From fc2b4530e21d12779a65712f046bd2300ef964a0 Mon Sep 17 00:00:00 2001 From: Ilya Krukov Date: Mon, 10 Aug 2020 11:48:48 +0300 Subject: [PATCH 1/5] working 2 --- .../plot/builder/coord/CoordProviders.kt | 10 ++- .../builder/coord/ProjectionCoordProvider.kt | 82 +++++++++++++------ .../builder/coord/map/MercatorProjectionX.kt | 24 ++++++ .../kotlin/plot/builder/coord/CoordMapTest.kt | 58 ++++++------- .../plotDemo/model/plotConfig/MapGeom.kt | 62 ++++++++++++++ .../kotlin/plotDemo/plotConfig/MapGeomJfx.kt | 29 +++++++ 6 files changed, 212 insertions(+), 53 deletions(-) create mode 100644 plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/map/MercatorProjectionX.kt create mode 100644 plot-demo-common/src/commonMain/kotlin/jetbrains/datalore/plotDemo/model/plotConfig/MapGeom.kt create mode 100644 plot-demo/src/jvmJfxMain/kotlin/plotDemo/plotConfig/MapGeomJfx.kt diff --git a/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/CoordProviders.kt b/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/CoordProviders.kt index a8c549d5af2..abcf02cbb6a 100644 --- a/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/CoordProviders.kt +++ b/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/CoordProviders.kt @@ -6,6 +6,7 @@ package jetbrains.datalore.plot.builder.coord import jetbrains.datalore.base.gcommon.collect.ClosedRange +import jetbrains.datalore.plot.builder.coord.map.MercatorProjectionX import jetbrains.datalore.plot.builder.coord.map.MercatorProjectionY object CoordProviders { @@ -26,7 +27,14 @@ object CoordProviders { yLim: ClosedRange? = null ): CoordProvider { // Mercator projection is cylindrical thus we don't really need 'projection X' - return ProjectionCoordProvider.withProjectionY( +// return ProjectionCoordProvider.withProjectionY( +// MercatorProjectionY(), +// xLim, +// yLim +// ) + + return ProjectionCoordProvider.withProjectionXY( + MercatorProjectionX(), MercatorProjectionY(), xLim, yLim diff --git a/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/ProjectionCoordProvider.kt b/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/ProjectionCoordProvider.kt index afe8a13f6e9..ee0d81cfd20 100644 --- a/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/ProjectionCoordProvider.kt +++ b/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/ProjectionCoordProvider.kt @@ -6,6 +6,9 @@ package jetbrains.datalore.plot.builder.coord import jetbrains.datalore.base.gcommon.collect.ClosedRange +import jetbrains.datalore.base.geometry.DoubleVector +import jetbrains.datalore.base.spatial.MercatorUtils +import jetbrains.datalore.base.values.Pair import jetbrains.datalore.plot.base.Scale import jetbrains.datalore.plot.base.coord.Projection import jetbrains.datalore.plot.base.scale.Mappers @@ -13,12 +16,13 @@ import jetbrains.datalore.plot.builder.layout.axis.GuideBreaks import jetbrains.datalore.plot.common.data.SeriesUtil internal class ProjectionCoordProvider private constructor( - private val myProjectionX: Projection?, - private val myProjectionY: Projection?, + private val myProjectionX: Projection, + private val myProjectionY: Projection, xLim: ClosedRange?, yLim: ClosedRange? )// square grid - : FixedRatioCoordProvider(1.0, xLim, yLim) { +// : FixedRatioCoordProvider(1.0, xLim, yLim) { + : CoordProviderBase(xLim, yLim) { override fun buildAxisScaleX( scaleProto: Scale, @@ -26,15 +30,13 @@ internal class ProjectionCoordProvider private constructor( axisLength: Double, breaks: GuideBreaks ): Scale { - return if (myProjectionX != null) { - buildAxisScaleWithProjection( - myProjectionX, - scaleProto, - domain, - axisLength, - breaks - ) - } else super.buildAxisScaleX(scaleProto, domain, axisLength, breaks) + return buildAxisScaleWithProjection( + myProjectionX, + scaleProto, + domain, + axisLength, + breaks + ) } override fun buildAxisScaleY( @@ -43,25 +45,59 @@ internal class ProjectionCoordProvider private constructor( axisLength: Double, breaks: GuideBreaks ): Scale { - return if (myProjectionY != null) { - buildAxisScaleWithProjection( - myProjectionY, - scaleProto, - domain, - axisLength, - breaks - ) - } else super.buildAxisScaleY(scaleProto, domain, axisLength, breaks) + return buildAxisScaleWithProjection( + myProjectionY, + scaleProto, + domain, + axisLength, + breaks + ) + } + + + override fun adjustDomainsImpl( + xDomain: ClosedRange, + yDomain: ClosedRange, + displaySize: DoubleVector + ): Pair, ClosedRange> { + val dx = myProjectionX.apply(180.0) - myProjectionX.apply(-180.0) + val dy = myProjectionY.apply(85.0) - myProjectionY.apply(-85.0) + val orig_dx = 360.0 + val orig_dy = 170.0 + val ratio = (dy/dx ) / (orig_dy/orig_dx) + + val prvd = FixedRatioCoordProvider( ratio, null, null ) + return prvd.adjustDomains(xDomain, yDomain, displaySize) + +// val newDomainX = ClosedRange( myProjectionX.apply(-180.0), myProjectionX.apply(180.0)) +// val newDomainY = ClosedRange( myProjectionY.apply(-85.0), myProjectionY.apply(85.0)) +// val prvd = FixedRatioCoordProvider( 1.0 , null, null ) + +// return prvd.adjustDomains(newDomainX, newDomainY, displaySize) } companion object { - fun withProjectionY( +// fun withProjectionY( +// projectionY: Projection, +// xLim: ClosedRange?, +// yLim: ClosedRange? +// ): CoordProvider { +// return ProjectionCoordProvider( +// null, +// projectionY, +// xLim, +// yLim +// ) +// } + + fun withProjectionXY( + projectionX: Projection, projectionY: Projection, xLim: ClosedRange?, yLim: ClosedRange? ): CoordProvider { return ProjectionCoordProvider( - null, + projectionX, projectionY, xLim, yLim diff --git a/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/map/MercatorProjectionX.kt b/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/map/MercatorProjectionX.kt new file mode 100644 index 00000000000..54ae2943177 --- /dev/null +++ b/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/map/MercatorProjectionX.kt @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2019. 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.builder.coord.map + +import jetbrains.datalore.base.gcommon.collect.ClosedRange +import jetbrains.datalore.base.spatial.MercatorUtils.VALID_LONGITUDE_RANGE +import jetbrains.datalore.base.spatial.MercatorUtils.getMercatorX +import jetbrains.datalore.plot.base.coord.Projection + +class MercatorProjectionX : Projection { + override fun apply(v: Double): Double { + return getMercatorX(v) + } + + override fun toValidDomain(domain: ClosedRange): ClosedRange { + if (VALID_LONGITUDE_RANGE.isConnected(domain)) { + return VALID_LONGITUDE_RANGE.intersection(domain) + } + throw IllegalArgumentException("Illegal longitude range for mercator projection: $domain") + } +} diff --git a/plot-builder/src/jvmTest/kotlin/plot/builder/coord/CoordMapTest.kt b/plot-builder/src/jvmTest/kotlin/plot/builder/coord/CoordMapTest.kt index 20a9d193629..e0fe56b7039 100644 --- a/plot-builder/src/jvmTest/kotlin/plot/builder/coord/CoordMapTest.kt +++ b/plot-builder/src/jvmTest/kotlin/plot/builder/coord/CoordMapTest.kt @@ -20,35 +20,35 @@ internal class CoordMapTest : jetbrains.datalore.plot.builder.coord.CoordTestBas ) } - @Test - fun adjustDomains() { - // Coord Map keeps fixed ratio == 1 (equal X and Y) - val dataBounds = dataBounds - tryAdjustDomains(2.0, - PROVIDER, dataBounds.xRange(), - expand(dataBounds.yRange(), 2.0) - ) - tryAdjustDomains(0.5, - PROVIDER, - expand(dataBounds.xRange(), 2.0), dataBounds.yRange()) - } - - @Test - fun applyScales() { - // Map coord tries to keep grid square regardless of the display form factor - run { - val ratio = 2.0 - val shortSide = shortSideOfDisplay(ratio) - tryApplyScales(ratio, PROVIDER, - DoubleVector(0.0, 0.0), DoubleVector(shortSide, shortSide), DoubleVector(0.0, 1.0E-2)) - } - run { - val ratio = 0.5 - val shortSide = shortSideOfDisplay(ratio) - tryApplyScales(ratio, PROVIDER, - DoubleVector(0.0, 0.0), DoubleVector(shortSide, shortSide), DoubleVector(0.0, 1.0E-5)) - } - } +// @Test +// fun adjustDomains() { +// // Coord Map keeps fixed ratio == 1 (equal X and Y) +// val dataBounds = dataBounds +// tryAdjustDomains(2.0, +// PROVIDER, dataBounds.xRange(), +// expand(dataBounds.yRange(), 2.0) +// ) +// tryAdjustDomains(0.5, +// PROVIDER, +// expand(dataBounds.xRange(), 2.0), dataBounds.yRange()) +// } +// +// @Test +// fun applyScales() { +// // Map coord tries to keep grid square regardless of the display form factor +// run { +// val ratio = 2.0 +// val shortSide = shortSideOfDisplay(ratio) +// tryApplyScales(ratio, PROVIDER, +// DoubleVector(0.0, 0.0), DoubleVector(shortSide, shortSide), DoubleVector(0.0, 1.0E-2)) +// } +// run { +// val ratio = 0.5 +// val shortSide = shortSideOfDisplay(ratio) +// tryApplyScales(ratio, PROVIDER, +// DoubleVector(0.0, 0.0), DoubleVector(shortSide, shortSide), DoubleVector(0.0, 1.0E-5)) +// } +// } private fun shortSideOfDisplay(ratio: Double): Double { val displaySize = unitDisplaySize(ratio) diff --git a/plot-demo-common/src/commonMain/kotlin/jetbrains/datalore/plotDemo/model/plotConfig/MapGeom.kt b/plot-demo-common/src/commonMain/kotlin/jetbrains/datalore/plotDemo/model/plotConfig/MapGeom.kt new file mode 100644 index 00000000000..9562a87b2b0 --- /dev/null +++ b/plot-demo-common/src/commonMain/kotlin/jetbrains/datalore/plotDemo/model/plotConfig/MapGeom.kt @@ -0,0 +1,62 @@ +/* + * 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.plotDemo.model.plotConfig + +import jetbrains.datalore.plot.parsePlotSpec +import jetbrains.datalore.plotDemo.model.PlotConfigDemoBase + +@Suppress("DuplicatedCode") + +class MapGeom : PlotConfigDemoBase() { + fun plotSpecList(): List> { + return listOf( + rectDemo() + ) + } + + private fun rectDemo(): Map { + val spec = """ + { + "data": null, + "mapping": { + "x": null, + "y": null + }, + "data_meta": {}, + "kind": "plot", + "scales": [], + "layers": [ + { + "geom": "map", + "stat": null, + "data": { + "geometry": [ + "{\"type\": \"Polygon\", \"coordinates\": [[[-179.0, -77.0], [179.0, -77.0], [179.0, 77.0], [-179.0, 77.0], [-179.0, -77.0]]]}" + ] + }, + "mapping": { + "x": null, + "y": null + }, + "position": null, + "show_legend": false, + "tooltips": null, + "data_meta": { + "geodataframe": { + "geometry": "geometry" + } + }, + "sampling": null, + "map": null, + "map_join": null + } + ] + } + """.trimMargin() + + return parsePlotSpec(spec) + } +} \ No newline at end of file diff --git a/plot-demo/src/jvmJfxMain/kotlin/plotDemo/plotConfig/MapGeomJfx.kt b/plot-demo/src/jvmJfxMain/kotlin/plotDemo/plotConfig/MapGeomJfx.kt new file mode 100644 index 00000000000..65cf4967c98 --- /dev/null +++ b/plot-demo/src/jvmJfxMain/kotlin/plotDemo/plotConfig/MapGeomJfx.kt @@ -0,0 +1,29 @@ +/* + * 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.plotDemo.plotConfig + + +import jetbrains.datalore.base.geometry.DoubleVector +import jetbrains.datalore.plot.builder.presentation.Style.JFX_PLOT_STYLESHEET +import jetbrains.datalore.plotDemo.model.plotConfig.MapGeom +import jetbrains.datalore.vis.demoUtils.SceneMapperDemoFactory + +object MapGeomJfx { + @JvmStatic + fun main(args: Array) { + with(MapGeom()) { + @Suppress("UNCHECKED_CAST") + val plotSpecList = plotSpecList() as List> + @Suppress("SpellCheckingInspection") + PlotConfigDemoUtil.show( + "Polynomial regression", + plotSpecList, + SceneMapperDemoFactory(JFX_PLOT_STYLESHEET), + DoubleVector(600.0, 300.0) + ) + } + } +} From 7680cf4e1f53c166deae7720f526258e8c4fd707 Mon Sep 17 00:00:00 2001 From: Ilya Krukov Date: Tue, 11 Aug 2020 10:13:24 +0300 Subject: [PATCH 2/5] coord map fixed --- .../plot/builder/coord/CoordProviders.kt | 20 +++-- .../builder/coord/ProjectionCoordProvider.kt | 83 ++++++------------- .../builder/coord/map/MercatorProjectionX.kt | 24 ------ .../kotlin/plot/builder/coord/CoordMapTest.kt | 2 +- .../datalore/plot/config/CoordConfig.kt | 2 + .../datalore/plot/config/CoordProto.kt | 8 +- .../plot/config/GeomProtoClientSide.kt | 2 +- .../plot/config/PlotConfigClientSide.kt | 74 ++++++++++++++++- .../model/geom/PolygonWithCoordMapDemo.kt | 4 +- 9 files changed, 120 insertions(+), 99 deletions(-) delete mode 100644 plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/map/MercatorProjectionX.kt diff --git a/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/CoordProviders.kt b/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/CoordProviders.kt index abcf02cbb6a..a31914c0419 100644 --- a/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/CoordProviders.kt +++ b/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/CoordProviders.kt @@ -6,7 +6,6 @@ package jetbrains.datalore.plot.builder.coord import jetbrains.datalore.base.gcommon.collect.ClosedRange -import jetbrains.datalore.plot.builder.coord.map.MercatorProjectionX import jetbrains.datalore.plot.builder.coord.map.MercatorProjectionY object CoordProviders { @@ -23,21 +22,24 @@ object CoordProviders { } fun map( + ratio: Double, xLim: ClosedRange? = null, yLim: ClosedRange? = null ): CoordProvider { // Mercator projection is cylindrical thus we don't really need 'projection X' -// return ProjectionCoordProvider.withProjectionY( -// MercatorProjectionY(), -// xLim, -// yLim -// ) - - return ProjectionCoordProvider.withProjectionXY( - MercatorProjectionX(), + return ProjectionCoordProvider.withProjectionY( MercatorProjectionY(), + ratio, xLim, yLim ) + +// return ProjectionCoordProvider.withProjectionXY( +// MercatorProjectionX(), +// MercatorProjectionY(), +// ratio, +// xLim, +// yLim +// ) } } diff --git a/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/ProjectionCoordProvider.kt b/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/ProjectionCoordProvider.kt index ee0d81cfd20..b7d663d8779 100644 --- a/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/ProjectionCoordProvider.kt +++ b/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/ProjectionCoordProvider.kt @@ -16,13 +16,13 @@ import jetbrains.datalore.plot.builder.layout.axis.GuideBreaks import jetbrains.datalore.plot.common.data.SeriesUtil internal class ProjectionCoordProvider private constructor( - private val myProjectionX: Projection, - private val myProjectionY: Projection, + private val myProjectionX: Projection?, + private val myProjectionY: Projection?, + ratio: Double, xLim: ClosedRange?, yLim: ClosedRange? )// square grid -// : FixedRatioCoordProvider(1.0, xLim, yLim) { - : CoordProviderBase(xLim, yLim) { + : FixedRatioCoordProvider(ratio, xLim, yLim) { override fun buildAxisScaleX( scaleProto: Scale, @@ -30,13 +30,15 @@ internal class ProjectionCoordProvider private constructor( axisLength: Double, breaks: GuideBreaks ): Scale { - return buildAxisScaleWithProjection( - myProjectionX, - scaleProto, - domain, - axisLength, - breaks - ) + return if (myProjectionX != null) { + buildAxisScaleWithProjection( + myProjectionX, + scaleProto, + domain, + axisLength, + breaks + ) + } else super.buildAxisScaleX(scaleProto, domain, axisLength, breaks) } override fun buildAxisScaleY( @@ -45,66 +47,35 @@ internal class ProjectionCoordProvider private constructor( axisLength: Double, breaks: GuideBreaks ): Scale { - return buildAxisScaleWithProjection( - myProjectionY, - scaleProto, - domain, - axisLength, - breaks - ) + return if (myProjectionY != null) { + buildAxisScaleWithProjection( + myProjectionY, + scaleProto, + domain, + axisLength, + breaks + ) + } else super.buildAxisScaleY(scaleProto, domain, axisLength, breaks) } - override fun adjustDomainsImpl( - xDomain: ClosedRange, - yDomain: ClosedRange, - displaySize: DoubleVector - ): Pair, ClosedRange> { - val dx = myProjectionX.apply(180.0) - myProjectionX.apply(-180.0) - val dy = myProjectionY.apply(85.0) - myProjectionY.apply(-85.0) - val orig_dx = 360.0 - val orig_dy = 170.0 - val ratio = (dy/dx ) / (orig_dy/orig_dx) - - val prvd = FixedRatioCoordProvider( ratio, null, null ) - return prvd.adjustDomains(xDomain, yDomain, displaySize) - -// val newDomainX = ClosedRange( myProjectionX.apply(-180.0), myProjectionX.apply(180.0)) -// val newDomainY = ClosedRange( myProjectionY.apply(-85.0), myProjectionY.apply(85.0)) -// val prvd = FixedRatioCoordProvider( 1.0 , null, null ) - -// return prvd.adjustDomains(newDomainX, newDomainY, displaySize) - } - companion object { -// fun withProjectionY( -// projectionY: Projection, -// xLim: ClosedRange?, -// yLim: ClosedRange? -// ): CoordProvider { -// return ProjectionCoordProvider( -// null, -// projectionY, -// xLim, -// yLim -// ) -// } - - fun withProjectionXY( - projectionX: Projection, + fun withProjectionY( projectionY: Projection, + ratio: Double, xLim: ClosedRange?, yLim: ClosedRange? ): CoordProvider { return ProjectionCoordProvider( - projectionX, + null, projectionY, + ratio, xLim, yLim ) } - private fun buildAxisScaleWithProjection( + private fun buildAxisScaleWithProjection( projection: Projection, scaleProto: Scale, domain: ClosedRange, axisLength: Double, breaks: GuideBreaks ): Scale { diff --git a/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/map/MercatorProjectionX.kt b/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/map/MercatorProjectionX.kt deleted file mode 100644 index 54ae2943177..00000000000 --- a/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/map/MercatorProjectionX.kt +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2019. 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.builder.coord.map - -import jetbrains.datalore.base.gcommon.collect.ClosedRange -import jetbrains.datalore.base.spatial.MercatorUtils.VALID_LONGITUDE_RANGE -import jetbrains.datalore.base.spatial.MercatorUtils.getMercatorX -import jetbrains.datalore.plot.base.coord.Projection - -class MercatorProjectionX : Projection { - override fun apply(v: Double): Double { - return getMercatorX(v) - } - - override fun toValidDomain(domain: ClosedRange): ClosedRange { - if (VALID_LONGITUDE_RANGE.isConnected(domain)) { - return VALID_LONGITUDE_RANGE.intersection(domain) - } - throw IllegalArgumentException("Illegal longitude range for mercator projection: $domain") - } -} diff --git a/plot-builder/src/jvmTest/kotlin/plot/builder/coord/CoordMapTest.kt b/plot-builder/src/jvmTest/kotlin/plot/builder/coord/CoordMapTest.kt index e0fe56b7039..0b0d2db5d0b 100644 --- a/plot-builder/src/jvmTest/kotlin/plot/builder/coord/CoordMapTest.kt +++ b/plot-builder/src/jvmTest/kotlin/plot/builder/coord/CoordMapTest.kt @@ -56,7 +56,7 @@ internal class CoordMapTest : jetbrains.datalore.plot.builder.coord.CoordTestBas } companion object { - private val PROVIDER = CoordProviders.map() + private val PROVIDER = CoordProviders.map(1.0) private val DATA_SPAN = DoubleVector(10.0, 10.0) } diff --git a/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/CoordConfig.kt b/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/CoordConfig.kt index 3dce03ea507..9c75de38ec6 100644 --- a/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/CoordConfig.kt +++ b/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/CoordConfig.kt @@ -27,5 +27,7 @@ class CoordConfig private constructor(name: String, options: Map) : private fun createForName(name: String, options: Map): CoordConfig { return CoordConfig(name, options) } + + } } diff --git a/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/CoordProto.kt b/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/CoordProto.kt index 8d39aa7afa3..5eac382fa18 100644 --- a/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/CoordProto.kt +++ b/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/CoordProto.kt @@ -14,9 +14,9 @@ import jetbrains.datalore.plot.config.Option.CoordName.MAP internal object CoordProto { // option names - private const val X_LIM = "xlim" - private const val Y_LIM = "ylim" - private const val RATIO = "ratio" + const val X_LIM = "xlim" + const val Y_LIM = "ylim" + const val RATIO = "ratio" private const val EXPAND = "expand" // todo private const val ORIENTATION = "orientation" // todo private const val PROJECTION = "projection" // todo @@ -27,7 +27,7 @@ internal object CoordProto { return when (coordName) { CARTESIAN -> CoordProviders.cartesian(xLim, yLim) FIXED -> CoordProviders.fixed(options.getDouble(RATIO) ?: 1.0, xLim, yLim) - MAP -> CoordProviders.map(xLim, yLim) + MAP -> CoordProviders.map(options.getDouble(RATIO) ?: 1.0, xLim, yLim) else -> throw IllegalArgumentException("Unknown coordinate system name: '$coordName'") } } diff --git a/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/GeomProtoClientSide.kt b/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/GeomProtoClientSide.kt index aaed03986fc..6510a3af58f 100644 --- a/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/GeomProtoClientSide.kt +++ b/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/GeomProtoClientSide.kt @@ -35,7 +35,7 @@ class GeomProtoClientSide(geomKind: GeomKind) : GeomProto(geomKind) { GeomKind.RASTER, GeomKind.IMAGE -> CoordProviders.fixed(1.0) - GeomKind.MAP -> CoordProviders.map() +// GeomKind.MAP -> CoordProviders.map() else -> null } diff --git a/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/PlotConfigClientSide.kt b/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/PlotConfigClientSide.kt index bf86c0e2ad0..1e8f2d9b30e 100644 --- a/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/PlotConfigClientSide.kt +++ b/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/PlotConfigClientSide.kt @@ -7,6 +7,7 @@ package jetbrains.datalore.plot.config import jetbrains.datalore.plot.base.Aes import jetbrains.datalore.plot.base.DataFrame +import jetbrains.datalore.plot.base.GeomKind import jetbrains.datalore.plot.builder.assemble.GuideOptions import jetbrains.datalore.plot.builder.assemble.TypedScaleProviderMap import jetbrains.datalore.plot.builder.coord.CoordProvider @@ -17,6 +18,10 @@ import jetbrains.datalore.plot.config.PlotConfigClientSideUtil.createGuideOption import jetbrains.datalore.plot.config.theme.ThemeConfig import jetbrains.datalore.plot.config.transform.PlotSpecTransform import jetbrains.datalore.plot.config.transform.migration.MoveGeomPropertiesToLayerMigration +import jetbrains.datalore.base.gcommon.collect.ClosedRange +import jetbrains.datalore.plot.common.data.SeriesUtil.span +import jetbrains.datalore.base.spatial.MercatorUtils.getMercatorX +import jetbrains.datalore.base.spatial.MercatorUtils.getMercatorY class PlotConfigClientSide private constructor(opts: Map) : PlotConfig(opts) { @@ -28,20 +33,83 @@ class PlotConfigClientSide private constructor(opts: Map) : PlotCon get() = true init { + coordProvider = createCoordProvider() + guideOptionsMap = createGuideOptionsMap(this.scaleConfigs) + } + private fun createCoordProvider(): CoordProvider { val coord = CoordConfig.create(get(COORD)!!) var coordProvider = coord.coord if (!hasOwn(COORD)) { // if coord wasn't set explicitly then geom can provide its own preferred coord system for (layerConfig in layerConfigs) { val geomProtoClientSide = layerConfig.geomProto as GeomProtoClientSide - if (geomProtoClientSide.hasPreferredCoordinateSystem()) { + if (layerConfig.geomProto.geomKind == GeomKind.MAP) { + val data = layerConfig.combinedData + val varX = layerConfig.getVariableForAes(Aes.X) + val varY = layerConfig.getVariableForAes(Aes.Y) + + if (varX != null && varY != null) { + val xRange = data.range(varX) + val yRange = data.range(varY) + + val xLim = getRangeOrNull(CoordProto.X_LIM) + val yLim = getRangeOrNull(CoordProto.Y_LIM) + + coordProvider = getMapCoordinateProvider(xRange!!, yRange!!, xLim, yLim) + } + } else if (geomProtoClientSide.hasPreferredCoordinateSystem()) { coordProvider = geomProtoClientSide.preferredCoordinateSystem() } } } - this.coordProvider = coordProvider - guideOptionsMap = createGuideOptionsMap(this.scaleConfigs) + + return coordProvider + } + + private fun getMapCoordinateProvider( + xDomain: ClosedRange, + yDomain: ClosedRange, + xLim: ClosedRange?, + yLim: ClosedRange? + ): CoordProvider { + val projDX = span( + doProjection({ getMercatorX(it) }, xDomain)!! + ) + + val projDY = span( + doProjection({ getMercatorY(it) }, yDomain)!! + ) + + val dx = span(xDomain) + val dy = span(yDomain) + + val ratio = (projDY / projDX) / (dy / dx) + + @Suppress("NAME_SHADOWING") + val xLim = doProjection({ getMercatorX(it) }, xLim) + @Suppress("NAME_SHADOWING") + val yLim = doProjection({ getMercatorY(it) }, yLim) + + val opts: MutableMap = mutableMapOf( + Option.Meta.NAME to Option.CoordName.MAP, + CoordProto.RATIO to ratio + ) + + if (xLim != null) { + opts[CoordProto.X_LIM] = xLim + } + + if (yLim != null) { + opts[CoordProto.Y_LIM] = yLim + } + + + return CoordConfig.create(opts).coord + } + + private fun doProjection(proj: ((Double) -> Double), range: ClosedRange?) = range?.let { + ClosedRange(proj(range.lowerEnd), proj(range.upperEnd)) } override fun createLayerConfig( diff --git a/plot-demo/src/commonMain/kotlin/jetbrains/datalore/plotDemo/model/geom/PolygonWithCoordMapDemo.kt b/plot-demo/src/commonMain/kotlin/jetbrains/datalore/plotDemo/model/geom/PolygonWithCoordMapDemo.kt index 29ca9266567..48de2927ce8 100644 --- a/plot-demo/src/commonMain/kotlin/jetbrains/datalore/plotDemo/model/geom/PolygonWithCoordMapDemo.kt +++ b/plot-demo/src/commonMain/kotlin/jetbrains/datalore/plotDemo/model/geom/PolygonWithCoordMapDemo.kt @@ -80,7 +80,9 @@ open class PolygonWithCoordMapDemo : SimpleDemoBase() { .color(constant(Color.DARK_MAGENTA)) .alpha(constant(0.5)) .build() - val coord = CoordProviders.map() + + + val coord = CoordProviders.map(1.0) // FIX ME! .createCoordinateSystem(domainX, lengthX, domainY, lengthY) val layer = jetbrains.datalore.plot.builder.SvgLayerRenderer( aes, From b7c83082fc22018013fe0e9efb2ce3be470b29e4 Mon Sep 17 00:00:00 2001 From: Ilya Krukov Date: Tue, 11 Aug 2020 11:03:34 +0300 Subject: [PATCH 3/5] Coord map code cleanup. --- .../plot/builder/coord/CoordProviders.kt | 8 --- .../builder/coord/ProjectionCoordProvider.kt | 2 +- .../kotlin/plot/builder/coord/CoordMapTest.kt | 58 +++++++++---------- .../datalore/plot/config/CoordConfig.kt | 5 +- .../plot/config/PlotConfigClientSide.kt | 50 +--------------- .../plot/config/PlotConfigClientSideUtil.kt | 52 ++++++++++++++++- .../model/geom/PolygonWithCoordMapDemo.kt | 6 +- 7 files changed, 88 insertions(+), 93 deletions(-) diff --git a/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/CoordProviders.kt b/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/CoordProviders.kt index a31914c0419..e3c169c9541 100644 --- a/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/CoordProviders.kt +++ b/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/CoordProviders.kt @@ -33,13 +33,5 @@ object CoordProviders { xLim, yLim ) - -// return ProjectionCoordProvider.withProjectionXY( -// MercatorProjectionX(), -// MercatorProjectionY(), -// ratio, -// xLim, -// yLim -// ) } } diff --git a/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/ProjectionCoordProvider.kt b/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/ProjectionCoordProvider.kt index b7d663d8779..731fd0352b3 100644 --- a/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/ProjectionCoordProvider.kt +++ b/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/coord/ProjectionCoordProvider.kt @@ -75,7 +75,7 @@ internal class ProjectionCoordProvider private constructor( ) } - private fun buildAxisScaleWithProjection( + private fun buildAxisScaleWithProjection( projection: Projection, scaleProto: Scale, domain: ClosedRange, axisLength: Double, breaks: GuideBreaks ): Scale { diff --git a/plot-builder/src/jvmTest/kotlin/plot/builder/coord/CoordMapTest.kt b/plot-builder/src/jvmTest/kotlin/plot/builder/coord/CoordMapTest.kt index 0b0d2db5d0b..bee89fdc68f 100644 --- a/plot-builder/src/jvmTest/kotlin/plot/builder/coord/CoordMapTest.kt +++ b/plot-builder/src/jvmTest/kotlin/plot/builder/coord/CoordMapTest.kt @@ -20,35 +20,35 @@ internal class CoordMapTest : jetbrains.datalore.plot.builder.coord.CoordTestBas ) } -// @Test -// fun adjustDomains() { -// // Coord Map keeps fixed ratio == 1 (equal X and Y) -// val dataBounds = dataBounds -// tryAdjustDomains(2.0, -// PROVIDER, dataBounds.xRange(), -// expand(dataBounds.yRange(), 2.0) -// ) -// tryAdjustDomains(0.5, -// PROVIDER, -// expand(dataBounds.xRange(), 2.0), dataBounds.yRange()) -// } -// -// @Test -// fun applyScales() { -// // Map coord tries to keep grid square regardless of the display form factor -// run { -// val ratio = 2.0 -// val shortSide = shortSideOfDisplay(ratio) -// tryApplyScales(ratio, PROVIDER, -// DoubleVector(0.0, 0.0), DoubleVector(shortSide, shortSide), DoubleVector(0.0, 1.0E-2)) -// } -// run { -// val ratio = 0.5 -// val shortSide = shortSideOfDisplay(ratio) -// tryApplyScales(ratio, PROVIDER, -// DoubleVector(0.0, 0.0), DoubleVector(shortSide, shortSide), DoubleVector(0.0, 1.0E-5)) -// } -// } + @Test + fun adjustDomains() { + // Coord Map keeps fixed ratio == 1 (equal X and Y) + val dataBounds = dataBounds + tryAdjustDomains(2.0, + PROVIDER, dataBounds.xRange(), + expand(dataBounds.yRange(), 2.0) + ) + tryAdjustDomains(0.5, + PROVIDER, + expand(dataBounds.xRange(), 2.0), dataBounds.yRange()) + } + + @Test + fun applyScales() { + // Map coord tries to keep grid square regardless of the display form factor + run { + val ratio = 2.0 + val shortSide = shortSideOfDisplay(ratio) + tryApplyScales(ratio, PROVIDER, + DoubleVector(0.0, 0.0), DoubleVector(shortSide, shortSide), DoubleVector(0.0, 1.0E-2)) + } + run { + val ratio = 0.5 + val shortSide = shortSideOfDisplay(ratio) + tryApplyScales(ratio, PROVIDER, + DoubleVector(0.0, 0.0), DoubleVector(shortSide, shortSide), DoubleVector(0.0, 1.0E-5)) + } + } private fun shortSideOfDisplay(ratio: Double): Double { val displaySize = unitDisplaySize(ratio) diff --git a/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/CoordConfig.kt b/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/CoordConfig.kt index 9c75de38ec6..175251a2c11 100644 --- a/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/CoordConfig.kt +++ b/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/CoordConfig.kt @@ -7,7 +7,8 @@ package jetbrains.datalore.plot.config import jetbrains.datalore.plot.builder.coord.CoordProvider -class CoordConfig private constructor(name: String, options: Map) : OptionsAccessor(options, emptyMap()) { +class CoordConfig private constructor(name: String, options: Map) : + OptionsAccessor(options, emptyMap()) { val coord: CoordProvider = CoordProto.createCoordProvider(name, this) @@ -27,7 +28,5 @@ class CoordConfig private constructor(name: String, options: Map) : private fun createForName(name: String, options: Map): CoordConfig { return CoordConfig(name, options) } - - } } diff --git a/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/PlotConfigClientSide.kt b/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/PlotConfigClientSide.kt index 1e8f2d9b30e..9990cb0dd52 100644 --- a/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/PlotConfigClientSide.kt +++ b/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/PlotConfigClientSide.kt @@ -18,10 +18,7 @@ import jetbrains.datalore.plot.config.PlotConfigClientSideUtil.createGuideOption import jetbrains.datalore.plot.config.theme.ThemeConfig import jetbrains.datalore.plot.config.transform.PlotSpecTransform import jetbrains.datalore.plot.config.transform.migration.MoveGeomPropertiesToLayerMigration -import jetbrains.datalore.base.gcommon.collect.ClosedRange -import jetbrains.datalore.plot.common.data.SeriesUtil.span -import jetbrains.datalore.base.spatial.MercatorUtils.getMercatorX -import jetbrains.datalore.base.spatial.MercatorUtils.getMercatorY +import jetbrains.datalore.plot.config.PlotConfigClientSideUtil.getMapCoordinateProvider class PlotConfigClientSide private constructor(opts: Map) : PlotConfig(opts) { @@ -67,51 +64,6 @@ class PlotConfigClientSide private constructor(opts: Map) : PlotCon return coordProvider } - private fun getMapCoordinateProvider( - xDomain: ClosedRange, - yDomain: ClosedRange, - xLim: ClosedRange?, - yLim: ClosedRange? - ): CoordProvider { - val projDX = span( - doProjection({ getMercatorX(it) }, xDomain)!! - ) - - val projDY = span( - doProjection({ getMercatorY(it) }, yDomain)!! - ) - - val dx = span(xDomain) - val dy = span(yDomain) - - val ratio = (projDY / projDX) / (dy / dx) - - @Suppress("NAME_SHADOWING") - val xLim = doProjection({ getMercatorX(it) }, xLim) - @Suppress("NAME_SHADOWING") - val yLim = doProjection({ getMercatorY(it) }, yLim) - - val opts: MutableMap = mutableMapOf( - Option.Meta.NAME to Option.CoordName.MAP, - CoordProto.RATIO to ratio - ) - - if (xLim != null) { - opts[CoordProto.X_LIM] = xLim - } - - if (yLim != null) { - opts[CoordProto.Y_LIM] = yLim - } - - - return CoordConfig.create(opts).coord - } - - private fun doProjection(proj: ((Double) -> Double), range: ClosedRange?) = range?.let { - ClosedRange(proj(range.lowerEnd), proj(range.upperEnd)) - } - override fun createLayerConfig( layerOptions: Map<*, *>, sharedData: DataFrame, diff --git a/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/PlotConfigClientSideUtil.kt b/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/PlotConfigClientSideUtil.kt index 24c9941fb15..42cc5f37922 100644 --- a/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/PlotConfigClientSideUtil.kt +++ b/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/PlotConfigClientSideUtil.kt @@ -6,6 +6,8 @@ package jetbrains.datalore.plot.config import jetbrains.datalore.base.gcommon.base.Preconditions.checkState +import jetbrains.datalore.base.gcommon.collect.ClosedRange +import jetbrains.datalore.base.spatial.MercatorUtils import jetbrains.datalore.plot.base.Aes import jetbrains.datalore.plot.base.DataFrame import jetbrains.datalore.plot.base.GeomKind @@ -15,7 +17,9 @@ import jetbrains.datalore.plot.builder.assemble.GeomLayerBuilder import jetbrains.datalore.plot.builder.assemble.GuideOptions import jetbrains.datalore.plot.builder.assemble.PlotAssembler import jetbrains.datalore.plot.builder.assemble.TypedScaleProviderMap +import jetbrains.datalore.plot.builder.coord.CoordProvider import jetbrains.datalore.plot.builder.interact.GeomInteraction +import jetbrains.datalore.plot.common.data.SeriesUtil object PlotConfigClientSideUtil { internal fun createGuideOptionsMap(scaleConfigs: List>): Map, GuideOptions> { @@ -68,7 +72,8 @@ object PlotConfigClientSideUtil { if (layerBuilders.size == layerIndex) { val layerConfig = cfg.layerConfigs[layerIndex] - val geomInteraction = GeomInteractionUtil.configGeomTargets(layerConfig, isMultilayer, isLiveMap, cfg.theme) + val geomInteraction = + GeomInteractionUtil.configGeomTargets(layerConfig, isMultilayer, isLiveMap, cfg.theme) layerBuilders.add(createLayerBuilder(layerConfig, scaleProvidersMap, geomInteraction)) } @@ -137,4 +142,49 @@ object PlotConfigClientSideUtil { return layerBuilder } + + private fun doProjection(proj: ((Double) -> Double), range: ClosedRange?) = range?.let { + ClosedRange(proj(range.lowerEnd), proj(range.upperEnd)) + } + + fun getMapCoordinateProvider( + xDomain: ClosedRange, + yDomain: ClosedRange, + xLim: ClosedRange?, + yLim: ClosedRange? + ): CoordProvider { + val projDX = SeriesUtil.span( + doProjection({ MercatorUtils.getMercatorX(it) }, xDomain)!! + ) + + val projDY = SeriesUtil.span( + doProjection({ MercatorUtils.getMercatorY(it) }, yDomain)!! + ) + + val dx = SeriesUtil.span(xDomain) + val dy = SeriesUtil.span(yDomain) + + val ratio = (projDY / projDX) / (dy / dx) + + @Suppress("NAME_SHADOWING") + val xLim = doProjection({ MercatorUtils.getMercatorX(it) }, xLim) + + @Suppress("NAME_SHADOWING") + val yLim = doProjection({ MercatorUtils.getMercatorY(it) }, yLim) + + val opts: MutableMap = mutableMapOf( + Option.Meta.NAME to Option.CoordName.MAP, + CoordProto.RATIO to ratio + ) + + if (xLim != null) { + opts[CoordProto.X_LIM] = xLim + } + + if (yLim != null) { + opts[CoordProto.Y_LIM] = yLim + } + + return CoordConfig.create(opts).coord + } } diff --git a/plot-demo/src/commonMain/kotlin/jetbrains/datalore/plotDemo/model/geom/PolygonWithCoordMapDemo.kt b/plot-demo/src/commonMain/kotlin/jetbrains/datalore/plotDemo/model/geom/PolygonWithCoordMapDemo.kt index 48de2927ce8..fb018384cc3 100644 --- a/plot-demo/src/commonMain/kotlin/jetbrains/datalore/plotDemo/model/geom/PolygonWithCoordMapDemo.kt +++ b/plot-demo/src/commonMain/kotlin/jetbrains/datalore/plotDemo/model/geom/PolygonWithCoordMapDemo.kt @@ -19,6 +19,7 @@ import jetbrains.datalore.plot.base.scale.Mappers import jetbrains.datalore.plot.builder.coord.CoordProviders import jetbrains.datalore.plot.builder.scale.mapper.ColorMapper import jetbrains.datalore.plot.common.data.SeriesUtil +import jetbrains.datalore.plot.config.PlotConfigClientSideUtil.getMapCoordinateProvider import jetbrains.datalore.plotDemo.data.KansasPolygon.KANSAS_X import jetbrains.datalore.plotDemo.data.KansasPolygon.KANSAS_Y import jetbrains.datalore.plotDemo.model.SimpleDemoBase @@ -81,9 +82,10 @@ open class PolygonWithCoordMapDemo : SimpleDemoBase() { .alpha(constant(0.5)) .build() - - val coord = CoordProviders.map(1.0) // FIX ME! + val coord = getMapCoordinateProvider(domainX, domainY, null, null) .createCoordinateSystem(domainX, lengthX, domainY, lengthY) + + val layer = jetbrains.datalore.plot.builder.SvgLayerRenderer( aes, PolygonGeom(), From 5536db82a501141611e7c9d798d70353e94d0bc4 Mon Sep 17 00:00:00 2001 From: Ilya Krukov Date: Tue, 11 Aug 2020 11:29:21 +0300 Subject: [PATCH 4/5] Remove debug files. --- .../plotDemo/model/plotConfig/MapGeom.kt | 62 ------------------- .../kotlin/plotDemo/plotConfig/MapGeomJfx.kt | 29 --------- 2 files changed, 91 deletions(-) delete mode 100644 plot-demo-common/src/commonMain/kotlin/jetbrains/datalore/plotDemo/model/plotConfig/MapGeom.kt delete mode 100644 plot-demo/src/jvmJfxMain/kotlin/plotDemo/plotConfig/MapGeomJfx.kt diff --git a/plot-demo-common/src/commonMain/kotlin/jetbrains/datalore/plotDemo/model/plotConfig/MapGeom.kt b/plot-demo-common/src/commonMain/kotlin/jetbrains/datalore/plotDemo/model/plotConfig/MapGeom.kt deleted file mode 100644 index 9562a87b2b0..00000000000 --- a/plot-demo-common/src/commonMain/kotlin/jetbrains/datalore/plotDemo/model/plotConfig/MapGeom.kt +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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.plotDemo.model.plotConfig - -import jetbrains.datalore.plot.parsePlotSpec -import jetbrains.datalore.plotDemo.model.PlotConfigDemoBase - -@Suppress("DuplicatedCode") - -class MapGeom : PlotConfigDemoBase() { - fun plotSpecList(): List> { - return listOf( - rectDemo() - ) - } - - private fun rectDemo(): Map { - val spec = """ - { - "data": null, - "mapping": { - "x": null, - "y": null - }, - "data_meta": {}, - "kind": "plot", - "scales": [], - "layers": [ - { - "geom": "map", - "stat": null, - "data": { - "geometry": [ - "{\"type\": \"Polygon\", \"coordinates\": [[[-179.0, -77.0], [179.0, -77.0], [179.0, 77.0], [-179.0, 77.0], [-179.0, -77.0]]]}" - ] - }, - "mapping": { - "x": null, - "y": null - }, - "position": null, - "show_legend": false, - "tooltips": null, - "data_meta": { - "geodataframe": { - "geometry": "geometry" - } - }, - "sampling": null, - "map": null, - "map_join": null - } - ] - } - """.trimMargin() - - return parsePlotSpec(spec) - } -} \ No newline at end of file diff --git a/plot-demo/src/jvmJfxMain/kotlin/plotDemo/plotConfig/MapGeomJfx.kt b/plot-demo/src/jvmJfxMain/kotlin/plotDemo/plotConfig/MapGeomJfx.kt deleted file mode 100644 index 65cf4967c98..00000000000 --- a/plot-demo/src/jvmJfxMain/kotlin/plotDemo/plotConfig/MapGeomJfx.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.plotDemo.plotConfig - - -import jetbrains.datalore.base.geometry.DoubleVector -import jetbrains.datalore.plot.builder.presentation.Style.JFX_PLOT_STYLESHEET -import jetbrains.datalore.plotDemo.model.plotConfig.MapGeom -import jetbrains.datalore.vis.demoUtils.SceneMapperDemoFactory - -object MapGeomJfx { - @JvmStatic - fun main(args: Array) { - with(MapGeom()) { - @Suppress("UNCHECKED_CAST") - val plotSpecList = plotSpecList() as List> - @Suppress("SpellCheckingInspection") - PlotConfigDemoUtil.show( - "Polynomial regression", - plotSpecList, - SceneMapperDemoFactory(JFX_PLOT_STYLESHEET), - DoubleVector(600.0, 300.0) - ) - } - } -} From b56c1d5947e98b756bdf0d3a2b35395461c45d3d Mon Sep 17 00:00:00 2001 From: Ilya Krukov Date: Tue, 11 Aug 2020 11:34:39 +0300 Subject: [PATCH 5/5] Remove preferredCoord system for map --- .../jetbrains/datalore/plot/config/GeomProtoClientSide.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/GeomProtoClientSide.kt b/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/GeomProtoClientSide.kt index 6510a3af58f..80f92f4d676 100644 --- a/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/GeomProtoClientSide.kt +++ b/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/config/GeomProtoClientSide.kt @@ -35,8 +35,6 @@ class GeomProtoClientSide(geomKind: GeomKind) : GeomProto(geomKind) { GeomKind.RASTER, GeomKind.IMAGE -> CoordProviders.fixed(1.0) -// GeomKind.MAP -> CoordProviders.map() - else -> null }