mirror of
https://github.com/sebastianpauli/netgis-client.git
synced 2025-04-26 09:54:13 +02:00
Geoportal Update: first major update to make this a functional replacement for the old mobile client (mobilemap2), see "demo/geoportal.html" for reference and try with parameter "?wmc_id=14971", more coming soon...
This commit is contained in:
parent
1df99be964
commit
959eff4d59
269
demo/geoportal.html
Normal file
269
demo/geoportal.html
Normal file
@ -0,0 +1,269 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
|
||||
<head>
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
|
||||
<title>Geoportal Demo | NetGIS Client</title>
|
||||
|
||||
<!-- 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/openlayers/10.0.0/ol.css" />
|
||||
|
||||
<!-- Custom Styles -->
|
||||
<link rel="stylesheet" type="text/css" href="../dist/netgis.min.css" />
|
||||
|
||||
<!-- Implementation Style -->
|
||||
<style>
|
||||
|
||||
html, body
|
||||
{
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
#container
|
||||
{
|
||||
position: absolute;
|
||||
left: 0mm;
|
||||
top: 0mm;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.netgis-map
|
||||
{
|
||||
background: white;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!-- Client Container -->
|
||||
<main id="container">
|
||||
</main>
|
||||
|
||||
<!-- Library Scripts -->
|
||||
<script type="text/javascript" src="/libs/openlayers/10.0.0/ol.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/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/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 -->
|
||||
<script type="text/javascript" src="../dist/netgis.min.js"></script>
|
||||
|
||||
<!-- Implementation Script -->
|
||||
<script type="text/javascript">
|
||||
|
||||
// Client Config
|
||||
var config =
|
||||
{
|
||||
"modules":
|
||||
{
|
||||
"menu": true,
|
||||
"layertree": true,
|
||||
"map": true,
|
||||
"controls": true,
|
||||
"attribution": true,
|
||||
"legend": true,
|
||||
"geolocation": true,
|
||||
"info": true,
|
||||
"searchplace": true,
|
||||
"toolbox": true,
|
||||
"import": true
|
||||
},
|
||||
|
||||
"client":
|
||||
{
|
||||
"loading_text": "Geoportal Client wird geladen..."
|
||||
},
|
||||
|
||||
"menu":
|
||||
{
|
||||
"compact": true,
|
||||
"header": "<a href='.' target='_self'>Geoportal Demo</a>",
|
||||
"items":
|
||||
[
|
||||
{
|
||||
"title": "<i class='fas fa-caret-down'></i><span>Ansicht</span>",
|
||||
"items":
|
||||
[
|
||||
{ "id": "view_prev", "title": "<i class='fas fa-step-backward'></i><span>Vorherige</span>" },
|
||||
{ "id": "view_next", "title": "<i class='fas fa-step-forward'></i><span>Nächste</span>" },
|
||||
{ "id": "scales", "title": "<i class='fas fa-ruler-horizontal'></i><span>Maßstab</span><i class='fas fa-caret-right'></i>", "items": [ /*{ "id": "test1", "title": "Subitem 1" }, { "id": "test2", "title": "Subitem 2" }, { "id": "test3", "title": "Subitem 3" }*/ ] }
|
||||
]
|
||||
},
|
||||
|
||||
{ "id": "searchplace", "title": "<i class='fas fa-search'></i><span>Suche</span>" },
|
||||
{ "id": "toolbox", "title": "<i class='fas fa-tools'></i><span>Werkzeuge</span>" },
|
||||
{ "id": "layertree", "title": "<i class='fas fa-layer-group'></i><span>Inhalte</span>" }
|
||||
]
|
||||
},
|
||||
|
||||
"projections":
|
||||
[
|
||||
[ "EPSG:25832", "+proj=utm +zone=32 +ellps=GRS80 +units=m +no_defs" ]
|
||||
],
|
||||
|
||||
"map":
|
||||
{
|
||||
"projection": "EPSG:25832",
|
||||
"center": [ 329766.1782104631, 5513621.076679279 ],
|
||||
"zoom": 14,
|
||||
"min_zoom": 5,
|
||||
"max_zoom": 19,
|
||||
"scalebar": true,
|
||||
|
||||
"extent": [ 293315.97, 5423948.96, 464350.97, 5644103.06 ],
|
||||
"scales": [ 500, 1000, 3000, 5000, 8000, 10000, 15000, 25000, 50000, 100000, 150000, 250000, 500000, 1000000, 1500000, 2000000 ]
|
||||
},
|
||||
|
||||
"wmc":
|
||||
{
|
||||
"url": "./proxy.php?https://www.geoportal.rlp.de/mapbender/php/mod_exportWmc2Json.php?confFileName=mobilemap2&epsg=25832&withHierarchy=1&wmc_id={id}"
|
||||
|
||||
// Use this to directly load a WMC by ID:
|
||||
// "id": 27581
|
||||
},
|
||||
|
||||
"folders":
|
||||
[
|
||||
{ "id": "bg", "title": "Hintergrund", "parent": null, "radio": true }
|
||||
],
|
||||
|
||||
"layers":
|
||||
[
|
||||
// Background Layers
|
||||
{ "id": "top_tiles", "folder": "bg", "order": 1, "type": "WMS", "tiled": true, "title": "TopPlusOpen Tiled", "attribution": "BKG", "url": "https://sgx.geodatenzentrum.de/wms_topplus_open?", "name": "web", "active": false, "query": false },
|
||||
{ "id": "top", "folder": "bg", "order": 1, "type": "WMS", "title": "TopPlusOpen", "attribution": "BKG", "url": "https://sgx.geodatenzentrum.de/wms_topplus_open?", "name": "web", "active": false, "query": false },
|
||||
{ "id": "osm_human", "folder": "bg", "type": "XYZ", "title": "OSM Humanitarian", "attribution": "OSM", "url": "https://{a-c}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png" },
|
||||
{ "id": "osm", "folder": "bg", "type": "OSM", "title": "Open Street Map", "attribution": "OSM", "active": false, "order": 1, "min_zoom": 1, "max_zoom": 20 },
|
||||
{ "id": "bg_aerial", "folder": "bg", "order": 1, "title": "Luftbild", "type": "WMS", "url": "https://geo4.service24.rlp.de/wms/rp_dop20.fcgi", "tiled": true, "name": "rp_dop20", "query": false },
|
||||
{ "id": "bg_hybrid", "folder": "bg", "active": true, "order": 1, "title": "Hybrid", "type": "TMS", "url": "https://www.geoportal.rlp.de/mapcache/tms/1.0.0/test@UTM32/{z}/{x}/{-y}.jpeg", "projection": "EPSG:25832", "extent": "map", "scales": "map", "query": false },
|
||||
|
||||
// Hidden Layer For Height Queries
|
||||
{ "id": "dem_hidden", "title": "Digitales Höhenmodell", "hidden": true, "active": true, "query": true, "type": "HIDDEN", "query_url": "./proxy.php?https://www.geoportal.rlp.de/mapbender/extensions/mobilemap2/scripts/heightRequest.php?&lang=de&coord={x},{y}" }
|
||||
],
|
||||
|
||||
"layertree":
|
||||
{
|
||||
"open": false,
|
||||
"title": "Inhalte",
|
||||
"buttons":
|
||||
[
|
||||
{ "id": "import_layer", "title": "<i class='netgis-icon fas fa-plus' style='font-size: 1em;'></i><span>Hinzufügen...</span>" }
|
||||
]
|
||||
},
|
||||
|
||||
"controls":
|
||||
{
|
||||
"buttons":
|
||||
[
|
||||
{ "id": "zoom_in", "icon": "<i class='fas fa-plus'></i>", "title": "Zoom +" },
|
||||
{ "id": "zoom_out", "icon": "<i class='fas fa-minus'></i>", "title": "Zoom -" },
|
||||
{ "id": "geolocation", "icon": "<i class='fas fa-crosshairs'></i>", "title": "Gerätestandort" },
|
||||
{ "id": "zoom_home", "icon": "<i class='fas fa-home'></i>", "title": "Anfangsausdehung" },
|
||||
{ "id": "legend", "icon": "<i class='fas fa-bars'></i>", "title": "Legende" }
|
||||
]
|
||||
},
|
||||
|
||||
"legend":
|
||||
{
|
||||
"open": false
|
||||
},
|
||||
|
||||
"geolocation":
|
||||
{
|
||||
"marker_color": "#3480eb",
|
||||
"marker_title": "Geräte-Standort"
|
||||
},
|
||||
|
||||
"info":
|
||||
{
|
||||
"default_format": "text/plain"
|
||||
},
|
||||
|
||||
"searchplace":
|
||||
{
|
||||
"title": "Adresse...",
|
||||
"url": "./proxy.php?https://www.geoportal.rlp.de/mapbender/geoportal/gaz_geom_mobile.php?outputFormat=json&resultTarget=web&searchEPSG=4326&maxResults=5&maxRows=5&featureClass=P&style=full&searchText={query}&name_startsWith={query}"
|
||||
},
|
||||
|
||||
"toolbox":
|
||||
{
|
||||
"open": false,
|
||||
|
||||
"items":
|
||||
[
|
||||
{ "id": "view", "title": "<i class='netgis-icon netgis-text-a fas fa-hand-paper'></i><span>Betrachten</span>" },
|
||||
{ "id": "zoom_box", "title": "<i class='netgis-icon netgis-text-a fas fa-expand'></i><span>Zoom-Rechteck</span>" },
|
||||
|
||||
{ "id": "measure_line", "title": "<i class='netgis-icon netgis-text-a fas fa-ruler'></i><span>Strecke messen</span>" },
|
||||
{ "id": "measure_area", "title": "<i class='netgis-icon netgis-text-a fas fa-ruler-combined'></i><span>Fläche messen</span>" },
|
||||
{ "id": "measure_clear", "title": "<i class='netgis-icon netgis-text-a fas fa-trash-alt'></i><span>Messung löschen</span>" }
|
||||
]
|
||||
|
||||
// TODO: make all this config here?
|
||||
/*"options":
|
||||
{
|
||||
"buffer_features":
|
||||
{
|
||||
"title": "Puffern",
|
||||
"items":
|
||||
[
|
||||
{ "id": "buffer_radius", "type": "integer", "title": "Radius (Meter)" },
|
||||
{ "id": "buffer_segments", "type": "integer", "title": "Segmente" },
|
||||
{ "id": "buffer_submit", "type": "button", "title": "<i class='netgis-icon netgis-text-a fas fa-arrow-circle-right'></i><span>Akzeptieren</span>" }
|
||||
]
|
||||
}
|
||||
}*/
|
||||
},
|
||||
|
||||
"import":
|
||||
{
|
||||
"title": "Ebene hinzufügen",
|
||||
"preview": true,
|
||||
"wms_options": [ "https://sgx.geodatenzentrum.de/wms_topplus_open" ],
|
||||
"wfs_options": [ "http://213.139.159.34:80/geoserver/uesg/wfs" ],
|
||||
"wfs_proxy": "./proxy.php?",
|
||||
"geopackage_lib": "/libs/geopackage/4.2.3/",
|
||||
"geoportal_tab": true,
|
||||
"geoportal_search_url": "./proxy.php?" + "https://www.geoportal.rlp.de/mapbender/php/mod_callMetadata.php?languageCode=de&resultTarget=web&maxResults=40&searchText={query}"
|
||||
},
|
||||
|
||||
"measure":
|
||||
{
|
||||
"line_color": "rgba( 255, 0, 0, 1.0 )",
|
||||
"line_width": 3.0,
|
||||
"line_dash": [ 5, 10 ],
|
||||
"area_fill": "rgba( 255, 0, 0, 0.3 )",
|
||||
"point_radius": 4.0,
|
||||
"point_fill": "rgba( 255, 255, 255, 1.0 )",
|
||||
"point_stroke": "rgba( 0, 0, 0, 1.0 )",
|
||||
"text_color": "#871d33",
|
||||
"text_back": "rgba( 255, 255, 255, 0.7 )"
|
||||
},
|
||||
|
||||
"attribution":
|
||||
{
|
||||
"prefix": "GEOPORTAL"
|
||||
}
|
||||
};
|
||||
|
||||
// Create Client Instance
|
||||
var client = new netgis.Client( "container", config );
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
2
dist/netgis.min.css
vendored
2
dist/netgis.min.css
vendored
File diff suppressed because one or more lines are too long
260
dist/netgis.min.js
vendored
260
dist/netgis.min.js
vendored
@ -16,24 +16,25 @@ netgis.Client.prototype.initParams=function(a){var b=window.location.search.subs
|
||||
netgis.Client.prototype.initElements=function(a){if(a.hasAttribute("data-lon")){var b=Number.parseFloat(a.getAttribute("data-lon"));this.config.map.center_lonlat||(this.config.map.center_lonlat=[]);this.config.map.center_lonlat[0]=b}a.hasAttribute("data-lat")&&(b=Number.parseFloat(a.getAttribute("data-lat")),this.config.map.center_lonlat||(this.config.map.center_lonlat=[]),this.config.map.center_lonlat[1]=b);a.hasAttribute("data-zoom")&&(b=Number.parseFloat(a.getAttribute("data-zoom")),this.config.map.zoom=
|
||||
b);a.hasAttribute("data-bounds")&&(b=a.getAttribute("data-bounds"),this.config.tools.bounds=b);a.hasAttribute("data-editable")&&(a="true"===a.getAttribute("data-editable"),this.config.tools||(this.config.tools={}),this.config.tools.editable=a)};
|
||||
netgis.Client.prototype.initOutput=function(a){if(a.output&&a.output.id){if((a=document.getElementById(a.output.id))&&a.value&&0<a.value.length){var b=JSON.parse(a.value);netgis.util.invoke(this.container,netgis.Events.MAP_EDIT_LAYER_LOADED,{geojson:b})}this.output=a}this.output||(this.output=document.createElement("input"),this.output.setAttribute("type","hidden"),this.output.className="netgis-storage",this.container.appendChild(this.output))};
|
||||
netgis.Client.prototype.initModules=function(a){this.modules={};if(a=a.modules)a.map&&this.addModule("map",netgis.Map),a.controls&&this.addModule("controls",netgis.Controls),a.attribution&&this.addModule("attribution",netgis.Attribution),a.info&&this.addModule("info",netgis.Info),a.menu&&this.addModule("menu",netgis.Menu),a.layertree&&this.addModule("layertree",netgis.LayerTree),a.searchplace&&this.addModule("searchplace",netgis.SearchPlace),a.searchparcel&&this.addModule("searchparcel",netgis.SearchParcel),
|
||||
a.toolbox&&this.addModule("toolbox",netgis.Toolbox),a["import"]&&this.addModule("import",netgis.Import),a["export"]&&this.addModule("export",netgis.Export),a.timeslider&&this.addModule("timeslider",netgis.TimeSlider)};
|
||||
netgis.Client.prototype.initModules=function(a){this.modules={};if(a=a.modules)a.map&&this.addModule("map",netgis.Map),a.controls&&this.addModule("controls",netgis.Controls),a.attribution&&this.addModule("attribution",netgis.Attribution),a.legend&&this.addModule("legend",netgis.Legend),a.geolocation&&this.addModule("geolocation",netgis.Geolocation),a.info&&this.addModule("info",netgis.Info),a.menu&&this.addModule("menu",netgis.Menu),a.layertree&&this.addModule("layertree",netgis.LayerTree),a.searchplace&&
|
||||
this.addModule("searchplace",netgis.SearchPlace),a.searchparcel&&this.addModule("searchparcel",netgis.SearchParcel),a.toolbox&&this.addModule("toolbox",netgis.Toolbox),a["import"]&&this.addModule("import",netgis.Import),a["export"]&&this.addModule("export",netgis.Export),a.timeslider&&this.addModule("timeslider",netgis.TimeSlider)};
|
||||
netgis.Client.prototype.initEvents=function(){this.container.addEventListener(void 0,function(a){console.error("undefined event invoked",a)});for(var a in netgis.Events)this.container.addEventListener(netgis.Events[a],this.handleEvent.bind(this));this.container.addEventListener(netgis.Events.MAP_EDIT_LAYER_CHANGE,this.onMapEditLayerChange.bind(this))};
|
||||
netgis.Client.prototype.showLoader=function(a){this.loader||(this.loader=document.createElement("div"),this.loader.className="netgis-loader netgis-color-e netgis-text-a",this.loader.innerHTML="<i class='fas fa-cog'></i>",this.container.appendChild(this.loader));!1===a?this.loader.classList.add("netgis-hide"):this.loader.classList.remove("netgis-hide")};netgis.Client.prototype.handleEvent=function(a){var b=a.type;a=a.detail;!0===this.logEvents&&console.info("EVENT:",b,a)};
|
||||
netgis.Client.prototype.addModule=function(a,b){b=new b(this.config);b.attachTo&&b.attachTo(this.container);return this.modules[a]=b};netgis.Client.prototype.isMobile=function(){return netgis.util.isMobile(this.container)};netgis.Client.prototype.onConfigResponse=function(a){a=JSON.parse(a);this.init(this.container,a);this.showLoader(!1)};
|
||||
netgis.Client.prototype.requestContextWMC=function(a,b){if(-1<a.indexOf("{id}"))if(b)a=netgis.util.replace(a,"{id}",b);else{console.warn("No WMC id set in config for url",a);return}(new netgis.WMC).requestContext(a,this.onContextResponseWMC.bind(this))};
|
||||
netgis.Client.prototype.onContextResponseWMC=function(a){console.info("WMC Response:",a);for(var b=0;b<a.config.layers.length;b++)this.config.layers.push(a.config.layers[b]);a.config.map.bbox&&(this.config.map.bbox=a.config.map.bbox);netgis.util.invoke(this.container,netgis.Events.CLIENT_CONTEXT_RESPONSE,{context:a})};netgis.Client.prototype.requestContextOWS=function(a){console.info("Request OWS:",a);netgis.util.request(a,this.onContextResponseOWS.bind(this))};
|
||||
netgis.Client.prototype.showLoader=function(a){this.loader||(this.loader=document.createElement("div"),this.loader.className="netgis-loader netgis-color-e netgis-text-a",this.loader.innerHTML="<i class='fas fa-cog'></i>",this.config.client&&this.config.client.loading_text&&(this.loader.innerHTML+="<h2>"+this.config.client.loading_text+"</h2>"),this.container.appendChild(this.loader));!1===a?(this.loader.classList.add("netgis-fade"),this.loaderTimeout=window.setTimeout(function(){this.loader.classList.add("netgis-hide");
|
||||
this.loaderTimeout=null}.bind(this),600)):(this.loader.classList.remove("netgis-hide"),this.loader.classList.remove("netgis-fade"),this.loaderTimeout&&(window.clearTimeout(this.loaderTimeout),this.loaderTimeout=null))};netgis.Client.prototype.handleEvent=function(a){var b=a.type;a=a.detail;!0===this.logEvents&&console.info("EVENT:",b,a)};netgis.Client.prototype.addModule=function(a,b){b=new b(this.config);b.attachTo&&b.attachTo(this.container);return this.modules[a]=b};
|
||||
netgis.Client.prototype.isMobile=function(){return netgis.util.isMobile(this.container)};netgis.Client.prototype.onConfigResponse=function(a){a=JSON.parse(a);this.init(this.container,a);this.showLoader(!1)};netgis.Client.prototype.requestContextWMC=function(a,b){if(-1<a.indexOf("{id}"))if(b)a=netgis.util.replace(a,"{id}",b);else{console.warn("No WMC id set in config for url",a);return}(new netgis.WMC).requestContext(a,this.onContextResponseWMC.bind(this));this.showLoader(!0)};
|
||||
netgis.Client.prototype.onContextResponseWMC=function(a){console.info("WMC Response:",a);for(var b=0;b<a.config.layers.length;b++)this.config.layers.push(a.config.layers[b]);a.config.map.bbox&&(this.config.map.bbox=a.config.map.bbox);netgis.util.invoke(this.container,netgis.Events.CLIENT_CONTEXT_RESPONSE,{context:a});this.showLoader(!1)};netgis.Client.prototype.requestContextOWS=function(a){console.info("Request OWS:",a);netgis.util.request(a,this.onContextResponseOWS.bind(this))};
|
||||
netgis.Client.prototype.onContextResponseOWS=function(a){a=JSON.parse(a);console.info("OWS Response:",a);a=netgis.OWS.read(a,this);console.info("OWS Config:",a)};netgis.Client.prototype.onIconbarIconClick=function(a){switch(a.detail.id){case "home":a=this.config.layers;for(var b=0;b<a.length;b++){var c=a[b],d=c.id;!0===c.active?(this.modules.map.addLayer(d,c),this.modules.layertree.tree.setItemChecked(d,!0)):(this.modules.map.removeLayer(d),this.modules.layertree.tree.setItemChecked(d,!1))}}};
|
||||
netgis.Client.prototype.onIconbarItemClick=function(a){a=a.detail;for(var b=this.config.layers,c=0;c<b.length;c++){var d=b[c],e=d.id;"background"!==d.folder&&(e===a.id?(this.modules.map.addLayer(e,d),this.modules.layertree.tree.setItemChecked(e,!0)):(this.modules.map.removeLayer(e),this.modules.layertree.tree.setItemChecked(e,!1)))}};
|
||||
netgis.Client.prototype.onSwitcherButtonClick=function(a){a=a.detail;for(var b=this.config.switcher.buttons,c=this.config.layers,d=0;d<b.length;d++){var e=b[d].id;if(e===a.id)for(var f=0;f<c.length;f++){var g=c[f];g.id===e&&(this.modules.map.addLayer(e,g),this.modules.layertree.tree.setItemChecked(e,!0))}else this.modules.map.removeLayer(e),this.modules.layertree.tree.setItemChecked(e,!1)}0===this.modules.switcher.getIndex(a.id)&&this.modules.switcher.shift(1,0)};
|
||||
netgis.Client.prototype.onGeolocationToggle=function(a){this.modules.map.setGeolocMarkerVisible(a.detail.on)};netgis.Client.prototype.onGeolocationChange=function(a){a=a.detail;this.modules.map.zoomLonLat(a.lon,a.lat,this.config.geolocation.zoom);this.modules.map.setGeolocMarkerLonLat(a.lon,a.lat)};netgis.Client.prototype.onMapEditLayerChange=function(a){a=JSON.stringify(a.detail.geojson);this.output.value=a};
|
||||
netgis.Client.handleCommand=function(a,b){switch(b){case netgis.Commands.LAYERTREE:netgis.util.invoke(a,netgis.Events.LAYERTREE_TOGGLE,null);break;case netgis.Commands.SEARCHPLACE:netgis.util.invoke(a,netgis.Events.SEARCHPLACE_TOGGLE,null);break;case netgis.Commands.SEARCHPARCEL:netgis.util.invoke(a,netgis.Events.SEARCHPARCEL_TOGGLE,null);break;case netgis.Commands.TOOLBOX:netgis.util.invoke(a,netgis.Events.TOOLBOX_TOGGLE,null);break;case netgis.Commands.VIEW_PREV:netgis.util.invoke(a,netgis.Events.MAP_VIEW_PREV,
|
||||
null);break;case netgis.Commands.VIEW_NEXT:netgis.util.invoke(a,netgis.Events.MAP_VIEW_NEXT,null);break;case netgis.Commands.VIEW:netgis.util.invoke(a,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.VIEW});break;case netgis.Commands.ZOOM_BOX:netgis.util.invoke(a,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.ZOOM_BOX});break;case netgis.Commands.ZOOM_SCALE:b=Number.parseInt(a.innerText.split(":")[1]);netgis.util.invoke(a,netgis.Events.MAP_ZOOM_SCALE,{scale:b,anim:!0});break;case netgis.Commands.MEASURE_LINE:netgis.util.invoke(a,
|
||||
netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.MEASURE_LINE});break;case netgis.Commands.MEASURE_AREA:netgis.util.invoke(a,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.MEASURE_AREA});break;case netgis.Commands.MEASURE_CLEAR:netgis.util.invoke(a,netgis.Events.MEASURE_CLEAR,null);break;case netgis.Commands.DRAW_POINTS:netgis.util.invoke(a,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.DRAW_POINTS});break;case netgis.Commands.DRAW_LINES:netgis.util.invoke(a,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.DRAW_LINES});
|
||||
break;case netgis.Commands.DRAW_POLYGONS:netgis.util.invoke(a,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.DRAW_POLYGONS});break;case netgis.Commands.MODIFY_FEATURES:netgis.util.invoke(a,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.MODIFY_FEATURES});break;case netgis.Commands.DELETE_FEATURES:netgis.util.invoke(a,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.DELETE_FEATURES});break;case netgis.Commands.BUFFER_FEATURES:netgis.util.invoke(a,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.BUFFER_FEATURES_DYNAMIC});
|
||||
break;case netgis.Commands.CUT_FEATURES:netgis.util.invoke(a,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.CUT_FEATURES});break;case netgis.Commands.IMPORT_LAYER:netgis.util.invoke(a,netgis.Events.IMPORT_LAYER_SHOW,null);break;case netgis.Commands.EXPORT:netgis.util.invoke(a,netgis.Events.EXPORT_SHOW,null);break;default:console.warn("unhandled command id",b)}};netgis=netgis||{};
|
||||
netgis.Commands=Object.freeze({LAYERTREE:"layertree",SEARCHPLACE:"searchplace",SEARCHPARCEL:"searchparcel",TOOLBOX:"toolbox",VIEW_PREV:"view_prev",VIEW_NEXT:"view_next",VIEW:"view",ZOOM_BOX:"zoom_box",ZOOM_SCALE:"zoom_scale",MEASURE_LINE:"measure_line",MEASURE_AREA:"measure_area",MEASURE_CLEAR:"measure_clear",DRAW_POINTS:"draw_points",DRAW_LINES:"draw_lines",DRAW_POLYGONS:"draw_polygons",MODIFY_FEATURES:"modify_features",DELETE_FEATURES:"delete_features",BUFFER_FEATURES:"buffer_features",CUT_FEATURES:"cut_features",
|
||||
SNAP_TOGGLE:"snap_toggle",IMPORT_LAYER:"import_layer",EXPORT:"export"});netgis=netgis||{};netgis.ContextMenu=function(){this.initElements()};netgis.ContextMenu.prototype.initElements=function(){this.container=document.createElement("div");this.container.className="netgis-contextmenu netgis-shadow-large netgis-color-e netgis-hide"};
|
||||
netgis.Client.handleCommand=function(a,b){switch(b){case netgis.Commands.LAYERTREE:netgis.util.invoke(a,netgis.Events.LAYERTREE_TOGGLE,null);break;case netgis.Commands.SEARCHPLACE:netgis.util.invoke(a,netgis.Events.SEARCHPLACE_TOGGLE,null);break;case netgis.Commands.SEARCHPARCEL:netgis.util.invoke(a,netgis.Events.SEARCHPARCEL_TOGGLE,null);break;case netgis.Commands.TOOLBOX:netgis.util.invoke(a,netgis.Events.TOOLBOX_TOGGLE,null);break;case netgis.Commands.LEGEND:netgis.util.invoke(a,netgis.Events.LEGEND_TOGGLE,
|
||||
null);break;case netgis.Commands.VIEW_PREV:netgis.util.invoke(a,netgis.Events.MAP_VIEW_PREV,null);break;case netgis.Commands.VIEW_NEXT:netgis.util.invoke(a,netgis.Events.MAP_VIEW_NEXT,null);break;case netgis.Commands.VIEW:netgis.util.invoke(a,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.VIEW});break;case netgis.Commands.ZOOM_BOX:netgis.util.invoke(a,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.ZOOM_BOX});break;case netgis.Commands.ZOOM_SCALE:b=Number.parseInt(a.innerText.split(":")[1]);netgis.util.invoke(a,
|
||||
netgis.Events.MAP_ZOOM_SCALE,{scale:b,anim:!0});break;case netgis.Commands.MEASURE_LINE:netgis.util.invoke(a,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.MEASURE_LINE});break;case netgis.Commands.MEASURE_AREA:netgis.util.invoke(a,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.MEASURE_AREA});break;case netgis.Commands.MEASURE_CLEAR:netgis.util.invoke(a,netgis.Events.MEASURE_CLEAR,null);break;case netgis.Commands.DRAW_POINTS:netgis.util.invoke(a,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.DRAW_POINTS});
|
||||
break;case netgis.Commands.DRAW_LINES:netgis.util.invoke(a,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.DRAW_LINES});break;case netgis.Commands.DRAW_POLYGONS:netgis.util.invoke(a,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.DRAW_POLYGONS});break;case netgis.Commands.MODIFY_FEATURES:netgis.util.invoke(a,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.MODIFY_FEATURES});break;case netgis.Commands.DELETE_FEATURES:netgis.util.invoke(a,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.DELETE_FEATURES});
|
||||
break;case netgis.Commands.BUFFER_FEATURES:netgis.util.invoke(a,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.BUFFER_FEATURES_DYNAMIC});break;case netgis.Commands.CUT_FEATURES:netgis.util.invoke(a,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.CUT_FEATURES});break;case netgis.Commands.IMPORT_LAYER:netgis.util.invoke(a,netgis.Events.IMPORT_LAYER_SHOW,null);break;case netgis.Commands.EXPORT:netgis.util.invoke(a,netgis.Events.EXPORT_SHOW,null);break;case netgis.Commands.GEOLOCATION:netgis.util.invoke(a,
|
||||
netgis.Events.GEOLOCATION_SHOW_OPTIONS,null);break;default:console.error("unhandled command id",b)}};netgis=netgis||{};
|
||||
netgis.Commands=Object.freeze({LAYERTREE:"layertree",SEARCHPLACE:"searchplace",SEARCHPARCEL:"searchparcel",TOOLBOX:"toolbox",LEGEND:"legend",VIEW_PREV:"view_prev",VIEW_NEXT:"view_next",VIEW:"view",ZOOM_BOX:"zoom_box",ZOOM_SCALE:"zoom_scale",MEASURE_LINE:"measure_line",MEASURE_AREA:"measure_area",MEASURE_CLEAR:"measure_clear",DRAW_POINTS:"draw_points",DRAW_LINES:"draw_lines",DRAW_POLYGONS:"draw_polygons",MODIFY_FEATURES:"modify_features",DELETE_FEATURES:"delete_features",BUFFER_FEATURES:"buffer_features",CUT_FEATURES:"cut_features",
|
||||
SNAP_TOGGLE:"snap_toggle",IMPORT_LAYER:"import_layer",EXPORT:"export",GEOLOCATION:"geolocation"});netgis=netgis||{};netgis.ContextMenu=function(){this.initElements()};netgis.ContextMenu.prototype.initElements=function(){this.container=document.createElement("div");this.container.className="netgis-contextmenu netgis-shadow-large netgis-color-e netgis-hide"};
|
||||
netgis.ContextMenu.prototype.attachTo=function(a){a.appendChild(this.container);a.addEventListener(netgis.Events.CONTEXTMENU_SHOW,this.onContextMenuShow.bind(this));a.addEventListener("click",this.onParentClick.bind(this));a.addEventListener("pointerup",this.onParentClick.bind(this));a.addEventListener("scroll",this.onParentScroll.bind(this),!0);a.addEventListener("keydown",this.onParentKeyDown.bind(this))};netgis.ContextMenu.prototype.clear=function(){this.container.innerHTML=""};
|
||||
netgis.ContextMenu.prototype.addButton=function(a,b){var c=document.createElement("button");c.className="netgis-button netgis-clip-text netgis-hover-d";c.innerHTML=b;c.setAttribute("type","button");c.setAttribute("data-id",a);c.addEventListener("click",this.onButtonClick.bind(this));this.container.appendChild(c);return c};
|
||||
netgis.ContextMenu.prototype.addCheckbox=function(a,b,c){var d=document.createElement("label");d.className="netgis-noselect netgis-hover-d";var e=document.createElement("input");e.setAttribute("type","checkbox");e.setAttribute("title",b);e.setAttribute("data-id",a);e.checked=c;e.addEventListener("change",this.onCheckboxChange.bind(this));d.appendChild(e);a=document.createElement("span");a.className="netgis-clip-text";a.innerHTML=b;d.appendChild(a);this.container.appendChild(d);return e};
|
||||
@ -43,15 +44,22 @@ netgis.ContextMenu.prototype.setPosition=function(a,b){var c=this.container.pare
|
||||
netgis.ContextMenu.prototype.onContextMenuShow=function(a){a=a.detail;this.clear();for(var b=0;b<a.items.length;b++){var c=a.items[b];switch(c.type){case "slider":this.addSlider(c.id,c.title,c.val,c.min,c.max)}}this.setVisible(!0);this.setPosition(a.x,a.y)};netgis.ContextMenu.prototype.onContextMenu=function(a){a.preventDefault();var b=a.clientX;a=a.clientY;this.setVisible(!0);this.setPosition(b,a);return!1};
|
||||
netgis.ContextMenu.prototype.onParentClick=function(a){this.container.contains(a.target)||this.setVisible(!1)};netgis.ContextMenu.prototype.onParentScroll=function(a){this.setVisible(!1)};netgis.ContextMenu.prototype.onParentKeyDown=function(a){27===(a.keyCode||a.which)&&this.setVisible(!1)};
|
||||
netgis.ContextMenu.prototype.onButtonClick=function(a){a=a.currentTarget;var b=a.getAttribute("data-id");this.setVisible(!1);netgis.util.invoke(a,netgis.Events.CONTEXTMENU_BUTTON_CLICK,{id:b});netgis.Client.handleCommand(a,b)};netgis.ContextMenu.prototype.onCheckboxChange=function(a){a=a.currentTarget;var b=a.getAttribute("data-id");netgis.util.invoke(a,netgis.Events.CONTEXTMENU_CHECKBOX_CHANGE,{id:b,checked:a.checked})};
|
||||
netgis.ContextMenu.prototype.onSliderChange=function(a){a=a.currentTarget;var b=a.getAttribute("data-id"),c=Number.parseFloat(a.value),d=a.getAttribute("data-title");a.setAttribute("title",d+" "+c);netgis.util.invoke(a,netgis.Events.CONTEXTMENU_SLIDER_CHANGE,{id:b,val:c})};netgis=netgis||{};netgis.Controls=function(a){this.config=a;this.initElements();this.initConfig(a)};netgis.Controls.Events=Object.freeze({BUTTON_CLICK:"controls-button-click"});netgis.Controls.prototype.initElements=function(){this.container=document.createElement("section");this.container.className="netgis-controls netgis-color-e netgis-text-a netgis-shadow netgis-round"};
|
||||
netgis.Controls.prototype.initConfig=function(a){a=a.controls.buttons;for(var b=0;b<a.length;b++){var c=a[b];this.addButton(c.id,c.icon,c.title)}};netgis.Controls.prototype.attachTo=function(a){a.appendChild(this.container)};
|
||||
netgis.ContextMenu.prototype.onSliderChange=function(a){a=a.currentTarget;var b=a.getAttribute("data-id"),c=Number.parseFloat(a.value),d=a.getAttribute("data-title");a.setAttribute("title",d+" "+c);netgis.util.invoke(a,netgis.Events.CONTEXTMENU_SLIDER_CHANGE,{id:b,val:c})};netgis=netgis||{};netgis.Controls=function(a){this.config=a;this.initElements(a);this.initConfig(a)};
|
||||
netgis.Controls.prototype.initElements=function(a){this.container=document.createElement("section");this.container.className="netgis-controls netgis-color-e netgis-text-a netgis-shadow netgis-round";if(!0===a.modules.geolocation){this.popupGeoloc=new netgis.Popup({direction:"right"});this.popupGeoloc.container.style.width="60mm";this.popupGeoloc.setHeader("Ger\u00e4te-Standort");a=document.createElement("label");a.className="netgis-hover-d netgis-clip-text netgis-clickable netgis-noselect";var b=
|
||||
document.createElement("input");b.setAttribute("type","checkbox");b.addEventListener("change",this.onInputGeolocActiveChange.bind(this));a.appendChild(b);this.inputGeolocActive=b;b=document.createElement("span");b.innerHTML="Aktiviert";a.appendChild(b);this.popupGeoloc.wrapper.appendChild(a);a=document.createElement("label");a.className="netgis-hover-d netgis-clip-text netgis-clickable netgis-noselect";b=document.createElement("input");b.setAttribute("type","checkbox");b.addEventListener("change",
|
||||
this.onInputGeolocCenterChange.bind(this));a.appendChild(b);this.inputGeolocCenter=b;b=document.createElement("span");b.innerHTML="Zentriert";a.appendChild(b);this.popupGeoloc.wrapper.appendChild(a)}};netgis.Controls.prototype.initConfig=function(a){a=a.controls.buttons;for(var b=0;b<a.length;b++){var c=a[b];this.addButton(c.id,c.icon,c.title)}};
|
||||
netgis.Controls.prototype.attachTo=function(a){a.appendChild(this.container);this.popupGeoloc.attachTo(a);a.addEventListener(netgis.Events.GEOLOCATION_SHOW_OPTIONS,this.onGeolocShowOptions.bind(this));a.addEventListener(netgis.Events.GEOLOCATION_TOGGLE_ACTIVE,this.onGeolocToggleActive.bind(this));a.addEventListener(netgis.Events.GEOLOCATION_TOGGLE_CENTER,this.onGeolocToggleCenter.bind(this));a.addEventListener("pointerdown",this.onParentPointerDown.bind(this))};
|
||||
netgis.Controls.prototype.addButton=function(a,b,c){var d=document.createElement("button");d.setAttribute("type","button");d.setAttribute("data-id",a);d.className="netgis-hover-a";d.innerHTML=b;d.title=c;d.addEventListener("pointerdown",this.onButtonClick.bind(this));this.container.appendChild(d);return d};
|
||||
netgis.Controls.prototype.onButtonClick=function(a){a=a.currentTarget;switch(a.getAttribute("data-id")){case "zoom_in":netgis.util.invoke(a,netgis.Events.MAP_ZOOM,{delta:1});break;case "zoom_out":netgis.util.invoke(a,netgis.Events.MAP_ZOOM,{delta:-1});break;case "zoom_home":netgis.util.invoke(a,netgis.Events.MAP_ZOOM_HOME,null)}};netgis=netgis||{};
|
||||
netgis.Controls.prototype.onButtonClick=function(a){a=a.currentTarget;var b=a.getAttribute("data-id");switch(b){case "zoom_in":netgis.util.invoke(a,netgis.Events.MAP_ZOOM,{delta:1});break;case "zoom_out":netgis.util.invoke(a,netgis.Events.MAP_ZOOM,{delta:-1});break;case "zoom_home":netgis.util.invoke(a,netgis.Events.MAP_ZOOM_HOME,null);break;default:netgis.Client.handleCommand(a,b)}};
|
||||
netgis.Controls.prototype.onGeolocShowOptions=function(a){a=this.container.getElementsByTagName("button");for(var b=null,c=0;c<a.length;c++)if(a[c].getAttribute("data-id")===netgis.Commands.GEOLOCATION){b=a[c];break}b&&(this.popupGeoloc.isVisible()?this.popupGeoloc.hide():(this.popupGeoloc.show(),a=b.getBoundingClientRect(),this.popupGeoloc.setPosition(a.x+4,a.y+.5*a.height)))};
|
||||
netgis.Controls.prototype.onParentPointerDown=function(a){netgis.util.insideElement(this.container,a.clientX,a.clientY)||this.popupGeoloc.hide()};netgis.Controls.prototype.onInputGeolocActiveChange=function(a){a=a.currentTarget;netgis.util.invoke(a,netgis.Events.GEOLOCATION_TOGGLE_ACTIVE,{on:a.checked})};netgis.Controls.prototype.onInputGeolocCenterChange=function(a){a=a.currentTarget;netgis.util.invoke(a,netgis.Events.GEOLOCATION_TOGGLE_CENTER,{on:a.checked})};
|
||||
netgis.Controls.prototype.onGeolocToggleActive=function(a){a.target!==this.inputGeolocActive&&(this.inputGeolocActive.checked=a.detail.on)};netgis.Controls.prototype.onGeolocToggleCenter=function(a){a.target!==this.inputGeolocCenter&&(this.inputGeolocCenter.checked=a.detail.on)};netgis=netgis||{};
|
||||
netgis.Events=Object.freeze({CLIENT_CONTEXT_RESPONSE:"client-context-response",CLIENT_SET_MODE:"client-set-mode",CONTROLS_BUTTON_CLICK:"controls-button-click",MAP_ZOOM:"map-zoom",MAP_ZOOM_HOME:"map-zoom-home",MAP_ZOOM_LONLAT:"map-zoom-lonlat",MAP_ZOOM_SCALE:"map-zoom-scale",MAP_ZOOM_LAYER:"map-zoom-layer",MAP_ZOOM_LEVEL:"map-zoom-level",MAP_LAYER_TOGGLE:"map-layer-toggle",MAP_LAYER_TRANSPARENCY:"map-layer-transparency",MAP_VIEW_CHANGE:"map-view-change",MAP_VIEW_NEXT:"map-view-next",MAP_VIEW_PREV:"map-view-prev",
|
||||
MAP_CLICK:"map-click",MAP_FEATURE_ENTER:"map-feature-enter",MAP_FEATURE_CLICK:"map-feature-click",MAP_FEATURE_LEAVE:"map-feature-leave",MAP_SNAP_TOGGLE:"map-snap-toggle",MAP_EDIT_LAYER_CHANGE:"map-edit-layer-change",MAP_EDIT_LAYER_LOADED:"map-edit-layer-loaded",MAP_COPY_FEATURE_TO_EDIT:"map-copy-feature-to-edit",PANEL_TOGGLE:"panel-toggle",PANEL_RESIZE:"panel-resize",TREE_ITEM_CHANGE:"tree-item-change",TREE_ITEM_SLIDER_CHANGE:"tree-item-slider-change",TREE_BUTTON_CLICK:"tree-button-click",LAYERTREE_TOGGLE:"layertree-toggle",
|
||||
TOOLBOX_TOGGLE:"toolbox-toggle",TOOLBOX_BUTTON_CLICK:"toolbox-button-click",MENU_BUTTON_CLICK:"menu-button-click",MENU_CHECKBOX_CHANGE:"menu-checkbox-change",MENU_SELECT_CHANGE:"menu-select-change",CONTEXTMENU_SHOW:"contextmenu-show",CONTEXTMENU_BUTTON_CLICK:"contextmenu-button-click",CONTEXTMENU_CHECKBOX_CHANGE:"contextmenu-checkbox-change",CONTEXTMENU_SLIDER_CHANGE:"contextmenu-slider-change",SEARCH_CHANGE:"search-change",SEARCH_SELECT:"search-select",SEARCH_CLEAR:"search-clear",SEARCHPLACE_TOGGLE:"searchplace-toggle",
|
||||
SEARCHPARCEL_TOGGLE:"searchparcel-toggle",SEARCHPARCEL_RESET:"searchparcel-reset",SEARCHPARCEL_PARCELS_RESPONSE:"searchparcel-parcels-response",SEARCHPARCEL_ITEM_ENTER:"searchparcel-item-enter",SEARCHPARCEL_ITEM_LEAVE:"searchparcel-item-leave",SEARCHPARCEL_ITEM_CLICK:"searchparcel-item-click",SEARCHPARCEL_ITEM_IMPORT:"searchparcel-item-import",MEASURE_CLEAR:"measure-clear",DRAW_BUFFER_TOGGLE:"draw-buffer-toggle",DRAW_BUFFER_CHANGE:"draw-buffer-change",BUFFER_CHANGE:"buffer-change",BUFFER_ACCEPT:"buffer-accept",
|
||||
IMPORT_LAYER_SHOW:"import-layer-show",IMPORT_LAYER_ACCEPT:"import-layer-accept",IMPORT_LAYER_PREVIEW:"import-layer-preview",IMPORT_LAYER_PREVIEW_FEATURES:"import-layer-preview-features",IMPORT_GEOPORTAL_SUBMIT:"import-geoportal-submit",EXPORT_SHOW:"export-show",EXPORT_BEGIN:"export-begin",EXPORT_END:"export-end",TIMESLIDER_SHOW:"timeslider-show",TIMESLIDER_HIDE:"timeslider-hide",TIMESLIDER_SELECT:"timeslider-select"});netgis=netgis||{};netgis.Export=function(a){this.config=a;this.initElements(a);this.initSections()};
|
||||
LEGEND_TOGGLE:"legend-toggle",GEOLOCATION_SHOW_OPTIONS:"geolocation-show-options",GEOLOCATION_TOGGLE_ACTIVE:"geolocation-toggle-active",GEOLOCATION_TOGGLE_CENTER:"geolocation-toggle-center",GEOLOCATION_CHANGE:"geolocation-change",TOOLBOX_TOGGLE:"toolbox-toggle",TOOLBOX_BUTTON_CLICK:"toolbox-button-click",MENU_BUTTON_CLICK:"menu-button-click",MENU_CHECKBOX_CHANGE:"menu-checkbox-change",MENU_SELECT_CHANGE:"menu-select-change",CONTEXTMENU_SHOW:"contextmenu-show",CONTEXTMENU_BUTTON_CLICK:"contextmenu-button-click",
|
||||
CONTEXTMENU_CHECKBOX_CHANGE:"contextmenu-checkbox-change",CONTEXTMENU_SLIDER_CHANGE:"contextmenu-slider-change",SEARCH_CHANGE:"search-change",SEARCH_SELECT:"search-select",SEARCH_CLEAR:"search-clear",SEARCHPLACE_TOGGLE:"searchplace-toggle",SEARCHPARCEL_TOGGLE:"searchparcel-toggle",SEARCHPARCEL_RESET:"searchparcel-reset",SEARCHPARCEL_PARCELS_RESPONSE:"searchparcel-parcels-response",SEARCHPARCEL_ITEM_ENTER:"searchparcel-item-enter",SEARCHPARCEL_ITEM_LEAVE:"searchparcel-item-leave",SEARCHPARCEL_ITEM_CLICK:"searchparcel-item-click",
|
||||
SEARCHPARCEL_ITEM_IMPORT:"searchparcel-item-import",MEASURE_CLEAR:"measure-clear",DRAW_BUFFER_TOGGLE:"draw-buffer-toggle",DRAW_BUFFER_CHANGE:"draw-buffer-change",BUFFER_CHANGE:"buffer-change",BUFFER_ACCEPT:"buffer-accept",IMPORT_LAYER_SHOW:"import-layer-show",IMPORT_LAYER_ACCEPT:"import-layer-accept",IMPORT_LAYER_PREVIEW:"import-layer-preview",IMPORT_LAYER_PREVIEW_FEATURES:"import-layer-preview-features",IMPORT_GEOPORTAL_SUBMIT:"import-geoportal-submit",EXPORT_SHOW:"export-show",EXPORT_BEGIN:"export-begin",
|
||||
EXPORT_END:"export-end",TIMESLIDER_SHOW:"timeslider-show",TIMESLIDER_HIDE:"timeslider-hide",TIMESLIDER_SELECT:"timeslider-select"});netgis=netgis||{};netgis.Export=function(a){this.config=a;this.initElements(a);this.initSections()};
|
||||
netgis.Export.prototype.initElements=function(a){a=a["export"];this.modal=new netgis.Modal(a.title?a.title:"Export");this.modal.container.classList.add("netgis-export");this.tabs=new netgis.Tabs(["PDF","JPEG","PNG","GIF","GeoJSON"]);this.tabs.container.style.position="absolute";this.tabs.container.style.left="0mm";this.tabs.container.style.right="0mm";this.tabs.container.style.top="12mm";this.tabs.container.style.bottom="0mm";this.tabs.attachTo(this.modal.content)};
|
||||
netgis.Export.prototype.initSections=function(){this.sections={};var a=0;this.sections.pdf=this.tabs.getContentSection(a);a+=1;this.addInputNumber(this.sections.pdf,"Breite (Pixel):",1600,0);this.addInputNumber(this.sections.pdf,"H\u00f6he (Pixel):",900,0);this.addInputNumber(this.sections.pdf,"Seitenr\u00e4nder (Millimeter):",10,0);this.addCheckbox(this.sections.pdf,"Querformat",!0);this.addButton(this.sections.pdf,"<i class='netgis-icon fas fa-save'></i><span>Exportieren</span>",this.onExportClickPDF.bind(this));
|
||||
this.sections.jpeg=this.tabs.getContentSection(a);a+=1;this.addInputNumber(this.sections.jpeg,"Breite (Pixel):",1600,0);this.addInputNumber(this.sections.jpeg,"H\u00f6he (Pixel):",900,0);this.addCheckbox(this.sections.jpeg,"Querformat",!0);this.addButton(this.sections.jpeg,"<i class='netgis-icon fas fa-save'></i><span>Exportieren</span>",this.onExportClickJPEG.bind(this));this.sections.png=this.tabs.getContentSection(a);a+=1;this.addInputNumber(this.sections.png,"Breite (Pixel):",1600,0);this.addInputNumber(this.sections.png,
|
||||
@ -66,7 +74,11 @@ netgis.Export.prototype.onExportClickPDF=function(a){var b=this.sections.pdf.get
|
||||
netgis.Export.prototype.onExportClickJPEG=function(a){var b=this.sections.pdf.getElementsByTagName("input");b={format:"jpeg",width:Number.parseInt(b[0].value),height:Number.parseInt(b[1].value),landscape:b[3].checked};netgis.util.invoke(a.target,netgis.Events.EXPORT_BEGIN,b)};
|
||||
netgis.Export.prototype.onExportClickPNG=function(a){var b=this.sections.pdf.getElementsByTagName("input");b={format:"png",width:Number.parseInt(b[0].value),height:Number.parseInt(b[1].value),landscape:b[3].checked};netgis.util.invoke(a.target,netgis.Events.EXPORT_BEGIN,b)};
|
||||
netgis.Export.prototype.onExportClickGIF=function(a){var b=this.sections.pdf.getElementsByTagName("input");b={format:"gif",width:Number.parseInt(b[0].value),height:Number.parseInt(b[1].value),landscape:b[3].checked};netgis.util.invoke(a.target,netgis.Events.EXPORT_BEGIN,b)};netgis.Export.prototype.onExportClickGeoJSON=function(a){var b={format:"geojson",nonEdits:this.sections.geojson.getElementsByTagName("input")[0].checked};netgis.util.invoke(a.target,netgis.Events.EXPORT_BEGIN,b)};
|
||||
netgis.Export.prototype.onExportEnd=function(a){this.modal.hide()};netgis=netgis||{};netgis.Import=function(a){this.config=a;this.initElements(a);this.initSections();this.initPreview()};
|
||||
netgis.Export.prototype.onExportEnd=function(a){this.modal.hide()};netgis=netgis||{};netgis.Geolocation=function(a){this.config=a;this.center=this.active=!1};netgis.Geolocation.prototype.initConfig=function(a){};netgis.Geolocation.prototype.attachTo=function(a){this.container=a;a.addEventListener(netgis.Events.GEOLOCATION_TOGGLE_ACTIVE,this.onGeolocToggleActive.bind(this));a.addEventListener(netgis.Events.GEOLOCATION_TOGGLE_CENTER,this.onGeolocToggleCenter.bind(this))};
|
||||
netgis.Geolocation.prototype.setActive=function(a,b){var c=this.config.geolocation;a?navigator.geolocation?(this.watch=navigator.geolocation.watchPosition(this.onPositionChange.bind(this),this.onPositionError.bind(this),{timeout:c&&c.timeout?1E3*c.timeout:1E4,maximumAge:0,enableHighAccuracy:!0}),b||netgis.util.invoke(this.container,netgis.Events.GEOLOCATION_TOGGLE_ACTIVE,{on:!0})):this.error("Geolocation not supported by this device!"):(this.watch&&(navigator.geolocation.clearWatch(this.watch),this.watch=
|
||||
null),b||netgis.util.invoke(this.container,netgis.Events.GEOLOCATION_TOGGLE_ACTIVE,{on:!1}));this.active=a};netgis.Geolocation.prototype.isActive=function(){return this.active};netgis.Geolocation.prototype.error=function(a){console.error(a);this.watch&&(navigator.geolocation.clearWatch(this.watch),this.watch=null);netgis.util.invoke(this.container,netgis.Events.GEOLOCATION_TOGGLE_ACTIVE,{on:!1})};netgis.Geolocation.prototype.onActiveChange=function(a){this.setActive(a.currentTarget.checked)};
|
||||
netgis.Geolocation.prototype.onCenterChange=function(a){};netgis.Geolocation.prototype.onPositionChange=function(a){netgis.util.invoke(this.container,netgis.Events.GEOLOCATION_CHANGE,{lon:a.coords.longitude,lat:a.coords.latitude,center:this.center})};netgis.Geolocation.prototype.onPositionError=function(a){this.error("Geolocation: "+a.message+" ("+a.code+")")};netgis.Geolocation.prototype.onGeolocToggleActive=function(a){a.target!==this.container&&this.setActive(a.detail.on)};
|
||||
netgis.Geolocation.prototype.onGeolocToggleCenter=function(a){a.target!==this.container&&(this.center=a.detail.on)};netgis=netgis||{};netgis.Import=function(a){this.config=a;this.initElements(a);this.initSections();this.initPreview()};
|
||||
netgis.Import.prototype.initElements=function(a){a=a["import"];this.modal=new netgis.Modal(a.title?a.title:"Import");this.modal.container.classList.add("netgis-import");var b="WMS WFS GeoJSON GML GeoPackage Spatialite Shapefile".split(" ");a.geoportal_tab&&b.unshift("Geoportal");this.tabs=new netgis.Tabs(b);this.tabs.container.style.position="absolute";this.tabs.container.style.left="0mm";this.tabs.container.style.right="0mm";this.tabs.container.style.top="12mm";this.tabs.container.style.bottom="0mm";
|
||||
this.tabs.attachTo(this.modal.content)};
|
||||
netgis.Import.prototype.initSections=function(){this.sections={};var a=0;this.config["import"].geoportal_tab&&(this.sections.geoportal=this.tabs.getContentSection(a),a+=1,this.sections.geoportal.classList.add("netgis-geoportal"),this.geoportalSearch=this.addInputText(this.sections.geoportal,"Suche im Datenkatalog:"),this.geoportalSearch.addEventListener("change",this.onGeoportalSearchChange.bind(this)),this.geoportalSearch.setAttribute("placeholder","Thema, Schlagwort..."),this.geoportalResults=new netgis.Tree,
|
||||
@ -92,7 +104,7 @@ netgis.Import.prototype.onWMSLoadClick=function(a){this.showDetailsWMS(!1);var b
|
||||
netgis.Import.prototype.onWMSCapsResponse=function(a){var b=(new DOMParser).parseFromString(a,"text/xml"),c=b.documentElement;b=b.getElementsByTagName("parsererror");for(var d=0;d<b.length;d++)console.error("WMS caps parser error:",b[d].textContent);0<b.length&&alert(0<a.length?a:b[0].textContent);a=this.sections.wms;var e=a.getElementsByTagName("input");a=a.getElementsByTagName("select");b=a[0];a=a[1];for(d=b.options.length-1;0<=d;d--)b.options.remove(d);for(d=a.options.length-1;0<=d;d--)a.options.remove(d);
|
||||
switch(c.nodeName){default:case "HTML":console.warn("could not detect WMS service",c);break;case "WMS_Capabilities":case "WMT_MS_Capabilities":c.getAttribute("version");d=c.getElementsByTagName("Service")[0].getElementsByTagName("Title")[0].textContent;e[1].value=d;d=c.getElementsByTagName("Layer");for(var f=[],g=0;g<d.length;g++){e=d[g];var h=e.getElementsByTagName("Name")[0].textContent,k=e.getElementsByTagName("Title")[0].textContent;f.push({name:h,title:k});e=document.createElement("option");
|
||||
e.text=k;e.value=h;b.options.add(e)}c=c.getElementsByTagName("GetMap")[0].getElementsByTagName("Format");b=[];for(d=0;d<c.length;d++)e=c[d],f=e.textContent,b.push(f),e=document.createElement("option"),e.text=f,e.value=f,a.options.add(e)}this.showDetailsWMS(!0)};
|
||||
netgis.Import.prototype.onWMSAcceptClick=function(a){a=this.sections.wms;var b=a.getElementsByTagName("input"),c=a.getElementsByTagName("select"),d="import_"+netgis.util.getTimeStamp(!0);b=b[0].value;var e=c[0].selectedOptions[0].innerText,f=c[0].value;c=c[1].value;b=netgis.util.replace(b,"request=","oldrequest=");b=netgis.util.replace(b,"Request=","oldrequest=");d={id:d,folder:null,active:!0,order:this.getLayerOrder(),type:netgis.LayerTypes.WMS,url:b,title:e,name:f,format:c,tiled:!0};this.config.layers.push(d);
|
||||
netgis.Import.prototype.onWMSAcceptClick=function(a){a=this.sections.wms;var b=a.getElementsByTagName("input"),c=a.getElementsByTagName("select"),d="import_"+netgis.util.getTimeStamp(!0);b=b[0].value;var e=c[0].selectedOptions[0].innerText,f=c[0].value;c=c[1].value;b=netgis.util.replace(b,"request=","oldrequest=");b=netgis.util.replace(b,"Request=","oldrequest=");d={id:d,folder:null,active:!0,query:!0,order:this.getLayerOrder(),type:netgis.LayerTypes.WMS,url:b,title:e,name:f,format:c,tiled:!0};this.config.layers.push(d);
|
||||
netgis.util.invoke(a,netgis.Events.IMPORT_LAYER_ACCEPT,d);this.modal.hide()};
|
||||
netgis.Import.prototype.onWFSLoadClick=function(a){this.showDetailsWFS(!1);var b=this.sections.wfs.getElementsByTagName("input")[0].value;b=b.trim();if(!(1>b.length)){var c=b.indexOf("?");a=-1<c?b.substr(0,c):b;var d=["request=GetCapabilities"];if(-1<c)for(b=b.substr(c+1),b=b.split("&"),c=0;c<b.length;c++){var e=b[c];e=e.toLowerCase();-1<e.search("service")?d.push(e):-1<e.search("version")?d.push(e):-1<e.search("request")||d.push(e)}d=d.join("&");-1===d.search("service=")&&(d+="&service=WFS");a=a+
|
||||
"?"+d;this.config["import"].wfs_proxy&&(a=this.config["import"].wfs_proxy+a);netgis.util.request(a,this.onWFSCapsResponse.bind(this))}};
|
||||
@ -115,34 +127,40 @@ ol.geom.LineString)k+=" ("+netgis.util.formatArea(h.getLength())+")";else if(h i
|
||||
netgis.Import.prototype.onPreviewSubmitClick=function(a){var b=this.previewTree.container.getElementsByClassName("netgis-folder")[0];a=b.getAttribute("data-id");b=b.getElementsByTagName("span")[0].innerText;for(var c=this.previewTree.container.getElementsByTagName("input"),d=this.previewMap.getLayers().getArray()[1].getSource(),e=[],f=1;f<c.length;f++){var g=c[f];g.checked&&(g=g.getAttribute("data-id"),g=d.getFeatureById(g),e.push(g))}c=(new ol.format.GeoJSON).writeFeaturesObject(e);d=this.previewMap.getView().getProjection().getCode();
|
||||
c.crs={type:"name",properties:{name:"urn:ogc:def:crs:"+d.replace(":","::")}};a={id:a,folder:null,active:!0,order:this.getLayerOrder(),style:this.config.styles["import"],title:b,type:netgis.LayerTypes.GEOJSON,data:c};this.config.layers.push(a);netgis.util.invoke(this.preview.container,netgis.Events.IMPORT_LAYER_ACCEPT,a);this.preview.hide();this.modal.hide()};
|
||||
netgis.Import.prototype.onPreviewTreeItemChange=function(a){a=a.detail;var b=this.previewMap.getLayers().getArray()[1].getSource().getFeatureById(a.id);a.checked?b.setStyle(null):b.setStyle(new ol.style.Style({}))};netgis.Import.prototype.onGeoportalSearchChange=function(a){a=this.geoportalSearch.value;a=a.trim();var b=this.config["import"].geoportal_search_url;b=netgis.util.replace(b,"{query}",a);console.info("Geoportal Search:",b);netgis.util.request(b,this.onGeoportalSearchResponse.bind(this))};
|
||||
netgis.Import.prototype.onGeoportalSearchResponse=function(a){function b(a){if(a&&a.layer)for(var c=0;c<a.layer.length;c++)b(a.layer[c]);else a&&e.push(a);return e.length}a=JSON.parse(a);this.geoportalResults.clear();console.info("Geoportal Response:",a);this.geoportalDataRaw=a=a.wms.srv;this.geoportalData=[];for(var c=0;c<a.length;c++){var d=a[c];console.info("Result Layer:",d);var e=[];var f=b(d);f=this.geoportalResults.addFolder(null,c,d.title+" ("+f+")");f.setAttribute("title",d["abstract"]);
|
||||
for(var g=0;g<e.length;g++){var h=e[g];console.info("Result Child:",h);this.geoportalResults.addCheckbox(f,g,h.title)}d.children=e;this.geoportalData.push(d)}};
|
||||
netgis.Import.prototype.onGeoportalSubmit=function(a){console.info("Geoportal Submit...");a=this.geoportalResults.container.getElementsByClassName("netgis-item");for(var b=0,c=0;c<a.length;c++){var d=a[c],e=d.getElementsByTagName("input")[0];if(e.checked){b+=1;e=e.getAttribute("data-id");d=d.parentNode.parentNode.parentNode.getAttribute("data-id");var f=this.geoportalData[d],g=f.children[e];console.info("Item:",d,e,f,g);var h=f.title;f=f.getMapUrl;var k=g.name;g=g.title;d="geoportal_"+d;e=d+"_"+e;
|
||||
netgis.util.invoke(this.sections.geoportal,netgis.Events.IMPORT_GEOPORTAL_SUBMIT,{folder:{id:d,title:h},layer:{id:e,url:f,name:k,title:g}})}}0<b&&this.modal.hide()};netgis=netgis||{};netgis.Info=function(a){this.config=a;this.queryLayers={};this.popup=new netgis.Popup;this.popup.setHeader("Abfrage:");this.initConfig(a)};netgis.Info.prototype.initConfig=function(a){for(a=a.layers.length-1;0<=a;a--);};netgis.Info.prototype.attachTo=function(a){this.popup.attachTo(a);a.addEventListener(netgis.Events.MAP_CLICK,this.onMapClick.bind(this));a.addEventListener(netgis.Events.MAP_LAYER_TOGGLE,this.onMapLayerToggle.bind(this))};netgis.Info.prototype.onContextResponse=function(a){this.initConfig(a.detail.context.config)};
|
||||
netgis.Info.prototype.onMapLayerToggle=function(a){var b=a.detail;a=b.id;if(b.on){b=this.config.layers;for(var c=null,d=0;d<b.length;d++)if(b[d].id===a){c=b[d];break}if(c)switch(c.type){case netgis.LayerTypes.WMS:case netgis.LayerTypes.WMST:this.queryLayers[a]=c}}else delete this.queryLayers[a]};
|
||||
netgis.Info.prototype.onMapClick=function(a){a=a.detail;if(a.mode===netgis.Modes.VIEW){this.popup.container!==a.overlay&&this.popup.attachTo(a.overlay);this.popup.clearContent();var b=0,c;for(c in this.queryLayers){var d=this.queryLayers[c];switch(d.type){case netgis.LayerTypes.WMS:case netgis.LayerTypes.WMST:var e=d.url;d.query_url&&(e=d.query_url);var f=["service=WMS","version=1.1.0","request=GetFeatureInfo","styles=","layers="+window.encodeURIComponent(d.name),"query_layers="+window.encodeURIComponent(d.name),
|
||||
"bbox="+a.view.bbox.join(","),"srs="+a.view.projection,"width="+a.view.width,"height="+a.view.height,"x="+a.pixel[0],"y="+a.pixel[1],"info_format=text/html"];e=e+(-1===e.indexOf("?")?"?":"")+f.join("&");console.info("WMS REQUEST 1:",e);netgis.util.request(e,this.onLayerResponseWMS.bind(this),{title:d.title});b+=1}(e=d.query_url)&&""!==e&&(e=netgis.util.replace(e,"{bbox}",a.view.bbox.join(",")),e=netgis.util.replace(e,"{proj}",a.view.projection),e=netgis.util.replace(e,"{width}",a.view.width),e=netgis.util.replace(e,
|
||||
"{height}",a.view.height),e=netgis.util.replace(e,"{x}",a.pixel[0]),e=netgis.util.replace(e,"{y}",a.pixel[1]),e=netgis.util.replace(e,"{lon}",a.lon),e=netgis.util.replace(e,"{lat}",a.lat),console.info("WMS REQUEST 2:",e),netgis.util.request(e,this.onLayerResponseWMS.bind(this),{title:d.title}),b+=1)}0<b?(this.popup.showLoader(),this.popup.show()):this.popup.hide()}};
|
||||
netgis.Info.prototype.onLayerResponseWMS=function(a,b){this.popup.hideLoader();this.popup.addContent(["<details><summary class='netgis-button netgis-noselect netgis-clip-text netgis-color-e netgis-hover-d'>",b.title,"</summary><div>",a,"</div></details>"].join(""))};netgis=netgis||{};netgis.LayerID=Object.freeze({EDITABLE:"editable-layer",NON_EDITABLE:"non-editable-layer"});netgis=netgis||{};netgis.LayerTree=function(a){this.config=a;this.importFolder=null;this.initElements();this.initConfig(a);this.initFolders()};netgis.LayerTree.prototype.initElements=function(){this.panel=new netgis.Panel("Layers");this.tree=new netgis.Tree;this.tree.attachTo(this.panel.content);this.tree.container.addEventListener(netgis.Events.TREE_ITEM_CHANGE,this.onTreeItemChange.bind(this));this.tree.container.addEventListener(netgis.Events.TREE_ITEM_SLIDER_CHANGE,this.onTreeItemSliderChange.bind(this))};
|
||||
netgis.Import.prototype.onGeoportalSearchResponse=function(a){function b(a){if(a&&a.layer)for(var c=0;c<a.layer.length;c++)b(a.layer[c]);else a&&e.push(a);return e.length}a=JSON.parse(a);this.geoportalResults.clear();console.info("Geoportal Response:",a);this.geoportalDataRaw=a=a.wms.srv;this.geoportalData=[];for(var c=0;c<a.length;c++){var d=a[c];var e=[];var f=b(d);f=this.geoportalResults.addFolder(null,c,d.title+" ("+f+")");f.setAttribute("title",d["abstract"]);for(var g=0;g<e.length;g++)this.geoportalResults.addCheckbox(f,
|
||||
g,e[g].title);d.children=e;this.geoportalData.push(d)}};
|
||||
netgis.Import.prototype.onGeoportalSubmit=function(a){console.info("Geoportal Submit...");a=this.geoportalResults.container.getElementsByClassName("netgis-item");for(var b=0,c=0;c<a.length;c++){var d=a[c],e=d.getElementsByTagName("input")[0];if(e.checked){b+=1;e=e.getAttribute("data-id");d=d.parentNode.parentNode.parentNode.getAttribute("data-id");var f=this.geoportalData[d],g=f.children[e],h=f.title;f=f.getMapUrl;var k=g.name;g=g.title;d="geoportal_"+d;e=d+"_"+e;netgis.util.invoke(this.sections.geoportal,
|
||||
netgis.Events.IMPORT_GEOPORTAL_SUBMIT,{folder:{id:d,title:h},layer:{id:e,url:f,name:k,title:g}})}}0<b&&this.modal.hide()};netgis=netgis||{};netgis.Info=function(a){this.config=a;this.queryLayers={};this.popup=new netgis.Popup;this.popup.setHeader("Abfrage");this.initConfig(a)};netgis.Info.prototype.initConfig=function(a){a=a.layers;for(var b=a.length-1;0<=b;b--){var c=a[b];!0===c.active&&this.isLayerQueryable(c)?this.queryLayers[c.id]=c:this.queryLayers[c.id]&&delete this.queryLayers[c.id]}};
|
||||
netgis.Info.prototype.attachTo=function(a){this.popup.attachTo(a);a.addEventListener(netgis.Events.CLIENT_CONTEXT_RESPONSE,this.onClientContextResponse.bind(this));a.addEventListener(netgis.Events.MAP_LAYER_TOGGLE,this.onMapLayerToggle.bind(this));a.addEventListener(netgis.Events.IMPORT_LAYER_ACCEPT,this.onImportLayerAccept.bind(this));a.addEventListener(netgis.Events.IMPORT_GEOPORTAL_SUBMIT,this.onImportGeoportalSubmit.bind(this));a.addEventListener(netgis.Events.MAP_CLICK,this.onMapClick.bind(this));
|
||||
a.addEventListener(netgis.Events.MAP_FEATURE_CLICK,this.onMapFeatureClick.bind(this))};netgis.Info.prototype.isLayerQueryable=function(a){var b=!1;if(!0===a.query)b=!0;else if(!1!==a.query)switch(a.type){case netgis.LayerTypes.WMS:case netgis.LayerTypes.WMST:b=!0}return b};
|
||||
netgis.Info.prototype.addSection=function(a,b,c){this.popup.addContent([!0===c?"<details open='open'>":"<details>","<summary class='netgis-button netgis-noselect netgis-clip-text netgis-color-d netgis-hover-text-a netgis-hover-d'>",a,"</summary><div class='netgis-border-d'>",b,"</div></details>"].join(""))};netgis.Info.prototype.onClientContextResponse=function(a){this.initConfig(a.detail.context.config)};
|
||||
netgis.Info.prototype.onMapLayerToggle=function(a){var b=a.detail;a=b.id;if(b.on){b=this.config.layers;for(var c=null,d=0;d<b.length;d++)if(b[d].id===a){c=b[d];break}c&&this.isLayerQueryable(c)&&(this.queryLayers[a]=c)}else delete this.queryLayers[a]};netgis.Info.prototype.onImportLayerAccept=function(a){a=a.detail;this.isLayerQueryable(a)&&(this.queryLayers[a.id]=a)};netgis.Info.prototype.onImportGeoportalSubmit=function(a){};
|
||||
netgis.Info.prototype.onMapClick=function(a){a=a.detail;if(a.mode===netgis.Modes.VIEW){var b=this.config.info;this.popup.container!==a.overlay&&this.popup.attachTo(a.overlay);this.popup.clearContent();var c=0,d;for(d in this.queryLayers){var e=this.queryLayers[d];if(!e.query_url||""===e.query_url)switch(e.type){case netgis.LayerTypes.WMS:case netgis.LayerTypes.WMST:var f=e.url,g=["service=WMS","version=1.1.0","request=GetFeatureInfo","styles=","layers="+window.encodeURIComponent(e.name),"query_layers="+
|
||||
window.encodeURIComponent(e.name),"bbox="+a.view.bbox.join(","),"srs="+a.view.projection,"width="+a.view.width,"height="+a.view.height,"x="+Math.round(a.pixel[0]),"y="+Math.round(a.pixel[1]),"info_format="+(b&&b.default_format?b.default_format:"text/plain")];f=f+(-1===f.indexOf("?")?"?":"")+g.join("&");netgis.util.request(f,this.onLayerResponseWMS.bind(this),{title:e.title});c+=1}(f=e.query_url)&&""!==f&&(f=netgis.util.replace(f,"{bbox}",a.view.bbox.join(",")),f=netgis.util.replace(f,"{proj}",a.view.projection),
|
||||
f=netgis.util.replace(f,"{width}",a.view.width),f=netgis.util.replace(f,"{height}",a.view.height),f=netgis.util.replace(f,"{x}",a.coords[0]),f=netgis.util.replace(f,"{y}",a.coords[1]),f=netgis.util.replace(f,"{px}",a.pixel[0]),f=netgis.util.replace(f,"{py}",a.pixel[1]),f=netgis.util.replace(f,"{lon}",a.lon),f=netgis.util.replace(f,"{lat}",a.lat),netgis.util.request(f,this.onLayerResponseWMS.bind(this),{title:e.title}),c+=1)}0<c?(this.popup.showLoader(),this.popup.show()):this.popup.hide()}};
|
||||
netgis.Info.prototype.onLayerResponseWMS=function(a,b,c){b=b.title;if(c=c.getResponseHeader("Content-Type"))switch(c.split(";")[0]){case "text/plain":a="<pre>"+a+"</pre>"}this.popup.hideLoader();this.addSection(b,a,!1)};
|
||||
netgis.Info.prototype.onMapFeatureClick=function(a){var b=a.detail,c=b.properties;a=null;var d=[],e="geometry fill fill-opacity stroke stroke-opacity stroke-width styleUrl".split(" ");for(g in c)if(!(-1<e.indexOf(g))){var f=c[g];d.push([g,f]);a||("name"===g&&""!==f?a=f:"title"===g&&""!==f?a=f:"id"===g&&f&&(a=f))}!a&&b.id&&(a=b.id);a=a?'Feature "'+a+'"':"Feature";"geolocation"===b.id&&((a=this.config.geolocation.marker_title)&&""!==a||(a="Geolocation"),d.push(["L\u00e4ngengrad (Lon.)",b.lon]),d.push(["Breitengrad (Lat.)",
|
||||
b.lat]));b=[];if(0<d.length){b.push("<table>");for(c=0;c<d.length;c++){f=d[c];var g=f[0];f=f[1];b.push("<tr class='netgis-hover-d'>");b.push("<th>"+g+"</th>");b.push("<td>"+f+"</td>");b.push("</tr>")}b.push("</table>")}else b.push("<i>Keine Eigenschaften vorhanden...</i>");b=b.join("");this.addSection(a,b,!1);!this.popup.isVisible()&&this.popup.show()};netgis=netgis||{};netgis.LayerID=Object.freeze({EDITABLE:"editable-layer",NON_EDITABLE:"non-editable-layer"});netgis=netgis||{};netgis.LayerTree=function(a){this.config=a;this.importFolder=null;this.initElements();this.initFolders();this.initConfig(a)};netgis.LayerTree.prototype.initElements=function(){this.panel=new netgis.Panel("Layers");this.tree=new netgis.Tree;this.tree.attachTo(this.panel.content);this.tree.container.addEventListener(netgis.Events.TREE_ITEM_CHANGE,this.onTreeItemChange.bind(this));this.tree.container.addEventListener(netgis.Events.TREE_ITEM_SLIDER_CHANGE,this.onTreeItemSliderChange.bind(this))};
|
||||
netgis.LayerTree.prototype.initFolders=function(){this.editFolder=this.tree.addFolder(null,"edit-folder","Zeichnung",!0);this.tree.addCheckbox(this.editFolder,netgis.LayerID.EDITABLE,"Editierbar");this.tree.setItemChecked(netgis.LayerID.EDITABLE,!0);this.tree.addCheckbox(this.editFolder,netgis.LayerID.NON_EDITABLE,"Nicht-Editierbar");this.tree.setItemChecked(netgis.LayerID.NON_EDITABLE,!0);this.editFolder.classList.add("netgis-hide")};
|
||||
netgis.LayerTree.prototype.initConfig=function(a,b){a.layertree&&a.layertree.title&&this.panel.setTitle(a.layertree.title);for(var c=a.folders,d={},e=0;e<c.length;e++){var f=c[e],g=this.tree.addFolder(null,f.id,f.title,b,!1);d[f.id]=g;!0===f.open&&this.tree.setFolderOpen(f.id,!0)}for(e=0;e<c.length;e++)f=c[e],g=f.id,f=f.parent,-1===f&&(f=null),""===f&&(f=null),f&&this.tree.setFolderParent(d[g],d[f]);b=a.layers;for(e=0;e<b.length;e++){var h=b[e];f=d[h.folder]?d[h.folder]:null;g=h.id?h.id:e.toString();
|
||||
var k=!1;if(f)for(var l=0;l<c.length;l++){var m=c[l];m.id===h.folder&&(k=m.radio)}g=!0===k?this.tree.addRadioButton(f,g,h.title,h.active,this.createDefaultDetails(h)):this.tree.addCheckbox(f,g,h.title,h.active,!1,this.createDefaultDetails(h));g.addEventListener("contextmenu",this.onTreeItemMenu.bind(this))}this.tree.updateFolderChecks();if(a.layertree&&a.layertree.buttons)for(c=a.layertree.buttons,e=0;e<c.length;e++)d=c[e],this.tree.addButton(null,d.id,d.title,this.onTreeButtonClick.bind(this));a.layertree&&
|
||||
!0===a.layertree.open&&this.panel.show()};
|
||||
netgis.LayerTree.prototype.attachTo=function(a){a.appendChild(this.panel.container);a.addEventListener(netgis.Events.CLIENT_CONTEXT_RESPONSE,this.onClientContextResponse.bind(this));a.addEventListener(netgis.Events.LAYERTREE_TOGGLE,this.onLayerTreeToggle.bind(this));a.addEventListener(netgis.Events.TOOLBOX_TOGGLE,this.onToolboxToggle.bind(this));a.addEventListener(netgis.Events.SEARCHPARCEL_TOGGLE,this.onSearchParcelToggle.bind(this));a.addEventListener(netgis.Events.MAP_LAYER_TOGGLE,this.onMapLayerToggle.bind(this));
|
||||
a.addEventListener(netgis.Events.IMPORT_LAYER_ACCEPT,this.onImportLayerAccept.bind(this));a.addEventListener(netgis.Events.IMPORT_GEOPORTAL_SUBMIT,this.onImportGeoportalSubmit.bind(this));a.addEventListener(netgis.Events.CONTEXTMENU_SLIDER_CHANGE,this.onContextMenuSliderChange.bind(this));a.addEventListener(netgis.Events.MAP_EDIT_LAYER_LOADED,this.onMapEditLayerChange.bind(this));a.addEventListener(netgis.Events.MAP_EDIT_LAYER_CHANGE,this.onMapEditLayerChange.bind(this))};
|
||||
netgis.LayerTree.prototype.createDefaultDetails=function(a){return[{title:"Transparenz:",type:"slider",val:a.transparency?Math.round(100*a.transparency):0}]};netgis.LayerTree.prototype.onTreeItemChange=function(a){var b=a.detail;netgis.util.invoke(a.target,netgis.Events.MAP_LAYER_TOGGLE,{id:b.id,on:b.checked})};netgis.LayerTree.prototype.onClientContextResponse=function(a){this.initConfig(a.detail.context.config,!0)};netgis.LayerTree.prototype.onLayerTreeToggle=function(a){this.panel.toggle()};
|
||||
netgis.LayerTree.prototype.onToolboxToggle=function(a){this.panel.hide()};netgis.LayerTree.prototype.onSearchParcelToggle=function(a){this.panel.hide()};netgis.LayerTree.prototype.onTreeButtonClick=function(a){a=a.currentTarget;var b=a.getAttribute("data-id");netgis.Client.handleCommand(a,b)};netgis.LayerTree.prototype.onMapLayerToggle=function(a){a=a.detail;this.tree.setItemChecked(a.id,a.on,!0);this.tree.updateFolderChecks()};
|
||||
netgis.LayerTree.prototype.onImportLayerAccept=function(a){a=a.detail;this.importFolder||(this.importFolder=this.tree.addFolder(null,"_import","Import",!0,!1));this.tree.addCheckbox(this.importFolder,a.id,a.title,!0,!0,this.createDefaultDetails(a)).addEventListener("contextmenu",this.onTreeItemMenu.bind(this));this.tree.updateFolderChecks()};
|
||||
var k=!1;if(f)for(var l=0;l<c.length;l++){var m=c[l];m.id===h.folder&&(k=m.radio)}l=h.title;m='<i class="fas fa-mouse-pointer" title="Ebene ist abfragbar"></i>';a.layertree&&a.layertree.query_icon&&(m=a.layertree.query_icon);(!0===h.query||h.query_url&&""!==h.query_url)&&m&&""!==m&&(l+='<span class="netgis-right">'+m+"</span>");g=!0===k?this.tree.addRadioButton(f,g,l,h.active,this.createDefaultDetails(h)):this.tree.addCheckbox(f,g,l,h.active,!1,this.createDefaultDetails(h));g.addEventListener("contextmenu",
|
||||
this.onTreeItemMenu.bind(this));!0===h.hidden&&g.classList.add("netgis-hide")}this.tree.updateFolderChecks();if(a.layertree&&a.layertree.buttons)for(c=a.layertree.buttons,e=0;e<c.length;e++)d=c[e],this.tree.addButton(null,d.id,d.title,this.onTreeButtonClick.bind(this));a.layertree&&!0===a.layertree.open&&this.panel.show()};
|
||||
netgis.LayerTree.prototype.attachTo=function(a){a.appendChild(this.panel.container);a.addEventListener(netgis.Events.CLIENT_CONTEXT_RESPONSE,this.onClientContextResponse.bind(this));a.addEventListener(netgis.Events.LAYERTREE_TOGGLE,this.onLayerTreeToggle.bind(this));a.addEventListener(netgis.Events.TOOLBOX_TOGGLE,this.onToolboxToggle.bind(this));a.addEventListener(netgis.Events.SEARCHPARCEL_TOGGLE,this.onSearchParcelToggle.bind(this));a.addEventListener(netgis.Events.LEGEND_TOGGLE,this.onLegendToggle.bind(this));
|
||||
a.addEventListener(netgis.Events.MAP_LAYER_TOGGLE,this.onMapLayerToggle.bind(this));a.addEventListener(netgis.Events.IMPORT_LAYER_ACCEPT,this.onImportLayerAccept.bind(this));a.addEventListener(netgis.Events.IMPORT_GEOPORTAL_SUBMIT,this.onImportGeoportalSubmit.bind(this));a.addEventListener(netgis.Events.CONTEXTMENU_SLIDER_CHANGE,this.onContextMenuSliderChange.bind(this));a.addEventListener(netgis.Events.MAP_EDIT_LAYER_LOADED,this.onMapEditLayerChange.bind(this));a.addEventListener(netgis.Events.MAP_EDIT_LAYER_CHANGE,
|
||||
this.onMapEditLayerChange.bind(this))};netgis.LayerTree.prototype.createDefaultDetails=function(a){return[{title:"Transparenz:",type:"slider",val:a.transparency?Math.round(100*a.transparency):0}]};netgis.LayerTree.prototype.onTreeItemChange=function(a){var b=a.detail;netgis.util.invoke(a.target,netgis.Events.MAP_LAYER_TOGGLE,{id:b.id,on:b.checked})};netgis.LayerTree.prototype.onClientContextResponse=function(a){this.initConfig(a.detail.context.config,!0)};
|
||||
netgis.LayerTree.prototype.onLayerTreeToggle=function(a){this.panel.toggle()};netgis.LayerTree.prototype.onToolboxToggle=function(a){this.panel.hide()};netgis.LayerTree.prototype.onSearchParcelToggle=function(a){this.panel.hide()};netgis.LayerTree.prototype.onLegendToggle=function(a){this.panel.hide()};netgis.LayerTree.prototype.onTreeButtonClick=function(a){a=a.currentTarget;var b=a.getAttribute("data-id");netgis.Client.handleCommand(a,b)};
|
||||
netgis.LayerTree.prototype.onMapLayerToggle=function(a){a=a.detail;this.tree.setItemChecked(a.id,a.on,!0);this.tree.updateFolderChecks()};
|
||||
netgis.LayerTree.prototype.onImportLayerAccept=function(a){a=a.detail;this.importFolder||(this.importFolder=this.tree.addFolder(null,"_import","Import",!0,!1));var b=a.title,c='<i class="fas fa-mouse-pointer" title="Ebene ist abfragbar"></i>';config.layertree&&config.layertree.query_icon&&(c=config.layertree.query_icon);(!0===a.query||a.query_url&&""!==a.query_url)&&c&&""!==c&&(b+='<span class="netgis-right">'+c+"</span>");this.tree.addCheckbox(this.importFolder,a.id,b,!0,!0,this.createDefaultDetails(a)).addEventListener("contextmenu",
|
||||
this.onTreeItemMenu.bind(this));this.tree.updateFolderChecks()};
|
||||
netgis.LayerTree.prototype.onImportGeoportalSubmit=function(a){a=a.detail;var b=a.folder.id,c=this.tree.getFolder(b);c||(c=this.tree.addFolder(null,b,a.folder.title,!0,!1));var d=a.layer.id;b={id:d,folder:b,title:a.layer.title,active:!0,type:netgis.LayerTypes.WMS,url:a.layer.url,name:a.layer.name,order:1E4,transparency:0};this.config.layers.push(b);this.tree.addCheckbox(c,d,a.layer.title,!1,!1,this.createDefaultDetails(b));this.tree.setItemChecked(d,!0,!1)};
|
||||
netgis.LayerTree.prototype.onTreeItemMenu=function(a){a.preventDefault();return!1};netgis.LayerTree.prototype.onContextMenuSliderChange=function(a){var b=a.detail;a=.01*b.val;var c=null;0===b.id.indexOf("layer_trans_")&&(c=b.id.split("layer_trans_")[1]);b=this.config.layers;for(var d=0;d<b.length;d++){var e=b[d];if(e.id===c){e.transparency=a;break}}netgis.util.invoke(this.tree.container,netgis.Events.MAP_LAYER_TRANSPARENCY,{id:c,transparency:a})};
|
||||
netgis.LayerTree.prototype.onTreeItemSliderChange=function(a){var b=a.detail;a=b.id;b=.01*b.val;for(var c=this.config.layers,d=0;d<c.length;d++){var e=c[d];if(e.id===a){e.transparency=b;break}}netgis.util.invoke(this.tree.container,netgis.Events.MAP_LAYER_TRANSPARENCY,{id:a,transparency:b})};netgis.LayerTree.prototype.onMapEditLayerChange=function(a){this.editFolder.classList.remove("netgis-hide")};netgis=netgis||{};netgis.LayerTypes=Object.freeze({TMS:"TMS",WMTS:"WMTS",WMS:"WMS",WMST:"WMST",GEOJSON:"GEOJSON",VTILES:"VTILES",WFS:"WFS",GML:"GML",KML:"KML",GEOPACKAGE:"GEOPACKAGE",SPATIALITE:"SPATIALITE",SHAPEFILE:"SHAPEFILE",WKT:"WKT",OSM:"OSM",XYZ:"XYZ"});netgis=netgis||{};netgis.Logic=function(a){this.client=a;this.config=a.config;this.container=a.container;this.modules=a.modules;this.initConfig(config);this.initEvents()};netgis.Logic.prototype.initConfig=function(a){a.wmc&&a.wmc.url&&(new netgis.WMC).requestContext(a.wmc.url,this.onContextLoaded.bind(this))};netgis.Logic.prototype.initEvents=function(){};
|
||||
netgis.Logic.prototype.onMenuButtonClick=function(a){a=a.detail;switch(a.id){case "layertree":this.modules.layertree.panel.toggle();break;case "searchplace":this.modules.searchplace.search.toggle();break;default:console.error("unhandled menu button",a)}};netgis.Logic.prototype.onLayerItemChange=function(a){a=a.detail;if(a.checked)for(var b=this.config.layers,c=0;c<b.length;c++){var d=b[c];d.id===a.id&&this.modules.map.addLayer(a.id,d)}else this.modules.map.removeLayer(a.id)};
|
||||
netgis.Logic.prototype.onControlsButtonClick=function(a){switch(a.detail.id){case "zoom_in":this.modules.map.zoom(1);break;case "zoom_out":this.modules.map.zoom(-1);break;case "zoom_home":this.config.map.bbox?this.modules.map.zoomBBox(this.config.map.bbox,500):this.config.map.centerLonLat&&(a=this.config.map.centerLonLat,this.modules.map.zoomLonLat(a[0],a[1],this.config.map.zoom))}};
|
||||
netgis.Logic.prototype.onSearchPlaceChange=function(a){var b=this.config.searchplace.url;b=netgis.util.replace(b,"{query}",window.encodeURIComponent(a.detail.query));netgis.util.request(b,this.onSearchPlaceResponse.bind(this))};
|
||||
netgis.Logic.prototype.onSearchPlaceResponse=function(a){a=JSON.parse(a).data;this.modules.searchplace.search.clearResults();for(var b=0;b<a.length;b++){var c=a[b],d=c.name;c={type:"street",id:c.strid,lon:Number.parseFloat(c.wgs_x),lat:Number.parseFloat(c.wgs_y)};this.modules.searchplace.search.addResult(d,JSON.stringify(c))}};
|
||||
netgis.Logic.prototype.onSearchPlaceSelect=function(a){a=JSON.parse(a.detail.data);this.modules.map.zoomLonLat(a.lon,a.lat,this.config.searchplace.zoom);if("street"===a.type){var b=this.config.searchplace.url_detail;b&&(b=netgis.util.replace(b,"{id}",a.id),netgis.util.request(b,this.onSearchPlaceDetailResponse.bind(this)))}};
|
||||
netgis.Logic.prototype.onSearchPlaceDetailResponse=function(a){a=JSON.parse(a);var b=a.hsnrarr;if(0!==b.length){this.modules.searchplace.search.clearResults();for(var c=0;c<b.length;c++){var d=b[c],e=a.strname+" "+d.hsnr;d={type:"address",lon:Number.parseFloat(d.wgs_x),lat:Number.parseFloat(d.wgs_y)};this.modules.searchplace.search.addResult(e,JSON.stringify(d))}}};netgis.Logic.prototype.onSearchPlaceClear=function(a){};
|
||||
netgis.Logic.prototype.onContextLoaded=function(a){console.info("Context Loaded:",a);for(var b=0;b<a.config.layers.length;b++)this.config.layers.push(a.config.layers[b]);a.config.map.bbox&&(this.config.map.bbox=a.config.map.bbox);this.modules.map&&this.modules.map.initConfig(a.config);this.modules.layertree&&this.modules.layertree.initConfig(a.config,!0)};netgis=netgis||{};
|
||||
netgis.LayerTree.prototype.onTreeItemSliderChange=function(a){var b=a.detail;a=b.id;b=.01*b.val;for(var c=this.config.layers,d=0;d<c.length;d++){var e=c[d];if(e.id===a){e.transparency=b;break}}netgis.util.invoke(this.tree.container,netgis.Events.MAP_LAYER_TRANSPARENCY,{id:a,transparency:b})};netgis.LayerTree.prototype.onMapEditLayerChange=function(a){this.editFolder.classList.remove("netgis-hide")};netgis=netgis||{};netgis.LayerTypes=Object.freeze({HIDDEN:"HIDDEN",TMS:"TMS",WMTS:"WMTS",WMS:"WMS",WMST:"WMST",GEOJSON:"GEOJSON",VTILES:"VTILES",WFS:"WFS",GML:"GML",KML:"KML",GEOPACKAGE:"GEOPACKAGE",SPATIALITE:"SPATIALITE",SHAPEFILE:"SHAPEFILE",WKT:"WKT",OSM:"OSM",XYZ:"XYZ"});netgis=netgis||{};netgis.Legend=function(a){this.config=a;this.initElements();this.initConfig(a)};netgis.Legend.prototype.initElements=function(){this.panel=new netgis.Panel("<i class='netgis-icon fas fa-bars'></i><span>Legende</span>");this.panel.content.classList.add("netgis-legend")};netgis.Legend.prototype.initConfig=function(a){var b=a.legend;b&&!0===b.open&&this.show();a=a.layers;for(b=0;b<a.length;b++){var c=a[b];!0===c.active?this.addLayerLegend(c.id):this.removeLayerLegend(c.id)}};
|
||||
netgis.Legend.prototype.attachTo=function(a){this.panel.attachTo(a);a.addEventListener(netgis.Events.CLIENT_CONTEXT_RESPONSE,this.onClientContextResponse.bind(this));a.addEventListener(netgis.Events.MAP_LAYER_TOGGLE,this.onMapLayerToggle.bind(this));a.addEventListener(netgis.Events.LEGEND_TOGGLE,this.onLegendToggle.bind(this));a.addEventListener(netgis.Events.LAYERTREE_TOGGLE,this.onLayerTreeToggle.bind(this));a.addEventListener(netgis.Events.TOOLBOX_TOGGLE,this.onToolboxToggle.bind(this));a.addEventListener(netgis.Events.SEARCHPARCEL_TOGGLE,
|
||||
this.onSearchParcelToggle.bind(this))};netgis.Legend.prototype.show=function(){this.panel.show()};netgis.Legend.prototype.hide=function(){this.panel.hide()};
|
||||
netgis.Legend.prototype.addSection=function(a,b,c,d){this.panel.content.innerHTML=[!0===d?"<details data-id='"+a+"' open='open'>":"<details data-id='"+a+"'>","<summary class='netgis-button netgis-noselect netgis-clip-text netgis-color-d netgis-hover-text-a netgis-hover-d'>",b,"</summary><div class='netgis-border-d'>",c,"</div></details>"].join("")+this.panel.content.innerHTML};
|
||||
netgis.Legend.prototype.addLayerLegend=function(a){for(var b=null,c=this.config.layers,d=0;d<c.length;d++){var e=c[d];if(e.id===a){b=e;break}}c=b.legend;if(!c||""===c)switch(b.type){case netgis.LayerTypes.WMS:case netgis.LayerTypes.WMST:c=b.url,-1===c.indexOf("?")&&(c+="?"),c+=["service=WMS&version=1.1.0&request=GetLegendGraphic&format=image/png","layer="+b.name].join("&")}c&&""!==c&&this.addSection(a,b.title,"<img src='"+c+"'/>",!0)};
|
||||
netgis.Legend.prototype.removeLayerLegend=function(a){for(var b=this.panel.content.getElementsByTagName("details"),c=0;c<b.length;c++){var d=b[c];d.getAttribute("data-id")===a&&d.parentNode.removeChild(d)}};netgis.Legend.prototype.onClientContextResponse=function(a){this.initConfig(a.detail.context.config)};netgis.Legend.prototype.onMapLayerToggle=function(a){a=a.detail;a.on?this.addLayerLegend(a.id):this.removeLayerLegend(a.id)};netgis.Legend.prototype.onLegendToggle=function(a){this.panel.toggle()};
|
||||
netgis.Legend.prototype.onLayerTreeToggle=function(a){this.panel.hide()};netgis.Legend.prototype.onToolboxToggle=function(a){this.panel.hide()};netgis.Legend.prototype.onSearchParcelToggle=function(a){this.panel.hide()};netgis=netgis||{};
|
||||
netgis.Map=function(a){this.config=a;this.mode=null;this.interactions={};this.layers={};this.viewHistory=[];this.viewIndex=-1;this.viewFromHistory=!1;this.viewHistoryMax=20;this.paddingBuffer=40;this.hoverBounds=this.hoverFeature=null;this.selectedFeatures=[];this.sketchFeatures=[];this.snap=null;this.snapFeatures=new ol.Collection;this.drawError=this.selectReset=this.selectMultiple=this.editEventsSilent=!1;this.initElements();this.initMap(a);this.initLayers();this.initOverlays();this.initInteractions();
|
||||
this.initConfig(a);this.setPadding(0,0,0,0);this.setMode(netgis.Modes.VIEW)};
|
||||
netgis.Map.prototype.initElements=function(){this.container=document.createElement("div");this.container.setAttribute("tabindex",-1);this.container.className="netgis-map";this.container.addEventListener("pointerleave",this.onPointerLeave.bind(this));this.container.addEventListener("click",this.onContainerClick.bind(this));this.container.addEventListener("contextmenu",this.onRightClick.bind(this));this.container.addEventListener("keydown",this.onKeyDown.bind(this));this.container.addEventListener("keyup",
|
||||
@ -150,34 +168,36 @@ this.onKeyUp.bind(this))};
|
||||
netgis.Map.prototype.initMap=function(a){var b=a.map;"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));var c={projection:b.projection,center:b.center_lonlat?ol.proj.fromLonLat(b.center_lonlat,b.projection):b.center,minZoom:b.min_zoom,maxZoom:b.max_zoom,zoom:b.zoom};this.view=new ol.View(c);this.map=new ol.Map({target:this.container,view:this.view,pixelRatio:1,moveTolerance:b.move_tolerance||0===
|
||||
b.move_tolerance?b.move_tolerance:7,controls:[]});if(b.scalebar&&(this.scalebar=new ol.control.ScaleLine({bar:!0}),this.map.addControl(this.scalebar),(b=b.scales)&&0<b.length))for(this.scalebarSelect=document.createElement("select"),this.scalebarSelect.addEventListener("change",this.onScalebarSelectChange.bind(this)),this.scalebar.element.appendChild(this.scalebarSelect),c=0;c<b.length;c++){var d=b[c],e=document.createElement("option");e.innerHTML="1:"+d;e.setAttribute("value",d);this.scalebarSelect.appendChild(e)}this.map.on("moveend",
|
||||
this.onMapMoveEnd.bind(this));this.map.on("pointermove",this.onPointerMove.bind(this));this.map.on("click",this.onPointerClick.bind(this));if(a.map.extent){var f=this;window.setTimeout(function(){f.map.updateSize();f.view.fit(a.map.extent)},10)}};
|
||||
netgis.Map.prototype.initLayers=function(){this.measureLayer=new ol.layer.Vector({source:new ol.source.Vector({features:[]}),zIndex:6E4,style:this.styleMeasure.bind(this)});this.map.addLayer(this.measureLayer);var a=this.config.tools;this.nonEditLayer=new ol.layer.Vector({source:new ol.source.Vector({features:[]}),zIndex:5E4,style:this.styleNonEdit.bind(this),updateWhileAnimating:a.interactive_render,updateWhileInteracting:a.interactive_render});this.map.addLayer(this.nonEditLayer);this.editLayer=
|
||||
new ol.layer.Vector({source:new ol.source.Vector({features:[]}),zIndex:5E4,style:this.styleEdit.bind(this),updateWhileAnimating:a.interactive_render,updateWhileInteracting:a.interactive_render});this.map.addLayer(this.editLayer);this.editLayer.getSource().on("addfeature",this.onEditLayerAdd.bind(this));this.editLayer.getSource().on("changefeature",this.onEditLayerChange.bind(this));this.editLayer.getSource().on("removefeature",this.onEditLayerRemove.bind(this));this.previewLayer=new ol.layer.Vector({source:new ol.source.Vector({features:[]}),
|
||||
zIndex:55E3,style:this.styleSketch.bind(this)});this.map.addLayer(this.previewLayer);this.boundsLayer=null;if(this.config.tools.bounds){a=(new ol.format.GeoJSON).readFeatures(this.config.tools.bounds);var b=null;this.config.tools.show_bounds&&this.config.styles.bounds&&(b=this.createStyle(this.config.styles.bounds));this.boundsLayer=new ol.layer.Vector({source:new ol.source.Vector({features:a}),style:b,zIndex:6E4});this.map.addLayer(this.boundsLayer)}};
|
||||
netgis.Map.prototype.initOverlays=function(){var a=document.createElement("div");a.className="netgis-map-overlay";this.popupOverlay=new ol.Overlay({id:"popup",element:a,positioning:"center-center"});this.map.addOverlay(this.popupOverlay)};
|
||||
netgis.Map.prototype.initInteractions=function(){this.interactions[netgis.Modes.VIEW]=[new ol.interaction.DragPan,new ol.interaction.DragPan({condition:function(a){return 1===a.originalEvent.button}}),new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.ZOOM_BOX]=[new ol.interaction.DragZoom({condition:function(a){return 0===a.originalEvent.button},out:!1}),new ol.interaction.DragPan({condition:function(a){return 1===a.originalEvent.button}}),new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.MEASURE_LINE]=
|
||||
[new ol.interaction.DragPan,new ol.interaction.Modify({source:this.measureLayer.getSource(),deleteCondition:ol.events.condition.doubleClick,style:this.styleMeasure.bind(this)}),new ol.interaction.Draw({type:"LineString",source:this.measureLayer.getSource(),style:this.styleMeasure.bind(this)}),new ol.interaction.DragPan({condition:function(a){return 1===a.originalEvent.button}}),new ol.interaction.PinchZoom,new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.MEASURE_AREA]=[new ol.interaction.DragPan,
|
||||
new ol.interaction.Modify({source:this.measureLayer.getSource(),deleteCondition:ol.events.condition.doubleClick,style:this.styleMeasure.bind(this)}),new ol.interaction.Draw({type:"Polygon",source:this.measureLayer.getSource(),style:this.styleMeasure.bind(this)}),new ol.interaction.DragPan({condition:function(a){return 1===a.originalEvent.button}}),new ol.interaction.PinchZoom,new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.MEASURE_LINE][2].on("drawstart",this.onMeasureLineBegin.bind(this));
|
||||
this.interactions[netgis.Modes.MEASURE_AREA][2].on("drawstart",this.onMeasureAreaBegin.bind(this));if(!0===this.config.tools.editable){var a=this.config.tools.bounds?!0:!1;this.interactions[netgis.Modes.DRAW_POINTS]=[new ol.interaction.Draw({type:"Point",source:this.editLayer.getSource(),style:this.styleSketch.bind(this),geometryFunction:a?this.onDrawPointsUpdateGeom.bind(this):void 0}),new ol.interaction.DragPan,new ol.interaction.DragPan({condition:function(a){return 1===a.originalEvent.button}}),
|
||||
new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.DRAW_POINTS][0].on("drawend",this.onDrawBufferEnd.bind(this));if(a)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),geometryFunction:a?this.onDrawLinesUpdateGeom.bind(this):void 0}),new ol.interaction.DragPan,new ol.interaction.DragPan({condition:function(a){return 1===
|
||||
netgis.Map.prototype.initLayers=function(){this.measureLayer=new ol.layer.Vector({source:new ol.source.Vector({features:[]}),zIndex:6E4,style:this.styleMeasure.bind(this)});this.map.addLayer(this.measureLayer);var a=this.config.tools;if(a&&(this.nonEditLayer=new ol.layer.Vector({source:new ol.source.Vector({features:[]}),zIndex:5E4,style:this.styleNonEdit.bind(this),updateWhileAnimating:a&&a.interactive_render?a.interactive_render:!1,updateWhileInteracting:a&&a.interactive_render?a.interactive_render:
|
||||
!1}),this.map.addLayer(this.nonEditLayer),this.editLayer=new ol.layer.Vector({source:new ol.source.Vector({features:[]}),zIndex:5E4,style:this.styleEdit.bind(this),updateWhileAnimating:a&&a.interactive_render?a.interactive_render:!1,updateWhileInteracting:a&&a.interactive_render?a.interactive_render:!1}),this.map.addLayer(this.editLayer),this.editLayer.getSource().on("addfeature",this.onEditLayerAdd.bind(this)),this.editLayer.getSource().on("changefeature",this.onEditLayerChange.bind(this)),this.editLayer.getSource().on("removefeature",
|
||||
this.onEditLayerRemove.bind(this)),this.previewLayer=new ol.layer.Vector({source:new ol.source.Vector({features:[]}),zIndex:55E3,style:this.styleSketch.bind(this)}),this.map.addLayer(this.previewLayer),this.boundsLayer=null,this.config.tools.bounds)){var b=(new ol.format.GeoJSON).readFeatures(this.config.tools.bounds);a=null;this.config.tools.show_bounds&&this.config.styles.bounds&&(a=this.createStyle(this.config.styles.bounds));this.boundsLayer=new ol.layer.Vector({source:new ol.source.Vector({features:b}),
|
||||
style:a,zIndex:6E4});this.map.addLayer(this.boundsLayer)}this.geolocLayer=null;!0===this.config.modules.geolocation&&(a=this.config.geolocation,a=[new ol.style.Style({image:new ol.style.Circle({fill:new ol.style.Fill({color:"#ffffff"}),radius:8})}),new ol.style.Style({image:new ol.style.Circle({fill:new ol.style.Fill({color:a.marker_color?a.marker_color:"#ff0000"}),radius:5})})],b=new ol.Feature({geometry:new ol.geom.Point(ol.proj.fromLonLat([7,50],this.view.getProjection()))}),b.setId("geolocation"),
|
||||
this.geolocLayer=new ol.layer.Vector({source:new ol.source.Vector({features:[b]}),style:a,zIndex:66E3}),this.map.addLayer(this.geolocLayer),this.geolocLayer.setVisible(!1))};netgis.Map.prototype.initOverlays=function(){var a=document.createElement("div");a.className="netgis-map-overlay";this.popupOverlay=new ol.Overlay({id:"popup",element:a,positioning:"center-center"});this.map.addOverlay(this.popupOverlay)};
|
||||
netgis.Map.prototype.initInteractions=function(){this.interactions[netgis.Modes.VIEW]=[new ol.interaction.DragPan,new ol.interaction.DragPan({condition:function(a){return 1===a.originalEvent.button}}),new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.ZOOM_BOX]=[new ol.interaction.DragZoom({condition:function(a){return 0===a.originalEvent.button},out:!1,className:"netgis-zoom-box"}),new ol.interaction.DragPan({condition:function(a){return 1===a.originalEvent.button}}),new ol.interaction.MouseWheelZoom];
|
||||
this.interactions[netgis.Modes.MEASURE_LINE]=[new ol.interaction.DragPan,new ol.interaction.Modify({source:this.measureLayer.getSource(),deleteCondition:ol.events.condition.doubleClick,style:this.styleMeasure.bind(this)}),new ol.interaction.Draw({type:"LineString",source:this.measureLayer.getSource(),style:this.styleMeasure.bind(this)}),new ol.interaction.DragPan({condition:function(a){return 1===a.originalEvent.button}}),new ol.interaction.PinchZoom,new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.MEASURE_AREA]=
|
||||
[new ol.interaction.DragPan,new ol.interaction.Modify({source:this.measureLayer.getSource(),deleteCondition:ol.events.condition.doubleClick,style:this.styleMeasure.bind(this)}),new ol.interaction.Draw({type:"Polygon",source:this.measureLayer.getSource(),style:this.styleMeasure.bind(this)}),new ol.interaction.DragPan({condition:function(a){return 1===a.originalEvent.button}}),new ol.interaction.PinchZoom,new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.MEASURE_LINE][2].on("drawstart",
|
||||
this.onMeasureLineBegin.bind(this));this.interactions[netgis.Modes.MEASURE_AREA][2].on("drawstart",this.onMeasureAreaBegin.bind(this));if(this.config.tools&&!0===this.config.tools.editable){var a=this.config.tools.bounds?!0:!1;this.interactions[netgis.Modes.DRAW_POINTS]=[new ol.interaction.Draw({type:"Point",source:this.editLayer.getSource(),style:this.styleSketch.bind(this),geometryFunction:a?this.onDrawPointsUpdateGeom.bind(this):void 0}),new ol.interaction.DragPan,new ol.interaction.DragPan({condition:function(a){return 1===
|
||||
a.originalEvent.button}}),new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.DRAW_POINTS][0].on("drawend",this.onDrawBufferEnd.bind(this));if(a)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),geometryFunction:a?this.onDrawLinesUpdateGeom.bind(this):void 0}),new ol.interaction.DragPan,new ol.interaction.DragPan({condition:function(a){return 1===
|
||||
a.originalEvent.button}}),new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.DRAW_LINES][0].on("drawend",this.onDrawBufferEnd.bind(this));if(a)this.interactions[netgis.Modes.DRAW_LINES][0].on("drawend",this.onDrawLinesEnd.bind(this));this.interactions[netgis.Modes.DRAW_POLYGONS]=[new ol.interaction.Draw({type:"Polygon",source:this.editLayer.getSource(),style:this.styleSketch.bind(this),geometryFunction:a?this.onDrawPolygonsUpdateGeom.bind(this):void 0}),new ol.interaction.DragPan,new ol.interaction.DragPan({condition:function(a){return 1===
|
||||
a.originalEvent.button}}),new ol.interaction.MouseWheelZoom];if(a)this.interactions[netgis.Modes.DRAW_POLYGONS][0].on("drawend",this.onDrawPolygonsEnd.bind(this));this.interactions[netgis.Modes.MODIFY_FEATURES]=[new ol.interaction.DragPan,new ol.interaction.Modify({source:this.editLayer.getSource(),deleteCondition:ol.events.condition.doubleClick,style:this.styleModify.bind(this)}),new ol.interaction.DragPan({condition:function(a){return 1===a.originalEvent.button}}),new ol.interaction.MouseWheelZoom];
|
||||
this.interactions[netgis.Modes.DELETE_FEATURES]=[new ol.interaction.DragPan,new ol.interaction.DragPan({condition:function(a){return 1===a.originalEvent.button}}),new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.CUT_FEATURES_DRAW]=[new ol.interaction.Draw({type:"Polygon",style:this.styleSketch.bind(this)}),new ol.interaction.DragPan,new ol.interaction.DragPan({condition:function(a){return 1===a.originalEvent.button}}),new ol.interaction.MouseWheelZoom];this.interactions[netgis.Modes.CUT_FEATURES_DRAW][0].on("drawend",
|
||||
this.onCutFeaturesDrawEnd.bind(this))}};netgis.Map.prototype.initConfig=function(a){a.map.bbox&&this.zoomBBox(a.map.bbox);a.map.zoom&&this.view.setZoom(a.map.zoom);a=a.layers;for(var b=a.length-1;0<=b;b--){var c=a[b];!0===c.active&&this.addLayer(c.id,c)}};
|
||||
netgis.Map.prototype.attachTo=function(a){a.appendChild(this.container);a.addEventListener(netgis.Events.CLIENT_CONTEXT_RESPONSE,this.onClientContextResponse.bind(this));a.addEventListener(netgis.Events.CLIENT_SET_MODE,this.onClientSetMode.bind(this));a.addEventListener(netgis.Events.PANEL_TOGGLE,this.onPanelToggle.bind(this));a.addEventListener(netgis.Events.PANEL_RESIZE,this.onPanelResize.bind(this));a.addEventListener(netgis.Events.MAP_EDIT_LAYER_LOADED,this.onEditLayerLoaded.bind(this));a.addEventListener(netgis.Events.MAP_ZOOM,
|
||||
this.onMapZoom.bind(this));a.addEventListener(netgis.Events.MAP_ZOOM_HOME,this.onMapZoomHome.bind(this));a.addEventListener(netgis.Events.MAP_ZOOM_LONLAT,this.onMapZoomLonLat.bind(this));a.addEventListener(netgis.Events.MAP_ZOOM_SCALE,this.onMapZoomScale.bind(this));a.addEventListener(netgis.Events.MAP_ZOOM_LAYER,this.onMapZoomLayer.bind(this));a.addEventListener(netgis.Events.MAP_ZOOM_LEVEL,this.onMapZoomLevel.bind(this));a.addEventListener(netgis.Events.MAP_LAYER_TOGGLE,this.onMapLayerToggle.bind(this));
|
||||
a.addEventListener(netgis.Events.MAP_LAYER_TRANSPARENCY,this.onMapLayerTransparency.bind(this));a.addEventListener(netgis.Events.MAP_SNAP_TOGGLE,this.onMapSnapToggle.bind(this));a.addEventListener(netgis.Events.MAP_VIEW_PREV,this.onMapViewPrev.bind(this));a.addEventListener(netgis.Events.MAP_VIEW_NEXT,this.onMapViewNext.bind(this));a.addEventListener(netgis.Events.MEASURE_CLEAR,this.onMeasureClear.bind(this));a.addEventListener(netgis.Events.DRAW_BUFFER_TOGGLE,this.onDrawBufferToggle.bind(this));
|
||||
a.addEventListener(netgis.Events.DRAW_BUFFER_CHANGE,this.onDrawBufferChange.bind(this));a.addEventListener(netgis.Events.BUFFER_CHANGE,this.onBufferChange.bind(this));a.addEventListener(netgis.Events.BUFFER_ACCEPT,this.onBufferAccept.bind(this));a.addEventListener(netgis.Events.IMPORT_LAYER_ACCEPT,this.onImportLayerAccept.bind(this));a.addEventListener(netgis.Events.IMPORT_LAYER_PREVIEW,this.onImportLayerPreview.bind(this));a.addEventListener(netgis.Events.IMPORT_GEOPORTAL_SUBMIT,this.onImportGeoportalSubmit.bind(this));
|
||||
a.addEventListener(netgis.Events.MAP_COPY_FEATURE_TO_EDIT,this.onCopyFeatureToEdit.bind(this));a.addEventListener(netgis.Events.SEARCHPARCEL_ITEM_ENTER,this.onSearchParcelItemEnter.bind(this));a.addEventListener(netgis.Events.SEARCHPARCEL_ITEM_LEAVE,this.onSearchParcelItemLeave.bind(this));a.addEventListener(netgis.Events.SEARCHPARCEL_ITEM_CLICK,this.onSearchParcelItemClick.bind(this));a.addEventListener(netgis.Events.SEARCHPARCEL_ITEM_IMPORT,this.onSearchParcelItemImport.bind(this));a.addEventListener(netgis.Events.EXPORT_BEGIN,
|
||||
this.onExportBegin.bind(this));a.addEventListener(netgis.Events.TIMESLIDER_SHOW,this.onTimeSliderShow.bind(this));a.addEventListener(netgis.Events.TIMESLIDER_HIDE,this.onTimeSliderHide.bind(this));a.addEventListener(netgis.Events.TIMESLIDER_SELECT,this.onTimeSliderSelect.bind(this))};
|
||||
netgis.Map.prototype.setMode=function(a){switch(this.mode){case netgis.Modes.MODIFY_FEATURES:this.editLayer.setStyle(this.styleEdit.bind(this));break;case netgis.Modes.DRAW_POINTS:case netgis.Modes.DRAW_LINES:this.previewLayer.getSource().clear();this.container.classList.remove("netgis-not-allowed");this.container.removeAttribute("title");break;case netgis.Modes.DRAW_POLYGONS:this.container.classList.remove("netgis-not-allowed");this.container.removeAttribute("title");break;case netgis.Modes.BUFFER_FEATURES:this.clearSketchFeatures();
|
||||
break;case netgis.Modes.BUFFER_FEATURES_EDIT:this.clearSketchFeatures(),this.selectedFeatures=[],this.redrawVectorLayers()}this.map.getInteractions().clear();this.mode&&this.container.classList.remove("netgis-mode-"+this.mode);var b=this.interactions[a];b||(console.warn("no interactions found for mode",a),b=this.interactions[netgis.Modes.VIEW]);for(var c=0;c<b.length;c++)this.map.addInteraction(b[c]);b=this.config.tools.editable;switch(a){case netgis.Modes.DRAW_POINTS:case netgis.Modes.DRAW_LINES:b&&
|
||||
(this.setSnapping(this.drawSnapOn),this.onDrawBufferToggle({detail:{on:this.drawBufferOn,radius:this.drawBufferRadius,segments:this.drawBufferSegments}}));break;case netgis.Modes.DRAW_POLYGONS:b&&this.setSnapping(this.drawSnapOn);break;case netgis.Modes.MODIFY_FEATURES:b&&(this.setSnapping(this.drawSnapOn),this.editLayer.setStyle(this.styleModify.bind(this)))}this.container.classList.add("netgis-mode-"+a);this.mode=a};
|
||||
a.addEventListener(netgis.Events.MAP_LAYER_TRANSPARENCY,this.onMapLayerTransparency.bind(this));a.addEventListener(netgis.Events.MAP_SNAP_TOGGLE,this.onMapSnapToggle.bind(this));a.addEventListener(netgis.Events.MAP_VIEW_PREV,this.onMapViewPrev.bind(this));a.addEventListener(netgis.Events.MAP_VIEW_NEXT,this.onMapViewNext.bind(this));a.addEventListener(netgis.Events.GEOLOCATION_TOGGLE_ACTIVE,this.onGeolocToggleActive.bind(this));a.addEventListener(netgis.Events.GEOLOCATION_CHANGE,this.onGeolocChange.bind(this));
|
||||
a.addEventListener(netgis.Events.MEASURE_CLEAR,this.onMeasureClear.bind(this));a.addEventListener(netgis.Events.DRAW_BUFFER_TOGGLE,this.onDrawBufferToggle.bind(this));a.addEventListener(netgis.Events.DRAW_BUFFER_CHANGE,this.onDrawBufferChange.bind(this));a.addEventListener(netgis.Events.BUFFER_CHANGE,this.onBufferChange.bind(this));a.addEventListener(netgis.Events.BUFFER_ACCEPT,this.onBufferAccept.bind(this));a.addEventListener(netgis.Events.IMPORT_LAYER_ACCEPT,this.onImportLayerAccept.bind(this));
|
||||
a.addEventListener(netgis.Events.IMPORT_LAYER_PREVIEW,this.onImportLayerPreview.bind(this));a.addEventListener(netgis.Events.IMPORT_GEOPORTAL_SUBMIT,this.onImportGeoportalSubmit.bind(this));a.addEventListener(netgis.Events.MAP_COPY_FEATURE_TO_EDIT,this.onCopyFeatureToEdit.bind(this));a.addEventListener(netgis.Events.SEARCHPARCEL_ITEM_ENTER,this.onSearchParcelItemEnter.bind(this));a.addEventListener(netgis.Events.SEARCHPARCEL_ITEM_LEAVE,this.onSearchParcelItemLeave.bind(this));a.addEventListener(netgis.Events.SEARCHPARCEL_ITEM_CLICK,
|
||||
this.onSearchParcelItemClick.bind(this));a.addEventListener(netgis.Events.SEARCHPARCEL_ITEM_IMPORT,this.onSearchParcelItemImport.bind(this));a.addEventListener(netgis.Events.EXPORT_BEGIN,this.onExportBegin.bind(this));a.addEventListener(netgis.Events.TIMESLIDER_SHOW,this.onTimeSliderShow.bind(this));a.addEventListener(netgis.Events.TIMESLIDER_HIDE,this.onTimeSliderHide.bind(this));a.addEventListener(netgis.Events.TIMESLIDER_SELECT,this.onTimeSliderSelect.bind(this))};
|
||||
netgis.Map.prototype.setMode=function(a){switch(this.mode){case netgis.Modes.VIEW:this.container.classList.remove("netgis-clickable");break;case netgis.Modes.MODIFY_FEATURES:this.editLayer.setStyle(this.styleEdit.bind(this));break;case netgis.Modes.DRAW_POINTS:case netgis.Modes.DRAW_LINES:this.previewLayer.getSource().clear();this.container.classList.remove("netgis-not-allowed");this.container.removeAttribute("title");break;case netgis.Modes.DRAW_POLYGONS:this.container.classList.remove("netgis-not-allowed");
|
||||
this.container.removeAttribute("title");break;case netgis.Modes.BUFFER_FEATURES:this.clearSketchFeatures();break;case netgis.Modes.BUFFER_FEATURES_EDIT:this.clearSketchFeatures(),this.selectedFeatures=[],this.redrawVectorLayers()}this.map.getInteractions().clear();this.mode&&this.container.classList.remove("netgis-mode-"+this.mode);var b=this.interactions[a];b||(console.warn("no interactions found for mode",a),b=this.interactions[netgis.Modes.VIEW]);for(var c=0;c<b.length;c++)this.map.addInteraction(b[c]);
|
||||
b=this.config.tools&&this.config.tools.editable;switch(a){case netgis.Modes.DRAW_POINTS:case netgis.Modes.DRAW_LINES:b&&(this.setSnapping(this.drawSnapOn),this.onDrawBufferToggle({detail:{on:this.drawBufferOn,radius:this.drawBufferRadius,segments:this.drawBufferSegments}}));break;case netgis.Modes.DRAW_POLYGONS:b&&this.setSnapping(this.drawSnapOn);break;case netgis.Modes.MODIFY_FEATURES:b&&(this.setSnapping(this.drawSnapOn),this.editLayer.setStyle(this.styleModify.bind(this)))}this.container.classList.add("netgis-mode-"+
|
||||
a);this.mode=a};
|
||||
netgis.Map.prototype.addLayer=function(a,b){var c=this.createLayer(b);c&&(c.set("id",a),this.map.addLayer(c),this.layers[a]=c,b.order&&c.setZIndex(b.order),b.transparency&&c.setOpacity(1-b.transparency),b.style&&c.setStyle(this.createStyle(b.style)),b.min_zoom&&c.setMinZoom(b.min_zoom-1E-4),b.max_zoom&&c.setMaxZoom(b.max_zoom),c instanceof ol.layer.Vector&&this.addSnapLayer(c),b.type===netgis.LayerTypes.WMST&&netgis.util.invoke(this.container,netgis.Events.TIMESLIDER_SHOW,{layer:a,title:b.title,url:b.url,
|
||||
name:b.name}));return c};
|
||||
netgis.Map.prototype.createLayer=function(a){switch(a.type){case netgis.LayerTypes.TMS:case netgis.LayerTypes.XYZ:var b=this.createLayerTMS(a.url,a.projection,a.extent,a.scales);break;case netgis.LayerTypes.OSM:b=this.createLayerTMS("https://{a-c}.tile.openstreetmap.de/{z}/{x}/{y}.png");break;case netgis.LayerTypes.WMTS:b=this.createLayerWMTS(a.url,a.name);break;case netgis.LayerTypes.WMS:b=this.createLayerWMS(a.url,a.name,a.format,a.tiled,a.username,a.password);break;case netgis.LayerTypes.WMST:b=this.createLayerWMST(a.url,
|
||||
a.name,a.format,a.tiled,a.username,a.password);break;case netgis.LayerTypes.GEOJSON:(b=a.data)&&netgis.util.isString(b)&&(b=JSON.parse(b));b=this.createLayerGeoJSON(b?b:a.url);break;case netgis.LayerTypes.WFS:b=this.createLayerWFS(a.url,a.name,this.view.getProjection().getCode(),a.format,a.username,a.password);break;case netgis.LayerTypes.VTILES:b=this.createLayerVectorTiles(a.url,a.extent,a.min_zoom,a.max_zoom);break;case netgis.LayerTypes.GML:b=this.createLayerGML(a.data);break;case netgis.LayerTypes.KML:b=
|
||||
this.createLayerKML(a.url);break;case netgis.LayerTypes.GEOPACKAGE:b=this.createLayerGeoPackage(a.data);break;case netgis.LayerTypes.SPATIALITE:b=this.createLayerSpatialite(a.data);break;case netgis.LayerTypes.SHAPEFILE:b=this.createLayerShapefile(a.data);break;case netgis.LayerTypes.WKT:b=this.createLayerWKT(a.data);break;default:console.error("unknown layer type",a.type)}return b};
|
||||
netgis.Map.prototype.removeLayer=function(a){var b=this.layers[a];b instanceof ol.layer.Vector&&this.removeSnapLayer(b);for(var c=0;c<this.config.layers.length;c++)if(this.config.layers[c].id===a){this.config.layers[c].type===netgis.LayerTypes.WMST&&netgis.util.invoke(this.container,netgis.Events.TIMESLIDER_HIDE,null);break}this.map.removeLayer(b);delete this.layers[a]};netgis.Map.prototype.setLayerOrder=function(a,b){this.layers[a].setZIndex(b)};
|
||||
name:b.name}));return c};netgis.Map.prototype.isLayerQueryable=function(a){var b=!1;if(!0===a.query)b=!0;else if(!1!==a.query)switch(a.type){case netgis.LayerTypes.WMS:case netgis.LayerTypes.WMST:b=!0}return b};netgis.Map.prototype.getQueryableLayers=function(a){for(var b=[],c=0;c<this.config.layers.length;c++){var d=this.config.layers[c],e=this.layers[d.id];e&&(a&&e instanceof ol.layer.Vector||this.isLayerQueryable(d)&&b.push(d))}return b};
|
||||
netgis.Map.prototype.createLayer=function(a){switch(a.type){case netgis.LayerTypes.HIDDEN:break;case netgis.LayerTypes.TMS:case netgis.LayerTypes.XYZ:var b=this.createLayerTMS(a.url,a.projection,a.extent,a.scales);break;case netgis.LayerTypes.OSM:b=this.createLayerTMS("https://{a-c}.tile.openstreetmap.de/{z}/{x}/{y}.png");break;case netgis.LayerTypes.WMTS:b=this.createLayerWMTS(a.url,a.name);break;case netgis.LayerTypes.WMS:b=this.createLayerWMS(a.url,a.name,a.format,a.tiled,a.username,a.password);
|
||||
break;case netgis.LayerTypes.WMST:b=this.createLayerWMST(a.url,a.name,a.format,a.tiled,a.username,a.password);break;case netgis.LayerTypes.GEOJSON:(b=a.data)&&netgis.util.isString(b)&&(b=JSON.parse(b));b=this.createLayerGeoJSON(b?b:a.url);break;case netgis.LayerTypes.WFS:b=this.createLayerWFS(a.url,a.name,this.view.getProjection().getCode(),a.format,a.username,a.password);break;case netgis.LayerTypes.VTILES:b=this.createLayerVectorTiles(a.url,a.extent,a.min_zoom,a.max_zoom);break;case netgis.LayerTypes.GML:b=
|
||||
this.createLayerGML(a.data);break;case netgis.LayerTypes.KML:b=this.createLayerKML(a.url);break;case netgis.LayerTypes.GEOPACKAGE:b=this.createLayerGeoPackage(a.data);break;case netgis.LayerTypes.SPATIALITE:b=this.createLayerSpatialite(a.data);break;case netgis.LayerTypes.SHAPEFILE:b=this.createLayerShapefile(a.data);break;case netgis.LayerTypes.WKT:b=this.createLayerWKT(a.data);break;default:console.error("unknown layer type",a.type)}return b};
|
||||
netgis.Map.prototype.removeLayer=function(a){var b=this.layers[a];b instanceof ol.layer.Vector&&this.removeSnapLayer(b);for(var c=0;c<this.config.layers.length;c++){var d=this.config.layers[c];d.id===a&&d.type===netgis.LayerTypes.WMST&&netgis.util.invoke(this.container,netgis.Events.TIMESLIDER_HIDE,null)}this.map.removeLayer(b);delete this.layers[a]};netgis.Map.prototype.setLayerOrder=function(a,b){this.layers[a].setZIndex(b)};
|
||||
netgis.Map.prototype.createStyle=function(a){var b=a.radius?a.radius:3,c=a.width?a.width:1,d=a.fill?a.fill:"gray",e=a.stroke?a.stroke:"black";return function(a){return new ol.style.Style({image:new ol.style.Circle({radius:b-c,fill:new ol.style.Fill({color:d})}),fill:new ol.style.Fill({color:d}),stroke:new ol.style.Stroke({color:e,width:c})})}};
|
||||
netgis.Map.prototype.styleMeasure=function(a){var b=a.getGeometry(),c=this.config.measure,d=new ol.style.Style({fill:new ol.style.Fill({color:c.area_fill}),stroke:new ol.style.Stroke({color:c.line_color,width:c.line_width,lineDash:c.line_dash})});b instanceof ol.geom.Polygon?(b=b.getArea(),d.setText(new ol.style.Text({text:[netgis.util.formatArea(b,!0),"4mm sans-serif"],font:"Arial",fill:new ol.style.Fill({color:c.text_color}),backgroundFill:new ol.style.Fill({color:c.text_back}),padding:[2,4,2,4],
|
||||
overflow:!0}))):b instanceof ol.geom.LineString&&(this.mode===netgis.Modes.MEASURE_LINE||this.mode===netgis.Modes.VIEW)&&(b=b.getLength(),d.setText(new ol.style.Text({text:[netgis.util.formatDistance(b),"4mm sans-serif"],font:"Arial",fill:new ol.style.Fill({color:c.text_color}),backgroundFill:new ol.style.Fill({color:c.text_back}),padding:[2,4,2,4],overflow:!0})));return c.point_radius&&0<c.point_radius?(b=this.getGeometryPoints(a),a=new ol.style.Style({image:new ol.style.Circle({radius:1.25*c.point_radius,
|
||||
@ -196,7 +216,7 @@ netgis.Map.prototype.setSnapping=function(a){var b=this.config.tools.snapping;a?
|
||||
netgis.Map.prototype.removeSnapLayer=function(a){a=a.getSource().getFeatures();for(var b=0;b<a.length;b++)this.snapFeatures.remove(a[b])};netgis.Map.prototype.setDrawBuffer=function(a,b,c){if(a){var d=this.createBufferFeature(new ol.geom.Point(this.view.getCenter()),b,c);this.previewLayer.getSource().addFeature(d);this.drawBufferRadius=b;this.drawBufferSegments=c}else this.previewLayer.getSource().clear();this.drawBufferOn=a};
|
||||
netgis.Map.prototype.createLayerTMS=function(a,b,c,d){if(b&&c&&d){b=[];d="map"===d?this.config.map.scales:d;c="map"===c?this.config.map.extent:c;for(var e=0;e<d.length;e++)b.unshift(this.getResolutionFromScale(d[e]));c=new ol.source.TileImage({crossOrigin:null,projection:this.view.getProjection(),tileGrid:new ol.tilegrid.TileGrid({extent:c,origin:[c[0],c[1]],resolutions:b}),tileUrlFunction:function(b){if(null!==b){var c=a;c=netgis.util.replace(c,"{z}",b[0]);c=netgis.util.replace(c,"{x}",b[1]);c=netgis.util.replace(c,
|
||||
"{y}",b[2]);return c=netgis.util.replace(c,"{-y}",-b[2]-1)}}});c=new ol.layer.Tile({source:c})}else c=new ol.layer.Tile({source:new ol.source.XYZ({url:a,crossOrigin:"anonymous"})});return c};
|
||||
netgis.Map.prototype.createLayerWMS=function(a,b,c,d,e,f){a={url:a,params:{LAYERS:b,FORMAT:c?c:"image/png",TRANSPARENT:"true",VERSION:"1.1.1"},hidpi:!1};e&&f&&(a.imageLoadFunction=function(a,b){var c=new XMLHttpRequest;c.open("GET",b);c.setRequestHeader("Authorization","Basic "+window.btoa(e+":"+f));c.onload=function(){a.getImage().src=b};c.send()});d?(d=new ol.source.TileWMS(a),d=new ol.layer.Tile({source:d})):(d=new ol.source.ImageWMS(a),d=new ol.layer.Image({source:d}));return d};
|
||||
netgis.Map.prototype.createLayerWMS=function(a,b,c,d,e,f){a={url:a,params:{LAYERS:b,FORMAT:c?c:"image/png",TRANSPARENT:"true"},hidpi:!1};e&&f&&(a.imageLoadFunction=function(a,b){var c=new XMLHttpRequest;c.open("GET",b);c.setRequestHeader("Authorization","Basic "+window.btoa(e+":"+f));c.onload=function(){a.getImage().src=b};c.send()});d?(d=new ol.source.TileWMS(a),d=new ol.layer.Tile({source:d})):(d=new ol.source.ImageWMS(a),d=new ol.layer.Image({source:d}));return d};
|
||||
netgis.Map.prototype.createLayerWMST=function(a,b,c,d,e,f){a={url:a,params:{LAYERS:b,FORMAT:c?c:"image/png",TRANSPARENT:"true",VERSION:"1.1.1"},hidpi:!1};e&&f&&(a.imageLoadFunction=function(a,b){var c=new XMLHttpRequest;c.open("GET",b);c.setRequestHeader("Authorization","Basic "+window.btoa(e+":"+f));c.onload=function(){a.getImage().src=b};c.send()});d?(d=new ol.source.TileWMS(a),d=new ol.layer.Tile({source:d})):(d=new ol.source.ImageWMS(a),d=new ol.layer.Image({source:d}));return d};
|
||||
netgis.Map.prototype.createLayerWMTS=function(a){for(var b=[],c=this.client.config.map.scales,d=this.client.config.map.extent,e=0;e<c.length;e++)b.unshift(this.getResolutionFromScale(c[e]));b=new ol.source.TileImage({crossOrigin:null,projection:this.view.getProjection(),tileGrid:new ol.tilegrid.TileGrid({extent:d,origin:[d[0],d[1]],resolutions:b}),tileUrlFunction:function(b){if(null!==b){var c=a;c=netgis.util.replace(c,"{z}",b[0]);c=netgis.util.replace(c,"{x}",b[1]);c=netgis.util.replace(c,"{y}",
|
||||
b[2]);return c=netgis.util.replace(c,"{-y}",-b[2])}}});return new ol.layer.Tile({source:b})};
|
||||
@ -246,13 +266,14 @@ netgis.Map.prototype.onMapZoomLayer=function(a){a=a.detail;var b=this.layers[a.i
|
||||
netgis.Map.prototype.onMapLayerToggle=function(a){a=a.detail;switch(a.id){case netgis.LayerID.EDITABLE:a.on?this.map.addLayer(this.editLayer):this.map.removeLayer(this.editLayer);break;case netgis.LayerID.NON_EDITABLE:a.on?this.map.addLayer(this.nonEditLayer):this.map.removeLayer(this.nonEditLayer);break;default:if(a.on)for(var b=this.config.layers,c=0;c<b.length;c++){var d=b[c];d.id===a.id&&this.addLayer(a.id,d)}else this.removeLayer(a.id)}};
|
||||
netgis.Map.prototype.onMapLayerTransparency=function(a){a=a.detail;var b=this.layers[a.id];b||(netgis.util.invoke(this.container,netgis.Events.MAP_LAYER_TOGGLE,{id:a.id,on:!0}),b=this.layers[a.id]);b.setOpacity(1-a.transparency)};netgis.Map.prototype.onMapSnapToggle=function(a){this.setSnapping(a.detail.on)};
|
||||
netgis.Map.prototype.onMapMoveEnd=function(a){a=this.view.getCenter();var b=this.view.getZoom(),c=this.getScaleFromResolution(this.view.getResolution());!1===this.viewFromHistory&&this.addViewHistory(a,b);netgis.util.invoke(this.container,netgis.Events.MAP_VIEW_CHANGE,{center:a,zoom:b,scale:c});this.viewFromHistory=!1};
|
||||
netgis.Map.prototype.onPointerMove=function(a){var b=a.pixel;a=a.coordinate;var c=null,d=null,e=void 0,f=this;this.map.forEachFeatureAtPixel(b,function(a,b){if(b&&b!==f.measureLayer&&b!==f.nonEditLayer)if(b===f.boundsLayer)e=a;else if(b!==f.previewLayer)return c=a,d=b,!0});switch(this.mode){case netgis.Modes.DRAW_POINTS:case netgis.Modes.DRAW_LINES:this.updateDrawBufferPreview()}if(this.boundsLayer&&(this.mode===netgis.Modes.DRAW_POINTS||this.mode===netgis.Modes.DRAW_LINES||this.mode===netgis.Modes.DRAW_POLYGONS)){if(e)this.container.classList.remove("netgis-not-allowed"),
|
||||
this.container.removeAttribute("title");else{this.container.classList.add("netgis-not-allowed");var g=this.config.tools.bounds_message;g&&0<g.length&&this.container.setAttribute("title",g)}this.hoverBounds=e}g=!0;this.mode===netgis.Modes.VIEW&&(g=!1);this.mode===netgis.Modes.MEASURE_LINE&&(g=!1);this.mode===netgis.Modes.MEASURE_AREA&&(g=!1);this.mode===netgis.Modes.DRAW_POINTS&&(g=!1);this.mode===netgis.Modes.DRAW_LINES&&(g=!1);this.mode===netgis.Modes.DRAW_POLYGONS&&(g=!1);this.mode===netgis.Modes.CUT_FEATURES_DRAW&&
|
||||
(g=!1);if(c!==this.hoverFeature&&g){if(this.hoverFeature)this.onFeatureLeave(this.hoverFeature,this.hoverLayer,b,a);if(c)this.onFeatureEnter(c,d,b,a);this.redrawVectorLayers();this.hoverFeature=c;this.hoverLayer=d}if(c)this.onFeatureHover(c,d,b,a)};netgis.Map.prototype.onPointerLeave=function(a){this.hoverFeature&&(this.onFeatureLeave(this.hoverFeature,this.hoverLayer,[a.offsetX,a.offsetY],null),this.hoverLayer=this.hoverFeature=null)};
|
||||
netgis.Map.prototype.onPointerClick=function(a){var b=a.pixel;a=a.coordinate;this.popupOverlay.setPosition(a);var c=[],d=this;this.map.forEachFeatureAtPixel(b,function(a,b){b&&b!==d.nonEditLayer&&b!==d.boundsLayer&&b!==d.measureLayer&&b!==d.previewLayer&&(-1<d.sketchFeatures.indexOf(a)||c.push({feature:a,layer:b}))});var e=!0;this.mode===netgis.Modes.VIEW&&(e=!1);this.mode===netgis.Modes.MEASURE_LINE&&(e=!1);this.mode===netgis.Modes.MEASURE_AREA&&(e=!1);this.mode===netgis.Modes.DRAW_POINTS&&(e=!1);
|
||||
this.mode===netgis.Modes.DRAW_LINES&&(e=!1);this.mode===netgis.Modes.DRAW_POLYGONS&&(e=!1);this.mode===netgis.Modes.CUT_FEATURES_DRAW&&(e=!1);e&&(0<c.length&&!1===this.selectMultiple&&(this.selectedFeatures=[]),0===c.length&&!1===this.selectMultiple&&(this.selectedFeatures=[]),!0===this.selectReset&&(this.selectedFeatures=[],this.selectReset=!1),this.mode===netgis.Modes.BUFFER_FEATURES_DYNAMIC&&this.updateBufferFeaturesSketch(this.bufferFeaturesRadius,this.bufferFeaturesSegments));for(var f=0;f<c.length;f++){var g=
|
||||
c[f];if(e){var h=this.selectedFeatures.indexOf(g.feature);-1<h?this.selectedFeatures.splice(h,1):this.selectedFeatures.push(g.feature)}this.onFeatureClick(g.feature,g.layer,b,a)}e={resolution:this.view.getResolution(),projection:this.view.getProjection().getCode(),bbox:this.view.calculateExtent(this.map.getSize()),width:this.map.getSize()[0],height:this.map.getSize()[1]};f=ol.proj.toLonLat(a,this.view.getProjection());b={mode:this.mode,pixel:b,coords:a,lon:f[0],lat:f[1],overlay:this.popupOverlay.getElement(),
|
||||
view:e};netgis.util.invoke(this.container,netgis.Events.MAP_CLICK,b);this.redrawVectorLayers()};netgis.Map.prototype.onContainerClick=function(a){if(2===a.detail)this.onDoubleClick(a)};
|
||||
netgis.Map.prototype.onPointerMove=function(a){var b=a.pixel;a=a.coordinate;var c=null,d=null,e=void 0,f=this;this.map.forEachFeatureAtPixel(b,function(a,b){if(b&&b!==f.measureLayer&&b!==f.nonEditLayer)if(b===f.boundsLayer)e=a;else if(b!==f.previewLayer)return c=a,d=b,!0});switch(this.mode){case netgis.Modes.VIEW:0===this.getQueryableLayers(!0).length?c?this.container.classList.add("netgis-clickable"):this.container.classList.remove("netgis-clickable"):this.container.classList.add("netgis-clickable");
|
||||
break;case netgis.Modes.DRAW_POINTS:case netgis.Modes.DRAW_LINES:this.updateDrawBufferPreview()}if(this.boundsLayer&&(this.mode===netgis.Modes.DRAW_POINTS||this.mode===netgis.Modes.DRAW_LINES||this.mode===netgis.Modes.DRAW_POLYGONS)){if(e)this.container.classList.remove("netgis-not-allowed"),this.container.removeAttribute("title");else{this.container.classList.add("netgis-not-allowed");var g=this.config.tools.bounds_message;g&&0<g.length&&this.container.setAttribute("title",g)}this.hoverBounds=e}g=
|
||||
!0;this.mode===netgis.Modes.MEASURE_LINE&&(g=!1);this.mode===netgis.Modes.MEASURE_AREA&&(g=!1);this.mode===netgis.Modes.DRAW_POINTS&&(g=!1);this.mode===netgis.Modes.DRAW_LINES&&(g=!1);this.mode===netgis.Modes.DRAW_POLYGONS&&(g=!1);this.mode===netgis.Modes.CUT_FEATURES_DRAW&&(g=!1);if(c!==this.hoverFeature&&g){if(this.hoverFeature)this.onFeatureLeave(this.hoverFeature,this.hoverLayer,b,a);if(c)this.onFeatureEnter(c,d,b,a);this.redrawVectorLayers();this.hoverFeature=c;this.hoverLayer=d}if(c)this.onFeatureHover(c,
|
||||
d,b,a)};netgis.Map.prototype.onPointerLeave=function(a){this.hoverFeature&&(this.onFeatureLeave(this.hoverFeature,this.hoverLayer,[a.offsetX,a.offsetY],null),this.hoverLayer=this.hoverFeature=null)};
|
||||
netgis.Map.prototype.onPointerClick=function(a){var b=a.pixel;a=a.coordinate;this.popupOverlay.setPosition(a);var c={resolution:this.view.getResolution(),projection:this.view.getProjection().getCode(),bbox:this.view.calculateExtent(this.map.getSize()),width:this.map.getSize()[0],height:this.map.getSize()[1]},d=ol.proj.toLonLat(a,this.view.getProjection());c={mode:this.mode,pixel:b,coords:a,lon:d[0],lat:d[1],overlay:this.popupOverlay.getElement(),view:c};netgis.util.invoke(this.container,netgis.Events.MAP_CLICK,
|
||||
c);var e=[],f=this;this.map.forEachFeatureAtPixel(b,function(a,b){b&&b!==f.nonEditLayer&&b!==f.boundsLayer&&b!==f.measureLayer&&b!==f.previewLayer&&(-1<f.sketchFeatures.indexOf(a)||e.push({feature:a,layer:b}))});c=!0;this.mode===netgis.Modes.VIEW&&(c=!1);this.mode===netgis.Modes.MEASURE_LINE&&(c=!1);this.mode===netgis.Modes.MEASURE_AREA&&(c=!1);this.mode===netgis.Modes.DRAW_POINTS&&(c=!1);this.mode===netgis.Modes.DRAW_LINES&&(c=!1);this.mode===netgis.Modes.DRAW_POLYGONS&&(c=!1);this.mode===netgis.Modes.CUT_FEATURES_DRAW&&
|
||||
(c=!1);c&&(0<e.length&&!1===this.selectMultiple&&(this.selectedFeatures=[]),0===e.length&&!1===this.selectMultiple&&(this.selectedFeatures=[]),!0===this.selectReset&&(this.selectedFeatures=[],this.selectReset=!1),this.mode===netgis.Modes.BUFFER_FEATURES_DYNAMIC&&this.updateBufferFeaturesSketch(this.bufferFeaturesRadius,this.bufferFeaturesSegments));for(d=0;d<e.length;d++){var g=e[d];if(c){var h=this.selectedFeatures.indexOf(g.feature);-1<h?this.selectedFeatures.splice(h,1):this.selectedFeatures.push(g.feature)}this.onFeatureClick(g.feature,
|
||||
g.layer,b,a)}this.redrawVectorLayers()};netgis.Map.prototype.onContainerClick=function(a){if(2===a.detail)this.onDoubleClick(a)};
|
||||
netgis.Map.prototype.onDoubleClick=function(a){switch(this.mode){case netgis.Modes.MEASURE_LINE:this.interactions[netgis.Modes.MEASURE_LINE][2].finishDrawing();break;case netgis.Modes.MEASURE_AREA:this.interactions[netgis.Modes.MEASURE_AREA][2].finishDrawing();break;case netgis.Modes.DRAW_LINES:this.interactions[netgis.Modes.DRAW_LINES][0].finishDrawing();break;case netgis.Modes.DRAW_POLYGONS:this.interactions[netgis.Modes.DRAW_POLYGONS][0].finishDrawing();break;case netgis.Modes.CUT_FEATURES_DRAW:this.interactions[netgis.Modes.CUT_FEATURES_DRAW][0].finishDrawing()}};
|
||||
netgis.Map.prototype.onRightClick=function(a){switch(this.mode){case netgis.Modes.MEASURE_LINE:this.interactions[netgis.Modes.MEASURE_LINE][2].finishDrawing();break;case netgis.Modes.MEASURE_AREA:this.interactions[netgis.Modes.MEASURE_AREA][2].finishDrawing();break;case netgis.Modes.DRAW_LINES:this.interactions[netgis.Modes.DRAW_LINES][0].finishDrawing();break;case netgis.Modes.DRAW_POLYGONS:this.interactions[netgis.Modes.DRAW_POLYGONS][0].finishDrawing();break;case netgis.Modes.CUT_FEATURES_DRAW:this.interactions[netgis.Modes.CUT_FEATURES_DRAW][0].finishDrawing()}a.preventDefault();
|
||||
return!1};
|
||||
@ -261,29 +282,29 @@ a&&b.finishDrawing();27===a&&b.abortDrawing();8===a&&b.removeLastPoint();46===a&
|
||||
netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.CUT_FEATURES})}16===a&&(this.selectMultiple=!0)};
|
||||
netgis.Map.prototype.onKeyUp=function(a){a=a.keyCode||a.which;switch(this.mode){case netgis.Modes.BUFFER_FEATURES:this.selectMultiple&&netgis.util.invoke(this.container,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.BUFFER_FEATURES_EDIT});break;case netgis.Modes.CUT_FEATURES:this.selectMultiple&&netgis.util.invoke(this.container,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.CUT_FEATURES_DRAW})}16===a&&(this.selectReset=this.selectMultiple=!1,!0===this.config.tools.select_multi_reset&&(this.selectReset=
|
||||
!0))};
|
||||
netgis.Map.prototype.onFeatureEnter=function(a,b,c,d){if(b){switch(this.mode){case netgis.Modes.DELETE_FEATURES:case netgis.Modes.BUFFER_FEATURES:case netgis.Modes.BUFFER_FEATURES_DYNAMIC:case netgis.Modes.CUT_FEATURES:this.container.classList.add("netgis-clickable");a.setStyle(this.styleHover.bind(this));break;case netgis.Modes.SEARCH_PARCEL:this.container.classList.add("netgis-clickable"),a.setStyle(this.styleHover.bind(this))}netgis.util.invoke(this.container,netgis.Events.MAP_FEATURE_ENTER,{pixel:c,
|
||||
coords:d,layer:b.get("id"),properties:a.getProperties()})}};netgis.Map.prototype.onFeatureHover=function(a,b,c,d){};
|
||||
netgis.Map.prototype.onFeatureClick=function(a,b,c,d){c={pixel:c,coords:d,layer:this.hoverLayer?this.hoverLayer.get("id"):null,id:this.hoverFeature?this.hoverFeature.getId():null,properties:this.hoverFeature?this.hoverFeature.getProperties():null};netgis.util.invoke(this.container,netgis.Events.MAP_FEATURE_CLICK,c);switch(this.mode){case netgis.Modes.DELETE_FEATURES:b.getSource().removeFeature(a);this.onFeatureLeave(a,b);netgis.util.invoke(this.container,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.VIEW});
|
||||
break;case netgis.Modes.BUFFER_FEATURES:case netgis.Modes.BUFFER_FEATURES_EDIT:this.onFeatureLeave(a,b);this.selectMultiple?netgis.util.invoke(this.container,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.BUFFER_FEATURES}):netgis.util.invoke(this.container,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.BUFFER_FEATURES_EDIT});break;case netgis.Modes.BUFFER_FEATURES_DYNAMIC:this.updateBufferFeaturesSketch(this.bufferFeaturesRadius,this.bufferFeaturesSegments);break;case netgis.Modes.CUT_FEATURES:if(a.getGeometry()instanceof
|
||||
ol.geom.Point)this.onFeatureLeave(a,b);else this.selectMultiple||netgis.util.invoke(this.container,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.CUT_FEATURES_DRAW})}};
|
||||
netgis.Map.prototype.onFeatureEnter=function(a,b,c,d){if(b){switch(this.mode){case netgis.Modes.VIEW:this.container.classList.add("netgis-clickable");break;case netgis.Modes.DELETE_FEATURES:case netgis.Modes.BUFFER_FEATURES:case netgis.Modes.BUFFER_FEATURES_DYNAMIC:case netgis.Modes.CUT_FEATURES:this.container.classList.add("netgis-clickable");a.setStyle(this.styleHover.bind(this));break;case netgis.Modes.SEARCH_PARCEL:this.container.classList.add("netgis-clickable"),a.setStyle(this.styleHover.bind(this))}netgis.util.invoke(this.container,netgis.Events.MAP_FEATURE_ENTER,
|
||||
{pixel:c,coords:d,layer:b.get("id"),properties:a.getProperties()})}};netgis.Map.prototype.onFeatureHover=function(a,b,c,d){};
|
||||
netgis.Map.prototype.onFeatureClick=function(a,b,c,d){var e=ol.proj.toLonLat(d,this.view.getProjection());c={pixel:c,coords:d,lon:e[0],lat:e[1],layer:b.get("id"),id:a.getId(),properties:a.getProperties()};netgis.util.invoke(this.container,netgis.Events.MAP_FEATURE_CLICK,c);switch(this.mode){case netgis.Modes.DELETE_FEATURES:b.getSource().removeFeature(a);this.onFeatureLeave(a,b);netgis.util.invoke(this.container,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.VIEW});break;case netgis.Modes.BUFFER_FEATURES:case netgis.Modes.BUFFER_FEATURES_EDIT:this.onFeatureLeave(a,
|
||||
b);this.selectMultiple?netgis.util.invoke(this.container,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.BUFFER_FEATURES}):netgis.util.invoke(this.container,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.BUFFER_FEATURES_EDIT});break;case netgis.Modes.BUFFER_FEATURES_DYNAMIC:this.updateBufferFeaturesSketch(this.bufferFeaturesRadius,this.bufferFeaturesSegments);break;case netgis.Modes.CUT_FEATURES:if(a.getGeometry()instanceof ol.geom.Point)this.onFeatureLeave(a,b);else this.selectMultiple||netgis.util.invoke(this.container,
|
||||
netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.CUT_FEATURES_DRAW})}};
|
||||
netgis.Map.prototype.onFeatureLeave=function(a,b,c,d){netgis.util.invoke(this.container,netgis.Events.MAP_FEATURE_LEAVE,{pixel:c,coords:d,layer:b?b.get("id"):null,properties:a.getProperties()});switch(this.mode){case netgis.Modes.DELETE_FEATURES:case netgis.Modes.BUFFER_FEATURES:case netgis.Modes.BUFFER_FEATURES_DYNAMIC:case netgis.Modes.CUT_FEATURES:case netgis.Modes.CUT_FEATURES_DRAW:this.container.classList.remove("netgis-clickable");a.setStyle(null);break;case netgis.Modes.SEARCH_PARCEL:this.container.classList.remove("netgis-clickable"),
|
||||
a.setStyle(null)}};netgis.Map.prototype.onEditLayerAdd=function(a){this.editEventsSilent||this.updateEditOutput();this.snapFeatures.push(a.feature)};netgis.Map.prototype.onEditLayerRemove=function(a){this.editEventsSilent||this.updateEditOutput();this.snapFeatures.remove(a.feature)};netgis.Map.prototype.onEditLayerChange=function(a){this.editEventsSilent||this.updateEditOutput()};
|
||||
netgis.Map.prototype.onCopyFeatureToEdit=function(a){a=a.detail;var b=this.layers[a.source].getSource().getFeatureById(a.id);b?this.editLayer.getSource().getFeatureById(a.id)||(b.setStyle(void 0),this.selectedFeatures=[],this.editLayer.getSource().addFeature(b)):console.error("feature to copy not found",a)};netgis.Map.prototype.onMeasureLineBegin=function(a){this.measureLayer.getSource().clear()};netgis.Map.prototype.onMeasureAreaBegin=function(a){this.measureLayer.getSource().clear()};
|
||||
netgis.Map.prototype.onMeasureClear=function(a){this.measureLayer.getSource().clear()};
|
||||
netgis.Map.prototype.onCopyFeatureToEdit=function(a){a=a.detail;var b=this.layers[a.source].getSource().getFeatureById(a.id);b?this.editLayer.getSource().getFeatureById(a.id)||(b.setStyle(void 0),this.selectedFeatures=[],this.editLayer.getSource().addFeature(b)):console.error("feature to copy not found",a)};netgis.Map.prototype.onGeolocToggleActive=function(a){a.detail.on?this.geolocLayer.setVisible(!0):this.geolocLayer.setVisible(!1)};
|
||||
netgis.Map.prototype.onGeolocChange=function(a){a=a.detail;this.geolocLayer.getSource().getFeatures()[0].getGeometry().setCoordinates(ol.proj.fromLonLat([a.lon,a.lat],this.view.getProjection()));!0===a.center&&this.zoomLonLat(a.lon,a.lat,this.view.getZoom())};netgis.Map.prototype.onMeasureLineBegin=function(a){this.measureLayer.getSource().clear()};netgis.Map.prototype.onMeasureAreaBegin=function(a){this.measureLayer.getSource().clear()};netgis.Map.prototype.onMeasureClear=function(a){this.measureLayer.getSource().clear()};
|
||||
netgis.Map.prototype.onDrawBufferEnd=function(a){var b=a.feature;a=this.previewLayer.getSource().getFeatures();if(0!==a.length){a=a[0];if(this.boundsLayer){var c=!0;c=b.getGeometry()instanceof ol.geom.Point?this.isPointInsideLayer(this.boundsLayer,b.getGeometry().getCoordinates()):this.isGeomInsideLayer(this.boundsLayer,b.getGeometry());if(!c)return;c=new jsts.io.OL3Parser;for(var d=c.read(a.getGeometry()),e=this.boundsLayer.getSource().getFeatures(),f=0;f<e.length;f++){var g=c.read(e[f].getGeometry());
|
||||
d.intersects(g)&&(d=d.intersection(g))}c=c.write(d);a.setGeometry(c)}var h=this.editLayer.getSource();h.addFeature(a.clone());window.setTimeout(function(){h.removeFeature(b)},10)}};netgis.Map.prototype.onDrawBufferToggle=function(a){a=a.detail;this.setDrawBuffer(a.on,a.radius,a.segments)};netgis.Map.prototype.onDrawBufferChange=function(a){a=a.detail;this.drawBufferRadius=a.radius;this.drawBufferSegments=a.segments;this.updateDrawBufferPreview()};
|
||||
netgis.Map.prototype.onBufferChange=function(a){a=a.detail;this.updateBufferFeaturesSketch(a.radius,a.segments);this.bufferFeaturesRadius=a.radius;this.bufferFeaturesSegments=a.segments};netgis.Map.prototype.updateBufferFeaturesSketch=function(a,b){var c=this.selectedFeatures,d=this.editLayer.getSource();this.clearSketchFeatures();for(var e=0;e<c.length;e++){var f=this.createBufferFeature(this.selectedFeatures[e].getGeometry(),a,b);d.addFeature(f);this.sketchFeatures.push(f)}};
|
||||
netgis.Map.prototype.onBufferAccept=function(a){a=this.selectedFeatures;for(var b=this.editLayer.getSource(),c=0;c<a.length;c++)b.removeFeature(a[c]);this.sketchFeatures=[];this.selectedFeatures=[]};
|
||||
netgis.Map.prototype.onCutFeaturesDrawEnd=function(a){a=a.feature;for(var b=0;b<this.selectedFeatures.length;b++){var c=this.selectedFeatures[b];if(c)if(this.onFeatureLeave(c,null),c.getGeometry()instanceof ol.geom.Point)console.error("trying to cut a point feature",c);else{var d=new jsts.io.OL3Parser,e=d.read(c.getGeometry()),f=d.read(a.getGeometry());e=e.difference(f);d=d.write(e);d=new ol.Feature({geometry:d});e=this.editLayer.getSource();e.removeFeature(c);e.addFeature(d)}}this.selectedFeatures=
|
||||
[];this.editEventsSilent=!0;this.splitMultiPolygons(this.editLayer);this.editEventsSilent=!1;this.updateEditOutput();netgis.util.invoke(this.container,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.VIEW})};netgis.Map.prototype.onImportLayerAccept=function(a){a=a.detail;a=this.addLayer(a.id,a);0!==a.getSource().getFeatures().length&&this.view.fit(a.getSource().getExtent(),{duration:600})};netgis.Map.prototype.onImportGeoportalSubmit=function(a){};
|
||||
[];this.editEventsSilent=!0;this.splitMultiPolygons(this.editLayer);this.editEventsSilent=!1;this.updateEditOutput();netgis.util.invoke(this.container,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.VIEW})};netgis.Map.prototype.onImportLayerAccept=function(a){a=a.detail;a=this.addLayer(a.id,a);var b=a.getSource();b instanceof ol.source.Vector&&0<b.getFeatures().length&&this.view.fit(a.getSource().getExtent(),{duration:600})};netgis.Map.prototype.onImportGeoportalSubmit=function(a){};
|
||||
netgis.Map.prototype.onImportLayerPreview=function(a){a=a.detail;var b=this.createLayer(a),c=this.view.getProjection().getCode();netgis.util.invoke(this.container,netgis.Events.IMPORT_LAYER_PREVIEW_FEATURES,{id:a.id,title:a.title,layer:b,proj:c})};netgis.Map.prototype.onSearchParcelReset=function(a){(a=this.config.searchparcel.districts_service.min_zoom)&&this.view.setZoom(a)};netgis.Map.prototype.onSearchParcelItemEnter=function(a){a=a.detail.id;this.layers.searchparcel_parcels.getSource().getFeatureById(a).setStyle(this.styleHover.bind(this))};
|
||||
netgis.Map.prototype.onSearchParcelItemLeave=function(a){a=a.detail.id;this.layers.searchparcel_parcels.getSource().getFeatureById(a).setStyle(null)};netgis.Map.prototype.onSearchParcelItemClick=function(a){a=a.detail.id;console.info("PARCEL CLICK:",a);this.zoomFeature("searchparcel_parcels",a)};netgis.Map.prototype.onSearchParcelItemImport=function(a){};netgis.Map.prototype.onDrawPointsUpdateGeom=function(a,b,c){b?b.setCoordinates(a):b=new ol.geom.Point(a);return b};
|
||||
netgis.Map.prototype.onDrawLinesUpdateGeom=function(a,b,c){b?b.setCoordinates(a):b=new ol.geom.LineString(a);this.drawError=!this.isGeomInsideLayer(this.boundsLayer,b);return b};
|
||||
netgis.Map.prototype.onDrawPolygonsUpdateGeom=function(a,b,c){b?(a=[a[0].concat([a[0][0]])],b.setCoordinates(a)):b=new ol.geom.Polygon(a);c=!0;if(4>a[0].length)for(var d=0;d<a[0].length;d++){if(!this.isPointInsideLayer(this.boundsLayer,a[0][d])){c=!1;break}}else c=this.isGeomInsideLayer(this.boundsLayer,b);this.drawError=!c;return b};
|
||||
netgis.Map.prototype.onDrawPointsEnd=function(a){if(this.boundsLayer){var b=a.feature,c=this.editLayer;this.isPointInsideLayer(this.boundsLayer,b.getGeometry().getCoordinates())||window.setTimeout(function(){c.getSource().removeFeature(b)},10)}};netgis.Map.prototype.onDrawLinesEnd=function(a){if(this.boundsLayer){var b=a.feature,c=this.editLayer;this.isGeomInsideLayer(this.boundsLayer,b.getGeometry())||window.setTimeout(function(){c.getSource().removeFeature(b)},10)}};
|
||||
netgis.Map.prototype.onDrawPolygonsEnd=function(a){if(this.boundsLayer){var b=a.feature,c=this.editLayer;this.isGeomInsideLayer(this.boundsLayer,b.getGeometry())||window.setTimeout(function(){c.getSource().removeFeature(b)},10)}};netgis.Map.prototype.onExportBegin=function(a){a=a.detail;switch(a.format){case "geojson":this.exportFeatures(a.nonEdits);break;default:this.exportImage(a.format,a.width,a.height,a.landscape,a.padding)}};
|
||||
netgis.Map.prototype.onScalebarSelectChange=function(a){a=this.scalebarSelect.value;console.info("Scalebar Click:",this.scalebar,a);netgis.util.invoke(this.scalebarSelect,netgis.Events.MAP_ZOOM_SCALE,{scale:a,anim:!0})};netgis.Map.prototype.onTimeSliderShow=function(a){};netgis.Map.prototype.onTimeSliderHide=function(a){};netgis.Map.prototype.onTimeSliderSelect=function(a){a=a.detail;console.info("Time Slider Select:",a);this.layers[a.layer].getSource().updateParams({TIME:a.time})};netgis=netgis||{};netgis.Menu=function(a){this.config=a;this.initElements();this.initConfig(a)};
|
||||
netgis.Menu.prototype.initElements=function(){this.container=document.createElement("nav");this.container.className="netgis-menu netgis-noselect netgis-color-a netgis-shadow-large";this.toggle=document.createElement("button");this.toggle.setAttribute("type","button");this.toggle.addEventListener("click",this.onToggleClick.bind(this));this.toggle.className="netgis-menu-toggle netgis-hover-c";this.toggle.innerHTML="<i class='fas fa-bars'></i>";this.container.appendChild(this.toggle)};
|
||||
netgis.Map.prototype.onScalebarSelectChange=function(a){netgis.util.invoke(this.scalebarSelect,netgis.Events.MAP_ZOOM_SCALE,{scale:this.scalebarSelect.value,anim:!0})};netgis.Map.prototype.onTimeSliderShow=function(a){};netgis.Map.prototype.onTimeSliderHide=function(a){};netgis.Map.prototype.onTimeSliderSelect=function(a){a=a.detail;console.info("Time Slider Select:",a);this.layers[a.layer].getSource().updateParams({TIME:a.time})};netgis=netgis||{};netgis.Menu=function(a){this.config=a;this.initElements();this.initConfig(a)};
|
||||
netgis.Menu.prototype.initElements=function(){this.container=document.createElement("nav");this.container.className="netgis-menu netgis-noselect netgis-color-a netgis-gradient-a netgis-shadow-large";this.toggle=document.createElement("button");this.toggle.setAttribute("type","button");this.toggle.addEventListener("click",this.onToggleClick.bind(this));this.toggle.className="netgis-menu-toggle netgis-hover-c";this.toggle.innerHTML="<i class='fas fa-bars'></i>";this.container.appendChild(this.toggle)};
|
||||
netgis.Menu.prototype.initConfig=function(a){!0===a.menu.compact&&this.container.classList.add("netgis-compact");this.addHeader(a.menu.header);for(var b=a.menu.items,c=0;c<b.length;c++){var d=b[c];if(d.items)this.addDropdown(d.title,d.items);else if(d.url&&0<d.url.length)this.addLink(d.url,d.title);else if(d.options){var e;if("scales"===d.options){var f={0:"1:X"};for(e=0;e<a.map.scales.length;e++)f[a.map.scales[e]]="1:"+a.map.scales[e];e=a.map.default_scale;this.addSelect(d.id,d.title,f,e).options[0].classList.add("netgis-hide")}else{f=
|
||||
d.options;if(d.value)e=d.value;else for(var g in f){e=g;break}this.addSelect(d.id,d.title,f,e)}}else this.addButton(d.id,d.title)}};netgis.Menu.prototype.attachTo=function(a){a.appendChild(this.container);a.addEventListener(netgis.Events.MAP_VIEW_CHANGE,this.onMapViewChange.bind(this))};netgis.Menu.prototype.addHeader=function(a){var b=document.createElement("h1");b.className="netgis-hover-c";b.innerHTML=a;this.container.appendChild(b);return b};
|
||||
netgis.Menu.prototype.addButton=function(a,b){a=this.createButton(a,b);this.container.appendChild(a);return a};netgis.Menu.prototype.addLink=function(a,b){a=this.createLink(a,b);this.container.appendChild(a);return a};
|
||||
@ -299,21 +320,23 @@ netgis.Menu.prototype.onSelectChange=function(a){a=a.currentTarget;var b=a.getAt
|
||||
netgis.Menu.prototype.onMapViewChange=function(a){a=a.detail;for(var b=a.scale,c=this.container.getElementsByTagName("button"),d=0;d<c.length;d++){var e=c[d];"zoom_scale"===e.getAttribute("data-id")&&(Number.parseInt(e.innerText.split(":")[1])===b?e.classList.add("netgis-bold"):e.classList.remove("netgis-bold"))}c=this.container.getElementsByTagName("select");for(d=0;d<c.length;d++){e=c[d];if("scales"===!e.getAttribute("data-id"))break;for(var f=!1,g=this.config.map.scales,h=0;h<g.length;h++)if(g[h]===
|
||||
b){f=!0;break}f?e.options[0].classList.add("netgis-hide"):(e.options[0].setAttribute("value",a.scale),e.options[0].innerHTML="1:"+a.scale,e.options[0].classList.remove("netgis-hide"));e.value=b}};netgis=netgis||{};netgis.Modal=function(a){this.initElements(a);this.initEvents()};netgis.Modal.prototype.initElements=function(a){this.container=document.createElement("div");this.container.className="netgis-modal";this.container.addEventListener("click",this.onContainerClick.bind(this));this.content=document.createElement("div");this.content.className="netgis-color-e netgis-shadow";this.container.appendChild(this.content);this.header=this.addHeader(this.content,a,this.onHeaderClick.bind(this))};
|
||||
netgis.Modal.prototype.initEvents=function(){};netgis.Modal.prototype.attachTo=function(a){a.appendChild(this.container)};netgis.Modal.prototype.show=function(){this.container.classList.add("netgis-show")};netgis.Modal.prototype.hide=function(){this.container.classList.remove("netgis-show")};
|
||||
netgis.Modal.prototype.addHeader=function(a,b,c){var d=document.createElement("button");d.className="netgis-button netgis-clip-text netgis-color-c";d.innerHTML="<span>"+b+"</span><i class='netgis-icon fas fa-times'></i>";d.setAttribute("type","button");c&&(d.onclick=c);a&&a.appendChild(d);return d};netgis.Modal.prototype.onHeaderClick=function(a){this.hide()};netgis.Modal.prototype.onContainerClick=function(a){a.target===this.container&&this.hide()};netgis=netgis||{};
|
||||
netgis.Modal.prototype.addHeader=function(a,b,c){var d=document.createElement("button");d.className="netgis-button netgis-clip-text netgis-color-c netgis-gradient-a";d.innerHTML="<span>"+b+"</span><i class='netgis-icon fas fa-times'></i>";d.setAttribute("type","button");c&&(d.onclick=c);a&&a.appendChild(d);return d};netgis.Modal.prototype.onHeaderClick=function(a){this.hide()};netgis.Modal.prototype.onContainerClick=function(a){a.target===this.container&&this.hide()};netgis=netgis||{};
|
||||
netgis.Modes=Object.freeze({VIEW:"view",ZOOM_BOX:"zoom-box",MEASURE_LINE:"measure-line",MEASURE_AREA:"measure-area",DRAW_POINTS:"draw-points",DRAW_LINES:"draw-lines",DRAW_POLYGONS:"draw-polygons",MODIFY_FEATURES:"modify-features",DELETE_FEATURES:"delete-features",BUFFER_FEATURES:"buffer-features",BUFFER_FEATURES_EDIT:"buffer-features-edit",BUFFER_FEATURES_DYNAMIC:"buffer-features-dynamic",CUT_FEATURES:"cut-features",CUT_FEATURES_DRAW:"cut-features-draw",CUT_FEATURES_DYNAMIC:"cut-features-dynamic",SEARCH_PARCEL:"search-parcel"});netgis=netgis||{};
|
||||
netgis.OWS=function(){return{read:function(a,b){b={layers:[],folders:[]};netgis.util.isDefined(a.properties)&&(b.bbox=a.properties.bbox);a=a.features;for(var c=0;c<a.length;c++){var d=a[c];if("Feature"===d.type){var e=d.properties;e=e.folder;var f=!1;for(d=0;d<b.folders.length;d++)if(b.folders[d].id===e){f=!0;break}if(!f){d=e.split("/");e=[];for(f=0;f<d.length;f++){var g=d[f];0<g.length&&e.push(g)}var h=-1;for(f=0;f<e.length;f++){g=e[f];var k="/"+e.slice(0,f+1).join("/"),l=!1;for(d=0;d<b.folders.length;d++)if(b.folders[d].path===
|
||||
k){h=d;l=!0;break}l||(d=b.folders.length,b.folders.push({title:g,parent:h,path:k}),h=d)}}}}for(c=0;c<a.length;c++)if(d=a[c],"Feature"===d.type){e=d.properties;f=-1;for(d=0;d<b.folders.length;d++)if(b.folders[d].path===e.folder){f=d;break}d=e.offerings;for(g=0;g<d.length;g++)switch(h=d[g],k=h.operations,h.code){case "http://www.opengis.net/spec/owc-geojson/1.0/req/wms":b.layers.push({folder:f,type:netgis.LayerTypes.WMS,url:k[0].href,title:e.title,attribution:e.rights,active:e.active});break;case "http://www.opengis.net/spec/owc-geojson/1.0/req/xyz":h=
|
||||
k[0];b.layers.push({folder:f,type:netgis.LayerTypes.XYZ,url:h.href,title:e.title,attribution:e.rights,active:e.active});break;case "http://www.opengis.net/spec/owc-geojson/1.0/req/osm":h=k[0],b.layers.push({folder:f,type:netgis.LayerTypes.XYZ,url:h.href,title:e.title,attribution:e.rights,active:e.active})}}return b}}}();netgis=netgis||{};netgis.Panel=function(a){this.initElements(a);this.initEvents()};netgis.Panel.prototype.initElements=function(a){var b=document.createElement("section");b.className="netgis-panel netgis-resize-right netgis-color-e netgis-shadow";this.content=document.createElement("div");b.appendChild(this.content);this.header=this.addHeader(b,a,this.onHeaderClick.bind(this));this.container=b};netgis.Panel.prototype.initEvents=function(){this.resizeObserver=(new ResizeObserver(this.onResize.bind(this))).observe(this.container)};
|
||||
netgis.Panel.prototype.attachTo=function(a){a.appendChild(this.container)};netgis.Panel.prototype.addHeader=function(a,b,c){var d=document.createElement("button");d.className="netgis-button netgis-clip-text netgis-color-c netgis-shadow";d.innerHTML="<span>"+b+"</span><i class='netgis-icon fas fa-times'></i>";d.setAttribute("type","button");c&&(d.onpointerdown=c);a&&a.appendChild(d);return d};
|
||||
netgis.Panel.prototype.attachTo=function(a){a.appendChild(this.container)};netgis.Panel.prototype.addHeader=function(a,b,c){var d=document.createElement("button");d.className="netgis-button netgis-clip-text netgis-color-c netgis-gradient-a netgis-shadow";d.innerHTML="<span>"+b+"</span><i class='netgis-icon fas fa-times'></i>";d.setAttribute("type","button");c&&(d.onpointerdown=c);a&&a.appendChild(d);return d};
|
||||
netgis.Panel.prototype.show=function(){this.container.classList.contains("netgis-show")||(this.container.classList.add("netgis-show"),netgis.util.invoke(this.container,netgis.Events.PANEL_TOGGLE,{visible:!0,width:this.container.getBoundingClientRect().width}))};netgis.Panel.prototype.hide=function(){this.container.classList.contains("netgis-show")&&(this.container.classList.remove("netgis-show"),netgis.util.invoke(this.container,netgis.Events.PANEL_TOGGLE,{visible:!1}))};
|
||||
netgis.Panel.prototype.toggle=function(){this.container.classList.toggle("netgis-show");var a=this.container.classList.contains("netgis-show");netgis.util.invoke(this.container,netgis.Events.PANEL_TOGGLE,{visible:a,width:a?this.container.getBoundingClientRect().width:void 0})};netgis.Panel.prototype.visible=function(){return this.container.classList.contains("netgis-show")};netgis.Panel.prototype.width=function(){return this.container.getBoundingClientRect().width};
|
||||
netgis.Panel.prototype.setTitle=function(a){this.header.getElementsByTagName("span")[0].innerHTML=a};netgis.Panel.prototype.onHeaderClick=function(a){this.hide()};netgis.Panel.prototype.onResize=function(a){this.container.classList.contains("netgis-show")&&(a=this.container.getBoundingClientRect(),netgis.util.invoke(this.container,netgis.Events.PANEL_RESIZE,{width:a.width}))};netgis=netgis||{};netgis.Popup=function(){this.initElements()};
|
||||
netgis.Popup.prototype.initElements=function(){document.body.addEventListener("pointerdown",this.onDocumentPointerDown.bind(this));this.container=document.createElement("div");this.container.className="netgis-popup";this.container.addEventListener("pointerdown",this.onPointerDown.bind(this));this.content=document.createElement("div");this.content.className="netgis-content netgis-color-e netgis-round";this.container.appendChild(this.content);this.arrow=document.createElement("div");this.arrow.className=
|
||||
"netgis-arrow-down";this.container.appendChild(this.arrow);this.closer=document.createElement("button");this.closer.setAttribute("type","button");this.closer.className="netgis-closer netgis-color-e netgis-text-a";this.closer.innerHTML="<span></span><i class='fas fa-times'></i>";this.closer.onclick=this.onCloserClick.bind(this);this.content.appendChild(this.closer);this.loader=document.createElement("div");this.loader.className="netgis-loader netgis-text-a";this.loader.innerHTML="<i class='netgis-icon netgis-anim-spin fas fa-sync-alt'></i>";
|
||||
this.wrapper=document.createElement("div");this.wrapper.className="netgis-wrapper";this.content.appendChild(this.wrapper)};netgis.Popup.prototype.attachTo=function(a){a.appendChild(this.container)};netgis.Popup.prototype.show=function(){this.container.classList.add("netgis-show")};netgis.Popup.prototype.hide=function(){this.container.classList.remove("netgis-show")};netgis.Popup.prototype.showLoader=function(){this.content.appendChild(this.loader)};
|
||||
netgis.Panel.prototype.setTitle=function(a){this.header.getElementsByTagName("span")[0].innerHTML=a};netgis.Panel.prototype.onHeaderClick=function(a){this.hide()};netgis.Panel.prototype.onResize=function(a){this.container.classList.contains("netgis-show")&&(a=this.container.getBoundingClientRect(),netgis.util.invoke(this.container,netgis.Events.PANEL_RESIZE,{width:a.width}))};netgis=netgis||{};netgis.Popup=function(a){a||(a={direction:"down"});this.options=a;this.initElements()};
|
||||
netgis.Popup.prototype.initElements=function(){document.body.addEventListener("pointerdown",this.onDocumentPointerDown.bind(this));this.container=document.createElement("div");this.container.className="netgis-popup";this.container.addEventListener("pointerdown",this.onPointerDown.bind(this));this.content=document.createElement("div");this.content.className="netgis-content netgis-color-e netgis-round";this.container.appendChild(this.content);switch(this.options.direction){default:case "down":this.container.classList.add("netgis-dir-down");
|
||||
break;case "right":this.container.classList.add("netgis-dir-right")}this.arrow=document.createElement("div");this.arrow.className="netgis-arrow";this.container.appendChild(this.arrow);this.closer=document.createElement("button");this.closer.setAttribute("type","button");this.closer.className="netgis-closer netgis-color-e netgis-text-a";this.closer.innerHTML="<span></span><i class='fas fa-times'></i>";this.closer.onclick=this.onCloserClick.bind(this);this.content.appendChild(this.closer);this.loader=
|
||||
document.createElement("div");this.loader.className="netgis-loader netgis-color-e netgis-text-a";this.loader.innerHTML="<i class='netgis-icon netgis-anim-spin fas fa-sync-alt'></i>";this.wrapper=document.createElement("div");this.wrapper.className="netgis-wrapper";this.content.appendChild(this.wrapper)};netgis.Popup.prototype.attachTo=function(a){a.appendChild(this.container)};
|
||||
netgis.Popup.prototype.show=function(){this.container.classList.add("netgis-show");netgis.util.isMobile()&&(this.container.style.width=document.body.getBoundingClientRect().width-10+"px")};netgis.Popup.prototype.hide=function(){this.container.classList.remove("netgis-show")};netgis.Popup.prototype.isVisible=function(){return this.container.classList.contains("netgis-show")};netgis.Popup.prototype.showLoader=function(){this.content.appendChild(this.loader)};
|
||||
netgis.Popup.prototype.hideLoader=function(){this.loader.parentNode===this.content&&this.content.removeChild(this.loader)};
|
||||
netgis.Popup.prototype.setPosition=function(a,b){var c=this.container.parentNode.getBoundingClientRect(),d=this.arrow.getBoundingClientRect();a>c.width-d.width&&(a=c.width-d.width);a<d.width&&(a=d.width);this.container.style.left=a+"px";this.container.style.top=b+"px";this.content.style.left="";a=this.content.getBoundingClientRect();0>a.x?this.content.style.left=-a.x+"px":a.x+a.width>c.width&&(this.content.style.left=-(a.x+a.width-c.width)+"px")};
|
||||
netgis.Popup.prototype.setHeader=function(a){this.closer.getElementsByTagName("span")[0].innerHTML=a};netgis.Popup.prototype.setContent=function(a){this.wrapper.innerHTML=a};netgis.Popup.prototype.clearContent=function(){this.wrapper.innerHTML=""};netgis.Popup.prototype.addContent=function(a){this.wrapper.innerHTML+=a};netgis.Popup.prototype.onDocumentPointerDown=function(a){};netgis.Popup.prototype.onPointerDown=function(a){a.stopPropagation()};netgis.Popup.prototype.onCloserClick=function(a){this.hide()};netgis=netgis||{};netgis.Search=function(a){this.debounce=400;this.initElements(a);this.initEvents()};
|
||||
netgis.Popup.prototype.setPosition=function(a,b){var c=this.container.parentNode.getBoundingClientRect(),d=this.arrow.getBoundingClientRect();a>c.width-d.width&&(a=c.width-d.width);a<d.width&&(a=d.width);switch(this.options.direction){default:case "down":this.container.style.left=a+"px";this.container.style.top=b+"px";break;case "right":this.container.style.right=c.width-a+"px",this.container.style.top=b+"px"}this.content.style.left="";a=this.content.getBoundingClientRect();0>a.x?this.content.style.left=
|
||||
-a.x+"px":a.x+a.width>c.width&&(this.content.style.left=-(a.x+a.width-c.width)+"px")};netgis.Popup.prototype.setHeader=function(a){this.closer.getElementsByTagName("span")[0].innerHTML=a};netgis.Popup.prototype.setContent=function(a){this.wrapper.innerHTML=a};netgis.Popup.prototype.clearContent=function(){this.wrapper.innerHTML=""};netgis.Popup.prototype.addContent=function(a){this.wrapper.innerHTML+=a};netgis.Popup.prototype.onDocumentPointerDown=function(a){};
|
||||
netgis.Popup.prototype.onPointerDown=function(a){a.stopPropagation()};netgis.Popup.prototype.onCloserClick=function(a){this.hide()};netgis=netgis||{};netgis.Search=function(a){this.debounce=400;this.initElements(a);this.initEvents()};
|
||||
netgis.Search.prototype.initElements=function(a){var b=document.createElement("div");b.className="netgis-search";this.container=b;var c=document.createElement("label");b.appendChild(c);this.label=c;var d=document.createElement("input");d.className="netgis-round netgis-shadow";d.setAttribute("type","text");d.setAttribute("placeholder",a);c.appendChild(d);this.input=d;a=document.createElement("button");a.setAttribute("type","button");a.innerHTML="<i class='fas fa-search'></i>";c.appendChild(a);this.button=
|
||||
a;a=document.createElement("button");a.setAttribute("type","button");a.className="netgis-hide";a.innerHTML="<i class='fas fa-times'></i>";c.appendChild(a);this.closer=a;c=document.createElement("ul");b.appendChild(c);this.results=c};
|
||||
netgis.Search.prototype.initEvents=function(){this.input.addEventListener("change",this.onInputChange.bind(this));this.input.addEventListener("keydown",this.onInputKeyDown.bind(this));this.input.addEventListener("keyup",this.onInputKeyUp.bind(this));this.button.addEventListener("click",this.onButtonClick.bind(this));this.closer.addEventListener("click",this.onCloserClick.bind(this))};netgis.Search.prototype.attachTo=function(a){a.appendChild(this.container)};netgis.Search.prototype.show=function(){this.container.classList.remove("netgis-hide")};
|
||||
@ -333,8 +356,8 @@ c.setAttribute("type","button");c.addEventListener("click",this.onBottomHeaderCl
|
||||
netgis.SearchParcel.prototype.initEvents=function(){this.resizeObserver=(new ResizeObserver(this.onTopResize.bind(this))).observe(this.top)};
|
||||
netgis.SearchParcel.prototype.initConfig=function(a){this.districtsLayer=a.searchparcel.districts_service;this.districtsLayer.id=this.districtsLayerID;this.districtsLayer.style=a.styles.parcel;this.districtsLayer.order=99999;a.layers.push(this.districtsLayer);this.fieldsLayer={id:this.fieldsLayerID,type:netgis.LayerTypes.GEOJSON,style:a.styles.parcel,order:99999,data:null};a.layers.push(this.fieldsLayer);this.parcelsLayer={id:this.parcelsLayerID,type:netgis.LayerTypes.WKT,style:a.styles.parcel,order:99999,
|
||||
data:null};a.layers.push(this.parcelsLayer);if(!0===a.searchparcel.open){var b=this;window.setTimeout(function(){b.panel.show()},100)}};
|
||||
netgis.SearchParcel.prototype.attachTo=function(a){this.panel.attachTo(a);a.addEventListener(netgis.Events.CLIENT_SET_MODE,this.onClientSetMode.bind(this));a.addEventListener(netgis.Events.SEARCHPARCEL_TOGGLE,this.onSearchParcelToggle.bind(this));a.addEventListener(netgis.Events.LAYERTREE_TOGGLE,this.onLayerTreeToggle.bind(this));a.addEventListener(netgis.Events.TOOLBOX_TOGGLE,this.onToolboxToggle.bind(this));a.addEventListener(netgis.Events.MAP_FEATURE_ENTER,this.onMapFeatureEnter.bind(this));a.addEventListener(netgis.Events.MAP_FEATURE_CLICK,
|
||||
this.onMapFeatureClick.bind(this));a.addEventListener(netgis.Events.MAP_FEATURE_LEAVE,this.onMapFeatureLeave.bind(this))};netgis.SearchParcel.prototype.createInput=function(a){var b=document.createElement("label");b.className="netgis-hover-text-primary";b.innerHTML=a;a=document.createElement("input");a.setAttribute("type","text");b.appendChild(a);return b};
|
||||
netgis.SearchParcel.prototype.attachTo=function(a){this.panel.attachTo(a);a.addEventListener(netgis.Events.CLIENT_SET_MODE,this.onClientSetMode.bind(this));a.addEventListener(netgis.Events.SEARCHPARCEL_TOGGLE,this.onSearchParcelToggle.bind(this));a.addEventListener(netgis.Events.LAYERTREE_TOGGLE,this.onLayerTreeToggle.bind(this));a.addEventListener(netgis.Events.TOOLBOX_TOGGLE,this.onToolboxToggle.bind(this));a.addEventListener(netgis.Events.LEGEND_TOGGLE,this.onLegendToggle.bind(this));a.addEventListener(netgis.Events.MAP_FEATURE_ENTER,
|
||||
this.onMapFeatureEnter.bind(this));a.addEventListener(netgis.Events.MAP_FEATURE_CLICK,this.onMapFeatureClick.bind(this));a.addEventListener(netgis.Events.MAP_FEATURE_LEAVE,this.onMapFeatureLeave.bind(this))};netgis.SearchParcel.prototype.createInput=function(a){var b=document.createElement("label");b.className="netgis-hover-text-primary";b.innerHTML=a;a=document.createElement("input");a.setAttribute("type","text");b.appendChild(a);return b};
|
||||
netgis.SearchParcel.prototype.createNameItem=function(a){var b=document.createElement("li"),c=document.createElement("button");c.setAttribute("type","button");c.addEventListener("click",this.onNameItemClick.bind(this));c.className="netgis-color-e netgis-hover-a netgis-text-a netgis-hover-text-e";c.innerHTML=a;b.appendChild(c);return b};
|
||||
netgis.SearchParcel.prototype.createTable=function(a){var b=document.createElement("div");b.className="netgis-table-wrapper";var c=document.createElement("table");b.appendChild(c);var d=document.createElement("thead");c.appendChild(d);var e=document.createElement("tr");e.className="netgis-color-d netgis-shadow";d.appendChild(e);for(d=0;d<a.length;d++){var f=document.createElement("th");f.innerHTML=a[d];e.appendChild(f)}a=document.createElement("tbody");c.appendChild(a);return b};
|
||||
netgis.SearchParcel.prototype.createParcelItem=function(a,b,c,d,e,f,g){var h=document.createElement("tr");h.className="netgis-hover-d";h.setAttribute("title","Klicken zum zoomen");h.setAttribute("data-id",d);h.setAttribute("data-field",a);h.setAttribute("data-parcel-a",b);h.setAttribute("data-parcel-b",c);h.setAttribute("data-bbox",f);h.setAttribute("data-geom",g);h.addEventListener("pointerenter",this.onParcelEnter.bind(this));h.addEventListener("pointerleave",this.onParcelLeave.bind(this));h.addEventListener("click",
|
||||
@ -345,8 +368,9 @@ netgis.SearchParcel.prototype.reset=function(){this.hideBottom();this.nameLoader
|
||||
netgis.SearchParcel.prototype.showDistricts=function(a){a?(netgis.util.invoke(this.container,netgis.Events.MAP_LAYER_TOGGLE,{id:this.districtsLayerID,on:!0}),netgis.util.invoke(this.container,netgis.Events.MAP_ZOOM_LEVEL,{z:this.config.searchparcel.districts_service.min_zoom})):netgis.util.invoke(this.container,netgis.Events.MAP_LAYER_TOGGLE,{id:this.districtsLayerID,on:!1})};
|
||||
netgis.SearchParcel.prototype.showFields=function(a,b){a?(b.crs={type:"name",properties:{name:"urn:ogc:def:crs:EPSG::25832"}},this.fieldsLayer.data=b,netgis.util.invoke(this.container,netgis.Events.MAP_LAYER_TOGGLE,{id:this.fieldsLayerID,on:!0}),netgis.util.invoke(this.container,netgis.Events.MAP_ZOOM_LAYER,{id:this.fieldsLayerID})):(netgis.util.invoke(this.container,netgis.Events.MAP_LAYER_TOGGLE,{id:this.fieldsLayerID,on:!1}),this.fieldsLayer.data=null)};
|
||||
netgis.SearchParcel.prototype.showParcels=function(a,b){if(a){a=[];for(var c=0;c<b.length;c++){var d=b[c];a.push({id:d.fsk,geometry:d.geometry,properties:{flaeche:d.flaeche,fln:d.fln,fsk:d.fsk,fsn_nen:d.fsn_nen,fsn_zae:d.fsn_zae}})}this.parcelsLayer.data=a;netgis.util.invoke(this.container,netgis.Events.MAP_LAYER_TOGGLE,{id:this.parcelsLayerID,on:!0});netgis.util.invoke(this.container,netgis.Events.MAP_ZOOM_LAYER,{id:this.parcelsLayerID})}else netgis.util.invoke(this.container,netgis.Events.MAP_LAYER_TOGGLE,
|
||||
{id:this.parcelsLayerID,on:!1})};netgis.SearchParcel.prototype.onSearchParcelToggle=function(a){this.panel.toggle()};netgis.SearchParcel.prototype.onLayerTreeToggle=function(a){this.panel.hide()};netgis.SearchParcel.prototype.onToolboxToggle=function(a){this.panel.hide()};netgis.SearchParcel.prototype.onClientSetMode=function(a){a.detail.mode===netgis.Modes.SEARCH_PARCEL?this.reset():(this.showDistricts(!1),this.showFields(!1),this.showParcels(!1))};
|
||||
netgis.SearchParcel.prototype.onPanelToggle=function(a){!1===a.detail.visible?netgis.util.invoke(this.panel.container,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.VIEW}):netgis.util.invoke(this.panel.container,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.SEARCH_PARCEL})};netgis.SearchParcel.prototype.onInputNameKey=function(a){switch(a.keyCode){case 13:this.selectFirstName();break;case 27:this.reset();break;default:this.requestName(this.nameInput.value.trim())}};
|
||||
{id:this.parcelsLayerID,on:!1})};netgis.SearchParcel.prototype.onSearchParcelToggle=function(a){this.panel.toggle()};netgis.SearchParcel.prototype.onLayerTreeToggle=function(a){this.panel.hide()};netgis.SearchParcel.prototype.onToolboxToggle=function(a){this.panel.hide()};netgis.SearchParcel.prototype.onLegendToggle=function(a){this.panel.hide()};
|
||||
netgis.SearchParcel.prototype.onClientSetMode=function(a){a.detail.mode===netgis.Modes.SEARCH_PARCEL?this.reset():(this.showDistricts(!1),this.showFields(!1),this.showParcels(!1))};netgis.SearchParcel.prototype.onPanelToggle=function(a){!1===a.detail.visible?netgis.util.invoke(this.panel.container,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.VIEW}):netgis.util.invoke(this.panel.container,netgis.Events.CLIENT_SET_MODE,{mode:netgis.Modes.SEARCH_PARCEL})};
|
||||
netgis.SearchParcel.prototype.onInputNameKey=function(a){switch(a.keyCode){case 13:this.selectFirstName();break;case 27:this.reset();break;default:this.requestName(this.nameInput.value.trim())}};
|
||||
netgis.SearchParcel.prototype.requestName=function(a){this.nameDebounce&&window.clearTimeout(this.nameDebounce);if(0!==a.length){var b=this.config.searchparcel.name_url;b=netgis.util.replace(b,"{q}",window.encodeURIComponent(a));this.nameDebounce=window.setTimeout(this.onInputNameDebounce.bind(this,b),200);this.nameLoader.classList.remove("netgis-hide")}};netgis.SearchParcel.prototype.onInputNameDebounce=function(a){netgis.util.request(a,this.onInputNameResponse.bind(this))};
|
||||
netgis.SearchParcel.prototype.onInputNameResponse=function(a){this.nameLoader.classList.add("netgis-hide");this.parcelReset.classList.remove("netgis-hide");this.nameList.innerHTML="";if("{"===a.charAt(0)||"["===a.charAt(0)){a=JSON.parse(a);for(var b=0;b<a.data.length;b++){var c=a.data[b],d=this.createNameItem(c.gmk_name);d.getElementsByTagName("button")[0].setAttribute("data-id",c.gmk_gmn);this.nameList.appendChild(d)}}};
|
||||
netgis.SearchParcel.prototype.onNameItemClick=function(a){a=a.target;var b=a.getAttribute("data-id");this.nameInput.value=a.innerHTML;this.nameList.innerHTML="";this.districtInput.value=b;this.requestFields(b)};
|
||||
@ -391,16 +415,16 @@ break}a=a.getElementsByTagName("Extent");for(e=0;e<a.length;e++)if(b=a[e],"time"
|
||||
0;e<d.length;e++)b=d[e],a=g=b.toISOString(),a=a.replace("T",", "),a=a.replace("Z",""),this.addTimeStep(g,a);this.setActiveTimeStep(d.length-1)}};netgis.TimeSlider.prototype.onTimeSliderShow=function(a){a=a.detail;console.info("TimeSlider Show:",a);this.layerID=a.layer;this.setTitle(a.title);this.clearTimeSteps();this.requestServiceWMST(a.url,a.name);this.setVisible(!0)};netgis.TimeSlider.prototype.onTimeSliderHide=function(a){this.setVisible(!1)};netgis.TimeSlider.prototype.onHeaderClick=function(a){this.setVisible(!1)};
|
||||
netgis.TimeSlider.prototype.onPointerDown=function(a){a=a.pageX-this.wrapper.offsetLeft;this.down=!0;this.downX=a;this.downScroll=this.wrapper.scrollLeft;this.container.classList.add("netgis-active")};netgis.TimeSlider.prototype.onPointerMove=function(a){this.down&&(a.preventDefault(),this.wrapper.scrollLeft=this.downScroll-(a.pageX-this.wrapper.offsetLeft-this.downX))};netgis.TimeSlider.prototype.onPointerUp=function(a){this.down&&a.preventDefault();this.down=!1;this.container.classList.remove("netgis-active")};
|
||||
netgis.TimeSlider.prototype.onTimeStepClick=function(a){a=a.currentTarget.parentNode;a.getAttribute("data-id");if(!(5<Math.abs(this.wrapper.scrollLeft-this.downScroll))){for(var b=this.top.getElementsByTagName("td"),c=-1,d=0;d<b.length;d++)if(b[d]===a){c=d;break}this.setActiveTimeStep(c)}};netgis=netgis||{};netgis.Toolbox=function(a){this.config=a;this.bottomPanels={};this.initElements(a);this.initOptions(a);this.initEvents()};
|
||||
netgis.Toolbox.prototype.initElements=function(a){this.panel=new netgis.Panel("Toolbox");this.panel.content.classList.add("netgis-toolbox");this.top=document.createElement("section");this.panel.content.appendChild(this.top);for(var b=a.toolbox.items,c=0;c<b.length;c++){var d=b[c];if(!1===this.config.tools.editable)switch(d.id){case "draw_points":continue;case "draw_lines":continue;case "draw_polygons":continue;case "modify_features":continue;case "delete_features":continue;case "buffer_features":continue;
|
||||
netgis.Toolbox.prototype.initElements=function(a){this.panel=new netgis.Panel("Toolbox");this.panel.content.classList.add("netgis-toolbox");this.top=document.createElement("section");this.panel.content.appendChild(this.top);for(var b=a.toolbox.items,c=0;c<b.length;c++){var d=b[c];if(this.config.tools&&!1===this.config.tools.editable)switch(d.id){case "draw_points":continue;case "draw_lines":continue;case "draw_polygons":continue;case "modify_features":continue;case "delete_features":continue;case "buffer_features":continue;
|
||||
case "cut_features":continue}this.addButton(this.top,d.id,d.title)}this.bottom=document.createElement("section");this.bottom.className="netgis-color-e netgis-hide";this.panel.content.appendChild(this.bottom);b=document.createElement("button");b.className="netgis-button netgis-clip-text netgis-color-c";b.innerHTML="<span>Einstellungen</span><i class='netgis-icon fas fa-times'></i>";b.setAttribute("type","button");b.addEventListener("click",this.onBottomHeaderClick.bind(this));this.bottom.appendChild(b);
|
||||
this.bottomTitle=b.getElementsByTagName("span")[0];a.toolbox&&!0===a.toolbox.open&&this.panel.show()};
|
||||
netgis.Toolbox.prototype.initOptions=function(a){var b=a.toolbox.options;if(b)for(var c in b);b=a.tools;a=[];b.buffer||(b.buffer={});this.bottomPanels.drawPoints=document.createElement("div");a.push(this.addCheckbox(this.bottomPanels.drawPoints,"Einrasten",this.onDrawSnapToggle.bind(this)));this.addCheckbox(this.bottomPanels.drawPoints,"Puffern",this.onDrawBufferToggle.bind(this));this.addInputNumber(this.bottomPanels.drawPoints,"Radius (Meter):",b.buffer.default_radius,this.onDrawBufferChange.bind(this));
|
||||
this.addInputNumber(this.bottomPanels.drawPoints,"Segmente:",b.buffer.default_segments,this.onDrawBufferChange.bind(this));this.bottom.appendChild(this.bottomPanels.drawPoints);this.bottomPanels.drawLines=document.createElement("div");a.push(this.addCheckbox(this.bottomPanels.drawLines,"Einrasten",this.onDrawSnapToggle.bind(this)));this.addCheckbox(this.bottomPanels.drawLines,"Puffern",this.onDrawBufferToggle.bind(this));this.addInputNumber(this.bottomPanels.drawLines,"Radius (Meter):",b.buffer.default_radius,
|
||||
this.onDrawBufferChange.bind(this));this.addInputNumber(this.bottomPanels.drawLines,"Segmente:",b.buffer.default_segments,this.onDrawBufferChange.bind(this));this.bottom.appendChild(this.bottomPanels.drawLines);this.showDrawBufferOptions(!1);this.bottomPanels.drawPolygons=document.createElement("div");a.push(this.addCheckbox(this.bottomPanels.drawPolygons,"Einrasten",this.onDrawSnapToggle.bind(this)));this.bottom.appendChild(this.bottomPanels.drawPolygons);this.bottomPanels.bufferFeatures=document.createElement("div");
|
||||
this.addInputNumber(this.bottomPanels.bufferFeatures,"Radius (Meter):",b.buffer.default_radius,this.onBufferFeaturesChange.bind(this));this.addInputNumber(this.bottomPanels.bufferFeatures,"Segmente:",b.buffer.default_segments,this.onBufferFeaturesChange.bind(this));this.addButton(this.bottomPanels.bufferFeatures,null,"<i class='netgis-icon netgis-text-a fas fa-arrow-circle-right'></i><span>Akzeptieren</span>",this.onBufferFeaturesAccept.bind(this));this.bottom.appendChild(this.bottomPanels.bufferFeatures);
|
||||
this.bottomPanels.modifyFeatures=document.createElement("div");a.push(this.addCheckbox(this.bottomPanels.modifyFeatures,"Einrasten",this.onDrawSnapToggle.bind(this)));this.bottom.appendChild(this.bottomPanels.modifyFeatures);if(this.config.tools&&this.config.tools.snapping){if(!1===this.config.tools.snapping.show)for(b=0;b<a.length;b++)a[b].parentNode.classList.add("netgis-hide");if(!0===this.config.tools.snapping.active){for(b=0;b<a.length;b++)a[b].checked=!0;var d=this;window.setTimeout(function(){netgis.util.invoke(d.panel.container,
|
||||
netgis.Events.MAP_SNAP_TOGGLE,{on:!0})},100)}}};netgis.Toolbox.prototype.initEvents=function(){this.resizeObserver=(new ResizeObserver(this.onTopResize.bind(this))).observe(this.top)};
|
||||
netgis.Toolbox.prototype.attachTo=function(a){a.appendChild(this.panel.container);a.addEventListener(netgis.Events.CLIENT_SET_MODE,this.onClientSetMode.bind(this));a.addEventListener(netgis.Events.TOOLBOX_TOGGLE,this.onToolboxToggle.bind(this));a.addEventListener(netgis.Events.LAYERTREE_TOGGLE,this.onLayerTreeToggle.bind(this));a.addEventListener(netgis.Events.SEARCHPARCEL_TOGGLE,this.onSearchParcelToggle.bind(this))};
|
||||
netgis.Toolbox.prototype.initOptions=function(a){var b=a.toolbox.options;if(b)for(var c in b);a=a.tools;b=[];a&&(a.buffer||(a.buffer={}),this.bottomPanels.drawPoints=document.createElement("div"),b.push(this.addCheckbox(this.bottomPanels.drawPoints,"Einrasten",this.onDrawSnapToggle.bind(this))),this.addCheckbox(this.bottomPanels.drawPoints,"Puffern",this.onDrawBufferToggle.bind(this)),this.addInputNumber(this.bottomPanels.drawPoints,"Radius (Meter):",a.buffer.default_radius,this.onDrawBufferChange.bind(this)),
|
||||
this.addInputNumber(this.bottomPanels.drawPoints,"Segmente:",a.buffer.default_segments,this.onDrawBufferChange.bind(this)),this.bottom.appendChild(this.bottomPanels.drawPoints),this.bottomPanels.drawLines=document.createElement("div"),b.push(this.addCheckbox(this.bottomPanels.drawLines,"Einrasten",this.onDrawSnapToggle.bind(this))),this.addCheckbox(this.bottomPanels.drawLines,"Puffern",this.onDrawBufferToggle.bind(this)),this.addInputNumber(this.bottomPanels.drawLines,"Radius (Meter):",a.buffer.default_radius,
|
||||
this.onDrawBufferChange.bind(this)),this.addInputNumber(this.bottomPanels.drawLines,"Segmente:",a.buffer.default_segments,this.onDrawBufferChange.bind(this)),this.bottom.appendChild(this.bottomPanels.drawLines),this.showDrawBufferOptions(!1),this.bottomPanels.drawPolygons=document.createElement("div"),b.push(this.addCheckbox(this.bottomPanels.drawPolygons,"Einrasten",this.onDrawSnapToggle.bind(this))),this.bottom.appendChild(this.bottomPanels.drawPolygons),this.bottomPanels.bufferFeatures=document.createElement("div"),
|
||||
this.addInputNumber(this.bottomPanels.bufferFeatures,"Radius (Meter):",a.buffer.default_radius,this.onBufferFeaturesChange.bind(this)),this.addInputNumber(this.bottomPanels.bufferFeatures,"Segmente:",a.buffer.default_segments,this.onBufferFeaturesChange.bind(this)),this.addButton(this.bottomPanels.bufferFeatures,null,"<i class='netgis-icon netgis-text-a fas fa-arrow-circle-right'></i><span>Akzeptieren</span>",this.onBufferFeaturesAccept.bind(this)),this.bottom.appendChild(this.bottomPanels.bufferFeatures),
|
||||
this.bottomPanels.modifyFeatures=document.createElement("div"),b.push(this.addCheckbox(this.bottomPanels.modifyFeatures,"Einrasten",this.onDrawSnapToggle.bind(this))),this.bottom.appendChild(this.bottomPanels.modifyFeatures));if(a&&a.snapping){if(!1===a.snapping.show)for(c=0;c<b.length;c++)b[c].parentNode.classList.add("netgis-hide");if(!0===a.snapping.active){for(c=0;c<b.length;c++)b[c].checked=!0;var d=this;window.setTimeout(function(){netgis.util.invoke(d.panel.container,netgis.Events.MAP_SNAP_TOGGLE,
|
||||
{on:!0})},100)}}};netgis.Toolbox.prototype.initEvents=function(){this.resizeObserver=(new ResizeObserver(this.onTopResize.bind(this))).observe(this.top)};
|
||||
netgis.Toolbox.prototype.attachTo=function(a){a.appendChild(this.panel.container);a.addEventListener(netgis.Events.CLIENT_SET_MODE,this.onClientSetMode.bind(this));a.addEventListener(netgis.Events.TOOLBOX_TOGGLE,this.onToolboxToggle.bind(this));a.addEventListener(netgis.Events.LAYERTREE_TOGGLE,this.onLayerTreeToggle.bind(this));a.addEventListener(netgis.Events.SEARCHPARCEL_TOGGLE,this.onSearchParcelToggle.bind(this));a.addEventListener(netgis.Events.LEGEND_TOGGLE,this.onLegendToggle.bind(this))};
|
||||
netgis.Toolbox.prototype.addButton=function(a,b,c,d){var e=document.createElement("button");e.className="netgis-button netgis-clip-text netgis-color-e netgis-hover-d";e.innerHTML=c;e.setAttribute("type","button");e.setAttribute("data-id",b);d?e.onclick=d:e.addEventListener("click",this.onButtonClick.bind(this));a&&a.appendChild(e);return e};
|
||||
netgis.Toolbox.prototype.addCheckbox=function(a,b,c){var d=document.createElement("label");d.className="netgis-noselect netgis-hover-a";var e=document.createElement("input");e.setAttribute("type","checkbox");d.appendChild(e);var f=document.createElement("span");f.innerHTML=b;d.appendChild(f);c&&(e.onchange=c);a&&a.appendChild(d);return e};
|
||||
netgis.Toolbox.prototype.addInputNumber=function(a,b,c,d){var e=document.createElement("label");e.className="netgis-noselect netgis-hover-a";var f=document.createElement("span");f.innerHTML=b;e.appendChild(f);b=document.createElement("input");b.setAttribute("type","number");b.setAttribute("min",0);b.value=c;e.appendChild(b);d&&(b.onchange=d,b.onkeyup=d);a&&a.appendChild(e);return b};
|
||||
@ -408,7 +432,7 @@ netgis.Toolbox.prototype.showBottom=function(a,b){this.top.classList.add("netgis
|
||||
netgis.Toolbox.prototype.hideBottom=function(){this.top.classList.remove("netgis-resize-bottom");this.top.style.height="auto";this.top.style.bottom="0mm";this.bottom.classList.add("netgis-hide")};
|
||||
netgis.Toolbox.prototype.showDrawBufferOptions=function(a){var b=this.bottomPanels.drawPoints.getElementsByTagName("label"),c=this.bottomPanels.drawLines.getElementsByTagName("label");b[1].getElementsByTagName("input")[0].checked=a;(c[1].getElementsByTagName("input")[0].checked=a)?(b[2].classList.remove("netgis-hide"),b[3].classList.remove("netgis-hide"),c[2].classList.remove("netgis-hide"),c[3].classList.remove("netgis-hide")):(b[2].classList.add("netgis-hide"),b[3].classList.add("netgis-hide"),
|
||||
c[2].classList.add("netgis-hide"),c[3].classList.add("netgis-hide"))};netgis.Toolbox.prototype.setActiveButton=function(a){for(var b=this.top.getElementsByTagName("button"),c=null,d=0;d<b.length;d++){var e=b[d];e.getAttribute("data-id")===a?(c=e,e.classList.add("netgis-active")):e.classList.remove("netgis-active")}if(c){var f=this;window.setTimeout(function(){f.top.scrollTo({top:c.offsetTop,behavior:"smooth"})},10)}};netgis.Toolbox.prototype.onToolboxToggle=function(a){this.panel.toggle()};
|
||||
netgis.Toolbox.prototype.onLayerTreeToggle=function(a){this.panel.hide()};netgis.Toolbox.prototype.onSearchParcelToggle=function(a){this.panel.hide()};
|
||||
netgis.Toolbox.prototype.onLayerTreeToggle=function(a){this.panel.hide()};netgis.Toolbox.prototype.onSearchParcelToggle=function(a){this.panel.hide()};netgis.Toolbox.prototype.onLegendToggle=function(a){this.panel.hide()};
|
||||
netgis.Toolbox.prototype.onClientSetMode=function(a){a=a.detail;this.hideBottom();switch(a.mode){default:this.setActiveButton(null);break;case netgis.Modes.VIEW:this.setActiveButton(netgis.Commands.VIEW);break;case netgis.Modes.ZOOM_BOX:this.setActiveButton(netgis.Commands.ZOOM_BOX);break;case netgis.Modes.MEASURE_LINE:this.setActiveButton(netgis.Commands.MEASURE_LINE);break;case netgis.Modes.MEASURE_AREA:this.setActiveButton(netgis.Commands.MEASURE_AREA);break;case netgis.Modes.DRAW_POINTS:this.setActiveButton(netgis.Commands.DRAW_POINTS);
|
||||
this.showBottom(this.bottomPanels.drawPoints,"Punkte zeichnen");break;case netgis.Modes.DRAW_LINES:this.setActiveButton(netgis.Commands.DRAW_LINES);this.showBottom(this.bottomPanels.drawLines,"Linien zeichnen");break;case netgis.Modes.DRAW_POLYGONS:this.setActiveButton(netgis.Commands.DRAW_POLYGONS);this.showBottom(this.bottomPanels.drawPolygons,"Polygone zeichnen");break;case netgis.Modes.MODIFY_FEATURES:this.setActiveButton(netgis.Commands.MODIFY_FEATURES);this.showBottom(this.bottomPanels.modifyFeatures,
|
||||
"Verschieben");break;case netgis.Modes.DELETE_FEATURES:this.setActiveButton(netgis.Commands.DELETE_FEATURES);break;case netgis.Modes.BUFFER_FEATURES:this.setActiveButton(netgis.Commands.BUFFER_FEATURES);this.showBottom(this.bottomPanels.bufferFeatures,"Puffern");this.onBufferFeaturesChange();break;case netgis.Modes.BUFFER_FEATURES_EDIT:this.setActiveButton(netgis.Commands.BUFFER_FEATURES);this.showBottom(this.bottomPanels.bufferFeatures,"Puffern");this.onBufferFeaturesChange();break;case netgis.Modes.BUFFER_FEATURES_DYNAMIC:this.setActiveButton(netgis.Commands.BUFFER_FEATURES);
|
||||
@ -444,20 +468,12 @@ b){b||(b="-");a=a.trim();a=a.toLowerCase();a=this.replace(a," ",b);a=this.replac
|
||||
b);a=this.replace(a,"\\)",b);a=this.replace(a,"\\{",b);a=this.replace(a,"\\}",b);a=this.replace(a,"\\[",b);a=this.replace(a,"\\]",b);a=this.replace(a,"=",b);a=this.replace(a,"\\+",b);a=this.replace(a,"\\*",b);a=this.replace(a,"\\~",b);a=this.replace(a,"\\^",b);a=this.replace(a,"\\\u00b0",b);a=this.replace(a,"\u00b2",b);a=this.replace(a,"\u00b3",b);a=this.replace(a,"\\#",b);a=this.replace(a,"\\<",b);a=this.replace(a,"\\>",b);a=this.replace(a,"\\|",b);a=this.replace(a,"\\@",b);a=this.replace(a,"\u20ac",
|
||||
b);a=this.replace(a,"\u00b5",b);a=this.trim(a,b);a=this.replace(a,"\u00e4","ae");a=this.replace(a,"\u00f6","oe");a=this.replace(a,"\u00fc","ue");a=this.replace(a,"\u00df","ss");a=this.replace(a,"\u00e1","a");a=this.replace(a,"\u00e0","a");a=this.replace(a,"\u00e2","a");a=this.replace(a,"\u00e9","e");a=this.replace(a,"\u00e8","e");a=this.replace(a,"\u00ea","e");a=this.replace(a,"\u00ed","i");a=this.replace(a,"\u00ec","i");a=this.replace(a,"\u00ee","i");a=this.replace(a,"\u00f3","o");a=this.replace(a,
|
||||
"\u00f2","o");a=this.replace(a,"\u00f4","o");a=this.replace(a,"\u00fa","u");a=this.replace(a,"\u00f9","u");return a=this.replace(a,"\u00fb","u")},replace:function(a,b,e){return a.replace(new RegExp(b,"g"),e)},trim:function(a,b){a=a.replace(new RegExp("^"+b+"+"),"");return a=a.replace(new RegExp(b+"+$"),"")},foreach:a,template:function(b,d){a(d,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,b,e){var c=new XMLHttpRequest;e&&(c._requestData=e);c.onload=function(){b(this.responseText,this._requestData,this)};c.withCredentials=!1;c.open("GET",a,!0);c.send();return c},downloadJSON:function(a,b){a="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(a));var c=document.createElement("a");c.setAttribute("href",
|
||||
a);c.setAttribute("download",b);document.body.appendChild(c);c.click();c.remove()},padstr:function(a,b){for(a=a.toString();a.length<b;)a="0"+a;return a},merge:function(a,b){return Object.assign(a,b)},getTimeStamp:function(a){var b=new Date;if(!0===a){a=b.getFullYear();var c=b.getMonth()+1,f=b.getDate(),g=b.getHours(),h=b.getMinutes();b=b.getSeconds();10>c&&(c="0"+c);10>f&&(f="0"+f);10>g&&(g="0"+g);10>h&&(h="0"+h);10>b&&(b="0"+b);a=[a,c,f,"_",g,h,b].join("")}else a=b.getDate()+"."+(b.getMonth()+1)+
|
||||
"."+b.getFullYear(),a+=" "+b.getHours()+":"+b.getMinutes();return a},getUserLanguage:b,getFileExtension:function(a){a=a.split(".");return 1>=a.length?"":a[a.length-1]},formatDistance:function(a){return 100<a?Math.round(a/1E3*100)/100+" km":Math.round(100*a)/100+" m"},formatLength:function(a,b){var c=1E3<a;a=c?b?Math.round(a/1E3*1E3)/1E3:Math.round(a/1E3):b?Math.round(100*a)/100:Math.round(a);0===a&&(c=!1);return a+(c?" km":" m")},formatArea:function(a,d,e,f){a=(e=a>(e||1E5))?d?Math.round(a/1E6*1E3)/
|
||||
1E3:Math.round(a/1E6):d?Math.round(100*a)/100:Math.round(a);0===a&&(e=!1);a=a.toLocaleString(b());return a+(e?" km\u00b2":" m\u00b2")},hexToRGB:function(a){"#"===a.charAt(0)&&(a=a.substr(1));a=Number.parseInt(a,16);return[a>>16&255,a>>8&255,a&255]},invoke:function(a,b,e){a.dispatchEvent(new CustomEvent(b,{bubbles:!0,detail:e}))},handler:function(a,b){return function(c){b||(b=c);netgis.util.invoke(this,a,b)}}}}();netgis=netgis||{};netgis.WMC=function(){};netgis.WMC.prototype.requestContext=function(a,b){this.callback=b;netgis.util.request(a,this.onContextResponse.bind(this))};netgis.WMC.prototype.onContextResponse=function(a){a=JSON.parse(a);this.fromJSON(a)};netgis.WMC.prototype.requestLayers=function(a){a="./proxy.php?https://www.geoportal.rlp.de/mapbender/php/mod_callMetadata.php?languageCode=de&resultTarget=web&maxResults=40&resourceIds="+a.join(",");netgis.util.request(a,this.onLayersResponse.bind(this))};
|
||||
netgis.WMC.prototype.onLayersResponse=function(a){a=JSON.parse(a).wms.srv;this.services=[];for(var b=0;b<a.length;b++){var c=a[b],d={id:c.id,title:c.title,url:c.getMapUrl};d.layers=this.parseLayers(c.layer);this.services.push(d)}var e=this.layers;this.services.sort(function(a,b){a=Number.parseInt(a.layers[0].id);b=Number.parseInt(b.layers[0].id);for(var c=null,d=null,f=0;f<e.length;f++)e[f].id===a&&(c=f),e[f].id===b&&(d=f);return c<d?-1:c>d?1:0});this.callback&&this.callback({config:this.toConfig()})};
|
||||
netgis.WMC.prototype.parseLayers=function(a){var b=[];if(a)for(var c=0;c<a.length;c++){var d=a[c],e={id:d.id,title:d.title,name:d.name,legendURL:d.getLegendGraphicUrl,legendFormat:d.getLegendGraphicUrlFormat,queryable:d.layerQueryable|d.queryable,bbox:d.bbox};e.layers=this.parseLayers(d.layer);b.push(e)}this.sortLayers(b);return b};
|
||||
netgis.WMC.prototype.sortLayers=function(a){var b=this.layers;a.sort(function(a,d){var c=null,f=null;a=Number.parseInt(a.id);d=Number.parseInt(d.id);for(var g=0;g<b.length;g++)b[g].id===a&&(c=b[g].pos),b[g].id===d&&(f=b[g].pos);return c<f?1:c>f?-1:0})};
|
||||
netgis.WMC.prototype.fromJSON=function(a){var b=a.wmc;this.id=b.id;this.title=b.title;this.crs=b.crs;var c=b.bbox;c=c.split(",");for(var d=0;d<c.length;d++)c[d]=Number.parseFloat(c[d]);this.bbox=c;this.layers=[];c=[];a=a.layerList;for(d=0;d<a.length;d++){var e=a[d];this.layers.push({id:e.layerId,active:e.active,opacity:e.opacity,pos:e.layerPos});c.push(e.layerId)}this.requestLayers(c);this.kmloverlay=b.kmloverlay};
|
||||
netgis.WMC.prototype.toConfig=function(){var a={map:{attribution:this.title+", GeoPortal RLP",projection:this.crs,bbox:this.bbox}},b=[],c=[];if(this.kmloverlay&&""!==this.kmloverlay){var d={id:"kmloverlay",title:"KML",parent:null};b.push(d);var e={id:"kmloverlay",folder:"kmloverlay",title:"KML Overlay",active:!0,order:9999,type:netgis.LayerTypes.KML,url:this.kmloverlay};c.push(e)}for(var f=this.layers.length,g=0;g<this.services.length;g++){var h=this.services[g],k=h.layers[0];d={id:k.id,title:k.title,
|
||||
parent:-1};b.unshift(d);d=d.id;for(var l=0;l<k.layers.length;l++){e=k.layers[l];for(var m=null,n=0;n<this.layers.length;n++)if(this.layers[n].id===Number.parseInt(e.id)){m=this.layers[n];break}e={id:e.id,title:e.title,folder:d,active:m.active,type:"WMS",url:h.url,name:e.name,order:f};c.push(e);--f}}a.folders=b;a.layers=c;return a};netgis=netgis||{};netgis.WMC=function(){};netgis.WMC.prototype.requestContext=function(a,b){this.callback=b;netgis.util.request(a,this.onContextResponse.bind(this))};netgis.WMC.prototype.onContextResponse=function(a){a=JSON.parse(a);console.info("Context Response:",a);this.fromJSON(a)};
|
||||
netgis.WMC.prototype.requestLayers=function(a){a="./proxy.php?https://www.geoportal.rlp.de/mapbender/php/mod_callMetadata.php?languageCode=de&resultTarget=web&maxResults=40&resourceIds="+a.join(",");netgis.util.request(a,this.onLayersResponse.bind(this))};
|
||||
netgis.WMC.prototype.onLayersResponse=function(a){a=JSON.parse(a);console.info("Layers Response:",a);a=a.wms.srv;this.services=[];for(var b=0;b<a.length;b++){var c=a[b],d={id:c.id,title:c.title,url:c.getMapUrl};d.layers=this.parseLayers(c.layer);this.services.push(d)}var e=this.layers;this.services.sort(function(a,b){a=Number.parseInt(a.layers[0].id);b=Number.parseInt(b.layers[0].id);for(var c=null,d=null,f=0;f<e.length;f++)e[f].id===a&&(c=f),e[f].id===b&&(d=f);return c<d?-1:c>d?1:0});this.callback&&
|
||||
this.callback({config:this.toConfig()})};netgis.WMC.prototype.parseLayers=function(a){var b=[];if(a)for(var c=0;c<a.length;c++){var d=a[c],e={id:d.id,title:d.title,name:d.name,legendURL:d.getLegendGraphicUrl,legendFormat:d.getLegendGraphicUrlFormat,queryable:d.layerQueryable|d.queryable,bbox:d.bbox};e.layers=this.parseLayers(d.layer);b.push(e)}this.sortLayers(b);return b};
|
||||
netgis.WMC.prototype.sortLayers=function(a){var b=this.layers;a.sort(function(a,d){var c=null,f=null;a=Number.parseInt(a.id);d=Number.parseInt(d.id);for(var g=0;g<b.length;g++)b[g].id===a&&(c=b[g].pos),b[g].id===d&&(f=b[g].pos);return c<f?1:c>f?-1:0})};
|
||||
netgis.WMC.prototype.fromJSON=function(a){var b=a.wmc;this.id=b.id;this.title=b.title;this.crs=b.crs;var c=b.bbox;c=c.split(",");for(b=0;b<c.length;b++)c[b]=Number.parseFloat(c[b]);this.bbox=c;this.layers=[];c=[];a=a.layerList;for(b=0;b<a.length;b++){var d=a[b];this.layers.push({id:d.layerId,active:d.active,opacity:d.opacity,pos:d.layerPos});c.push(d.layerId)}this.requestLayers(c);console.info("WMC Layers:",this.layers)};
|
||||
netgis.WMC.prototype.toConfig=function(){for(var a={title:"<b>GeoPortal</b>",modules:{search_parcel:!1},map:{attribution:this.title+", GeoPortal RLP",projection:this.crs,bbox:this.bbox,scalebar:!0},search:{url:"./proxy.php?https://www.geoportal.rlp.de/mapbender/geoportal/gaz_geom_mobile.php?outputFormat=json&resultTarget=web&searchEPSG={epsg}&maxResults=5&maxRows=5&featureClass=P&style=full&searchText={q}&name_startsWith={q}"}},b=[],c=[],d=this.layers.length,e=0;e<this.services.length;e++){var f=
|
||||
this.services[e],g=f.layers[0];b.push({id:g.id,title:g.title,parent:-1});for(var h=b.length-1,k=0;k<g.layers.length;k++){for(var l=g.layers[k],m=null,n=0;n<this.layers.length;n++)if(this.layers[n].id===Number.parseInt(l.id)){m=this.layers[n];break}c.push({id:l.id,title:l.title,folder:h,active:m.active,type:"WMS",url:f.url,name:l.name,order:d});--d}}a.folders=b;a.layers=c;return a};
|
||||
b.innerHTML=a;return b.children[0]},insideElement:function(a,b,e){a=a.getBoundingClientRect();return b<a.left||e<a.top||b>a.right||e>a.bottom?!1:!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,b,e,f){f=new XMLHttpRequest;e&&(f._requestData=e);f.onload=function(){b(this.responseText,this._requestData,this)};f.withCredentials=!1;f.open("GET",a,!0);f.send();return f},downloadJSON:function(a,b){a="data:text/json;charset=utf-8,"+
|
||||
encodeURIComponent(JSON.stringify(a));var c=document.createElement("a");c.setAttribute("href",a);c.setAttribute("download",b);document.body.appendChild(c);c.click();c.remove()},padstr:function(a,b){for(a=a.toString();a.length<b;)a="0"+a;return a},merge:function(a,b){return Object.assign(a,b)},getTimeStamp:function(a){var b=new Date;if(!0===a){a=b.getFullYear();var c=b.getMonth()+1,f=b.getDate(),g=b.getHours(),h=b.getMinutes();b=b.getSeconds();10>c&&(c="0"+c);10>f&&(f="0"+f);10>g&&(g="0"+g);10>h&&
|
||||
(h="0"+h);10>b&&(b="0"+b);a=[a,c,f,"_",g,h,b].join("")}else a=b.getDate()+"."+(b.getMonth()+1)+"."+b.getFullYear(),a+=" "+b.getHours()+":"+b.getMinutes();return a},getUserLanguage:b,getFileExtension:function(a){a=a.split(".");return 1>=a.length?"":a[a.length-1]},formatDistance:function(a){return 100<a?Math.round(a/1E3*100)/100+" km":Math.round(100*a)/100+" m"},formatLength:function(a,b){var c=1E3<a;a=c?b?Math.round(a/1E3*1E3)/1E3:Math.round(a/1E3):b?Math.round(100*a)/100:Math.round(a);0===a&&(c=!1);
|
||||
return a+(c?" km":" m")},formatArea:function(a,d,e,f){a=(e=a>(e||1E5))?d?Math.round(a/1E6*1E3)/1E3:Math.round(a/1E6):d?Math.round(100*a)/100:Math.round(a);0===a&&(e=!1);a=a.toLocaleString(b());return a+(e?" km\u00b2":" m\u00b2")},hexToRGB:function(a){"#"===a.charAt(0)&&(a=a.substr(1));a=Number.parseInt(a,16);return[a>>16&255,a>>8&255,a&255]},invoke:function(a,b,e){a.dispatchEvent(new CustomEvent(b,{bubbles:!0,detail:e}))},handler:function(a,b){return function(c){b||(b=c);netgis.util.invoke(this,a,
|
||||
b)}}}}();netgis=netgis||{};netgis.WMC=function(){};netgis.WMC.prototype.requestContext=function(a,b){this.callback=b;netgis.util.request(a,this.onContextResponse.bind(this))};netgis.WMC.prototype.onContextResponse=function(a){var b=JSON.parse(a);this.data=b;a=[];b=b.layerList;for(var c=0;c<b.length;c++)a.push(b[c].layerId);this.requestLayers(a)};
|
||||
netgis.WMC.prototype.requestLayers=function(a){a="./proxy.php?https://www.geoportal.rlp.de/mapbender/php/mod_callMetadata.php?languageCode=de&resultTarget=web&maxResults=40&resourceIds="+a.join(",");netgis.util.request(a,this.onLayersResponse.bind(this))};netgis.WMC.prototype.onLayersResponse=function(a){this.layers=JSON.parse(a);this.callback&&this.callback({config:this.toConfig()})};
|
||||
netgis.WMC.prototype.toConfig=function(){var a=this.data.wmc,b=this.layers.wms.srv,c=this.data.layerList,d={},e=a.bbox;e=e.split(",");for(var f=0;f<e.length;f++)e[f]=Number.parseFloat(e[f]);d.map={attribution:a.title+", GeoPortal RLP",projection:a.crs,bbox:e};e=[];var g={};for(f=0;f<b.length;f++){var h=b[f],k={id:h.id,title:h.title,open:"1"===h.isopen};e.push(k);for(k=0;k<h.layer.length;k++){var l=h.layer[k];l.getMapUrl||(l.getMapUrl=h.getMapUrl);g[l.id.toString()]=l;if(l.layer)for(var m=0;m<l.layer.length;m++){var n=
|
||||
l.layer[m];n.getMapUrl||(n.getMapUrl=l.getMapUrl);g[n.id.toString()]=n}}}b=[];h=9999;(this.kmloverlay=a.kmloverlay)&&""!==this.kmloverlay&&(k={id:"kmloverlay",title:"Meine Geodaten",parent:null},e.push(k),l={id:"kmloverlay",folder:"kmloverlay",title:"KML Overlay",active:!0,order:h,type:netgis.LayerTypes.KML,url:this.kmloverlay,query:!0},b.push(l),--h);for(f=c.length-1;0<=f;f--)m=c[f],a=m.layerId.toString(),(l=g[a])&&!l.isRoot&&(k=null!==m.layerParent?e[m.layerParent].id:null,l={id:a,folder:k,title:l.title,
|
||||
active:m.active,query:1===m.layerQueryable,transparency:1-.01*m.opacity,order:h,type:netgis.LayerTypes.WMS,url:l.getMapUrl,name:l.name,format:m.currentFormat},"image/tiff"===l.format&&(l.format="image/png"),b.push(l),--h);c=[];for(f=0;f<e.length;f++){a=e[f].id;for(k=g=0;k<b.length;k++)b[k].folder===a&&(g+=1);0===g&&c.push(f)}for(f=c.length-1;0<=f;f--)e.splice(c[f],1);d.folders=e;d.layers=b;return d};
|
||||
|
Loading…
Reference in New Issue
Block a user