commonMain.jetbrains.datalore.plot.base.geom.PolygonGeom.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lets-plot-common Show documentation
Show all versions of lets-plot-common Show documentation
Lets-Plot JVM package without rendering part
/*
* Copyright (c) 2020. JetBrains s.r.o.
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/
package jetbrains.datalore.plot.base.geom
import jetbrains.datalore.plot.base.*
import jetbrains.datalore.plot.base.geom.util.GeomUtil
import jetbrains.datalore.plot.base.geom.util.HintColorUtil
import jetbrains.datalore.plot.base.geom.util.LinePathConstructor
import jetbrains.datalore.plot.base.geom.util.LinesHelper
import jetbrains.datalore.plot.base.render.SvgRoot
open class PolygonGeom : GeomBase() {
protected fun dataPoints(aesthetics: Aesthetics): Iterable {
return GeomUtil.with_X_Y(aesthetics.dataPoints())
}
override fun buildIntern(
root: SvgRoot, aesthetics: Aesthetics, pos: PositionAdjustment, coord: CoordinateSystem,
ctx: GeomContext
) {
val dataPoints = dataPoints(aesthetics)
val targetCollector = getGeomTargetCollector(ctx)
val linesHelper = LinesHelper(pos, coord, ctx)
val geomConstructor =
LinePathConstructor(
targetCollector,
dataPoints,
linesHelper,
myClosePath = true,
HintColorUtil.createColorMarkerMapper(GeomKind.POLYGON, ctx),
ctx.flipped
)
appendNodes(
geomConstructor.construct(),
root
)
}
companion object {
const val HANDLES_GROUPS = true
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy