From: jsimomaa Date: Mon, 13 May 2019 09:10:46 +0000 (+0300) Subject: First version of elevation server based on GeoTIFF files X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=c6ddbec532645f52583c1ab9691cfb802724fca7;p=simantics%2Fdistrict.git First version of elevation server based on GeoTIFF files gitlab #45 APROS-15308 Change-Id: I7aba5526bd45396967bbae8ed26e41934efef47f --- diff --git a/org.simantics.district.geotools/.classpath b/org.simantics.district.geotools/.classpath index b7283c77..29b4b7aa 100644 --- a/org.simantics.district.geotools/.classpath +++ b/org.simantics.district.geotools/.classpath @@ -1,5 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org.simantics.district.geotools/META-INF/MANIFEST.MF b/org.simantics.district.geotools/META-INF/MANIFEST.MF index 05b21c22..6bf0695b 100644 --- a/org.simantics.district.geotools/META-INF/MANIFEST.MF +++ b/org.simantics.district.geotools/META-INF/MANIFEST.MF @@ -19,7 +19,52 @@ Bundle-ClassPath: lib/commons-pool-1.5.4.jar, lib/jts-1.13.jar, ., lib/gt-epsg-hsql-16.0.jar, - lib/hsqldb-2.3.4.jar + lib/hsqldb-2.3.4.jar, + lib/commons-io-2.1.jar, + lib/gt-api-16.0.jar, + lib/gt-coverage-16.0.jar, + lib/gt-geotiff-16.0.jar, + lib/gt-main-16.0.jar, + lib/guava-17.0.jar, + lib/imageio-ext-geocore-1.1.16.jar, + lib/imageio-ext-streams-1.1.16.jar, + lib/imageio-ext-tiff-1.1.16.jar, + lib/imageio-ext-utilities-1.1.16.jar, + lib/jai_codec-1.1.3.jar, + lib/jai_imageio-1.1.jar, + lib/jdom-1.1.3.jar, + lib/jt-affine-1.0.11.jar, + lib/jt-algebra-1.0.11.jar, + lib/jt-bandcombine-1.0.11.jar, + lib/jt-bandmerge-1.0.11.jar, + lib/jt-bandselect-1.0.11.jar, + lib/jt-binarize-1.0.11.jar, + lib/jt-border-1.0.11.jar, + lib/jt-buffer-1.0.11.jar, + lib/jt-classifier-1.0.11.jar, + lib/jt-colorconvert-1.0.11.jar, + lib/jt-colorindexer-1.0.11.jar, + lib/jt-crop-1.0.11.jar, + lib/jt-errordiffusion-1.0.11.jar, + lib/jt-format-1.0.11.jar, + lib/jt-imagefunction-1.0.11.jar, + lib/jt-iterators-1.0.11.jar, + lib/jt-lookup-1.0.11.jar, + lib/jt-mosaic-1.0.11.jar, + lib/jt-nullop-1.0.11.jar, + lib/jt-orderdither-1.0.11.jar, + lib/jt-piecewise-1.0.11.jar, + lib/jt-rescale-1.0.11.jar, + lib/jt-rlookup-1.0.11.jar, + lib/jt-scale-1.0.11.jar, + lib/jt-stats-1.0.11.jar, + lib/jt-translate-1.0.11.jar, + lib/jt-utilities-1.0.11.jar, + lib/jt-utils-1.4.0.jar, + lib/jt-vectorbin-1.0.11.jar, + lib/jt-warp-1.0.11.jar, + lib/jt-zonal-1.0.11.jar, + lib/jt-zonalstats-1.4.0.jar Export-Package: com.vividsolutions.jts, com.vividsolutions.jts.geom, com.vividsolutions.jts.geom.impl, @@ -28,6 +73,13 @@ Export-Package: com.vividsolutions.jts, com.vividsolutions.jts.geomgraph, com.vividsolutions.jts.geomgraph.index, com.vividsolutions.jts.index.quadtree, + com.vividsolutions.jts.index.strtree, + it.geosolutions.imageio.stream.input.spi, + it.geosolutions.imageio.stream.output.spi, + org.geotools.coverage, + org.geotools.coverage.grid, + org.geotools.coverage.grid.io, + org.geotools.gce.geotiff, org.geotools.geometry, org.geotools.referencing, org.opengis.geometry, diff --git a/org.simantics.district.geotools/build.properties b/org.simantics.district.geotools/build.properties index efaa0a7f..8741e47a 100644 --- a/org.simantics.district.geotools/build.properties +++ b/org.simantics.district.geotools/build.properties @@ -2,4 +2,49 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ - lib/ + lib/,\ + lib/commons-io-2.1.jar,\ + lib/gt-api-16.0.jar,\ + lib/gt-coverage-16.0.jar,\ + lib/gt-geotiff-16.0.jar,\ + lib/gt-main-16.0.jar,\ + lib/guava-17.0.jar,\ + lib/imageio-ext-geocore-1.1.16.jar,\ + lib/imageio-ext-streams-1.1.16.jar,\ + lib/imageio-ext-tiff-1.1.16.jar,\ + lib/imageio-ext-utilities-1.1.16.jar,\ + lib/jai_codec-1.1.3.jar,\ + lib/jai_imageio-1.1.jar,\ + lib/jdom-1.1.3.jar,\ + lib/jt-affine-1.0.11.jar,\ + lib/jt-algebra-1.0.11.jar,\ + lib/jt-bandcombine-1.0.11.jar,\ + lib/jt-bandmerge-1.0.11.jar,\ + lib/jt-bandselect-1.0.11.jar,\ + lib/jt-binarize-1.0.11.jar,\ + lib/jt-border-1.0.11.jar,\ + lib/jt-buffer-1.0.11.jar,\ + lib/jt-classifier-1.0.11.jar,\ + lib/jt-colorconvert-1.0.11.jar,\ + lib/jt-colorindexer-1.0.11.jar,\ + lib/jt-crop-1.0.11.jar,\ + lib/jt-errordiffusion-1.0.11.jar,\ + lib/jt-format-1.0.11.jar,\ + lib/jt-imagefunction-1.0.11.jar,\ + lib/jt-iterators-1.0.11.jar,\ + lib/jt-lookup-1.0.11.jar,\ + lib/jt-mosaic-1.0.11.jar,\ + lib/jt-nullop-1.0.11.jar,\ + lib/jt-orderdither-1.0.11.jar,\ + lib/jt-piecewise-1.0.11.jar,\ + lib/jt-rescale-1.0.11.jar,\ + lib/jt-rlookup-1.0.11.jar,\ + lib/jt-scale-1.0.11.jar,\ + lib/jt-stats-1.0.11.jar,\ + lib/jt-translate-1.0.11.jar,\ + lib/jt-utilities-1.0.11.jar,\ + lib/jt-utils-1.4.0.jar,\ + lib/jt-vectorbin-1.0.11.jar,\ + lib/jt-warp-1.0.11.jar,\ + lib/jt-zonal-1.0.11.jar,\ + lib/jt-zonalstats-1.4.0.jar diff --git a/org.simantics.district.geotools/lib/commons-io-2.1.jar b/org.simantics.district.geotools/lib/commons-io-2.1.jar new file mode 100644 index 00000000..b5c7d692 Binary files /dev/null and b/org.simantics.district.geotools/lib/commons-io-2.1.jar differ diff --git a/org.simantics.district.geotools/lib/gt-api-16.0.jar b/org.simantics.district.geotools/lib/gt-api-16.0.jar new file mode 100644 index 00000000..e38314e3 Binary files /dev/null and b/org.simantics.district.geotools/lib/gt-api-16.0.jar differ diff --git a/org.simantics.district.geotools/lib/gt-coverage-16.0.jar b/org.simantics.district.geotools/lib/gt-coverage-16.0.jar new file mode 100644 index 00000000..76e22407 Binary files /dev/null and b/org.simantics.district.geotools/lib/gt-coverage-16.0.jar differ diff --git a/org.simantics.district.geotools/lib/gt-geotiff-16.0.jar b/org.simantics.district.geotools/lib/gt-geotiff-16.0.jar new file mode 100644 index 00000000..5979a2f8 Binary files /dev/null and b/org.simantics.district.geotools/lib/gt-geotiff-16.0.jar differ diff --git a/org.simantics.district.geotools/lib/gt-main-16.0.jar b/org.simantics.district.geotools/lib/gt-main-16.0.jar new file mode 100644 index 00000000..fbf20724 Binary files /dev/null and b/org.simantics.district.geotools/lib/gt-main-16.0.jar differ diff --git a/org.simantics.district.geotools/lib/guava-17.0.jar b/org.simantics.district.geotools/lib/guava-17.0.jar new file mode 100644 index 00000000..661fc747 Binary files /dev/null and b/org.simantics.district.geotools/lib/guava-17.0.jar differ diff --git a/org.simantics.district.geotools/lib/imageio-ext-geocore-1.1.16.jar b/org.simantics.district.geotools/lib/imageio-ext-geocore-1.1.16.jar new file mode 100644 index 00000000..394e94a3 Binary files /dev/null and b/org.simantics.district.geotools/lib/imageio-ext-geocore-1.1.16.jar differ diff --git a/org.simantics.district.geotools/lib/imageio-ext-streams-1.1.16.jar b/org.simantics.district.geotools/lib/imageio-ext-streams-1.1.16.jar new file mode 100644 index 00000000..72b8dff4 Binary files /dev/null and b/org.simantics.district.geotools/lib/imageio-ext-streams-1.1.16.jar differ diff --git a/org.simantics.district.geotools/lib/imageio-ext-tiff-1.1.16.jar b/org.simantics.district.geotools/lib/imageio-ext-tiff-1.1.16.jar new file mode 100644 index 00000000..a629affc Binary files /dev/null and b/org.simantics.district.geotools/lib/imageio-ext-tiff-1.1.16.jar differ diff --git a/org.simantics.district.geotools/lib/imageio-ext-utilities-1.1.16.jar b/org.simantics.district.geotools/lib/imageio-ext-utilities-1.1.16.jar new file mode 100644 index 00000000..dd60adbf Binary files /dev/null and b/org.simantics.district.geotools/lib/imageio-ext-utilities-1.1.16.jar differ diff --git a/org.simantics.district.geotools/lib/jai_codec-1.1.3.jar b/org.simantics.district.geotools/lib/jai_codec-1.1.3.jar new file mode 100644 index 00000000..056ecd3a Binary files /dev/null and b/org.simantics.district.geotools/lib/jai_codec-1.1.3.jar differ diff --git a/org.simantics.district.geotools/lib/jai_imageio-1.1.jar b/org.simantics.district.geotools/lib/jai_imageio-1.1.jar new file mode 100644 index 00000000..571aa199 Binary files /dev/null and b/org.simantics.district.geotools/lib/jai_imageio-1.1.jar differ diff --git a/org.simantics.district.geotools/lib/jdom-1.1.3.jar b/org.simantics.district.geotools/lib/jdom-1.1.3.jar new file mode 100644 index 00000000..a2877278 Binary files /dev/null and b/org.simantics.district.geotools/lib/jdom-1.1.3.jar differ diff --git a/org.simantics.district.geotools/lib/jt-affine-1.0.11.jar b/org.simantics.district.geotools/lib/jt-affine-1.0.11.jar new file mode 100644 index 00000000..6a450869 Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-affine-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-algebra-1.0.11.jar b/org.simantics.district.geotools/lib/jt-algebra-1.0.11.jar new file mode 100644 index 00000000..7aef8401 Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-algebra-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-bandcombine-1.0.11.jar b/org.simantics.district.geotools/lib/jt-bandcombine-1.0.11.jar new file mode 100644 index 00000000..1d38bb07 Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-bandcombine-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-bandmerge-1.0.11.jar b/org.simantics.district.geotools/lib/jt-bandmerge-1.0.11.jar new file mode 100644 index 00000000..e88ce446 Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-bandmerge-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-bandselect-1.0.11.jar b/org.simantics.district.geotools/lib/jt-bandselect-1.0.11.jar new file mode 100644 index 00000000..32b09037 Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-bandselect-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-binarize-1.0.11.jar b/org.simantics.district.geotools/lib/jt-binarize-1.0.11.jar new file mode 100644 index 00000000..12d8be0b Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-binarize-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-border-1.0.11.jar b/org.simantics.district.geotools/lib/jt-border-1.0.11.jar new file mode 100644 index 00000000..c868ff2c Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-border-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-buffer-1.0.11.jar b/org.simantics.district.geotools/lib/jt-buffer-1.0.11.jar new file mode 100644 index 00000000..66d6febd Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-buffer-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-classifier-1.0.11.jar b/org.simantics.district.geotools/lib/jt-classifier-1.0.11.jar new file mode 100644 index 00000000..82f0ff85 Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-classifier-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-colorconvert-1.0.11.jar b/org.simantics.district.geotools/lib/jt-colorconvert-1.0.11.jar new file mode 100644 index 00000000..7d0fb178 Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-colorconvert-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-colorindexer-1.0.11.jar b/org.simantics.district.geotools/lib/jt-colorindexer-1.0.11.jar new file mode 100644 index 00000000..b4074b45 Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-colorindexer-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-crop-1.0.11.jar b/org.simantics.district.geotools/lib/jt-crop-1.0.11.jar new file mode 100644 index 00000000..073151c0 Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-crop-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-errordiffusion-1.0.11.jar b/org.simantics.district.geotools/lib/jt-errordiffusion-1.0.11.jar new file mode 100644 index 00000000..687f37e6 Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-errordiffusion-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-format-1.0.11.jar b/org.simantics.district.geotools/lib/jt-format-1.0.11.jar new file mode 100644 index 00000000..a9c748a7 Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-format-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-imagefunction-1.0.11.jar b/org.simantics.district.geotools/lib/jt-imagefunction-1.0.11.jar new file mode 100644 index 00000000..136c2d50 Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-imagefunction-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-iterators-1.0.11.jar b/org.simantics.district.geotools/lib/jt-iterators-1.0.11.jar new file mode 100644 index 00000000..5ed3d28c Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-iterators-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-lookup-1.0.11.jar b/org.simantics.district.geotools/lib/jt-lookup-1.0.11.jar new file mode 100644 index 00000000..cb13ed39 Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-lookup-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-mosaic-1.0.11.jar b/org.simantics.district.geotools/lib/jt-mosaic-1.0.11.jar new file mode 100644 index 00000000..fd93d10f Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-mosaic-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-nullop-1.0.11.jar b/org.simantics.district.geotools/lib/jt-nullop-1.0.11.jar new file mode 100644 index 00000000..10402a88 Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-nullop-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-orderdither-1.0.11.jar b/org.simantics.district.geotools/lib/jt-orderdither-1.0.11.jar new file mode 100644 index 00000000..7781b21b Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-orderdither-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-piecewise-1.0.11.jar b/org.simantics.district.geotools/lib/jt-piecewise-1.0.11.jar new file mode 100644 index 00000000..ea16e9d9 Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-piecewise-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-rescale-1.0.11.jar b/org.simantics.district.geotools/lib/jt-rescale-1.0.11.jar new file mode 100644 index 00000000..1dd0ecfc Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-rescale-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-rlookup-1.0.11.jar b/org.simantics.district.geotools/lib/jt-rlookup-1.0.11.jar new file mode 100644 index 00000000..4f1bfcb1 Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-rlookup-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-scale-1.0.11.jar b/org.simantics.district.geotools/lib/jt-scale-1.0.11.jar new file mode 100644 index 00000000..6ff872af Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-scale-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-stats-1.0.11.jar b/org.simantics.district.geotools/lib/jt-stats-1.0.11.jar new file mode 100644 index 00000000..179021e5 Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-stats-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-translate-1.0.11.jar b/org.simantics.district.geotools/lib/jt-translate-1.0.11.jar new file mode 100644 index 00000000..2d1b416e Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-translate-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-utilities-1.0.11.jar b/org.simantics.district.geotools/lib/jt-utilities-1.0.11.jar new file mode 100644 index 00000000..dca7dd3f Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-utilities-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-utils-1.4.0.jar b/org.simantics.district.geotools/lib/jt-utils-1.4.0.jar new file mode 100644 index 00000000..99afd47d Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-utils-1.4.0.jar differ diff --git a/org.simantics.district.geotools/lib/jt-vectorbin-1.0.11.jar b/org.simantics.district.geotools/lib/jt-vectorbin-1.0.11.jar new file mode 100644 index 00000000..afd31948 Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-vectorbin-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-warp-1.0.11.jar b/org.simantics.district.geotools/lib/jt-warp-1.0.11.jar new file mode 100644 index 00000000..90ee42aa Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-warp-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-zonal-1.0.11.jar b/org.simantics.district.geotools/lib/jt-zonal-1.0.11.jar new file mode 100644 index 00000000..ba9540c9 Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-zonal-1.0.11.jar differ diff --git a/org.simantics.district.geotools/lib/jt-zonalstats-1.4.0.jar b/org.simantics.district.geotools/lib/jt-zonalstats-1.4.0.jar new file mode 100644 index 00000000..3c52f32e Binary files /dev/null and b/org.simantics.district.geotools/lib/jt-zonalstats-1.4.0.jar differ diff --git a/org.simantics.district.network.ui/META-INF/MANIFEST.MF b/org.simantics.district.network.ui/META-INF/MANIFEST.MF index 42d812c2..34b23c96 100644 --- a/org.simantics.district.network.ui/META-INF/MANIFEST.MF +++ b/org.simantics.district.network.ui/META-INF/MANIFEST.MF @@ -33,7 +33,8 @@ Require-Bundle: org.eclipse.e4.ui.model.workbench;bundle-version="1.1.100.v20150 org.simantics.scl.osgi, org.simantics.district.route, org.simantics.scenegraph.profile, - org.simantics.district.geotools;bundle-version="1.0.0" + org.simantics.district.geotools;bundle-version="1.0.0", + org.simantics.maps.elevation.server Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Import-Package: javax.annotation;version="1.0.0";resolution:=optional, javax.inject;version="1.0.0" diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/NetworkDrawingNode.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/NetworkDrawingNode.java index 35d76289..6c13f90d 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/NetworkDrawingNode.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/NetworkDrawingNode.java @@ -30,6 +30,8 @@ import org.simantics.g2d.canvas.Hints; import org.simantics.g2d.canvas.ICanvasContext; import org.simantics.g2d.canvas.IToolMode; import org.simantics.g2d.diagram.IDiagram; +import org.simantics.maps.elevation.server.SingletonTiffTileInterface; +import org.simantics.maps.elevation.server.prefs.MapsElevationServerPreferences; import org.simantics.scenegraph.g2d.G2DNode; import org.simantics.scenegraph.g2d.events.EventTypes; import org.simantics.scenegraph.g2d.events.KeyEvent.KeyPressedEvent; @@ -40,9 +42,13 @@ import org.simantics.scenegraph.g2d.events.MouseEvent.MouseMovedEvent; import org.simantics.scenegraph.utils.GeometryUtils; import org.simantics.scenegraph.utils.NodeUtil; import org.simantics.utils.threads.ThreadUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class NetworkDrawingNode extends G2DNode { + private static final Logger LOGGER = LoggerFactory.getLogger(NetworkDrawingNode.class); + static class DrawingNode { private List routeNodes = new ArrayList<>(); @@ -166,6 +172,17 @@ public class NetworkDrawingNode extends G2DNode { double x = ModelledCRS.xToLongitude(pos.getX() / scale); double y = ModelledCRS.yToLatitude(-pos.getY() / scale); + double elevation = 0; + if (MapsElevationServerPreferences.useElevationServer()) { + // ok! we use new elevation API to resolve possible elevations for the starting points + try { + elevation = SingletonTiffTileInterface.lookup(x, y).doubleValue(); + } catch (Exception ee) { + LOGGER.error("Could not get elevation from tiff interface", ee); + } + } + final double felevation = elevation; + boolean leftButton = e.button == MouseEvent.LEFT_BUTTON; ThreadUtils.getNonBlockingWorkExecutor().schedule(() -> { @@ -183,7 +200,7 @@ public class NetworkDrawingNode extends G2DNode { if (mapping == null) { mapping = graph.getSingleObject(diagramResource, DistrictNetworkResource.getInstance(graph).VertexDefaultMapping); } - DistrictNetworkUtil.createVertex(graph, diagramResource, new double[] { x, y }, 0, mapping); // TODO: elevation can be fetched from e.g. elevation API + DistrictNetworkUtil.createVertex(graph, diagramResource, new double[] { x, y }, felevation, mapping); } }); }, 100, TimeUnit.MILLISECONDS); @@ -235,15 +252,28 @@ public class NetworkDrawingNode extends G2DNode { detailedGeometryCoords[i++] = lat; } + double startElevation = 0; + double endElevation = 0; + if (MapsElevationServerPreferences.useElevationServer()) { + // ok! we use new elevation API to resolve possible elevations for the starting points + try { + startElevation = SingletonTiffTileInterface.lookup(startLat, startLon).doubleValue(); + endElevation = SingletonTiffTileInterface.lookup(endLat, endLon).doubleValue(); + } catch (Exception e) { + LOGGER.error("Could not get elevation from tiff interface", e); + } + } + final double se = startElevation; + final double ee = endElevation; DNEdgeBuilder builder = new DNEdgeBuilder(diagramResource, diagram); Simantics.getSession().asyncRequest(new WriteRequest() { - + @Override public void perform(WriteGraph graph) throws DatabaseException { - builder.create(graph, startCoords, 0, endCoords, 0, detailedGeometryCoords, padding); + builder.create(graph, startCoords, se, endCoords, ee, detailedGeometryCoords, padding); } }); - + } @Override diff --git a/org.simantics.district.ui.feature/feature.xml b/org.simantics.district.ui.feature/feature.xml index d563d637..213c4426 100644 --- a/org.simantics.district.ui.feature/feature.xml +++ b/org.simantics.district.ui.feature/feature.xml @@ -62,4 +62,11 @@ version="0.0.0" unpack="false"/> + + diff --git a/org.simantics.maps.elevation.server.ui/.classpath b/org.simantics.maps.elevation.server.ui/.classpath new file mode 100644 index 00000000..eca7bdba --- /dev/null +++ b/org.simantics.maps.elevation.server.ui/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.simantics.maps.elevation.server.ui/.project b/org.simantics.maps.elevation.server.ui/.project new file mode 100644 index 00000000..ddcb3811 --- /dev/null +++ b/org.simantics.maps.elevation.server.ui/.project @@ -0,0 +1,28 @@ + + + org.simantics.maps.elevation.server.ui + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/org.simantics.maps.elevation.server.ui/META-INF/MANIFEST.MF b/org.simantics.maps.elevation.server.ui/META-INF/MANIFEST.MF new file mode 100644 index 00000000..fe2d6d66 --- /dev/null +++ b/org.simantics.maps.elevation.server.ui/META-INF/MANIFEST.MF @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Simantics Maps Elevation Server UI +Bundle-SymbolicName: org.simantics.maps.elevation.server.ui;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: org.simantics.maps.elevation.server.ui.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.slf4j.api;bundle-version="1.7.25", + org.simantics.maps.elevation.server;bundle-version="1.0.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Automatic-Module-Name: org.simantics.maps.elevation.server.ui +Bundle-ActivationPolicy: lazy diff --git a/org.simantics.maps.elevation.server.ui/build.properties b/org.simantics.maps.elevation.server.ui/build.properties new file mode 100644 index 00000000..34d2e4d2 --- /dev/null +++ b/org.simantics.maps.elevation.server.ui/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/org.simantics.maps.elevation.server.ui/plugin.xml b/org.simantics.maps.elevation.server.ui/plugin.xml new file mode 100644 index 00000000..1e8eaa1a --- /dev/null +++ b/org.simantics.maps.elevation.server.ui/plugin.xml @@ -0,0 +1,13 @@ + + + + + + + + diff --git a/org.simantics.maps.elevation.server.ui/pom.xml b/org.simantics.maps.elevation.server.ui/pom.xml new file mode 100644 index 00000000..84a32b99 --- /dev/null +++ b/org.simantics.maps.elevation.server.ui/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + + org.simantics.district + org.simantics.district.root + 1.0.0-SNAPSHOT + + + org.simantics.maps.elevation.server.ui + eclipse-plugin + 1.0.0-SNAPSHOT + + diff --git a/org.simantics.maps.elevation.server.ui/src/org/simantics/maps/elevation/server/ui/Activator.java b/org.simantics.maps.elevation.server.ui/src/org/simantics/maps/elevation/server/ui/Activator.java new file mode 100644 index 00000000..980dd165 --- /dev/null +++ b/org.simantics.maps.elevation.server.ui/src/org/simantics/maps/elevation/server/ui/Activator.java @@ -0,0 +1,50 @@ +package org.simantics.maps.elevation.server.ui; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.simantics.maps.elevation.server.ui"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/org.simantics.maps.elevation.server.ui/src/org/simantics/maps/elevation/server/ui/MapsElevationServerPreferencePage.java b/org.simantics.maps.elevation.server.ui/src/org/simantics/maps/elevation/server/ui/MapsElevationServerPreferencePage.java new file mode 100644 index 00000000..69ac4bc7 --- /dev/null +++ b/org.simantics.maps.elevation.server.ui/src/org/simantics/maps/elevation/server/ui/MapsElevationServerPreferencePage.java @@ -0,0 +1,60 @@ +package org.simantics.maps.elevation.server.ui; + +import org.eclipse.core.runtime.preferences.InstanceScope; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.preference.BooleanFieldEditor; +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Group; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.eclipse.ui.preferences.ScopedPreferenceStore; +import org.simantics.maps.elevation.server.prefs.MapsElevationServerPreferences; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class MapsElevationServerPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { + + private static final Logger LOGGER = LoggerFactory.getLogger(MapsElevationServerPreferencePage.class); + + public MapsElevationServerPreferencePage() { + super(GRID); + setDescription("Maps elevation server preferences"); + } + + @Override + protected IPreferenceStore doGetPreferenceStore() { + return new ScopedPreferenceStore(InstanceScope.INSTANCE, MapsElevationServerPreferences.P_NODE); + } + + private void createGeneralGroup() { + Group serverGroup = new Group(getFieldEditorParent(), SWT.NONE); + serverGroup.setText("General"); + GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(serverGroup); + + BooleanFieldEditor automatically = new BooleanFieldEditor(MapsElevationServerPreferences.P_USE_ELEVATION_SERVER, "Use elevation server", serverGroup); + addField(automatically); + + GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).extendedMargins(12, 12, 12, 12).spacing(5, 4).applyTo(serverGroup); + } + + @Override + protected void createFieldEditors() { + createGeneralGroup(); + + } + + @Override + protected void performApply() { + super.performApply(); + } + + @Override + public void init(IWorkbench workbench) { + + } + + +} diff --git a/org.simantics.maps.elevation.server/.classpath b/org.simantics.maps.elevation.server/.classpath new file mode 100644 index 00000000..eca7bdba --- /dev/null +++ b/org.simantics.maps.elevation.server/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.simantics.maps.elevation.server/.project b/org.simantics.maps.elevation.server/.project new file mode 100644 index 00000000..fb4071cd --- /dev/null +++ b/org.simantics.maps.elevation.server/.project @@ -0,0 +1,28 @@ + + + org.simantics.maps.elevation.server + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/org.simantics.maps.elevation.server/META-INF/MANIFEST.MF b/org.simantics.maps.elevation.server/META-INF/MANIFEST.MF new file mode 100644 index 00000000..04e6dc18 --- /dev/null +++ b/org.simantics.maps.elevation.server/META-INF/MANIFEST.MF @@ -0,0 +1,17 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Simantics Maps Elevation Server +Bundle-SymbolicName: org.simantics.maps.elevation.server;singleton:=true +Bundle-Version: 1.0.0.qualifier +Automatic-Module-Name: org.simantics.maps.elevation.server +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Require-Bundle: org.simantics.district.geotools;bundle-version="1.0.0", + org.slf4j.api;bundle-version="1.7.25", + com.github.benmanes.caffeine;bundle-version="2.6.2", + org.eclipse.jetty.util;bundle-version="9.4.5", + org.eclipse.osgi, + org.eclipse.core.runtime;bundle-version="3.13.0", + org.eclipse.equinox.preferences +Export-Package: org.simantics.maps.elevation.server, + org.simantics.maps.elevation.server.prefs +Bundle-ActivationPolicy: lazy diff --git a/org.simantics.maps.elevation.server/build.properties b/org.simantics.maps.elevation.server/build.properties new file mode 100644 index 00000000..34d2e4d2 --- /dev/null +++ b/org.simantics.maps.elevation.server/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/org.simantics.maps.elevation.server/pom.xml b/org.simantics.maps.elevation.server/pom.xml new file mode 100644 index 00000000..f2db8685 --- /dev/null +++ b/org.simantics.maps.elevation.server/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + + org.simantics.district + org.simantics.district.root + 1.0.0-SNAPSHOT + + + org.simantics.maps.elevation.server + eclipse-plugin + 1.0.0-SNAPSHOT + + diff --git a/org.simantics.maps.elevation.server/src/org/simantics/maps/elevation/server/Activator.java b/org.simantics.maps.elevation.server/src/org/simantics/maps/elevation/server/Activator.java new file mode 100644 index 00000000..c003700f --- /dev/null +++ b/org.simantics.maps.elevation.server/src/org/simantics/maps/elevation/server/Activator.java @@ -0,0 +1,47 @@ +package org.simantics.maps.elevation.server; + +import java.util.concurrent.atomic.AtomicBoolean; + +import javax.imageio.spi.IIORegistry; +import javax.imageio.spi.ImageInputStreamSpi; +import javax.imageio.spi.ImageOutputStreamSpi; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +import it.geosolutions.imageio.stream.input.spi.FileImageInputStreamExtImplSpi; +import it.geosolutions.imageio.stream.input.spi.StringImageInputStreamSpi; +import it.geosolutions.imageio.stream.input.spi.URLImageInputStreamSpi; +import it.geosolutions.imageio.stream.output.spi.FileImageOutputStreamExtImplSpi; +import it.geosolutions.imageio.stream.output.spi.StringImageOutputStreamSpi; +import it.geosolutions.imageio.stream.output.spi.URLImageOutputStreamSpi; + +public class Activator implements BundleActivator { + + private static AtomicBoolean registered = new AtomicBoolean(false); + + public static final String PLUGIN_ID = "org.simantics.maps.elevation.server"; + + @Override + public void start(BundleContext context) throws Exception { + // register SPI's + registerSpis(); + } + + public static void registerSpis() { + if (!registered.getAndSet(true)) { + IIORegistry.getDefaultInstance().registerServiceProvider(new FileImageInputStreamExtImplSpi(), ImageInputStreamSpi.class); + IIORegistry.getDefaultInstance().registerServiceProvider(new URLImageInputStreamSpi(), ImageInputStreamSpi.class); + IIORegistry.getDefaultInstance().registerServiceProvider(new StringImageInputStreamSpi(), ImageInputStreamSpi.class); + IIORegistry.getDefaultInstance().registerServiceProvider(new FileImageOutputStreamExtImplSpi(), ImageOutputStreamSpi.class); + IIORegistry.getDefaultInstance().registerServiceProvider(new URLImageOutputStreamSpi(), ImageOutputStreamSpi.class); + IIORegistry.getDefaultInstance().registerServiceProvider(new StringImageOutputStreamSpi(), ImageOutputStreamSpi.class); + } + } + + @Override + public void stop(BundleContext context) throws Exception { + + } + +} diff --git a/org.simantics.maps.elevation.server/src/org/simantics/maps/elevation/server/SingletonTiffTileInterface.java b/org.simantics.maps.elevation.server/src/org/simantics/maps/elevation/server/SingletonTiffTileInterface.java new file mode 100644 index 00000000..3a3a0f6f --- /dev/null +++ b/org.simantics.maps.elevation.server/src/org/simantics/maps/elevation/server/SingletonTiffTileInterface.java @@ -0,0 +1,43 @@ +package org.simantics.maps.elevation.server; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SingletonTiffTileInterface { + + private static final Logger LOGGER = LoggerFactory.getLogger(SingletonTiffTileInterface.class); + + private static final String TIFS_FOLDER = System.getProperty("tifsFolder"); + + private static SingletonTiffTileInterface instance = new SingletonTiffTileInterface(); + + private TiffTileInterface tileInterface; + + private SingletonTiffTileInterface() { + // register spis + Activator.registerSpis(); + Path tilesFolder = Paths.get("tifsFolder"); + if (TIFS_FOLDER != null) { + Path potTilesFolder = Paths.get(TIFS_FOLDER); + if (!Files.exists(potTilesFolder)) { + // use default from working directory + tilesFolder = potTilesFolder; + } + } + try { + Files.createDirectories(tilesFolder); + } catch (IOException e) { + LOGGER.error("Could not create directories {}", tilesFolder.toAbsolutePath(), e); + } + tileInterface = new TiffTileInterface(tilesFolder); + } + + public static Number lookup(double x, double y) { + return instance.tileInterface.lookup(x, y); + } +} diff --git a/org.simantics.maps.elevation.server/src/org/simantics/maps/elevation/server/TiffInterface.java b/org.simantics.maps.elevation.server/src/org/simantics/maps/elevation/server/TiffInterface.java new file mode 100644 index 00000000..14485230 --- /dev/null +++ b/org.simantics.maps.elevation.server/src/org/simantics/maps/elevation/server/TiffInterface.java @@ -0,0 +1,77 @@ +package org.simantics.maps.elevation.server; + +import java.awt.image.DataBuffer; +import java.nio.file.Path; + +import org.geotools.coverage.grid.GridCoverage2D; +import org.geotools.gce.geotiff.GeoTiffReader; +import org.geotools.geometry.Envelope2D; +import org.opengis.geometry.DirectPosition; +import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TiffInterface { + + private static final Logger LOGGER = LoggerFactory.getLogger(TiffInterface.class); + + private final Path tifPath; + private GridCoverage2D coverage; + private CoordinateReferenceSystem crs; + + private boolean init = false; + + public TiffInterface(Path tifPath) { + this.tifPath = tifPath; + loadMetadata(); + } + + private void loadMetadata() { + GeoTiffReader reader = null; + try { + reader = new GeoTiffReader(this.tifPath.toFile()); + this.coverage = reader.read(null); + this.crs = coverage.getCoordinateReferenceSystem(); + this.init = true; + } catch (Exception e) { + LOGGER.error("Could not load {}", tifPath, e); + } finally { + if (reader != null) { + reader.dispose(); + } + } + } + + public Number lookup(DirectPosition pos) { + ensureInit(); + Object r = coverage.evaluate(pos); + final int dataType = coverage.getRenderedImage().getSampleModel().getDataType(); + switch (dataType) { + case DataBuffer.TYPE_BYTE: return new Byte(((byte[]) r)[0]); + case DataBuffer.TYPE_SHORT: // Fall through + case DataBuffer.TYPE_USHORT: // Fall through + case DataBuffer.TYPE_INT: return new Integer(((int[]) r)[0]); + case DataBuffer.TYPE_FLOAT: return new Float(((float[]) r)[0]); + case DataBuffer.TYPE_DOUBLE: return new Double(((double[]) r)[0]); + default: return null; + } + } + + private void ensureInit() { + if (!init) { + throw new IllegalStateException("Interface is not initialized for " + this.tifPath); + } + } + + public void close() { + coverage.dispose(true); + } + + public Envelope2D getCornerCoords() { + return coverage.getEnvelope2D(); + } + + public CoordinateReferenceSystem getCRS() { + return crs; + } +} diff --git a/org.simantics.maps.elevation.server/src/org/simantics/maps/elevation/server/TiffTileInterface.java b/org.simantics.maps.elevation.server/src/org/simantics/maps/elevation/server/TiffTileInterface.java new file mode 100644 index 00000000..900630dc --- /dev/null +++ b/org.simantics.maps.elevation.server/src/org/simantics/maps/elevation/server/TiffTileInterface.java @@ -0,0 +1,119 @@ +package org.simantics.maps.elevation.server; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Stream; + +import com.github.benmanes.caffeine.cache.Caffeine; +import com.github.benmanes.caffeine.cache.LoadingCache; +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.Envelope; +import com.vividsolutions.jts.index.strtree.STRtree; + +import org.geotools.geometry.DirectPosition2D; +import org.geotools.geometry.Envelope2D; +import org.geotools.referencing.CRS; +import org.opengis.geometry.DirectPosition; +import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.opengis.referencing.operation.MathTransform; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TiffTileInterface { + + private static final Logger LOGGER = LoggerFactory.getLogger(TiffTileInterface.class); + + private Path tilesFolder; + private LoadingCache interfaceCache; + private int openInterfacesSize; + private STRtree index; + + public TiffTileInterface(Path tilesFolder) { + this(tilesFolder, 5); + } + + public TiffTileInterface(Path tilesFolder, int openInterfacesSize) { + if (!Files.isDirectory(tilesFolder)) { + throw new IllegalArgumentException("tilesFolder has to be a folder: " + tilesFolder.toAbsolutePath()); + } + this.tilesFolder = tilesFolder; + this.index = new STRtree(); + this.openInterfacesSize = openInterfacesSize; + + this.interfaceCache = Caffeine.newBuilder() + .maximumSize(this.openInterfacesSize) + .removalListener((key, gdalInterface, cause) -> ((TiffInterface) gdalInterface).close()) + .build(key -> new TiffInterface(key)); + + try { + initializeIndex(); + } catch (IOException e) { + LOGGER.error("Could not initialize index for folder {}", tilesFolder, e); + } + } + + private TiffInterface openTifInterface(Path tifFile) { + return interfaceCache.get(tifFile); + } + + private Stream allTiffFiles() throws IOException { + return Files.walk(tilesFolder).filter(Files::isRegularFile).filter(tif -> tif.getFileName().toString().endsWith(".tif")); + } + + public void initializeIndex() throws IOException { + LOGGER.info("Initializing index.."); + AtomicInteger counter = new AtomicInteger(); + allTiffFiles().parallel().forEach(tifFile -> { + TiffInterface tifInterface = openTifInterface(tifFile); + Envelope2D coords = tifInterface.getCornerCoords(); + try { + MathTransform transform = CRS.findMathTransform(tifInterface.getCRS(), c4326); + DirectPosition2D min = new DirectPosition2D(); + DirectPosition2D max = new DirectPosition2D(); + transform.transform(new DirectPosition2D(coords.getMinX(), coords.getMinY()), min); + transform.transform(new DirectPosition2D(coords.getMaxX(), coords.getMaxY()), max); + Envelope envelope = new Envelope(min.getX(), max.getX(), min.getY(), max.getY()); + synchronized(index) { + index.insert(envelope, tifFile); + } + } catch (Exception e) { + LOGGER.error("Could not initialize index for file {}", tifFile, e); + } finally { + tifInterface.close(); + int current = counter.getAndIncrement(); + if (current % 100 == 0) { + LOGGER.info(" {}", current); + } + } + }); + } + + private static CoordinateReferenceSystem c4326; + + static { + try { + c4326 = CRS.decode("EPSG:4326"); + } catch (Exception e) { + LOGGER.error("Could not initialize epsg:4326", e); + } + } + + public Number lookup(double x, double y) { + LOGGER.info("Looking up x={} y={}", x, y); + DirectPosition p = new DirectPosition2D(c4326, x, y); + List tifFile = (List) index.query(new Envelope(new Coordinate(x, y))); + if (!tifFile.isEmpty()) { + TiffInterface tifInterface = openTifInterface(tifFile.get(0)); + try { + return tifInterface.lookup(p); + } finally { + tifInterface.close(); + } + } else { + return new Double(0); // use 0 by default for now + } + } +} \ No newline at end of file diff --git a/org.simantics.maps.elevation.server/src/org/simantics/maps/elevation/server/prefs/MapsElevationServerPreferences.java b/org.simantics.maps.elevation.server/src/org/simantics/maps/elevation/server/prefs/MapsElevationServerPreferences.java new file mode 100644 index 00000000..8401aed4 --- /dev/null +++ b/org.simantics.maps.elevation.server/src/org/simantics/maps/elevation/server/prefs/MapsElevationServerPreferences.java @@ -0,0 +1,21 @@ +package org.simantics.maps.elevation.server.prefs; + +import org.eclipse.core.runtime.preferences.InstanceScope; +import org.osgi.service.prefs.Preferences; +import org.simantics.maps.elevation.server.Activator; + +public class MapsElevationServerPreferences { + + public static final String P_NODE = Activator.PLUGIN_ID; + + public static final String P_USE_ELEVATION_SERVER = "org.simantics.maps.elevation.server.useElevationServer"; + + public static Preferences getPreferences() { + return InstanceScope.INSTANCE.getNode(MapsElevationServerPreferences.P_NODE); + } + + public static boolean useElevationServer() { + return getPreferences().getBoolean(P_USE_ELEVATION_SERVER, false); + } + +} diff --git a/org.simantics.maps.server.feature/feature.xml b/org.simantics.maps.server.feature/feature.xml index 6feb1d77..d983b5ae 100644 --- a/org.simantics.maps.server.feature/feature.xml +++ b/org.simantics.maps.server.feature/feature.xml @@ -23,4 +23,18 @@ version="0.0.0" unpack="false"/> + + + + diff --git a/pom.xml b/pom.xml index ac49440b..8bec8afd 100644 --- a/pom.xml +++ b/pom.xml @@ -20,6 +20,11 @@ p2 ${simantics-download-site}/${branch-spec}/sdk + + external-components + p2 + ${simantics-download-site}/${branch-spec}/external-components/maven + @@ -105,7 +110,10 @@ org.simantics.district.route.feature org.simantics.district.ui.feature org.simantics.maps.server.feature - + + org.simantics.maps.elevation.server + org.simantics.maps.elevation.server.ui + org.simantics.district.repository