From cd9b781be5c9fbaba1bf761fc89cd92e6d70234b Mon Sep 17 00:00:00 2001
From: sebastianpauli <>
Date: Mon, 2 Jan 2023 19:34:37 +0100
Subject: [PATCH] LANIS Update: - Config Layers Min-Max-Zoom Options - Config
Layers Output Format Option - Draw Points / Lines Auto Buffer - Draw Polygons
Tracing - Draw Polygons Area Labels - Import Spatialite - Import GeoPackage -
Export Time Stamp - Layer Tree Add Custom WMS / WFS
---
demo/lanis.html | 25 +-
dist/netgis.min.css | 2 +-
dist/netgis.min.js | 232 +++++++-----
src/netgis/Client.js | 2 +
src/netgis/Events.js | 17 +-
src/netgis/LayerTree.css | 24 ++
src/netgis/LayerTree.js | 92 ++++-
src/netgis/MapOpenLayers.js | 728 +++++++++++++++++++++++++++++-------
src/netgis/Menu.js | 12 +
src/netgis/Modal.css | 3 +-
src/netgis/Modal.js | 412 ++++++++++++++++++++
src/netgis/Toolbar.js | 121 +++++-
src/netgis/Util.js | 57 ++-
13 files changed, 1473 insertions(+), 254 deletions(-)
diff --git a/demo/lanis.html b/demo/lanis.html
index a91aa0e..18bdc22 100644
--- a/demo/lanis.html
+++ b/demo/lanis.html
@@ -11,7 +11,7 @@
-
+
@@ -50,14 +50,16 @@
-
+
-
+
+
+
@@ -95,12 +97,12 @@
{ "folder": 1, "type": "WMS", "title": "Lagebezeichnungen", "url": "https://geo5.service24.rlp.de/wms/liegenschaften_rp.fcgi?", "name": "Lagebezeichnungen" },
{ "folder": 1, "type": "WMS", "title": "Flurstücke", "url": "https://geo5.service24.rlp.de/wms/liegenschaften_rp.fcgi?", "name": "Flurstueck", "username": "abc", "password": "123" },
{ "folder": 1, "type": "WMS", "title": "Gebäude / Bauwerke", "url": "https://geo5.service24.rlp.de/wms/liegenschaften_rp.fcgi?", "name": "GebaeudeBauwerke" },
- { "folder": 1, "type": "WMS", "title": "Nutzung", "url": "https://geo5.service24.rlp.de/wms/liegenschaften_rp.fcgi?", "name": "Nutzung", "active": true },
+ { "folder": 1, "type": "WMS", "title": "Nutzung", "url": "https://geo5.service24.rlp.de/wms/liegenschaften_rp.fcgi?", "name": "Nutzung", "active": false },
- { "folder": 2, "type": "WFS", "title": "Überschwemmungsgebiete WFS Test", "url": "http://213.139.159.34:80/geoserver/uesg/wfs?", "name": "uesg:uesg_gesetzlich" },
+ { "folder": 2, "type": "WFS", "title": "Überschwemmungsgebiete WFS Test", "url": "http://213.139.159.34:80/geoserver/uesg/wfs?", "name": "uesg:uesg_gesetzlich", "outputFormat": "application/json" },
- { "folder": 3, "type": "WMS", "title": "TopPlusOpen", "attribution": "BKG", "url": "https://sgx.geodatenzentrum.de/wms_topplus_open?", "name": "web", "active": true },
- { "folder": 3, "type": "OSM", "title": "Open Street Map", "attribution": "OSM" }
+ { "folder": 3, "type": "WMS", "title": "TopPlusOpen", "attribution": "BKG", "url": "https://sgx.geodatenzentrum.de/wms_topplus_open?", "name": "web", "active": false },
+ { "folder": 3, "type": "OSM", "title": "Open Street Map", "attribution": "OSM", "active": true, "minZoom": 8, "maxZoom": 11 }
],
"folders":
@@ -141,10 +143,15 @@
"nameURL": "./proxy.php?https://geodaten.naturschutz.rlp.de/kartendienste_naturschutz/mod_alkis/gem_search.php?placename={q}",
"parcelURL": "./proxy.php?https://geodaten.naturschutz.rlp.de/kartendienste_naturschutz/mod_alkis/flur_search.php?gmk_gmn={district}&fln={field}&fsn_zae={parcelA}&fsn_nen={parcelB}&export=json"
},
+
+ "import":
+ {
+ "geopackageLibURL": "/libs/geopackage/4.2.3/"
+ },
"export":
{
- "logo": "./assets/logo.png",
+ "logo": "/geoportal/client/assets/logo.png",
"gifWebWorker": "/libs/gifjs/0.2.0/gif.worker.js",
"defaultFilename": "Export",
"defaultMargin": 10
@@ -154,7 +161,7 @@
{
"buffer":
{
- "defaultRadius": 10,
+ "defaultRadius": 100,
"defaultSegments": 3
}
},
diff --git a/dist/netgis.min.css b/dist/netgis.min.css
index 5da995e..a760282 100644
--- a/dist/netgis.min.css
+++ b/dist/netgis.min.css
@@ -1 +1 @@
-.netgis-attribution{position:absolute;left:0;bottom:0;padding:1mm;background:rgba(255,255,255,0.5);font-size:.8em!important;z-index:100}.netgis-client{position:absolute;width:100%;height:100%;overflow:hidden;background:#aaa}.netgis-client *{box-sizing:border-box}.netgis-client .netgis-loader{position:absolute;width:100%;height:100%;z-index:9999;text-align:center;font-size:12mm}.netgis-client .netgis-hide{display:none}.netgis-client .netgis-loader i{position:absolute;top:50%;transform:translateY(-50%);animation:netgis-spin 2s linear infinite}@keyframes netgis-spin{0%{transform:rotate(0deg)}to{transform:rotate(360deg)}}.netgis-controls{position:absolute;width:12mm;left:0;bottom:8mm;z-index:100}.netgis-controls button{font-size:6mm!important;width:100%;height:12mm;padding:0;border:none;background:none;cursor:pointer;color:white;text-shadow:-0.5mm 0 .3mm #000,.5mm 0 .3mm #000,0 -0.5mm .3mm #000,0 .5mm .3mm #000,0 1mm 3mm rgba(0,0,0,0.7)}.netgis-controls button:hover{text-shadow:-0.5mm 0 .3mm #a7233f,.5mm 0 .3mm #a7233f,0 -0.5mm .3mm #a7233f,0 .5mm .3mm #a7233f,0 1mm 3mm rgba(0,0,0,0.7)}.netgis-layer-list{position:absolute;right:0;width:100%;max-width:100mm;top:12mm;bottom:0;overflow:auto;z-index:200;-webkit-transform:none;transform:none;transition:transform 150ms ease}.netgis-layer-list.netgis-hide{display:initial;-webkit-transform:translateX(110%);transform:translateX(110%);transition:transform 150ms ease;will-change:transform}.netgis-layer-list ul{list-style-type:none}.netgis-layer-list>ul{display:block;position:relative;width:100%;margin:0;padding:0}.netgis-folder{position:relative;overflow:hidden;list-style:none;padding:0;margin:0;min-height:12mm;width:100%;white-space:nowrap}.netgis-folder label{cursor:pointer}.netgis-folder input[type=checkbox]{cursor:pointer}.netgis-folder>button{display:inline-block;width:100%;padding:0;padding-right:16mm;margin:0;line-height:12mm;text-align:left}.netgis-folder>ul{display:none;padding-left:8mm}.netgis-folder.netgis-active>ul{display:block}.netgis-folder-item{height:12mm;line-height:12mm}.netgis-folder-item>label{display:block;padding-right:4mm}.netgis-layer-list .netgis-icon{display:inline-block;width:12mm;line-height:12mm;text-align:center}.netgis-layer-list i{margin-right:4mm}.netgis-folder i{color:#eab000}.netgis-folder-item i{color:#bbb}.netgis-folder .netgis-partial{opacity:.5}.netgis-map{position:absolute;left:0;right:0;top:12mm;bottom:0;background:#f2efe9}.netgis-drop-target{position:absolute;left:0;right:0;top:0;bottom:0;line-height:40mm;text-align:center;z-index:1;pointer-events:none;background:rgba(0,0,0,0.5);color:#fff}.netgis-drop-target.netgis-hide{display:none}.netgis-map{cursor:default}.netgis-map .netgis-toolbar,.netgis-map .netgis-dialog{cursor:auto}.netgis-map.netgis-mode-view,.netgis-map.netgis-mode-search-place{cursor:default;cursor:grab;cursor:-moz-grab;cursor:-webkit-grab}.netgis-map.netgis-mode-panning{cursor:move;cursor:all-scroll;cursor:grabbing;cursor:-moz-grabbing;cursor:-webkit-grabbing}.netgis-map.netgis-mode-zooming-in{cursor:zoom-in}.netgis-map.netgis-mode-zooming-out{cursor:zoom-out}.netgis-map.netgis-mode-draw-points,.netgis-map.netgis-mode-draw-lines,.netgis-map.netgis-mode-draw-polygons,.netgis-map.netgis-mode-cut-feature-draw,.netgis-map.netgis-mode-modify-features{cursor:pointer;cursor:crosshair}.netgis-map.netgis-mode-delete-features,.netgis-map.netgis-mode-cut-feature-begin,.netgis-map.netgis-mode-buffer-feature-begin{cursor:pointer}.netgis-map.netgis-mode-buffer-feature-edit{cursor:default}.netgis-menu{position:absolute;left:0;right:0;top:0;height:12mm;line-height:12mm;white-space:nowrap;font-size:0;z-index:1000;background:lightsalmon}.netgis-menu>div{height:12mm;white-space:nowrap}.netgis-menu>div>*{display:inline-block;height:100%;margin:0;font-size:4mm}.netgis-menu .netgis-right{float:right;padding-right:0;padding-left:4mm}.netgis-menu span{padding:0 4mm 0 0}.netgis-menu button i{font-size:5mm;width:12mm;line-height:12mm;text-align:center}.netgis-dropdown{position:relative;padding:0}.netgis-dropdown .netgis-dropdown-content{display:none;position:absolute;min-width:100%;padding:0;margin:0;margin-top:-1px;z-index:1;font-size:4mm;list-style-type:none}.netgis-dropdown:hover .netgis-dropdown-content{display:block}.netgis-dropdown .netgis-dropdown-content i{font-size:4mm;color:#bbb}.netgis-dropdown button{width:100%;padding:0 4mm 0 0;white-space:nowrap;text-align:left}.netgis-modal{display:none;position:absolute;width:100%;height:100%;top:0;left:0;padding:6mm;z-index:5000;background:rgba(0,0,0,0.6)}.netgis-modal.netgis-show{display:block}.netgis-modal .netgis-dialog{display:none;max-width:160mm;max-height:160mm;margin:auto;border-radius:1mm;border:1mm solid #a7233f;overflow:hidden;overflow-y:auto;cursor:default}.netgis-modal .netgis-dialog.netgis-show{display:block}.netgis-modal header{width:100%;height:12mm;line-height:12mm;text-align:center}.netgis-modal header button{position:relative;width:100%;min-height:12mm}.netgis-modal header button span{display:block;position:absolute;right:0;top:0;line-height:12mm;padding:0 4mm;text-align:center}.netgis-modal-content{padding:6mm;overflow:auto}.netgis-modal-content>table{width:100%;border:none;border-spacing:0}.netgis-modal-content>table td,.netgis-modal-content>table th{width:50%;overflow:hidden;vertical-align:top;text-align:left}.netgis-modal-content .netgis-padding{padding:4mm}.netgis-modal-content .netgis-space{height:6mm}.netgis-modal-content button,.netgis-modal-content label{width:100%;min-height:12mm}.netgis-modal-content button i{margin-right:4mm}.netgis-modal-content button[disabled]{opacity:.5;cursor:not-allowed}.netgis-modal-content input{width:100%}.netgis-modal-content input[type=file]{cursor:pointer}.netgis-modal-content ul{margin:0;padding:0;padding-left:4mm;list-style-type:square}.netgis-modal-content li:not(:last-child){margin-bottom:4mm}.netgis-modal h3{margin:0}.netgis-search-parcel{position:absolute;right:0;width:100%;max-width:100mm;top:12mm;bottom:0;overflow:auto;z-index:200;padding:4mm;-webkit-transform:none;transform:none;transition:transform 150ms ease}.netgis-search-parcel.netgis-hide{display:initial;-webkit-transform:translateX(110%);transform:translateX(110%);transition:transform 150ms ease;will-change:transform}.netgis-search-parcel h3{margin:0;margin-bottom:4mm}.netgis-search-parcel label{display:block;margin:3mm 0;margin-bottom:0;cursor:pointer}.netgis-search-parcel input{width:100%;height:12mm;margin:3mm 0;padding:0 3mm}.netgis-search-parcel .netgis-loader{width:6mm;height:6mm;top:8mm;right:6mm;font-size:6mm}.netgis-search-parcel ul{margin:0;padding:0;list-style-type:none}.netgis-search-parcel li button{text-align:left}.netgis-search-parcel button{display:block;width:100%;height:12mm;padding:0 3mm;margin:0}.netgis-search-parcel .netgis-table-wrapper{width:100%;max-height:120mm;margin-top:4mm;overflow:auto}.netgis-search-parcel table{border-collapse:collapse;white-space:nowrap}.netgis-search-parcel tr{height:12mm}.netgis-search-parcel th{text-align:left;padding:0 3mm}.netgis-search-parcel td{text-align:left;padding:0 3mm;cursor:pointer}.netgis-search-parcel td:first-child{padding:0}.netgis-search-parcel table button{display:inline-block;width:12mm;height:12mm}.netgis-search-parcel p{margin:4mm 3mm;font-style:italic}.netgis-client,.netgis-client button{font-family:Verdana,sans-serif;font-size:4mm}.netgis-primary{background-color:#a7233f!important;color:white!important}.netgis-hover-primary:hover{background-color:#c82a4b!important;color:white!important}.netgis-light,.netgis-hover-light:hover{background-color:#f4f4f4!important}.netgis-text-primary{color:#a7233f!important}.netgis-hover-text-primary:hover{color:#c82a4b!important}.netgis-dialog{background:#fff;color:#000}.netgis-dropdown:hover>button{background-color:#c82a4b!important}.netgis-shadow{box-shadow:0 .5mm 1mm 0 rgba(0,0,0,0.2),0 1mm 2.5mm 0 rgba(0,0,0,0.1)!important}.netgis-shadow-large{box-shadow:0 1mm 2mm 0 rgba(0,0,0,0.3),0 2mm 5mm 0 rgba(0,0,0,0.15)!important}.netgis-text-shadow{text-shadow:0 0 1mm rgba(0,0,0,1.0)}.netgis-client button{border:none;background:none;cursor:pointer}.netgis-clip-text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.netgis-toolbars{position:absolute;left:0;right:0;top:0}.netgis-toolbar{position:absolute;left:0;right:0;top:12mm;min-height:12mm;line-height:12mm;font-size:0;white-space:nowrap;overflow-x:auto;overflow-y:hidden;z-index:1;-webkit-transform:none;transform:none;transition:transform 150ms ease}.netgis-toolbar.netgis-hide{-webkit-transform:translateY(-24mm);transform:translateY(-24mm);transition:transform 150ms ease;will-change:transform}.netgis-toolbar>div{height:12mm;white-space:nowrap}.netgis-toolbar>div>*{display:inline-block;font-size:4mm}.netgis-toolbar button{padding:0 4mm 0 0}.netgis-toolbar>div>button{line-height:12mm}.netgis-toolbar button i{width:12mm}.netgis-toolbar button:last-child{padding-right:0}.netgis-toolbar button:last-child span{margin-right:4mm}.netgis-toolbar label{display:inline-block;height:12mm;padding:0 4mm;cursor:pointer}.netgis-toolbar input[type=checkbox]{margin-right:2mm}.netgis-toolbar input[type=number]{margin-left:2mm;width:20mm}.netgis-toolbar input[type=text]{width:60mm}.netgis-toolbar .netgis-search-list{position:fixed;min-width:68mm;padding:0;margin:0;margin-left:-4mm;z-index:1;list-style-type:none;overflow:hidden;box-shadow:0 .5mm .5mm 0 rgba(0,0,0,0.2)!important}.netgis-toolbar .netgis-search-list.netgis-hide{display:none}.netgis-toolbar .netgis-search-list li{width:100%;padding:0;margin:0}.netgis-toolbar .netgis-search-list li button{width:100%;height:12mm;padding:0 4mm;white-space:nowrap;text-align:left}
\ No newline at end of file
+.netgis-attribution{position:absolute;left:0;bottom:0;padding:1mm;background:rgba(255,255,255,0.5);font-size:.8em!important;z-index:100}.netgis-client{position:absolute;width:100%;height:100%;overflow:hidden;background:#aaa}.netgis-client *{box-sizing:border-box}.netgis-client .netgis-loader{position:absolute;width:100%;height:100%;z-index:9999;text-align:center;font-size:12mm}.netgis-client .netgis-hide{display:none}.netgis-client .netgis-loader i{position:absolute;top:50%;transform:translateY(-50%);animation:netgis-spin 2s linear infinite}@keyframes netgis-spin{0%{transform:rotate(0deg)}to{transform:rotate(360deg)}}.netgis-controls{position:absolute;width:12mm;left:0;bottom:8mm;z-index:100}.netgis-controls button{font-size:6mm!important;width:100%;height:12mm;padding:0;border:none;background:none;cursor:pointer;color:white;text-shadow:-0.5mm 0 .3mm #000,.5mm 0 .3mm #000,0 -0.5mm .3mm #000,0 .5mm .3mm #000,0 1mm 3mm rgba(0,0,0,0.7)}.netgis-controls button:hover{text-shadow:-0.5mm 0 .3mm #a7233f,.5mm 0 .3mm #a7233f,0 -0.5mm .3mm #a7233f,0 .5mm .3mm #a7233f,0 1mm 3mm rgba(0,0,0,0.7)}.netgis-layer-list{position:absolute;right:0;width:100%;max-width:100mm;top:12mm;bottom:0;overflow:auto;z-index:200;-webkit-transform:none;transform:none;transition:transform 150ms ease}.netgis-layer-list.netgis-hide{display:initial;-webkit-transform:translateX(110%);transform:translateX(110%);transition:transform 150ms ease;will-change:transform}.netgis-layer-list ul{list-style-type:none}.netgis-layer-list>ul{display:block;position:relative;width:100%;margin:0;padding:0}.netgis-folder{position:relative;overflow:hidden;list-style:none;padding:0;margin:0;min-height:12mm;width:100%;white-space:nowrap}.netgis-folder label{cursor:pointer}.netgis-folder input[type=checkbox]{cursor:pointer}.netgis-folder>button{display:inline-block;width:100%;padding:0;padding-right:16mm;margin:0;line-height:12mm;text-align:left}.netgis-folder>ul{display:none;padding-left:8mm}.netgis-folder.netgis-active>ul{display:block}.netgis-folder-item{height:12mm;line-height:12mm}.netgis-folder-item>label{display:block;padding-right:4mm}.netgis-layer-list .netgis-icon{display:inline-block;width:12mm;line-height:12mm;text-align:center}.netgis-layer-list i{margin-right:4mm}.netgis-folder i{color:#eab000}.netgis-folder-item i{color:#bbb}.netgis-folder .netgis-partial{opacity:.5}.netgis-layer-tools{padding:4mm;padding-top:0;text-align:center}.netgis-layer-tools hr{margin:4mm 0;color:#eee;border-color:#eee}.netgis-layer-tools button{padding:2mm 4mm}.netgis-layer-tools button i{margin-right:1mm}.netgis-map{position:absolute;left:0;right:0;top:12mm;bottom:0;background:#f2efe9}.netgis-drop-target{position:absolute;left:0;right:0;top:0;bottom:0;line-height:40mm;text-align:center;z-index:1;pointer-events:none;background:rgba(0,0,0,0.5);color:#fff}.netgis-drop-target.netgis-hide{display:none}.netgis-map{cursor:default}.netgis-map .netgis-toolbar,.netgis-map .netgis-dialog{cursor:auto}.netgis-map.netgis-mode-view,.netgis-map.netgis-mode-search-place{cursor:default;cursor:grab;cursor:-moz-grab;cursor:-webkit-grab}.netgis-map.netgis-mode-panning{cursor:move;cursor:all-scroll;cursor:grabbing;cursor:-moz-grabbing;cursor:-webkit-grabbing}.netgis-map.netgis-mode-zooming-in{cursor:zoom-in}.netgis-map.netgis-mode-zooming-out{cursor:zoom-out}.netgis-map.netgis-mode-draw-points,.netgis-map.netgis-mode-draw-lines,.netgis-map.netgis-mode-draw-polygons,.netgis-map.netgis-mode-cut-feature-draw,.netgis-map.netgis-mode-modify-features{cursor:pointer;cursor:crosshair}.netgis-map.netgis-mode-delete-features,.netgis-map.netgis-mode-cut-feature-begin,.netgis-map.netgis-mode-buffer-feature-begin{cursor:pointer}.netgis-map.netgis-mode-buffer-feature-edit{cursor:default}.netgis-menu{position:absolute;left:0;right:0;top:0;height:12mm;line-height:12mm;white-space:nowrap;font-size:0;z-index:1000;background:lightsalmon}.netgis-menu>div{height:12mm;white-space:nowrap}.netgis-menu>div>*{display:inline-block;height:100%;margin:0;font-size:4mm}.netgis-menu .netgis-right{float:right;padding-right:0;padding-left:4mm}.netgis-menu span{padding:0 4mm 0 0}.netgis-menu button i{font-size:5mm;width:12mm;line-height:12mm;text-align:center}.netgis-dropdown{position:relative;padding:0}.netgis-dropdown .netgis-dropdown-content{display:none;position:absolute;min-width:100%;padding:0;margin:0;margin-top:-1px;z-index:1;font-size:4mm;list-style-type:none}.netgis-dropdown:hover .netgis-dropdown-content{display:block}.netgis-dropdown .netgis-dropdown-content i{font-size:4mm;color:#bbb}.netgis-dropdown button{width:100%;padding:0 4mm 0 0;white-space:nowrap;text-align:left}.netgis-modal{display:none;position:absolute;width:100%;height:100%;top:0;left:0;padding:6mm;z-index:5000;background:rgba(0,0,0,0.6)}.netgis-modal.netgis-show{display:block}.netgis-modal .netgis-dialog{display:none;max-width:160mm;max-height:160mm;margin:auto;border-radius:1mm;border:1mm solid #a7233f;overflow:hidden;overflow-y:auto;cursor:default}.netgis-modal .netgis-dialog.netgis-show{display:block}.netgis-modal header{width:100%;height:12mm;line-height:12mm;text-align:center}.netgis-modal header button{position:relative;width:100%;min-height:12mm}.netgis-modal header button span{display:block;position:absolute;right:0;top:0;line-height:12mm;padding:0 4mm;text-align:center}.netgis-modal-content{padding:6mm;overflow:auto}.netgis-modal-content>table{width:100%;border:none;border-spacing:0}.netgis-modal-content>table td,.netgis-modal-content>table th{width:50%;overflow:hidden;vertical-align:top;text-align:left}.netgis-modal-content .netgis-padding{padding:4mm}.netgis-modal-content .netgis-space{height:6mm}.netgis-modal-content button,.netgis-modal-content label{width:100%;min-height:12mm}.netgis-modal-content button i{margin-right:4mm}.netgis-modal-content button[disabled]{opacity:.5;cursor:not-allowed}.netgis-modal-content input,.netgis-modal-content select{width:100%}.netgis-modal-content input[type=file]{cursor:pointer}.netgis-modal-content ul{margin:0;padding:0;padding-left:4mm;list-style-type:square}.netgis-modal-content li:not(:last-child){margin-bottom:4mm}.netgis-modal h3{margin:0}.netgis-search-parcel{position:absolute;right:0;width:100%;max-width:100mm;top:12mm;bottom:0;overflow:auto;z-index:200;padding:4mm;-webkit-transform:none;transform:none;transition:transform 150ms ease}.netgis-search-parcel.netgis-hide{display:initial;-webkit-transform:translateX(110%);transform:translateX(110%);transition:transform 150ms ease;will-change:transform}.netgis-search-parcel h3{margin:0;margin-bottom:4mm}.netgis-search-parcel label{display:block;margin:3mm 0;margin-bottom:0;cursor:pointer}.netgis-search-parcel input{width:100%;height:12mm;margin:3mm 0;padding:0 3mm}.netgis-search-parcel .netgis-loader{width:6mm;height:6mm;top:8mm;right:6mm;font-size:6mm}.netgis-search-parcel ul{margin:0;padding:0;list-style-type:none}.netgis-search-parcel li button{text-align:left}.netgis-search-parcel button{display:block;width:100%;height:12mm;padding:0 3mm;margin:0}.netgis-search-parcel .netgis-table-wrapper{width:100%;max-height:120mm;margin-top:4mm;overflow:auto}.netgis-search-parcel table{border-collapse:collapse;white-space:nowrap}.netgis-search-parcel tr{height:12mm}.netgis-search-parcel th{text-align:left;padding:0 3mm}.netgis-search-parcel td{text-align:left;padding:0 3mm;cursor:pointer}.netgis-search-parcel td:first-child{padding:0}.netgis-search-parcel table button{display:inline-block;width:12mm;height:12mm}.netgis-search-parcel p{margin:4mm 3mm;font-style:italic}.netgis-client,.netgis-client button{font-family:Verdana,sans-serif;font-size:4mm}.netgis-primary{background-color:#a7233f!important;color:white!important}.netgis-hover-primary:hover{background-color:#c82a4b!important;color:white!important}.netgis-light,.netgis-hover-light:hover{background-color:#f4f4f4!important}.netgis-text-primary{color:#a7233f!important}.netgis-hover-text-primary:hover{color:#c82a4b!important}.netgis-dialog{background:#fff;color:#000}.netgis-dropdown:hover>button{background-color:#c82a4b!important}.netgis-shadow{box-shadow:0 .5mm 1mm 0 rgba(0,0,0,0.2),0 1mm 2.5mm 0 rgba(0,0,0,0.1)!important}.netgis-shadow-large{box-shadow:0 1mm 2mm 0 rgba(0,0,0,0.3),0 2mm 5mm 0 rgba(0,0,0,0.15)!important}.netgis-text-shadow{text-shadow:0 0 1mm rgba(0,0,0,1.0)}.netgis-client button{border:none;background:none;cursor:pointer}.netgis-clip-text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.netgis-toolbars{position:absolute;left:0;right:0;top:0}.netgis-toolbar{position:absolute;left:0;right:0;top:12mm;min-height:12mm;line-height:12mm;font-size:0;white-space:nowrap;z-index:1;-webkit-transform:none;transform:none;transition:transform 150ms ease}.netgis-toolbar.netgis-hide{-webkit-transform:translateY(-24mm);transform:translateY(-24mm);transition:transform 150ms ease;will-change:transform}.netgis-toolbar>div{height:12mm;white-space:nowrap}.netgis-toolbar>div>*{display:inline-block;font-size:4mm}.netgis-toolbar button{padding:0 4mm 0 0}.netgis-toolbar>div>button{line-height:12mm}.netgis-toolbar button i{width:12mm}.netgis-toolbar button:last-child{padding-right:0}.netgis-toolbar button:last-child span{margin-right:4mm}.netgis-toolbar label{display:inline-block;height:12mm;padding:0 4mm;cursor:pointer}.netgis-toolbar input[type=checkbox]{margin-right:2mm}.netgis-toolbar input[type=number]{margin-left:2mm;width:20mm}.netgis-toolbar input[type=text]{width:60mm}.netgis-toolbar .netgis-search-list{position:absolute;min-width:68mm;padding:0;margin:0;margin-left:-4mm;z-index:1;list-style-type:none;overflow:hidden;box-shadow:0 .5mm .5mm 0 rgba(0,0,0,0.2)!important}.netgis-toolbar .netgis-search-list.netgis-hide{display:none}.netgis-toolbar .netgis-search-list li{width:100%;padding:0;margin:0}.netgis-toolbar .netgis-search-list li button{width:100%;height:12mm;padding:0 4mm;white-space:nowrap;text-align:left}
\ No newline at end of file
diff --git a/dist/netgis.min.js b/dist/netgis.min.js
index fa8e432..52f3363 100644
--- a/dist/netgis.min.js
+++ b/dist/netgis.min.js
@@ -1,8 +1,14 @@
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};
$jscomp.getGlobal=function(a){a=["object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global,a];for(var b=0;bc&&(c=Math.max(0,b+c));if(null==d||d>b)d=b;d=Number(d);0>d&&(d=Math.max(0,b+d));for(c=Number(c||0);cc&&(c=Math.max(0,b+c));if(null==d||d>b)d=b;d=Number(d);0>d&&(d=Math.max(0,b+d));for(c=Number(c||0);c";a.title="Hineinzoomen";a.addEventListener("click",this.onZoomIn.bind(this));this.root.appendChild(a);a=document.createElement("button");a.setAttribute("type","button");a.innerHTML="";a.title="Herauszoomen";a.addEventListener("click",
this.onZoomOut.bind(this));this.root.appendChild(a);this.client.root.appendChild(this.root)};netgis.Controls.prototype.onZoomIn=function(a){this.client.invoke(netgis.Events.MAP_CHANGE_ZOOM,1)};netgis.Controls.prototype.onZoomOut=function(a){this.client.invoke(netgis.Events.MAP_CHANGE_ZOOM,-1)};netgis.Controls.prototype.onSettings=function(a){alert("TODO: settings dialog")};netgis=netgis||{};
netgis.Events=Object.freeze({CONTEXT_UPDATE:"CONTEXT_UPDATE",SET_MODE:"SET_MODE",LAYER_LIST_TOGGLE:"LAYER_LIST_TOGGLE",PANEL_TOGGLE:"PANEL_TOGGLE",PANEL_SHOW:"PANEL_SHOW",PANEL_HIDE:"PANEL_HIDE",LAYER_SHOW:"LAYER_SHOW",LAYER_HIDE:"LAYER_HIDE",LAYER_CREATED:"LAYER_CREATED",MAP_ZOOM_WKT:"MAP_ZOOM_WKT",MAP_SET_EXTENT:"MAP_SET_EXTENT",MAP_CHANGE_ZOOM:"MAP_CHANGE_ZOOM",MAP_UPDATE_STYLE:"MAP_UPDATE_STYLE",MAP_MODE_POINTS:"MAP_MODE_POINTS",MAP_MODE_LINES:"MAP_MODE_LINES",MAP_MODE_POLYGONS:"MAP_MODE_POLYGONS",EDIT_FEATURES_LOADED:"EDIT_FEATURES_LOADED",
-EDIT_FEATURES_CHANGE:"EDIT_FEATURES_CHANGE",SEARCH_PLACE_REQUEST:"SEARCH_PLACE_REQUEST",SEARCH_PLACE_RESPONSE:"SEARCH_PLACE_RESPONSE",PARCEL_SHOW_PREVIEW:"PARCEL_SHOW_PREVIEW",PARCEL_HIDE_PREVIEW:"PARCEL_HIDE_PREVIEW",BUFFER_CHANGE:"BUFFER_CHANGE",BUFFER_ACCEPT:"BUFFER_ACCEPT",BUFFER_CANCEL:"BUFFER_CANCEL",SNAP_ON:"SNAP_ON",SNAP_OFF:"SNAP_OFF",IMPORT_SHAPEFILE_SHOW:"IMPORT_SHAPEFILE_SHOW",IMPORT_GEOJSON_SHOW:"IMPORT_GEOJSON_SHOW",IMPORT_GML_SHOW:"IMPORT_GML_SHOW",IMPORT_SHAPEFILE:"IMPORT_SHAPEFILE",
-IMPORT_GEOJSON:"IMPORT_GEOJSON",IMPORT_GML:"IMPORT_GML",IMPORT_WKT:"IMPORT_WKT",EXPORT_PDF_SHOW:"EXPORT_PDF_SHOW",EXPORT_JPEG_SHOW:"EXPORT_JPEG_SHOW",EXPORT_PNG_SHOW:"EXPORT_PNG_SHOW",EXPORT_GIF_SHOW:"EXPORT_GIF_SHOW",EXPORT_PDF:"EXPORT_PDF",EXPORT_JPEG:"EXPORT_JPEG",EXPORT_PNG:"EXPORT_PNG",EXPORT_GIF:"EXPORT_GIF",EXPORT_BEGIN:"EXPORT_BEGIN",EXPORT_END:"EXPORT_END"});netgis=netgis||{};netgis.LayerTree=function(){this.folderDraw=this.folderImport=this.list=this.root=this.client=null};
-netgis.LayerTree.prototype.load=function(){this.root=document.createElement("section");this.root.className="netgis-layer-list netgis-dialog netgis-shadow netgis-hide";this.list=document.createElement("ul");this.list.className="root";this.root.appendChild(this.list);this.client.root.appendChild(this.root);this.client.on(netgis.Events.CONTEXT_UPDATE,this.onContextUpdate.bind(this));this.client.on(netgis.Events.LAYER_LIST_TOGGLE,this.onLayerListToggle.bind(this));this.client.on(netgis.Events.LAYER_CREATED,
-this.onLayerCreated.bind(this));this.client.on(netgis.Events.EDIT_FEATURES_CHANGE,this.onEditFeaturesChange.bind(this));this.client.on(netgis.Events.SET_MODE,this.onSetMode.bind(this))};netgis.LayerTree.prototype.clearAll=function(){this.list.innerHTML=""};
+EDIT_FEATURES_CHANGE:"EDIT_FEATURES_CHANGE",SEARCH_PLACE_REQUEST:"SEARCH_PLACE_REQUEST",SEARCH_PLACE_RESPONSE:"SEARCH_PLACE_RESPONSE",PARCEL_SHOW_PREVIEW:"PARCEL_SHOW_PREVIEW",PARCEL_HIDE_PREVIEW:"PARCEL_HIDE_PREVIEW",BUFFER_CHANGE:"BUFFER_CHANGE",BUFFER_ACCEPT:"BUFFER_ACCEPT",BUFFER_CANCEL:"BUFFER_CANCEL",DRAW_BUFFER_ON:"DRAW_BUFFER_ON",DRAW_BUFFER_OFF:"DRAW_BUFFER_OFF",DRAW_BUFFER_RADIUS_CHANGE:"DRAW_BUFFER_RADIUS_CHANGE",DRAW_BUFFER_SEGMENTS_CHANGE:"DRAW_BUFFER_SEGMENTS_CHANGE",SNAP_ON:"SNAP_ON",
+SNAP_OFF:"SNAP_OFF",TRACING_ON:"TRACING_ON",TRACING_OFF:"TRACING_OFF",IMPORT_SHAPEFILE_SHOW:"IMPORT_SHAPEFILE_SHOW",IMPORT_GEOJSON_SHOW:"IMPORT_GEOJSON_SHOW",IMPORT_GML_SHOW:"IMPORT_GML_SHOW",IMPORT_SPATIALITE_SHOW:"IMPORT_SPATIALITE_SHOW",IMPORT_GEOPACKAGE_SHOW:"IMPORT_GEOPACKAGE_SHOW",IMPORT_SHAPEFILE:"IMPORT_SHAPEFILE",IMPORT_GEOJSON:"IMPORT_GEOJSON",IMPORT_GML:"IMPORT_GML",IMPORT_WKT:"IMPORT_WKT",IMPORT_SPATIALITE:"IMPORT_SPATIALITE",IMPORT_GEOPACKAGE:"IMPORT_GEOPACKAGE",EXPORT_PDF_SHOW:"EXPORT_PDF_SHOW",
+EXPORT_JPEG_SHOW:"EXPORT_JPEG_SHOW",EXPORT_PNG_SHOW:"EXPORT_PNG_SHOW",EXPORT_GIF_SHOW:"EXPORT_GIF_SHOW",EXPORT_PDF:"EXPORT_PDF",EXPORT_JPEG:"EXPORT_JPEG",EXPORT_PNG:"EXPORT_PNG",EXPORT_GIF:"EXPORT_GIF",EXPORT_BEGIN:"EXPORT_BEGIN",EXPORT_END:"EXPORT_END",ADD_SERVICE_SHOW:"ADD_SERVICE_SHOW",ADD_SERVICE_WMS:"ADD_SERVICE_WMS",ADD_SERVICE_WFS:"ADD_SERVICE_WFS"});netgis=netgis||{};netgis.LayerTree=function(){this.folderDraw=this.folderImport=this.list=this.root=this.client=null};
+netgis.LayerTree.prototype.load=function(){this.root=document.createElement("section");this.root.className="netgis-layer-list netgis-dialog netgis-shadow netgis-hide";this.list=document.createElement("ul");this.list.className="root";this.root.appendChild(this.list);this.initDefaultFolders();this.tools=document.createElement("div");this.tools.className="netgis-layer-tools";this.tools.innerHTML="
";this.root.appendChild(this.tools);this.buttonAddService=document.createElement("button");this.buttonAddService.className=
+"netgis-text-primary netgis-hover-primary";this.buttonAddService.innerHTML=" Dienst hinzuf\u00fcgen";this.buttonAddService.addEventListener("click",this.onAddServiceClick.bind(this));this.tools.appendChild(this.buttonAddService);this.client.root.appendChild(this.root);this.client.on(netgis.Events.CONTEXT_UPDATE,this.onContextUpdate.bind(this));this.client.on(netgis.Events.LAYER_LIST_TOGGLE,this.onLayerListToggle.bind(this));this.client.on(netgis.Events.LAYER_CREATED,
+this.onLayerCreated.bind(this));this.client.on(netgis.Events.EDIT_FEATURES_CHANGE,this.onEditFeaturesChange.bind(this));this.client.on(netgis.Events.ADD_SERVICE_WMS,this.onAddServiceWMS.bind(this));this.client.on(netgis.Events.ADD_SERVICE_WFS,this.onAddServiceWFS.bind(this));this.client.on(netgis.Events.SET_MODE,this.onSetMode.bind(this))};
+netgis.LayerTree.prototype.initDefaultFolders=function(){this.folderDraw=this.createFolder("Zeichnung");this.folderDraw.classList.add("netgis-hide");this.list.appendChild(this.folderDraw);this.folderImport=this.createFolder("Importierte Ebenen");this.folderImport.classList.add("netgis-hide");this.list.appendChild(this.folderImport);this.folderServices=this.createFolder("Eigene Dienste");this.folderServices.classList.add("netgis-hide");this.list.appendChild(this.folderServices)};
+netgis.LayerTree.prototype.clearAll=function(){this.list.innerHTML="";this.initDefaultFolders()};
netgis.LayerTree.prototype.createFolder=function(a){var b=document.createElement("li");b.className="netgis-folder netgis-hover-light";b.setAttribute("title",a);var c=document.createElement("label");c.className="netgis-icon";b.appendChild(c);var d=document.createElement("input");d.setAttribute("type","checkbox");d.addEventListener("change",this.onFolderChange.bind(this));c.appendChild(d);c=document.createElement("button");c.setAttribute("type","button");c.className="netgis-clip-text netgis-hover-text-primary";
c.innerHTML=''+a;c.addEventListener("click",this.onFolderClick.bind(this));b.appendChild(c);a=document.createElement("ul");b.appendChild(a);return b};
netgis.LayerTree.prototype.createLayer=function(a,b,c){var d=document.createElement("li");d.setAttribute("title",b);d.className="netgis-folder-item netgis-hover-text-primary";var e=document.createElement("label");e.className="netgis-label netgis-clip-text";d.appendChild(e);var f=document.createElement("span");f.className="netgis-icon";e.appendChild(f);var g=document.createElement("input");g.setAttribute("type","checkbox");g.dataset.id=a;g.checked=c;g.addEventListener("change",this.onItemChange.bind(this));
-f.appendChild(g);a=document.createElement("i");a.className="fas fa-th-large";e.appendChild(a);b=document.createTextNode(b);e.appendChild(b);return d};netgis.LayerTree.prototype.addToFolder=function(a,b,c){a?(a=a.getElementsByTagName("ul")[0],a.appendChild(b)):a=this.list;c?a.insertBefore(b,a.firstChild):a.appendChild(b)};netgis.LayerTree.prototype.onFolderClick=function(a){a.currentTarget.parentElement.classList.toggle("netgis-active")};
+f.appendChild(g);a=document.createElement("i");a.className="fas fa-th-large";e.appendChild(a);b=document.createTextNode(b);e.appendChild(b);b=document.createElement("span");e.appendChild(b);return d};netgis.LayerTree.prototype.addToFolder=function(a,b,c){a?(a=a.getElementsByTagName("ul")[0],a.appendChild(b)):a=this.list;c?a.insertBefore(b,a.firstChild):a.appendChild(b)};netgis.LayerTree.prototype.onFolderClick=function(a){a.currentTarget.parentElement.classList.toggle("netgis-active")};
netgis.LayerTree.prototype.onFolderChange=function(a){var b=a.currentTarget;a=b.checked;b=b.parentElement.parentElement;for(var c=b.getElementsByTagName("input"),d=1;da.length)){var b=this.previewLayer.getSource().getFeatures()[0];b&&(a=a[0].getGeometry(),a=this.createBufferGeometry(a,this.drawBufferRadius,this.drawBufferSegments),b.setGeometry(a))}};
+netgis.MapOpenLayers.prototype.onEditLayerAdd=function(a){this.updateEditLayerItem();this.updateEditOutput();this.snapFeatures.push(a.feature)};netgis.MapOpenLayers.prototype.onEditLayerRemove=function(a){this.updateEditOutput();this.snapFeatures.remove(a.feature)};netgis.MapOpenLayers.prototype.onEditLayerChange=function(a){this.updateEditOutput()};
+netgis.MapOpenLayers.prototype.updateEditOutput=function(){var a=this.editLayer.getSource().getFeatures(),b=this.client.config.map.projection,c=(new ol.format.GeoJSON).writeFeaturesObject(a,{dataProjection:b,featureProjection:b});c.crs={type:"name",properties:{name:"urn:ogc:def:crs:"+b.replace(":","::")}};for(var d=b=0;dn.width){var v=q;r=v*u;r>p&&(r=p,v=r/u)}else r=p,v=r/u,v>q&&(v=q,r=v*u);u=new jsPDF(d?"l":"p");var x=e;x+=(p-r)/2;p=e;p+=(q-v)/2;u.addImage(n.toDataURL("image/png,1.0",1),"PNG",x,p,r,v);u.setFontSize(8);u.text("Quelle: "+window.location.href,x+2,p+v-2);n=u.output("bloburl",{filename:k.export.defaultFilename+".pdf"});window.open(n,"_blank");break;case "jpeg":window.navigator.msSaveBlob?
-window.navigator.msSaveBlob(n.msToBlob(),k.export.defaultFilename+".jpg"):(t.setAttribute("download",k.export.defaultFilename+".jpg"),t.setAttribute("href",n.toDataURL("image/jpeg",1)),t.click());break;case "png":window.navigator.msSaveBlob?window.navigator.msSaveBlob(n.msToBlob(),k.export.defaultFilename+".png"):(t.setAttribute("download",k.export.defaultFilename+".png"),t.setAttribute("href",n.toDataURL("image/png",1)),t.click());break;case "gif":t.setAttribute("download",k.export.defaultFilename+
-".gif"),q=new GIF({workerScript:k.export.gifWebWorker,quality:1}),q.addFrame(n),q.on("finished",function(a){t.setAttribute("href",window.URL.createObjectURL(a));t.click()}),q.render()}h.setTarget(g);g.removeChild(m);f.client.invoke(netgis.Events.EXPORT_END,null)});h.renderSync()};l.src=k.export.logo};
-netgis.MapOpenLayers.prototype.splitMultiPolygons=function(a){a=a.getSource();for(var b=a.getFeatures(),c=[],d=[],e=0;en.width){var u=v;w=u*t;w>r&&(w=r,u=w/t)}else w=r,u=w/t,u>v&&(u=v,w=u*t);t=new jsPDF(d?"l":"p");var x=e;x+=(r-w)/2;r=e;r+=(v-u)/2;t.addImage(n.toDataURL("image/png,1.0",1),"PNG",x,r,w,u);t.setFillColor(255,255,
+255);t.rect(x,r+u-11,80,11,"F");t.setFontSize(8);t.text("Datum: "+netgis.util.getTimeStamp(),x+2,r+u-2-4);t.text("Quelle: "+window.location.href,x+2,r+u-2);n=t.output("bloburl",{filename:k.export.defaultFilename+".pdf"});window.open(n,"_blank");break;case "jpeg":window.navigator.msSaveBlob?window.navigator.msSaveBlob(n.msToBlob(),k.export.defaultFilename+".jpg"):(q.setAttribute("download",k.export.defaultFilename+".jpg"),q.setAttribute("href",n.toDataURL("image/jpeg",1)),q.click());break;case "png":window.navigator.msSaveBlob?
+window.navigator.msSaveBlob(n.msToBlob(),k.export.defaultFilename+".png"):(q.setAttribute("download",k.export.defaultFilename+".png"),q.setAttribute("href",n.toDataURL("image/png",1)),q.click());break;case "gif":q.setAttribute("download",k.export.defaultFilename+".gif"),v=new GIF({workerScript:k.export.gifWebWorker,quality:1}),v.addFrame(n),v.on("finished",function(a){q.setAttribute("href",window.URL.createObjectURL(a));q.click()}),v.render()}h.setTarget(g);g.removeChild(m);f.client.invoke(netgis.Events.EXPORT_END,
+null)});h.renderSync()};l.src=k.export.logo};netgis.MapOpenLayers.prototype.splitMultiPolygons=function(a){a=a.getSource();for(var b=a.getFeatures(),c=[],d=[],e=0;e',!0);b.addEventListener("click",this.onToggleClick.bind(this));a.appendChild(b);b=this.createButton('Suche',!0);b.addEventListener("click",this.onSearchPlaceClick.bind(this));
a.appendChild(b);b=this.createButton('Flurst\u00fccke',!0);b.addEventListener("click",this.onSearchParcelClick.bind(this));a.appendChild(b);if(this.client.editable){b=this.createMenu('Zeichnen');var c=b.getElementsByTagName("ul")[0];a.appendChild(b);c.appendChild(this.createMenuItem('Punkte',this.onDrawPointClick.bind(this)));c.appendChild(this.createMenuItem('Linien',
this.onDrawLineClick.bind(this)));c.appendChild(this.createMenuItem('Polygone',this.onDrawPolygonClick.bind(this)));b=this.createMenu('Bearbeiten');c=b.getElementsByTagName("ul")[0];a.appendChild(b);c.appendChild(this.createMenuItem('Ausschneiden',this.onCutFeatureClick.bind(this)));c.appendChild(this.createMenuItem('Verschieben',this.onModifyFeaturesClick.bind(this)));c.appendChild(this.createMenuItem('L\u00f6schen',
this.onDeleteFeaturesClick.bind(this)));c.appendChild(this.createMenuItem('Puffern',this.onBufferFeatureClick.bind(this)));b=this.createMenu('Import');a.appendChild(b);b=b.getElementsByTagName("ul")[0];b.appendChild(this.createMenuItem('GeoJSON',this.onImportGeoJSONClick.bind(this)));b.appendChild(this.createMenuItem('GML',this.onImportGMLClick.bind(this)));b.appendChild(this.createMenuItem('Shapefile',
-this.onImportShapefileClick.bind(this)));b=this.createMenu('Export');a.appendChild(b);a=b.getElementsByTagName("ul")[0];a.appendChild(this.createMenuItem('PDF',this.onExportPDFClick.bind(this)));a.appendChild(this.createMenuItem('JPEG',this.onExportJPEGClick.bind(this)));a.appendChild(this.createMenuItem('PNG',this.onExportPNGClick.bind(this)));a.appendChild(this.createMenuItem('GIF',
-this.onExportGIFClick.bind(this)))}this.client.root.appendChild(this.root)};netgis.Menu.prototype.createButton=function(a,b){var c=document.createElement("button");c.setAttribute("type","button");c.className="netgis-primary netgis-hover-primary";b&&(c.className+=" netgis-right");c.innerHTML=a;return c};
+this.onImportShapefileClick.bind(this)));b.appendChild(this.createMenuItem('Spatialite',this.onImportSpatialiteClick.bind(this)));b.appendChild(this.createMenuItem('GeoPackage',this.onImportGeopackageClick.bind(this)));b=this.createMenu('Export');a.appendChild(b);a=b.getElementsByTagName("ul")[0];a.appendChild(this.createMenuItem('PDF',this.onExportPDFClick.bind(this)));a.appendChild(this.createMenuItem('JPEG',
+this.onExportJPEGClick.bind(this)));a.appendChild(this.createMenuItem('PNG',this.onExportPNGClick.bind(this)));a.appendChild(this.createMenuItem('GIF',this.onExportGIFClick.bind(this)))}this.client.root.appendChild(this.root)};netgis.Menu.prototype.createButton=function(a,b){var c=document.createElement("button");c.setAttribute("type","button");c.className="netgis-primary netgis-hover-primary";b&&(c.className+=" netgis-right");c.innerHTML=a;return c};
netgis.Menu.prototype.createMenu=function(a){var b=document.createElement("div");b.className="netgis-dropdown";var c=document.createElement("button");c.setAttribute("type","button");c.className="netgis-primary netgis-hover-primary";c.innerHTML=a;b.appendChild(c);a=document.createElement("ul");a.className="netgis-dropdown-content netgis-dialog netgis-shadow";b.appendChild(a);return b};
netgis.Menu.prototype.createMenuItem=function(a,b){var c=document.createElement("li");c.className="netgis-hover-light";var d=document.createElement("button");d.setAttribute("type","button");d.innerHTML=a;d.addEventListener("click",b);c.appendChild(d);return c};netgis.Menu.prototype.onToggleClick=function(a){this.client.invoke(netgis.Events.LAYER_LIST_TOGGLE,null)};netgis.Menu.prototype.onDrawPointClick=function(a){this.client.invoke(netgis.Events.SET_MODE,netgis.Modes.DRAW_POINTS)};
netgis.Menu.prototype.onDrawLineClick=function(a){this.client.invoke(netgis.Events.SET_MODE,netgis.Modes.DRAW_LINES)};netgis.Menu.prototype.onDrawPolygonClick=function(a){this.client.invoke(netgis.Events.SET_MODE,netgis.Modes.DRAW_POLYGONS)};netgis.Menu.prototype.onCutFeatureClick=function(a){this.client.invoke(netgis.Events.SET_MODE,netgis.Modes.CUT_FEATURE_BEGIN)};netgis.Menu.prototype.onModifyFeaturesClick=function(a){this.client.invoke(netgis.Events.SET_MODE,netgis.Modes.MODIFY_FEATURES)};
netgis.Menu.prototype.onDeleteFeaturesClick=function(a){this.client.invoke(netgis.Events.SET_MODE,netgis.Modes.DELETE_FEATURES)};netgis.Menu.prototype.onBufferFeatureClick=function(a){this.client.invoke(netgis.Events.SET_MODE,netgis.Modes.BUFFER_FEATURE_BEGIN)};netgis.Menu.prototype.onSearchPlaceClick=function(a){this.client.invoke(netgis.Events.SET_MODE,netgis.Modes.SEARCH_PLACE)};netgis.Menu.prototype.onSearchParcelClick=function(a){this.client.invoke(netgis.Events.SET_MODE,netgis.Modes.SEARCH_PARCEL)};
netgis.Menu.prototype.onSearchDataClick=function(a){alert("TODO: data search interface")};netgis.Menu.prototype.onImportOWSClick=function(a){alert("TODO: ows import interface, try setting url parameter '?ows='")};netgis.Menu.prototype.onImportShapefileClick=function(a){this.client.invoke(netgis.Events.IMPORT_SHAPEFILE_SHOW,null)};netgis.Menu.prototype.onImportGeoJSONClick=function(a){this.client.invoke(netgis.Events.IMPORT_GEOJSON_SHOW,null)};netgis.Menu.prototype.onImportKMLClick=function(a){alert("TODO: kml import interface")};
-netgis.Menu.prototype.onImportGMLClick=function(a){this.client.invoke(netgis.Events.IMPORT_GML_SHOW,null)};netgis.Menu.prototype.onExportPDFClick=function(a){this.client.invoke(netgis.Events.EXPORT_PDF_SHOW,null)};netgis.Menu.prototype.onExportJPEGClick=function(a){this.client.invoke(netgis.Events.EXPORT_JPEG_SHOW,null)};netgis.Menu.prototype.onExportPNGClick=function(a){this.client.invoke(netgis.Events.EXPORT_PNG_SHOW,null)};
-netgis.Menu.prototype.onExportGIFClick=function(a){this.client.invoke(netgis.Events.EXPORT_GIF_SHOW,null)};netgis=netgis||{};netgis.Modal=function(){this.exportGIF=this.exportPNG=this.exportJPEG=this.exportPDF=this.importShapefile=this.importGML=this.importGeoJSON=this.client=null};
-netgis.Modal.prototype.load=function(){this.root=document.createElement("section");this.root.className="netgis-modal";this.root.addEventListener("click",this.onRootClick.bind(this));this.importGeoJSON=this.createImportGeoJSON();this.root.appendChild(this.importGeoJSON);this.importGML=this.createImportGML();this.root.appendChild(this.importGML);this.importShapefile=this.createImportShapefile();this.root.appendChild(this.importShapefile);this.exportPDF=this.createExportPDF();this.root.appendChild(this.exportPDF);
-this.exportJPEG=this.createExportJPEG();this.root.appendChild(this.exportJPEG);this.exportPNG=this.createExportPNG();this.root.appendChild(this.exportPNG);this.exportGIF=this.createExportGIF();this.root.appendChild(this.exportGIF);this.client.root.appendChild(this.root);this.client.on(netgis.Events.IMPORT_GEOJSON_SHOW,this.onImportGeoJSONShow.bind(this));this.client.on(netgis.Events.IMPORT_GML_SHOW,this.onImportGMLShow.bind(this));this.client.on(netgis.Events.IMPORT_SHAPEFILE_SHOW,this.onImportShapefileShow.bind(this));
-this.client.on(netgis.Events.EXPORT_PDF_SHOW,this.onExportPDFShow.bind(this));this.client.on(netgis.Events.EXPORT_JPEG_SHOW,this.onExportJPEGShow.bind(this));this.client.on(netgis.Events.EXPORT_PNG_SHOW,this.onExportPNGShow.bind(this));this.client.on(netgis.Events.EXPORT_GIF_SHOW,this.onExportGIFShow.bind(this))};
+netgis.Menu.prototype.onImportGMLClick=function(a){this.client.invoke(netgis.Events.IMPORT_GML_SHOW,null)};netgis.Menu.prototype.onImportSpatialiteClick=function(a){this.client.invoke(netgis.Events.IMPORT_SPATIALITE_SHOW,null)};netgis.Menu.prototype.onImportGeopackageClick=function(a){this.client.invoke(netgis.Events.IMPORT_GEOPACKAGE_SHOW,null)};netgis.Menu.prototype.onExportPDFClick=function(a){this.client.invoke(netgis.Events.EXPORT_PDF_SHOW,null)};
+netgis.Menu.prototype.onExportJPEGClick=function(a){this.client.invoke(netgis.Events.EXPORT_JPEG_SHOW,null)};netgis.Menu.prototype.onExportPNGClick=function(a){this.client.invoke(netgis.Events.EXPORT_PNG_SHOW,null)};netgis.Menu.prototype.onExportGIFClick=function(a){this.client.invoke(netgis.Events.EXPORT_GIF_SHOW,null)};netgis=netgis||{};netgis.Modal=function(){this.addService=this.exportGIF=this.exportPNG=this.exportJPEG=this.exportPDF=this.importShapefile=this.importGML=this.importGeoJSON=this.client=null;this.addServiceID=1E4};
+netgis.Modal.prototype.load=function(){this.root=document.createElement("section");this.root.className="netgis-modal";this.root.addEventListener("click",this.onRootClick.bind(this));this.importGeoJSON=this.createImportGeoJSON();this.root.appendChild(this.importGeoJSON);this.importGML=this.createImportGML();this.root.appendChild(this.importGML);this.importShapefile=this.createImportShapefile();this.root.appendChild(this.importShapefile);this.importSpatialite=this.createImportSpatialite();this.root.appendChild(this.importSpatialite);
+this.importGeopackage=this.createImportGeopackage();this.root.appendChild(this.importGeopackage);this.exportPDF=this.createExportPDF();this.root.appendChild(this.exportPDF);this.exportJPEG=this.createExportJPEG();this.root.appendChild(this.exportJPEG);this.exportPNG=this.createExportPNG();this.root.appendChild(this.exportPNG);this.exportGIF=this.createExportGIF();this.root.appendChild(this.exportGIF);this.addService=this.createAddService();this.root.appendChild(this.addService);this.client.root.appendChild(this.root);
+this.client.on(netgis.Events.IMPORT_GEOJSON_SHOW,this.onImportGeoJSONShow.bind(this));this.client.on(netgis.Events.IMPORT_GML_SHOW,this.onImportGMLShow.bind(this));this.client.on(netgis.Events.IMPORT_SHAPEFILE_SHOW,this.onImportShapefileShow.bind(this));this.client.on(netgis.Events.IMPORT_SPATIALITE_SHOW,this.onImportSpatialiteShow.bind(this));this.client.on(netgis.Events.IMPORT_GEOPACKAGE_SHOW,this.onImportGeopackageShow.bind(this));this.client.on(netgis.Events.EXPORT_PDF_SHOW,this.onExportPDFShow.bind(this));
+this.client.on(netgis.Events.EXPORT_JPEG_SHOW,this.onExportJPEGShow.bind(this));this.client.on(netgis.Events.EXPORT_PNG_SHOW,this.onExportPNGShow.bind(this));this.client.on(netgis.Events.EXPORT_GIF_SHOW,this.onExportGIFShow.bind(this));this.client.on(netgis.Events.ADD_SERVICE_SHOW,this.onAddServiceShow.bind(this))};
netgis.Modal.prototype.createImportGeoJSON=function(){var a=this.createContainer("Import GeoJSON");this.createText(a,"Unterst\u00fctzte Koordinatensysteme:","- World Geodetic System 1984 (EPSG:4326)
- ETRS89 / UTM zone 32N (EPSG:25832)
");this.createInputFile(a,"Datei ausw\u00e4hlen / ablegen:",".geojson,.json",this.onImportGeoJSONChange.bind(this));this.createSpace(a);this.createButton(a,"Importieren",this.onImportGeoJSONAccept.bind(this));return a};
netgis.Modal.prototype.createImportGML=function(){var a=this.createContainer("Import GML");this.createText(a,"Unterst\u00fctzte Koordinatensysteme:","- World Geodetic System 1984 (EPSG:4326)
- ETRS89 / UTM zone 32N (EPSG:25832)
");this.createInputFile(a,"Datei ausw\u00e4hlen / ablegen:",".gml,.xml",this.onImportGMLChange.bind(this));this.createSpace(a);this.createButton(a,"Importieren",this.onImportGMLAccept.bind(this));return a};
netgis.Modal.prototype.createImportShapefile=function(){var a=this.createContainer("Import Shapefile");this.createText(a,"Unterst\u00fctzte Koordinatensysteme:","- World Geodetic System 1984 (EPSG:4326)
- ETRS89 / UTM zone 32N (EPSG:25832)
");this.createInputFile(a,"Datei ausw\u00e4hlen / ablegen:","application/zip",this.onImportShapefileChange.bind(this));this.createSpace(a);this.createButton(a,"Importieren",this.onImportShapefileAccept.bind(this));
-return a};netgis.Modal.prototype.createExportPDF=function(){var a=this.createContainer("Export PDF");this.createInputInteger(a,"Breite (Pixel):",800,0,4096);this.createInputInteger(a,"H\u00f6he (Pixel):",600,0,4096);this.createInputInteger(a,"Seitenr\u00e4nder (Millimeter):",10,0,100);this.createInputCheckbox(a,"Querformat:",!0);this.createSpace(a);this.createButton(a,"Exportieren",this.onExportPDFAccept.bind(this));return a};
+return a};
+netgis.Modal.prototype.createImportSpatialite=function(){var a=this.createContainer("Import Spatialite");this.createText(a,"Unterst\u00fctzte Koordinatensysteme:","- World Geodetic System 1984 (EPSG:4326)
- ETRS89 / UTM zone 32N (EPSG:25832)
");this.createInputFile(a,"Datei ausw\u00e4hlen / ablegen:",".sqlite",this.onImportSpatialiteChange.bind(this));this.createSpace(a);this.createButton(a,"Importieren",this.onImportSpatialiteAccept.bind(this));return a};
+netgis.Modal.prototype.createImportGeopackage=function(){var a=this.createContainer("Import GeoPackage");this.createText(a,"Unterst\u00fctzte Koordinatensysteme:","- World Geodetic System 1984 (EPSG:4326)
- ETRS89 / UTM zone 32N (EPSG:25832)
");this.createInputFile(a,"Datei ausw\u00e4hlen / ablegen:",".gpkg",this.onImportGeopackageChange.bind(this));this.createSpace(a);this.createButton(a,"Importieren",this.onImportGeopackageAccept.bind(this));return a};
+netgis.Modal.prototype.createExportPDF=function(){var a=this.createContainer("Export PDF");this.createInputInteger(a,"Breite (Pixel):",800,0,4096);this.createInputInteger(a,"H\u00f6he (Pixel):",600,0,4096);this.createInputInteger(a,"Seitenr\u00e4nder (Millimeter):",10,0,100);this.createInputCheckbox(a,"Querformat:",!0);this.createSpace(a);this.createButton(a,"Exportieren",this.onExportPDFAccept.bind(this));return a};
netgis.Modal.prototype.createExportJPEG=function(){var a=this.createContainer("Export JPEG");this.createInputInteger(a,"Breite (Pixel):",800,0,4096);this.createInputInteger(a,"H\u00f6he (Pixel):",600,0,4096);this.createSpace(a);this.createButton(a,"Exportieren",this.onExportJPEGAccept.bind(this));return a};
netgis.Modal.prototype.createExportPNG=function(){var a=this.createContainer("Export PNG");this.createInputInteger(a,"Breite (Pixel):",800,0,4096);this.createInputInteger(a,"H\u00f6he (Pixel):",600,0,4096);this.createSpace(a);this.createButton(a,"Exportieren",this.onExportPNGAccept.bind(this));return a};
netgis.Modal.prototype.createExportGIF=function(){var a=this.createContainer("Export GIF");this.createInputInteger(a,"Breite (Pixel):",800,0,4096);this.createInputInteger(a,"H\u00f6he (Pixel):",600,0,4096);this.createSpace(a);this.createButton(a,"Exportieren",this.onExportGIFAccept.bind(this));return a};
-netgis.Modal.prototype.show=function(a){this.root.classList.add("netgis-show");for(var b=this.root.getElementsByClassName("netgis-dialog"),c=0;cDienst laden",this.onAddServiceLoad.bind(this));this.createSpace(a);this.createInputHidden(a);this.createText(a,"Bezeichnung:","");this.createInputSelect(a,"Kartenebene:",[]);this.createInputSelect(a,"Format:",[]);this.createSpace(a);this.createButton(a,"Dienst hinzuf\u00fcgen",
+this.onAddServiceAccept.bind(this));return a};netgis.Modal.prototype.show=function(a){this.root.classList.add("netgis-show");for(var b=this.root.getElementsByClassName("netgis-dialog"),c=0;c"+a+"";d.addEventListener("click",this.onHeaderClick.bind(this));c.appendChild(d);a=document.createElement("span");a.innerHTML="";d.appendChild(a);b.appendChild(c);
c=document.createElement("div");c.className="netgis-modal-content";b.appendChild(c);d=document.createElement("table");c.appendChild(d);return b};netgis.Modal.prototype.createSpace=function(a){var b=document.createElement("tr");b.className="netgis-space";var c=document.createElement("td");c.setAttribute("colspan",100);b.appendChild(c);a.getElementsByClassName("netgis-modal-content")[0].getElementsByTagName("table")[0].appendChild(b);return c};
netgis.Modal.prototype.createButton=function(a,b,c){var d=document.createElement("tr"),e=document.createElement("td");e.setAttribute("colspan",100);d.appendChild(e);var f=document.createElement("button");f.setAttribute("type","button");f.className="netgis-primary netgis-hover-primary";f.innerHTML=b;c&&f.addEventListener("click",c);e.appendChild(f);a.getElementsByClassName("netgis-modal-content")[0].getElementsByTagName("table")[0].appendChild(d);return f};
-netgis.Modal.prototype.createInputText=function(a,b){var c=document.createElement("tr"),d=document.createElement("th");d.className="netgis-padding";var e=document.createElement("label");e.innerHTML=b;d.appendChild(e);c.appendChild(d);b=document.createElement("td");b.className="netgis-padding";d=document.createElement("input");d.setAttribute("type","text");b.appendChild(d);c.appendChild(b);e.htmlFor=d;a.getElementsByClassName("netgis-modal-content")[0].getElementsByTagName("table")[0].appendChild(c);
-return d};
-netgis.Modal.prototype.createInputInteger=function(a,b,c,d,e){var f=document.createElement("tr"),g=document.createElement("th");g.className="netgis-padding";var h=document.createElement("label");h.innerHTML=b;g.appendChild(h);f.appendChild(g);b=document.createElement("td");b.className="netgis-padding";g=document.createElement("input");g.setAttribute("type","number");g.setAttribute("min",d);g.setAttribute("max",e);g.value=Number.parseInt(c);b.appendChild(g);f.appendChild(b);h.htmlFor=g;a.getElementsByClassName("netgis-modal-content")[0].getElementsByTagName("table")[0].appendChild(f);return g};
-netgis.Modal.prototype.createInputCheckbox=function(a,b,c){var d=document.createElement("tr"),e=document.createElement("th");e.className="netgis-padding";var f=document.createElement("label");f.innerHTML=b;e.appendChild(f);d.appendChild(e);b=document.createElement("td");b.className="netgis-padding";e=document.createElement("input");e.setAttribute("type","checkbox");e.checked=c;b.appendChild(e);d.appendChild(b);f.htmlFor=e;a.getElementsByClassName("netgis-modal-content")[0].getElementsByTagName("table")[0].appendChild(d);
-return e};
-netgis.Modal.prototype.createInputFile=function(a,b,c,d){var e=document.createElement("tr"),f=document.createElement("th");f.className="netgis-padding";var g=document.createElement("label");g.innerHTML=b;f.appendChild(g);e.appendChild(f);b=document.createElement("td");b.className="netgis-padding";f=document.createElement("input");f.setAttribute("type","file");f.setAttribute("accept",c);d&&f.addEventListener("change",d);b.appendChild(f);e.appendChild(b);a.getElementsByClassName("netgis-modal-content")[0].getElementsByTagName("table")[0].appendChild(e);return f};
-netgis.Modal.prototype.createText=function(a,b,c){var d=document.createElement("tr"),e=document.createElement("th");e.className="netgis-padding";e.innerHTML=b;d.appendChild(e);b=document.createElement("td");b.className="netgis-padding";b.innerHTML=c;d.appendChild(b);a.getElementsByClassName("netgis-modal-content")[0].getElementsByTagName("table")[0].appendChild(d);return b};netgis.Modal.prototype.onRootClick=function(a){a.target===this.root&&this.hide()};netgis.Modal.prototype.onHeaderClick=function(a){this.hide()};
-netgis.Modal.prototype.onImportGeoJSONShow=function(a){a=this.importGeoJSON.getElementsByTagName("input")[0];var b=this.importGeoJSON.getElementsByTagName("button")[1];a.value="";b.disabled=!0;this.show(this.importGeoJSON)};netgis.Modal.prototype.onImportGeoJSONChange=function(a){a=this.importGeoJSON.getElementsByTagName("input")[0];this.importGeoJSON.getElementsByTagName("button")[1].disabled=a.value&&0Punkte zeichnen:',this.onToolbarClose.bind(this)));this.append(this.toolbars[netgis.Modes.DRAW_POINTS],this.createToolbarCheckbox("Einrasten",this.onSnapChange.bind(this)));
-this.root.appendChild(this.toolbars[netgis.Modes.DRAW_POINTS]);this.toolbars[netgis.Modes.DRAW_LINES]=this.createToolbar();this.append(this.toolbars[netgis.Modes.DRAW_LINES],this.createToolbarButton('Linien zeichnen:',this.onToolbarClose.bind(this)));this.append(this.toolbars[netgis.Modes.DRAW_LINES],this.createToolbarCheckbox("Einrasten",this.onSnapChange.bind(this)));this.root.appendChild(this.toolbars[netgis.Modes.DRAW_LINES]);this.toolbars[netgis.Modes.DRAW_POLYGONS]=
-this.createToolbar();this.append(this.toolbars[netgis.Modes.DRAW_POLYGONS],this.createToolbarButton('Polygone zeichnen:',this.onToolbarClose.bind(this)));this.append(this.toolbars[netgis.Modes.DRAW_POLYGONS],this.createToolbarCheckbox("Einrasten",this.onSnapChange.bind(this)));this.root.appendChild(this.toolbars[netgis.Modes.DRAW_POLYGONS]);this.toolbars[netgis.Modes.CUT_FEATURE_BEGIN]=this.createToolbar();this.append(this.toolbars[netgis.Modes.CUT_FEATURE_BEGIN],
-this.createToolbarButton('Feature zum Ausschneiden w\u00e4hlen:',this.onToolbarClose.bind(this)));this.root.appendChild(this.toolbars[netgis.Modes.CUT_FEATURE_BEGIN]);this.toolbars[netgis.Modes.CUT_FEATURE_DRAW]=this.createToolbar();this.append(this.toolbars[netgis.Modes.CUT_FEATURE_DRAW],this.createToolbarButton('Fl\u00e4che zum Ausschneiden zeichnen:',this.onToolbarClose.bind(this)));this.root.appendChild(this.toolbars[netgis.Modes.CUT_FEATURE_DRAW]);
-this.toolbars[netgis.Modes.MODIFY_FEATURES]=this.createToolbar();this.append(this.toolbars[netgis.Modes.MODIFY_FEATURES],this.createToolbarButton('Features verschieben:',this.onToolbarClose.bind(this)));this.root.appendChild(this.toolbars[netgis.Modes.MODIFY_FEATURES]);this.toolbars[netgis.Modes.DELETE_FEATURES]=this.createToolbar();this.append(this.toolbars[netgis.Modes.DELETE_FEATURES],this.createToolbarButton('Features l\u00f6schen:',
-this.onToolbarClose.bind(this)));this.root.appendChild(this.toolbars[netgis.Modes.DELETE_FEATURES]);this.toolbars[netgis.Modes.BUFFER_FEATURE_BEGIN]=this.createToolbar();this.append(this.toolbars[netgis.Modes.BUFFER_FEATURE_BEGIN],this.createToolbarButton('Feature zum Puffern w\u00e4hlen:',this.onToolbarClose.bind(this)));this.root.appendChild(this.toolbars[netgis.Modes.BUFFER_FEATURE_BEGIN]);this.toolbars[netgis.Modes.BUFFER_FEATURE_EDIT]=this.createToolbar();
-var b=1E3,c=3;netgis.util.isDefined(a.tools)&&(netgis.util.isDefined(a.tools.buffer.defaultRadius)&&(b=a.tools.buffer.defaultRadius),netgis.util.isDefined(a.tools.buffer.defaultSegments)&&(c=a.tools.buffer.defaultSegments));this.append(this.toolbars[netgis.Modes.BUFFER_FEATURE_EDIT],this.createToolbarButton('Feature puffern:',this.onBufferCancel.bind(this)));this.append(this.toolbars[netgis.Modes.BUFFER_FEATURE_EDIT],this.createToolbarInput("Radius in Meter:",
-b,this.onBufferChange.bind(this)));this.append(this.toolbars[netgis.Modes.BUFFER_FEATURE_EDIT],this.createToolbarInput("Segmente:",c,this.onBufferChange.bind(this)));this.append(this.toolbars[netgis.Modes.BUFFER_FEATURE_EDIT],this.createToolbarButton('OK',this.onBufferAccept.bind(this)));a=this.toolbars[netgis.Modes.BUFFER_FEATURE_EDIT].getElementsByTagName("input");a[0].addEventListener("keyup",this.onBufferKeyUp.bind(this));a[1].addEventListener("keyup",
-this.onBufferKeyUp.bind(this));a[1].setAttribute("min",1);this.root.appendChild(this.toolbars[netgis.Modes.BUFFER_FEATURE_EDIT])}this.toolbars[netgis.Modes.SEARCH_PLACE]=this.createToolbar();this.append(this.toolbars[netgis.Modes.SEARCH_PLACE],this.createToolbarButton('Suche:',this.onToolbarClose.bind(this)));a=this.createToolbarInputText("Adresse...","",null);a.style.position="relative";this.searchInput=a.getElementsByTagName("input")[0];this.searchInput.addEventListener("keyup",
-this.onSearchKeyUp.bind(this));this.searchInput.addEventListener("focus",this.onSearchFocus.bind(this));this.searchInput.addEventListener("blur",this.onSearchBlur.bind(this));this.append(this.toolbars[netgis.Modes.SEARCH_PLACE],a);this.searchList=document.createElement("ul");this.searchList.className="netgis-dropdown-content netgis-search-list netgis-dialog netgis-shadow netgis-hide";a.appendChild(this.searchList);this.append(this.toolbars[netgis.Modes.SEARCH_PLACE],this.createToolbarButton('',
-this.onSearchClear.bind(this)));this.root.appendChild(this.toolbars[netgis.Modes.SEARCH_PLACE]);this.client.root.appendChild(this.root);this.client.on(netgis.Events.SET_MODE,this.onSetMode.bind(this));this.client.on(netgis.Events.SEARCH_PLACE_RESPONSE,this.onSearchPlaceResponse.bind(this))};netgis.Toolbar.prototype.createToolbar=function(){var a=document.createElement("div");a.className="netgis-toolbar netgis-dialog netgis-shadow netgis-hide";var b=document.createElement("div");a.appendChild(b);return a};
-netgis.Toolbar.prototype.append=function(a,b){a.getElementsByTagName("div")[0].appendChild(b)};netgis.Toolbar.prototype.createToolbarButton=function(a,b){var c=document.createElement("button");c.setAttribute("type","button");c.className="netgis-hover-light";c.innerHTML=a;c.addEventListener("click",b);return c};
+netgis.Toolbar.prototype.load=function(){var a=this.client.config;this.root=document.createElement("section");this.root.className="netgis-toolbars";if(this.client.editable){var b=1E3,c=3;netgis.util.isDefined(a.tools)&&(netgis.util.isDefined(a.tools.buffer.defaultRadius)&&(b=a.tools.buffer.defaultRadius),netgis.util.isDefined(a.tools.buffer.defaultSegments)&&(c=a.tools.buffer.defaultSegments));this.toolbars[netgis.Modes.DRAW_POINTS]=this.createToolbar();this.append(this.toolbars[netgis.Modes.DRAW_POINTS],
+this.createToolbarButton('Punkte zeichnen:',this.onToolbarClose.bind(this)));this.append(this.toolbars[netgis.Modes.DRAW_POINTS],this.createToolbarCheckbox("Einrasten",this.onSnapChange.bind(this)));this.append(this.toolbars[netgis.Modes.DRAW_POINTS],this.createToolbarCheckbox("Puffern",this.onDrawBufferChange.bind(this)));this.append(this.toolbars[netgis.Modes.DRAW_POINTS],this.createToolbarInput("Radius (Meter):",b,this.onDrawBufferRadiusChange.bind(this)));
+this.append(this.toolbars[netgis.Modes.DRAW_POINTS],this.createToolbarInput("Segmente:",c,this.onDrawBufferSegmentsChange.bind(this)));this.root.appendChild(this.toolbars[netgis.Modes.DRAW_POINTS]);this.toolbars[netgis.Modes.DRAW_LINES]=this.createToolbar();this.append(this.toolbars[netgis.Modes.DRAW_LINES],this.createToolbarButton('Linien zeichnen:',this.onToolbarClose.bind(this)));this.append(this.toolbars[netgis.Modes.DRAW_LINES],this.createToolbarCheckbox("Einrasten",
+this.onSnapChange.bind(this)));this.append(this.toolbars[netgis.Modes.DRAW_LINES],this.createToolbarCheckbox("Puffern",this.onDrawBufferChange.bind(this)));this.append(this.toolbars[netgis.Modes.DRAW_LINES],this.createToolbarInput("Radius (Meter):",b,this.onDrawBufferRadiusChange.bind(this)));this.append(this.toolbars[netgis.Modes.DRAW_LINES],this.createToolbarInput("Segmente:",c,this.onDrawBufferSegmentsChange.bind(this)));this.root.appendChild(this.toolbars[netgis.Modes.DRAW_LINES]);this.showDrawBufferOptions(!1);
+this.toolbars[netgis.Modes.DRAW_POLYGONS]=this.createToolbar();this.append(this.toolbars[netgis.Modes.DRAW_POLYGONS],this.createToolbarButton('Polygone zeichnen:',this.onToolbarClose.bind(this)));this.append(this.toolbars[netgis.Modes.DRAW_POLYGONS],this.createToolbarCheckbox("Einrasten",this.onSnapChange.bind(this)));this.append(this.toolbars[netgis.Modes.DRAW_POLYGONS],this.createToolbarCheckbox("Tracing",this.onTracingChange.bind(this)));this.root.appendChild(this.toolbars[netgis.Modes.DRAW_POLYGONS]);
+this.toolbars[netgis.Modes.CUT_FEATURE_BEGIN]=this.createToolbar();this.append(this.toolbars[netgis.Modes.CUT_FEATURE_BEGIN],this.createToolbarButton('Feature zum Ausschneiden w\u00e4hlen:',this.onToolbarClose.bind(this)));this.root.appendChild(this.toolbars[netgis.Modes.CUT_FEATURE_BEGIN]);this.toolbars[netgis.Modes.CUT_FEATURE_DRAW]=this.createToolbar();this.append(this.toolbars[netgis.Modes.CUT_FEATURE_DRAW],this.createToolbarButton('Fl\u00e4che zum Ausschneiden zeichnen:',
+this.onToolbarClose.bind(this)));this.root.appendChild(this.toolbars[netgis.Modes.CUT_FEATURE_DRAW]);this.toolbars[netgis.Modes.MODIFY_FEATURES]=this.createToolbar();this.append(this.toolbars[netgis.Modes.MODIFY_FEATURES],this.createToolbarButton('Features verschieben:',this.onToolbarClose.bind(this)));this.root.appendChild(this.toolbars[netgis.Modes.MODIFY_FEATURES]);this.toolbars[netgis.Modes.DELETE_FEATURES]=this.createToolbar();this.append(this.toolbars[netgis.Modes.DELETE_FEATURES],
+this.createToolbarButton('Features l\u00f6schen:',this.onToolbarClose.bind(this)));this.root.appendChild(this.toolbars[netgis.Modes.DELETE_FEATURES]);this.toolbars[netgis.Modes.BUFFER_FEATURE_BEGIN]=this.createToolbar();this.append(this.toolbars[netgis.Modes.BUFFER_FEATURE_BEGIN],this.createToolbarButton('Feature zum Puffern w\u00e4hlen:',this.onToolbarClose.bind(this)));this.root.appendChild(this.toolbars[netgis.Modes.BUFFER_FEATURE_BEGIN]);
+this.toolbars[netgis.Modes.BUFFER_FEATURE_EDIT]=this.createToolbar();this.append(this.toolbars[netgis.Modes.BUFFER_FEATURE_EDIT],this.createToolbarButton('Feature puffern:',this.onBufferCancel.bind(this)));this.append(this.toolbars[netgis.Modes.BUFFER_FEATURE_EDIT],this.createToolbarInput("Radius (Meter):",b,this.onBufferChange.bind(this)));this.append(this.toolbars[netgis.Modes.BUFFER_FEATURE_EDIT],this.createToolbarInput("Segmente:",c,this.onBufferChange.bind(this)));
+this.append(this.toolbars[netgis.Modes.BUFFER_FEATURE_EDIT],this.createToolbarButton('OK',this.onBufferAccept.bind(this)));a=this.toolbars[netgis.Modes.BUFFER_FEATURE_EDIT].getElementsByTagName("input");a[0].addEventListener("keyup",this.onBufferKeyUp.bind(this));a[1].addEventListener("keyup",this.onBufferKeyUp.bind(this));a[1].setAttribute("min",1);this.root.appendChild(this.toolbars[netgis.Modes.BUFFER_FEATURE_EDIT])}this.toolbars[netgis.Modes.SEARCH_PLACE]=
+this.createToolbar();this.append(this.toolbars[netgis.Modes.SEARCH_PLACE],this.createToolbarButton('Suche:',this.onToolbarClose.bind(this)));a=this.createToolbarInputText("Adresse...","",null);a.style.position="relative";this.searchInput=a.getElementsByTagName("input")[0];this.searchInput.addEventListener("keyup",this.onSearchKeyUp.bind(this));this.searchInput.addEventListener("focus",this.onSearchFocus.bind(this));this.searchInput.addEventListener("blur",
+this.onSearchBlur.bind(this));this.append(this.toolbars[netgis.Modes.SEARCH_PLACE],a);this.searchList=document.createElement("ul");this.searchList.className="netgis-dropdown-content netgis-search-list netgis-dialog netgis-shadow netgis-hide";a.appendChild(this.searchList);this.append(this.toolbars[netgis.Modes.SEARCH_PLACE],this.createToolbarButton('',this.onSearchClear.bind(this)));this.root.appendChild(this.toolbars[netgis.Modes.SEARCH_PLACE]);this.client.root.appendChild(this.root);
+this.client.on(netgis.Events.SET_MODE,this.onSetMode.bind(this));this.client.on(netgis.Events.SEARCH_PLACE_RESPONSE,this.onSearchPlaceResponse.bind(this))};netgis.Toolbar.prototype.createToolbar=function(){var a=document.createElement("div");a.className="netgis-toolbar netgis-dialog netgis-shadow netgis-hide";var b=document.createElement("div");a.appendChild(b);return a};netgis.Toolbar.prototype.append=function(a,b){a.getElementsByTagName("div")[0].appendChild(b)};
+netgis.Toolbar.prototype.createToolbarButton=function(a,b){var c=document.createElement("button");c.setAttribute("type","button");c.className="netgis-hover-light";c.innerHTML=a;c.addEventListener("click",b);return c};
netgis.Toolbar.prototype.createToolbarCheckbox=function(a,b){var c=document.createElement("label");c.className="netgis-hover-light";var d=document.createElement("input");d.setAttribute("type","checkbox");d.addEventListener("change",b);c.appendChild(d);a=document.createTextNode(a);c.appendChild(a);return c};
netgis.Toolbar.prototype.createToolbarInput=function(a,b,c){var d=document.createElement("label");d.className="netgis-hover-light";a=document.createTextNode(a);d.appendChild(a);a=document.createElement("input");a.setAttribute("type","number");a.setAttribute("min",0);a.value=b;a.addEventListener("change",c);d.appendChild(a);return d};
netgis.Toolbar.prototype.createToolbarInputText=function(a,b,c){var d=document.createElement("label");d.className="netgis-hover-light";var e=document.createElement("input");e.setAttribute("type","text");e.setAttribute("placeholder",a);e.value=b;c&&e.addEventListener("change",c);d.appendChild(e);return d};
-netgis.Toolbar.prototype.onSetMode=function(a){var b=!this.toolbars[netgis.Modes.SEARCH_PLACE].classList.contains("netgis-hide");netgis.util.foreach(this.toolbars,function(b,d){b===a?d.classList.remove("netgis-hide"):d.classList.add("netgis-hide")});switch(a){case netgis.Modes.SEARCH_PLACE:b?this.client.invoke(netgis.Events.SET_MODE,netgis.Modes.VIEW):this.searchInput.focus();break;case netgis.Modes.BUFFER_FEATURE_EDIT:this.updateBuffer()}};
-netgis.Toolbar.prototype.onToolbarClose=function(a){this.client.invoke(netgis.Events.SET_MODE,netgis.Modes.VIEW)};netgis.Toolbar.prototype.searchRequest=function(a){a=a.trim();a!==this.searchValue&&(this.searchValue=a,0")},create:function(a){var b=document.createElement("tbody");b.innerHTML=
-a;return b.children[0]},size:function(a){a=(new TextEncoder).encode(JSON.stringify(a)).length;var b=a/1024;return{bytes:a,kilobytes:b,megabytes:b/1024}},request:function(a,c){var b=new XMLHttpRequest;b.onload=function(){c(this.responseText)};b.open("GET",a,!0);b.send()},padstr:function(a,c){for(a=a.toString();a.length 0 )
{
+ //console.info( "INPUT:", this.output.value );
var json = JSON.parse( this.output.value );
this.invoke( netgis.Events.EDIT_FEATURES_LOADED, json );
}
@@ -288,6 +289,7 @@ netgis.Client.prototype.onHtmlResponse = function( data )
netgis.Client.prototype.onEditFeaturesChange = function( e )
{
var geojson = JSON.stringify( e );
+ //console.info( "OUTPUT:", geojson );
this.output.value = geojson;
};
diff --git a/src/netgis/Events.js b/src/netgis/Events.js
index 8cd2028..f0ba901 100644
--- a/src/netgis/Events.js
+++ b/src/netgis/Events.js
@@ -40,18 +40,27 @@ netgis.Events = Object.freeze
BUFFER_CHANGE: "BUFFER_CHANGE",
BUFFER_ACCEPT: "BUFFER_ACCEPT",
BUFFER_CANCEL: "BUFFER_CANCEL",
-
+ DRAW_BUFFER_ON: "DRAW_BUFFER_ON",
+ DRAW_BUFFER_OFF: "DRAW_BUFFER_OFF",
+ DRAW_BUFFER_RADIUS_CHANGE: "DRAW_BUFFER_RADIUS_CHANGE",
+ DRAW_BUFFER_SEGMENTS_CHANGE: "DRAW_BUFFER_SEGMENTS_CHANGE",
SNAP_ON: "SNAP_ON",
SNAP_OFF: "SNAP_OFF",
+ TRACING_ON: "TRACING_ON",
+ TRACING_OFF: "TRACING_OFF",
IMPORT_SHAPEFILE_SHOW: "IMPORT_SHAPEFILE_SHOW",
IMPORT_GEOJSON_SHOW: "IMPORT_GEOJSON_SHOW",
IMPORT_GML_SHOW: "IMPORT_GML_SHOW",
+ IMPORT_SPATIALITE_SHOW: "IMPORT_SPATIALITE_SHOW",
+ IMPORT_GEOPACKAGE_SHOW: "IMPORT_GEOPACKAGE_SHOW",
IMPORT_SHAPEFILE: "IMPORT_SHAPEFILE",
IMPORT_GEOJSON: "IMPORT_GEOJSON",
IMPORT_GML: "IMPORT_GML",
IMPORT_WKT: "IMPORT_WKT",
+ IMPORT_SPATIALITE: "IMPORT_SPATIALITE",
+ IMPORT_GEOPACKAGE: "IMPORT_GEOPACKAGE",
EXPORT_PDF_SHOW: "EXPORT_PDF_SHOW",
EXPORT_JPEG_SHOW: "EXPORT_JPEG_SHOW",
@@ -63,6 +72,10 @@ netgis.Events = Object.freeze
EXPORT_PNG: "EXPORT_PNG",
EXPORT_GIF: "EXPORT_GIF",
EXPORT_BEGIN: "EXPORT_BEGIN",
- EXPORT_END: "EXPORT_END"
+ EXPORT_END: "EXPORT_END",
+
+ ADD_SERVICE_SHOW: "ADD_SERVICE_SHOW",
+ ADD_SERVICE_WMS: "ADD_SERVICE_WMS",
+ ADD_SERVICE_WFS: "ADD_SERVICE_WFS"
}
);
diff --git a/src/netgis/LayerTree.css b/src/netgis/LayerTree.css
index a032d58..29d0017 100644
--- a/src/netgis/LayerTree.css
+++ b/src/netgis/LayerTree.css
@@ -157,3 +157,27 @@
{
opacity: 0.5;
}
+
+.netgis-layer-tools
+{
+ padding: 4mm;
+ padding-top: 0mm;
+ text-align: center;
+}
+
+.netgis-layer-tools hr
+{
+ margin: 4mm 0mm;
+ color: #eee;
+ border-color: #eee;
+}
+
+.netgis-layer-tools button
+{
+ padding: 2mm 4mm;
+}
+
+.netgis-layer-tools button i
+{
+ margin-right: 1mm;
+}
diff --git a/src/netgis/LayerTree.js b/src/netgis/LayerTree.js
index 57c9a2a..afbff5b 100644
--- a/src/netgis/LayerTree.js
+++ b/src/netgis/LayerTree.js
@@ -24,20 +24,55 @@ netgis.LayerTree.prototype.load = function()
this.list.className = "root";
this.root.appendChild( this.list );
+ this.initDefaultFolders();
+
+ this.tools = document.createElement( "div" );
+ this.tools.className = "netgis-layer-tools";
+ this.tools.innerHTML = "
";
+ this.root.appendChild( this.tools );
+
+ this.buttonAddService = document.createElement( "button" );
+ //this.buttonAddService.className = "netgis-primary netgis-hover-primary netgis-shadow";
+ this.buttonAddService.className = "netgis-text-primary netgis-hover-primary";
+ //this.buttonAddService.innerHTML = " Dienst hinzufügen";
+ this.buttonAddService.innerHTML = " Dienst hinzufügen";
+ //this.buttonAddService.innerHTML = " Dienst hinzufügen";
+ this.buttonAddService.addEventListener( "click", this.onAddServiceClick.bind( this ) );
+ this.tools.appendChild( this.buttonAddService );
+
this.client.root.appendChild( this.root );
this.client.on( netgis.Events.CONTEXT_UPDATE, this.onContextUpdate.bind( this ) );
this.client.on( netgis.Events.LAYER_LIST_TOGGLE, this.onLayerListToggle.bind( this ) );
this.client.on( netgis.Events.LAYER_CREATED, this.onLayerCreated.bind( this ) );
this.client.on( netgis.Events.EDIT_FEATURES_CHANGE, this.onEditFeaturesChange.bind( this ) );
+ this.client.on( netgis.Events.ADD_SERVICE_WMS, this.onAddServiceWMS.bind( this ) );
+ this.client.on( netgis.Events.ADD_SERVICE_WFS, this.onAddServiceWFS.bind( this ) );
//TODO: kind of hack to hide if parcel search open
this.client.on( netgis.Events.SET_MODE, this.onSetMode.bind( this ) );
};
+netgis.LayerTree.prototype.initDefaultFolders = function()
+{
+ this.folderDraw = this.createFolder( "Zeichnung" );
+ this.folderDraw.classList.add( "netgis-hide" );
+ this.list.appendChild( this.folderDraw );
+
+ this.folderImport = this.createFolder( "Importierte Ebenen" );
+ this.folderImport.classList.add( "netgis-hide" );
+ this.list.appendChild( this.folderImport );
+
+ this.folderServices = this.createFolder( "Eigene Dienste" );
+ this.folderServices.classList.add( "netgis-hide" );
+ this.list.appendChild( this.folderServices );
+};
+
netgis.LayerTree.prototype.clearAll = function()
{
this.list.innerHTML = "";
+
+ this.initDefaultFolders();
};
netgis.LayerTree.prototype.createFolder = function( title )
@@ -102,6 +137,9 @@ netgis.LayerTree.prototype.createLayer = function( id, title, checked )
var text = document.createTextNode( title );
label.appendChild( text );
+ var appendix = document.createElement( "span" );
+ label.appendChild( appendix );
+
return item;
};
@@ -342,21 +380,26 @@ netgis.LayerTree.prototype.onLayerCreated = function( e )
//TODO: this is a hack to get special folders working
if ( e.folder === "import" )
{
- if ( ! this.folderImport )
+ /*if ( ! this.folderImport )
{
this.folderImport = this.createFolder( "Importierte Ebenen" );
this.list.insertBefore( this.folderImport, this.folderDraw ? this.folderDraw.nextSibling : this.list.firstChild );
}
-
+ */
+
+ this.folderImport.classList.remove( "netgis-hide" );
+
folder = this.folderImport;
}
else if ( e.folder === "draw" )
{
- if ( ! this.folderDraw )
+ /*if ( ! this.folderDraw )
{
this.folderDraw = this.createFolder( "Zeichnung" );
this.list.insertBefore( this.folderDraw, this.list.firstChild );
- }
+ }*/
+
+ this.folderDraw.classList.remove( "netgis-hide" );
folder = this.folderDraw;
}
@@ -382,13 +425,54 @@ netgis.LayerTree.prototype.onEditFeaturesChange = function( e )
this.updateFolderChecks( this.folderDraw );
this.client.invoke( netgis.Events.LAYER_SHOW, { id: id } );
}
+
+ // Update Area
+ var label = list.getElementsByTagName( "label" )[ 0 ];
+ var spans = label.getElementsByTagName( "span" );
+ var appendix = spans[ spans.length - 1 ];
+
+ if ( e.area && e.area > 0.0 )
+ {
+ appendix.innerText = " (Fläche: " + netgis.util.formatArea( e.area, true ) + ")";
+ }
+ else
+ {
+ appendix.innerText = "";
+ }
};
};
+netgis.LayerTree.prototype.onAddServiceWMS = function( e )
+{
+ var item = this.createLayer( e.id, e.title, true );
+
+ this.folderServices.classList.remove( "netgis-hide" );
+ this.addToFolder( this.folderServices, item, true );
+ this.updateFolderChecks( this.folderServices );
+
+ this.client.invoke( netgis.Events.LAYER_SHOW, { id: e.id } );
+};
+
+netgis.LayerTree.prototype.onAddServiceWFS = function( e )
+{
+ var item = this.createLayer( e.id, e.title, true );
+
+ this.folderServices.classList.remove( "netgis-hide" );
+ this.addToFolder( this.folderServices, item, true );
+ this.updateFolderChecks( this.folderServices );
+
+ this.client.invoke( netgis.Events.LAYER_SHOW, { id: e.id } );
+};
+
netgis.LayerTree.prototype.onSetMode = function( e )
{
if ( e === netgis.Modes.SEARCH_PARCEL )
{
this.root.classList.add( "netgis-hide" );
}
+};
+
+netgis.LayerTree.prototype.onAddServiceClick = function( e )
+{
+ this.client.invoke( netgis.Events.ADD_SERVICE_SHOW, null );
};
\ No newline at end of file
diff --git a/src/netgis/MapOpenLayers.js b/src/netgis/MapOpenLayers.js
index 5321cce..7a8c6bb 100644
--- a/src/netgis/MapOpenLayers.js
+++ b/src/netgis/MapOpenLayers.js
@@ -28,8 +28,11 @@ netgis.MapOpenLayers = function()
this.editEventsSilent = false;
- this.importLayerID = 1000;
- this.editLayerID = 2000;
+ this.importLayerID = 20000;
+ this.editLayerID = 30000;
+ this.labelFont = "4mm Verdana, sans-serif";
+ this.drawBufferRadius = 100.0;
+ this.drawBufferSegments = 3;
};
netgis.MapOpenLayers.prototype = Object.create( netgis.Map.prototype );
@@ -54,9 +57,9 @@ netgis.MapOpenLayers.prototype.load = function()
this.root.addEventListener( "drop", this.onDragDrop.bind( this ) );
// Map Renderer
- this.createMap();
- this.createDefaultLayers();
- this.createInteractions();
+ this.initMap();
+ this.initDefaultLayers();
+ this.initInteractions();
// Events
this.client.on( netgis.Events.CONTEXT_UPDATE, this.onContextUpdate.bind( this ) );
@@ -65,6 +68,8 @@ netgis.MapOpenLayers.prototype.load = function()
this.client.on( netgis.Events.SET_MODE, this.onSetMode.bind( this ) );
this.client.on( netgis.Events.SNAP_ON, this.onSnapOn.bind( this ) );
this.client.on( netgis.Events.SNAP_OFF, this.onSnapOff.bind( this ) );
+ this.client.on( netgis.Events.TRACING_ON, this.onTracingOn.bind( this ) );
+ this.client.on( netgis.Events.TRACING_OFF, this.onTracingOff.bind( this ) );
this.client.on( netgis.Events.LAYER_SHOW, this.onLayerShow.bind( this ) );
this.client.on( netgis.Events.LAYER_HIDE, this.onLayerHide.bind( this ) );
this.client.on( netgis.Events.MAP_ZOOM_WKT, this.onZoomWKT.bind( this ) );
@@ -77,15 +82,23 @@ netgis.MapOpenLayers.prototype.load = function()
this.client.on( netgis.Events.IMPORT_GML, this.onImportGML.bind( this ) );
this.client.on( netgis.Events.IMPORT_SHAPEFILE, this.onImportShapefile.bind( this ) );
this.client.on( netgis.Events.IMPORT_WKT, this.onImportWKT.bind( this ) );
+ this.client.on( netgis.Events.IMPORT_SPATIALITE, this.onImportSpatialite.bind( this ) );
+ this.client.on( netgis.Events.IMPORT_GEOPACKAGE, this.onImportGeopackage.bind( this ) );
this.client.on( netgis.Events.EXPORT_PDF, this.onExportPDF.bind( this ) );
this.client.on( netgis.Events.EXPORT_JPEG, this.onExportJPEG.bind( this ) );
this.client.on( netgis.Events.EXPORT_PNG, this.onExportPNG.bind( this ) );
this.client.on( netgis.Events.EXPORT_GIF, this.onExportGIF.bind( this ) );
this.client.on( netgis.Events.PARCEL_SHOW_PREVIEW, this.onParcelShowPreview.bind( this ) );
this.client.on( netgis.Events.PARCEL_HIDE_PREVIEW, this.onParcelHidePreview.bind( this ) );
+ this.client.on( netgis.Events.ADD_SERVICE_WMS, this.onAddServiceWMS.bind( this ) );
+ this.client.on( netgis.Events.ADD_SERVICE_WFS, this.onAddServiceWFS.bind( this ) );
+ this.client.on( netgis.Events.DRAW_BUFFER_ON, this.onDrawBufferOn.bind( this ) );
+ this.client.on( netgis.Events.DRAW_BUFFER_OFF, this.onDrawBufferOff.bind( this ) );
+ this.client.on( netgis.Events.DRAW_BUFFER_RADIUS_CHANGE, this.onDrawBufferRadiusChange.bind( this ) );
+ this.client.on( netgis.Events.DRAW_BUFFER_SEGMENTS_CHANGE, this.onDrawBufferSegmentsChange.bind( this ) );
};
-netgis.MapOpenLayers.prototype.createMap = function()
+netgis.MapOpenLayers.prototype.initMap = function()
{
var config = this.client.config;
@@ -133,14 +146,17 @@ netgis.MapOpenLayers.prototype.createMap = function()
this.view.on( "change:resolution", this.onChangeResolution.bind( this ) );
};
-netgis.MapOpenLayers.prototype.createDefaultLayers = function()
+netgis.MapOpenLayers.prototype.initDefaultLayers = function()
{
//TODO: why id as z index ?
this.editLayer = new ol.layer.Vector( { source: new ol.source.Vector( { features: [] } ), style: this.styleEdit.bind( this ), zIndex: this.editLayerID } );
this.map.addLayer( this.editLayer );
- this.parcelLayer = new ol.layer.Vector( { source: new ol.source.Vector( { features: [] } ), style: this.styleParcel.bind( this ), zIndex: this.editLayerID + 10 } );
+ this.previewLayer = new ol.layer.Vector( { source: new ol.source.Vector( { features: [] } ), style: this.styleSketch.bind( this ), zIndex: this.editLayerID + 10 } );
+ this.map.addLayer( this.previewLayer );
+
+ this.parcelLayer = new ol.layer.Vector( { source: new ol.source.Vector( { features: [] } ), style: this.styleParcel.bind( this ), zIndex: this.editLayerID + 20 } );
this.map.addLayer( this.parcelLayer );
this.editEventsOn();
@@ -163,7 +179,7 @@ netgis.MapOpenLayers.prototype.editEventsOff = function()
//this.editLayer.getSource().un( "removefeature"/*, this.onEditLayerRemove*/ );
};
-netgis.MapOpenLayers.prototype.createInteractions = function()
+netgis.MapOpenLayers.prototype.initInteractions = function()
{
// View
this.interactions[ netgis.Modes.VIEW ] =
@@ -184,6 +200,8 @@ netgis.MapOpenLayers.prototype.createInteractions = function()
new ol.interaction.MouseWheelZoom()
];
+ this.interactions[ netgis.Modes.DRAW_POINTS ][ 0 ].on( "drawend", this.onDrawPointsEnd.bind( this ) );
+
this.interactions[ netgis.Modes.DRAW_LINES ] =
[
new ol.interaction.Draw( { type: "LineString", source: this.editLayer.getSource(), style: this.styleSketch.bind( this ) } ),
@@ -191,6 +209,8 @@ netgis.MapOpenLayers.prototype.createInteractions = function()
new ol.interaction.MouseWheelZoom()
];
+ this.interactions[ netgis.Modes.DRAW_LINES ][ 0 ].on( "drawend", this.onDrawLinesEnd.bind( this ) );
+
this.interactions[ netgis.Modes.DRAW_POLYGONS ] =
[
new ol.interaction.Draw( { type: "Polygon", source: this.editLayer.getSource(), style: this.styleSketch.bind( this ) } ),
@@ -257,137 +277,175 @@ netgis.MapOpenLayers.prototype.createInteractions = function()
netgis.MapOpenLayers.prototype.createLayer = function( data )
{
- //TODO: refactor into createLayerWMS, createLayerWFS etc.
+ var layer = null;
+ // Create Specific Layer By Type
switch ( data.type )
{
case netgis.LayerTypes.XYZ:
{
- var layer = new ol.layer.Tile
- (
- {
- source: new ol.source.XYZ
- (
- {
- url: data.url,
- crossOrigin: "anonymous"
- }
- )
- }
- );
-
- return layer;
+ layer = this.createLayerXYZ( data.url );
+ break;
}
case netgis.LayerTypes.OSM:
{
- var layer = new ol.layer.Tile
- (
- {
- source: new ol.source.XYZ
- (
- {
- url: "https://{a-c}.tile.openstreetmap.de/{z}/{x}/{y}.png",
- crossOrigin: "anonymous"
- }
- )
- }
- );
-
- return layer;
+ layer = this.createLayerOSM();
+ break;
}
case netgis.LayerTypes.WMS:
{
- var params =
- {
- url: data.url,
- params:
- {
- "LAYERS": data.name,
- "FORMAT": "image/png",
- "TRANSPARENT": "true",
- "VERSION": "1.1.1"
- },
- serverType: "mapserver",
- crossOrigin: "anonymous",
- hidpi: false
- //ratio: 3.0
- };
-
- // Authorization
- if ( data.username && data.password )
- {
- params.imageLoadFunction = function( image, src )
- {
- var request = new XMLHttpRequest();
- request.open( "GET", src );
- request.setRequestHeader( "Authorization", "Basic " + window.btoa( data.username + ":" + data.password ) );
-
- request.onload = function()
- {
- image.getImage().src = src;
- };
-
- request.send();
- };
- }
-
- var source = new ol.source.ImageWMS( params );
-
- var layer = new ol.layer.Image
- (
- {
- source: source,
- //zIndex: index,
- opacity: 1.0
- }
- );
-
- return layer;
+ layer = this.createLayerWMS( data.url, data.name, data.format, data.username, data.password );
+ break;
}
case netgis.LayerTypes.WFS:
{
- var config = this.client.config;
-
- var url = data.url
- + "service=WFS"
- + "&version=1.1.0"
- + "&request=GetFeature"
- + "&outputformat=application/json";
-
- var source = new ol.source.Vector
- (
- {
- format: new ol.format.GeoJSON(),
- strategy: ol.loadingstrategy.bbox,
- url: function( extent )
- {
- return url
- + "&typename=" + data.name
- + "&srsname=" + config.map.projection
- + "&bbox=" + extent.join( "," ) + "," + config.map.projection;
- }
- }
- );
-
- var layer = new ol.layer.Vector
- (
- {
- source: source
- }
- );
-
- var self = this;
- source.on( "featuresloadstart", function( e ) { self.removeSnapLayer( layer ); } );
- source.on( "featuresloadend", function( e ) { window.setTimeout( function() { self.addSnapLayer( layer ); }, 10 ); } );
-
- return layer;
+ layer = this.createLayerWFS( data.url, data.name, this.client.config.map.projection, data.outputFormat );
+ break;
}
}
+
+ // Common Settings
+ if ( layer )
+ {
+ if ( data.minZoom ) layer.setMinZoom( Number.parseFloat( data.minZoom ) - 1.0 );
+ if ( data.maxZoom ) layer.setMaxZoom( Number.parseFloat( data.maxZoom ) );
+ }
+
+ return layer;
+};
- return null;
+netgis.MapOpenLayers.prototype.createLayerXYZ = function( url )
+{
+ var layer = new ol.layer.Tile
+ (
+ {
+ source: new ol.source.XYZ
+ (
+ {
+ url: url,
+ crossOrigin: "anonymous"
+ }
+ )
+ }
+ );
+
+ return layer;
+};
+
+netgis.MapOpenLayers.prototype.createLayerOSM = function()
+{
+ var layer = new ol.layer.Tile
+ (
+ {
+ source: new ol.source.XYZ
+ (
+ {
+ url: "https://{a-c}.tile.openstreetmap.de/{z}/{x}/{y}.png",
+ crossOrigin: "anonymous"
+ }
+ )
+ }
+ );
+
+ return layer;
+};
+
+netgis.MapOpenLayers.prototype.createLayerWMS = function( url, layerName, format, user, password )
+{
+ var params =
+ {
+ url: url,
+ params:
+ {
+ "LAYERS": layerName,
+ "FORMAT": format ? format : "image/png",
+ "TRANSPARENT": "true",
+ "VERSION": "1.1.1"
+ },
+ serverType: "mapserver",
+ crossOrigin: "anonymous",
+ hidpi: false
+ //ratio: 3.0
+ };
+
+ // Authorization
+ if ( user && password )
+ {
+ params.imageLoadFunction = function( image, src )
+ {
+ var request = new XMLHttpRequest();
+ request.open( "GET", src );
+ request.setRequestHeader( "Authorization", "Basic " + window.btoa( user + ":" + password ) );
+
+ request.onload = function()
+ {
+ image.getImage().src = src;
+ };
+
+ request.send();
+ };
+ }
+
+ var source = new ol.source.ImageWMS( params );
+
+ var layer = new ol.layer.Image
+ (
+ {
+ source: source,
+ //zIndex: index,
+ opacity: 1.0
+ }
+ );
+
+ return layer;
+};
+
+netgis.MapOpenLayers.prototype.createLayerWFS = function( url, typeName, projection, outputFormat )
+{
+ url = url
+ + "service=WFS"
+ + "&version=1.1.0"
+ + "&request=GetFeature";
+
+ if ( ! outputFormat )
+ outputFormat = "application/json";
+ else
+ outputFormat = netgis.util.replace( outputFormat, " ", "+" ); //TODO: encode uri component ?
+
+ var source = new ol.source.Vector
+ (
+ {
+ format: new ol.format.GeoJSON(),
+ strategy: ol.loadingstrategy.bbox,
+ url: function( extent )
+ {
+ return url
+ + "&typename=" + typeName
+ + "&srsname=" + projection
+ + "&bbox=" + extent.join( "," ) + "," + projection
+ + "&outputFormat=" + outputFormat;
+ }
+
+ //TODO: custom loader function to catch xhr response parse errors
+ }
+ );
+
+ var layer = new ol.layer.Vector
+ (
+ {
+ source: source
+ }
+ );
+
+ var self = this;
+ source.on( "featuresloadstart", function( e ) { self.removeSnapLayer( layer ); } );
+ source.on( "featuresloadend", function( e ) { window.setTimeout( function() { self.addSnapLayer( layer ); }, 10 ); } );
+ //source.on( "featuresloaderror", function( e ) { console.info( "Layer Error:", e ); } );
+
+ return layer;
};
netgis.MapOpenLayers.prototype.clearAll = function()
@@ -416,9 +474,10 @@ netgis.MapOpenLayers.prototype.onUpdateStyle = function( e )
this.editLayer.setStyle( style );
};
-netgis.MapOpenLayers.prototype.styleEdit = function()
+netgis.MapOpenLayers.prototype.styleEdit = function( feature )
{
var radius = this.client.config.styles.editLayer.pointRadius;
+ var geom = feature.getGeometry();
var style = new ol.style.Style
(
@@ -429,11 +488,32 @@ netgis.MapOpenLayers.prototype.styleEdit = function()
}
);
+ if ( geom instanceof ol.geom.Polygon )
+ {
+ var area = geom.getArea();
+
+ style.setText
+ (
+ new ol.style.Text
+ (
+ {
+ text: [ netgis.util.formatArea( area, true ), "4mm sans-serif" ],
+ font: this.labelFont,
+ fill: new ol.style.Fill( { color: this.client.config.styles.editLayer.stroke } ),
+ backgroundFill: new ol.style.Fill( { color: "rgba( 255, 255, 255, 0.5 )" } ),
+ padding: [ 2, 4, 2, 4 ]
+ }
+ )
+ );
+ }
+
return style;
};
netgis.MapOpenLayers.prototype.styleSelect = function( feature )
{
+ var geom = feature.getGeometry();
+
var style = new ol.style.Style
(
{
@@ -443,6 +523,25 @@ netgis.MapOpenLayers.prototype.styleSelect = function( feature )
}
);
+ if ( geom instanceof ol.geom.Polygon )
+ {
+ var area = geom.getArea();
+
+ style.setText
+ (
+ new ol.style.Text
+ (
+ {
+ text: [ netgis.util.formatArea( area, true ), "4mm sans-serif" ],
+ font: this.labelFont,
+ fill: new ol.style.Fill( { color: this.client.config.styles.select.stroke } ),
+ backgroundFill: new ol.style.Fill( { color: "rgba( 255, 255, 255, 0.5 )" } ),
+ padding: [ 2, 4, 2, 4 ]
+ }
+ )
+ );
+ }
+
return style;
};
@@ -469,7 +568,9 @@ netgis.MapOpenLayers.prototype.styleModify = function( feature )
};
netgis.MapOpenLayers.prototype.styleSketch = function( feature )
-{
+{
+ var geom = feature.getGeometry();
+
var style = new ol.style.Style
(
{
@@ -479,6 +580,25 @@ netgis.MapOpenLayers.prototype.styleSketch = function( feature )
}
);
+ if ( geom instanceof ol.geom.Polygon )
+ {
+ var area = geom.getArea();
+
+ style.setText
+ (
+ new ol.style.Text
+ (
+ {
+ text: [ netgis.util.formatArea( area, true ), "4mm sans-serif" ],
+ font: this.labelFont,
+ fill: new ol.style.Fill( { color: this.client.config.styles.sketch.stroke } ),
+ backgroundFill: new ol.style.Fill( { color: "rgba( 255, 255, 255, 0.5 )" } ),
+ padding: [ 2, 4, 2, 4 ]
+ }
+ )
+ );
+ }
+
var vertex = new ol.style.Style
(
{
@@ -599,7 +719,7 @@ netgis.MapOpenLayers.prototype.getActiveVectorLayers = function()
netgis.MapOpenLayers.prototype.setMode = function( mode )
{
- // Old Mode
+ // Leave
switch ( this.mode )
{
case netgis.Modes.BUFFER_FEATURE_EDIT:
@@ -607,6 +727,18 @@ netgis.MapOpenLayers.prototype.setMode = function( mode )
this.onBufferCancel( null );
break;
}
+
+ case netgis.Modes.DRAW_POINTS:
+ case netgis.Modes.DRAW_LINES:
+ {
+ this.onDrawBufferOff( null );
+ break;
+ }
+ }
+
+ // Enter
+ switch ( mode )
+ {
}
// Interactions
@@ -674,6 +806,8 @@ netgis.MapOpenLayers.prototype.setSnapOn = function()
this.snapFeatures.changed();
//this.updateSnapLayers();
+
+ //TODO: https://openlayers.org/en/latest/examples/tracing.html
};
netgis.MapOpenLayers.prototype.setSnapOff = function()
@@ -685,6 +819,29 @@ netgis.MapOpenLayers.prototype.setSnapOff = function()
//this.snapFeatures = null;
}
};
+
+netgis.MapOpenLayers.prototype.setTracingOn = function()
+{
+ var source = new ol.source.Vector( { features: this.snapFeatures } );
+
+ this.tracing = new ol.interaction.Draw( { type: "Polygon", source: this.editLayer.getSource(), style: this.styleSketch.bind( this ), trace: true, traceSource: source } );
+
+ var actions = this.interactions[ netgis.Modes.DRAW_POLYGONS ];
+ actions[ 0 ].setActive( false );
+ actions.push( this.tracing );
+
+ this.setMode( this.mode );
+};
+
+netgis.MapOpenLayers.prototype.setTracingOff = function()
+{
+ var actions = this.interactions[ netgis.Modes.DRAW_POLYGONS ];
+ actions[ 0 ].setActive( true );
+ actions.splice( actions.indexOf( this.tracing ), 1 );
+
+ this.setMode( this.mode );
+};
+
/*
netgis.MapOpenLayers.prototype.updateSnapLayers = function()
{
@@ -739,6 +896,16 @@ netgis.MapOpenLayers.prototype.onSnapOff = function( e )
this.setSnapOff();
};
+netgis.MapOpenLayers.prototype.onTracingOn = function( e )
+{
+ this.setTracingOn();
+};
+
+netgis.MapOpenLayers.prototype.onTracingOff = function( e )
+{
+ this.setTracingOff();
+};
+
netgis.MapOpenLayers.prototype.onLayerShow = function( e )
{
var layer = this.layers[ e.id ];
@@ -825,6 +992,20 @@ netgis.MapOpenLayers.prototype.onContextUpdate = function( e )
}*/
};
+netgis.MapOpenLayers.prototype.onAddServiceWMS = function( e )
+{
+ var layer = this.createLayerWMS( e.url, e.name, e.format );
+ layer.setZIndex( e.id );
+ this.layers[ e.id ] = layer;
+};
+
+netgis.MapOpenLayers.prototype.onAddServiceWFS = function( e )
+{
+ var layer = this.createLayerWFS( e.url, e.name, this.client.config.map.projection, e.format );
+ layer.setZIndex( e.id );
+ this.layers[ e.id ] = layer;
+};
+
netgis.MapOpenLayers.prototype.onSetMode = function( e )
{
this.setMode( e );
@@ -857,7 +1038,8 @@ netgis.MapOpenLayers.prototype.onZoomWKT = function( e )
netgis.MapOpenLayers.prototype.onPointerMove = function( e )
{
- //var pixel = e.pixel;
+ var pixel = e.pixel;
+ var coords = e.coordinate;
var hover = this.hover;
var styleSelect = this.styleSelect.bind( this );
@@ -876,7 +1058,7 @@ netgis.MapOpenLayers.prototype.onPointerMove = function( e )
{
this.map.forEachFeatureAtPixel
(
- e.pixel,
+ pixel,
function( feature, layer ) //TODO: bind to this?
{
if ( layer === self.editLayer )
@@ -896,7 +1078,7 @@ netgis.MapOpenLayers.prototype.onPointerMove = function( e )
{
this.map.forEachFeatureAtPixel
(
- e.pixel,
+ pixel,
function( feature, layer ) //TODO: bind to this?
{
if ( layer === self.editLayer )
@@ -916,7 +1098,7 @@ netgis.MapOpenLayers.prototype.onPointerMove = function( e )
{
this.map.forEachFeatureAtPixel
(
- e.pixel,
+ pixel,
function( feature, layer ) //TODO: bind to this?
{
if ( layer === self.editLayer )
@@ -931,6 +1113,13 @@ netgis.MapOpenLayers.prototype.onPointerMove = function( e )
break;
}
+
+ case netgis.Modes.DRAW_POINTS:
+ case netgis.Modes.DRAW_LINES:
+ {
+ this.updateDrawBufferPreview();
+ break;
+ }
}
//TODO: refactor to default hover handler?
@@ -1030,13 +1219,31 @@ netgis.MapOpenLayers.prototype.onCutFeatureDrawEnd = function( e )
netgis.MapOpenLayers.prototype.onModifyFeaturesEnd = function( e )
{
this.updateEditOutput();
+ this.updateEditArea();
+};
+
+netgis.MapOpenLayers.prototype.createBufferFeature = function( srcgeom, radius, segments )
+{
+ var geom = this.createBufferGeometry( srcgeom, radius, segments );
+ var feature = new ol.Feature( { geometry: geom } );
+
+ return feature;
+};
+
+netgis.MapOpenLayers.prototype.createBufferGeometry = function( srcgeom, radius, segments )
+{
+ var parser = new jsts.io.OL3Parser();
+
+ var a = parser.read( srcgeom );
+ var b = a.buffer( radius, segments );
+
+ var geom = parser.write( b );
+
+ return geom;
};
netgis.MapOpenLayers.prototype.onBufferChange = function( e )
{
- var radius = e.radius;
- var segments = e.segments;
-
var source = this.editLayer.getSource();
var target = this.selected;
@@ -1047,15 +1254,7 @@ netgis.MapOpenLayers.prototype.onBufferChange = function( e )
if ( target )
{
- // Cut Process
- var parser = new jsts.io.OL3Parser();
-
- var a = parser.read( target.getGeometry() );
- var b = a.buffer( radius, segments );
-
- // Output
- var geom = parser.write( b );
- var feature = new ol.Feature( { geometry: geom } );
+ var feature = this.createBufferFeature( target.getGeometry(), e.radius, e.segments );
//source.removeFeature( target );
source.addFeature( feature );
@@ -1090,10 +1289,87 @@ netgis.MapOpenLayers.prototype.onBufferCancel = function( e )
this.selected = null;
};
+netgis.MapOpenLayers.prototype.onDrawPointsEnd = function( e )
+{
+ var preview = this.previewLayer.getSource().getFeatures()[ 0 ];
+
+ if ( preview )
+ {
+ var src = this.editLayer.getSource();
+ src.addFeature( preview.clone() );
+
+ //TODO: remove sketch point ?
+ //this.editLayer.getSource().removeFeature( e.feature );
+
+ /*window.setTimeout( function() {
+ var features = src.getFeatures();
+ src.removeFeature( features[ features.length - 1 ] );
+ src.addFeature( preview.clone() );
+ }, 10 );*/
+
+ /*e.preventDefault();
+ e.stopPropagation();
+ return false;*/
+ }
+};
+
+netgis.MapOpenLayers.prototype.onDrawLinesEnd = function( e )
+{
+ var preview = this.previewLayer.getSource().getFeatures()[ 0 ];
+ if ( ! preview ) return;
+
+ var src = this.editLayer.getSource();
+ src.addFeature( preview.clone() );
+};
+
+netgis.MapOpenLayers.prototype.onDrawBufferOn = function( e )
+{
+ var feature = this.createBufferFeature( new ol.geom.Point( this.client.config.map.center ), this.drawBufferRadius, this.drawBufferSegments );
+ this.previewLayer.getSource().addFeature( feature );
+
+ //TODO: send all draw buffer params with events ?
+};
+
+netgis.MapOpenLayers.prototype.onDrawBufferOff = function( e )
+{
+ this.previewLayer.getSource().clear();
+};
+
+netgis.MapOpenLayers.prototype.onDrawBufferRadiusChange = function( e )
+{
+ var radius = e;
+ this.drawBufferRadius = radius;
+
+ this.updateDrawBufferPreview();
+};
+
+netgis.MapOpenLayers.prototype.onDrawBufferSegmentsChange = function( e )
+{
+ var segs = e;
+ this.drawBufferSegments = segs;
+
+ this.updateDrawBufferPreview();
+};
+
+netgis.MapOpenLayers.prototype.updateDrawBufferPreview = function()
+{
+ var draw = this.interactions[ this.mode ][ 0 ];
+ var overlays = draw.getOverlay().getSource().getFeatures();
+ if ( overlays.length < 1 ) return;
+
+ var preview = this.previewLayer.getSource().getFeatures()[ 0 ];
+ if ( ! preview ) return;
+
+ var geom = overlays[ 0 ].getGeometry();
+ var buffer = this.createBufferGeometry( geom, this.drawBufferRadius, this.drawBufferSegments );
+ preview.setGeometry( buffer );
+};
+
netgis.MapOpenLayers.prototype.onEditLayerAdd = function( e )
{
- this.updateEditOutput();
+ ////this.updateEditOutput();
this.updateEditLayerItem();
+ this.updateEditOutput();
this.snapFeatures.push( e.feature );
};
@@ -1116,14 +1392,28 @@ netgis.MapOpenLayers.prototype.updateEditOutput = function()
var format = new ol.format.GeoJSON();
var output = format.writeFeaturesObject( features, { dataProjection: proj, featureProjection: proj } );
+ // Projection
output[ "crs" ] =
{
"type": "name",
"properties": { "name": "urn:ogc:def:crs:" + proj.replace( ":", "::" ) }
};
+ // Total Area
+ var area = 0.0;
+
+ for ( var i = 0; i < features.length; i++ )
+ {
+ var geom = features[ i ].getGeometry();
+ if ( geom instanceof ol.geom.Polygon ) area += geom.getArea();
+ }
+
+ output[ "area" ] = area;
+
if ( ! this.editEventsSilent )
+ {
this.client.invoke( netgis.Events.EDIT_FEATURES_CHANGE, output );
+ }
};
netgis.MapOpenLayers.prototype.updateEditLayerItem = function()
@@ -1138,6 +1428,11 @@ netgis.MapOpenLayers.prototype.updateEditLayerItem = function()
}
};
+netgis.MapOpenLayers.prototype.updateEditArea = function()
+{
+
+};
+
netgis.MapOpenLayers.prototype.onEditFeaturesLoaded = function( e )
{
var json = e;
@@ -1247,6 +1542,28 @@ netgis.MapOpenLayers.prototype.onImportShapefile = function( e )
reader.readAsArrayBuffer( file );
};
+netgis.MapOpenLayers.prototype.onImportSpatialite = function( e )
+{
+ var file = e;
+ var title = file.name;
+ var self = this;
+
+ var reader = new FileReader();
+ reader.onload = function( e ) { self.createLayerSpatialite( title, e.target.result ); };
+ reader.readAsArrayBuffer( file );
+};
+
+netgis.MapOpenLayers.prototype.onImportGeopackage = function( e )
+{
+ var file = e;
+ var title = file.name;
+ var self = this;
+
+ var reader = new FileReader();
+ reader.onload = function( e ) { self.createLayerGeopackage( title, e.target.result ); };
+ reader.readAsArrayBuffer( file );
+};
+
netgis.MapOpenLayers.prototype.createLayerGeoJSON = function( title, data )
{
var format = new ol.format.GeoJSON();
@@ -1265,7 +1582,6 @@ netgis.MapOpenLayers.prototype.createLayerGeoJSON = function( title, data )
case this.client.config.map.projection:
{
// Projection OK
- //console.info( "Import Projection:", projcode );
break;
}
@@ -1441,6 +1757,124 @@ netgis.MapOpenLayers.prototype.createLayerShapefile = function( title, shapeData
);
};
+netgis.MapOpenLayers.prototype.createLayerSpatialite = function( title, data )
+{
+ var self = this;
+
+ window.initSqlJs().then
+ (
+ function( SQL )
+ {
+ var features = [];
+
+ var arr = new Uint8Array( data );
+ var db = new SQL.Database( arr );
+
+ // Tables
+ var results = db.exec
+ (
+ "SELECT name FROM sqlite_schema WHERE type = 'table' \n\
+ AND name NOT LIKE 'sqlite_%' \n\
+ AND name NOT LIKE 'sql_%' \n\
+ AND name NOT LIKE 'idx_%' \n\
+ AND name NOT LIKE 'spatial_ref_sys%' \n\
+ AND name NOT LIKE 'spatialite_%' \n\
+ AND name NOT LIKE 'geometry_columns%' \n\
+ AND name NOT LIKE 'views_%' \n\
+ AND name NOT LIKE 'virts_%' \n\
+ AND name NOT LIKE 'SpatialIndex' \n\
+ AND name NOT LIKE 'ElementaryGeometries' \n\
+ ;" );
+
+ var tables = results[ 0 ].values;
+
+ for ( var t = 0; t < tables.length; t++ )
+ {
+ var table = tables[ t ][ 0 ];
+
+ results = db.exec( "SELECT * FROM " + table );
+ var result = results[ 0 ];
+
+ // Columns
+ var geomcol = null;
+
+ for ( var c = 0; c < result.columns.length; c++ )
+ {
+ if ( result.columns[ c ].toLowerCase() === "geometry" ) { geomcol = c; break; }
+ if ( result.columns[ c ].toLowerCase() === "geom" ) { geomcol = c; break; }
+ }
+
+ // Rows
+ var rows = result.values;
+
+ for ( var r = 0; r < rows.length; r++ )
+ {
+ var row = rows[ r ];
+
+ // Convert WKB
+ var input = row[ geomcol ];
+ var output = new Uint8Array( input.length - 43 - 1 + 5 );
+
+ // Byte Order
+ output[ 0 ] = input[ 1 ];
+
+ // Type
+ output[ 1 ] = input[ 39 ];
+ output[ 2 ] = input[ 40 ];
+ output[ 3 ] = input[ 41 ];
+ output[ 4 ] = input[ 42 ];
+
+ // Geometry
+ var geomlen = input.length - 43 - 1;
+
+ for ( var i = 0; i < geomlen; i++ )
+ {
+ output[ 5 + i ] = input[ 43 + i ];
+ }
+
+ var wkb = new ol.format.WKB();
+ var geom = wkb.readGeometry( output, { featureProjection: self.client.config.map.projection } );
+
+ features.push( new ol.Feature( { geometry: geom } ) );
+ }
+ }
+
+ self.addImportedFeatures( features );
+ }
+ );
+};
+
+netgis.MapOpenLayers.prototype.createLayerGeopackage = function( title, data )
+{
+ var self = this;
+ var arr = new Uint8Array( data );
+
+ window.GeoPackage.setSqljsWasmLocateFile( function( file ) { return self.client.config.import.geopackageLibURL + file; } );
+
+ window.GeoPackage.GeoPackageAPI.open( arr ).then( function( geoPackage )
+ {
+ var features = [];
+ var format = new ol.format.GeoJSON();
+ var tables = geoPackage.getFeatureTables();
+
+ for ( var t = 0; t < tables.length; t++ )
+ {
+ var table = tables[ t ];
+ var rows = geoPackage.queryForGeoJSONFeaturesInTable( table );
+
+ for ( var r = 0; r < rows.length; r++ )
+ {
+ var row = rows[ r ];
+ var geom = format.readGeometry( row.geometry, { featureProjection: self.client.config.map.projection } );
+ var feature = new ol.Feature( { geometry: geom } );
+ features.push( feature );
+ }
+ }
+
+ self.addImportedFeatures( features );
+ } );
+};
+
netgis.MapOpenLayers.prototype.addImportedFeatures = function( features )
{
// Add To Edit Layer
@@ -1537,6 +1971,7 @@ netgis.MapOpenLayers.prototype.exportImage = function( format, resx, resy, mode,
// Request Logo Image
var logo = new Image();
+
logo.onload = function()
{
//TODO: refactor map render image and image export
@@ -1596,6 +2031,13 @@ netgis.MapOpenLayers.prototype.exportImage = function( format, resx, resy, mode,
// Watermark Logo
mapContext.drawImage( logo, 0, 0 );
+
+ // Timestamp
+ mapContext.fillStyle = "#fff";
+ mapContext.fillRect( 0, mapCanvas.height - 30, 140, 30 );
+ mapContext.fillStyle = "#000";
+ mapContext.font = "4mm sans-serif";
+ mapContext.fillText( netgis.util.getTimeStamp(), 10, mapCanvas.height - 10 );
// Export Map Image
var link = document.createElement( "a" );
@@ -1658,7 +2100,11 @@ netgis.MapOpenLayers.prototype.exportImage = function( format, resx, resy, mode,
pdf.addImage( mapCanvas.toDataURL( "image/png,1.0", 1.0 ), "PNG", x, y, width, height );
// Text
+ pdf.setFillColor( 255, 255, 255 );
+ pdf.rect( x, y + height - 11, 80, 11, "F" );
+
pdf.setFontSize( 8 );
+ pdf.text( "Datum: " + netgis.util.getTimeStamp(), x + 2, y + height - 2 - 4 );
pdf.text( "Quelle: " + window.location.href, x + 2, y + height - 2 );
// Same Tab
diff --git a/src/netgis/Menu.js b/src/netgis/Menu.js
index c61ee8c..eacacad 100644
--- a/src/netgis/Menu.js
+++ b/src/netgis/Menu.js
@@ -72,6 +72,8 @@ netgis.Menu.prototype.load = function()
//fileItems.appendChild( this.createMenuItem( 'KML', this.onImportKMLClick.bind( this ) ) );
importItem.appendChild( this.createMenuItem( 'GML', this.onImportGMLClick.bind( this ) ) );
importItem.appendChild( this.createMenuItem( 'Shapefile', this.onImportShapefileClick.bind( this ) ) );
+ importItem.appendChild( this.createMenuItem( 'Spatialite', this.onImportSpatialiteClick.bind( this ) ) );
+ importItem.appendChild( this.createMenuItem( 'GeoPackage', this.onImportGeopackageClick.bind( this ) ) );
// Export
var exportMenu = this.createMenu( 'Export' );
@@ -228,6 +230,16 @@ netgis.Menu.prototype.onImportGMLClick = function( e )
this.client.invoke( netgis.Events.IMPORT_GML_SHOW, null );
};
+netgis.Menu.prototype.onImportSpatialiteClick = function( e )
+{
+ this.client.invoke( netgis.Events.IMPORT_SPATIALITE_SHOW, null );
+};
+
+netgis.Menu.prototype.onImportGeopackageClick = function( e )
+{
+ this.client.invoke( netgis.Events.IMPORT_GEOPACKAGE_SHOW, null );
+};
+
netgis.Menu.prototype.onExportPDFClick = function( e )
{
this.client.invoke( netgis.Events.EXPORT_PDF_SHOW, null );
diff --git a/src/netgis/Modal.css b/src/netgis/Modal.css
index ec4d3ca..39b7d02 100644
--- a/src/netgis/Modal.css
+++ b/src/netgis/Modal.css
@@ -131,7 +131,8 @@
cursor: not-allowed;
}
-.netgis-modal-content input
+.netgis-modal-content input,
+.netgis-modal-content select
{
width: 100%;
}
diff --git a/src/netgis/Modal.js b/src/netgis/Modal.js
index 5d8be16..d38f4ef 100644
--- a/src/netgis/Modal.js
+++ b/src/netgis/Modal.js
@@ -21,6 +21,9 @@ netgis.Modal = function()
this.exportJPEG = null;
this.exportPNG = null;
this.exportGIF = null;
+ this.addService = null;
+
+ this.addServiceID = 10000;
};
netgis.Modal.prototype.load = function()
@@ -39,6 +42,12 @@ netgis.Modal.prototype.load = function()
this.importShapefile = this.createImportShapefile();
this.root.appendChild( this.importShapefile );
+ this.importSpatialite = this.createImportSpatialite();
+ this.root.appendChild( this.importSpatialite );
+
+ this.importGeopackage = this.createImportGeopackage();
+ this.root.appendChild( this.importGeopackage );
+
// Export
this.exportPDF = this.createExportPDF();
this.root.appendChild( this.exportPDF );
@@ -52,6 +61,10 @@ netgis.Modal.prototype.load = function()
this.exportGIF = this.createExportGIF();
this.root.appendChild( this.exportGIF );
+ // Layers
+ this.addService = this.createAddService();
+ this.root.appendChild( this.addService );
+
// Done
this.client.root.appendChild( this.root );
@@ -59,11 +72,15 @@ netgis.Modal.prototype.load = function()
this.client.on( netgis.Events.IMPORT_GEOJSON_SHOW, this.onImportGeoJSONShow.bind( this ) );
this.client.on( netgis.Events.IMPORT_GML_SHOW, this.onImportGMLShow.bind( this ) );
this.client.on( netgis.Events.IMPORT_SHAPEFILE_SHOW, this.onImportShapefileShow.bind( this ) );
+ this.client.on( netgis.Events.IMPORT_SPATIALITE_SHOW, this.onImportSpatialiteShow.bind( this ) );
+ this.client.on( netgis.Events.IMPORT_GEOPACKAGE_SHOW, this.onImportGeopackageShow.bind( this ) );
this.client.on( netgis.Events.EXPORT_PDF_SHOW, this.onExportPDFShow.bind( this ) );
this.client.on( netgis.Events.EXPORT_JPEG_SHOW, this.onExportJPEGShow.bind( this ) );
this.client.on( netgis.Events.EXPORT_PNG_SHOW, this.onExportPNGShow.bind( this ) );
this.client.on( netgis.Events.EXPORT_GIF_SHOW, this.onExportGIFShow.bind( this ) );
+
+ this.client.on( netgis.Events.ADD_SERVICE_SHOW, this.onAddServiceShow.bind( this ) );
};
netgis.Modal.prototype.createImportGeoJSON = function()
@@ -102,6 +119,30 @@ netgis.Modal.prototype.createImportShapefile = function()
return container;
};
+netgis.Modal.prototype.createImportSpatialite = function()
+{
+ var container = this.createContainer( "Import Spatialite" );
+
+ this.createText( container, "Unterstützte Koordinatensysteme:", "- World Geodetic System 1984 (EPSG:4326)
- ETRS89 / UTM zone 32N (EPSG:25832)
" );
+ this.createInputFile( container, "Datei auswählen / ablegen:", ".sqlite", this.onImportSpatialiteChange.bind( this ) );
+ this.createSpace( container );
+ this.createButton( container, "Importieren", this.onImportSpatialiteAccept.bind( this ) );
+
+ return container;
+};
+
+netgis.Modal.prototype.createImportGeopackage = function()
+{
+ var container = this.createContainer( "Import GeoPackage" );
+
+ this.createText( container, "Unterstützte Koordinatensysteme:", "- World Geodetic System 1984 (EPSG:4326)
- ETRS89 / UTM zone 32N (EPSG:25832)
" );
+ this.createInputFile( container, "Datei auswählen / ablegen:", ".gpkg", this.onImportGeopackageChange.bind( this ) );
+ this.createSpace( container );
+ this.createButton( container, "Importieren", this.onImportGeopackageAccept.bind( this ) );
+
+ return container;
+};
+
netgis.Modal.prototype.createExportPDF = function()
{
var container = this.createContainer( "Export PDF" );
@@ -152,6 +193,29 @@ netgis.Modal.prototype.createExportGIF = function()
return container;
};
+netgis.Modal.prototype.createAddService = function()
+{
+ var container = this.createContainer( "Dienst hinzufügen" );
+
+ this.createInputText( container, "WMS/WFS URL:" );
+ this.createSpace( container );
+ this.createButton( container, "Dienst laden", this.onAddServiceLoad.bind( this ) );
+
+ /*var details = document.createElement( "div" );
+ details.className = "netgis-hide";
+ container.appendChild( details );*/
+
+ this.createSpace( container );
+ this.createInputHidden( container );
+ this.createText( container, "Bezeichnung:", "" );
+ this.createInputSelect( container, "Kartenebene:", [] );
+ this.createInputSelect( container, "Format:", [] );
+ this.createSpace( container );
+ this.createButton( container, "Dienst hinzufügen", this.onAddServiceAccept.bind( this ) );
+
+ return container;
+};
+
netgis.Modal.prototype.show = function( container )
{
this.root.classList.add( "netgis-show" );
@@ -243,6 +307,25 @@ netgis.Modal.prototype.createButton = function( container, title, callback )
return button;
};
+netgis.Modal.prototype.createInputHidden = function( container )
+{
+ var row = document.createElement( "tr" );
+ row.className = "netgis-hidden";
+
+ var cell = document.createElement( "td" );
+ row.appendChild( cell );
+
+ var input = document.createElement( "input" );
+ input.setAttribute( "type", "hidden" );
+ cell.appendChild( input );
+
+ var content = container.getElementsByClassName( "netgis-modal-content" )[ 0 ];
+ var table = content.getElementsByTagName( "table" )[ 0 ];
+ table.appendChild( row );
+
+ return input;
+};
+
netgis.Modal.prototype.createInputText = function( container, title )
{
var row = document.createElement( "tr" );
@@ -258,12 +341,41 @@ netgis.Modal.prototype.createInputText = function( container, title )
var cell = document.createElement( "td" );
cell.className = "netgis-padding";
+ row.appendChild( cell );
var input = document.createElement( "input" );
input.setAttribute( "type", "text" );
cell.appendChild( input );
+
+ label.htmlFor = input;
+
+ var content = container.getElementsByClassName( "netgis-modal-content" )[ 0 ];
+ var table = content.getElementsByTagName( "table" )[ 0 ];
+ table.appendChild( row );
+
+ return input;
+};
+
+netgis.Modal.prototype.createInputSelect = function( container, title, keyValues )
+{
+ var row = document.createElement( "tr" );
+ //row.className = "netgis-hover-light";
+
+ var head = document.createElement( "th" );
+ head.className = "netgis-padding";
+
+ var label = document.createElement( "label" );
+ label.innerHTML = title;
+ head.appendChild( label );
+ row.appendChild( head );
+
+ var cell = document.createElement( "td" );
+ cell.className = "netgis-padding";
row.appendChild( cell );
+ var input = document.createElement( "select" );
+ cell.appendChild( input );
+
label.htmlFor = input;
var content = container.getElementsByClassName( "netgis-modal-content" )[ 0 ];
@@ -503,6 +615,74 @@ netgis.Modal.prototype.onImportShapefileAccept = function( e )
this.hide();
};
+netgis.Modal.prototype.onImportSpatialiteShow = function( e )
+{
+ var input = this.importShapefile.getElementsByTagName( "input" )[ 0 ];
+ var button = this.importShapefile.getElementsByTagName( "button" )[ 1 ];
+ input.value = "";
+ button.disabled = true;
+
+ this.show( this.importSpatialite );
+};
+
+netgis.Modal.prototype.onImportSpatialiteChange = function( e )
+{
+ var input = this.importSpatialite.getElementsByTagName( "input" )[ 0 ];
+ var button = this.importSpatialite.getElementsByTagName( "button" )[ 1 ];
+
+ if ( input.value && input.value.length > 0 )
+ {
+ button.disabled = false;
+ }
+ else
+ {
+ button.disabled = true;
+ }
+};
+
+netgis.Modal.prototype.onImportSpatialiteAccept = function( e )
+{
+ var input = this.importSpatialite.getElementsByTagName( "input" )[ 0 ];
+ var file = input.files[ 0 ];
+ this.client.invoke( netgis.Events.IMPORT_SPATIALITE, file );
+
+ this.hide();
+};
+
+netgis.Modal.prototype.onImportGeopackageShow = function( e )
+{
+ var input = this.importGeopackage.getElementsByTagName( "input" )[ 0 ];
+ var button = this.importGeopackage.getElementsByTagName( "button" )[ 1 ];
+ input.value = "";
+ button.disabled = true;
+
+ this.show( this.importGeopackage );
+};
+
+netgis.Modal.prototype.onImportGeopackageChange = function( e )
+{
+ var input = this.importGeopackage.getElementsByTagName( "input" )[ 0 ];
+ var button = this.importGeopackage.getElementsByTagName( "button" )[ 1 ];
+
+ if ( input.value && input.value.length > 0 )
+ {
+ button.disabled = false;
+ }
+ else
+ {
+ button.disabled = true;
+ }
+};
+
+netgis.Modal.prototype.onImportGeopackageAccept = function( e )
+{
+ var input = this.importGeopackage.getElementsByTagName( "input" )[ 0 ];
+ var file = input.files[ 0 ];
+ this.client.invoke( netgis.Events.IMPORT_GEOPACKAGE, file );
+
+ this.hide();
+};
+
netgis.Modal.prototype.onExportPDFShow = function( e )
{
var inputs = this.exportPDF.getElementsByTagName( "input" );
@@ -588,5 +768,237 @@ netgis.Modal.prototype.onExportGIFAccept = function( e )
var resy = Number.parseInt( inputs[ 1 ].value );
this.client.invoke( netgis.Events.EXPORT_GIF, { resx: resx, resy: resy } );
+ this.hide();
+};
+
+netgis.Modal.prototype.onAddServiceShow = function( e )
+{
+ //this.addService.getElementsByTagName( "input" )[ 0 ].value = "";
+
+ this.show( this.addService );
+
+ // Hide Details
+ var rows = this.addService.getElementsByTagName( "tr" );
+
+ for ( var r = 3; r < rows.length; r++ )
+ {
+ rows[ r ].classList.add( "netgis-hide" );
+ }
+};
+
+netgis.Modal.prototype.onAddServiceLoad = function( e )
+{
+ var inputs = this.addService.getElementsByTagName( "input" );
+ var url = inputs[ 0 ].value;
+
+ // Get Base URL
+ var qmark = url.indexOf( "?" );
+ if ( qmark > -1 ) url = url.substr( 0, qmark );
+
+ var getCaps = url + "?request=GetCapabilities";
+
+ netgis.util.request( getCaps, this.onAddServiceCapsResponse.bind( this ) );
+
+ console.info( "Add Service Load:", url );
+};
+
+netgis.Modal.prototype.onAddServiceCapsResponse = function( e )
+{
+ var parser = new DOMParser();
+ var xml = parser.parseFromString( e, "text/xml" );
+ var caps = xml.documentElement;
+
+ var rows = this.addService.getElementsByTagName( "tr" );
+ var rowTitle = rows[ 5 ];
+
+ var inputs = this.addService.getElementsByTagName( "input" );
+ var inputType = inputs[ 1 ];
+
+ var selects = this.addService.getElementsByTagName( "select" );
+ var selectLayer = selects[ 0 ];
+ var selectFormat = selects[ 1 ];
+
+ for ( var i = selectLayer.options.length - 1; i >= 0; i-- ) selectLayer.options.remove( i );
+ for ( var i = selectFormat.options.length - 1; i >= 0; i-- ) selectFormat.options.remove( i );
+
+ switch ( caps.nodeName )
+ {
+ // WMS
+ case "WMS_Capabilities":
+ {
+ inputType.value = "wms";
+
+ var version = caps.getAttribute( "version" );
+ var service = caps.getElementsByTagName( "Service" )[ 0 ];
+ var title = service.getElementsByTagName( "Title" )[ 0 ].textContent;
+ rowTitle.children[ 1 ].innerHTML = title;
+
+ var layerItems = caps.getElementsByTagName( "Layer" );
+ var layers = [];
+
+ for ( var l = 0; l < layerItems.length; l++ )
+ {
+ var item = layerItems[ l ];
+ var layerName = item.getElementsByTagName( "Name" )[ 0 ].textContent;
+ var layerTitle = item.getElementsByTagName( "Title" )[ 0 ].textContent;
+
+ layers.push( { name: layerName, title: layerTitle } );
+
+ var option = document.createElement( "option" );
+ option.text = layerTitle;
+ option.value = layerName;
+ selectLayer.options.add( option );
+ }
+
+ var getMap = caps.getElementsByTagName( "GetMap" )[ 0 ];
+ var formatItems = getMap.getElementsByTagName( "Format" );
+ var formats = [];
+
+ for ( var f = 0; f < formatItems.length; f++ )
+ {
+ var item = formatItems[ f ];
+ var format = item.textContent;
+
+ formats.push( format );
+
+ var option = document.createElement( "option" );
+ option.text = format;
+ option.value = format;
+ selectFormat.options.add( option );
+ }
+
+ break;
+ }
+
+ // WFS
+ case "WFS_Capabilities":
+ case "wfs:WFS_Capabilities":
+ {
+ inputType.value = "wfs";
+
+ var version = caps.getAttribute( "version" );
+ var service = caps.getElementsByTagName( "ows:ServiceIdentification" )[ 0 ];
+ var title = service.getElementsByTagName( "ows:Title" )[ 0 ].textContent;
+ rowTitle.children[ 1 ].innerHTML = title;
+
+ var featureTypeItems = caps.getElementsByTagName( "FeatureType" );
+ var types = [];
+
+ for ( var l = 0; l < featureTypeItems.length; l++ )
+ {
+ var item = featureTypeItems[ l ];
+ var typeName = item.getElementsByTagName( "Name" )[ 0 ].textContent;
+ var typeTitle = item.getElementsByTagName( "Title" )[ 0 ].textContent;
+
+ types.push( { name: typeName, title: typeTitle } );
+
+ var option = document.createElement( "option" );
+ option.text = typeTitle;
+ option.value = typeName;
+ selectLayer.options.add( option );
+ }
+
+ var operations = caps.getElementsByTagName( "ows:Operation" );
+ var getFeature = null;
+
+ for ( var o = 0; o < operations.length; o++ )
+ {
+ if ( operations[ o ].getAttribute( "name" ) === "GetFeature" )
+ {
+ getFeature = operations[ o ];
+ break;
+ }
+ }
+
+ if ( getFeature )
+ {
+ var parameters = getFeature.getElementsByTagName( "ows:Parameter" );
+
+ for ( var p = 0; p < parameters.length; p++ )
+ {
+ var parameter = parameters[ p ];
+
+ if ( parameter.getAttribute( "name" ) === "outputFormat" )
+ {
+ var formatItems = parameter.getElementsByTagName( "ows:Value" );
+
+ for ( var f = 0; f < formatItems.length; f++ )
+ {
+ var item = formatItems[ f ];
+ var format = item.textContent;
+
+ var option = document.createElement( "option" );
+ option.text = format;
+ option.value = format;
+ selectFormat.options.add( option );
+ }
+
+ break;
+ }
+ }
+ }
+
+ selectFormat.value = "application/json";
+
+ break;
+ }
+ }
+
+ // Show Details
+ var rows = this.addService.getElementsByTagName( "tr" );
+
+ for ( var r = 3; r < rows.length; r++ )
+ {
+ rows[ r ].classList.remove( "netgis-hide" );
+ }
+};
+
+netgis.Modal.prototype.onAddServiceAccept = function( e )
+{
+ /*var inputs = this.exportPDF.getElementsByTagName( "input" );
+ var resx = Number.parseInt( inputs[ 0 ].value );
+ var resy = Number.parseInt( inputs[ 1 ].value );
+ var margin = Number.parseInt( inputs[ 2 ].value );
+ var mode = inputs[ 3 ].checked;
+ this.client.invoke( netgis.Events.EXPORT_PDF, { resx: resx, resy: resy, mode: mode, margin: margin } );*/
+
+ var inputs = this.addService.getElementsByTagName( "input" );
+ var selects = this.addService.getElementsByTagName( "select" );
+
+ var url = inputs[ 0 ].value;
+ var type = inputs[ 1 ].value;
+
+ var selectLayer = selects[ 0 ];
+ var selectFormat = selects[ 1 ];
+
+ var layerOption = selectLayer.options.item( selectLayer.options.selectedIndex );
+ var formatOption = selectFormat.options.item( selectFormat.options.selectedIndex );
+
+ var id = this.addServiceID++;
+
+ var params =
+ {
+ id: id,
+ url: url,
+ title: layerOption.text,
+ name: layerOption.value,
+ format: formatOption.value
+ };
+
+ switch ( type )
+ {
+ case "wms":
+ {
+ this.client.invoke( netgis.Events.ADD_SERVICE_WMS, params );
+ break;
+ }
+
+ case "wfs":
+ {
+ this.client.invoke( netgis.Events.ADD_SERVICE_WFS, params );
+ break;
+ }
+ }
+
this.hide();
};
\ No newline at end of file
diff --git a/src/netgis/Toolbar.js b/src/netgis/Toolbar.js
index 875fc54..023845a 100644
--- a/src/netgis/Toolbar.js
+++ b/src/netgis/Toolbar.js
@@ -18,20 +18,38 @@ netgis.Toolbar.prototype.load = function()
if ( this.client.editable )
{
+ var bufferDefaultRadius = 1000;
+ var bufferDefaultSegments = 3;
+
+ if ( netgis.util.isDefined( config.tools ) )
+ {
+ if ( netgis.util.isDefined( config.tools.buffer.defaultRadius ) ) bufferDefaultRadius = config.tools.buffer.defaultRadius;
+ if ( netgis.util.isDefined( config.tools.buffer.defaultSegments ) ) bufferDefaultSegments = config.tools.buffer.defaultSegments;
+ }
+
// Draw
this.toolbars[ netgis.Modes.DRAW_POINTS ] = this.createToolbar();
this.append( this.toolbars[ netgis.Modes.DRAW_POINTS ], this.createToolbarButton( 'Punkte zeichnen:', this.onToolbarClose.bind( this ) ) );
this.append( this.toolbars[ netgis.Modes.DRAW_POINTS ], this.createToolbarCheckbox( "Einrasten", this.onSnapChange.bind( this ) ) );
+ this.append( this.toolbars[ netgis.Modes.DRAW_POINTS ], this.createToolbarCheckbox( "Puffern", this.onDrawBufferChange.bind( this ) ) );
+ this.append( this.toolbars[ netgis.Modes.DRAW_POINTS ], this.createToolbarInput( "Radius (Meter):", bufferDefaultRadius, this.onDrawBufferRadiusChange.bind( this ) ) );
+ this.append( this.toolbars[ netgis.Modes.DRAW_POINTS ], this.createToolbarInput( "Segmente:", bufferDefaultSegments, this.onDrawBufferSegmentsChange.bind( this ) ) );
this.root.appendChild( this.toolbars[ netgis.Modes.DRAW_POINTS ] );
this.toolbars[ netgis.Modes.DRAW_LINES ] = this.createToolbar();
this.append( this.toolbars[ netgis.Modes.DRAW_LINES ], this.createToolbarButton( 'Linien zeichnen:', this.onToolbarClose.bind( this ) ) );
this.append( this.toolbars[ netgis.Modes.DRAW_LINES ], this.createToolbarCheckbox( "Einrasten", this.onSnapChange.bind( this ) ) );
+ this.append( this.toolbars[ netgis.Modes.DRAW_LINES ], this.createToolbarCheckbox( "Puffern", this.onDrawBufferChange.bind( this ) ) );
+ this.append( this.toolbars[ netgis.Modes.DRAW_LINES ], this.createToolbarInput( "Radius (Meter):", bufferDefaultRadius, this.onDrawBufferRadiusChange.bind( this ) ) );
+ this.append( this.toolbars[ netgis.Modes.DRAW_LINES ], this.createToolbarInput( "Segmente:", bufferDefaultSegments, this.onDrawBufferSegmentsChange.bind( this ) ) );
this.root.appendChild( this.toolbars[ netgis.Modes.DRAW_LINES ] );
+
+ this.showDrawBufferOptions( false );
this.toolbars[ netgis.Modes.DRAW_POLYGONS ] = this.createToolbar();
this.append( this.toolbars[ netgis.Modes.DRAW_POLYGONS ], this.createToolbarButton( 'Polygone zeichnen:', this.onToolbarClose.bind( this ) ) );
this.append( this.toolbars[ netgis.Modes.DRAW_POLYGONS ], this.createToolbarCheckbox( "Einrasten", this.onSnapChange.bind( this ) ) );
+ this.append( this.toolbars[ netgis.Modes.DRAW_POLYGONS ], this.createToolbarCheckbox( "Tracing", this.onTracingChange.bind( this ) ) );
this.root.appendChild( this.toolbars[ netgis.Modes.DRAW_POLYGONS ] );
// Edit
@@ -60,17 +78,8 @@ netgis.Toolbar.prototype.load = function()
//var wrapper = document.createElement( "div" );
//this.toolbars[ netgis.Modes.BUFFER_FEATURE_EDIT ].appendChild( wrapper );
- var bufferDefaultRadius = 1000;
- var bufferDefaultSegments = 3;
-
- if ( netgis.util.isDefined( config.tools ) )
- {
- if ( netgis.util.isDefined( config.tools.buffer.defaultRadius ) ) bufferDefaultRadius = config.tools.buffer.defaultRadius;
- if ( netgis.util.isDefined( config.tools.buffer.defaultSegments ) ) bufferDefaultSegments = config.tools.buffer.defaultSegments;
- }
-
this.append( this.toolbars[ netgis.Modes.BUFFER_FEATURE_EDIT ], this.createToolbarButton( 'Feature puffern:', this.onBufferCancel.bind( this ) ) );
- this.append( this.toolbars[ netgis.Modes.BUFFER_FEATURE_EDIT ], this.createToolbarInput( "Radius in Meter:", bufferDefaultRadius, this.onBufferChange.bind( this ) ) );
+ this.append( this.toolbars[ netgis.Modes.BUFFER_FEATURE_EDIT ], this.createToolbarInput( "Radius (Meter):", bufferDefaultRadius, this.onBufferChange.bind( this ) ) );
this.append( this.toolbars[ netgis.Modes.BUFFER_FEATURE_EDIT ], this.createToolbarInput( "Segmente:", bufferDefaultSegments, this.onBufferChange.bind( this ) ) );
this.append( this.toolbars[ netgis.Modes.BUFFER_FEATURE_EDIT ], this.createToolbarButton( 'OK', this.onBufferAccept.bind( this ) ) );
@@ -252,6 +261,19 @@ netgis.Toolbar.prototype.onSetMode = function( e )
this.updateBuffer();
break;
}
+
+ case netgis.Modes.DRAW_POINTS:
+ case netgis.Modes.DRAW_LINES:
+ {
+ var checkbox = this.toolbars[ netgis.Modes.DRAW_POINTS ].getElementsByTagName( "input" )[ 1 ];
+
+ if ( checkbox.checked )
+ {
+ this.client.invoke( netgis.Events.DRAW_BUFFER_ON, null );
+ }
+
+ break;
+ }
}
};
@@ -444,4 +466,83 @@ netgis.Toolbar.prototype.onSnapChange = function( e )
this.toolbars[ netgis.Modes.DRAW_POLYGONS ].getElementsByTagName( "input" )[ 0 ].checked = on;
this.client.invoke( on ? netgis.Events.SNAP_ON : netgis.Events.SNAP_OFF, null );
+};
+
+netgis.Toolbar.prototype.onTracingChange = function( e )
+{
+ var input = e.target;
+ var on = input.checked;
+
+ var snapInput = this.toolbars[ netgis.Modes.DRAW_POLYGONS ].getElementsByTagName( "input" )[ 0 ];
+ var snap = snapInput.checked;
+
+ if ( on && !snap )
+ {
+ snapInput.checked = on;
+ this.client.invoke( netgis.Events.SNAP_ON, null );
+ }
+
+ this.client.invoke( on ? netgis.Events.TRACING_ON : netgis.Events.TRACING_OFF, null );
+};
+
+netgis.Toolbar.prototype.onDrawBufferChange = function( e )
+{
+ var input = e.target;
+ var on = input.checked;
+
+ this.toolbars[ netgis.Modes.DRAW_POINTS ].getElementsByTagName( "input" )[ 1 ].checked = on;
+ this.toolbars[ netgis.Modes.DRAW_LINES ].getElementsByTagName( "input" )[ 1 ].checked = on;
+
+ this.client.invoke( on ? netgis.Events.DRAW_BUFFER_ON : netgis.Events.DRAW_BUFFER_OFF, null );
+
+ this.showDrawBufferOptions( on );
+};
+
+netgis.Toolbar.prototype.onDrawBufferRadiusChange = function( e )
+{
+ var input = e.target;
+ var radius = Number.parseFloat( input.value );
+
+ this.client.invoke( netgis.Events.DRAW_BUFFER_RADIUS_CHANGE, radius );
+
+ var pointsInput = this.toolbars[ netgis.Modes.DRAW_POINTS ].getElementsByTagName( "input" )[ 2 ];
+ if ( input !== pointsInput ) pointsInput.value = radius;
+
+ var linesInput = this.toolbars[ netgis.Modes.DRAW_LINES ].getElementsByTagName( "input" )[ 2 ];
+ if ( input !== linesInput ) linesInput.value = radius;
+};
+
+netgis.Toolbar.prototype.onDrawBufferSegmentsChange = function( e )
+{
+ var input = e.target;
+ var segs = Number.parseInt( input.value );
+
+ this.client.invoke( netgis.Events.DRAW_BUFFER_SEGMENTS_CHANGE, segs );
+
+ var pointsInput = this.toolbars[ netgis.Modes.DRAW_POINTS ].getElementsByTagName( "input" )[ 3 ];
+ if ( input !== pointsInput ) pointsInput.value = segs;
+
+ var linesInput = this.toolbars[ netgis.Modes.DRAW_LINES ].getElementsByTagName( "input" )[ 3 ];
+ if ( input !== linesInput ) linesInput.value = segs;
+};
+
+netgis.Toolbar.prototype.showDrawBufferOptions = function( on )
+{
+ var pointsItems = this.toolbars[ netgis.Modes.DRAW_POINTS ].children[ 0 ].children;
+ var linesItems = this.toolbars[ netgis.Modes.DRAW_LINES ].children[ 0 ].children;
+
+ if ( on )
+ {
+ pointsItems[ 3 ].classList.remove( "netgis-hide" );
+ pointsItems[ 4 ].classList.remove( "netgis-hide" );
+ linesItems[ 3 ].classList.remove( "netgis-hide" );
+ linesItems[ 4 ].classList.remove( "netgis-hide" );
+ }
+ else
+ {
+ pointsItems[ 3 ].classList.add( "netgis-hide" );
+ pointsItems[ 4 ].classList.add( "netgis-hide" );
+ linesItems[ 3 ].classList.add( "netgis-hide" );
+ linesItems[ 4 ].classList.add( "netgis-hide" );
+ }
};
\ No newline at end of file
diff --git a/src/netgis/Util.js b/src/netgis/Util.js
index ad7f8c9..b16eb2d 100644
--- a/src/netgis/Util.js
+++ b/src/netgis/Util.js
@@ -139,6 +139,59 @@ netgis.util =
{
return Object.assign( target, other );
};
+
+ /**
+ * @returns {String} Formatted Date Time String (German Locale)
+ */
+ var getTimeStamp = function()
+ {
+ var date = new Date();
+
+ var timestamp = date.getDate() + "." + ( date.getMonth() + 1 ) + "." + date.getFullYear();
+ timestamp += " " + date.getHours() + ":" + date.getMinutes();
+
+ return timestamp;
+ };
+
+ /*
+ * @param {Number} area Raw Area in Square Meters
+ * @param {Boolean} decimals Output Rounded Decimals
+ * @returns {String} Formatted Area String (Square Meters/Square Kilometers)
+ */
+ var formatArea = function( area, decimals )
+ {
+ var output;
+
+ // Normal / Large Value
+ var large = ( area > 10000 );
+
+ // Round Value
+ var i = 0;
+
+ if ( large )
+ {
+ if ( decimals )
+ i = Math.round( area / 1000000 * 1000 ) / 1000;
+ else
+ i = Math.round( area / 1000000 );
+ }
+ else
+ {
+ if ( decimals )
+ i = Math.round( area * 100 ) / 100;
+ else
+ i = Math.round( area );
+ }
+
+ if ( i === 0 ) large = false;
+
+ // Build String
+ output = i + ( large ? " qkm" : " qm" );
+
+ //NOTE: HTML Superscript / Unicode (² etc.) not supported in OL Labels
+
+ return output;
+ };
// Public Interface
var iface =
@@ -153,7 +206,9 @@ netgis.util =
size: size,
request: request,
padstr: padstr,
- merge: merge
+ merge: merge,
+ getTimeStamp: getTimeStamp,
+ formatArea: formatArea
};
return iface;