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
main
sebastian_pauli 2 years ago
parent c421197e99
commit f14585386a

@ -11,7 +11,7 @@
<!-- Library Styles --> <!-- Library Styles -->
<link rel="stylesheet" type="text/css" href="/libs/fontawesome/5.12.0/css/all.min.css" /> <link rel="stylesheet" type="text/css" href="/libs/fontawesome/5.12.0/css/all.min.css" />
<link rel="stylesheet" type="text/css" href="/libs/openlayers/6.14.1/ol.css" /> <link rel="stylesheet" type="text/css" href="/libs/openlayers/7.2.2/ol.css" />
<!-- Custom Styles --> <!-- Custom Styles -->
<link rel="stylesheet" type="text/css" href="../src/netgis/Client.css" /> <link rel="stylesheet" type="text/css" href="../src/netgis/Client.css" />
@ -52,12 +52,14 @@
<input type="hidden" id="netgis-storage" name="output" /> <input type="hidden" id="netgis-storage" name="output" />
<!-- Library Scripts --> <!-- Library Scripts -->
<script type="text/javascript" src="/libs/openlayers/6.14.1/ol.js"></script> <script type="text/javascript" src="/libs/openlayers/7.2.2/ol.js"></script>
<script type="text/javascript" src="/libs/proj4js/2.6.0/proj4.js"></script> <script type="text/javascript" src="/libs/proj4js/2.6.0/proj4.js"></script>
<script type="text/javascript" src="/libs/jsts/1.6.1/jsts.min.js"></script> <script type="text/javascript" src="/libs/jsts/1.6.1/jsts.min.js"></script>
<script type="text/javascript" src="/libs/shapefilejs/4.0.2/shp.js"></script> <script type="text/javascript" src="/libs/shapefilejs/4.0.2/shp.js"></script>
<script type="text/javascript" src="/libs/jspdf/1.3.2/jspdf.min.js"></script> <script type="text/javascript" src="/libs/jspdf/1.3.2/jspdf.min.js"></script>
<script type="text/javascript" src="/libs/gifjs/0.2.0/gif.js"></script> <script type="text/javascript" src="/libs/gifjs/0.2.0/gif.js"></script>
<script type="text/javascript" src="/libs/sqljs/1.8.0/sql.js"></script>
<script type="text/javascript" src="/libs/geopackage/4.2.3/geopackage.min.js"></script>
<!-- Custom Scripts --> <!-- Custom Scripts -->
<script type="text/javascript" src="../src/netgis/Util.js"></script> <script type="text/javascript" src="../src/netgis/Util.js"></script>
@ -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": "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": "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": "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": "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" } { "folder": 3, "type": "OSM", "title": "Open Street Map", "attribution": "OSM", "active": true, "minZoom": 8, "maxZoom": 11 }
], ],
"folders": "folders":
@ -142,9 +144,14 @@
"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" "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": "export":
{ {
"logo": "./assets/logo.png", "logo": "/geoportal/client/assets/logo.png",
"gifWebWorker": "/libs/gifjs/0.2.0/gif.worker.js", "gifWebWorker": "/libs/gifjs/0.2.0/gif.worker.js",
"defaultFilename": "Export", "defaultFilename": "Export",
"defaultMargin": 10 "defaultMargin": 10
@ -154,7 +161,7 @@
{ {
"buffer": "buffer":
{ {
"defaultRadius": 10, "defaultRadius": 100,
"defaultSegments": 3 "defaultSegments": 3
} }
}, },

File diff suppressed because one or more lines are too long

232
dist/netgis.min.js vendored

@ -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)}; 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;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this); $jscomp.getGlobal=function(a){a=["object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global,a];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.polyfill=function(a,b,c,d){if(b){c=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:b})}};$jscomp.polyfill("Array.prototype.fill",function(a){return a?a:function(a,c,d){var b=this.length||0;0>c&&(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<d;c++)this[c]=a;return this}},"es6","es3"); $jscomp.polyfill=function(a,b,c,d){if(b){c=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:b})}};$jscomp.polyfill("Number.parseFloat",function(a){return a||parseFloat},"es6","es3");
$jscomp.polyfill("Number.parseInt",function(a){return a||parseInt},"es6","es3");$jscomp.polyfill("Number.parseFloat",function(a){return a||parseFloat},"es6","es3");$jscomp.owns=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};$jscomp.assign="function"==typeof Object.assign?Object.assign:function(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c];if(d)for(var e in d)$jscomp.owns(d,e)&&(a[e]=d[e])}return a}; $jscomp.polyfill("Array.prototype.fill",function(a){return a?a:function(a,c,d){var b=this.length||0;0>c&&(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<d;c++)this[c]=a;return this}},"es6","es3");$jscomp.arrayIteratorImpl=function(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.SYMBOL_PREFIX="jscomp_symbol_";
$jscomp.polyfill("Object.assign",function(a){return a||$jscomp.assign},"es6","es3");var netgis=netgis||{};netgis.Attribution=function(){this.layers=this.client=null;this.items=[]}; $jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.SymbolClass=function(a,b){this.$jscomp$symbol$id_=a;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:b})};$jscomp.SymbolClass.prototype.toString=function(){return this.$jscomp$symbol$id_};
$jscomp.Symbol=function(){function a(c){if(this instanceof a)throw new TypeError("Symbol is not a constructor");return new $jscomp.SymbolClass($jscomp.SYMBOL_PREFIX+(c||"")+"_"+b++,c)}var b=0;return a}();
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.iterator;a||(a=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("Symbol.iterator"));"function"!=typeof Array.prototype[a]&&$jscomp.defineProperty(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this))}});$jscomp.initSymbolIterator=function(){}};
$jscomp.initSymbolAsyncIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.asyncIterator;a||(a=$jscomp.global.Symbol.asyncIterator=$jscomp.global.Symbol("Symbol.asyncIterator"));$jscomp.initSymbolAsyncIterator=function(){}};$jscomp.iteratorPrototype=function(a){$jscomp.initSymbolIterator();a={next:a};a[$jscomp.global.Symbol.iterator]=function(){return this};return a};
$jscomp.iteratorFromArray=function(a,b){$jscomp.initSymbolIterator();a instanceof String&&(a+="");var c=0,d={next:function(){if(c<a.length){var e=c++;return{value:b(e,a[e]),done:!1}}d.next=function(){return{done:!0,value:void 0}};return d.next()}};d[Symbol.iterator]=function(){return d};return d};$jscomp.polyfill("Array.prototype.values",function(a){return a?a:function(){return $jscomp.iteratorFromArray(this,function(a,c){return c})}},"es8","es3");
$jscomp.polyfill("Number.parseInt",function(a){return a||parseInt},"es6","es3");$jscomp.owns=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};$jscomp.assign="function"==typeof Object.assign?Object.assign:function(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c];if(d)for(var e in d)$jscomp.owns(d,e)&&(a[e]=d[e])}return a};$jscomp.polyfill("Object.assign",function(a){return a||$jscomp.assign},"es6","es3");var netgis=netgis||{};
netgis.Attribution=function(){this.layers=this.client=null;this.items=[]};
netgis.Attribution.prototype.load=function(){this.root=document.createElement("section");this.root.className="netgis-attribution netgis-text-primary";netgis.util.isDefined(this.client.config.map)&&netgis.util.isDefined(this.client.config.map.attribution)&&this.items.push(this.client.config.map.attribution);this.update();this.client.root.appendChild(this.root);this.client.on(netgis.Events.CONTEXT_UPDATE,this.onContextUpdate.bind(this));this.client.on(netgis.Events.LAYER_SHOW,this.onLayerShow.bind(this)); netgis.Attribution.prototype.load=function(){this.root=document.createElement("section");this.root.className="netgis-attribution netgis-text-primary";netgis.util.isDefined(this.client.config.map)&&netgis.util.isDefined(this.client.config.map.attribution)&&this.items.push(this.client.config.map.attribution);this.update();this.client.root.appendChild(this.root);this.client.on(netgis.Events.CONTEXT_UPDATE,this.onContextUpdate.bind(this));this.client.on(netgis.Events.LAYER_SHOW,this.onLayerShow.bind(this));
this.client.on(netgis.Events.LAYER_HIDE,this.onLayerHide.bind(this))};netgis.Attribution.prototype.update=function(){this.root.innerHTML="&copy; "+this.items.join(", ")};netgis.Attribution.prototype.onContextUpdate=function(a){this.layers=[];for(var b=0;b<a.layers.length;b++){var c=a.layers[b];c.attribution&&0<c.attribution.length&&(this.layers[b]=c.attribution)}}; this.client.on(netgis.Events.LAYER_HIDE,this.onLayerHide.bind(this))};netgis.Attribution.prototype.update=function(){this.root.innerHTML="&copy; "+this.items.join(", ")};netgis.Attribution.prototype.onContextUpdate=function(a){this.layers=[];for(var b=0;b<a.layers.length;b++){var c=a.layers[b];c.attribution&&0<c.attribution.length&&(this.layers[b]=c.attribution)}};
netgis.Attribution.prototype.onLayerShow=function(a){if(a=this.layers[a.id]){for(var b=0;b<this.items.length;b++)if(this.items[b]===a)return;this.items.push(a);this.update()}};netgis.Attribution.prototype.onLayerHide=function(a){if(a=this.layers[a.id]){for(var b=0;b<this.items.length;b++)if(this.items[b]===a){this.items.splice(b,1);break}this.update()}};netgis=netgis||{}; netgis.Attribution.prototype.onLayerShow=function(a){if(a=this.layers[a.id]){for(var b=0;b<this.items.length;b++)if(this.items[b]===a)return;this.items.push(a);this.update()}};netgis.Attribution.prototype.onLayerHide=function(a){if(a=this.layers[a.id]){for(var b=0;b<this.items.length;b++)if(this.items[b]===a){this.items.splice(b,1);break}this.update()}};netgis=netgis||{};
@ -21,120 +27,168 @@ netgis.Client.prototype.onMapExportEnd=function(a){this.hideLoader()};netgis=net
netgis.Controls.prototype.load=function(){this.root=document.createElement("section");this.root.className="netgis-controls";var a=document.createElement("button");a.setAttribute("type","button");a.innerHTML="<i class='fas fa-search-plus'></i>";a.title="Hineinzoomen";a.addEventListener("click",this.onZoomIn.bind(this));this.root.appendChild(a);a=document.createElement("button");a.setAttribute("type","button");a.innerHTML="<i class='fas fa-search-minus'></i>";a.title="Herauszoomen";a.addEventListener("click", netgis.Controls.prototype.load=function(){this.root=document.createElement("section");this.root.className="netgis-controls";var a=document.createElement("button");a.setAttribute("type","button");a.innerHTML="<i class='fas fa-search-plus'></i>";a.title="Hineinzoomen";a.addEventListener("click",this.onZoomIn.bind(this));this.root.appendChild(a);a=document.createElement("button");a.setAttribute("type","button");a.innerHTML="<i class='fas fa-search-minus'></i>";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||{}; 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", 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", 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",
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}; 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",
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, 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};
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=""}; 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="<hr/>";this.root.appendChild(this.tools);this.buttonAddService=document.createElement("button");this.buttonAddService.className=
"netgis-text-primary netgis-hover-primary";this.buttonAddService.innerHTML="<i class='fas fa-folder-plus'></i> 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"; 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='<i class="fas fa-folder-open"></i>'+a;c.addEventListener("click",this.onFolderClick.bind(this));b.appendChild(c);a=document.createElement("ul");b.appendChild(a);return b}; c.innerHTML='<i class="fas fa-folder-open"></i>'+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)); 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;d<c.length;d++){var e=c[d];e.checked=a;e=e.dataset.id;netgis.util.isDefined(e)&&(e=parseInt(e),this.client.invoke(a?netgis.Events.LAYER_SHOW:netgis.Events.LAYER_HIDE,{id:e}))}this.updateFolderChecks(b);a=b.parentElement.parentElement;-1!==a.className.search("netgis-folder")&&this.updateFolderChecks(a)}; 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;d<c.length;d++){var e=c[d];e.checked=a;e=e.dataset.id;netgis.util.isDefined(e)&&(e=parseInt(e),this.client.invoke(a?netgis.Events.LAYER_SHOW:netgis.Events.LAYER_HIDE,{id:e}))}this.updateFolderChecks(b);a=b.parentElement.parentElement;-1!==a.className.search("netgis-folder")&&this.updateFolderChecks(a)};
netgis.LayerTree.prototype.updateFolderChecks=function(a){netgis.util.isDefined(a)||(a=this.list);for(var b=a.getElementsByClassName("netgis-folder-item"),c=0,d=0;d<b.length;d++){var e=b[d].getElementsByTagName("input")[0];e.checked&&c++}e=a.getElementsByTagName("input")[0];d=0;0<c&&(d=1);c===b.length&&(d=2);switch(d){case 0:e.checked=!1;e.classList.remove("netgis-partial");break;case 1:e.checked=!0;e.classList.add("netgis-partial");break;case 2:e.checked=!0,e.classList.remove("netgis-partial")}(a= netgis.LayerTree.prototype.updateFolderChecks=function(a){netgis.util.isDefined(a)||(a=this.list);for(var b=a.getElementsByClassName("netgis-folder-item"),c=0,d=0;d<b.length;d++){var e=b[d].getElementsByTagName("input")[0];e.checked&&c++}e=a.getElementsByTagName("input")[0];d=0;0<c&&(d=1);c===b.length&&(d=2);switch(d){case 0:e.checked=!1;e.classList.remove("netgis-partial");break;case 1:e.checked=!0;e.classList.add("netgis-partial");break;case 2:e.checked=!0,e.classList.remove("netgis-partial")}(a=
a.parentElement)&&a!==this.list&&(a=a.parentElement)&&-1!==a.className.search("netgis-folder")&&this.updateFolderChecks(a)}; a.parentElement)&&a!==this.list&&(a=a.parentElement)&&-1!==a.className.search("netgis-folder")&&this.updateFolderChecks(a)};
netgis.LayerTree.prototype.onItemChange=function(a){var b=a.currentTarget;a=b.checked;var c=b.parentElement.parentElement.parentElement;b=parseInt(b.dataset.id);c=c.parentElement.parentElement;for(var d=c.getElementsByTagName("input"),e=0,f=1;f<d.length;f++)d[f].checked&&e++;-1!==c.className.search("netgis-folder")&&this.updateFolderChecks(c);this.client.invoke(a?netgis.Events.LAYER_SHOW:netgis.Events.LAYER_HIDE,{id:b})};netgis.LayerTree.prototype.onLayerListToggle=function(a){this.root.classList.toggle("netgis-hide")}; netgis.LayerTree.prototype.onItemChange=function(a){var b=a.currentTarget;a=b.checked;var c=b.parentElement.parentElement.parentElement;b=parseInt(b.dataset.id);c=c.parentElement.parentElement;for(var d=c.getElementsByTagName("input"),e=0,f=1;f<d.length;f++)d[f].checked&&e++;-1!==c.className.search("netgis-folder")&&this.updateFolderChecks(c);this.client.invoke(a?netgis.Events.LAYER_SHOW:netgis.Events.LAYER_HIDE,{id:b})};netgis.LayerTree.prototype.onLayerListToggle=function(a){this.root.classList.toggle("netgis-hide")};
netgis.LayerTree.prototype.onContextUpdate=function(a){this.clearAll();var b=a.folders;a=a.layers;for(var c=[],d=0;d<b.length;d++){var e=b[d],f=this.createFolder(e.title);c.push(f)}for(d=0;d<a.length;d++)e=a[d],f=this.createLayer(d,e.title,e.active),this.addToFolder(c[e.folder],f);for(d=0;d<b.length;d++)e=b[d],f=c[d],-1===e.parent?this.list.appendChild(f):this.addToFolder(c[e.parent],f);for(d=0;d<a.length;d++)e=a[d],e.active&&this.client.invoke(netgis.Events.LAYER_SHOW,{id:d});for(d=0;d<c.length;d++)this.updateFolderChecks(c[d])}; netgis.LayerTree.prototype.onContextUpdate=function(a){this.clearAll();var b=a.folders;a=a.layers;for(var c=[],d=0;d<b.length;d++){var e=b[d],f=this.createFolder(e.title);c.push(f)}for(d=0;d<a.length;d++)e=a[d],f=this.createLayer(d,e.title,e.active),this.addToFolder(c[e.folder],f);for(d=0;d<b.length;d++)e=b[d],f=c[d],-1===e.parent?this.list.appendChild(f):this.addToFolder(c[e.parent],f);for(d=0;d<a.length;d++)e=a[d],e.active&&this.client.invoke(netgis.Events.LAYER_SHOW,{id:d});for(d=0;d<c.length;d++)this.updateFolderChecks(c[d])};
netgis.LayerTree.prototype.onLayerCreated=function(a){var b=this.createLayer(a.id,a.title,a.checked);if("import"===a.folder){this.folderImport||(this.folderImport=this.createFolder("Importierte Ebenen"),this.list.insertBefore(this.folderImport,this.folderDraw?this.folderDraw.nextSibling:this.list.firstChild));var c=this.folderImport}else"draw"===a.folder&&(this.folderDraw||(this.folderDraw=this.createFolder("Zeichnung"),this.list.insertBefore(this.folderDraw,this.list.firstChild)),c=this.folderDraw); netgis.LayerTree.prototype.onLayerCreated=function(a){var b=this.createLayer(a.id,a.title,a.checked);if("import"===a.folder){this.folderImport.classList.remove("netgis-hide");var c=this.folderImport}else"draw"===a.folder&&(this.folderDraw.classList.remove("netgis-hide"),c=this.folderDraw);this.addToFolder(c,b,!0);this.updateFolderChecks(c)};
this.addToFolder(c,b,!0);this.updateFolderChecks(c)};netgis.LayerTree.prototype.onEditFeaturesChange=function(a){if(this.folderDraw){a=this.folderDraw.getElementsByTagName("ul")[0].getElementsByTagName("input")[0];var b=parseInt(a.dataset.id);a.checked||(a.checked=!0,this.updateFolderChecks(this.folderDraw),this.client.invoke(netgis.Events.LAYER_SHOW,{id:b}))}};netgis.LayerTree.prototype.onSetMode=function(a){a===netgis.Modes.SEARCH_PARCEL&&this.root.classList.add("netgis-hide")};netgis=netgis||{};netgis.LayerTypes=Object.freeze({XYZ:"XYZ",OSM:"OSM",WMS:"WMS",WFS:"WFS",KML:"KML"});netgis=netgis||{};netgis.Map=function(){this.attribution=this.root=this.client=null};netgis.Map.prototype.load=function(){this.root=document.createElement("section");this.root.className="netgis-map";this.client.root.appendChild(this.root)};netgis=netgis||{};netgis.MapOpenLayers=function(){netgis.Map.call(this);this.mode=null;this.toolbars={};this.map=this.view=null;this.layers=[];this.interactions={};this.sketch=this.selected=this.hover=this.parcelLayer=this.editLayer=this.snapFeatures=this.snap=null;this.editEventsSilent=!1;this.importLayerID=1E3;this.editLayerID=2E3};netgis.MapOpenLayers.prototype=Object.create(netgis.Map.prototype);netgis.MapOpenLayers.prototype.constructor=netgis.MapOpenLayers; netgis.LayerTree.prototype.onEditFeaturesChange=function(a){if(this.folderDraw){var b=this.folderDraw.getElementsByTagName("ul")[0],c=b.getElementsByTagName("input")[0],d=parseInt(c.dataset.id);c.checked||(c.checked=!0,this.updateFolderChecks(this.folderDraw),this.client.invoke(netgis.Events.LAYER_SHOW,{id:d}));b=b.getElementsByTagName("label")[0].getElementsByTagName("span");b[b.length-1].innerText=a.area&&0<a.area?" (Fl\u00e4che: "+netgis.util.formatArea(a.area,!0)+")":""}};
netgis.LayerTree.prototype.onAddServiceWMS=function(a){var b=this.createLayer(a.id,a.title,!0);this.folderServices.classList.remove("netgis-hide");this.addToFolder(this.folderServices,b,!0);this.updateFolderChecks(this.folderServices);this.client.invoke(netgis.Events.LAYER_SHOW,{id:a.id})};
netgis.LayerTree.prototype.onAddServiceWFS=function(a){var b=this.createLayer(a.id,a.title,!0);this.folderServices.classList.remove("netgis-hide");this.addToFolder(this.folderServices,b,!0);this.updateFolderChecks(this.folderServices);this.client.invoke(netgis.Events.LAYER_SHOW,{id:a.id})};netgis.LayerTree.prototype.onSetMode=function(a){a===netgis.Modes.SEARCH_PARCEL&&this.root.classList.add("netgis-hide")};
netgis.LayerTree.prototype.onAddServiceClick=function(a){this.client.invoke(netgis.Events.ADD_SERVICE_SHOW,null)};netgis=netgis||{};netgis.LayerTypes=Object.freeze({XYZ:"XYZ",OSM:"OSM",WMS:"WMS",WFS:"WFS",KML:"KML"});netgis=netgis||{};netgis.Map=function(){this.attribution=this.root=this.client=null};netgis.Map.prototype.load=function(){this.root=document.createElement("section");this.root.className="netgis-map";this.client.root.appendChild(this.root)};netgis=netgis||{};netgis.MapOpenLayers=function(){netgis.Map.call(this);this.mode=null;this.toolbars={};this.map=this.view=null;this.layers=[];this.interactions={};this.sketch=this.selected=this.hover=this.parcelLayer=this.editLayer=this.snapFeatures=this.snap=null;this.editEventsSilent=!1;this.importLayerID=2E4;this.editLayerID=3E4;this.labelFont="4mm Verdana, sans-serif";this.drawBufferRadius=100;this.drawBufferSegments=3};netgis.MapOpenLayers.prototype=Object.create(netgis.Map.prototype);
netgis.MapOpenLayers.prototype.constructor=netgis.MapOpenLayers;
netgis.MapOpenLayers.prototype.load=function(){netgis.Map.prototype.load.call(this);this.dropTarget=document.createElement("div");this.dropTarget.className="netgis-drop-target netgis-hide";this.dropTarget.innerHTML="Datei hier ablegen!";this.root.appendChild(this.dropTarget);this.root.addEventListener("dragenter",this.onDragEnter.bind(this));this.root.addEventListener("dragover",this.onDragEnter.bind(this));this.root.addEventListener("dragend",this.onDragLeave.bind(this));this.root.addEventListener("dragleave", netgis.MapOpenLayers.prototype.load=function(){netgis.Map.prototype.load.call(this);this.dropTarget=document.createElement("div");this.dropTarget.className="netgis-drop-target netgis-hide";this.dropTarget.innerHTML="Datei hier ablegen!";this.root.appendChild(this.dropTarget);this.root.addEventListener("dragenter",this.onDragEnter.bind(this));this.root.addEventListener("dragover",this.onDragEnter.bind(this));this.root.addEventListener("dragend",this.onDragLeave.bind(this));this.root.addEventListener("dragleave",
this.onDragLeave.bind(this));this.root.addEventListener("drop",this.onDragDrop.bind(this));this.createMap();this.createDefaultLayers();this.createInteractions();this.client.on(netgis.Events.CONTEXT_UPDATE,this.onContextUpdate.bind(this));this.client.on(netgis.Events.MAP_UPDATE_STYLE,this.onUpdateStyle.bind(this));this.client.on(netgis.Events.EDIT_FEATURES_LOADED,this.onEditFeaturesLoaded.bind(this));this.client.on(netgis.Events.SET_MODE,this.onSetMode.bind(this));this.client.on(netgis.Events.SNAP_ON, this.onDragLeave.bind(this));this.root.addEventListener("drop",this.onDragDrop.bind(this));this.initMap();this.initDefaultLayers();this.initInteractions();this.client.on(netgis.Events.CONTEXT_UPDATE,this.onContextUpdate.bind(this));this.client.on(netgis.Events.MAP_UPDATE_STYLE,this.onUpdateStyle.bind(this));this.client.on(netgis.Events.EDIT_FEATURES_LOADED,this.onEditFeaturesLoaded.bind(this));this.client.on(netgis.Events.SET_MODE,this.onSetMode.bind(this));this.client.on(netgis.Events.SNAP_ON,this.onSnapOn.bind(this));
this.onSnapOn.bind(this));this.client.on(netgis.Events.SNAP_OFF,this.onSnapOff.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));this.client.on(netgis.Events.MAP_SET_EXTENT,this.onSetExtent.bind(this));this.client.on(netgis.Events.MAP_CHANGE_ZOOM,this.onChangeZoom.bind(this));this.client.on(netgis.Events.BUFFER_CHANGE,this.onBufferChange.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));this.client.on(netgis.Events.MAP_SET_EXTENT,this.onSetExtent.bind(this));this.client.on(netgis.Events.MAP_CHANGE_ZOOM,
this.client.on(netgis.Events.BUFFER_ACCEPT,this.onBufferAccept.bind(this));this.client.on(netgis.Events.BUFFER_CANCEL,this.onBufferCancel.bind(this));this.client.on(netgis.Events.IMPORT_GEOJSON,this.onImportGeoJSON.bind(this));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.EXPORT_PDF,this.onExportPDF.bind(this)); this.onChangeZoom.bind(this));this.client.on(netgis.Events.BUFFER_CHANGE,this.onBufferChange.bind(this));this.client.on(netgis.Events.BUFFER_ACCEPT,this.onBufferAccept.bind(this));this.client.on(netgis.Events.BUFFER_CANCEL,this.onBufferCancel.bind(this));this.client.on(netgis.Events.IMPORT_GEOJSON,this.onImportGeoJSON.bind(this));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.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.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,
netgis.MapOpenLayers.prototype.createMap=function(){var a=this.client.config;"undefined"!==typeof proj4&&(proj4.defs(a.projections),proj4.defs("urn:ogc:def:crs:OGC:1.3:CRS84",proj4.defs("EPSG:4326")),ol.proj.proj4.register(proj4));this.view=new ol.View({projection:a.map.projection,center:a.map.center,minZoom:a.map.minZoom,maxZoom:a.map.maxZoom,zoom:a.map.zoom});this.map=new ol.Map({target:this.root,view:this.view,pixelRatio:1,moveTolerance:5,controls:[]});this.map.on("pointermove",this.onPointerMove.bind(this)); 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.initMap=function(){var a=this.client.config;"undefined"!==typeof proj4&&(proj4.defs(a.projections),proj4.defs("urn:ogc:def:crs:OGC:1.3:CRS84",proj4.defs("EPSG:4326")),ol.proj.proj4.register(proj4));this.view=new ol.View({projection:a.map.projection,center:a.map.center,minZoom:a.map.minZoom,maxZoom:a.map.maxZoom,zoom:a.map.zoom});this.map=new ol.Map({target:this.root,view:this.view,pixelRatio:1,moveTolerance:5,controls:[]});this.map.on("pointermove",this.onPointerMove.bind(this));
this.map.on("click",this.onSingleClick.bind(this));this.map.on("movestart",this.onMoveStart.bind(this));this.map.on("moveend",this.onMoveEnd.bind(this));this.view.on("change:resolution",this.onChangeResolution.bind(this))}; this.map.on("click",this.onSingleClick.bind(this));this.map.on("movestart",this.onMoveStart.bind(this));this.map.on("moveend",this.onMoveEnd.bind(this));this.view.on("change:resolution",this.onChangeResolution.bind(this))};
netgis.MapOpenLayers.prototype.createDefaultLayers=function(){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.map.addLayer(this.parcelLayer);this.editEventsOn()}; netgis.MapOpenLayers.prototype.initDefaultLayers=function(){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.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),
netgis.MapOpenLayers.prototype.editEventsOn=function(){this.editLayer.getSource().on("addfeature",this.onEditLayerAdd.bind(this));this.editLayer.getSource().on("removefeature",this.onEditLayerRemove.bind(this))};netgis.MapOpenLayers.prototype.editEventsOff=function(){}; zIndex:this.editLayerID+20});this.map.addLayer(this.parcelLayer);this.editEventsOn()};netgis.MapOpenLayers.prototype.editEventsOn=function(){this.editLayer.getSource().on("addfeature",this.onEditLayerAdd.bind(this));this.editLayer.getSource().on("removefeature",this.onEditLayerRemove.bind(this))};netgis.MapOpenLayers.prototype.editEventsOff=function(){};
netgis.MapOpenLayers.prototype.createInteractions=function(){this.interactions[netgis.Modes.VIEW]=[new ol.interaction.DragPan,new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.PANNING]=this.interactions[netgis.Modes.VIEW];this.interactions[netgis.Modes.ZOOMING_IN]=this.interactions[netgis.Modes.VIEW];this.interactions[netgis.Modes.ZOOMING_OUT]=this.interactions[netgis.Modes.VIEW];this.interactions[netgis.Modes.DRAW_POINTS]=[new ol.interaction.Draw({type:"Point",source:this.editLayer.getSource(), netgis.MapOpenLayers.prototype.initInteractions=function(){this.interactions[netgis.Modes.VIEW]=[new ol.interaction.DragPan,new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.PANNING]=this.interactions[netgis.Modes.VIEW];this.interactions[netgis.Modes.ZOOMING_IN]=this.interactions[netgis.Modes.VIEW];this.interactions[netgis.Modes.ZOOMING_OUT]=this.interactions[netgis.Modes.VIEW];this.interactions[netgis.Modes.DRAW_POINTS]=[new ol.interaction.Draw({type:"Point",source:this.editLayer.getSource(),
style:this.styleSketch.bind(this)}),new ol.interaction.DragPan,new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.DRAW_LINES]=[new ol.interaction.Draw({type:"LineString",source:this.editLayer.getSource(),style:this.styleSketch.bind(this)}),new ol.interaction.DragPan,new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.DRAW_POLYGONS]=[new ol.interaction.Draw({type:"Polygon",source:this.editLayer.getSource(),style:this.styleSketch.bind(this)}),new ol.interaction.DragPan, style:this.styleSketch.bind(this)}),new ol.interaction.DragPan,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)}),new ol.interaction.DragPan,new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.DRAW_LINES][0].on("drawend",this.onDrawLinesEnd.bind(this));
new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.CUT_FEATURE_BEGIN]=[new ol.interaction.DragPan,new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.CUT_FEATURE_DRAW]=[new ol.interaction.Draw({type:"Polygon",style:this.styleSketch.bind(this)}),new ol.interaction.DragPan,new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.CUT_FEATURE_DRAW][0].on("drawend",this.onCutFeatureDrawEnd.bind(this));this.interactions[netgis.Modes.MODIFY_FEATURES]=[new ol.interaction.Modify({source:this.editLayer.getSource(), this.interactions[netgis.Modes.DRAW_POLYGONS]=[new ol.interaction.Draw({type:"Polygon",source:this.editLayer.getSource(),style:this.styleSketch.bind(this)}),new ol.interaction.DragPan,new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.CUT_FEATURE_BEGIN]=[new ol.interaction.DragPan,new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.CUT_FEATURE_DRAW]=[new ol.interaction.Draw({type:"Polygon",style:this.styleSketch.bind(this)}),new ol.interaction.DragPan,new ol.interaction.MouseWheelZoom];
deleteCondition:ol.events.condition.doubleClick,style:this.styleModify.bind(this)}),new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.MODIFY_FEATURES][0].on("modifyend",this.onModifyFeaturesEnd.bind(this));this.interactions[netgis.Modes.DELETE_FEATURES]=[new ol.interaction.DragPan,new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.BUFFER_FEATURE_BEGIN]=[new ol.interaction.DragPan,new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.BUFFER_FEATURE_EDIT]= this.interactions[netgis.Modes.CUT_FEATURE_DRAW][0].on("drawend",this.onCutFeatureDrawEnd.bind(this));this.interactions[netgis.Modes.MODIFY_FEATURES]=[new ol.interaction.Modify({source:this.editLayer.getSource(),deleteCondition:ol.events.condition.doubleClick,style:this.styleModify.bind(this)}),new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.MODIFY_FEATURES][0].on("modifyend",this.onModifyFeaturesEnd.bind(this));this.interactions[netgis.Modes.DELETE_FEATURES]=[new ol.interaction.DragPan,
[new ol.interaction.DragPan,new ol.interaction.MouseWheelZoom];this.snapFeatures=new ol.Collection;this.interactions[netgis.Modes.SEARCH_PLACE]=[new ol.interaction.DragPan,new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.SEARCH_PARCEL]=this.interactions[netgis.Modes.VIEW]}; new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.BUFFER_FEATURE_BEGIN]=[new ol.interaction.DragPan,new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.BUFFER_FEATURE_EDIT]=[new ol.interaction.DragPan,new ol.interaction.MouseWheelZoom];this.snapFeatures=new ol.Collection;this.interactions[netgis.Modes.SEARCH_PLACE]=[new ol.interaction.DragPan,new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.SEARCH_PARCEL]=this.interactions[netgis.Modes.VIEW]};
netgis.MapOpenLayers.prototype.createLayer=function(a){switch(a.type){case netgis.LayerTypes.XYZ:var b=new ol.layer.Tile({source:new ol.source.XYZ({url:a.url,crossOrigin:"anonymous"})});return b;case netgis.LayerTypes.OSM:return b=new ol.layer.Tile({source:new ol.source.XYZ({url:"https://{a-c}.tile.openstreetmap.de/{z}/{x}/{y}.png",crossOrigin:"anonymous"})});case netgis.LayerTypes.WMS:var c={url:a.url,params:{LAYERS:a.name,FORMAT:"image/png",TRANSPARENT:"true",VERSION:"1.1.1"},serverType:"mapserver", netgis.MapOpenLayers.prototype.createLayer=function(a){var b=null;switch(a.type){case netgis.LayerTypes.XYZ:b=this.createLayerXYZ(a.url);break;case netgis.LayerTypes.OSM:b=this.createLayerOSM();break;case netgis.LayerTypes.WMS:b=this.createLayerWMS(a.url,a.name,a.format,a.username,a.password);break;case netgis.LayerTypes.WFS:b=this.createLayerWFS(a.url,a.name,this.client.config.map.projection,a.outputFormat)}b&&(a.minZoom&&b.setMinZoom(Number.parseFloat(a.minZoom)-1),a.maxZoom&&b.setMaxZoom(Number.parseFloat(a.maxZoom)));
crossOrigin:"anonymous",hidpi:!1};a.username&&a.password&&(c.imageLoadFunction=function(b,c){var d=new XMLHttpRequest;d.open("GET",c);d.setRequestHeader("Authorization","Basic "+window.btoa(a.username+":"+a.password));d.onload=function(){b.getImage().src=c};d.send()});c=new ol.source.ImageWMS(c);return b=new ol.layer.Image({source:c,opacity:1});case netgis.LayerTypes.WFS:var d=this.client.config,e=a.url+"service=WFS&version=1.1.0&request=GetFeature&outputformat=application/json";c=new ol.source.Vector({format:new ol.format.GeoJSON, return b};netgis.MapOpenLayers.prototype.createLayerXYZ=function(a){return new ol.layer.Tile({source:new ol.source.XYZ({url:a,crossOrigin:"anonymous"})})};netgis.MapOpenLayers.prototype.createLayerOSM=function(){return new ol.layer.Tile({source:new ol.source.XYZ({url:"https://{a-c}.tile.openstreetmap.de/{z}/{x}/{y}.png",crossOrigin:"anonymous"})})};
strategy:ol.loadingstrategy.bbox,url:function(b){return e+"&typename="+a.name+"&srsname="+d.map.projection+"&bbox="+b.join(",")+","+d.map.projection}});b=new ol.layer.Vector({source:c});var f=this;c.on("featuresloadstart",function(a){f.removeSnapLayer(b)});c.on("featuresloadend",function(a){window.setTimeout(function(){f.addSnapLayer(b)},10)});return b}return null}; netgis.MapOpenLayers.prototype.createLayerWMS=function(a,b,c,d,e){a={url:a,params:{LAYERS:b,FORMAT:c?c:"image/png",TRANSPARENT:"true",VERSION:"1.1.1"},serverType:"mapserver",crossOrigin:"anonymous",hidpi:!1};d&&e&&(a.imageLoadFunction=function(a,b){var c=new XMLHttpRequest;c.open("GET",b);c.setRequestHeader("Authorization","Basic "+window.btoa(d+":"+e));c.onload=function(){a.getImage().src=b};c.send()});a=new ol.source.ImageWMS(a);return new ol.layer.Image({source:a,opacity:1})};
netgis.MapOpenLayers.prototype.clearAll=function(){for(var a=0;a<this.layers.length;a++)this.map.removeLayer(this.layers[a]);this.layers=[];this.snapFeatures.clear()};netgis.MapOpenLayers.prototype.onUpdateStyle=function(a){a=new ol.style.Style({fill:new ol.style.Fill({color:a.polygon.fill}),stroke:new ol.style.Stroke({color:a.polygon.stroke,width:a.polygon.strokeWidth})});this.editLayer.setStyle(a)}; netgis.MapOpenLayers.prototype.createLayerWFS=function(a,b,c,d){a+="service=WFS&version=1.1.0&request=GetFeature";d=d?netgis.util.replace(d," ","+"):"application/json";var e=new ol.source.Vector({format:new ol.format.GeoJSON,strategy:ol.loadingstrategy.bbox,url:function(e){return a+"&typename="+b+"&srsname="+c+"&bbox="+e.join(",")+","+c+"&outputFormat="+d}}),f=new ol.layer.Vector({source:e}),g=this;e.on("featuresloadstart",function(a){g.removeSnapLayer(f)});e.on("featuresloadend",function(a){window.setTimeout(function(){g.addSnapLayer(f)},
netgis.MapOpenLayers.prototype.styleEdit=function(){return new ol.style.Style({image:new ol.style.Circle({radius:this.client.config.styles.editLayer.pointRadius,fill:new ol.style.Fill({color:this.client.config.styles.editLayer.stroke})}),fill:new ol.style.Fill({color:this.client.config.styles.editLayer.fill}),stroke:new ol.style.Stroke({color:this.client.config.styles.editLayer.stroke,width:this.client.config.styles.editLayer.strokeWidth})})}; 10)});return f};netgis.MapOpenLayers.prototype.clearAll=function(){for(var a=0;a<this.layers.length;a++)this.map.removeLayer(this.layers[a]);this.layers=[];this.snapFeatures.clear()};netgis.MapOpenLayers.prototype.onUpdateStyle=function(a){a=new ol.style.Style({fill:new ol.style.Fill({color:a.polygon.fill}),stroke:new ol.style.Stroke({color:a.polygon.stroke,width:a.polygon.strokeWidth})});this.editLayer.setStyle(a)};
netgis.MapOpenLayers.prototype.styleSelect=function(a){return new ol.style.Style({image:new ol.style.Circle({radius:this.client.config.styles.select.pointRadius,fill:new ol.style.Fill({color:this.client.config.styles.select.stroke})}),fill:new ol.style.Fill({color:this.client.config.styles.select.fill}),stroke:new ol.style.Stroke({color:this.client.config.styles.select.stroke,width:this.client.config.styles.select.strokeWidth})})}; netgis.MapOpenLayers.prototype.styleEdit=function(a){var b=this.client.config.styles.editLayer.pointRadius;a=a.getGeometry();b=new ol.style.Style({image:new ol.style.Circle({radius:b,fill:new ol.style.Fill({color:this.client.config.styles.editLayer.stroke})}),fill:new ol.style.Fill({color:this.client.config.styles.editLayer.fill}),stroke:new ol.style.Stroke({color:this.client.config.styles.editLayer.stroke,width:this.client.config.styles.editLayer.strokeWidth})});a instanceof ol.geom.Polygon&&(a=
a.getArea(),b.setText(new ol.style.Text({text:[netgis.util.formatArea(a,!0),"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 b};
netgis.MapOpenLayers.prototype.styleSelect=function(a){var b=a.getGeometry();a=new ol.style.Style({image:new ol.style.Circle({radius:this.client.config.styles.select.pointRadius,fill:new ol.style.Fill({color:this.client.config.styles.select.stroke})}),fill:new ol.style.Fill({color:this.client.config.styles.select.fill}),stroke:new ol.style.Stroke({color:this.client.config.styles.select.stroke,width:this.client.config.styles.select.strokeWidth})});b instanceof ol.geom.Polygon&&(b=b.getArea(),a.setText(new ol.style.Text({text:[netgis.util.formatArea(b,
!0),"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 a};
netgis.MapOpenLayers.prototype.styleModify=function(a){var b=new ol.style.Style({image:new ol.style.Circle({radius:this.client.config.styles.modify.pointRadius,fill:new ol.style.Fill({color:this.client.config.styles.modify.stroke})}),fill:new ol.style.Fill({color:this.client.config.styles.modify.fill}),stroke:new ol.style.Stroke({color:this.client.config.styles.modify.stroke,width:this.client.config.styles.modify.strokeWidth})});a=new ol.style.Style({image:new ol.style.Circle({radius:this.client.config.styles.modify.pointRadius, netgis.MapOpenLayers.prototype.styleModify=function(a){var b=new ol.style.Style({image:new ol.style.Circle({radius:this.client.config.styles.modify.pointRadius,fill:new ol.style.Fill({color:this.client.config.styles.modify.stroke})}),fill:new ol.style.Fill({color:this.client.config.styles.modify.fill}),stroke:new ol.style.Stroke({color:this.client.config.styles.modify.stroke,width:this.client.config.styles.modify.strokeWidth})});a=new ol.style.Style({image:new ol.style.Circle({radius:this.client.config.styles.modify.pointRadius,
fill:new ol.style.Fill({color:this.client.config.styles.modify.stroke})}),geometry:this.getGeometryPoints(a)});return[b,a]}; fill:new ol.style.Fill({color:this.client.config.styles.modify.stroke})}),geometry:this.getGeometryPoints(a)});return[b,a]};
netgis.MapOpenLayers.prototype.styleSketch=function(a){var b=new ol.style.Style({image:new ol.style.Circle({radius:this.client.config.styles.sketch.pointRadius,fill:new ol.style.Fill({color:this.client.config.styles.sketch.stroke})}),fill:new ol.style.Fill({color:this.client.config.styles.sketch.fill}),stroke:new ol.style.Stroke({color:this.client.config.styles.sketch.stroke,width:this.client.config.styles.sketch.strokeWidth})});a=new ol.style.Style({image:new ol.style.Circle({radius:this.client.config.styles.sketch.pointRadius, netgis.MapOpenLayers.prototype.styleSketch=function(a){var b=a.getGeometry(),c=new ol.style.Style({image:new ol.style.Circle({radius:this.client.config.styles.sketch.pointRadius,fill:new ol.style.Fill({color:this.client.config.styles.sketch.stroke})}),fill:new ol.style.Fill({color:this.client.config.styles.sketch.fill}),stroke:new ol.style.Stroke({color:this.client.config.styles.sketch.stroke,width:this.client.config.styles.sketch.strokeWidth})});b instanceof ol.geom.Polygon&&(b=b.getArea(),c.setText(new ol.style.Text({text:[netgis.util.formatArea(b,
fill:new ol.style.Fill({color:this.client.config.styles.sketch.stroke})}),geometry:this.getGeometryPoints(a)});return[b,a]};netgis.MapOpenLayers.prototype.styleParcel=function(){return new ol.style.Style({fill:new ol.style.Fill({color:this.client.config.styles.parcel.fill}),stroke:new ol.style.Stroke({color:this.client.config.styles.parcel.stroke,width:this.client.config.styles.parcel.strokeWidth})})}; !0),"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]})));a=new ol.style.Style({image:new ol.style.Circle({radius:this.client.config.styles.sketch.pointRadius,fill:new ol.style.Fill({color:this.client.config.styles.sketch.stroke})}),geometry:this.getGeometryPoints(a)});return[c,a]};
netgis.MapOpenLayers.prototype.styleParcel=function(){return new ol.style.Style({fill:new ol.style.Fill({color:this.client.config.styles.parcel.fill}),stroke:new ol.style.Stroke({color:this.client.config.styles.parcel.stroke,width:this.client.config.styles.parcel.strokeWidth})})};
netgis.MapOpenLayers.prototype.getGeometryPoints=function(a){var b=a.getGeometry();if(b instanceof ol.geom.LineString)return new ol.geom.MultiPoint(b.getCoordinates());if(b instanceof ol.geom.Polygon){a=[];b=b.getCoordinates();for(var c=0;c<b.length;c++)for(var d=b[c],e=0;e<d.length;e++)a.push(d[e]);return new ol.geom.MultiPoint(a)}if(b instanceof ol.geom.MultiPolygon){a=[];for(var f=b.getPolygons(),g=0;g<f.length;g++)for(b=f[g].getCoordinates(),c=0;c<b.length;c++)for(d=b[c],e=0;e<d.length;e++)a.push(d[e]); netgis.MapOpenLayers.prototype.getGeometryPoints=function(a){var b=a.getGeometry();if(b instanceof ol.geom.LineString)return new ol.geom.MultiPoint(b.getCoordinates());if(b instanceof ol.geom.Polygon){a=[];b=b.getCoordinates();for(var c=0;c<b.length;c++)for(var d=b[c],e=0;e<d.length;e++)a.push(d[e]);return new ol.geom.MultiPoint(a)}if(b instanceof ol.geom.MultiPolygon){a=[];for(var f=b.getPolygons(),g=0;g<f.length;g++)for(b=f[g].getCoordinates(),c=0;c<b.length;c++)for(d=b[c],e=0;e<d.length;e++)a.push(d[e]);
return new ol.geom.MultiPoint(a)}if(b instanceof ol.geom.MultiLineString){a=[];f=b.getPolygons();for(g=0;g<f.length;g++)for(b=f[g].getCoordinates(),c=0;c<b.length;c++)for(d=b[c],e=0;e<d.length;e++)a.push(d[e]);return new ol.geom.MultiPoint(a)}return b};netgis.MapOpenLayers.prototype.getActiveVectorLayers=function(){for(var a=[],b=this.map.getLayers().getArray(),c=this.layers,d=0;d<c.length;d++){var e=c[d];e instanceof ol.layer.Vector&&-1<b.indexOf(e)&&a.push(e)}return a}; return new ol.geom.MultiPoint(a)}if(b instanceof ol.geom.MultiLineString){a=[];f=b.getPolygons();for(g=0;g<f.length;g++)for(b=f[g].getCoordinates(),c=0;c<b.length;c++)for(d=b[c],e=0;e<d.length;e++)a.push(d[e]);return new ol.geom.MultiPoint(a)}return b};netgis.MapOpenLayers.prototype.getActiveVectorLayers=function(){for(var a=[],b=this.map.getLayers().getArray(),c=this.layers,d=0;d<c.length;d++){var e=c[d];e instanceof ol.layer.Vector&&-1<b.indexOf(e)&&a.push(e)}return a};
netgis.MapOpenLayers.prototype.setMode=function(a){switch(this.mode){case netgis.Modes.BUFFER_FEATURE_EDIT:this.onBufferCancel(null)}this.map.getInteractions().clear();var b=this.interactions[a];if(b)for(var c=0;c<b.length;c++)this.map.addInteraction(b[c]);this.snap&&(a===netgis.Modes.DRAW_POINTS||a===netgis.Modes.DRAW_LINES||a===netgis.Modes.DRAW_POLYGONS)&&this.map.addInteraction(this.snap);switch(a){default:this.editLayer.setStyle(this.styleEdit.bind(this));break;case netgis.Modes.MODIFY_FEATURES:this.editLayer.setStyle(this.styleModify.bind(this))}this.mode&& netgis.MapOpenLayers.prototype.setMode=function(a){switch(this.mode){case netgis.Modes.BUFFER_FEATURE_EDIT:this.onBufferCancel(null);break;case netgis.Modes.DRAW_POINTS:case netgis.Modes.DRAW_LINES:this.onDrawBufferOff(null)}this.map.getInteractions().clear();var b=this.interactions[a];if(b)for(var c=0;c<b.length;c++)this.map.addInteraction(b[c]);this.snap&&(a===netgis.Modes.DRAW_POINTS||a===netgis.Modes.DRAW_LINES||a===netgis.Modes.DRAW_POLYGONS)&&this.map.addInteraction(this.snap);switch(a){default:this.editLayer.setStyle(this.styleEdit.bind(this));
this.root.classList.remove(this.getModeClassName(this.mode));a&&this.root.classList.add(this.getModeClassName(a));this.mode=a};netgis.MapOpenLayers.prototype.getModeClassName=function(a){a=a.toLowerCase();a=netgis.util.replace(a,"_","-");return"netgis-mode-"+a};netgis.MapOpenLayers.prototype.setSnapOn=function(){this.snap=new ol.interaction.Snap({features:this.snapFeatures});this.map.addInteraction(this.snap);this.snapFeatures.changed()}; break;case netgis.Modes.MODIFY_FEATURES:this.editLayer.setStyle(this.styleModify.bind(this))}this.mode&&this.root.classList.remove(this.getModeClassName(this.mode));a&&this.root.classList.add(this.getModeClassName(a));this.mode=a};netgis.MapOpenLayers.prototype.getModeClassName=function(a){a=a.toLowerCase();a=netgis.util.replace(a,"_","-");return"netgis-mode-"+a};
netgis.MapOpenLayers.prototype.setSnapOff=function(){this.snap&&(this.map.removeInteraction(this.snap),this.snap=null)};netgis.MapOpenLayers.prototype.addSnapLayer=function(a){a=a.getSource().getFeatures();for(var b=0;b<a.length;b++)this.snapFeatures.push(a[b])};netgis.MapOpenLayers.prototype.removeSnapLayer=function(a){a=a.getSource().getFeatures();for(var b=0;b<a.length;b++)this.snapFeatures.remove(a[b])};netgis.MapOpenLayers.prototype.onSnapOn=function(a){this.setSnapOn()}; netgis.MapOpenLayers.prototype.setSnapOn=function(){this.snap=new ol.interaction.Snap({features:this.snapFeatures});this.map.addInteraction(this.snap);this.snapFeatures.changed()};netgis.MapOpenLayers.prototype.setSnapOff=function(){this.snap&&(this.map.removeInteraction(this.snap),this.snap=null)};
netgis.MapOpenLayers.prototype.onSnapOff=function(a){this.setSnapOff()};netgis.MapOpenLayers.prototype.onLayerShow=function(a){if(a=this.layers[a.id])this.map.addLayer(a),a instanceof ol.layer.Vector&&this.addSnapLayer(a)};netgis.MapOpenLayers.prototype.onLayerHide=function(a){if(a=this.layers[a.id])this.map.removeLayer(a),a instanceof ol.layer.Vector&&this.removeSnapLayer(a)}; netgis.MapOpenLayers.prototype.setTracingOn=function(){var a=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:!0,traceSource:a});a=this.interactions[netgis.Modes.DRAW_POLYGONS];a[0].setActive(!1);a.push(this.tracing);this.setMode(this.mode)};
netgis.MapOpenLayers.prototype.setTracingOff=function(){var a=this.interactions[netgis.Modes.DRAW_POLYGONS];a[0].setActive(!0);a.splice(a.indexOf(this.tracing),1);this.setMode(this.mode)};netgis.MapOpenLayers.prototype.addSnapLayer=function(a){a=a.getSource().getFeatures();for(var b=0;b<a.length;b++)this.snapFeatures.push(a[b])};netgis.MapOpenLayers.prototype.removeSnapLayer=function(a){a=a.getSource().getFeatures();for(var b=0;b<a.length;b++)this.snapFeatures.remove(a[b])};
netgis.MapOpenLayers.prototype.onSnapOn=function(a){this.setSnapOn()};netgis.MapOpenLayers.prototype.onSnapOff=function(a){this.setSnapOff()};netgis.MapOpenLayers.prototype.onTracingOn=function(a){this.setTracingOn()};netgis.MapOpenLayers.prototype.onTracingOff=function(a){this.setTracingOff()};netgis.MapOpenLayers.prototype.onLayerShow=function(a){if(a=this.layers[a.id])this.map.addLayer(a),a instanceof ol.layer.Vector&&this.addSnapLayer(a)};
netgis.MapOpenLayers.prototype.onLayerHide=function(a){if(a=this.layers[a.id])this.map.removeLayer(a),a instanceof ol.layer.Vector&&this.removeSnapLayer(a)};
netgis.MapOpenLayers.prototype.onContextUpdate=function(a){this.clearAll();var b=a.bbox;if(b){if(netgis.util.isDefined(this.client.config.map)&&netgis.util.isDefined(this.client.config.map.projection)){var c=ol.proj.fromLonLat([b[0],b[1]],this.client.config.map.projection);var d=ol.proj.fromLonLat([b[2],b[3]],this.client.config.map.projection)}else c=ol.proj.fromLonLat([b[0],b[1]]),d=ol.proj.fromLonLat([b[2],b[3]]);b[0]=c[0];b[1]=c[1];b[2]=d[0];b[3]=d[1];this.view.fit(b)}for(b=0;b<a.layers.length;b++)if(c= netgis.MapOpenLayers.prototype.onContextUpdate=function(a){this.clearAll();var b=a.bbox;if(b){if(netgis.util.isDefined(this.client.config.map)&&netgis.util.isDefined(this.client.config.map.projection)){var c=ol.proj.fromLonLat([b[0],b[1]],this.client.config.map.projection);var d=ol.proj.fromLonLat([b[2],b[3]],this.client.config.map.projection)}else c=ol.proj.fromLonLat([b[0],b[1]]),d=ol.proj.fromLonLat([b[2],b[3]]);b[0]=c[0];b[1]=c[1];b[2]=d[0];b[3]=d[1];this.view.fit(b)}for(b=0;b<a.layers.length;b++)if(c=
this.createLayer(a.layers[b]))c.setZIndex(a.layers.length-b),this.layers[b]=c};netgis.MapOpenLayers.prototype.onSetMode=function(a){this.setMode(a)};netgis.MapOpenLayers.prototype.onSetExtent=function(a){var b=ol.proj.fromLonLat([a.minx,a.miny],this.client.config.map.projection);a=ol.proj.fromLonLat([a.maxx,a.maxy],this.client.config.map.projection);this.view.fit([b[0],b[1],a[0],a[1]])};netgis.MapOpenLayers.prototype.onChangeZoom=function(a){this.view.animate({zoom:this.view.getZoom()+a,duration:200})}; this.createLayer(a.layers[b]))c.setZIndex(a.layers.length-b),this.layers[b]=c};netgis.MapOpenLayers.prototype.onAddServiceWMS=function(a){var b=this.createLayerWMS(a.url,a.name,a.format);b.setZIndex(a.id);this.layers[a.id]=b};netgis.MapOpenLayers.prototype.onAddServiceWFS=function(a){var b=this.createLayerWFS(a.url,a.name,this.client.config.map.projection,a.format);b.setZIndex(a.id);this.layers[a.id]=b};netgis.MapOpenLayers.prototype.onSetMode=function(a){this.setMode(a)};
netgis.MapOpenLayers.prototype.onZoomWKT=function(a){a=(new ol.format.WKT).readGeometry(a);this.view.fit(a,{duration:300,padding:[40,40,40,40]})}; netgis.MapOpenLayers.prototype.onSetExtent=function(a){var b=ol.proj.fromLonLat([a.minx,a.miny],this.client.config.map.projection);a=ol.proj.fromLonLat([a.maxx,a.maxy],this.client.config.map.projection);this.view.fit([b[0],b[1],a[0],a[1]])};netgis.MapOpenLayers.prototype.onChangeZoom=function(a){this.view.animate({zoom:this.view.getZoom()+a,duration:200})};netgis.MapOpenLayers.prototype.onZoomWKT=function(a){a=(new ol.format.WKT).readGeometry(a);this.view.fit(a,{duration:300,padding:[40,40,40,40]})};
netgis.MapOpenLayers.prototype.onPointerMove=function(a){var b=this.hover,c=this.styleSelect.bind(this);b&&(b.setStyle(this.styleEdit.bind(this)),b=null);var d=this;switch(this.mode){case netgis.Modes.DELETE_FEATURES:this.map.forEachFeatureAtPixel(a.pixel,function(a,f){f===d.editLayer&&(b=a,a.setStyle(c));return!0});break;case netgis.Modes.CUT_FEATURE_BEGIN:this.map.forEachFeatureAtPixel(a.pixel,function(a,f){f===d.editLayer&&(b=a,a.setStyle(c));return!0});break;case netgis.Modes.BUFFER_FEATURE_BEGIN:this.map.forEachFeatureAtPixel(a.pixel, netgis.MapOpenLayers.prototype.onPointerMove=function(a){a=a.pixel;var b=this.hover,c=this.styleSelect.bind(this);b&&(b.setStyle(this.styleEdit.bind(this)),b=null);var d=this;switch(this.mode){case netgis.Modes.DELETE_FEATURES:this.map.forEachFeatureAtPixel(a,function(a,f){f===d.editLayer&&(b=a,a.setStyle(c));return!0});break;case netgis.Modes.CUT_FEATURE_BEGIN:this.map.forEachFeatureAtPixel(a,function(a,f){f===d.editLayer&&(b=a,a.setStyle(c));return!0});break;case netgis.Modes.BUFFER_FEATURE_BEGIN:this.map.forEachFeatureAtPixel(a,
function(a,f){f===d.editLayer&&(b=a,a.setStyle(c));return!0})}this.hover=b}; function(a,f){f===d.editLayer&&(b=a,a.setStyle(c));return!0});break;case netgis.Modes.DRAW_POINTS:case netgis.Modes.DRAW_LINES:this.updateDrawBufferPreview()}this.hover=b};
netgis.MapOpenLayers.prototype.onSingleClick=function(a){switch(this.mode){case netgis.Modes.DELETE_FEATURES:this.hover&&(this.editLayer.getSource().removeFeature(this.hover),this.hover=null);break;case netgis.Modes.CUT_FEATURE_BEGIN:this.hover&&(this.selected=this.hover,this.client.invoke(netgis.Events.SET_MODE,netgis.Modes.CUT_FEATURE_DRAW));break;case netgis.Modes.BUFFER_FEATURE_BEGIN:this.hover&&(this.selected=this.hover,this.client.invoke(netgis.Events.SET_MODE,netgis.Modes.BUFFER_FEATURE_EDIT))}}; netgis.MapOpenLayers.prototype.onSingleClick=function(a){switch(this.mode){case netgis.Modes.DELETE_FEATURES:this.hover&&(this.editLayer.getSource().removeFeature(this.hover),this.hover=null);break;case netgis.Modes.CUT_FEATURE_BEGIN:this.hover&&(this.selected=this.hover,this.client.invoke(netgis.Events.SET_MODE,netgis.Modes.CUT_FEATURE_DRAW));break;case netgis.Modes.BUFFER_FEATURE_BEGIN:this.hover&&(this.selected=this.hover,this.client.invoke(netgis.Events.SET_MODE,netgis.Modes.BUFFER_FEATURE_EDIT))}};
netgis.MapOpenLayers.prototype.onMoveStart=function(a){};netgis.MapOpenLayers.prototype.onMoveEnd=function(a){};netgis.MapOpenLayers.prototype.onChangeResolution=function(a){}; netgis.MapOpenLayers.prototype.onMoveStart=function(a){};netgis.MapOpenLayers.prototype.onMoveEnd=function(a){};netgis.MapOpenLayers.prototype.onChangeResolution=function(a){};
netgis.MapOpenLayers.prototype.onCutFeatureDrawEnd=function(a){var b=a.feature;if(a=this.selected){var c=new jsts.io.OL3Parser,d=c.read(a.getGeometry());b=c.read(b.getGeometry());d=d.difference(b);c=c.write(d);c=new ol.Feature({geometry:c});d=this.editLayer.getSource();d.removeFeature(a);d.addFeature(c);this.selected=c}this.editEventsSilent=!0;this.splitMultiPolygons(this.editLayer);this.editEventsSilent=!1;this.updateEditOutput()};netgis.MapOpenLayers.prototype.onModifyFeaturesEnd=function(a){this.updateEditOutput()}; netgis.MapOpenLayers.prototype.onCutFeatureDrawEnd=function(a){var b=a.feature;if(a=this.selected){var c=new jsts.io.OL3Parser,d=c.read(a.getGeometry());b=c.read(b.getGeometry());d=d.difference(b);c=c.write(d);c=new ol.Feature({geometry:c});d=this.editLayer.getSource();d.removeFeature(a);d.addFeature(c);this.selected=c}this.editEventsSilent=!0;this.splitMultiPolygons(this.editLayer);this.editEventsSilent=!1;this.updateEditOutput()};
netgis.MapOpenLayers.prototype.onBufferChange=function(a){var b=a.radius,c=a.segments;a=this.editLayer.getSource();var d=this.selected;this.sketch&&a.removeFeature(this.sketch);if(d){var e=new jsts.io.OL3Parser;b=e.read(d.getGeometry()).buffer(b,c);b=e.write(b);b=new ol.Feature({geometry:b});a.addFeature(b);this.sketch=b}};netgis.MapOpenLayers.prototype.onBufferAccept=function(a){this.selected&&this.sketch&&this.editLayer.getSource().removeFeature(this.selected);this.selected=this.sketch=null}; netgis.MapOpenLayers.prototype.onModifyFeaturesEnd=function(a){this.updateEditOutput();this.updateEditArea()};netgis.MapOpenLayers.prototype.createBufferFeature=function(a,b,c){a=this.createBufferGeometry(a,b,c);return new ol.Feature({geometry:a})};netgis.MapOpenLayers.prototype.createBufferGeometry=function(a,b,c){var d=new jsts.io.OL3Parser;a=d.read(a).buffer(b,c);return d.write(a)};
netgis.MapOpenLayers.prototype.onBufferCancel=function(a){this.sketch&&(this.editLayer.getSource().removeFeature(this.sketch),this.sketch=null);this.selected=null};netgis.MapOpenLayers.prototype.onEditLayerAdd=function(a){this.updateEditOutput();this.updateEditLayerItem();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.onBufferChange=function(a){var b=this.editLayer.getSource(),c=this.selected;this.sketch&&b.removeFeature(this.sketch);c&&(a=this.createBufferFeature(c.getGeometry(),a.radius,a.segments),b.addFeature(a),this.sketch=a)};netgis.MapOpenLayers.prototype.onBufferAccept=function(a){this.selected&&this.sketch&&this.editLayer.getSource().removeFeature(this.selected);this.selected=this.sketch=null};
netgis.MapOpenLayers.prototype.updateEditOutput=function(){var a=this.editLayer.getSource().getFeatures();a=(new ol.format.GeoJSON).writeFeaturesObject(a);this.editEventsSilent||this.client.invoke(netgis.Events.EDIT_FEATURES_CHANGE,a)};netgis.MapOpenLayers.prototype.updateEditLayerItem=function(){var a=this.editLayerID;this.layers[a]||(this.layers[a]=this.editLayer,this.client.invoke(netgis.Events.LAYER_CREATED,{id:a,title:"Zeichnung",checked:!0,folder:"draw"}))}; netgis.MapOpenLayers.prototype.onBufferCancel=function(a){this.sketch&&(this.editLayer.getSource().removeFeature(this.sketch),this.sketch=null);this.selected=null};netgis.MapOpenLayers.prototype.onDrawPointsEnd=function(a){(a=this.previewLayer.getSource().getFeatures()[0])&&this.editLayer.getSource().addFeature(a.clone())};netgis.MapOpenLayers.prototype.onDrawLinesEnd=function(a){(a=this.previewLayer.getSource().getFeatures()[0])&&this.editLayer.getSource().addFeature(a.clone())};
netgis.MapOpenLayers.prototype.onEditFeaturesLoaded=function(a){a=(new ol.format.GeoJSON).readFeatures(a);this.editLayer.getSource().addFeatures(a);0<a.length&&this.view.fit(this.editLayer.getSource().getExtent(),{padding:[40,40,40,40]})};netgis.MapOpenLayers.prototype.onDragEnter=function(a){a.preventDefault();this.dropTarget.classList.remove("netgis-hide");return!1};netgis.MapOpenLayers.prototype.onDragLeave=function(a){this.dropTarget.classList.add("netgis-hide");return!1}; netgis.MapOpenLayers.prototype.onDrawBufferOn=function(a){a=this.createBufferFeature(new ol.geom.Point(this.client.config.map.center),this.drawBufferRadius,this.drawBufferSegments);this.previewLayer.getSource().addFeature(a)};netgis.MapOpenLayers.prototype.onDrawBufferOff=function(a){this.previewLayer.getSource().clear()};netgis.MapOpenLayers.prototype.onDrawBufferRadiusChange=function(a){this.drawBufferRadius=a;this.updateDrawBufferPreview()};
netgis.MapOpenLayers.prototype.onDrawBufferSegmentsChange=function(a){this.drawBufferSegments=a;this.updateDrawBufferPreview()};netgis.MapOpenLayers.prototype.updateDrawBufferPreview=function(){var a=this.interactions[this.mode][0].getOverlay().getSource().getFeatures();if(!(1>a.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;d<a.length;d++){var e=a[d].getGeometry();e instanceof ol.geom.Polygon&&(b+=e.getArea())}c.area=b;this.editEventsSilent||this.client.invoke(netgis.Events.EDIT_FEATURES_CHANGE,c)};
netgis.MapOpenLayers.prototype.updateEditLayerItem=function(){var a=this.editLayerID;this.layers[a]||(this.layers[a]=this.editLayer,this.client.invoke(netgis.Events.LAYER_CREATED,{id:a,title:"Zeichnung",checked:!0,folder:"draw"}))};netgis.MapOpenLayers.prototype.updateEditArea=function(){};netgis.MapOpenLayers.prototype.onEditFeaturesLoaded=function(a){var b=this;window.setTimeout(function(){b.createLayerGeoJSON("Import",a)},10)};
netgis.MapOpenLayers.prototype.onDragEnter=function(a){a.preventDefault();this.dropTarget.classList.remove("netgis-hide");return!1};netgis.MapOpenLayers.prototype.onDragLeave=function(a){this.dropTarget.classList.add("netgis-hide");return!1};
netgis.MapOpenLayers.prototype.onDragDrop=function(a){console.info("Drag Drop");this.dropTarget.classList.add("netgis-hide");a.preventDefault();a=a.dataTransfer.files[0];var b=new FileReader;b.onload=this.onDragLoad.bind(this);console.log("File:",a);b.readAsArrayBuffer(a);return!1};netgis.MapOpenLayers.prototype.onDragLoad=function(a){console.log("On Load:",a.target);this.loadShape(a.target.result)};netgis.MapOpenLayers.prototype.loadShape=function(a){var b=this;shp(a).then(function(a){b.onShapeLoad(a)})}; netgis.MapOpenLayers.prototype.onDragDrop=function(a){console.info("Drag Drop");this.dropTarget.classList.add("netgis-hide");a.preventDefault();a=a.dataTransfer.files[0];var b=new FileReader;b.onload=this.onDragLoad.bind(this);console.log("File:",a);b.readAsArrayBuffer(a);return!1};netgis.MapOpenLayers.prototype.onDragLoad=function(a){console.log("On Load:",a.target);this.loadShape(a.target.result)};netgis.MapOpenLayers.prototype.loadShape=function(a){var b=this;shp(a).then(function(a){b.onShapeLoad(a)})};
netgis.MapOpenLayers.prototype.onShapeLoad=function(a){console.info("Shapefile To Geojson:",a);a=(new ol.format.GeoJSON({dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})).readFeatures(a);this.importLayer.getSource().addFeatures(a);this.view.fit(this.importLayer.getSource().getExtent(),{})};netgis.MapOpenLayers.prototype.onImportGeoJSON=function(a){var b=a.name,c=this,d=new FileReader;d.onload=function(a){c.createLayerGeoJSON(b,a.target.result)};d.readAsText(a)}; netgis.MapOpenLayers.prototype.onShapeLoad=function(a){console.info("Shapefile To Geojson:",a);a=(new ol.format.GeoJSON({dataProjection:"EPSG:4326",featureProjection:"EPSG:3857"})).readFeatures(a);this.importLayer.getSource().addFeatures(a);this.view.fit(this.importLayer.getSource().getExtent(),{})};netgis.MapOpenLayers.prototype.onImportGeoJSON=function(a){var b=a.name,c=this,d=new FileReader;d.onload=function(a){c.createLayerGeoJSON(b,a.target.result)};d.readAsText(a)};
netgis.MapOpenLayers.prototype.onImportGML=function(a){var b=a.name,c=this,d=new FileReader;d.onload=function(a){c.createLayerGML(b,a.target.result)};d.readAsText(a)};netgis.MapOpenLayers.prototype.onImportShapefile=function(a){var b=a.name,c=this,d=new FileReader;d.onload=function(a){c.createLayerShapefile(b,a.target.result)};d.readAsArrayBuffer(a)}; netgis.MapOpenLayers.prototype.onImportGML=function(a){var b=a.name,c=this,d=new FileReader;d.onload=function(a){c.createLayerGML(b,a.target.result)};d.readAsText(a)};netgis.MapOpenLayers.prototype.onImportShapefile=function(a){var b=a.name,c=this,d=new FileReader;d.onload=function(a){c.createLayerShapefile(b,a.target.result)};d.readAsArrayBuffer(a)};
netgis.MapOpenLayers.prototype.createLayerGeoJSON=function(a,b){a=new ol.format.GeoJSON;a.readProjection(b);b=a.readFeatures(b,{featureProjection:this.client.config.map.projection});this.addImportedFeatures(b)};netgis.MapOpenLayers.prototype.createLayerGML=function(a,b){console.warn("GML support is experimental!");var c=new ol.format.WFS;a=c.readProjection(b);b=c.readFeatures(b,{featureProjection:this.client.config.map.projection});console.info("GML:",a,b);this.addImportedFeatures(b)}; netgis.MapOpenLayers.prototype.onImportSpatialite=function(a){var b=a.name,c=this,d=new FileReader;d.onload=function(a){c.createLayerSpatialite(b,a.target.result)};d.readAsArrayBuffer(a)};netgis.MapOpenLayers.prototype.onImportGeopackage=function(a){var b=a.name,c=this,d=new FileReader;d.onload=function(a){c.createLayerGeopackage(b,a.target.result)};d.readAsArrayBuffer(a)};
netgis.MapOpenLayers.prototype.createLayerShapefile=function(a,b){var c=this;shp(b).then(function(a){var b=new ol.format.GeoJSON;b.readProjection(a);a=b.readFeatures(a,{featureProjection:c.client.config.map.projection});c.addImportedFeatures(a)})};netgis.MapOpenLayers.prototype.addImportedFeatures=function(a){this.editEventsSilent=!0;this.editLayer.getSource().addFeatures(a);this.editEventsSilent=!1;this.updateEditOutput()}; netgis.MapOpenLayers.prototype.createLayerGeoJSON=function(a,b){var c=new ol.format.GeoJSON;a=c.readProjection(b);b=c.readFeatures(b,{featureProjection:this.client.config.map.projection});a=a.getCode();switch(a){case "EPSG:3857":case "EPSG:4326":case this.client.config.map.projection:break;default:console.warn("Unsupported Import Projection:",a)}this.addImportedFeatures(b)};
netgis.MapOpenLayers.prototype.createLayerGML=function(a,b){console.warn("GML support is experimental!");a=[];b=(new DOMParser).parseFromString(b,"text/xml").getElementsByTagName("gml:featureMember");for(var c=0;c<b.length;c++){for(var d={},e=b[c].children[0],f=0;f<e.attributes.length;f++){var g=e.attributes[f];d[g.nodeName]=g.nodeValue}for(f=0;f<e.children.length;f++)if(g=e.children[f],"ogr:geometryProperty"!==g.nodeName){var h=g.nodeName.split(":");d[h[h.length-1]]=g.innerHTML}e=e.getElementsByTagName("ogr:geometryProperty")[0].children[0];
(f=e.getAttribute("srsName"))&&"EPSG:4326"!==f&&f!==this.client.config.map.projection&&console.warn("Unsupported Import Projection:",f);switch(e.nodeName){case "gml:Polygon":d.geometry=this.gmlParsePolygon(e,f);break;case "gml:MultiPolygon":d.geometry=this.gmlParseMultiPolygon(e,f)}d=new ol.Feature(d);a.push(d)}this.addImportedFeatures(a)};
netgis.MapOpenLayers.prototype.gmlParsePolygon=function(a,b){var c=[];a=a.getElementsByTagName("gml:LinearRing");for(var d=0;d<a.length;d++){var e=a[d].getElementsByTagName("gml:coordinates")[0].innerHTML;c.push(this.gmlParseCoordinates(e,b))}return new ol.geom.Polygon(c)};
netgis.MapOpenLayers.prototype.gmlParseMultiPolygon=function(a,b){var c=[];a=a.getElementsByTagName("gml:polygonMember");for(var d=0;d<a.length;d++){var e=a[d].getElementsByTagName("gml:Polygon")[0];c.push(this.gmlParsePolygon(e,b))}return new ol.geom.MultiPolygon(c)};netgis.MapOpenLayers.prototype.gmlParseCoordinates=function(a,b){a=a.split(" ");for(var c=0;c<a.length;c++){a[c]=a[c].split(",");for(var d=0;d<a[c].length;d++)a[c][d]=Number.parseFloat(a[c][d]);b&&(a[c]=ol.proj.transform(a[c],b,this.client.config.map.projection))}return a};
netgis.MapOpenLayers.prototype.createLayerShapefile=function(a,b){var c=this;shp(b).then(function(a){var b=new ol.format.GeoJSON;b.readProjection(a);a=b.readFeatures(a,{featureProjection:c.client.config.map.projection});c.addImportedFeatures(a)})};
netgis.MapOpenLayers.prototype.createLayerSpatialite=function(a,b){var c=this;window.initSqlJs().then(function(a){var d=[],f=new Uint8Array(b);a=new a.Database(f);var g=a.exec("SELECT name FROM sqlite_schema WHERE type = 'table' \n\t\t\t\t\tAND name NOT LIKE 'sqlite_%' \n\t\t\t\t\tAND name NOT LIKE 'sql_%' \n\t\t\t\t\tAND name NOT LIKE 'idx_%' \n\t\t\t\t\tAND name NOT LIKE 'spatial_ref_sys%' \n\t\t\t\t\tAND name NOT LIKE 'spatialite_%' \n\t\t\t\t\tAND name NOT LIKE 'geometry_columns%' \n\t\t\t\t\tAND name NOT LIKE 'views_%' \n\t\t\t\t\tAND name NOT LIKE 'virts_%' \n\t\t\t\t\tAND name NOT LIKE 'SpatialIndex' \n\t\t\t\t\tAND name NOT LIKE 'ElementaryGeometries' \n\t\t\t\t;");f=
g[0].values;for(var h=0;h<f.length;h++){g=a.exec("SELECT * FROM "+f[h][0]);var k=g[0];g=null;for(var l=0;l<k.columns.length;l++){if("geometry"===k.columns[l].toLowerCase()){g=l;break}if("geom"===k.columns[l].toLowerCase()){g=l;break}}k=k.values;for(l=0;l<k.length;l++){var m=k[l][g],n=new Uint8Array(m.length-43-1+5);n[0]=m[1];n[1]=m[39];n[2]=m[40];n[3]=m[41];n[4]=m[42];for(var p=m.length-43-1,q=0;q<p;q++)n[5+q]=m[43+q];m=(new ol.format.WKB).readGeometry(n,{featureProjection:c.client.config.map.projection});
d.push(new ol.Feature({geometry:m}))}}c.addImportedFeatures(d)})};
netgis.MapOpenLayers.prototype.createLayerGeopackage=function(a,b){var c=this;a=new Uint8Array(b);window.GeoPackage.setSqljsWasmLocateFile(function(a){return c.client.config.import.geopackageLibURL+a});window.GeoPackage.GeoPackageAPI.open(a).then(function(a){for(var b=[],d=new ol.format.GeoJSON,g=a.getFeatureTables(),h=0;h<g.length;h++)for(var k=a.queryForGeoJSONFeaturesInTable(g[h]),l=0;l<k.length;l++){var m=d.readGeometry(k[l].geometry,{featureProjection:c.client.config.map.projection});m=new ol.Feature({geometry:m});
b.push(m)}c.addImportedFeatures(b)})};netgis.MapOpenLayers.prototype.addImportedFeatures=function(a){this.editEventsSilent=!0;this.editLayer.getSource().addFeatures(a);this.editEventsSilent=!1;this.updateEditOutput();if(0<a.length){for(var b=a[0].getGeometry().getExtent(),c=1;c<a.length;c++)ol.extent.extend(b,a[c].getGeometry().getExtent());this.view.fit(b,{duration:300,padding:[40,40,40,40]})}};
netgis.MapOpenLayers.prototype.onImportWKT=function(a){a=(new ol.format.WKT).readGeometry(a);a=new ol.Feature({geometry:a});this.addImportedFeatures([a])};netgis.MapOpenLayers.prototype.onExportPDF=function(a){this.exportImage("pdf",a.resx,a.resy,a.mode,a.margin)};netgis.MapOpenLayers.prototype.onExportJPEG=function(a){this.exportImage("jpeg",a.resx,a.resy)};netgis.MapOpenLayers.prototype.onExportPNG=function(a){this.exportImage("png",a.resx,a.resy)}; netgis.MapOpenLayers.prototype.onImportWKT=function(a){a=(new ol.format.WKT).readGeometry(a);a=new ol.Feature({geometry:a});this.addImportedFeatures([a])};netgis.MapOpenLayers.prototype.onExportPDF=function(a){this.exportImage("pdf",a.resx,a.resy,a.mode,a.margin)};netgis.MapOpenLayers.prototype.onExportJPEG=function(a){this.exportImage("jpeg",a.resx,a.resy)};netgis.MapOpenLayers.prototype.onExportPNG=function(a){this.exportImage("png",a.resx,a.resy)};
netgis.MapOpenLayers.prototype.onExportGIF=function(a){this.exportImage("gif",a.resx,a.resy)};netgis.MapOpenLayers.prototype.onParcelShowPreview=function(a){a=(new ol.format.WKT).readGeometry(a.geom);a=new ol.Feature({geometry:a});this.parcelLayer.getSource().clear();this.parcelLayer.getSource().addFeature(a)};netgis.MapOpenLayers.prototype.onParcelHidePreview=function(a){this.parcelLayer.getSource().clear()};netgis.MapOpenLayers.prototype.getWidth=function(){return this.map.getSize()[0]}; netgis.MapOpenLayers.prototype.onExportGIF=function(a){this.exportImage("gif",a.resx,a.resy)};netgis.MapOpenLayers.prototype.onParcelShowPreview=function(a){a=(new ol.format.WKT).readGeometry(a.geom);a=new ol.Feature({geometry:a});this.parcelLayer.getSource().clear();this.parcelLayer.getSource().addFeature(a)};netgis.MapOpenLayers.prototype.onParcelHidePreview=function(a){this.parcelLayer.getSource().clear()};netgis.MapOpenLayers.prototype.getWidth=function(){return this.map.getSize()[0]};
netgis.MapOpenLayers.prototype.getHeight=function(){return this.map.getSize()[1]}; netgis.MapOpenLayers.prototype.getHeight=function(){return this.map.getSize()[1]};
netgis.MapOpenLayers.prototype.exportImage=function(a,b,c,d,e){this.client.invoke(netgis.Events.EXPORT_BEGIN,null);var f=this,g=this.root,h=this.map,k=this.client.config,l=new Image;l.onload=function(){var m=document.createElement("div");m.style.position="fixed";m.style.top="0px";m.style.left="0px";m.style.width=b+"px";m.style.height=c+"px";m.style.background="white";m.style.zIndex=-1;m.style.opacity=0;m.style.pointerEvents="none";g.appendChild(m);h.setTarget(m);h.once("rendercomplete",function(){var n= netgis.MapOpenLayers.prototype.exportImage=function(a,b,c,d,e){this.client.invoke(netgis.Events.EXPORT_BEGIN,null);var f=this,g=this.root,h=this.map,k=this.client.config,l=new Image;l.onload=function(){var m=document.createElement("div");m.style.position="fixed";m.style.top="0px";m.style.left="0px";m.style.width=b+"px";m.style.height=c+"px";m.style.background="white";m.style.zIndex=-1;m.style.opacity=0;m.style.pointerEvents="none";g.appendChild(m);h.setTarget(m);h.once("rendercomplete",function(){var n=
document.createElement("canvas");n.width=b;n.height=c;var w=n.getContext("2d");w.webkitImageSmoothingEnabled=!1;w.mozImageSmoothingEnabled=!1;w.imageSmoothingEnabled=!1;Array.prototype.forEach.call(document.querySelectorAll(".ol-layer canvas"),function(a){if(0<a.width){var b=a.parentNode.style.opacity;w.globalAlpha=""===b?1:Number(b);b=a.style.transform.match(/^matrix\(([^\(]*)\)$/)[1].split(",").map(Number);CanvasRenderingContext2D.prototype.setTransform.apply(w,b);w.drawImage(a,0,0)}});w.drawImage(l, document.createElement("canvas");n.width=b;n.height=c;var p=n.getContext("2d");p.webkitImageSmoothingEnabled=!1;p.mozImageSmoothingEnabled=!1;p.imageSmoothingEnabled=!1;Array.prototype.forEach.call(document.querySelectorAll(".ol-layer canvas"),function(a){if(0<a.width){var b=a.parentNode.style.opacity;p.globalAlpha=""===b?1:Number(b);b=a.style.transform.match(/^matrix\(([^\(]*)\)$/)[1].split(",").map(Number);CanvasRenderingContext2D.prototype.setTransform.apply(p,b);p.drawImage(a,0,0)}});p.drawImage(l,
0,0);var t=document.createElement("a");switch(a){case "pdf":e=e?e:0;var p=297-e-e,q=210-e-e,u=n.width/n.height;if(!d){var r=p;p=q;q=r}if(n.height>n.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? 0,0);p.fillStyle="#fff";p.fillRect(0,n.height-30,140,30);p.fillStyle="#000";p.font="4mm sans-serif";p.fillText(netgis.util.getTimeStamp(),10,n.height-10);var q=document.createElement("a");switch(a){case "pdf":e=e?e:0;var r=297-e-e,v=210-e-e,t=n.width/n.height;if(!d){var w=r;r=v;v=w}if(n.height>n.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,
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+ 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?
".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}; 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,
netgis.MapOpenLayers.prototype.splitMultiPolygons=function(a){a=a.getSource();for(var b=a.getFeatures(),c=[],d=[],e=0;e<b.length;e++){var f=b[e],g=f.getGeometry();if(g instanceof ol.geom.MultiPolygon){g=g.getPolygons();for(var h=0;h<g.length;h++){var k=new ol.Feature({geometry:g[h]});d.push(k)}c.push(f)}}for(e=0;e<c.length;e++)a.removeFeature(c[e]);a.addFeatures(d)};netgis=netgis||{};netgis.Menu=function(){this.root=this.client=null;this.sections=[]}; 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<b.length;e++){var f=b[e],g=f.getGeometry();if(g instanceof ol.geom.MultiPolygon){g=g.getPolygons();for(var h=0;h<g.length;h++){var k=new ol.Feature({geometry:g[h]});d.push(k)}c.push(f)}}for(e=0;e<c.length;e++)a.removeFeature(c[e]);a.addFeatures(d)};netgis=netgis||{};netgis.Menu=function(){this.root=this.client=null;this.sections=[]};
netgis.Menu.prototype.load=function(){this.root=document.createElement("header");this.root.className="netgis-menu netgis-primary netgis-shadow";var a=document.createElement("div");this.root.appendChild(a);var b=this.createButton('Ebenen<i class="fab fa-buffer"></i>',!0);b.addEventListener("click",this.onToggleClick.bind(this));a.appendChild(b);b=this.createButton('Suche<i class="fas fa-search" style="position: relative; top: 0.3mm;"></i>',!0);b.addEventListener("click",this.onSearchPlaceClick.bind(this)); netgis.Menu.prototype.load=function(){this.root=document.createElement("header");this.root.className="netgis-menu netgis-primary netgis-shadow";var a=document.createElement("div");this.root.appendChild(a);var b=this.createButton('Ebenen<i class="fab fa-buffer"></i>',!0);b.addEventListener("click",this.onToggleClick.bind(this));a.appendChild(b);b=this.createButton('Suche<i class="fas fa-search" style="position: relative; top: 0.3mm;"></i>',!0);b.addEventListener("click",this.onSearchPlaceClick.bind(this));
a.appendChild(b);b=this.createButton('Flurst\u00fccke<i class="fas fa-vector-square" style="position: relative; top: 0.3mm;"></i>',!0);b.addEventListener("click",this.onSearchParcelClick.bind(this));a.appendChild(b);if(this.client.editable){b=this.createMenu('<i class="fas fa-caret-down"></i>Zeichnen');var c=b.getElementsByTagName("ul")[0];a.appendChild(b);c.appendChild(this.createMenuItem('<i class="fas fa-map-marker-alt"></i>Punkte',this.onDrawPointClick.bind(this)));c.appendChild(this.createMenuItem('<i class="fas fa-minus"></i>Linien', a.appendChild(b);b=this.createButton('Flurst\u00fccke<i class="fas fa-vector-square" style="position: relative; top: 0.3mm;"></i>',!0);b.addEventListener("click",this.onSearchParcelClick.bind(this));a.appendChild(b);if(this.client.editable){b=this.createMenu('<i class="fas fa-caret-down"></i>Zeichnen');var c=b.getElementsByTagName("ul")[0];a.appendChild(b);c.appendChild(this.createMenuItem('<i class="fas fa-map-marker-alt"></i>Punkte',this.onDrawPointClick.bind(this)));c.appendChild(this.createMenuItem('<i class="fas fa-minus"></i>Linien',
this.onDrawLineClick.bind(this)));c.appendChild(this.createMenuItem('<i class="fas fa-vector-square"></i>Polygone',this.onDrawPolygonClick.bind(this)));b=this.createMenu('<i class="fas fa-caret-down"></i>Bearbeiten');c=b.getElementsByTagName("ul")[0];a.appendChild(b);c.appendChild(this.createMenuItem('<i class="fas fa-cut"></i>Ausschneiden',this.onCutFeatureClick.bind(this)));c.appendChild(this.createMenuItem('<i class="fas fa-arrows-alt"></i>Verschieben',this.onModifyFeaturesClick.bind(this)));c.appendChild(this.createMenuItem('<i class="fas fa-eraser"></i>L\u00f6schen', this.onDrawLineClick.bind(this)));c.appendChild(this.createMenuItem('<i class="fas fa-vector-square"></i>Polygone',this.onDrawPolygonClick.bind(this)));b=this.createMenu('<i class="fas fa-caret-down"></i>Bearbeiten');c=b.getElementsByTagName("ul")[0];a.appendChild(b);c.appendChild(this.createMenuItem('<i class="fas fa-cut"></i>Ausschneiden',this.onCutFeatureClick.bind(this)));c.appendChild(this.createMenuItem('<i class="fas fa-arrows-alt"></i>Verschieben',this.onModifyFeaturesClick.bind(this)));c.appendChild(this.createMenuItem('<i class="fas fa-eraser"></i>L\u00f6schen',
this.onDeleteFeaturesClick.bind(this)));c.appendChild(this.createMenuItem('<i class="far fa-dot-circle"></i>Puffern',this.onBufferFeatureClick.bind(this)));b=this.createMenu('<i class="fas fa-caret-down"></i>Import');a.appendChild(b);b=b.getElementsByTagName("ul")[0];b.appendChild(this.createMenuItem('<i class="fas fa-file"></i>GeoJSON',this.onImportGeoJSONClick.bind(this)));b.appendChild(this.createMenuItem('<i class="fas fa-file"></i>GML',this.onImportGMLClick.bind(this)));b.appendChild(this.createMenuItem('<i class="fas fa-file"></i>Shapefile', this.onDeleteFeaturesClick.bind(this)));c.appendChild(this.createMenuItem('<i class="far fa-dot-circle"></i>Puffern',this.onBufferFeatureClick.bind(this)));b=this.createMenu('<i class="fas fa-caret-down"></i>Import');a.appendChild(b);b=b.getElementsByTagName("ul")[0];b.appendChild(this.createMenuItem('<i class="fas fa-file"></i>GeoJSON',this.onImportGeoJSONClick.bind(this)));b.appendChild(this.createMenuItem('<i class="fas fa-file"></i>GML',this.onImportGMLClick.bind(this)));b.appendChild(this.createMenuItem('<i class="fas fa-file"></i>Shapefile',
this.onImportShapefileClick.bind(this)));b=this.createMenu('<i class="fas fa-caret-down"></i>Export');a.appendChild(b);a=b.getElementsByTagName("ul")[0];a.appendChild(this.createMenuItem('<i class="fas fa-file"></i>PDF',this.onExportPDFClick.bind(this)));a.appendChild(this.createMenuItem('<i class="fas fa-file"></i>JPEG',this.onExportJPEGClick.bind(this)));a.appendChild(this.createMenuItem('<i class="fas fa-file"></i>PNG',this.onExportPNGClick.bind(this)));a.appendChild(this.createMenuItem('<i class="fas fa-file"></i>GIF', this.onImportShapefileClick.bind(this)));b.appendChild(this.createMenuItem('<i class="fas fa-file"></i>Spatialite',this.onImportSpatialiteClick.bind(this)));b.appendChild(this.createMenuItem('<i class="fas fa-file"></i>GeoPackage',this.onImportGeopackageClick.bind(this)));b=this.createMenu('<i class="fas fa-caret-down"></i>Export');a.appendChild(b);a=b.getElementsByTagName("ul")[0];a.appendChild(this.createMenuItem('<i class="fas fa-file"></i>PDF',this.onExportPDFClick.bind(this)));a.appendChild(this.createMenuItem('<i class="fas fa-file"></i>JPEG',
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.onExportJPEGClick.bind(this)));a.appendChild(this.createMenuItem('<i class="fas fa-file"></i>PNG',this.onExportPNGClick.bind(this)));a.appendChild(this.createMenuItem('<i class="fas fa-file"></i>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.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.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.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.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=<url>'")};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.onSearchDataClick=function(a){alert("TODO: data search interface")};netgis.Menu.prototype.onImportOWSClick=function(a){alert("TODO: ows import interface, try setting url parameter '?ows=<url>'")};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.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.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.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.exportPDF=this.createExportPDF();this.root.appendChild(this.exportPDF); 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.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.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.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.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:","<ul><li>World Geodetic System 1984 (EPSG:4326)</li><li>ETRS89 / UTM zone 32N (EPSG:25832)</li></ul>");this.createInputFile(a,"Datei ausw\u00e4hlen / ablegen:",".geojson,.json",this.onImportGeoJSONChange.bind(this));this.createSpace(a);this.createButton(a,"<i class='fas fa-check'></i>Importieren",this.onImportGeoJSONAccept.bind(this));return a}; netgis.Modal.prototype.createImportGeoJSON=function(){var a=this.createContainer("Import GeoJSON");this.createText(a,"Unterst\u00fctzte Koordinatensysteme:","<ul><li>World Geodetic System 1984 (EPSG:4326)</li><li>ETRS89 / UTM zone 32N (EPSG:25832)</li></ul>");this.createInputFile(a,"Datei ausw\u00e4hlen / ablegen:",".geojson,.json",this.onImportGeoJSONChange.bind(this));this.createSpace(a);this.createButton(a,"<i class='fas fa-check'></i>Importieren",this.onImportGeoJSONAccept.bind(this));return a};
netgis.Modal.prototype.createImportGML=function(){var a=this.createContainer("Import GML");this.createText(a,"Unterst\u00fctzte Koordinatensysteme:","<ul><li>World Geodetic System 1984 (EPSG:4326)</li><li>ETRS89 / UTM zone 32N (EPSG:25832)</li></ul>");this.createInputFile(a,"Datei ausw\u00e4hlen / ablegen:",".gml,.xml",this.onImportGMLChange.bind(this));this.createSpace(a);this.createButton(a,"<i class='fas fa-check'></i>Importieren",this.onImportGMLAccept.bind(this));return a}; netgis.Modal.prototype.createImportGML=function(){var a=this.createContainer("Import GML");this.createText(a,"Unterst\u00fctzte Koordinatensysteme:","<ul><li>World Geodetic System 1984 (EPSG:4326)</li><li>ETRS89 / UTM zone 32N (EPSG:25832)</li></ul>");this.createInputFile(a,"Datei ausw\u00e4hlen / ablegen:",".gml,.xml",this.onImportGMLChange.bind(this));this.createSpace(a);this.createButton(a,"<i class='fas fa-check'></i>Importieren",this.onImportGMLAccept.bind(this));return a};
netgis.Modal.prototype.createImportShapefile=function(){var a=this.createContainer("Import Shapefile");this.createText(a,"Unterst\u00fctzte Koordinatensysteme:","<ul><li>World Geodetic System 1984 (EPSG:4326)</li><li>ETRS89 / UTM zone 32N (EPSG:25832)</li></ul>");this.createInputFile(a,"Datei ausw\u00e4hlen / ablegen:","application/zip",this.onImportShapefileChange.bind(this));this.createSpace(a);this.createButton(a,"<i class='fas fa-check'></i>Importieren",this.onImportShapefileAccept.bind(this)); netgis.Modal.prototype.createImportShapefile=function(){var a=this.createContainer("Import Shapefile");this.createText(a,"Unterst\u00fctzte Koordinatensysteme:","<ul><li>World Geodetic System 1984 (EPSG:4326)</li><li>ETRS89 / UTM zone 32N (EPSG:25832)</li></ul>");this.createInputFile(a,"Datei ausw\u00e4hlen / ablegen:","application/zip",this.onImportShapefileChange.bind(this));this.createSpace(a);this.createButton(a,"<i class='fas fa-check'></i>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,"<i class='fas fa-check'></i>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:","<ul><li>World Geodetic System 1984 (EPSG:4326)</li><li>ETRS89 / UTM zone 32N (EPSG:25832)</li></ul>");this.createInputFile(a,"Datei ausw\u00e4hlen / ablegen:",".sqlite",this.onImportSpatialiteChange.bind(this));this.createSpace(a);this.createButton(a,"<i class='fas fa-check'></i>Importieren",this.onImportSpatialiteAccept.bind(this));return a};
netgis.Modal.prototype.createImportGeopackage=function(){var a=this.createContainer("Import GeoPackage");this.createText(a,"Unterst\u00fctzte Koordinatensysteme:","<ul><li>World Geodetic System 1984 (EPSG:4326)</li><li>ETRS89 / UTM zone 32N (EPSG:25832)</li></ul>");this.createInputFile(a,"Datei ausw\u00e4hlen / ablegen:",".gpkg",this.onImportGeopackageChange.bind(this));this.createSpace(a);this.createButton(a,"<i class='fas fa-check'></i>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,"<i class='fas fa-check'></i>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,"<i class='fas fa-check'></i>Exportieren",this.onExportJPEGAccept.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,"<i class='fas fa-check'></i>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,"<i class='fas fa-check'></i>Exportieren",this.onExportPNGAccept.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,"<i class='fas fa-check'></i>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,"<i class='fas fa-check'></i>Exportieren",this.onExportGIFAccept.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,"<i class='fas fa-check'></i>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;c<b.length;c++)b[c].classList.remove("netgis-show");a.classList.add("netgis-show")};netgis.Modal.prototype.hide=function(){this.root.classList.remove("netgis-show")}; netgis.Modal.prototype.createAddService=function(){var a=this.createContainer("Dienst hinzuf\u00fcgen");this.createInputText(a,"WMS/WFS URL:");this.createSpace(a);this.createButton(a,"<i class='fas fa-cloud-download-alt'></i>Dienst 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,"<i class='fas fa-check'></i>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<b.length;c++)b[c].classList.remove("netgis-show");a.classList.add("netgis-show")};netgis.Modal.prototype.hide=function(){this.root.classList.remove("netgis-show")};
netgis.Modal.prototype.createContainer=function(a){var b=document.createElement("section");b.className="netgis-dialog netgis-shadow";var c=document.createElement("header"),d=document.createElement("button");d.setAttribute("type","button");d.className="netgis-primary netgis-hover-primary";d.innerHTML="<h3>"+a+"</h3>";d.addEventListener("click",this.onHeaderClick.bind(this));c.appendChild(d);a=document.createElement("span");a.innerHTML="<i class='fas fa-times'></i>";d.appendChild(a);b.appendChild(c); netgis.Modal.prototype.createContainer=function(a){var b=document.createElement("section");b.className="netgis-dialog netgis-shadow";var c=document.createElement("header"),d=document.createElement("button");d.setAttribute("type","button");d.className="netgis-primary netgis-hover-primary";d.innerHTML="<h3>"+a+"</h3>";d.addEventListener("click",this.onHeaderClick.bind(this));c.appendChild(d);a=document.createElement("span");a.innerHTML="<i class='fas fa-times'></i>";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}; 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.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); netgis.Modal.prototype.createInputHidden=function(a){var b=document.createElement("tr");b.className="netgis-hidden";var c=document.createElement("td");b.appendChild(c);var d=document.createElement("input");d.setAttribute("type","hidden");c.appendChild(d);a.getElementsByClassName("netgis-modal-content")[0].getElementsByTagName("table")[0].appendChild(b);return d};
return d}; 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";c.appendChild(b);d=document.createElement("input");d.setAttribute("type","text");b.appendChild(d);e.htmlFor=d;a.getElementsByClassName("netgis-modal-content")[0].getElementsByTagName("table")[0].appendChild(c);
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}; return d};netgis.Modal.prototype.createInputSelect=function(a,b,c){c=document.createElement("tr");var 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";c.appendChild(b);d=document.createElement("select");b.appendChild(d);e.htmlFor=d;a.getElementsByClassName("netgis-modal-content")[0].getElementsByTagName("table")[0].appendChild(c);return d};
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); 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 e}; return g};
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.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.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.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);
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&&0<a.value.length?!1:!0}; 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&&0<a.value.length?!1:!0};
netgis.Modal.prototype.onImportGeoJSONAccept=function(a){a=this.importGeoJSON.getElementsByTagName("input")[0].files[0];this.client.invoke(netgis.Events.IMPORT_GEOJSON,a);this.hide()};netgis.Modal.prototype.onImportGMLShow=function(a){a=this.importGML.getElementsByTagName("input")[0];var b=this.importGML.getElementsByTagName("button")[1];a.value="";b.disabled=!0;this.show(this.importGML)}; netgis.Modal.prototype.onImportGeoJSONAccept=function(a){a=this.importGeoJSON.getElementsByTagName("input")[0].files[0];this.client.invoke(netgis.Events.IMPORT_GEOJSON,a);this.hide()};netgis.Modal.prototype.onImportGMLShow=function(a){a=this.importGML.getElementsByTagName("input")[0];var b=this.importGML.getElementsByTagName("button")[1];a.value="";b.disabled=!0;this.show(this.importGML)};
netgis.Modal.prototype.onImportGMLChange=function(a){a=this.importGML.getElementsByTagName("input")[0];this.importGML.getElementsByTagName("button")[1].disabled=a.value&&0<a.value.length?!1:!0};netgis.Modal.prototype.onImportGMLAccept=function(a){a=this.importGML.getElementsByTagName("input")[0].files[0];this.client.invoke(netgis.Events.IMPORT_GML,a);this.hide()}; netgis.Modal.prototype.onImportGMLChange=function(a){a=this.importGML.getElementsByTagName("input")[0];this.importGML.getElementsByTagName("button")[1].disabled=a.value&&0<a.value.length?!1:!0};netgis.Modal.prototype.onImportGMLAccept=function(a){a=this.importGML.getElementsByTagName("input")[0].files[0];this.client.invoke(netgis.Events.IMPORT_GML,a);this.hide()};
netgis.Modal.prototype.onImportShapefileShow=function(a){a=this.importShapefile.getElementsByTagName("input")[0];var b=this.importShapefile.getElementsByTagName("button")[1];a.value="";b.disabled=!0;this.show(this.importShapefile)};netgis.Modal.prototype.onImportShapefileChange=function(a){a=this.importShapefile.getElementsByTagName("input")[0];this.importShapefile.getElementsByTagName("button")[1].disabled=a.value&&0<a.value.length?!1:!0}; netgis.Modal.prototype.onImportShapefileShow=function(a){a=this.importShapefile.getElementsByTagName("input")[0];var b=this.importShapefile.getElementsByTagName("button")[1];a.value="";b.disabled=!0;this.show(this.importShapefile)};netgis.Modal.prototype.onImportShapefileChange=function(a){a=this.importShapefile.getElementsByTagName("input")[0];this.importShapefile.getElementsByTagName("button")[1].disabled=a.value&&0<a.value.length?!1:!0};
netgis.Modal.prototype.onImportShapefileAccept=function(a){a=this.importShapefile.getElementsByTagName("input")[0].files[0];this.client.invoke(netgis.Events.IMPORT_SHAPEFILE,a);this.hide()};netgis.Modal.prototype.onExportPDFShow=function(a){a=this.exportPDF.getElementsByTagName("input");a[0].value=this.client.map.getWidth();a[1].value=this.client.map.getHeight();a[2].value=this.client.config.export.defaultMargin;a[3].checked=!0;this.show(this.exportPDF)}; netgis.Modal.prototype.onImportShapefileAccept=function(a){a=this.importShapefile.getElementsByTagName("input")[0].files[0];this.client.invoke(netgis.Events.IMPORT_SHAPEFILE,a);this.hide()};netgis.Modal.prototype.onImportSpatialiteShow=function(a){a=this.importShapefile.getElementsByTagName("input")[0];var b=this.importShapefile.getElementsByTagName("button")[1];a.value="";b.disabled=!0;this.show(this.importSpatialite)};
netgis.Modal.prototype.onImportSpatialiteChange=function(a){a=this.importSpatialite.getElementsByTagName("input")[0];this.importSpatialite.getElementsByTagName("button")[1].disabled=a.value&&0<a.value.length?!1:!0};netgis.Modal.prototype.onImportSpatialiteAccept=function(a){a=this.importSpatialite.getElementsByTagName("input")[0].files[0];this.client.invoke(netgis.Events.IMPORT_SPATIALITE,a);this.hide()};
netgis.Modal.prototype.onImportGeopackageShow=function(a){a=this.importGeopackage.getElementsByTagName("input")[0];var b=this.importGeopackage.getElementsByTagName("button")[1];a.value="";b.disabled=!0;this.show(this.importGeopackage)};netgis.Modal.prototype.onImportGeopackageChange=function(a){a=this.importGeopackage.getElementsByTagName("input")[0];this.importGeopackage.getElementsByTagName("button")[1].disabled=a.value&&0<a.value.length?!1:!0};
netgis.Modal.prototype.onImportGeopackageAccept=function(a){a=this.importGeopackage.getElementsByTagName("input")[0].files[0];this.client.invoke(netgis.Events.IMPORT_GEOPACKAGE,a);this.hide()};netgis.Modal.prototype.onExportPDFShow=function(a){a=this.exportPDF.getElementsByTagName("input");a[0].value=this.client.map.getWidth();a[1].value=this.client.map.getHeight();a[2].value=this.client.config.export.defaultMargin;a[3].checked=!0;this.show(this.exportPDF)};
netgis.Modal.prototype.onExportJPEGShow=function(a){a=this.exportJPEG.getElementsByTagName("input");a[0].value=this.client.map.getWidth();a[1].value=this.client.map.getHeight();this.show(this.exportJPEG)};netgis.Modal.prototype.onExportPNGShow=function(a){a=this.exportPNG.getElementsByTagName("input");a[0].value=this.client.map.getWidth();a[1].value=this.client.map.getHeight();this.show(this.exportPNG)}; netgis.Modal.prototype.onExportJPEGShow=function(a){a=this.exportJPEG.getElementsByTagName("input");a[0].value=this.client.map.getWidth();a[1].value=this.client.map.getHeight();this.show(this.exportJPEG)};netgis.Modal.prototype.onExportPNGShow=function(a){a=this.exportPNG.getElementsByTagName("input");a[0].value=this.client.map.getWidth();a[1].value=this.client.map.getHeight();this.show(this.exportPNG)};
netgis.Modal.prototype.onExportGIFShow=function(a){a=this.exportGIF.getElementsByTagName("input");a[0].value=this.client.map.getWidth();a[1].value=this.client.map.getHeight();this.show(this.exportGIF)};netgis.Modal.prototype.onExportPDFAccept=function(a){a=this.exportPDF.getElementsByTagName("input");var b=Number.parseInt(a[0].value),c=Number.parseInt(a[1].value),d=Number.parseInt(a[2].value);this.client.invoke(netgis.Events.EXPORT_PDF,{resx:b,resy:c,mode:a[3].checked,margin:d});this.hide()}; netgis.Modal.prototype.onExportGIFShow=function(a){a=this.exportGIF.getElementsByTagName("input");a[0].value=this.client.map.getWidth();a[1].value=this.client.map.getHeight();this.show(this.exportGIF)};netgis.Modal.prototype.onExportPDFAccept=function(a){a=this.exportPDF.getElementsByTagName("input");var b=Number.parseInt(a[0].value),c=Number.parseInt(a[1].value),d=Number.parseInt(a[2].value);this.client.invoke(netgis.Events.EXPORT_PDF,{resx:b,resy:c,mode:a[3].checked,margin:d});this.hide()};
netgis.Modal.prototype.onExportJPEGAccept=function(a){var b=this.exportJPEG.getElementsByTagName("input");a=Number.parseInt(b[0].value);b=Number.parseInt(b[1].value);this.client.invoke(netgis.Events.EXPORT_JPEG,{resx:a,resy:b});this.hide()};netgis.Modal.prototype.onExportPNGAccept=function(a){var b=this.exportPNG.getElementsByTagName("input");a=Number.parseInt(b[0].value);b=Number.parseInt(b[1].value);this.client.invoke(netgis.Events.EXPORT_PNG,{resx:a,resy:b});this.hide()}; netgis.Modal.prototype.onExportJPEGAccept=function(a){var b=this.exportJPEG.getElementsByTagName("input");a=Number.parseInt(b[0].value);b=Number.parseInt(b[1].value);this.client.invoke(netgis.Events.EXPORT_JPEG,{resx:a,resy:b});this.hide()};netgis.Modal.prototype.onExportPNGAccept=function(a){var b=this.exportPNG.getElementsByTagName("input");a=Number.parseInt(b[0].value);b=Number.parseInt(b[1].value);this.client.invoke(netgis.Events.EXPORT_PNG,{resx:a,resy:b});this.hide()};
netgis.Modal.prototype.onExportGIFAccept=function(a){var b=this.exportGIF.getElementsByTagName("input");a=Number.parseInt(b[0].value);b=Number.parseInt(b[1].value);this.client.invoke(netgis.Events.EXPORT_GIF,{resx:a,resy:b});this.hide()};netgis=netgis||{};netgis.Modes=Object.freeze({VIEW:"VIEW",PANNING:"PANNING",ZOOMING_IN:"ZOOMING_IN",ZOOMING_OUT:"ZOOMING_OUT",DRAW_POINTS:"DRAW_POINTS",DRAW_LINES:"DRAW_LINES",DRAW_POLYGONS:"DRAW_POLYGONS",CUT_FEATURE_BEGIN:"CUT_FEATURE_BEGIN",CUT_FEATURE_DRAW:"CUT_FEATURE_DRAW",MODIFY_FEATURES:"MODIFY_FEATURES",DELETE_FEATURES:"DELETE_FEATURES",BUFFER_FEATURE_BEGIN:"BUFFER_FEATURE_BEGIN",BUFFER_FEATURE_EDIT:"BUFFER_FEATURE_EDIT",SEARCH_PLACE:"SEARCH_PLACE",SEARCH_PARCEL:"SEARCH_PARCEL"});netgis=netgis||{}; netgis.Modal.prototype.onExportGIFAccept=function(a){var b=this.exportGIF.getElementsByTagName("input");a=Number.parseInt(b[0].value);b=Number.parseInt(b[1].value);this.client.invoke(netgis.Events.EXPORT_GIF,{resx:a,resy:b});this.hide()};netgis.Modal.prototype.onAddServiceShow=function(a){this.show(this.addService);a=this.addService.getElementsByTagName("tr");for(var b=3;b<a.length;b++)a[b].classList.add("netgis-hide")};
netgis.Modal.prototype.onAddServiceLoad=function(a){a=this.addService.getElementsByTagName("input")[0].value;var b=a.indexOf("?");-1<b&&(a=a.substr(0,b));netgis.util.request(a+"?request=GetCapabilities",this.onAddServiceCapsResponse.bind(this));console.info("Add Service Load:",a)};
netgis.Modal.prototype.onAddServiceCapsResponse=function(a){var b=(new DOMParser).parseFromString(a,"text/xml").documentElement;a=this.addService.getElementsByTagName("tr");var c=a[5],d=this.addService.getElementsByTagName("input")[1];a=this.addService.getElementsByTagName("select");var e=a[0];a=a[1];for(var f=e.options.length-1;0<=f;f--)e.options.remove(f);for(f=a.options.length-1;0<=f;f--)a.options.remove(f);switch(b.nodeName){case "WMS_Capabilities":d.value="wms";b.getAttribute("version");d=b.getElementsByTagName("Service")[0];
d=d.getElementsByTagName("Title")[0].textContent;c.children[1].innerHTML=d;f=b.getElementsByTagName("Layer");var g=[];for(d=0;d<f.length;d++){c=f[d];var h=c.getElementsByTagName("Name")[0].textContent,k=c.getElementsByTagName("Title")[0].textContent;g.push({name:h,title:k});c=document.createElement("option");c.text=k;c.value=h;e.options.add(c)}b=b.getElementsByTagName("GetMap")[0].getElementsByTagName("Format");e=[];for(d=0;d<b.length;d++)c=b[d],f=c.textContent,e.push(f),c=document.createElement("option"),
c.text=f,c.value=f,a.options.add(c);break;case "WFS_Capabilities":case "wfs:WFS_Capabilities":d.value="wfs";b.getAttribute("version");d=b.getElementsByTagName("ows:ServiceIdentification")[0];d=d.getElementsByTagName("ows:Title")[0].textContent;c.children[1].innerHTML=d;f=b.getElementsByTagName("FeatureType");g=[];for(d=0;d<f.length;d++)c=f[d],h=c.getElementsByTagName("Name")[0].textContent,k=c.getElementsByTagName("Title")[0].textContent,g.push({name:h,title:k}),c=document.createElement("option"),
c.text=k,c.value=h,e.options.add(c);b=b.getElementsByTagName("ows:Operation");e=null;for(c=0;c<b.length;c++)if("GetFeature"===b[c].getAttribute("name")){e=b[c];break}if(e)for(b=e.getElementsByTagName("ows:Parameter"),e=0;e<b.length;e++)if(c=b[e],"outputFormat"===c.getAttribute("name")){b=c.getElementsByTagName("ows:Value");for(d=0;d<b.length;d++)c=b[d],f=c.textContent,c=document.createElement("option"),c.text=f,c.value=f,a.options.add(c);break}a.value="application/json"}a=this.addService.getElementsByTagName("tr");
for(b=3;b<a.length;b++)a[b].classList.remove("netgis-hide")};
netgis.Modal.prototype.onAddServiceAccept=function(a){var b=this.addService.getElementsByTagName("input"),c=this.addService.getElementsByTagName("select");a=b[0].value;b=b[1].value;var d=c[0];c=c[1];d=d.options.item(d.options.selectedIndex);c=c.options.item(c.options.selectedIndex);a={id:this.addServiceID++,url:a,title:d.text,name:d.value,format:c.value};switch(b){case "wms":this.client.invoke(netgis.Events.ADD_SERVICE_WMS,a);break;case "wfs":this.client.invoke(netgis.Events.ADD_SERVICE_WFS,a)}this.hide()};netgis=netgis||{};netgis.Modes=Object.freeze({VIEW:"VIEW",PANNING:"PANNING",ZOOMING_IN:"ZOOMING_IN",ZOOMING_OUT:"ZOOMING_OUT",DRAW_POINTS:"DRAW_POINTS",DRAW_LINES:"DRAW_LINES",DRAW_POLYGONS:"DRAW_POLYGONS",CUT_FEATURE_BEGIN:"CUT_FEATURE_BEGIN",CUT_FEATURE_DRAW:"CUT_FEATURE_DRAW",MODIFY_FEATURES:"MODIFY_FEATURES",DELETE_FEATURES:"DELETE_FEATURES",BUFFER_FEATURE_BEGIN:"BUFFER_FEATURE_BEGIN",BUFFER_FEATURE_EDIT:"BUFFER_FEATURE_EDIT",SEARCH_PLACE:"SEARCH_PLACE",SEARCH_PARCEL:"SEARCH_PARCEL"});netgis=netgis||{};
netgis.OWS=function(){return{read:function(a,b){var c={layers:[],folders:[]};netgis.util.isDefined(a.properties)&&(c.bbox=a.properties.bbox);a=a.features;for(var d=0;d<a.length;d++){var e=a[d];if("Feature"===e.type){var f=e.properties;f=f.folder;var g=!1;for(e=0;e<c.folders.length;e++)if(c.folders[e].id===f){g=!0;break}if(!g){e=f.split("/");f=[];for(g=0;g<e.length;g++){var h=e[g];0<h.length&&f.push(h)}var k=-1;for(g=0;g<f.length;g++){h=f[g];var l="/"+f.slice(0,g+1).join("/"),m=!1;for(e=0;e<c.folders.length;e++)if(c.folders[e].path=== netgis.OWS=function(){return{read:function(a,b){var c={layers:[],folders:[]};netgis.util.isDefined(a.properties)&&(c.bbox=a.properties.bbox);a=a.features;for(var d=0;d<a.length;d++){var e=a[d];if("Feature"===e.type){var f=e.properties;f=f.folder;var g=!1;for(e=0;e<c.folders.length;e++)if(c.folders[e].id===f){g=!0;break}if(!g){e=f.split("/");f=[];for(g=0;g<e.length;g++){var h=e[g];0<h.length&&f.push(h)}var k=-1;for(g=0;g<f.length;g++){h=f[g];var l="/"+f.slice(0,g+1).join("/"),m=!1;for(e=0;e<c.folders.length;e++)if(c.folders[e].path===
l){k=e;m=!0;break}m||(e=c.folders.length,c.folders.push({title:h,parent:k,path:l}),k=e)}}}}for(d=0;d<a.length;d++)if(e=a[d],"Feature"===e.type){f=e.properties;g=-1;for(e=0;e<c.folders.length;e++)if(c.folders[e].path===f.folder){g=e;break}e=f.offerings;for(h=0;h<e.length;h++)switch(k=e[h],l=k.operations,k.code){case "http://www.opengis.net/spec/owc-geojson/1.0/req/wms":c.layers.push({folder:g,type:netgis.LayerTypes.WMS,url:l[0].href,title:f.title,attribution:f.rights,active:f.active});break;case "http://www.opengis.net/spec/owc-geojson/1.0/req/xyz":k= l){k=e;m=!0;break}m||(e=c.folders.length,c.folders.push({title:h,parent:k,path:l}),k=e)}}}}for(d=0;d<a.length;d++)if(e=a[d],"Feature"===e.type){f=e.properties;g=-1;for(e=0;e<c.folders.length;e++)if(c.folders[e].path===f.folder){g=e;break}e=f.offerings;for(h=0;h<e.length;h++)switch(k=e[h],l=k.operations,k.code){case "http://www.opengis.net/spec/owc-geojson/1.0/req/wms":c.layers.push({folder:g,type:netgis.LayerTypes.WMS,url:l[0].href,title:f.title,attribution:f.rights,active:f.active});break;case "http://www.opengis.net/spec/owc-geojson/1.0/req/xyz":k=
l[0];c.layers.push({folder:g,type:netgis.LayerTypes.XYZ,url:k.href,title:f.title,attribution:f.rights,active:f.active});break;case "http://www.opengis.net/spec/owc-geojson/1.0/req/osm":k=l[0],c.layers.push({folder:g,type:netgis.LayerTypes.XYZ,url:k.href,title:f.title,attribution:f.rights,active:f.active})}}b.invoke(netgis.Events.CONTEXT_UPDATE,c)}}}();netgis=netgis||{};netgis.SearchParcel=function(){this.client=null}; l[0];c.layers.push({folder:g,type:netgis.LayerTypes.XYZ,url:k.href,title:f.title,attribution:f.rights,active:f.active});break;case "http://www.opengis.net/spec/owc-geojson/1.0/req/osm":k=l[0],c.layers.push({folder:g,type:netgis.LayerTypes.XYZ,url:k.href,title:f.title,attribution:f.rights,active:f.active})}}b.invoke(netgis.Events.CONTEXT_UPDATE,c)}}}();netgis=netgis||{};netgis.SearchParcel=function(){this.client=null};
@ -163,29 +217,37 @@ netgis.SearchPlace.prototype.request=function(a){if(this.client.config.search&&t
netgis.SearchPlace.prototype.onSearchPlaceRequest=function(a){var b=a.query,c=this;this.lastRequest&&this.lastRequest.abort();this.timeout&&window.clearTimeout(this.timeout);this.timeout=window.setTimeout(function(){c.request(b)},300)};netgis.SearchPlace.prototype.onSearchPlaceResponse=function(a){a=JSON.parse(a);this.client.invoke(netgis.Events.SEARCH_PLACE_RESPONSE,a)};netgis=netgis||{}; netgis.SearchPlace.prototype.onSearchPlaceRequest=function(a){var b=a.query,c=this;this.lastRequest&&this.lastRequest.abort();this.timeout&&window.clearTimeout(this.timeout);this.timeout=window.setTimeout(function(){c.request(b)},300)};netgis.SearchPlace.prototype.onSearchPlaceResponse=function(a){a=JSON.parse(a);this.client.invoke(netgis.Events.SEARCH_PLACE_RESPONSE,a)};netgis=netgis||{};
netgis.SLD=function(){return{read:function(a,b){var c={};a=(new DOMParser).parseFromString(a,"text/xml").getElementsByTagName("NamedLayer");for(var d=0;d<a.length;d++){var e=a[d],f=e.getElementsByTagName("se:Name")[0].innerHTML;console.info("Layer:",f);e=e.getElementsByTagName("se:FeatureTypeStyle");for(f=0;f<e.length;f++)for(var g=e[f].getElementsByTagName("se:Rule"),h=0;h<g.length;h++){var k=g[h],l=k.getElementsByTagName("se:Name")[0].innerHTML;console.info("Rule:",l);l=k.getElementsByTagName("se:PolygonSymbolizer")[0];k= netgis.SLD=function(){return{read:function(a,b){var c={};a=(new DOMParser).parseFromString(a,"text/xml").getElementsByTagName("NamedLayer");for(var d=0;d<a.length;d++){var e=a[d],f=e.getElementsByTagName("se:Name")[0].innerHTML;console.info("Layer:",f);e=e.getElementsByTagName("se:FeatureTypeStyle");for(f=0;f<e.length;f++)for(var g=e[f].getElementsByTagName("se:Rule"),h=0;h<g.length;h++){var k=g[h],l=k.getElementsByTagName("se:Name")[0].innerHTML;console.info("Rule:",l);l=k.getElementsByTagName("se:PolygonSymbolizer")[0];k=
l.getElementsByTagName("se:Fill")[0];l=l.getElementsByTagName("se:Stroke")[0];c.polygon={fill:k.querySelector("[name='fill']").innerHTML,stroke:l.querySelector("[name='stroke']").innerHTML,strokeWidth:Number.parseFloat(l.querySelector("[name='stroke-width']").innerHTML)}}}console.info("SLD:",c);b.invoke(netgis.Events.MAP_UPDATE_STYLE,c);return c}}}();netgis=netgis||{};netgis.Toolbar=function(){this.client=null;this.toolbars={};this.searchValue=""}; l.getElementsByTagName("se:Fill")[0];l=l.getElementsByTagName("se:Stroke")[0];c.polygon={fill:k.querySelector("[name='fill']").innerHTML,stroke:l.querySelector("[name='stroke']").innerHTML,strokeWidth:Number.parseFloat(l.querySelector("[name='stroke-width']").innerHTML)}}}console.info("SLD:",c);b.invoke(netgis.Events.MAP_UPDATE_STYLE,c);return c}}}();netgis=netgis||{};netgis.Toolbar=function(){this.client=null;this.toolbars={};this.searchValue=""};
netgis.Toolbar.prototype.load=function(){var a=this.client.config;this.root=document.createElement("section");this.root.className="netgis-toolbars";if(this.client.editable){this.toolbars[netgis.Modes.DRAW_POINTS]=this.createToolbar();this.append(this.toolbars[netgis.Modes.DRAW_POINTS],this.createToolbarButton('<i class="fas fa-times"></i><span>Punkte zeichnen:</span>',this.onToolbarClose.bind(this)));this.append(this.toolbars[netgis.Modes.DRAW_POINTS],this.createToolbarCheckbox("Einrasten",this.onSnapChange.bind(this))); 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.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('<i class="fas fa-times"></i><span>Linien zeichnen:</span>',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.createToolbarButton('<i class="fas fa-times"></i><span>Punkte zeichnen:</span>',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.createToolbar();this.append(this.toolbars[netgis.Modes.DRAW_POLYGONS],this.createToolbarButton('<i class="fas fa-times"></i><span>Polygone zeichnen:</span>',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.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('<i class="fas fa-times"></i><span>Linien zeichnen:</span>',this.onToolbarClose.bind(this)));this.append(this.toolbars[netgis.Modes.DRAW_LINES],this.createToolbarCheckbox("Einrasten",
this.createToolbarButton('<i class="fas fa-times"></i><span>Feature zum Ausschneiden w\u00e4hlen:</span>',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('<i class="fas fa-times"></i><span>Fl\u00e4che zum Ausschneiden zeichnen:</span>',this.onToolbarClose.bind(this)));this.root.appendChild(this.toolbars[netgis.Modes.CUT_FEATURE_DRAW]); 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.MODIFY_FEATURES]=this.createToolbar();this.append(this.toolbars[netgis.Modes.MODIFY_FEATURES],this.createToolbarButton('<i class="fas fa-times"></i><span>Features verschieben:</span>',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('<i class="fas fa-times"></i><span>Features l\u00f6schen:</span>', this.toolbars[netgis.Modes.DRAW_POLYGONS]=this.createToolbar();this.append(this.toolbars[netgis.Modes.DRAW_POLYGONS],this.createToolbarButton('<i class="fas fa-times"></i><span>Polygone zeichnen:</span>',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.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('<i class="fas fa-times"></i><span>Feature zum Puffern w\u00e4hlen:</span>',this.onToolbarClose.bind(this)));this.root.appendChild(this.toolbars[netgis.Modes.BUFFER_FEATURE_BEGIN]);this.toolbars[netgis.Modes.BUFFER_FEATURE_EDIT]=this.createToolbar(); this.toolbars[netgis.Modes.CUT_FEATURE_BEGIN]=this.createToolbar();this.append(this.toolbars[netgis.Modes.CUT_FEATURE_BEGIN],this.createToolbarButton('<i class="fas fa-times"></i><span>Feature zum Ausschneiden w\u00e4hlen:</span>',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('<i class="fas fa-times"></i><span>Fl\u00e4che zum Ausschneiden zeichnen:</span>',
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('<i class="fas fa-times"></i><span>Feature puffern:</span>',this.onBufferCancel.bind(this)));this.append(this.toolbars[netgis.Modes.BUFFER_FEATURE_EDIT],this.createToolbarInput("Radius in Meter:", 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('<i class="fas fa-times"></i><span>Features verschieben:</span>',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],
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('<i class="fas fa-check"></i><span>OK</span>',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.createToolbarButton('<i class="fas fa-times"></i><span>Features l\u00f6schen:</span>',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('<i class="fas fa-times"></i><span>Feature zum Puffern w\u00e4hlen:</span>',this.onToolbarClose.bind(this)));this.root.appendChild(this.toolbars[netgis.Modes.BUFFER_FEATURE_BEGIN]);
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('<i class="fas fa-times"></i><span>Suche:</span>',this.onToolbarClose.bind(this)));a=this.createToolbarInputText("Adresse...","",null);a.style.position="relative";this.searchInput=a.getElementsByTagName("input")[0];this.searchInput.addEventListener("keyup", this.toolbars[netgis.Modes.BUFFER_FEATURE_EDIT]=this.createToolbar();this.append(this.toolbars[netgis.Modes.BUFFER_FEATURE_EDIT],this.createToolbarButton('<i class="fas fa-times"></i><span>Feature puffern:</span>',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.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('<i class="fas fa-undo"></i>', this.append(this.toolbars[netgis.Modes.BUFFER_FEATURE_EDIT],this.createToolbarButton('<i class="fas fa-check"></i><span>OK</span>',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.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}; this.createToolbar();this.append(this.toolbars[netgis.Modes.SEARCH_PLACE],this.createToolbarButton('<i class="fas fa-times"></i><span>Suche:</span>',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",
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}; 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('<i class="fas fa-undo"></i>',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.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.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.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.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();break;case netgis.Modes.DRAW_POINTS:case netgis.Modes.DRAW_LINES:this.toolbars[netgis.Modes.DRAW_POINTS].getElementsByTagName("input")[1].checked&&
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<a.length&&this.client.invoke(netgis.Events.SEARCH_PLACE_REQUEST,{query:a}))};netgis.Toolbar.prototype.searchClear=function(){this.searchInput.value="";this.searchList.innerHTML=""}; this.client.invoke(netgis.Events.DRAW_BUFFER_ON,null)}};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<a.length&&this.client.invoke(netgis.Events.SEARCH_PLACE_REQUEST,{query:a}))};netgis.Toolbar.prototype.searchClear=function(){this.searchInput.value="";this.searchList.innerHTML=""};
netgis.Toolbar.prototype.searchSelectFirst=function(){var a=this.searchList.getElementsByTagName("button");if(0<a.length)this.onSearchItemClick({target:a[0]})};netgis.Toolbar.prototype.onSearchKeyUp=function(a){var b=a.target;switch(a.keyCode){case 13:this.searchSelectFirst();this.searchList.classList.add("netgis-hide");break;case 27:this.searchClear();break;default:this.searchRequest(b.value)}};netgis.Toolbar.prototype.onSearchChange=function(a){this.searchRequest(a.target.value)}; netgis.Toolbar.prototype.searchSelectFirst=function(){var a=this.searchList.getElementsByTagName("button");if(0<a.length)this.onSearchItemClick({target:a[0]})};netgis.Toolbar.prototype.onSearchKeyUp=function(a){var b=a.target;switch(a.keyCode){case 13:this.searchSelectFirst();this.searchList.classList.add("netgis-hide");break;case 27:this.searchClear();break;default:this.searchRequest(b.value)}};netgis.Toolbar.prototype.onSearchChange=function(a){this.searchRequest(a.target.value)};
netgis.Toolbar.prototype.onSearchClear=function(a){this.searchClear();this.searchInput.focus()};netgis.Toolbar.prototype.onSearchFocus=function(a){this.searchList.classList.remove("netgis-hide")};netgis.Toolbar.prototype.onSearchBlur=function(a){this.searchList.classList.add("netgis-hide")}; netgis.Toolbar.prototype.onSearchClear=function(a){this.searchClear();this.searchInput.focus()};netgis.Toolbar.prototype.onSearchFocus=function(a){this.searchList.classList.remove("netgis-hide")};netgis.Toolbar.prototype.onSearchBlur=function(a){this.searchList.classList.add("netgis-hide")};
netgis.Toolbar.prototype.onSearchPlaceResponse=function(a){this.searchList.innerHTML="";a=a.geonames;for(var b=0;b<a.length;b++){var c=a[b],d=document.createElement("li");d.className="netgis-hover-light";var e=document.createElement("button");e.setAttribute("type","button");e.innerHTML=c.title;e.dataset.title=c.title;e.dataset.minx=c.minx;e.dataset.miny=c.miny;e.dataset.maxx=c.maxx;e.dataset.maxy=c.maxy;e.addEventListener("mousedown",this.onSearchItemClick.bind(this));d.appendChild(e);this.searchList.appendChild(d)}}; netgis.Toolbar.prototype.onSearchPlaceResponse=function(a){this.searchList.innerHTML="";a=a.geonames;for(var b=0;b<a.length;b++){var c=a[b],d=document.createElement("li");d.className="netgis-hover-light";var e=document.createElement("button");e.setAttribute("type","button");e.innerHTML=c.title;e.dataset.title=c.title;e.dataset.minx=c.minx;e.dataset.miny=c.miny;e.dataset.maxx=c.maxx;e.dataset.maxy=c.maxy;e.addEventListener("mousedown",this.onSearchItemClick.bind(this));d.appendChild(e);this.searchList.appendChild(d)}};
netgis.Toolbar.prototype.onSearchItemClick=function(a){var b=a.target;a=b.dataset.title;var c=Number.parseFloat(b.dataset.minx),d=Number.parseFloat(b.dataset.miny),e=Number.parseFloat(b.dataset.maxx);b=Number.parseFloat(b.dataset.maxy);this.client.invoke(netgis.Events.MAP_SET_EXTENT,{minx:c,miny:d,maxx:e,maxy:b});this.searchValue=a}; netgis.Toolbar.prototype.onSearchItemClick=function(a){var b=a.target;a=b.dataset.title;var c=Number.parseFloat(b.dataset.minx),d=Number.parseFloat(b.dataset.miny),e=Number.parseFloat(b.dataset.maxx);b=Number.parseFloat(b.dataset.maxy);this.client.invoke(netgis.Events.MAP_SET_EXTENT,{minx:c,miny:d,maxx:e,maxy:b});this.searchValue=a};
netgis.Toolbar.prototype.updateBuffer=function(){var a=this.toolbars[netgis.Modes.BUFFER_FEATURE_EDIT].getElementsByTagName("input"),b=Number.parseFloat(a[0].value);a=Number.parseInt(a[1].value);this.client.invoke(netgis.Events.BUFFER_CHANGE,{radius:b,segments:a})};netgis.Toolbar.prototype.onBufferChange=function(a){this.updateBuffer()};netgis.Toolbar.prototype.onBufferKeyUp=function(a){this.updateBuffer()}; netgis.Toolbar.prototype.updateBuffer=function(){var a=this.toolbars[netgis.Modes.BUFFER_FEATURE_EDIT].getElementsByTagName("input"),b=Number.parseFloat(a[0].value);a=Number.parseInt(a[1].value);this.client.invoke(netgis.Events.BUFFER_CHANGE,{radius:b,segments:a})};netgis.Toolbar.prototype.onBufferChange=function(a){this.updateBuffer()};netgis.Toolbar.prototype.onBufferKeyUp=function(a){this.updateBuffer()};
netgis.Toolbar.prototype.onBufferAccept=function(a){this.client.invoke(netgis.Events.BUFFER_ACCEPT,null);this.client.invoke(netgis.Events.SET_MODE,netgis.Modes.VIEW)};netgis.Toolbar.prototype.onBufferCancel=function(a){this.client.invoke(netgis.Events.BUFFER_CANCEL,null);this.client.invoke(netgis.Events.SET_MODE,netgis.Modes.VIEW)}; netgis.Toolbar.prototype.onBufferAccept=function(a){this.client.invoke(netgis.Events.BUFFER_ACCEPT,null);this.client.invoke(netgis.Events.SET_MODE,netgis.Modes.VIEW)};netgis.Toolbar.prototype.onBufferCancel=function(a){this.client.invoke(netgis.Events.BUFFER_CANCEL,null);this.client.invoke(netgis.Events.SET_MODE,netgis.Modes.VIEW)};
netgis.Toolbar.prototype.onSnapChange=function(a){a=a.target.checked;this.toolbars[netgis.Modes.DRAW_POINTS].getElementsByTagName("input")[0].checked=a;this.toolbars[netgis.Modes.DRAW_LINES].getElementsByTagName("input")[0].checked=a;this.toolbars[netgis.Modes.DRAW_POLYGONS].getElementsByTagName("input")[0].checked=a;this.client.invoke(a?netgis.Events.SNAP_ON:netgis.Events.SNAP_OFF,null)};netgis=netgis||{}; netgis.Toolbar.prototype.onSnapChange=function(a){a=a.target.checked;this.toolbars[netgis.Modes.DRAW_POINTS].getElementsByTagName("input")[0].checked=a;this.toolbars[netgis.Modes.DRAW_LINES].getElementsByTagName("input")[0].checked=a;this.toolbars[netgis.Modes.DRAW_POLYGONS].getElementsByTagName("input")[0].checked=a;this.client.invoke(a?netgis.Events.SNAP_ON:netgis.Events.SNAP_OFF,null)};
netgis.Toolbar.prototype.onTracingChange=function(a){a=a.target.checked;var b=this.toolbars[netgis.Modes.DRAW_POLYGONS].getElementsByTagName("input")[0],c=b.checked;a&&!c&&(b.checked=a,this.client.invoke(netgis.Events.SNAP_ON,null));this.client.invoke(a?netgis.Events.TRACING_ON:netgis.Events.TRACING_OFF,null)};
netgis.Toolbar.prototype.onDrawBufferChange=function(a){a=a.target.checked;this.toolbars[netgis.Modes.DRAW_POINTS].getElementsByTagName("input")[1].checked=a;this.toolbars[netgis.Modes.DRAW_LINES].getElementsByTagName("input")[1].checked=a;this.client.invoke(a?netgis.Events.DRAW_BUFFER_ON:netgis.Events.DRAW_BUFFER_OFF,null);this.showDrawBufferOptions(a)};
netgis.Toolbar.prototype.onDrawBufferRadiusChange=function(a){a=a.target;var b=Number.parseFloat(a.value);this.client.invoke(netgis.Events.DRAW_BUFFER_RADIUS_CHANGE,b);var c=this.toolbars[netgis.Modes.DRAW_POINTS].getElementsByTagName("input")[2];a!==c&&(c.value=b);c=this.toolbars[netgis.Modes.DRAW_LINES].getElementsByTagName("input")[2];a!==c&&(c.value=b)};
netgis.Toolbar.prototype.onDrawBufferSegmentsChange=function(a){a=a.target;var b=Number.parseInt(a.value);this.client.invoke(netgis.Events.DRAW_BUFFER_SEGMENTS_CHANGE,b);var c=this.toolbars[netgis.Modes.DRAW_POINTS].getElementsByTagName("input")[3];a!==c&&(c.value=b);c=this.toolbars[netgis.Modes.DRAW_LINES].getElementsByTagName("input")[3];a!==c&&(c.value=b)};
netgis.Toolbar.prototype.showDrawBufferOptions=function(a){var b=this.toolbars[netgis.Modes.DRAW_POINTS].children[0].children,c=this.toolbars[netgis.Modes.DRAW_LINES].children[0].children;a?(b[3].classList.remove("netgis-hide"),b[4].classList.remove("netgis-hide"),c[3].classList.remove("netgis-hide"),c[4].classList.remove("netgis-hide")):(b[3].classList.add("netgis-hide"),b[4].classList.add("netgis-hide"),c[3].classList.add("netgis-hide"),c[4].classList.add("netgis-hide"))};netgis=netgis||{};
netgis.util=function(){var a=function(a,c){for(var b in a)a.hasOwnProperty(b)&&c(b,a[b])};return{isDefined:function(a){return"undefined"!==typeof a},isString:function(a){return"string"===typeof a||a instanceof String},replace:function(a,c,d){return a.replace(new RegExp(c,"g"),d)},foreach:a,template:function(b,c){a(c,function(a,c){b=b.replace(new RegExp("{"+a+"}","g"),c)});return b},newlines:function(a){return a.replace(/\n/g,"<br />")},create:function(a){var b=document.createElement("tbody");b.innerHTML= netgis.util=function(){var a=function(a,c){for(var b in a)a.hasOwnProperty(b)&&c(b,a[b])};return{isDefined:function(a){return"undefined"!==typeof a},isString:function(a){return"string"===typeof a||a instanceof String},replace:function(a,c,d){return a.replace(new RegExp(c,"g"),d)},foreach:a,template:function(b,c){a(c,function(a,c){b=b.replace(new RegExp("{"+a+"}","g"),c)});return b},newlines:function(a){return a.replace(/\n/g,"<br />")},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<c;)a="0"+a;return a},merge:function(a,c){return Object.assign(a,c)}}}(); 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<c;)a="0"+a;return a},merge:function(a,c){return Object.assign(a,c)},getTimeStamp:function(){var a=new Date,c=a.getDate()+"."+(a.getMonth()+1)+"."+a.getFullYear();return c+=" "+a.getHours()+
":"+a.getMinutes()},formatArea:function(a,c){var b=1E4<a;a=b?c?Math.round(a/1E6*1E3)/1E3:Math.round(a/1E6):c?Math.round(100*a)/100:Math.round(a);0===a&&(b=!1);return a+(b?" qkm":" qm")}}}();

@ -191,6 +191,7 @@ netgis.Client.prototype.load = function()
if ( this.output.value && this.output.value.length > 0 ) if ( this.output.value && this.output.value.length > 0 )
{ {
//console.info( "INPUT:", this.output.value );
var json = JSON.parse( this.output.value ); var json = JSON.parse( this.output.value );
this.invoke( netgis.Events.EDIT_FEATURES_LOADED, json ); this.invoke( netgis.Events.EDIT_FEATURES_LOADED, json );
} }
@ -288,6 +289,7 @@ netgis.Client.prototype.onHtmlResponse = function( data )
netgis.Client.prototype.onEditFeaturesChange = function( e ) netgis.Client.prototype.onEditFeaturesChange = function( e )
{ {
var geojson = JSON.stringify( e ); var geojson = JSON.stringify( e );
//console.info( "OUTPUT:", geojson );
this.output.value = geojson; this.output.value = geojson;
}; };

@ -40,18 +40,27 @@ netgis.Events = Object.freeze
BUFFER_CHANGE: "BUFFER_CHANGE", BUFFER_CHANGE: "BUFFER_CHANGE",
BUFFER_ACCEPT: "BUFFER_ACCEPT", BUFFER_ACCEPT: "BUFFER_ACCEPT",
BUFFER_CANCEL: "BUFFER_CANCEL", 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_ON: "SNAP_ON",
SNAP_OFF: "SNAP_OFF", SNAP_OFF: "SNAP_OFF",
TRACING_ON: "TRACING_ON",
TRACING_OFF: "TRACING_OFF",
IMPORT_SHAPEFILE_SHOW: "IMPORT_SHAPEFILE_SHOW", IMPORT_SHAPEFILE_SHOW: "IMPORT_SHAPEFILE_SHOW",
IMPORT_GEOJSON_SHOW: "IMPORT_GEOJSON_SHOW", IMPORT_GEOJSON_SHOW: "IMPORT_GEOJSON_SHOW",
IMPORT_GML_SHOW: "IMPORT_GML_SHOW", IMPORT_GML_SHOW: "IMPORT_GML_SHOW",
IMPORT_SPATIALITE_SHOW: "IMPORT_SPATIALITE_SHOW",
IMPORT_GEOPACKAGE_SHOW: "IMPORT_GEOPACKAGE_SHOW",
IMPORT_SHAPEFILE: "IMPORT_SHAPEFILE", IMPORT_SHAPEFILE: "IMPORT_SHAPEFILE",
IMPORT_GEOJSON: "IMPORT_GEOJSON", IMPORT_GEOJSON: "IMPORT_GEOJSON",
IMPORT_GML: "IMPORT_GML", IMPORT_GML: "IMPORT_GML",
IMPORT_WKT: "IMPORT_WKT", IMPORT_WKT: "IMPORT_WKT",
IMPORT_SPATIALITE: "IMPORT_SPATIALITE",
IMPORT_GEOPACKAGE: "IMPORT_GEOPACKAGE",
EXPORT_PDF_SHOW: "EXPORT_PDF_SHOW", EXPORT_PDF_SHOW: "EXPORT_PDF_SHOW",
EXPORT_JPEG_SHOW: "EXPORT_JPEG_SHOW", EXPORT_JPEG_SHOW: "EXPORT_JPEG_SHOW",
@ -63,6 +72,10 @@ netgis.Events = Object.freeze
EXPORT_PNG: "EXPORT_PNG", EXPORT_PNG: "EXPORT_PNG",
EXPORT_GIF: "EXPORT_GIF", EXPORT_GIF: "EXPORT_GIF",
EXPORT_BEGIN: "EXPORT_BEGIN", 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"
} }
); );

@ -157,3 +157,27 @@
{ {
opacity: 0.5; 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;
}

@ -24,20 +24,55 @@ netgis.LayerTree.prototype.load = function()
this.list.className = "root"; this.list.className = "root";
this.root.appendChild( this.list ); this.root.appendChild( this.list );
this.initDefaultFolders();
this.tools = document.createElement( "div" );
this.tools.className = "netgis-layer-tools";
this.tools.innerHTML = "<hr/>";
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 = "<i class='fas fa-plus' style='color: #000'></i> Dienst hinzufügen";
this.buttonAddService.innerHTML = "<i class='fas fa-folder-plus'></i> Dienst hinzufügen";
//this.buttonAddService.innerHTML = "<i class='fas fa-cloud-upload-alt'></i> Dienst hinzufügen";
this.buttonAddService.addEventListener( "click", this.onAddServiceClick.bind( this ) );
this.tools.appendChild( this.buttonAddService );
this.client.root.appendChild( this.root ); this.client.root.appendChild( this.root );
this.client.on( netgis.Events.CONTEXT_UPDATE, this.onContextUpdate.bind( this ) ); 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_LIST_TOGGLE, this.onLayerListToggle.bind( this ) );
this.client.on( netgis.Events.LAYER_CREATED, this.onLayerCreated.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.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 //TODO: kind of hack to hide if parcel search open
this.client.on( netgis.Events.SET_MODE, this.onSetMode.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() netgis.LayerTree.prototype.clearAll = function()
{ {
this.list.innerHTML = ""; this.list.innerHTML = "";
this.initDefaultFolders();
}; };
netgis.LayerTree.prototype.createFolder = function( title ) netgis.LayerTree.prototype.createFolder = function( title )
@ -102,6 +137,9 @@ netgis.LayerTree.prototype.createLayer = function( id, title, checked )
var text = document.createTextNode( title ); var text = document.createTextNode( title );
label.appendChild( text ); label.appendChild( text );
var appendix = document.createElement( "span" );
label.appendChild( appendix );
return item; return item;
}; };
@ -342,21 +380,26 @@ netgis.LayerTree.prototype.onLayerCreated = function( e )
//TODO: this is a hack to get special folders working //TODO: this is a hack to get special folders working
if ( e.folder === "import" ) if ( e.folder === "import" )
{ {
if ( ! this.folderImport ) /*if ( ! this.folderImport )
{ {
this.folderImport = this.createFolder( "Importierte Ebenen" ); this.folderImport = this.createFolder( "Importierte Ebenen" );
this.list.insertBefore( this.folderImport, this.folderDraw ? this.folderDraw.nextSibling : this.list.firstChild ); this.list.insertBefore( this.folderImport, this.folderDraw ? this.folderDraw.nextSibling : this.list.firstChild );
} }
*/
this.folderImport.classList.remove( "netgis-hide" );
folder = this.folderImport; folder = this.folderImport;
} }
else if ( e.folder === "draw" ) else if ( e.folder === "draw" )
{ {
if ( ! this.folderDraw ) /*if ( ! this.folderDraw )
{ {
this.folderDraw = this.createFolder( "Zeichnung" ); this.folderDraw = this.createFolder( "Zeichnung" );
this.list.insertBefore( this.folderDraw, this.list.firstChild ); this.list.insertBefore( this.folderDraw, this.list.firstChild );
} }*/
this.folderDraw.classList.remove( "netgis-hide" );
folder = this.folderDraw; folder = this.folderDraw;
} }
@ -382,7 +425,43 @@ netgis.LayerTree.prototype.onEditFeaturesChange = function( e )
this.updateFolderChecks( this.folderDraw ); this.updateFolderChecks( this.folderDraw );
this.client.invoke( netgis.Events.LAYER_SHOW, { id: id } ); 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 ) netgis.LayerTree.prototype.onSetMode = function( e )
@ -392,3 +471,8 @@ netgis.LayerTree.prototype.onSetMode = function( e )
this.root.classList.add( "netgis-hide" ); this.root.classList.add( "netgis-hide" );
} }
}; };
netgis.LayerTree.prototype.onAddServiceClick = function( e )
{
this.client.invoke( netgis.Events.ADD_SERVICE_SHOW, null );
};

@ -28,8 +28,11 @@ netgis.MapOpenLayers = function()
this.editEventsSilent = false; this.editEventsSilent = false;
this.importLayerID = 1000; this.importLayerID = 20000;
this.editLayerID = 2000; this.editLayerID = 30000;
this.labelFont = "4mm Verdana, sans-serif";
this.drawBufferRadius = 100.0;
this.drawBufferSegments = 3;
}; };
netgis.MapOpenLayers.prototype = Object.create( netgis.Map.prototype ); 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 ) ); this.root.addEventListener( "drop", this.onDragDrop.bind( this ) );
// Map Renderer // Map Renderer
this.createMap(); this.initMap();
this.createDefaultLayers(); this.initDefaultLayers();
this.createInteractions(); this.initInteractions();
// Events // Events
this.client.on( netgis.Events.CONTEXT_UPDATE, this.onContextUpdate.bind( this ) ); 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.SET_MODE, this.onSetMode.bind( this ) );
this.client.on( netgis.Events.SNAP_ON, this.onSnapOn.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.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_SHOW, this.onLayerShow.bind( this ) );
this.client.on( netgis.Events.LAYER_HIDE, this.onLayerHide.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 ) ); 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_GML, this.onImportGML.bind( this ) );
this.client.on( netgis.Events.IMPORT_SHAPEFILE, this.onImportShapefile.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_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_PDF, this.onExportPDF.bind( this ) );
this.client.on( netgis.Events.EXPORT_JPEG, this.onExportJPEG.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_PNG, this.onExportPNG.bind( this ) );
this.client.on( netgis.Events.EXPORT_GIF, this.onExportGIF.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_SHOW_PREVIEW, this.onParcelShowPreview.bind( this ) );
this.client.on( netgis.Events.PARCEL_HIDE_PREVIEW, this.onParcelHidePreview.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; var config = this.client.config;
@ -133,14 +146,17 @@ netgis.MapOpenLayers.prototype.createMap = function()
this.view.on( "change:resolution", this.onChangeResolution.bind( this ) ); 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 ? //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.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.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.map.addLayer( this.parcelLayer );
this.editEventsOn(); this.editEventsOn();
@ -163,7 +179,7 @@ netgis.MapOpenLayers.prototype.editEventsOff = function()
//this.editLayer.getSource().un( "removefeature"/*, this.onEditLayerRemove*/ ); //this.editLayer.getSource().un( "removefeature"/*, this.onEditLayerRemove*/ );
}; };
netgis.MapOpenLayers.prototype.createInteractions = function() netgis.MapOpenLayers.prototype.initInteractions = function()
{ {
// View // View
this.interactions[ netgis.Modes.VIEW ] = this.interactions[ netgis.Modes.VIEW ] =
@ -184,6 +200,8 @@ netgis.MapOpenLayers.prototype.createInteractions = function()
new ol.interaction.MouseWheelZoom() new ol.interaction.MouseWheelZoom()
]; ];
this.interactions[ netgis.Modes.DRAW_POINTS ][ 0 ].on( "drawend", this.onDrawPointsEnd.bind( this ) );
this.interactions[ netgis.Modes.DRAW_LINES ] = this.interactions[ netgis.Modes.DRAW_LINES ] =
[ [
new ol.interaction.Draw( { type: "LineString", source: this.editLayer.getSource(), style: this.styleSketch.bind( this ) } ), 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() new ol.interaction.MouseWheelZoom()
]; ];
this.interactions[ netgis.Modes.DRAW_LINES ][ 0 ].on( "drawend", this.onDrawLinesEnd.bind( this ) );
this.interactions[ netgis.Modes.DRAW_POLYGONS ] = this.interactions[ netgis.Modes.DRAW_POLYGONS ] =
[ [
new ol.interaction.Draw( { type: "Polygon", source: this.editLayer.getSource(), style: this.styleSketch.bind( this ) } ), new ol.interaction.Draw( { type: "Polygon", source: this.editLayer.getSource(), style: this.styleSketch.bind( this ) } ),
@ -257,11 +277,47 @@ netgis.MapOpenLayers.prototype.createInteractions = function()
netgis.MapOpenLayers.prototype.createLayer = function( data ) netgis.MapOpenLayers.prototype.createLayer = function( data )
{ {
//TODO: refactor into createLayerWMS, createLayerWFS etc. var layer = null;
// Create Specific Layer By Type
switch ( data.type ) switch ( data.type )
{ {
case netgis.LayerTypes.XYZ: case netgis.LayerTypes.XYZ:
{
layer = this.createLayerXYZ( data.url );
break;
}
case netgis.LayerTypes.OSM:
{
layer = this.createLayerOSM();
break;
}
case netgis.LayerTypes.WMS:
{
layer = this.createLayerWMS( data.url, data.name, data.format, data.username, data.password );
break;
}
case netgis.LayerTypes.WFS:
{
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;
};
netgis.MapOpenLayers.prototype.createLayerXYZ = function( url )
{ {
var layer = new ol.layer.Tile var layer = new ol.layer.Tile
( (
@ -269,7 +325,7 @@ netgis.MapOpenLayers.prototype.createLayer = function( data )
source: new ol.source.XYZ source: new ol.source.XYZ
( (
{ {
url: data.url, url: url,
crossOrigin: "anonymous" crossOrigin: "anonymous"
} }
) )
@ -277,9 +333,9 @@ netgis.MapOpenLayers.prototype.createLayer = function( data )
); );
return layer; return layer;
} };
case netgis.LayerTypes.OSM: netgis.MapOpenLayers.prototype.createLayerOSM = function()
{ {
var layer = new ol.layer.Tile var layer = new ol.layer.Tile
( (
@ -295,17 +351,17 @@ netgis.MapOpenLayers.prototype.createLayer = function( data )
); );
return layer; return layer;
} };
case netgis.LayerTypes.WMS: netgis.MapOpenLayers.prototype.createLayerWMS = function( url, layerName, format, user, password )
{ {
var params = var params =
{ {
url: data.url, url: url,
params: params:
{ {
"LAYERS": data.name, "LAYERS": layerName,
"FORMAT": "image/png", "FORMAT": format ? format : "image/png",
"TRANSPARENT": "true", "TRANSPARENT": "true",
"VERSION": "1.1.1" "VERSION": "1.1.1"
}, },
@ -316,13 +372,13 @@ netgis.MapOpenLayers.prototype.createLayer = function( data )
}; };
// Authorization // Authorization
if ( data.username && data.password ) if ( user && password )
{ {
params.imageLoadFunction = function( image, src ) params.imageLoadFunction = function( image, src )
{ {
var request = new XMLHttpRequest(); var request = new XMLHttpRequest();
request.open( "GET", src ); request.open( "GET", src );
request.setRequestHeader( "Authorization", "Basic " + window.btoa( data.username + ":" + data.password ) ); request.setRequestHeader( "Authorization", "Basic " + window.btoa( user + ":" + password ) );
request.onload = function() request.onload = function()
{ {
@ -345,17 +401,19 @@ netgis.MapOpenLayers.prototype.createLayer = function( data )
); );
return layer; return layer;
} };
case netgis.LayerTypes.WFS: netgis.MapOpenLayers.prototype.createLayerWFS = function( url, typeName, projection, outputFormat )
{ {
var config = this.client.config; url = url
var url = data.url
+ "service=WFS" + "service=WFS"
+ "&version=1.1.0" + "&version=1.1.0"
+ "&request=GetFeature" + "&request=GetFeature";
+ "&outputformat=application/json";
if ( ! outputFormat )
outputFormat = "application/json";
else
outputFormat = netgis.util.replace( outputFormat, " ", "+" ); //TODO: encode uri component ?
var source = new ol.source.Vector var source = new ol.source.Vector
( (
@ -365,10 +423,13 @@ netgis.MapOpenLayers.prototype.createLayer = function( data )
url: function( extent ) url: function( extent )
{ {
return url return url
+ "&typename=" + data.name + "&typename=" + typeName
+ "&srsname=" + config.map.projection + "&srsname=" + projection
+ "&bbox=" + extent.join( "," ) + "," + config.map.projection; + "&bbox=" + extent.join( "," ) + "," + projection
+ "&outputFormat=" + outputFormat;
} }
//TODO: custom loader function to catch xhr response parse errors
} }
); );
@ -382,12 +443,9 @@ netgis.MapOpenLayers.prototype.createLayer = function( data )
var self = this; var self = this;
source.on( "featuresloadstart", function( e ) { self.removeSnapLayer( layer ); } ); source.on( "featuresloadstart", function( e ) { self.removeSnapLayer( layer ); } );
source.on( "featuresloadend", function( e ) { window.setTimeout( function() { self.addSnapLayer( layer ); }, 10 ); } ); source.on( "featuresloadend", function( e ) { window.setTimeout( function() { self.addSnapLayer( layer ); }, 10 ); } );
//source.on( "featuresloaderror", function( e ) { console.info( "Layer Error:", e ); } );
return layer; return layer;
}
}
return null;
}; };
netgis.MapOpenLayers.prototype.clearAll = function() netgis.MapOpenLayers.prototype.clearAll = function()
@ -416,9 +474,10 @@ netgis.MapOpenLayers.prototype.onUpdateStyle = function( e )
this.editLayer.setStyle( style ); this.editLayer.setStyle( style );
}; };
netgis.MapOpenLayers.prototype.styleEdit = function() netgis.MapOpenLayers.prototype.styleEdit = function( feature )
{ {
var radius = this.client.config.styles.editLayer.pointRadius; var radius = this.client.config.styles.editLayer.pointRadius;
var geom = feature.getGeometry();
var style = new ol.style.Style 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; return style;
}; };
netgis.MapOpenLayers.prototype.styleSelect = function( feature ) netgis.MapOpenLayers.prototype.styleSelect = function( feature )
{ {
var geom = feature.getGeometry();
var style = new ol.style.Style 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; return style;
}; };
@ -470,6 +569,8 @@ netgis.MapOpenLayers.prototype.styleModify = function( feature )
netgis.MapOpenLayers.prototype.styleSketch = function( feature ) netgis.MapOpenLayers.prototype.styleSketch = function( feature )
{ {
var geom = feature.getGeometry();
var style = new ol.style.Style 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 var vertex = new ol.style.Style
( (
{ {
@ -599,7 +719,7 @@ netgis.MapOpenLayers.prototype.getActiveVectorLayers = function()
netgis.MapOpenLayers.prototype.setMode = function( mode ) netgis.MapOpenLayers.prototype.setMode = function( mode )
{ {
// Old Mode // Leave
switch ( this.mode ) switch ( this.mode )
{ {
case netgis.Modes.BUFFER_FEATURE_EDIT: case netgis.Modes.BUFFER_FEATURE_EDIT:
@ -607,6 +727,18 @@ netgis.MapOpenLayers.prototype.setMode = function( mode )
this.onBufferCancel( null ); this.onBufferCancel( null );
break; break;
} }
case netgis.Modes.DRAW_POINTS:
case netgis.Modes.DRAW_LINES:
{
this.onDrawBufferOff( null );
break;
}
}
// Enter
switch ( mode )
{
} }
// Interactions // Interactions
@ -674,6 +806,8 @@ netgis.MapOpenLayers.prototype.setSnapOn = function()
this.snapFeatures.changed(); this.snapFeatures.changed();
//this.updateSnapLayers(); //this.updateSnapLayers();
//TODO: https://openlayers.org/en/latest/examples/tracing.html
}; };
netgis.MapOpenLayers.prototype.setSnapOff = function() netgis.MapOpenLayers.prototype.setSnapOff = function()
@ -685,6 +819,29 @@ netgis.MapOpenLayers.prototype.setSnapOff = function()
//this.snapFeatures = null; //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() netgis.MapOpenLayers.prototype.updateSnapLayers = function()
{ {
@ -739,6 +896,16 @@ netgis.MapOpenLayers.prototype.onSnapOff = function( e )
this.setSnapOff(); this.setSnapOff();
}; };
netgis.MapOpenLayers.prototype.onTracingOn = function( e )
{
this.setTracingOn();
};
netgis.MapOpenLayers.prototype.onTracingOff = function( e )
{
this.setTracingOff();
};
netgis.MapOpenLayers.prototype.onLayerShow = function( e ) netgis.MapOpenLayers.prototype.onLayerShow = function( e )
{ {
var layer = this.layers[ e.id ]; 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 ) netgis.MapOpenLayers.prototype.onSetMode = function( e )
{ {
this.setMode( e ); this.setMode( e );
@ -857,7 +1038,8 @@ netgis.MapOpenLayers.prototype.onZoomWKT = function( e )
netgis.MapOpenLayers.prototype.onPointerMove = 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 hover = this.hover;
var styleSelect = this.styleSelect.bind( this ); var styleSelect = this.styleSelect.bind( this );
@ -876,7 +1058,7 @@ netgis.MapOpenLayers.prototype.onPointerMove = function( e )
{ {
this.map.forEachFeatureAtPixel this.map.forEachFeatureAtPixel
( (
e.pixel, pixel,
function( feature, layer ) //TODO: bind to this? function( feature, layer ) //TODO: bind to this?
{ {
if ( layer === self.editLayer ) if ( layer === self.editLayer )
@ -896,7 +1078,7 @@ netgis.MapOpenLayers.prototype.onPointerMove = function( e )
{ {
this.map.forEachFeatureAtPixel this.map.forEachFeatureAtPixel
( (
e.pixel, pixel,
function( feature, layer ) //TODO: bind to this? function( feature, layer ) //TODO: bind to this?
{ {
if ( layer === self.editLayer ) if ( layer === self.editLayer )
@ -916,7 +1098,7 @@ netgis.MapOpenLayers.prototype.onPointerMove = function( e )
{ {
this.map.forEachFeatureAtPixel this.map.forEachFeatureAtPixel
( (
e.pixel, pixel,
function( feature, layer ) //TODO: bind to this? function( feature, layer ) //TODO: bind to this?
{ {
if ( layer === self.editLayer ) if ( layer === self.editLayer )
@ -931,6 +1113,13 @@ netgis.MapOpenLayers.prototype.onPointerMove = function( e )
break; break;
} }
case netgis.Modes.DRAW_POINTS:
case netgis.Modes.DRAW_LINES:
{
this.updateDrawBufferPreview();
break;
}
} }
//TODO: refactor to default hover handler? //TODO: refactor to default hover handler?
@ -1030,13 +1219,31 @@ netgis.MapOpenLayers.prototype.onCutFeatureDrawEnd = function( e )
netgis.MapOpenLayers.prototype.onModifyFeaturesEnd = function( e ) netgis.MapOpenLayers.prototype.onModifyFeaturesEnd = function( e )
{ {
this.updateEditOutput(); this.updateEditOutput();
this.updateEditArea();
}; };
netgis.MapOpenLayers.prototype.onBufferChange = function( e ) 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 radius = e.radius; var parser = new jsts.io.OL3Parser();
var segments = e.segments;
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 source = this.editLayer.getSource(); var source = this.editLayer.getSource();
var target = this.selected; var target = this.selected;
@ -1047,15 +1254,7 @@ netgis.MapOpenLayers.prototype.onBufferChange = function( e )
if ( target ) if ( target )
{ {
// Cut Process var feature = this.createBufferFeature( target.getGeometry(), e.radius, e.segments );
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 } );
//source.removeFeature( target ); //source.removeFeature( target );
source.addFeature( feature ); source.addFeature( feature );
@ -1090,10 +1289,87 @@ netgis.MapOpenLayers.prototype.onBufferCancel = function( e )
this.selected = null; 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 ) netgis.MapOpenLayers.prototype.onEditLayerAdd = function( e )
{ {
this.updateEditOutput(); ////this.updateEditOutput();
this.updateEditLayerItem(); this.updateEditLayerItem();
this.updateEditOutput();
this.snapFeatures.push( e.feature ); this.snapFeatures.push( e.feature );
}; };
@ -1116,14 +1392,28 @@ netgis.MapOpenLayers.prototype.updateEditOutput = function()
var format = new ol.format.GeoJSON(); var format = new ol.format.GeoJSON();
var output = format.writeFeaturesObject( features, { dataProjection: proj, featureProjection: proj } ); var output = format.writeFeaturesObject( features, { dataProjection: proj, featureProjection: proj } );
// Projection
output[ "crs" ] = output[ "crs" ] =
{ {
"type": "name", "type": "name",
"properties": { "name": "urn:ogc:def:crs:" + proj.replace( ":", "::" ) } "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 ) if ( ! this.editEventsSilent )
{
this.client.invoke( netgis.Events.EDIT_FEATURES_CHANGE, output ); this.client.invoke( netgis.Events.EDIT_FEATURES_CHANGE, output );
}
}; };
netgis.MapOpenLayers.prototype.updateEditLayerItem = function() 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 ) netgis.MapOpenLayers.prototype.onEditFeaturesLoaded = function( e )
{ {
var json = e; var json = e;
@ -1247,6 +1542,28 @@ netgis.MapOpenLayers.prototype.onImportShapefile = function( e )
reader.readAsArrayBuffer( file ); 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 ) netgis.MapOpenLayers.prototype.createLayerGeoJSON = function( title, data )
{ {
var format = new ol.format.GeoJSON(); var format = new ol.format.GeoJSON();
@ -1265,7 +1582,6 @@ netgis.MapOpenLayers.prototype.createLayerGeoJSON = function( title, data )
case this.client.config.map.projection: case this.client.config.map.projection:
{ {
// Projection OK // Projection OK
//console.info( "Import Projection:", projcode );
break; 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 ) netgis.MapOpenLayers.prototype.addImportedFeatures = function( features )
{ {
// Add To Edit Layer // Add To Edit Layer
@ -1537,6 +1971,7 @@ netgis.MapOpenLayers.prototype.exportImage = function( format, resx, resy, mode,
// Request Logo Image // Request Logo Image
var logo = new Image(); var logo = new Image();
logo.onload = function() logo.onload = function()
{ {
//TODO: refactor map render image and image export //TODO: refactor map render image and image export
@ -1597,6 +2032,13 @@ netgis.MapOpenLayers.prototype.exportImage = function( format, resx, resy, mode,
// Watermark Logo // Watermark Logo
mapContext.drawImage( logo, 0, 0 ); 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 // Export Map Image
var link = document.createElement( "a" ); 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 ); pdf.addImage( mapCanvas.toDataURL( "image/png,1.0", 1.0 ), "PNG", x, y, width, height );
// Text // Text
pdf.setFillColor( 255, 255, 255 );
pdf.rect( x, y + height - 11, 80, 11, "F" );
pdf.setFontSize( 8 ); 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 ); pdf.text( "Quelle: " + window.location.href, x + 2, y + height - 2 );
// Same Tab // Same Tab

@ -72,6 +72,8 @@ netgis.Menu.prototype.load = function()
//fileItems.appendChild( this.createMenuItem( '<i class="fas fa-file"></i>KML', this.onImportKMLClick.bind( this ) ) ); //fileItems.appendChild( this.createMenuItem( '<i class="fas fa-file"></i>KML', this.onImportKMLClick.bind( this ) ) );
importItem.appendChild( this.createMenuItem( '<i class="fas fa-file"></i>GML', this.onImportGMLClick.bind( this ) ) ); importItem.appendChild( this.createMenuItem( '<i class="fas fa-file"></i>GML', this.onImportGMLClick.bind( this ) ) );
importItem.appendChild( this.createMenuItem( '<i class="fas fa-file"></i>Shapefile', this.onImportShapefileClick.bind( this ) ) ); importItem.appendChild( this.createMenuItem( '<i class="fas fa-file"></i>Shapefile', this.onImportShapefileClick.bind( this ) ) );
importItem.appendChild( this.createMenuItem( '<i class="fas fa-file"></i>Spatialite', this.onImportSpatialiteClick.bind( this ) ) );
importItem.appendChild( this.createMenuItem( '<i class="fas fa-file"></i>GeoPackage', this.onImportGeopackageClick.bind( this ) ) );
// Export // Export
var exportMenu = this.createMenu( '<i class="fas fa-caret-down"></i>Export' ); var exportMenu = this.createMenu( '<i class="fas fa-caret-down"></i>Export' );
@ -228,6 +230,16 @@ netgis.Menu.prototype.onImportGMLClick = function( e )
this.client.invoke( netgis.Events.IMPORT_GML_SHOW, null ); 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 ) netgis.Menu.prototype.onExportPDFClick = function( e )
{ {
this.client.invoke( netgis.Events.EXPORT_PDF_SHOW, null ); this.client.invoke( netgis.Events.EXPORT_PDF_SHOW, null );

@ -131,7 +131,8 @@
cursor: not-allowed; cursor: not-allowed;
} }
.netgis-modal-content input .netgis-modal-content input,
.netgis-modal-content select
{ {
width: 100%; width: 100%;
} }

@ -21,6 +21,9 @@ netgis.Modal = function()
this.exportJPEG = null; this.exportJPEG = null;
this.exportPNG = null; this.exportPNG = null;
this.exportGIF = null; this.exportGIF = null;
this.addService = null;
this.addServiceID = 10000;
}; };
netgis.Modal.prototype.load = function() netgis.Modal.prototype.load = function()
@ -39,6 +42,12 @@ netgis.Modal.prototype.load = function()
this.importShapefile = this.createImportShapefile(); this.importShapefile = this.createImportShapefile();
this.root.appendChild( this.importShapefile ); this.root.appendChild( this.importShapefile );
this.importSpatialite = this.createImportSpatialite();
this.root.appendChild( this.importSpatialite );
this.importGeopackage = this.createImportGeopackage();
this.root.appendChild( this.importGeopackage );
// Export // Export
this.exportPDF = this.createExportPDF(); this.exportPDF = this.createExportPDF();
this.root.appendChild( this.exportPDF ); this.root.appendChild( this.exportPDF );
@ -52,6 +61,10 @@ netgis.Modal.prototype.load = function()
this.exportGIF = this.createExportGIF(); this.exportGIF = this.createExportGIF();
this.root.appendChild( this.exportGIF ); this.root.appendChild( this.exportGIF );
// Layers
this.addService = this.createAddService();
this.root.appendChild( this.addService );
// Done // Done
this.client.root.appendChild( this.root ); 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_GEOJSON_SHOW, this.onImportGeoJSONShow.bind( this ) );
this.client.on( netgis.Events.IMPORT_GML_SHOW, this.onImportGMLShow.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_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_PDF_SHOW, this.onExportPDFShow.bind( this ) );
this.client.on( netgis.Events.EXPORT_JPEG_SHOW, this.onExportJPEGShow.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_PNG_SHOW, this.onExportPNGShow.bind( this ) );
this.client.on( netgis.Events.EXPORT_GIF_SHOW, this.onExportGIFShow.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() netgis.Modal.prototype.createImportGeoJSON = function()
@ -102,6 +119,30 @@ netgis.Modal.prototype.createImportShapefile = function()
return container; return container;
}; };
netgis.Modal.prototype.createImportSpatialite = function()
{
var container = this.createContainer( "Import Spatialite" );
this.createText( container, "Unterstützte Koordinatensysteme:", "<ul><li>World Geodetic System 1984 (EPSG:4326)</li><li>ETRS89 / UTM zone 32N (EPSG:25832)</li></ul>" );
this.createInputFile( container, "Datei auswählen / ablegen:", ".sqlite", this.onImportSpatialiteChange.bind( this ) );
this.createSpace( container );
this.createButton( container, "<i class='fas fa-check'></i>Importieren", this.onImportSpatialiteAccept.bind( this ) );
return container;
};
netgis.Modal.prototype.createImportGeopackage = function()
{
var container = this.createContainer( "Import GeoPackage" );
this.createText( container, "Unterstützte Koordinatensysteme:", "<ul><li>World Geodetic System 1984 (EPSG:4326)</li><li>ETRS89 / UTM zone 32N (EPSG:25832)</li></ul>" );
this.createInputFile( container, "Datei auswählen / ablegen:", ".gpkg", this.onImportGeopackageChange.bind( this ) );
this.createSpace( container );
this.createButton( container, "<i class='fas fa-check'></i>Importieren", this.onImportGeopackageAccept.bind( this ) );
return container;
};
netgis.Modal.prototype.createExportPDF = function() netgis.Modal.prototype.createExportPDF = function()
{ {
var container = this.createContainer( "Export PDF" ); var container = this.createContainer( "Export PDF" );
@ -152,6 +193,29 @@ netgis.Modal.prototype.createExportGIF = function()
return container; 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, "<i class='fas fa-cloud-download-alt'></i>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, "<i class='fas fa-check'></i>Dienst hinzufügen", this.onAddServiceAccept.bind( this ) );
return container;
};
netgis.Modal.prototype.show = function( container ) netgis.Modal.prototype.show = function( container )
{ {
this.root.classList.add( "netgis-show" ); this.root.classList.add( "netgis-show" );
@ -243,6 +307,25 @@ netgis.Modal.prototype.createButton = function( container, title, callback )
return button; 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 ) netgis.Modal.prototype.createInputText = function( container, title )
{ {
var row = document.createElement( "tr" ); var row = document.createElement( "tr" );
@ -258,12 +341,41 @@ netgis.Modal.prototype.createInputText = function( container, title )
var cell = document.createElement( "td" ); var cell = document.createElement( "td" );
cell.className = "netgis-padding"; cell.className = "netgis-padding";
row.appendChild( cell );
var input = document.createElement( "input" ); var input = document.createElement( "input" );
input.setAttribute( "type", "text" ); input.setAttribute( "type", "text" );
cell.appendChild( input ); 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 ); row.appendChild( cell );
var input = document.createElement( "select" );
cell.appendChild( input );
label.htmlFor = input; label.htmlFor = input;
var content = container.getElementsByClassName( "netgis-modal-content" )[ 0 ]; var content = container.getElementsByClassName( "netgis-modal-content" )[ 0 ];
@ -503,6 +615,74 @@ netgis.Modal.prototype.onImportShapefileAccept = function( e )
this.hide(); 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 ) netgis.Modal.prototype.onExportPDFShow = function( e )
{ {
var inputs = this.exportPDF.getElementsByTagName( "input" ); var inputs = this.exportPDF.getElementsByTagName( "input" );
@ -590,3 +770,235 @@ netgis.Modal.prototype.onExportGIFAccept = function( e )
this.hide(); 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();
};

@ -18,20 +18,38 @@ netgis.Toolbar.prototype.load = function()
if ( this.client.editable ) 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 // Draw
this.toolbars[ netgis.Modes.DRAW_POINTS ] = this.createToolbar(); this.toolbars[ netgis.Modes.DRAW_POINTS ] = this.createToolbar();
this.append( this.toolbars[ netgis.Modes.DRAW_POINTS ], this.createToolbarButton( '<i class="fas fa-times"></i><span>Punkte zeichnen:</span>', this.onToolbarClose.bind( this ) ) ); this.append( this.toolbars[ netgis.Modes.DRAW_POINTS ], this.createToolbarButton( '<i class="fas fa-times"></i><span>Punkte zeichnen:</span>', 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( "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.root.appendChild( this.toolbars[ netgis.Modes.DRAW_POINTS ] );
this.toolbars[ netgis.Modes.DRAW_LINES ] = this.createToolbar(); this.toolbars[ netgis.Modes.DRAW_LINES ] = this.createToolbar();
this.append( this.toolbars[ netgis.Modes.DRAW_LINES ], this.createToolbarButton( '<i class="fas fa-times"></i><span>Linien zeichnen:</span>', this.onToolbarClose.bind( this ) ) ); this.append( this.toolbars[ netgis.Modes.DRAW_LINES ], this.createToolbarButton( '<i class="fas fa-times"></i><span>Linien zeichnen:</span>', 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( "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.root.appendChild( this.toolbars[ netgis.Modes.DRAW_LINES ] );
this.showDrawBufferOptions( false );
this.toolbars[ netgis.Modes.DRAW_POLYGONS ] = this.createToolbar(); this.toolbars[ netgis.Modes.DRAW_POLYGONS ] = this.createToolbar();
this.append( this.toolbars[ netgis.Modes.DRAW_POLYGONS ], this.createToolbarButton( '<i class="fas fa-times"></i><span>Polygone zeichnen:</span>', this.onToolbarClose.bind( this ) ) ); this.append( this.toolbars[ netgis.Modes.DRAW_POLYGONS ], this.createToolbarButton( '<i class="fas fa-times"></i><span>Polygone zeichnen:</span>', 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( "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.root.appendChild( this.toolbars[ netgis.Modes.DRAW_POLYGONS ] );
// Edit // Edit
@ -60,17 +78,8 @@ netgis.Toolbar.prototype.load = function()
//var wrapper = document.createElement( "div" ); //var wrapper = document.createElement( "div" );
//this.toolbars[ netgis.Modes.BUFFER_FEATURE_EDIT ].appendChild( wrapper ); //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( '<i class="fas fa-times"></i><span>Feature puffern:</span>', this.onBufferCancel.bind( this ) ) ); this.append( this.toolbars[ netgis.Modes.BUFFER_FEATURE_EDIT ], this.createToolbarButton( '<i class="fas fa-times"></i><span>Feature puffern:</span>', 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.createToolbarInput( "Segmente:", bufferDefaultSegments, this.onBufferChange.bind( this ) ) );
this.append( this.toolbars[ netgis.Modes.BUFFER_FEATURE_EDIT ], this.createToolbarButton( '<i class="fas fa-check"></i><span>OK</span>', this.onBufferAccept.bind( this ) ) ); this.append( this.toolbars[ netgis.Modes.BUFFER_FEATURE_EDIT ], this.createToolbarButton( '<i class="fas fa-check"></i><span>OK</span>', this.onBufferAccept.bind( this ) ) );
@ -252,6 +261,19 @@ netgis.Toolbar.prototype.onSetMode = function( e )
this.updateBuffer(); this.updateBuffer();
break; 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;
}
} }
}; };
@ -445,3 +467,82 @@ netgis.Toolbar.prototype.onSnapChange = function( e )
this.client.invoke( on ? netgis.Events.SNAP_ON : netgis.Events.SNAP_OFF, null ); 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" );
}
};

@ -140,6 +140,59 @@ netgis.util =
return Object.assign( target, other ); 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 (&sup2; etc.) not supported in OL Labels
return output;
};
// Public Interface // Public Interface
var iface = var iface =
{ {
@ -153,7 +206,9 @@ netgis.util =
size: size, size: size,
request: request, request: request,
padstr: padstr, padstr: padstr,
merge: merge merge: merge,
getTimeStamp: getTimeStamp,
formatArea: formatArea
}; };
return iface; return iface;

Loading…
Cancel
Save