diff --git a/docs/Client.js.html b/docs/Client.js.html new file mode 100644 index 0000000..d7f5121 --- /dev/null +++ b/docs/Client.js.html @@ -0,0 +1,937 @@ + + + + + JSDoc: Source: Client.js + + + + + + + + + + +
+ +

Source: Client.js

+ + + + + + +
+
+
"use strict";
+
+/**
+ * The netgis namespace.
+ * @namespace
+ */
+var netgis = netgis || {};
+
+/**
+ * The main NetGIS Client class. 
+ * @param {Element} container
+ * @param {JSON} config
+ * @constructor
+ * @name Client
+ * @memberof netgis
+ */
+netgis.Client = function( container, config )
+{
+	this.container = this.initContainer( container );
+	this.logEvents = false;
+	
+	if ( netgis.util.isString( config ) )
+	{
+		// Config URL
+		this.showLoader( true );
+		netgis.util.request( config, this.onConfigResponse.bind( this ) );
+	}
+	else
+	{
+		// Config Object
+		this.init( this.container, config );
+	}
+};
+
+netgis.Client.prototype.init = function( container, config )
+{
+	this.config = config;
+	
+	this.initParams( config );
+	this.initConfig( config );
+	this.initElements( container );
+	this.initModules( config );
+	this.initEvents();
+	this.initOutput( config );
+	
+	// TODO: test stuff...
+	
+	var menu = new netgis.ContextMenu();
+	menu.attachTo( this.container );
+	
+	this.modules.contextmenu = menu;
+	
+	this.popup = new netgis.Popup();
+	this.popup.attachTo( this.container );
+	
+	/*
+	this.popup.setPosition( 200, 300 );
+	this.popup.setHeader( "Popup" );
+	this.popup.setContent( "Hello World..." );
+	this.popup.show();
+	*/
+	
+	//netgis.util.invoke( this.container, netgis.Events.TIMESLIDER_SHOW, { title: "", url: config[ "timeslider" ][ "url" ], id: config[ "timeslider" ][ "id" ] } );
+};
+
+netgis.Client.prototype.initContainer = function( container )
+{
+	// Client Container Element
+	if ( netgis.util.isString( container ) )
+		container = document.getElementById( container );
+	
+	container.classList.add( "netgis-client", "netgis-font" );
+	
+	return container;
+};
+
+netgis.Client.prototype.initParams = function( config )
+{
+	// Get Parameters
+	var params = window.location.search.substr( 1 );
+	params = params.split( "&" );
+	
+	this.params = {};
+	
+	for ( var i = 0; i < params.length; i++ )
+	{
+		var p = params[ i ].split( "=" );
+		var k = p[ 0 ].toLowerCase();
+		var v = p[ 1 ];
+		
+		if ( ! k || k === "" ) continue;
+		
+		this.params[ k ] = v;
+	}
+	
+	// Apply Params To Config
+	for ( var k in this.params )
+	{
+		var v = this.params[ k ];
+		
+		switch ( k )
+		{
+			case "wmc_id":
+			{
+				if ( config[ "wmc" ] )
+				{
+					config[ "wmc" ][ "id" ] = v;
+				}
+				
+				break;
+			}
+		}
+	}
+};
+
+netgis.Client.prototype.initConfig = function( config )
+{
+	// WMC
+	if ( config[ "wmc" ] && config[ "wmc" ][ "url" ] )
+	{
+		this.requestContextWMC( config[ "wmc" ][ "url" ], config[ "wmc" ][ "id" ] );
+	}
+	
+	// OWS
+	if ( config[ "ows" ] && config[ "ows" ][ "url" ] )
+	{
+		this.requestContextOWS( config[ "ows" ][ "url" ] );
+	}
+};
+
+netgis.Client.prototype.initElements = function( container )
+{	
+	// Container Attributes
+	if ( container.hasAttribute( "data-lon" ) )
+	{
+		var lon = Number.parseFloat( container.getAttribute( "data-lon" ) );
+		
+		if ( ! this.config[ "map" ][ "center_lonlat" ] ) this.config[ "map" ][ "center_lonlat" ] = [];
+		this.config[ "map" ][ "center_lonlat" ][ 0 ] = lon;
+	}
+	
+	if ( container.hasAttribute( "data-lat" ) )
+	{
+		var lat = Number.parseFloat( container.getAttribute( "data-lat" ) );
+		
+		if ( ! this.config[ "map" ][ "center_lonlat" ] ) this.config[ "map" ][ "center_lonlat" ] = [];
+		this.config[ "map" ][ "center_lonlat" ][ 1 ] = lat;
+	}
+	
+	if ( container.hasAttribute( "data-zoom" ) )
+	{
+		var zoom = Number.parseFloat( container.getAttribute( "data-zoom" ) );
+		this.config[ "map" ][ "zoom" ] = zoom;
+	}
+	
+	if ( container.hasAttribute( "data-bounds" ) )
+	{
+		var bounds = container.getAttribute( "data-bounds" );
+		this.config[ "tools" ][ "bounds" ] = bounds;
+	}
+	
+	if ( container.hasAttribute( "data-editable" ) )
+	{
+		var editable = ( container.getAttribute( "data-editable" ) === "true" );
+		
+		if ( ! this.config[ "tools" ] ) this.config[ "tools" ] = {};
+		this.config[ "tools" ][ "editable" ] = editable;
+	}
+};
+
+netgis.Client.prototype.initOutput = function( config )
+{
+	if ( config[ "output" ] && config[ "output" ][ "id" ] )
+	{
+		var output = document.getElementById( config[ "output" ][ "id" ] );
+
+		if ( output && output.value && output.value.length > 0 )
+		{
+			var geojson = JSON.parse( output.value );
+			netgis.util.invoke( this.container, netgis.Events.MAP_EDIT_LAYER_LOADED, { geojson: geojson } );
+
+			/*this.map.addEditFeaturesGeoJSON( json, false );
+			
+			var self = this;
+			
+			window.setTimeout( function() {
+				self.map.map.updateSize();
+				self.map.zoomGeoJSON( json );
+			}, 50 );
+
+			this.editFolder.classList.remove( "netgis-hide" );
+			*/
+		}	
+		
+		this.output = output;
+	}
+	
+	if ( ! 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( config )
+{	
+	this.modules = {};
+	
+	var configModules = config[ "modules" ];
+	
+	if ( ! configModules ) return;
+	
+	if ( configModules[ "map" ] ) this.addModule( "map", netgis.Map );
+	if ( configModules[ "controls" ] ) this.addModule( "controls", netgis.Controls );
+	if ( configModules[ "attribution" ] ) this.addModule( "attribution", netgis.Attribution );
+	if ( configModules[ "legend" ] ) this.addModule( "legend", netgis.Legend );
+	if ( configModules[ "geolocation" ] ) this.addModule( "geolocation", netgis.Geolocation );
+	if ( configModules[ "info" ] ) this.addModule( "info", netgis.Info );
+	if ( configModules[ "menu" ] ) this.addModule( "menu", netgis.Menu );
+	if ( configModules[ "layertree" ] ) this.addModule( "layertree", netgis.LayerTree );
+	/*if ( configModules[ "switcher" ] ) this.addModule( "switcher", netgis.Switcher );
+	if ( configModules[ "iconbar" ] ) this.addModule( "iconbar", netgis.Iconbar );*/
+	if ( configModules[ "searchplace" ] ) this.addModule( "searchplace", netgis.SearchPlace );
+	if ( configModules[ "searchparcel" ] ) this.addModule( "searchparcel", netgis.SearchParcel );
+	//if ( configModules[ "geolocation" ] ) this.addModule( "geolocation", netgis.Geolocation );
+	if ( configModules[ "toolbox" ] ) this.addModule( "toolbox", netgis.Toolbox );
+	if ( configModules[ "import" ] ) this.addModule( "import", netgis.Import );
+	if ( configModules[ "export" ] ) this.addModule( "export", netgis.Export );
+	if ( configModules[ "timeslider" ] ) this.addModule( "timeslider", netgis.TimeSlider );
+	
+	// TODO: automate module loading from config?
+	// TODO: config modules script constructors?
+	
+	//this.logic = new netgis.Logic( this );
+};
+
+netgis.Client.prototype.initEvents = function()
+{
+	// Check For Event Errors
+	this.container.addEventListener( undefined, function( e ) { console.error( "undefined event invoked", e ); } );
+	
+	// Listen To All Client Events
+	for ( var key in netgis.Events )
+	{
+		var val = netgis.Events[ key ];		
+		this.container.addEventListener( val, this.handleEvent.bind( this ) );
+	}
+	
+	
+	// Common
+	/*this.container.addEventListener( "menu-button-click", this.onMenuButtonClick.bind( this ) );
+	this.container.addEventListener( "controls-button-click", this.onControlsButtonClick.bind( this ) );
+	this.container.addEventListener( "iconbar-icon-click", this.onIconbarIconClick.bind( this ) );
+	this.container.addEventListener( "iconbar-item-click", this.onIconbarItemClick.bind( this ) );
+	this.container.addEventListener( "switcher-button-click", this.onSwitcherButtonClick.bind( this ) );
+	this.container.addEventListener( "geolocation-toggle", this.onGeolocationToggle.bind( this ) );
+	this.container.addEventListener( "geolocation-change", this.onGeolocationChange.bind( this ) );*/
+
+	// TODO: move module event handling to modules?
+	/*
+	// Layer Tree
+	this.modules.layertree.panel.container.addEventListener( "panel-toggle", this.onLayerPanelToggle.bind( this ) );
+	this.modules.layertree.panel.container.addEventListener( "item-change", this.onLayerItemChange.bind( this ) );
+	
+	// Search Place
+	this.modules.searchplace.container.addEventListener( "search-change", this.onSearchPlaceChange.bind( this ) );
+	this.modules.searchplace.container.addEventListener( "search-select", this.onSearchPlaceSelect.bind( this ) );
+	this.modules.searchplace.container.addEventListener( "search-clear", this.onSearchPlaceClear.bind( this ) );
+	*/
+   
+	this.container.addEventListener( netgis.Events.MAP_EDIT_LAYER_CHANGE, this.onMapEditLayerChange.bind( this ) );
+   
+	// Test Events
+	////this.container.addEventListener( netgis.Events.MAP_CLICK, this.onMapClick.bind( this ) );
+};
+
+netgis.Client.prototype.showLoader = function( on )
+{
+	if ( ! 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>";
+		
+		if ( this.config[ "client" ] && this.config[ "client" ][ "loading_text" ] )
+			this.loader.innerHTML += "<h2>" + this.config[ "client" ][ "loading_text" ] + "</h2>";
+		
+		this.container.appendChild( this.loader );
+	}
+	
+	if ( on === false )
+	{
+		this.loader.classList.add( "netgis-fade" );
+		
+		this.loaderTimeout = window.setTimeout( function() { this.loader.classList.add( "netgis-hide" ); this.loaderTimeout = null; }.bind( this ), 600 );
+	}
+	else
+	{
+		this.loader.classList.remove( "netgis-hide" );
+		this.loader.classList.remove( "netgis-fade" );
+		
+		if ( this.loaderTimeout )
+		{
+			window.clearTimeout( this.loaderTimeout );
+			this.loaderTimeout = null;
+		}
+	}
+};
+
+netgis.Client.prototype.handleEvent = function( e )
+{
+	var type = e.type;
+	var params = e.detail;
+	
+	if ( this.logEvents === true ) console.info( "EVENT:", type, params );
+	
+	//console.trace( "EVENT:", type, params );
+	
+	/*for ( var key in this.modules )
+	{
+		var module = this.modules[ key ];
+		
+		if ( module.handleEvent ) module.handleEvent( type, params );
+	}*/
+};
+
+netgis.Client.prototype.addModule = function( id, construct )
+{
+	var module = new construct( /*this,*/ this.config );
+	
+	if ( module.attachTo ) module.attachTo( this.container );
+	
+	this.modules[ id ] = module;
+	
+	return module;
+};
+
+netgis.Client.prototype.isMobile = function()
+{
+	//return ( document.body.getBoundingClientRect().width < 600 );
+	//return ( this.container.getBoundingClientRect().width < 600 );
+	return netgis.util.isMobile( this.container );
+};
+
+netgis.Client.prototype.onConfigResponse = function( data )
+{
+	var config = JSON.parse( data );
+	
+	this.init( this.container, config );
+	this.showLoader( false );
+};
+
+netgis.Client.prototype.requestContextWMC = function( url, id )
+{
+	if ( url.indexOf( "{id}" ) > -1 )
+	{
+		if ( ! id )
+		{
+			console.warn( "No WMC id set in config for url", url );
+			return;
+		}
+		else
+		{
+			url = netgis.util.replace( url, "{id}", id );
+		}
+	}
+
+	var wmc = new netgis.WMC();
+	wmc.requestContext( url, this.onContextResponseWMC.bind( this ) );
+	
+	this.showLoader( true );
+};
+
+netgis.Client.prototype.onContextResponseWMC = function( context )
+{
+	console.info( "WMC Response:", context );
+	
+	// TODO: pass only final config instead of context ?
+	
+	// Apply Changes To Current Config
+	for ( var i = 0; i < context.config.layers.length; i++ )
+	{
+		var layer = context.config.layers[ i ];
+		this.config[ "layers" ].push( layer );
+	}
+	
+	if ( context.config[ "map" ][ "bbox" ] )
+	{
+		this.config[ "map" ][ "bbox" ] = context.config[ "map" ][ "bbox" ];
+	}
+	
+	// Update Modules
+	netgis.util.invoke( this.container, netgis.Events.CLIENT_CONTEXT_RESPONSE, { context: context } );
+	
+	this.showLoader( false );
+};
+
+netgis.Client.prototype.requestContextOWS = function( url )
+{
+	console.info( "Request OWS:", url );
+	
+	netgis.util.request( url, this.onContextResponseOWS.bind( this ) );
+};
+
+netgis.Client.prototype.onContextResponseOWS = function( data )
+{
+	var json = JSON.parse( data );
+	
+	console.info( "OWS Response:", json );
+	
+	var config = netgis.OWS.read( json, this );
+	
+	console.info( "OWS Config:", config );
+};
+
+/*
+netgis.Client.prototype.onMenuButtonClick = function( e )
+{
+	var params = e.detail;
+	
+	switch ( params[ "id" ] )
+	{
+		case "layertree":
+		{
+			this.modules.layertree.panel.toggle();
+			break;
+		}
+		
+		case "searchplace":
+		{
+			this.modules.searchplace.search.toggle();
+			break;
+		}
+		
+		default:
+		{
+			console.error( "unhandled menu button", params );
+			break;
+		}
+	}
+};
+*/
+/*
+netgis.Client.prototype.onControlsButtonClick = function( e )
+{
+	var params = e.detail;
+	
+	switch ( params.id )
+	{
+		case "zoom_in":
+		{
+			this.modules.map.zoom( 1.0 );
+			break;
+		}
+		
+		case "zoom_out":
+		{
+			this.modules.map.zoom( -1.0 );
+			break;
+		}
+		
+		case "zoom_gps":
+		{
+			this.modules.geolocation.setActive( ! this.modules.geolocation.isActive() );
+			break;
+		}
+		
+		case "zoom_home":
+		{
+			var lonlat = this.config[ "map" ][ "centerLonLat" ];
+			this.modules.map.zoomLonLat( lonlat[ 0 ], lonlat[ 1 ], this.config[ "map" ][ "zoom" ] );
+			break;
+		}
+	}
+};
+*/
+/*
+netgis.Client.prototype.onLayerPanelToggle = function( e )
+{
+	var params = e.detail;
+	
+	if ( params.visible )
+		this.modules.iconbar.hide();
+	else
+		this.modules.iconbar.show();
+};
+*/
+/*
+netgis.Client.prototype.onLayerItemChange = function( e )
+{
+	var params = e.detail;
+	
+	if ( params.checked )
+	{
+		var layers = this.config[ "layers" ];
+		
+		for ( var i = 0; i < layers.length; i++ )
+		{
+			var layer = layers[ i ];
+			
+			if ( layer[ "id" ] !== params.id ) continue;
+			
+			this.modules.map.addLayer( params.id, layer );
+		}
+	}
+	else
+	{
+		this.modules.map.removeLayer( params.id );
+	}
+	
+	// Shift Switcher Items
+	if ( this.modules.switcher.getIndex( params.id ) === 0 ) this.modules.switcher.shift( 1, 0 );
+};
+*/
+
+netgis.Client.prototype.onIconbarIconClick = function( e )
+{
+	var params = e.detail;
+	
+	switch ( params.id )
+	{
+		case "home":
+		{
+			var layers = this.config[ "layers" ];
+	
+			for ( var i = 0; i < layers.length; i++ )
+			{
+				var layer = layers[ i ];
+				var id = layer[ "id" ];
+				
+				if ( layer[ "active" ] === true )
+				{
+					this.modules.map.addLayer( id, layer );
+					this.modules.layertree.tree.setItemChecked( id, true );
+				}
+				else
+				{
+					this.modules.map.removeLayer( id );
+					this.modules.layertree.tree.setItemChecked( id, false );
+				}
+			}
+			
+			break;
+		}
+	}
+};
+
+netgis.Client.prototype.onIconbarItemClick = function( e )
+{
+	var params = e.detail;
+	
+	var layers = this.config[ "layers" ];
+	
+	for ( var i = 0; i < layers.length; i++ )
+	{
+		var layer = layers[ i ];
+		var id = layer[ "id" ];
+		
+		if ( layer[ "folder" ] === "background" ) continue;
+		
+		if ( id === params.id )
+		{
+			this.modules.map.addLayer( id, layer );
+			this.modules.layertree.tree.setItemChecked( id, true );
+		}
+		else
+		{
+			this.modules.map.removeLayer( id );
+			this.modules.layertree.tree.setItemChecked( id, false );
+		}
+	}
+};
+
+netgis.Client.prototype.onSwitcherButtonClick = function( e )
+{
+	var params = e.detail;
+	
+	var buttons = this.config[ "switcher" ][ "buttons" ];
+	var layers = this.config[ "layers" ];
+	
+	for ( var i = 0; i < buttons.length; i++ )
+	{
+		var button = buttons[ i ];
+		var id = button[ "id" ];
+		
+		if ( id === params.id )
+		{
+			for ( var j = 0; j < layers.length; j++ )
+			{
+				var layer = layers[ j ];
+				
+				if ( layer[ "id" ] !== id ) continue;
+				
+				this.modules.map.addLayer( id, layer );
+				this.modules.layertree.tree.setItemChecked( id, true );
+			}
+		}
+		else
+		{
+			this.modules.map.removeLayer( id );
+			this.modules.layertree.tree.setItemChecked( id, false );
+		}
+	}
+	
+	// Shift Switcher Items
+	if ( this.modules.switcher.getIndex( params.id ) === 0 ) this.modules.switcher.shift( 1, 0 );
+};
+
+/*
+netgis.Client.prototype.onSearchPlaceChange = function( e )
+{
+	var params = e.detail;
+	
+	var url = this.config[ "searchplace" ][ "url" ];
+	url = netgis.util.replace( url, "{query}", window.encodeURIComponent( params.query ) );
+	
+	netgis.util.request( url, this.onSearchPlaceResponse.bind( this ) );
+};
+
+netgis.Client.prototype.onSearchPlaceResponse = function( data )
+{
+	var json = JSON.parse( data );
+	var results = json[ "data" ];
+	
+	this.modules.searchplace.search.clearResults();
+	
+	for ( var i = 0; i < results.length; i++ )
+	{
+		var result = results[ i ];
+		var title = result[ "name" ];
+		
+		var resultData =
+		{
+			type: "street",
+			id: result[ "strid" ],
+			lon: Number.parseFloat( result[ "wgs_x" ] ),
+			lat: Number.parseFloat( result[ "wgs_y" ] )
+		};
+		
+		this.modules.searchplace.search.addResult( title, JSON.stringify( resultData ) );
+	}
+};
+
+netgis.Client.prototype.onSearchPlaceSelect = function( e )
+{
+	var params = e.detail;
+	var data = JSON.parse( params.data );
+	
+	this.modules.map.zoomLonLat( data.lon, data.lat, this.config[ "searchplace" ][ "zoom" ] );
+	
+	this.modules.map.setSearchMarkerLonLat( data.lon, data.lat );
+	this.modules.map.setSearchMarkerVisible( true );
+	
+	// Search Detail Request
+	if ( data.type === "street" )
+	{
+		var url = this.config[ "searchplace" ][ "url_detail" ];
+
+		if ( url )
+		{
+			// TODO: replace all result props to support any url variable (like popup html)?
+
+			url = netgis.util.replace( url, "{id}", data.id );
+			netgis.util.request( url, this.onSearchPlaceDetailResponse.bind( this ) );
+		}
+	}
+};
+
+netgis.Client.prototype.onSearchPlaceDetailResponse = function( data )
+{
+	var json = JSON.parse( data );
+	var results = json[ "hsnrarr" ];
+	
+	if ( results.length === 0 ) return;
+	
+	this.modules.searchplace.search.clearResults();
+	this.modules.map.setSearchMarkerVisible( true );
+	
+	for ( var i = 0; i < results.length; i++ )
+	{
+		var result = results[ i ];
+		var title = json[ "strname" ] + " " + result[ "hsnr" ];
+		
+		var resultData =
+		{
+			type: "address",
+			lon: Number.parseFloat( result[ "wgs_x" ] ),
+			lat: Number.parseFloat( result[ "wgs_y" ] )
+		};
+		
+		this.modules.searchplace.search.addResult( title, JSON.stringify( resultData ) );
+	}
+};
+
+netgis.Client.prototype.onSearchPlaceClear = function( e )
+{
+	this.modules.map.setSearchMarkerVisible( false );
+};
+*/
+
+netgis.Client.prototype.onGeolocationToggle = function( e )
+{
+	var params = e.detail;
+	this.modules.map.setGeolocMarkerVisible( params.on );
+};
+
+netgis.Client.prototype.onGeolocationChange = function( e )
+{
+	var params = e.detail;
+	
+	this.modules.map.zoomLonLat( params.lon, params.lat, this.config[ "geolocation" ][ "zoom" ] );
+	this.modules.map.setGeolocMarkerLonLat( params.lon, params.lat );
+	
+	//this.modules.geolocation.setActive( false );
+};
+
+netgis.Client.prototype.onMapEditLayerChange = function( e )
+{
+	var params = e.detail;
+	var geojson = JSON.stringify( params.geojson );
+	
+	this.output.value = geojson;
+	//this.attribution.onEditFeaturesChange( e.detail );
+};
+
+netgis.Client.handleCommand = function( src, command )
+{
+	// TODO: having a common event invoke scheme for buttons, inputs, items etc. would get rid of this ?
+	
+	//console.info( "Handle Command:", arguments );
+	
+	// Translate Command IDs To Events
+	switch ( command )
+	{
+		case netgis.Commands.LAYERTREE:
+		{
+			netgis.util.invoke( src, netgis.Events.LAYERTREE_TOGGLE, null );
+			break;
+		}
+		
+		case netgis.Commands.SEARCHPLACE:
+		{
+			netgis.util.invoke( src, netgis.Events.SEARCHPLACE_TOGGLE, null );
+			break;
+		}
+		
+		case netgis.Commands.SEARCHPARCEL:
+		{
+			netgis.util.invoke( src, netgis.Events.SEARCHPARCEL_TOGGLE, null );
+			//netgis.util.invoke( src, netgis.Events.CLIENT_SET_MODE, { mode: netgis.Modes.SEARCH_PARCEL } );
+			break;
+		}
+		
+		case netgis.Commands.TOOLBOX:
+		{
+			netgis.util.invoke( src, netgis.Events.TOOLBOX_TOGGLE, null );
+			break;
+		}
+		
+		case netgis.Commands.LEGEND:
+		{
+			netgis.util.invoke( src, netgis.Events.LEGEND_TOGGLE, null );
+			break;
+		}
+		
+		case netgis.Commands.VIEW_PREV:
+		{
+			netgis.util.invoke( src, netgis.Events.MAP_VIEW_PREV, null );
+			break;
+		}
+		
+		case netgis.Commands.VIEW_NEXT:
+		{
+			netgis.util.invoke( src, netgis.Events.MAP_VIEW_NEXT, null );
+			break;
+		}
+		
+		case netgis.Commands.VIEW:
+		{
+			netgis.util.invoke( src, netgis.Events.CLIENT_SET_MODE, { mode: netgis.Modes.VIEW } );
+			break;
+		}
+		
+		case netgis.Commands.ZOOM_BOX:
+		{
+			netgis.util.invoke( src, netgis.Events.CLIENT_SET_MODE, { mode: netgis.Modes.ZOOM_BOX } );
+			break;
+		}
+		
+		case netgis.Commands.ZOOM_SCALE:
+		{
+			var text = src.innerText;
+			var scale = Number.parseInt( text.split( ":" )[ 1 ] );
+			netgis.util.invoke( src, netgis.Events.MAP_ZOOM_SCALE, { scale: scale, anim: true } );
+			break;
+		}
+		
+		case netgis.Commands.MEASURE_LINE:
+		{
+			netgis.util.invoke( src, netgis.Events.CLIENT_SET_MODE, { mode: netgis.Modes.MEASURE_LINE } );
+			break;
+		}
+		
+		case netgis.Commands.MEASURE_AREA:
+		{
+			netgis.util.invoke( src, netgis.Events.CLIENT_SET_MODE, { mode: netgis.Modes.MEASURE_AREA } );
+			break;
+		}
+		
+		case netgis.Commands.MEASURE_CLEAR:
+		{
+			netgis.util.invoke( src, netgis.Events.MEASURE_CLEAR, null );
+			break;
+		}
+		
+		case netgis.Commands.DRAW_POINTS:
+		{
+			netgis.util.invoke( src, netgis.Events.CLIENT_SET_MODE, { mode: netgis.Modes.DRAW_POINTS } );
+			break;
+		}
+		
+		case netgis.Commands.DRAW_LINES:
+		{
+			netgis.util.invoke( src, netgis.Events.CLIENT_SET_MODE, { mode: netgis.Modes.DRAW_LINES } );
+			break;
+		}
+		
+		case netgis.Commands.DRAW_POLYGONS:
+		{
+			netgis.util.invoke( src, netgis.Events.CLIENT_SET_MODE, { mode: netgis.Modes.DRAW_POLYGONS } );
+			break;
+		}
+		
+		case netgis.Commands.MODIFY_FEATURES:
+		{
+			netgis.util.invoke( src, netgis.Events.CLIENT_SET_MODE, { mode: netgis.Modes.MODIFY_FEATURES } );
+			break;
+		}
+		
+		case netgis.Commands.DELETE_FEATURES:
+		{
+			netgis.util.invoke( src, netgis.Events.CLIENT_SET_MODE, { mode: netgis.Modes.DELETE_FEATURES } );
+			break;
+		}
+		
+		case netgis.Commands.BUFFER_FEATURES:
+		{
+			//netgis.util.invoke( src, netgis.Events.CLIENT_SET_MODE, { mode: netgis.Modes.BUFFER_FEATURES } );
+			netgis.util.invoke( src, netgis.Events.CLIENT_SET_MODE, { mode: netgis.Modes.BUFFER_FEATURES_DYNAMIC } );
+			break;
+		}
+		
+		case netgis.Commands.CUT_FEATURES:
+		{
+			netgis.util.invoke( src, netgis.Events.CLIENT_SET_MODE, { mode: netgis.Modes.CUT_FEATURES } );
+			//netgis.util.invoke( src, netgis.Events.CLIENT_SET_MODE, { mode: netgis.Modes.CUT_FEATURES_DYNAMIC } );
+			break;
+		}
+		
+		case netgis.Commands.IMPORT_LAYER:
+		{
+			netgis.util.invoke( src, netgis.Events.IMPORT_LAYER_SHOW, null );
+			break;
+		}
+		
+		case netgis.Commands.EXPORT:
+		{
+			netgis.util.invoke( src, netgis.Events.EXPORT_SHOW, null );
+			break;
+		}
+		
+		case netgis.Commands.GEOLOCATION:
+		{
+			netgis.util.invoke( src, netgis.Events.GEOLOCATION_SHOW_OPTIONS, null );
+			break;
+		}
+		
+		default:
+		{
+			console.error( "unhandled command id", command );
+			break;
+		}
+	}
+};
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/docs/Import.js.html b/docs/Import.js.html new file mode 100644 index 0000000..6dc5e39 --- /dev/null +++ b/docs/Import.js.html @@ -0,0 +1,1473 @@ + + + + + JSDoc: Source: Import.js + + + + + + + + + + +
+ +

Source: Import.js

+ + + + + + +
+
+
"use strict";
+
+var netgis = netgis || {};
+
+/**
+ * Import Module.
+ * @param {type} config
+ * @constructor
+ * @memberof netgis
+ */
+netgis.Import = function( config )
+{
+	this.config = config;
+	
+	this.initElements( config );
+	this.initSections( config );
+	this.initPreview();
+};
+
+netgis.Import.ConfigOptions =
+{
+	/**
+	 * Show Geoportal Tab in Import Modal.
+	 * @type Boolean
+	 */
+	"geoportal_tab": true,
+	
+	/**
+	 * Enable Geoportal Search Autocomplete on Key Press.
+	 * @type Boolean
+	 */
+	geoportal_autocomplete: true
+};
+
+netgis.Import.prototype.initElements = function( config )
+{
+	var cfg = config[ "import" ];
+	
+	// Panel
+	this.modal = new netgis.Modal( cfg[ "title" ] ? cfg[ "title" ] : "Import" );
+	this.modal.container.classList.add( "netgis-import" );
+	
+	// Tabs
+	var tabs = [ "WMS", "WFS", "GeoJSON", "GML", "GeoPackage", "Spatialite", "Shapefile" ];
+	if ( cfg[ "geoportal_tab" ] ) tabs.unshift( "Geoportal" );
+		
+	this.tabs = new netgis.Tabs( tabs );
+	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( config )
+{
+	this.sections = {};
+	
+	var i = 0;
+	
+	// Geoportal
+	if ( config[ "import" ] && config[ "import" ][ "geoportal_tab" ] === true )
+	{
+		this.sections.geoportal = this.tabs.getContentSection( i );
+		i += 1;
+		
+		this.sections.geoportal.classList.add( "netgis-geoportal" );
+		//this.sections.geoportal.classList.remove( "netgis-form" );
+		
+		// TODO: refactor and use common search component (see Search module)
+		
+		this.geoportalSearch = this.addInputText( this.sections.geoportal, "Suche im Datenkatalog:" );
+		this.geoportalSearch.addEventListener( "change", this.onGeoportalSearchChange.bind( this ) );
+		this.geoportalSearch.setAttribute( "placeholder", "Thema, Schlagwort..." );
+		
+		// TODO: refactor and use common loader component (see Client loader)
+		
+		this.geoportalLoader = document.createElement( "div" );
+		this.geoportalLoader.className = "netgis-loader netgis-text-a netgis-hide";
+		this.geoportalLoader.innerHTML = "<i class='fas fa-cog'></i>";
+		this.geoportalSearch.parentNode.appendChild( this.geoportalLoader );
+		
+		if ( config[ "import" ] && config[ "import" ][ "geoportal_autocomplete" ] === true )
+		{
+			this.geoportalSearch.addEventListener( "keyup", this.onGeoportalSearchKeyUp.bind( this ) );
+		}
+		
+		this.geoportalResults = new netgis.Tree();
+		this.geoportalResults.attachTo( this.sections.geoportal );
+		
+		this.geoportalSubmit = this.addButton( this.sections.geoportal, "<i class='netgis-icon fas fa-check'></i><span>Hinzufügen</span>", this.onGeoportalSubmit.bind( this ) );
+	}
+	
+	// WMS
+	this.sections.wms = this.tabs.getContentSection( i );
+	i += 1;
+	
+	this.addInputText( this.sections.wms, "WMS-URL:", this.config[ "import" ][ "wms_options" ] );
+	this.addButton( this.sections.wms, "<i class='netgis-icon fas fa-cloud-download-alt'></i><span>Dienst laden</span>", this.onWMSLoadClick.bind( this ) );
+	
+	this.addInputText( this.sections.wms, "Bezeichnung:" );
+	this.addInputSelect( this.sections.wms, "Ebene:" );
+	this.addInputSelect( this.sections.wms, "Format:" );
+	this.addButton( this.sections.wms, "<i class='netgis-icon fas fa-check'></i><span>Hinzufügen</span>", this.onWMSAcceptClick.bind( this ) );
+	
+	this.showDetailsWMS( false );
+	
+	// WFS
+	this.sections.wfs = this.tabs.getContentSection( i );
+	i += 1;
+	
+	this.addInputText( this.sections.wfs, "WFS-URL:", this.config[ "import" ][ "wfs_options" ] );
+	this.addButton( this.sections.wfs, "<i class='netgis-icon fas fa-cloud-download-alt'></i><span>Dienst laden</span>", this.onWFSLoadClick.bind( this ) );
+	
+	this.addInputText( this.sections.wfs, "Bezeichnung:" );
+	this.addInputSelect( this.sections.wfs, "Ebene:" );
+	this.addInputSelect( this.sections.wfs, "Format:" );
+	this.addButton( this.sections.wfs, "<i class='netgis-icon fas fa-check'></i><span>Hinzufügen</span>", this.onWFSAcceptClick.bind( this ) );
+	
+	this.showDetailsWFS( false );
+	
+	// GeoJSON
+	this.sections.geojson = this.tabs.getContentSection( i );
+	i += 1;
+	
+	this.addInputFile( this.sections.geojson, "GeoJSON-Datei:", ".geojson,.json" );
+	this.addText( this.sections.geojson, "<h3>Unterstützte Koordinatensysteme:</h3><ul><li>Web Mercator (EPSG:3857)</li><li>WGS84 / Lon-Lat (EPSG:4326)</li><li>ETRS89 / UTM Zone 32N (EPSG:25832)</li></ul>" );
+	this.addButton( this.sections.geojson, "<i class='netgis-icon fas fa-check'></i><span>Datei laden</span>", this.onGeoJSONAcceptClick.bind( this ) );
+	
+	// GML
+	this.sections.gml = this.tabs.getContentSection( i );
+	i += 1;
+	
+	this.addInputFile( this.sections.gml, "GML-Datei:", ".gml,.xml" );
+	this.addText( this.sections.gml, "<h3>Unterstützte Koordinatensysteme:</h3><ul><li>Web Mercator (EPSG:3857)</li><li>WGS84 / Lon-Lat (EPSG:4326)</li><li>ETRS89 / UTM Zone 32N (EPSG:25832)</li></ul>" );
+	this.addButton( this.sections.gml, "<i class='netgis-icon fas fa-check'></i><span>Datei laden</span>", this.onGMLAcceptClick.bind( this ) );
+	
+	// GeoPackage
+	this.sections.geopackage = this.tabs.getContentSection( i );
+	i += 1;
+	
+	this.addInputFile( this.sections.geopackage, "GeoPackage-Datei:", ".gpkg" );
+	this.addText( this.sections.geopackage, "<h3>Unterstützte Koordinatensysteme:</h3><ul><li>Web Mercator (EPSG:3857)</li><li>WGS84 / Lon-Lat (EPSG:4326)</li><li>ETRS89 / UTM Zone 32N (EPSG:25832)</li></ul>" );
+	this.addButton( this.sections.geopackage, "<i class='netgis-icon fas fa-check'></i><span>Datei laden</span>", this.onGeoPackageAcceptClick.bind( this ) );
+	
+	// Spatialite
+	this.sections.spatialite = this.tabs.getContentSection( i );
+	i += 1;
+	
+	this.addInputFile( this.sections.spatialite, "Spatialite-Datei:", ".sqlite" );
+	this.addText( this.sections.spatialite, "<h3>Unterstützte Koordinatensysteme:</h3><ul><li>Web Mercator (EPSG:3857)</li><li>WGS84 / Lon-Lat (EPSG:4326)</li><li>ETRS89 / UTM Zone 32N (EPSG:25832)</li></ul>" );
+	this.addButton( this.sections.spatialite, "<i class='netgis-icon fas fa-check'></i><span>Datei laden</span>", this.onSpatialiteAcceptClick.bind( this ) );
+	
+	// Shapefile
+	this.sections.shapefile = this.tabs.getContentSection( i );
+	i += 1;
+	
+	this.addInputFile( this.sections.shapefile, "Shapefile-Zip-Datei:", ".zip" );
+	this.addText( this.sections.shapefile, "<h3>Unterstützte Koordinatensysteme:</h3><ul><li>Web Mercator (EPSG:3857)</li><li>WGS84 / Lon-Lat (EPSG:4326)</li><li>ETRS89 / UTM Zone 32N (EPSG:25832)</li></ul>" );
+	this.addButton( this.sections.shapefile, "<i class='netgis-icon fas fa-check'></i><span>Datei laden</span>", this.onShapefileAcceptClick.bind( this ) );
+};
+
+netgis.Import.prototype.initPreview = function()
+{
+	// TODO: import features preview modal with table / tree view and map
+	
+	this.preview = new netgis.Modal( "Vorschau" );
+	this.preview.attachTo( this.modal.content );
+	
+	this.previewMapContainer = document.createElement( "div" );
+	this.previewMapContainer.className = "netgis-preview-map";
+	this.preview.content.appendChild( this.previewMapContainer );
+	
+	if ( ol )
+	{
+		var mapconfig = this.config[ "map" ];
+		
+		var viewParams =
+		{
+			projection: mapconfig[ "projection" ],
+			center: mapconfig[ "centerLonLat" ] ? ol.proj.fromLonLat( mapconfig[ "centerLonLat" ] ) : mapconfig.center,
+			zoom: mapconfig[ "zoom" ]
+		};
+		
+		this.previewMap = new ol.Map
+		(
+			{
+				target: this.previewMapContainer,
+				view: new ol.View( viewParams ),
+				pixelRatio: 1.0,
+				moveTolerance: 3,
+				controls: []
+			}
+		);
+
+		this.previewMap.getView().padding = [ 10, 10, 10, 10 ];
+
+		this.previewMap.addLayer( new ol.layer.Tile( { source: new ol.source.OSM() } ) );
+	}
+	
+	this.previewTree = new netgis.Tree();
+	this.previewTree.container.classList.add( "netgis-preview-tree" );
+	this.previewTree.attachTo( this.preview.content );
+	
+	this.previewTree.container.addEventListener( netgis.Events.TREE_ITEM_CHANGE, this.onPreviewTreeItemChange.bind( this ) );
+	
+	this.previewSubmit = document.createElement( "button" );
+	this.previewSubmit.setAttribute( "type", "button" );
+	this.previewSubmit.className = "netgis-import-submit netgis-button netgis-center netgis-color-a netgis-hover-c netgis-shadow";
+	this.previewSubmit.innerHTML = "<i class='netgis-icon fas fa-check'></i><span>Hinzufügen</span>";
+	this.previewSubmit.addEventListener( "click", this.onPreviewSubmitClick.bind( this ) );
+	this.preview.content.appendChild( this.previewSubmit );
+};
+
+netgis.Import.prototype.attachTo = function( parent )
+{
+	parent.appendChild( this.modal.container );
+	
+	parent.addEventListener( netgis.Events.IMPORT_LAYER_SHOW, this.onImportShow.bind( this ) );
+	parent.addEventListener( netgis.Events.IMPORT_LAYER_PREVIEW_FEATURES, this.onImportPreviewFeatures.bind( this ) );
+};
+
+netgis.Import.prototype.addText = function( parent, text )
+{
+	var div = document.createElement( "div" );
+	div.innerHTML = text;
+	
+	parent.appendChild( div );
+	
+	return div;
+};
+
+netgis.Import.prototype.addButton = function( parent, title, handler )
+{
+	var button = document.createElement( "button" );
+	button.className = "netgis-button netgis-center netgis-color-a netgis-hover-c netgis-shadow";
+	button.setAttribute( "type", "button" );
+	button.innerHTML = title;
+	
+	if ( handler ) button.onclick = handler;
+	
+	parent.appendChild( button );
+	
+	return button;
+};
+
+netgis.Import.prototype.addInputText = function( parent, title, options )
+{
+	var label = document.createElement( "label" );
+	label.innerHTML = title;
+	
+	var input = document.createElement( "input" );
+	input.setAttribute( "type", "text" );
+	label.appendChild( input );
+	
+	if ( options )
+	{
+		var listID = "list-" + netgis.util.stringToID( title );
+		
+		var datalist = document.createElement( "datalist" );
+		datalist.setAttribute( "id", listID );
+		
+		for ( var i = 0; i < options.length; i++ )
+		{
+			var option = document.createElement( "option" );
+			option.setAttribute( "value", options[ i ] );
+			datalist.appendChild( option );
+		}
+		
+		parent.appendChild( datalist );
+		input.setAttribute( "list", listID );
+	}
+	
+	parent.appendChild( label );
+	
+	return input;
+};
+
+netgis.Import.prototype.addInputSelect = function( parent, title, options )
+{
+	var label = document.createElement( "label" );
+	label.innerHTML = title;
+	
+	var select = document.createElement( "select" );
+	label.appendChild( select );
+	
+	parent.appendChild( label );
+	
+	return select;
+};
+
+netgis.Import.prototype.addInputFile = function( parent, title, accept )
+{
+	var label = document.createElement( "label" );
+	label.innerHTML = title;
+	
+	var input = document.createElement( "input" );
+	input.setAttribute( "type", "file" );
+	input.setAttribute( "accept", accept );
+	label.appendChild( input );
+	
+	parent.appendChild( label );
+	
+	return input;
+};
+
+netgis.Import.prototype.getLayerOrder = function()
+{
+	return 10000; // TODO: increase by imported layer count to match tree order?
+};
+
+netgis.Import.prototype.showDetailsWMS = function( on )
+{
+	var section = this.sections.wms;
+	var labels = section.getElementsByTagName( "label" );
+	var buttons = section.getElementsByTagName( "button" );
+	
+	if ( on )
+	{
+		labels[ 1 ].classList.remove( "netgis-hide" );
+		labels[ 2 ].classList.remove( "netgis-hide" );
+		labels[ 3 ].classList.remove( "netgis-hide" );
+		buttons[ 1 ].classList.remove( "netgis-hide" );
+	}
+	else
+	{
+		labels[ 1 ].classList.add( "netgis-hide" );
+		labels[ 2 ].classList.add( "netgis-hide" );
+		labels[ 3 ].classList.add( "netgis-hide" );
+		buttons[ 1 ].classList.add( "netgis-hide" );
+	}
+};
+
+netgis.Import.prototype.showDetailsWFS = function( on )
+{
+	var section = this.sections.wfs;
+	var labels = section.getElementsByTagName( "label" );
+	var buttons = section.getElementsByTagName( "button" );
+	
+	if ( on )
+	{
+		labels[ 1 ].classList.remove( "netgis-hide" );
+		labels[ 2 ].classList.remove( "netgis-hide" );
+		labels[ 3 ].classList.remove( "netgis-hide" );
+		buttons[ 1 ].classList.remove( "netgis-hide" );
+	}
+	else
+	{
+		labels[ 1 ].classList.add( "netgis-hide" );
+		labels[ 2 ].classList.add( "netgis-hide" );
+		labels[ 3 ].classList.add( "netgis-hide" );
+		buttons[ 1 ].classList.add( "netgis-hide" );
+	}
+};
+
+netgis.Import.prototype.submitImportLayer = function( params )
+{
+	if ( this.config[ "import" ][ "preview" ] === true )
+	{
+		netgis.util.invoke( this.modal.container, netgis.Events.IMPORT_LAYER_PREVIEW, params );
+	}
+	else
+	{
+		this.config[ "layers" ].push( params );
+		netgis.util.invoke( this.modal.container, netgis.Events.IMPORT_LAYER_ACCEPT, params );
+		this.modal.hide();
+	}
+};
+
+netgis.Import.prototype.onImportShow = function( e )
+{
+	this.modal.show();
+	this.tabs.updateHeaderScroll();
+};
+
+netgis.Import.prototype.onWMSLoadClick = function( e )
+{
+	this.showDetailsWMS( false );
+	
+	var section = this.sections.wms;
+	var inputs = section.getElementsByTagName( "input" );
+	
+	// Input URL
+	var url = inputs[ 0 ].value;
+	url = url.trim();
+	
+	if ( url.length < 1 ) return;
+	
+	// Get Base URL
+	var qmark = url.indexOf( "?" );
+	var baseURL = ( qmark > -1 ) ? url.substr( 0, qmark ) : url;
+	
+	// Get Params
+	var params = [ "request=GetCapabilities" ];
+	
+	if ( qmark > -1 )
+	{
+		// Existing Params
+		var parts = url.substr( qmark + 1 );
+		parts = parts.split( "&" );
+		
+		for ( var p = 0; p < parts.length; p++ )
+		{
+			var part = parts[ p ];
+			part = part.toLowerCase();
+			
+			if ( part.search( "service" ) > -1 ) { params.push( part ); continue; }
+			if ( part.search( "version" ) > -1 ) { params.push( part ); continue; }
+			if ( part.search( "request" ) > -1 ) { continue; }
+		}
+	}
+	
+	params = params.join( "&" );
+	
+	if ( params.search( "service=" ) === -1 ) params += "&service=WMS";
+	
+	// Capabilities URL
+	var capsURL = baseURL + "?" + params;
+	netgis.util.request( capsURL, this.onWMSCapsResponse.bind( this ) );
+};
+
+netgis.Import.prototype.onWMSCapsResponse = function( data )
+{
+	var parser = new DOMParser();
+	var xml = parser.parseFromString( data, "text/xml" );
+	var caps = xml.documentElement;
+	
+	// Check For Parsing Errors
+	var errors = xml.getElementsByTagName( "parsererror" );
+	
+	for ( var i = 0; i < errors.length; i++ )
+	{
+		//alert( errors[ i ].textContent );
+		console.error( "WMS caps parser error:", errors[ i ].textContent );
+	}
+	
+	if ( errors.length > 0 ) alert( data.length > 0 ? data : errors[ 0 ].textContent );
+   
+	// Inputs
+	var section = this.sections.wms;
+	var inputs = section.getElementsByTagName( "input" );
+	var selects = section.getElementsByTagName( "select" );
+	
+	var selectLayer = selects[ 0 ];
+	var selectFormat = selects[ 1 ];
+   
+	for ( var i = selectLayer.options.length - 1; i >= 0; i-- ) selectLayer.options.remove( i );
+	for ( var i = selectFormat.options.length - 1; i >= 0; i-- ) selectFormat.options.remove( i );
+	
+	switch ( caps.nodeName )
+	{
+		default:
+		case "HTML":
+		{
+			console.warn( "could not detect WMS service", caps );
+			break;
+		}
+		
+		// WMS
+		case "WMS_Capabilities":
+		case "WMT_MS_Capabilities":
+		{
+			var version = caps.getAttribute( "version" );
+			var service = caps.getElementsByTagName( "Service" )[ 0 ];
+			var title = service.getElementsByTagName( "Title" )[ 0 ].textContent;
+			inputs[ 1 ].value = title;
+			
+			var layerItems = caps.getElementsByTagName( "Layer" );
+			var layers = [];
+			
+			for ( var l = 0; l < layerItems.length; l++ )
+			{
+				var item = layerItems[ l ];
+				var layerName = item.getElementsByTagName( "Name" )[ 0 ].textContent;
+				var layerTitle = item.getElementsByTagName( "Title" )[ 0 ].textContent;
+				
+				layers.push( { name: layerName, title: layerTitle } );
+				
+				var option = document.createElement( "option" );
+				option.text = layerTitle;
+				option.value = layerName;
+				selectLayer.options.add( option ); 
+			}
+			
+			var getMap = caps.getElementsByTagName( "GetMap" )[ 0 ];
+			var formatItems = getMap.getElementsByTagName( "Format" );
+			var formats = [];
+			
+			for ( var f = 0; f < formatItems.length; f++ )
+			{
+				var item = formatItems[ f ];
+				var format = item.textContent;
+				
+				formats.push( format );
+				
+				var option = document.createElement( "option" );
+				option.text = format;
+				option.value = format;
+				selectFormat.options.add( option );
+			}
+			
+			break;
+		}
+	}
+	
+	this.showDetailsWMS( true );
+};
+
+netgis.Import.prototype.onWMSAcceptClick = function( e )
+{
+	// Inputs
+	var section = this.sections.wms;
+	var inputs = section.getElementsByTagName( "input" );
+	var selects = section.getElementsByTagName( "select" );
+	
+	var id = "import_" + netgis.util.getTimeStamp( true );
+	var serviceURL = inputs[ 0 ].value;
+	var serviceTitle = inputs[ 1 ].value;
+	var layerTitle = selects[ 0 ].selectedOptions[ 0 ].innerText;
+	var layerName = selects[ 0 ].value;
+	var layerFormat = selects[ 1 ].value;
+	
+	serviceURL = netgis.util.replace( serviceURL, "request=", "oldrequest=" );
+	serviceURL = netgis.util.replace( serviceURL, "Request=", "oldrequest=" );
+	
+	var params =
+	{
+		id: id,
+		folder: null,
+		active: true,
+		query: true, // TODO: add dialog checkbox for queryable ? check caps for get feature info command support ?
+		order: this.getLayerOrder(),
+		
+		type: netgis.LayerTypes.WMS,
+		url: serviceURL,
+		title: layerTitle,
+		name: layerName,
+		format: layerFormat,
+		tiled: true
+	};
+	
+	this.config[ "layers" ].push( params );
+	
+	netgis.util.invoke( section, netgis.Events.IMPORT_LAYER_ACCEPT, params );
+	
+	this.modal.hide();
+};
+
+netgis.Import.prototype.onWFSLoadClick = function( e )
+{
+	this.showDetailsWFS( false );
+	
+	var section = this.sections.wfs;
+	var inputs = section.getElementsByTagName( "input" );
+	
+	// Input URL
+	var url = inputs[ 0 ].value;
+	url = url.trim();
+	
+	if ( url.length < 1 ) return;
+	
+	// Get Base URL
+	var qmark = url.indexOf( "?" );
+	var baseURL = ( qmark > -1 ) ? url.substr( 0, qmark ) : url;
+	
+	// Get Params
+	var params = [ "request=GetCapabilities" ];
+	
+	if ( qmark > -1 )
+	{
+		// Existing Params
+		var parts = url.substr( qmark + 1 );
+		parts = parts.split( "&" );
+		
+		for ( var p = 0; p < parts.length; p++ )
+		{
+			var part = parts[ p ];
+			part = part.toLowerCase();
+			
+			if ( part.search( "service" ) > -1 ) { params.push( part ); continue; }
+			if ( part.search( "version" ) > -1 ) { params.push( part ); continue; }
+			if ( part.search( "request" ) > -1 ) { continue; }
+			
+			params.push( part );
+		}
+	}
+	
+	params = params.join( "&" );
+	
+	if ( params.search( "service=" ) === -1 ) params += "&service=WFS";
+	
+	// Capabilities URL
+	var capsURL = baseURL + "?" + params;
+	
+	if ( this.config[ "import" ][ "wfs_proxy" ] )
+		capsURL = this.config[ "import" ][ "wfs_proxy" ] + capsURL;
+	
+	netgis.util.request( capsURL, this.onWFSCapsResponse.bind( this ) );
+};
+
+netgis.Import.prototype.onWFSCapsResponse = function( data )
+{
+	var parser = new DOMParser();
+	var xml = parser.parseFromString( data, "text/xml" );
+	var caps = xml.documentElement;
+	
+	// Check For Parsing Errors
+	var errors = xml.getElementsByTagName( "parsererror" );
+	
+	for ( var i = 0; i < errors.length; i++ )
+	{
+		//alert( errors[ i ].textContent );
+		console.error( "WFS caps parser error:", errors[ i ].textContent );
+	}
+	
+	if ( errors.length > 0 ) alert( data.length > 0 ? data : errors[ 0 ].textContent );
+   
+	// Inputs
+	var section = this.sections.wfs;
+	var inputs = section.getElementsByTagName( "input" );
+	var selects = section.getElementsByTagName( "select" );
+	
+	var selectLayer = selects[ 0 ];
+	var selectFormat = selects[ 1 ];
+   
+	for ( var i = selectLayer.options.length - 1; i >= 0; i-- ) selectLayer.options.remove( i );
+	for ( var i = selectFormat.options.length - 1; i >= 0; i-- ) selectFormat.options.remove( i );
+	
+	switch ( caps.nodeName )
+	{
+		default:
+		case "HTML":
+		{
+			console.error( "could not detect WFS service", caps );
+			break;
+		}
+		
+		case "WFS_Capabilities":
+		case "wfs:WFS_Capabilities":
+		{
+			var version = caps.getAttribute( "version" );
+			var service = caps.getElementsByTagName( "ows:ServiceIdentification" )[ 0 ];
+			var title = service.getElementsByTagName( "ows:Title" )[ 0 ].textContent;
+			inputs[ 1 ].value = title;
+			
+			var featureTypeItems = caps.getElementsByTagName( "FeatureType" );
+			var types = [];
+			
+			for ( var l = 0; l < featureTypeItems.length; l++ )
+			{
+				var item = featureTypeItems[ l ];
+				var typeName = item.getElementsByTagName( "Name" )[ 0 ].textContent;
+				var typeTitle = item.getElementsByTagName( "Title" )[ 0 ].textContent;
+				
+				types.push( { name: typeName, title: typeTitle } );
+				
+				var option = document.createElement( "option" );
+				option.text = typeTitle;
+				option.value = typeName;
+				selectLayer.options.add( option ); 
+			}
+			
+			var operations = caps.getElementsByTagName( "ows:Operation" );
+			var getFeature = null;
+			
+			for ( var o = 0; o < operations.length; o++ )
+			{
+				if ( operations[ o ].getAttribute( "name" ) === "GetFeature" )
+				{
+					getFeature = operations[ o ];
+					break;
+				}
+			}
+			
+			var preferredFormat = null;
+			
+			if ( getFeature )
+			{
+				var parameters = getFeature.getElementsByTagName( "ows:Parameter" );
+				
+				for ( var p = 0; p < parameters.length; p++ )
+				{
+					var parameter = parameters[ p ];
+					
+					if ( parameter.getAttribute( "name" ) === "outputFormat" )
+					{
+						var formatItems = parameter.getElementsByTagName( "ows:Value" );
+
+						for ( var f = 0; f < formatItems.length; f++ )
+						{
+							var item = formatItems[ f ];
+							var format = item.textContent;
+
+							var option = document.createElement( "option" );
+							option.text = format;
+							option.value = format;
+							selectFormat.options.add( option );
+							
+							if ( format.search( "json" ) > -1 ) preferredFormat = format;
+						}
+						
+						break;
+					}
+				}
+			}
+			
+			if ( preferredFormat ) selectFormat.value = preferredFormat;
+			
+			break;
+		}
+	}
+	
+	this.showDetailsWFS( true );
+};
+
+netgis.Import.prototype.onWFSAcceptClick = function( e )
+{
+	// Inputs
+	var section = this.sections.wfs;
+	var inputs = section.getElementsByTagName( "input" );
+	var selects = section.getElementsByTagName( "select" );
+	
+	var id = "import_" + netgis.util.getTimeStamp( true );
+	var serviceURL = inputs[ 0 ].value;
+	var serviceTitle = inputs[ 1 ].value;
+	var layerTitle = selects[ 0 ].selectedOptions[ 0 ].innerText;
+	var layerName = selects[ 0 ].value;
+	var layerFormat = selects[ 1 ].value;
+	
+	serviceURL = netgis.util.replace( serviceURL, "request=", "oldrequest=" );
+	serviceURL = netgis.util.replace( serviceURL, "Request=", "oldrequest=" );
+	
+	if ( this.config[ "import" ][ "wfs_proxy" ] )
+		serviceURL = this.config[ "import" ][ "wfs_proxy" ] + serviceURL;
+	
+	var params =
+	{
+		id: id,
+		folder: null,
+		active: true,
+		order: this.getLayerOrder(),
+		style: this.config[ "styles" ][ "import" ],
+		
+		title: layerTitle,
+		type: netgis.LayerTypes.WFS,
+		url: serviceURL,
+		name: layerName,
+		format: layerFormat
+	};
+	
+	this.config[ "layers" ].push( params );
+	
+	netgis.util.invoke( section, netgis.Events.IMPORT_LAYER_ACCEPT, params );
+	
+	this.modal.hide();
+};
+
+netgis.Import.prototype.onGeoJSONAcceptClick = function( e )
+{
+	// Inputs
+	var section = this.sections.geojson;
+	var inputs = section.getElementsByTagName( "input" );
+	
+	var file = inputs[ 0 ].files[ 0 ];
+	
+	if ( ! file )
+	{
+		alert( "No file selected!" );
+		return;
+	}
+	
+	var reader = new FileReader();
+	reader.title = file.name;
+	reader.onload = this.onGeoJSONLoad.bind( this );
+	reader.readAsText( file );
+};
+
+netgis.Import.prototype.onGeoJSONLoad = function( e )
+{
+	var section = this.sections.geojson;
+	var reader = e.target;
+	
+	var title = reader.title;
+	var data = reader.result;
+	
+	var id = "import_" + netgis.util.getTimeStamp( true );
+	
+	var params =
+	{
+		id: id,
+		folder: null,
+		active: true,
+		order: this.getLayerOrder(),
+		style: this.config[ "styles" ][ "import" ],
+		
+		title: title,
+		type: netgis.LayerTypes.GEOJSON,
+		data: data
+	};
+	
+	this.submitImportLayer( params );
+};
+
+netgis.Import.prototype.onGMLAcceptClick = function( e )
+{
+	// Inputs
+	var section = this.sections.gml;
+	var inputs = section.getElementsByTagName( "input" );
+	
+	var file = inputs[ 0 ].files[ 0 ];
+	
+	if ( ! file )
+	{
+		alert( "No file selected!" );
+		return;
+	}
+	
+	var reader = new FileReader();
+	reader.title = file.name;
+	reader.onload = this.onGMLLoad.bind( this );
+	reader.readAsText( file );
+};
+
+netgis.Import.prototype.onGMLLoad = function( e )
+{
+	var section = this.sections.gml;
+	var reader = e.target;
+	var data = reader.result;
+	
+	var id = "import_" + netgis.util.getTimeStamp( true );
+	var title = reader.title;
+	
+	var params =
+	{
+		id: id,
+		folder: null,
+		active: true,
+		order: this.getLayerOrder(),
+		style: this.config[ "styles" ][ "import" ],
+		
+		title: title,
+		type: netgis.LayerTypes.GML,
+		data: data
+	};
+	
+	this.submitImportLayer( params );
+};
+
+netgis.Import.prototype.onGeoPackageAcceptClick = function( e )
+{
+	// Inputs
+	var section = this.sections.geopackage;
+	var inputs = section.getElementsByTagName( "input" );
+	
+	var file = inputs[ 0 ].files[ 0 ];
+	
+	if ( ! file )
+	{
+		alert( "No file selected!" );
+		return;
+	}
+	
+	var reader = new FileReader();
+	reader.title = file.name;
+	reader.onload = this.onGeoPackageLoad.bind( this );
+	reader.readAsArrayBuffer( file );
+};
+
+netgis.Import.prototype.onGeoPackageLoad = function( e )
+{
+	var section = this.sections.geopackage;
+	var reader = e.target;
+	var data = reader.result;
+	
+	var id = "import_" + netgis.util.getTimeStamp( true );
+	var title = reader.title;
+	
+	var params =
+	{
+		id: id,
+		folder: null,
+		active: true,
+		order: this.getLayerOrder(),
+		style: this.config[ "styles" ][ "import" ],
+		
+		title: title,
+		type: netgis.LayerTypes.GEOPACKAGE,
+		data: data
+	};
+	
+	this.submitImportLayer( params );
+};
+
+netgis.Import.prototype.onSpatialiteAcceptClick = function( e )
+{
+	// Inputs
+	var section = this.sections.spatialite;
+	var inputs = section.getElementsByTagName( "input" );
+	
+	var file = inputs[ 0 ].files[ 0 ];
+	
+	if ( ! file )
+	{
+		alert( "No file selected!" );
+		return;
+	}
+	
+	var reader = new FileReader();
+	reader.title = file.name;
+	reader.onload = this.onSpatialiteLoad.bind( this );
+	reader.readAsArrayBuffer( file );
+};
+
+netgis.Import.prototype.onSpatialiteLoad = function( e )
+{
+	var section = this.sections.spatialite;
+	var reader = e.target;
+	var data = reader.result;
+	
+	var id = "import_" + netgis.util.getTimeStamp( true );
+	var title = reader.title;
+	
+	var params =
+	{
+		id: id,
+		folder: null,
+		active: true,
+		order: this.getLayerOrder(),
+		style: this.config[ "styles" ][ "import" ],
+		
+		title: title,
+		type: netgis.LayerTypes.SPATIALITE,
+		data: data
+	};
+	
+	this.submitImportLayer( params );
+};
+
+netgis.Import.prototype.onShapefileAcceptClick = function( e )
+{
+	// Inputs
+	var section = this.sections.shapefile;
+	var inputs = section.getElementsByTagName( "input" );
+	
+	var file = inputs[ 0 ].files[ 0 ];
+	
+	if ( ! file )
+	{
+		alert( "No file selected!" );
+		return;
+	}
+	
+	var reader = new FileReader();
+	reader.title = file.name;
+	reader.onload = this.onShapefileLoad.bind( this );
+	reader.readAsArrayBuffer( file );
+};
+
+netgis.Import.prototype.onShapefileLoad = function( e )
+{
+	var section = this.sections.shapefile;
+	var reader = e.target;
+	var data = reader.result;
+	
+	var id = "import_" + netgis.util.getTimeStamp( true );
+	var title = reader.title;
+	
+	var params =
+	{
+		id: id,
+		folder: null,
+		active: true,
+		order: this.getLayerOrder(),
+		style: this.config[ "styles" ][ "import" ],
+		
+		title: title,
+		type: netgis.LayerTypes.SHAPEFILE,
+		data: data
+	};
+	
+	this.submitImportLayer( params );
+};
+
+netgis.Import.prototype.onImportPreviewFeatures = function( e )
+{
+	var params = e.detail;
+	var layer = params.layer;
+	
+	// Clear All
+	this.previewTree.clear();
+	
+	var layers = this.previewMap.getLayers().getArray();
+	for ( var i = 1; i < layers.length; i++ ) this.previewMap.removeLayer( layers[ i ] );
+	
+	// TODO: get preview map renderer from config
+	if ( ! ol ) { console.error( "import preview only supported with OL map renderer", layer ); return; }
+	
+	var styleConfig = config[ "styles" ][ "import" ];
+	
+	var style = new ol.style.Style
+	(
+		{
+			fill: new ol.style.Fill( { color: styleConfig[ "fill" ] } ),
+			stroke: new ol.style.Stroke( { color: styleConfig[ "stroke" ], width: styleConfig[ "width" ] } )
+		}
+	);
+	
+	layer.setStyle( style );
+	
+	this.previewMap.addLayer( layer );
+	
+	var folder = this.previewTree.addFolder( null, params.id, params.title );
+	
+	// Delay Showing Features Until Fully Loaded	
+	var features = layer.getSource().getFeatures();
+	
+	if ( features.length === 0 )
+	{
+		// Delayed Feature Loading
+		var self = this;
+		
+		layer.getSource().on
+		(
+			"addfeature",
+			function( e )
+			{			
+				if ( self.featureLoadTimeout ) window.clearTimeout( self.featureLoadTimeout );
+
+				self.featureLoadTimeout = window.setTimeout
+				(
+					function()
+					{					
+						var features = layer.getSource().getFeatures();
+						self.updatePreviewFeatures( features, folder, layer, params );
+						self.featureLoadTimeout = null;
+					},
+					100
+				);
+			}
+		);
+	}
+	else
+	{
+		// Direct Feature Loading
+		this.updatePreviewFeatures( features, folder, layer, params );
+	}
+};
+
+netgis.Import.prototype.updatePreviewFeatures = function( features, folder, layer, params )
+{
+	// TODO: passing all params necessary ?
+	
+	for ( var i = 0; i < features.length; i++ )
+	{
+		var feature = features[ i ];
+		var id = feature.getId();
+		var props = feature.getProperties();
+
+		if ( ! id )
+		{
+			id = i + 1;
+			feature.setId( id );
+		}
+
+		var title = null;
+
+		for ( var key in props )
+		{
+			switch ( key.toLowerCase() )
+			{
+				case "name": { title = props[ key ]; break; }
+				case "title": { title = props[ key ]; break; }
+				case "id": { title = props[ key ]; break; }
+				case "gid": { title = props[ key ]; break; }
+				case "oid": { title = props[ key ]; break; }
+				case "objectid": { title = props[ key ]; break; }
+			}
+		}
+
+		if ( ! title ) title = id;
+		
+		// Append Length / Area
+		var geom = feature.getGeometry();
+		
+		if ( geom instanceof ol.geom.Polygon || geom instanceof ol.geom.MultiPolygon )
+		{
+			title += " (" + netgis.util.formatArea( geom.getArea() ) + ")";
+		}
+		else if ( geom instanceof ol.geom.LineString )
+		{
+			title += " (" + netgis.util.formatArea( geom.getLength() ) + ")";
+		}
+		else if ( geom instanceof ol.geom.MultiLineString )
+		{
+			var len = 0.0;
+			var parts = geom.getLineStrings();
+			
+			for ( var j = 0; j < parts.length; j++ )
+				len += parts[ j ].getLength();
+			
+			title += " (" + netgis.util.formatArea( len ) + ")";
+		}
+
+		// Create Checkbox
+		this.previewTree.addCheckbox( folder, id, "Feature " + title, true );
+	}
+
+	this.previewTree.setFolderOpen( params.id, true );
+	this.previewTree.updateFolderChecks();
+
+	this.preview.show();
+
+	this.previewMap.updateSize();
+	this.previewMap.getView().fit( layer.getSource().getExtent() );
+};
+
+netgis.Import.prototype.onPreviewSubmitClick = function( e )
+{
+	var folder = this.previewTree.container.getElementsByClassName( "netgis-folder" )[ 0 ];
+	var layerID = folder.getAttribute( "data-id" );
+	var layerTitle = folder.getElementsByTagName( "span" )[ 0 ].innerText;
+	
+	var items = this.previewTree.container.getElementsByTagName( "input" );
+	
+	var layer = this.previewMap.getLayers().getArray()[ 1 ];
+	var source = layer.getSource();
+	var features = [];
+	
+	for ( var i = 1; i < items.length; i++ )
+	{
+		var item = items[ i ];
+		var checked = item.checked;
+		
+		if ( ! checked ) continue;
+		
+		var id = item.getAttribute( "data-id" );
+		var feature = source.getFeatureById( id );
+		
+		features.push( feature );
+	}
+	
+	var format = new ol.format.GeoJSON();
+	var geojson = format.writeFeaturesObject( features );
+	
+	// Projection not set automatically, assume the same as Map View
+	var proj = this.previewMap.getView().getProjection().getCode();
+	geojson[ "crs" ] = { "type": "name", "properties": { "name": "urn:ogc:def:crs:" + proj.replace( ":", "::" ) } };
+	
+	var params =
+	{
+		id: layerID,
+		folder: null,
+		active: true,
+		order: this.getLayerOrder(),
+		style: this.config[ "styles" ][ "import" ],
+		
+		title: layerTitle,
+		type: netgis.LayerTypes.GEOJSON,
+		data: geojson
+	};
+	
+	this.config[ "layers" ].push( params );
+	
+	netgis.util.invoke( this.preview.container, netgis.Events.IMPORT_LAYER_ACCEPT, params );
+	
+	this.preview.hide();
+	this.modal.hide();
+};
+
+netgis.Import.prototype.onPreviewTreeItemChange = function( e )
+{
+	var params = e.detail;
+	
+	var layer = this.previewMap.getLayers().getArray()[ 1 ];
+	var feature = layer.getSource().getFeatureById( params.id );
+	
+	if ( params.checked )
+	{
+		feature.setStyle( null );
+	}
+	else
+	{
+		feature.setStyle( new ol.style.Style( {} ) );
+	}
+};
+
+netgis.Import.prototype.onGeoportalSearchKeyUp = function( e )
+{
+	var key = e.keyCode;
+	
+	switch ( key )
+	{
+		// Enter
+		case 13:
+		{
+			// Trigger First Result Click
+			/*var buttons = this.results.getElementsByTagName( "button" );
+			if ( buttons.length > 0 ) buttons[ 0 ].click();*/
+			
+			break;
+		}
+		
+		// Escape
+		case 27:
+		{
+			//this.toggle();
+			//this.clearAll();
+			break;
+		}
+		
+		default:
+		{
+			this.onGeoportalSearchChange();
+			break;
+		}
+	}
+};
+
+netgis.Import.prototype.onGeoportalSearchChange = function( e )
+{
+	//this.geoportalLoader.classList.remove( "netgis-hide" );
+	
+	if ( this.geoportalTimeout ) window.clearTimeout( this.geoportalTimeout );
+	this.geoportalTimeout = window.setTimeout( this.onGeoportalSearchTimeout.bind( this ), 250 );
+};
+
+netgis.Import.prototype.onGeoportalSearchTimeout = function()
+{
+	var query = this.geoportalSearch.value;
+	query = query.trim();
+	
+	if ( query.length > 0 && query !== this.geoportalLastQuery )
+	{
+		this.geoportalLoader.classList.remove( "netgis-hide" );
+		
+		var url = this.config[ "import" ][ "geoportal_search_url" ];
+		url = netgis.util.replace( url, "{query}", query );
+		
+		netgis.util.request( url, this.onGeoportalSearchResponse.bind( this ) );
+		
+		this.geoportalLastQuery = query;
+	}
+	else
+	{
+		//this.geoportalLoader.classList.add( "netgis-hide" );
+	}
+};
+
+netgis.Import.prototype.onGeoportalSearchResponse = function( data )
+{
+	var json = JSON.parse( data );
+	
+	this.geoportalResults.clear();
+	
+	console.info( "Geoportal Response:", json );
+	
+	var searchResults = json[ "wms" ][ "srv" ];
+	
+	this.geoportalDataRaw = searchResults;
+			
+	if ( searchResults.length > 0 )
+	{
+		//layerResultsPanel.collapse( "show" );
+	}
+
+	var total = json[ "wms" ][ "md" ][ "nresults" ];
+
+	if ( total > 40 )
+	{
+		//layerResultsAlert.toggleClass( "hidden", false );
+		//layerResultsAlert.find( "#layer-results-total" ).text( total );
+	}
+	else
+	{
+		//layerResultsAlert.toggleClass( "hidden", true );
+	}
+
+	var children;
+
+	function recursive( layer )
+	{
+		if ( layer && layer.layer )
+		{
+			for ( var c = 0; c < layer.layer.length; c++ )
+				recursive( layer.layer[ c ] );
+		}
+		else if ( layer )
+		{
+			children.push( layer );
+		}
+
+		return children.length;
+	}
+	
+	this.geoportalData = [];
+
+	for ( var l = 0; l < searchResults.length; l++ )
+	{
+		var layer = searchResults[ l ];
+		
+		//console.info( "Result Layer:", layer );
+
+		// Get children recursively
+		children = [];
+		var count = recursive( layer );
+		
+		// Service Folder
+		var title = layer[ "title" ] + " (" + count + ")";
+		
+		var folder = this.geoportalResults.addFolder( null, l, title );
+		folder.setAttribute( "title", layer[ "abstract" ] );
+
+		//var rows = "";
+		
+		for ( var c = 0; c < children.length; c++ )
+		{
+			var child = children[ c ];
+			
+			//console.info( "Result Child:", child );
+			
+			// Layer Item
+			this.geoportalResults.addCheckbox( folder, c /*child[ "id" ]*/, child[ "title" ] );
+			
+			/*
+			var child = "<tr class='layer-result-child' data-layer-id='" + children[ c ].id + "'>";
+			child += "<td>";
+			child += children[ c ].title;
+			child += "<span class='btn-add pull-right glyphicon glyphicon-plus'></span>";
+			child += "</td>";
+			child += "</tr>";
+
+			rows += child;
+			*/
+		}
+		
+		layer.children = children;
+		this.geoportalData.push( layer );
+
+		// Add to list
+		/*
+		var item =
+		{
+			index:		l,
+			id:			layer.id,
+			title:		layer.title + " (" + count + ")",
+			count:		count,
+			details:	layer.abstract,
+			rows:		rows
+		};
+
+		layerResultsList.loadTemplate( $( "#layer-result-template" ), item, { append: true } );
+		*/
+	}
+
+	//TODO: add click handler for layer result child
+
+	/*
+	layerResultsCount.text( searchResults.length );
+
+	layerResultsList.find( ".list-group-item-heading" ).click( onResultClick );
+	layerResultsList.find( ".layer-result-child" ).click( onResultChildClick );
+	layerResultsList.find( ".collapser" ).click( onResultDetailsClick );
+
+	searchButton.find( "i" ).toggleClass( "hidden" );
+	*/
+	
+	this.geoportalLoader.classList.add( "netgis-hide" );
+};
+
+netgis.Import.prototype.onGeoportalSubmit = function( e )
+{
+	console.info( "Geoportal Submit..." );
+	
+	var items = this.geoportalResults.container.getElementsByClassName( "netgis-item" );
+	
+	var count = 0;
+	
+	for ( var i = 0; i < items.length; i++ )
+	{
+		var item = items[ i ];
+		var input = item.getElementsByTagName( "input" )[ 0 ];
+		
+		if ( ! input.checked ) continue;
+		
+		count += 1;
+		
+		var id = input.getAttribute( "data-id" );
+		
+		var list = item.parentNode;
+		var details = list.parentNode;
+		var folder = details.parentNode;
+		
+		var fid = folder.getAttribute( "data-id" );
+		
+		var fdata = this.geoportalData[ fid ];
+		var data = fdata.children[ id ];
+		//var data = fdata[  ]
+		
+		//console.info( "Item:", fid, id, fdata, data );
+		
+		var ftitle = fdata[ "title" ];
+		
+		var url = fdata[ "getMapUrl" ];
+		var name = data[ "name" ];
+		var title = data[ "title" ];
+		var abstract = data[ "abstract" ];
+		var queryable = ( data[ "queryable" ] === 1 );
+		
+		fid = "geoportal_" + fid;
+		id = fid + "_" + id;
+		
+		var params =
+		{
+			folder: { id: fid, title: ftitle },
+			layer: { id: id, url: url, name: name, title: title }
+		};
+		
+		netgis.util.invoke( this.sections.geoportal, netgis.Events.IMPORT_GEOPORTAL_SUBMIT, params );
+	}
+	
+	if ( count > 0 ) this.modal.hide();
+};
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/docs/Info.js.html b/docs/Info.js.html new file mode 100644 index 0000000..d010bd7 --- /dev/null +++ b/docs/Info.js.html @@ -0,0 +1,443 @@ + + + + + JSDoc: Source: Info.js + + + + + + + + + + +
+ +

Source: Info.js

+ + + + + + +
+
+
"use strict";
+
+var netgis = netgis || {};
+
+netgis.Info = function( config )
+{
+	this.config = config;
+	
+	this.queryLayers = {};
+	
+	this.popup = new netgis.Popup();
+	this.popup.setHeader( "Abfrage" );
+	
+	this.initConfig( config );
+};
+
+netgis.Info.prototype.initConfig = function( config )
+{
+	// Add Active Layers (Top To Bottom Order)
+	var configLayers = config[ "layers" ];
+	
+	for ( var i = configLayers.length - 1; i >= 0; i-- )
+	{
+		var layer = configLayers[ i ];
+		
+		if ( layer[ "active" ] === true && this.isLayerQueryable( layer ) )
+		{
+			this.queryLayers[ layer[ "id" ] ] = layer;
+		}
+		else if ( this.queryLayers[ layer[ "id" ] ] )
+		{
+			delete this.queryLayers[ layer[ "id" ] ];
+		}
+	}
+};
+
+netgis.Info.prototype.attachTo = function( parent )
+{
+	this.popup.attachTo( parent );
+	
+	parent.addEventListener( netgis.Events.CLIENT_CONTEXT_RESPONSE, this.onClientContextResponse.bind( this ) );
+	
+	parent.addEventListener( netgis.Events.MAP_LAYER_TOGGLE, this.onMapLayerToggle.bind( this ) );
+	parent.addEventListener( netgis.Events.IMPORT_LAYER_ACCEPT, this.onImportLayerAccept.bind( this ) );
+	parent.addEventListener( netgis.Events.IMPORT_GEOPORTAL_SUBMIT, this.onImportGeoportalSubmit.bind( this ) );
+	
+	parent.addEventListener( netgis.Events.MAP_CLICK, this.onMapClick.bind( this ) );
+	parent.addEventListener( netgis.Events.MAP_FEATURE_CLICK, this.onMapFeatureClick.bind( this ) );
+};
+
+/**
+ * Checks for a queryable layer.
+ * Does not check layer active state.
+ * @param {object} layer Layer Config Parameters
+ * @returns {Boolean}
+ */
+netgis.Info.prototype.isLayerQueryable = function( layer )
+{
+	//if ( ! layer[ "active" ] ) return false;
+	
+	var queryable = false;
+	
+	if ( layer[ "query" ] === true )
+	{
+		// Queryable Config Layers
+		queryable = true;
+	}
+	else if ( layer[ "query" ] !== false )
+	{
+		// Default Query Behavior For WMS
+		switch ( layer[ "type" ] )
+		{
+			case netgis.LayerTypes.WMS:
+			case netgis.LayerTypes.WMST:
+			{
+				queryable = true;
+				break;
+			}
+		}
+	}
+	
+	return queryable;
+};
+
+/**
+ * 
+ * @param {string} title
+ * @param {string} content HTML
+ */
+netgis.Info.prototype.addSection = function( title, content, open )
+{
+	var html =
+	[
+		( open === true ) ? "<details open='open'>" : "<details>",
+		"<summary class='netgis-button netgis-noselect netgis-clip-text netgis-color-d netgis-hover-text-a netgis-hover-d'>",
+		title,
+		"</summary>",
+		"<div class='netgis-border-d'>",
+		content,
+		"</div>",
+		"</details>"
+	];
+	
+	this.popup.addContent( html.join( "" ) );
+	
+	// TODO: create element without html strings
+};
+
+netgis.Info.prototype.onClientContextResponse = function( e )
+{
+	var params = e.detail;
+	this.initConfig( params.context.config );
+};
+
+netgis.Info.prototype.onMapLayerToggle = function( e )
+{
+	var params = e.detail;
+	var id = params.id;
+	
+	//console.info( "Info Layer Toggle:", params );
+	
+	if ( params.on )
+	{
+		// Get Layer By ID
+		var layers = this.config[ "layers" ];
+		var layer = null;
+
+		for ( var i = 0; i < layers.length; i++ )
+		{
+			if ( layers[ i ][ "id" ] === id )
+			{
+				layer = layers[ i ];
+				break;
+			}
+		}
+
+		// Add Queryable Layer
+		if ( layer )
+		{
+			if ( this.isLayerQueryable( layer ) ) this.queryLayers[ id ] = layer;
+		}
+	}
+	else
+	{
+		// Remove Queryable Layer
+		delete this.queryLayers[ id ];
+	}
+};
+
+netgis.Info.prototype.onImportLayerAccept = function( e )
+{
+	var params = e.detail;
+	var layer = params;
+	
+	if ( this.isLayerQueryable( layer ) ) this.queryLayers[ layer.id ] = layer;
+};
+
+netgis.Info.prototype.onImportGeoportalSubmit = function( e )
+{
+	var params = e.detail;
+	
+	//console.info( "Info Geoportal Submit:", params );
+	
+	// TODO: make imported layers queryable
+};
+
+netgis.Info.prototype.onMapClick = function( e )
+{
+	var params = e.detail;
+	
+	//console.info( "Info Map Click:", params, params.lon, params.lat );
+	
+	if ( params.mode !== netgis.Modes.VIEW ) return;
+	
+	var cfg = this.config[ "info" ];
+	
+	// Popup
+	if ( this.popup.container !== params.overlay )
+	{
+		this.popup.attachTo( params.overlay );
+	}
+	
+	this.popup.clearContent();
+	
+	// Query Layers
+	var count = 0;
+	
+	for ( var id in this.queryLayers )
+	{
+		var layer = this.queryLayers[ id ];
+		
+		// Auto Query For WMS With Undefined Config
+		if ( ! layer[ "query_url" ] || layer[ "query_url" ] === "" )
+		{
+			switch ( layer[ "type" ] )
+			{
+				case netgis.LayerTypes.WMS:
+				case netgis.LayerTypes.WMST:
+				{
+					var url = layer[ "url" ];
+
+					////if ( layer[ "query_url" ] ) url = layer[ "query_url" ];
+
+					// TODO: layer config query url template params replace
+
+					var request =
+					[
+						"service=WMS",
+						"version=1.1.0",
+						"request=GetFeatureInfo",
+						"styles=",
+						"layers=" + window.encodeURIComponent( layer[ "name" ] ),
+						"query_layers=" + window.encodeURIComponent( layer[ "name" ] ),
+						"bbox=" + params.view.bbox.join( "," ),
+						"srs=" + params.view.projection,
+						"width=" + params.view.width,
+						"height=" + params.view.height,
+						"x=" + Math.round( params.pixel[ 0 ] ),
+						"y=" + Math.round( params.pixel[ 1 ] ),
+						"info_format=" + ( cfg && cfg[ "default_format" ] ? cfg[ "default_format" ] : "text/plain" )
+						//"info_format=" + "text/html"
+					];
+
+					url = url + ( url.indexOf( "?" ) === -1 ? "?" : "" ) + request.join( "&" );
+					
+					netgis.util.request( url, this.onLayerResponseWMS.bind( this ), { title: layer[ "title" ] } );
+
+					// TODO: handle wms query error responses
+
+					count += 1;
+
+					break;
+				}
+			}
+		}
+	   
+		// Query Using Config URL
+		var url = layer[ "query_url" ];
+		
+		if ( url && url !== "" )
+		{
+			//if ( ! url || url === "" ) continue;
+
+			url = netgis.util.replace( url, "{bbox}", params.view.bbox.join( "," ) );
+			url = netgis.util.replace( url, "{proj}", params.view.projection );
+			url = netgis.util.replace( url, "{width}", params.view.width );
+			url = netgis.util.replace( url, "{height}", params.view.height );
+			url = netgis.util.replace( url, "{x}", params.coords[ 0 ] );
+			url = netgis.util.replace( url, "{y}", params.coords[ 1 ] );
+			url = netgis.util.replace( url, "{px}", params.pixel[ 0 ] );
+			url = netgis.util.replace( url, "{py}", params.pixel[ 1 ] );
+			url = netgis.util.replace( url, "{lon}", params.lon );
+			url = netgis.util.replace( url, "{lat}", params.lat );
+
+			//console.info( "WMS REQUEST 2:", url );
+
+			netgis.util.request( url, this.onLayerResponseWMS.bind( this ), { title: layer[ "title" ] } );
+
+			count += 1;
+		}
+		
+		// Force Query From Config For Vector Features
+		/*
+		if ( layer[ "query" ] === true && ( ! layer[ "query_url" ] || layer[ "query_url" ] === "" ) )
+		{
+			count += 1;
+		}
+		*/
+	   
+		// TODO: handle vector feature info on map feature click
+	}
+	
+	if ( count > 0 )
+	{
+		this.popup.showLoader();
+		this.popup.show();
+	}
+	else
+	{
+		this.popup.hide();
+	}
+};
+
+netgis.Info.prototype.onLayerResponseWMS = function( data, requestData, request )
+{
+	//console.info( "INFO RESPONSE:", data, requestData, request );
+	
+	var title = requestData.title;
+	var content = data;
+	
+	// Nothing Returned
+	if ( ! data || data === "" ) data = "<p style='padding: 0mm 2mm;'><i>Keine Daten gefunden...</i></p>";
+	
+	// Check Content Type
+	var contentType = request.getResponseHeader( "Content-Type" );
+	
+	if ( contentType )
+	{
+		switch ( contentType.split( ";" )[ 0 ] )
+		{
+			case "text/plain":
+			{
+				content = "<pre>" + content + "</pre>";
+				break;
+			}
+		}
+	}
+	
+	// Add To Content
+	this.popup.hideLoader();
+	this.addSection( title, content, false );
+};
+
+netgis.Info.prototype.onMapFeatureClick = function( e )
+{
+	var params = e.detail;
+	var props = params.properties;
+	
+	//console.info( "Info Feature Click:", params, this.popup.wrapper.innerHTML, this.popup.wrapper.childNodes );
+	
+	var open = false; //( this.popup.wrapper.childNodes.length === 0 );
+	var show = false;
+	
+	// Filter Feature Properties
+	var title = null;
+	var filtered = [];
+	var blacklist = [ "geometry", "fill", "fill-opacity", "stroke", "stroke-opacity", "stroke-width", "styleUrl" ];
+	
+	for ( var k in props )
+	{
+		if ( blacklist.indexOf( k ) > -1 ) continue;
+		
+		var v = props[ k ];
+		filtered.push( [ k, v ] );
+		
+		if ( ! title )
+		{
+			if ( k === "name" && v !== "" ) title = v;
+			else if ( k === "title" && v !== "" ) title = v;
+			else if ( k === "id" && v ) title = v;
+		}
+	}
+		
+	// Build Title
+	if ( ! title && params.id ) title = params.id;
+	title = title ? 'Feature "' + title + '"' : "Feature";
+	
+	if ( params.id === "geolocation" )
+	{
+		title = this.config[ "geolocation" ][ "marker_title" ];
+		if ( ! title || title === "" ) title = "Geolocation";
+		
+		filtered.push( [ "Längengrad (Lon.)", params.lon ] );
+		filtered.push( [ "Breitengrad (Lat.)", params.lat ] );
+	}
+
+	// Build Table
+	var html = [];
+
+	if ( filtered.length > 0 )
+	{
+		html.push( "<table>" );
+
+		for ( var i = 0; i < filtered.length; i++ )
+		{
+			var item = filtered[ i ];
+			var k = item[ 0 ];
+			var v = item[ 1 ];
+
+			html.push( "<tr class='netgis-hover-d'>" );
+			html.push( "<th>" + k + "</th>" );
+			html.push( "<td>" + v + "</td>" );
+			html.push( "</tr>" );
+		}
+
+		html.push( "</table>" );
+	}
+	else
+	{
+		html.push( "<i>Keine Eigenschaften vorhanden...</i>" );
+	}
+
+	html = html.join( "" );
+
+	// Add To Popup Content
+	this.addSection( title, html, open );
+	show = true;
+	
+	if ( ! this.popup.isVisible() && show )
+	{
+		this.popup.show();
+	}
+};
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/docs/LayerID.js.html b/docs/LayerID.js.html new file mode 100644 index 0000000..912b0bd --- /dev/null +++ b/docs/LayerID.js.html @@ -0,0 +1,66 @@ + + + + + JSDoc: Source: LayerID.js + + + + + + + + + + +
+ +

Source: LayerID.js

+ + + + + + +
+
+
"use strict";
+
+var netgis = netgis || {};
+
+/**
+ * Default Layer IDs.
+ * @type Object
+ */
+netgis.LayerID = Object.freeze
+(
+	{
+		EDITABLE: "editable-layer",
+		NON_EDITABLE: "non-editable-layer"
+		//TIMESLIDER: "timeslider-layer"
+	}
+);
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/docs/LayerTypes.js.html b/docs/LayerTypes.js.html new file mode 100644 index 0000000..d793d01 --- /dev/null +++ b/docs/LayerTypes.js.html @@ -0,0 +1,81 @@ + + + + + JSDoc: Source: LayerTypes.js + + + + + + + + + + +
+ +

Source: LayerTypes.js

+ + + + + + +
+
+
"use strict";
+
+var netgis = netgis || {};
+
+netgis.LayerTypes = Object.freeze
+(
+	{
+		HIDDEN: "HIDDEN",
+		
+		// Raster Layers
+		TMS: "TMS",
+		WMTS: "WMTS",
+		WMS: "WMS",
+		WMST: "WMST",
+		
+		// Vector Layers
+		GEOJSON: "GEOJSON",
+		VTILES: "VTILES",
+		WFS: "WFS",
+		GML: "GML",
+		KML: "KML",
+		GEOPACKAGE: "GEOPACKAGE",
+		SPATIALITE: "SPATIALITE",
+		SHAPEFILE: "SHAPEFILE",
+		WKT: "WKT",
+		
+		/** NOTE: deprecated, see layer type TMS */
+		OSM: "OSM",
+		XYZ: "XYZ" 
+	}
+);
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/docs/Map.js.html b/docs/Map.js.html new file mode 100644 index 0000000..093aa52 --- /dev/null +++ b/docs/Map.js.html @@ -0,0 +1,4544 @@ + + + + + JSDoc: Source: Map.js + + + + + + + + + + +
+ +

Source: Map.js

+ + + + + + +
+
+
"use strict";
+
+/* global ol, proj4, jsts */
+
+var netgis = netgis || {};
+
+/**
+ * Map Implementation for OpenLayers 3+.
+ * @param {type} client
+ * @param {type} config
+ * @returns {netgis.Map}
+ */
+netgis.Map = function( /*client,*/ config )
+{
+	//this.client = client;
+	this.config = config;
+	
+	this.mode = null;
+	this.interactions = {};
+	this.layers = {};
+	
+	this.viewHistory = [];
+	this.viewIndex = -1;
+	this.viewFromHistory = false;
+	this.viewHistoryMax = 20;
+	this.paddingBuffer = 40;
+	
+	this.hoverFeature = null;
+	this.hoverBounds = null;
+	this.selectedFeatures = [];
+	this.sketchFeatures = [];
+	this.snap = null;
+	this.snapFeatures = new ol.Collection();
+	this.editEventsSilent = false;
+	this.selectMultiple = false;
+	this.selectReset = false;
+	this.drawError = false;
+	
+	this.initElements();
+	this.initMap( config );
+	this.initLayers();
+	this.initOverlays();
+	this.initInteractions();
+	this.initConfig( config );
+	
+	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", this.onKeyUp.bind( this ) );
+	
+	//this.container.addEventListener( "contextmenu", function( e ) { e.preventDefault(); } );
+};
+
+netgis.Map.prototype.initMap = function( config )
+{
+	var mapconfig = config[ "map" ];
+	
+	// Projections ( WGS / Lon-Lat Supported By Default )
+	if ( typeof proj4 !== "undefined" )
+	{
+		proj4.defs( config[ "projections" ] );
+		proj4.defs( "urn:ogc:def:crs:OGC:1.3:CRS84", proj4.defs( "EPSG:4326" ) );
+		ol.proj.proj4.register( proj4 );
+	}
+	
+	// View
+	var viewParams =
+	{
+		projection: mapconfig[ "projection" ],
+		center: mapconfig[ "center_lonlat" ] ? ol.proj.fromLonLat( mapconfig[ "center_lonlat" ], mapconfig[ "projection" ] ) : mapconfig[ "center" ],
+		minZoom: mapconfig[ "min_zoom" ],
+		maxZoom: mapconfig[ "max_zoom" ],
+		zoom: mapconfig[ "zoom" ]
+	};
+	
+	this.view = new ol.View
+	(
+		viewParams
+	);
+	
+	//this.setPadding( 0, 0, 0, 0 );
+
+	// Map
+	this.map = new ol.Map
+	(
+		{
+			target: this.container,
+			view: this.view,
+			pixelRatio: 1.0,
+			//moveTolerance: 0,
+			moveTolerance: ( mapconfig[ "move_tolerance" ] || mapconfig[ "move_tolerance" ] === 0 ) ? mapconfig[ "move_tolerance" ] : 7,
+			controls: []
+		}
+	);
+	
+	// Scale Bar
+	if ( mapconfig[ "scalebar" ] )
+	{
+		this.scalebar = new ol.control.ScaleLine( { bar: true } );
+		this.map.addControl( this.scalebar );
+		
+		var scales = mapconfig[ "scales" ];
+		
+		if ( scales && scales.length > 0 )
+		{
+			this.scalebarSelect = document.createElement( "select" );
+			this.scalebarSelect.addEventListener( "change", this.onScalebarSelectChange.bind( this ) );
+			this.scalebar.element.appendChild( this.scalebarSelect );
+			
+			for ( var i = 0; i < scales.length; i++ )
+			{
+				var scale = scales[ i ];
+				var option = document.createElement( "option" );
+				option.innerHTML = "1:" + scale;
+				option.setAttribute( "value", scale );
+				this.scalebarSelect.appendChild( option );
+			}
+		}
+	}
+	
+	// Map Events
+	this.map.on( "moveend", this.onMapMoveEnd.bind( this ) );
+	this.map.on( "pointermove", this.onPointerMove.bind( this ) );
+	this.map.on( "click", this.onPointerClick.bind( this ) );
+	
+	// TODO: unify event init
+	
+	if ( config[ "map" ][ "extent" ] )
+	{
+		// Wait Until Map In DOM
+		var self = this;
+		
+		window.setTimeout
+		(
+			function()
+			{
+				self.map.updateSize();
+				self.view.fit( config[ "map" ][ "extent" ] );
+			},
+			10
+		);
+	}
+};
+
+netgis.Map.prototype.initLayers = function()
+{
+	// Measure Layer
+	this.measureLayer = new ol.layer.Vector( { source: new ol.source.Vector( { features: [] } ), zIndex: 60000, style: this.styleMeasure.bind( this ) } );
+	this.map.addLayer( this.measureLayer );
+	
+	var toolsConfig =  this.config[ "tools" ];
+	
+	if ( toolsConfig )
+	{
+		// Non Edit Layer
+		this.nonEditLayer = new ol.layer.Vector
+		(
+			{
+				source: new ol.source.Vector( { features: [] } ),
+				zIndex: 50000,
+				style: this.styleNonEdit.bind( this ),
+				updateWhileAnimating: toolsConfig && toolsConfig[ "interactive_render" ] ? toolsConfig[ "interactive_render" ] : false,
+				updateWhileInteracting: toolsConfig && toolsConfig[ "interactive_render" ] ? toolsConfig[ "interactive_render" ] : false
+			}
+		);
+
+		this.map.addLayer( this.nonEditLayer );
+
+		// Edit Layer
+		this.editLayer = new ol.layer.Vector
+		(
+			{
+				source: new ol.source.Vector( { features: [] } ),
+				zIndex: 50000,
+				style: this.styleEdit.bind( this ),
+				updateWhileAnimating: toolsConfig && toolsConfig[ "interactive_render" ] ? toolsConfig[ "interactive_render" ] : false,
+				updateWhileInteracting: toolsConfig && toolsConfig[ "interactive_render" ] ? toolsConfig[ "interactive_render" ] : false
+			}
+		);
+
+		this.map.addLayer( this.editLayer );
+
+		this.editLayer.getSource().on( "addfeature", this.onEditLayerAdd.bind( this ) );
+		this.editLayer.getSource().on( "changefeature", this.onEditLayerChange.bind( this ) ); //TODO: fired on feature style change? use only one style function with selected/hover states?
+		this.editLayer.getSource().on( "removefeature", this.onEditLayerRemove.bind( this ) );
+
+		// Preview Layer
+		this.previewLayer = new ol.layer.Vector( { source: new ol.source.Vector( { features: [] } ), zIndex: 55000, style: this.styleSketch.bind( this ) } );
+		this.map.addLayer( this.previewLayer );
+		//this.addLayer( netgis.Client.Layers.PREVIEW_LAYER, this.previewLayer );
+
+		// Bounds Layer
+		this.boundsLayer = null;
+
+		if ( this.config[ "tools" ][ "bounds" ] )
+		{		
+			var features = new ol.format.GeoJSON().readFeatures( this.config[ "tools" ][ "bounds" ] );
+
+			var style = null;
+
+			if ( this.config[ "tools" ][ "show_bounds" ] && this.config[ "styles" ][ "bounds" ] )
+				style = this.createStyle( this.config[ "styles" ][ "bounds" ] );
+
+			this.boundsLayer = new ol.layer.Vector( { source: new ol.source.Vector( { features: features } ), style: style, zIndex: 60000 } );
+			this.map.addLayer( this.boundsLayer );
+		}
+	}
+	
+	// Geolocation Layer
+	this.geolocLayer = null;
+	
+	if ( this.config[ "modules" ][ "geolocation" ] === true )
+	{
+		var cfg = this.config[ "geolocation" ];
+		
+		var style = 
+		[
+			new ol.style.Style
+			(
+				{
+					image: new ol.style.Circle
+					(
+						{
+							fill: new ol.style.Fill( { color: "#ffffff" } ),
+							radius: 8.0
+						}
+					)
+				}
+			),
+			new ol.style.Style
+			(
+				{
+					image: new ol.style.Circle
+					(
+						{
+							fill: new ol.style.Fill( { color: cfg[ "marker_color" ] ? cfg[ "marker_color" ] : "#ff0000" } ),
+							radius: 5.0
+						}
+					)
+				}
+			)
+		];
+		
+		var marker = new ol.Feature( { geometry: new ol.geom.Point( ol.proj.fromLonLat( [ 7.0, 50.0 ], this.view.getProjection() ) ) } );
+		marker.setId( "geolocation" );
+		
+		this.geolocLayer = new ol.layer.Vector( { source: new ol.source.Vector( { features: [ marker ] } ), style: style, zIndex: 66000 } );
+		this.map.addLayer( this.geolocLayer );
+		
+		this.geolocLayer.setVisible( false );
+	}
+};
+
+netgis.Map.prototype.initOverlays = function()
+{
+	var popupElement = document.createElement( "div" );
+	popupElement.className = "netgis-map-overlay";
+	
+	this.popupOverlay = new ol.Overlay
+	(
+		{
+			id: "popup",
+			element: popupElement,
+			positioning: "center-center"
+		}
+	);
+	
+	this.map.addOverlay( this.popupOverlay );
+};
+
+netgis.Map.prototype.initInteractions = function()
+{
+	// View
+	
+	this.interactions[ netgis.Modes.VIEW ] =
+	[
+		new ol.interaction.DragPan(),
+		new ol.interaction.DragPan( { condition: function( e ) { return e.originalEvent.button === 1; } } ),
+		new ol.interaction.MouseWheelZoom()
+	];
+	
+	this.interactions[ netgis.Modes.ZOOM_BOX ] =
+	[
+		//new ol.interaction.DragZoom( { condition: ol.events.condition.always, out: false } ),
+		new ol.interaction.DragZoom( { condition: function( e ) { return e.originalEvent.button === 0; }, out: false, className: "netgis-zoom-box" } ),
+		new ol.interaction.DragPan( { condition: function( e ) { return e.originalEvent.button === 1; } } ),
+		new ol.interaction.MouseWheelZoom()
+	];
+	
+	// Measure
+	
+	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( e ) { return e.originalEvent.button === 1; } } ),
+		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 ) /* condition: function( e ) { return ol.events.condition.noModifierKeys( e ) && ol.events.condition.primaryAction( e ); }, /*finishCondition: function( e ) { return ol.events.condition.doubleClick( e ) || ( ol.events.condition.primaryAction( e ) === false ); }*/ } ),
+		new ol.interaction.DragPan( { condition: function( e ) { return e.originalEvent.button === 1; } } ),
+		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" ] && this.config[ "tools" ][ "editable" ] === true )
+	{
+		// Draw
+
+		var bounds = this.config[ "tools" ][ "bounds" ] ? true : false;
+
+		this.interactions[ netgis.Modes.DRAW_POINTS ] =
+		[
+			new ol.interaction.Draw( { type: "Point", source: this.editLayer.getSource(), style: this.styleSketch.bind( this ), geometryFunction: bounds ? this.onDrawPointsUpdateGeom.bind( this ) : undefined } ),
+			new ol.interaction.DragPan(),
+			new ol.interaction.DragPan( { condition: function( e ) { return e.originalEvent.button === 1; } } ),
+			new ol.interaction.MouseWheelZoom()
+		];
+
+		this.interactions[ netgis.Modes.DRAW_POINTS ][ 0 ].on( "drawend", this.onDrawBufferEnd.bind( this ) );
+		if ( bounds ) 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: bounds ? this.onDrawLinesUpdateGeom.bind( this ) : undefined } ),
+			new ol.interaction.DragPan(),
+			new ol.interaction.DragPan( { condition: function( e ) { return e.originalEvent.button === 1; } } ),
+			new ol.interaction.MouseWheelZoom()
+		];
+
+		this.interactions[ netgis.Modes.DRAW_LINES ][ 0 ].on( "drawend", this.onDrawBufferEnd.bind( this ) );
+		if ( bounds ) 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: bounds ? this.onDrawPolygonsUpdateGeom.bind( this ) : undefined } ),
+			new ol.interaction.DragPan(),
+			new ol.interaction.DragPan( { condition: function( e ) { return e.originalEvent.button === 1; } } ),
+			new ol.interaction.MouseWheelZoom()
+		];
+
+		if ( bounds ) this.interactions[ netgis.Modes.DRAW_POLYGONS ][ 0 ].on( "drawend", this.onDrawPolygonsEnd.bind( this ) );
+
+		// Edit
+
+		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( e ) { return e.originalEvent.button === 1; } } ),
+			new ol.interaction.MouseWheelZoom()
+		];
+
+		//this.interactions[ netgis.Modes.MODIFY_FEATURES ][ 0 ].on( "modifyend", this.onModifyFeaturesEnd.bind( this ) );
+
+		this.interactions[ netgis.Modes.DELETE_FEATURES ] =
+		[
+			//new ol.interaction.Select( { layers: [ this.editLayer ], addCondition: ol.events.condition.pointerMove } ),
+			new ol.interaction.DragPan(),
+			new ol.interaction.DragPan( { condition: function( e ) { return e.originalEvent.button === 1; } } ),
+			new ol.interaction.MouseWheelZoom()
+		];
+
+		this.interactions[ netgis.Modes.CUT_FEATURES_DRAW ] =
+		[
+			new ol.interaction.Draw( { type: "Polygon" /*, source: this.editLayer.getSource()*/, style: this.styleSketch.bind( this ) } ),
+			new ol.interaction.DragPan(),
+			new ol.interaction.DragPan( { condition: function( e ) { return e.originalEvent.button === 1; } } ),
+			new ol.interaction.MouseWheelZoom()
+		];
+
+		this.interactions[ netgis.Modes.CUT_FEATURES_DRAW ][ 0 ].on( "drawend", this.onCutFeaturesDrawEnd.bind( this ) );
+	}
+};
+
+netgis.Map.prototype.initConfig = function( config )
+{
+	// TODO: move map view config here?
+	
+	// Map View
+	if ( config[ "map" ][ "bbox" ] )
+	{
+		this.zoomBBox( config[ "map" ][ "bbox" ] );
+	}
+	
+	if ( config[ "map" ][ "zoom" ] )
+	{
+		this.view.setZoom( config[ "map" ][ "zoom" ] );
+	}
+	
+	// Add Active Layers ( Top To Bottom Order )
+	var configLayers = config[ "layers" ];
+	
+	for ( var i = configLayers.length - 1; i >= 0; i-- )
+	{
+		var layer = configLayers[ i ];
+		if ( layer[ "active" ] === true ) this.addLayer( layer[ "id" ], layer );
+	}
+};
+
+netgis.Map.prototype.attachTo = function( parent )
+{
+	parent.appendChild( this.container );
+	
+	parent.addEventListener( netgis.Events.CLIENT_CONTEXT_RESPONSE, this.onClientContextResponse.bind( this ) );
+	parent.addEventListener( netgis.Events.CLIENT_SET_MODE, this.onClientSetMode.bind( this ) );
+	parent.addEventListener( netgis.Events.PANEL_TOGGLE, this.onPanelToggle.bind( this ) );
+	parent.addEventListener( netgis.Events.PANEL_RESIZE, this.onPanelResize.bind( this ) );
+	
+	parent.addEventListener( netgis.Events.MAP_EDIT_LAYER_LOADED, this.onEditLayerLoaded.bind( this ) );
+	
+	parent.addEventListener( netgis.Events.MAP_ZOOM, this.onMapZoom.bind( this ) );
+	parent.addEventListener( netgis.Events.MAP_ZOOM_HOME, this.onMapZoomHome.bind( this ) );
+	parent.addEventListener( netgis.Events.MAP_ZOOM_LONLAT, this.onMapZoomLonLat.bind( this ) );
+	parent.addEventListener( netgis.Events.MAP_ZOOM_SCALE, this.onMapZoomScale.bind( this ) );
+	parent.addEventListener( netgis.Events.MAP_ZOOM_LAYER, this.onMapZoomLayer.bind( this ) );
+	parent.addEventListener( netgis.Events.MAP_ZOOM_LEVEL, this.onMapZoomLevel.bind( this ) );
+	
+	parent.addEventListener( netgis.Events.MAP_LAYER_TOGGLE, this.onMapLayerToggle.bind( this ) );
+	parent.addEventListener( netgis.Events.MAP_LAYER_TRANSPARENCY, this.onMapLayerTransparency.bind( this ) );
+	
+	parent.addEventListener( netgis.Events.MAP_SNAP_TOGGLE, this.onMapSnapToggle.bind( this ) );
+	
+	parent.addEventListener( netgis.Events.MAP_VIEW_PREV, this.onMapViewPrev.bind( this ) );
+	parent.addEventListener( netgis.Events.MAP_VIEW_NEXT, this.onMapViewNext.bind( this ) );
+	
+	parent.addEventListener( netgis.Events.GEOLOCATION_TOGGLE_ACTIVE, this.onGeolocToggleActive.bind( this ) );
+	parent.addEventListener( netgis.Events.GEOLOCATION_CHANGE, this.onGeolocChange.bind( this ) );
+	
+	parent.addEventListener( netgis.Events.MEASURE_CLEAR, this.onMeasureClear.bind( this ) );
+	
+	parent.addEventListener( netgis.Events.SELECT_MULTI_TOGGLE, this.onSelectMultiToggle.bind( this ) );
+	
+	parent.addEventListener( netgis.Events.DRAW_BUFFER_TOGGLE, this.onDrawBufferToggle.bind( this ) );
+	parent.addEventListener( netgis.Events.DRAW_BUFFER_CHANGE, this.onDrawBufferChange.bind( this ) );
+	
+	parent.addEventListener( netgis.Events.BUFFER_CHANGE, this.onBufferChange.bind( this ) );
+	parent.addEventListener( netgis.Events.BUFFER_ACCEPT, this.onBufferAccept.bind( this ) );
+	
+	parent.addEventListener( netgis.Events.IMPORT_LAYER_ACCEPT, this.onImportLayerAccept.bind( this ) );
+	parent.addEventListener( netgis.Events.IMPORT_LAYER_PREVIEW, this.onImportLayerPreview.bind( this ) );
+	parent.addEventListener( netgis.Events.IMPORT_GEOPORTAL_SUBMIT, this.onImportGeoportalSubmit.bind( this ) );
+	
+	parent.addEventListener( netgis.Events.MAP_COPY_FEATURE_TO_EDIT, this.onCopyFeatureToEdit.bind( this ) );
+	
+	//parent.addEventListener( netgis.Events.SEARCHPARCEL_FIELDS_RESPONSE, this.onSearchParcelFieldsResponse.bind( this ) );
+	parent.addEventListener( netgis.Events.SEARCHPARCEL_ITEM_ENTER, this.onSearchParcelItemEnter.bind( this ) );
+	parent.addEventListener( netgis.Events.SEARCHPARCEL_ITEM_LEAVE, this.onSearchParcelItemLeave.bind( this ) );
+	parent.addEventListener( netgis.Events.SEARCHPARCEL_ITEM_CLICK, this.onSearchParcelItemClick.bind( this ) );
+	parent.addEventListener( netgis.Events.SEARCHPARCEL_ITEM_IMPORT, this.onSearchParcelItemImport.bind( this ) );
+	
+	parent.addEventListener( netgis.Events.EXPORT_BEGIN, this.onExportBegin.bind( this ) );
+	
+	parent.addEventListener( netgis.Events.TIMESLIDER_SHOW, this.onTimeSliderShow.bind( this ) );
+	parent.addEventListener( netgis.Events.TIMESLIDER_HIDE, this.onTimeSliderHide.bind( this ) );
+	parent.addEventListener( netgis.Events.TIMESLIDER_SELECT, this.onTimeSliderSelect.bind( this ) );
+};
+
+netgis.Map.prototype.setMode = function( mode )
+{
+	//console.info( "Map Set Mode:", this.mode, "->", mode );
+	
+	// Leave
+	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();
+			break;
+		}
+		
+		case netgis.Modes.BUFFER_FEATURES_DYNAMIC:
+		{
+			this.clearSketchFeatures();
+			this.selectedFeatures = [];
+			this.redrawVectorLayers();
+			break;
+		}
+		
+		case netgis.Modes.CUT_FEATURES:
+		{
+			if ( mode !== netgis.Modes.CUT_FEATURES_DRAW )
+			{
+				this.selectedFeatures = [];
+				this.redrawVectorLayers();
+			}
+			
+			break;
+		}
+		
+		case netgis.Modes.CUT_FEATURES_DRAW:
+		{
+			this.selectedFeatures = [];
+			this.redrawVectorLayers();
+			break;
+		}
+	}
+	
+	this.map.getInteractions().clear();
+	
+	if ( this.mode ) this.container.classList.remove( "netgis-mode-" + this.mode );
+	
+	// Enter
+	var interactions = this.interactions[ mode ];
+	
+	if ( ! interactions )
+	{
+		console.warn( "no interactions found for mode", mode );
+		interactions = this.interactions[ netgis.Modes.VIEW ];
+	}
+	
+	for ( var i = 0; i < interactions.length; i++ )
+	{
+		this.map.addInteraction( interactions[ i ] );
+	}
+	
+	var editable = this.config[ "tools" ] && this.config[ "tools" ][ "editable" ];
+	
+	switch ( mode )
+	{
+		case netgis.Modes.DRAW_POINTS:
+		case netgis.Modes.DRAW_LINES:
+		{
+			if ( editable )
+			{
+				this.setSnapping( this.drawSnapOn );
+				this.onDrawBufferToggle( { detail: { on: this.drawBufferOn, radius: this.drawBufferRadius, segments: this.drawBufferSegments } } );
+			}
+			
+			break;
+		}
+		
+		case netgis.Modes.DRAW_POLYGONS:
+		{
+			if ( editable )
+			{
+				this.setSnapping( this.drawSnapOn );
+			}
+			
+			break;
+		}
+		
+		case netgis.Modes.MODIFY_FEATURES:
+		{
+			if ( editable )
+			{
+				this.setSnapping( this.drawSnapOn );
+				this.editLayer.setStyle( this.styleModify.bind( this ) );
+			}
+			
+			break;
+		}
+	}
+	
+	this.container.classList.add( "netgis-mode-" + mode );
+	
+	this.mode = mode;
+};
+
+netgis.Map.prototype.addLayer = function( id, params )
+{
+	//console.info( "Add Layer:", id, params, this.mode );
+	
+	var layer = this.createLayer( params );
+	
+	if ( layer )
+	{
+		layer.set( "id", id );
+		
+		this.map.addLayer( layer );
+		this.layers[ id ] = layer;
+		
+		if ( params[ "order" ] ) layer.setZIndex( params[ "order" ] );
+		if ( params[ "transparency" ] ) layer.setOpacity( 1.0 - params[ "transparency" ] );
+		if ( params[ "style" ] ) layer.setStyle( this.createStyle( params[ "style" ] ) );
+		if ( params[ "min_zoom" ] ) layer.setMinZoom( params[ "min_zoom" ] - 0.0001 ); // NOTE: subtract small bias because it's exclusive in OL
+		if ( params[ "max_zoom" ] ) layer.setMaxZoom( params[ "max_zoom" ] );
+		
+		if ( layer instanceof ol.layer.Vector ) this.addSnapLayer( layer );
+		
+		if ( params[ "type" ] === netgis.LayerTypes.WMST )
+		{
+			netgis.util.invoke( this.container, netgis.Events.TIMESLIDER_SHOW, { layer: id, title: params[ "title" ], url: params[ "url" ], name: params[ "name" ] } );
+		}
+	}
+	
+	return layer;
+};
+
+netgis.Map.prototype.isLayerQueryable = function( layer )
+{
+	// TODO: refactor with Info.isLayerQueryable ! static method ?
+	
+	var queryable = false;
+	
+	if ( layer[ "query" ] === true )
+	{
+		// Queryable Config Layers
+		queryable = true;
+	}
+	else if ( layer[ "query" ] !== false )
+	{
+		// Default Query Behavior For WMS
+		switch ( layer[ "type" ] )
+		{
+			case netgis.LayerTypes.WMS:
+			case netgis.LayerTypes.WMST:
+			{
+				queryable = true;
+				break;
+			}
+		}
+	}
+	
+	//console.error( "Map Layer Queryable:", layer, queryable );
+	
+	return queryable;
+};
+
+netgis.Map.prototype.getQueryableLayers = function( novectors )
+{
+	var layers = [];
+	
+	for ( var i = 0; i < this.config[ "layers" ].length; i++ )
+	{
+		var params = this.config[ "layers" ][ i ];
+		var layer = this.layers[ params[ "id" ] ];
+		
+		if ( ! layer ) continue;
+		
+		// Exclude Vector Layers
+		if ( novectors && ( layer instanceof ol.layer.Vector ) ) continue;
+		
+		if ( this.isLayerQueryable( params ) ) layers.push( params );
+	}
+	
+	return layers;
+};
+
+netgis.Map.prototype.createLayer = function( params )
+{
+	var layer;
+	
+	switch ( params[ "type" ] )
+	{
+		case netgis.LayerTypes.HIDDEN:
+		{
+			break;
+		}
+		
+		// Raster Layers
+		
+		case netgis.LayerTypes.TMS:
+		case netgis.LayerTypes.XYZ:
+		{
+			layer = this.createLayerTMS( params[ "url" ], params[ "projection" ], params[ "extent" ], params[ "scales" ] );
+			break;
+		}
+		
+		case netgis.LayerTypes.OSM:
+		{
+			layer = this.createLayerTMS( "https://{a-c}.tile.openstreetmap.de/{z}/{x}/{y}.png" );
+			break;
+		}
+		
+		case netgis.LayerTypes.WMTS:
+		{
+			layer = this.createLayerWMTS( params[ "url" ], params[ "name" ] );
+			break;
+		}
+		
+		case netgis.LayerTypes.WMS:
+		{
+			layer = this.createLayerWMS( params[ "url" ], params[ "name" ], params[ "format" ], params[ "tiled" ], params[ "username" ], params[ "password" ] );
+			break;
+		}
+		
+		case netgis.LayerTypes.WMST:
+		{
+			layer = this.createLayerWMST( params[ "url" ], params[ "name" ], params[ "format" ], params[ "tiled" ], params[ "username" ], params[ "password" ] );
+			break;
+		}
+		
+		// Vector Layers
+		
+		case netgis.LayerTypes.GEOJSON:
+		{
+			var data = params[ "data" ];
+			if ( data && netgis.util.isString( data ) ) data = JSON.parse( data );
+			
+			layer = this.createLayerGeoJSON( data ? data : params[ "url" ] );
+			break;
+		}
+		
+		case netgis.LayerTypes.WFS:
+		{
+			layer = this.createLayerWFS( params[ "url" ], params[ "name" ], this.view.getProjection().getCode(), params[ "format" ], params[ "username" ], params[ "password" ] );
+			break;
+		}
+		
+		case netgis.LayerTypes.VTILES:
+		{
+			layer = this.createLayerVectorTiles( params[ "url" ], params[ "extent" ], params[ "min_zoom" ], params[ "max_zoom" ] );
+			break;
+		}
+		
+		case netgis.LayerTypes.GML:
+		{
+			layer = this.createLayerGML( params[ "data" ] );
+			break;
+		}
+		
+		case netgis.LayerTypes.KML:
+		{
+			layer = this.createLayerKML( params[ "url" ] );
+			break;
+		}
+		
+		case netgis.LayerTypes.GEOPACKAGE:
+		{
+			layer = this.createLayerGeoPackage( params[ "data" ] );
+			break;
+		}
+		
+		case netgis.LayerTypes.SPATIALITE:
+		{
+			layer = this.createLayerSpatialite( params[ "data" ] );
+			break;
+		}
+		
+		case netgis.LayerTypes.SHAPEFILE:
+		{
+			layer = this.createLayerShapefile( params[ "data" ] );
+			break;
+		}
+		
+		case netgis.LayerTypes.WKT:
+		{
+			layer = this.createLayerWKT( params[ "data" ] );
+			break;
+		}
+		
+		default:
+		{
+			console.error( "unknown layer type", params[ "type" ] );
+			break;
+		}	
+	}
+	
+	return layer;
+};
+
+netgis.Map.prototype.removeLayer = function( id )
+{
+	//console.info( "Remove Layer:", id );
+	
+	var layer = this.layers[ id ];
+	
+	if ( layer instanceof ol.layer.Vector ) this.removeSnapLayer( layer );
+	
+	for ( var i = 0; i < this.config[ "layers" ].length; i++ )
+	{
+		var params = this.config[ "layers" ][ i ];
+		
+		if ( params[ "id" ] === id )
+		{			
+			// TODO: optimize this (special case for wmst)
+			if ( params[ "type" ] === netgis.LayerTypes.WMST )
+			{
+				netgis.util.invoke( this.container, netgis.Events.TIMESLIDER_HIDE, null );
+			}
+		}
+	}
+	
+	this.map.removeLayer( layer );
+	delete this.layers[ id ];
+};
+
+netgis.Map.prototype.setLayerOrder = function( id, order )
+{
+	var layer = this.layers[ id ];
+	layer.setZIndex( order );
+};
+
+netgis.Map.prototype.createStyle = function( config )
+{
+	var radius = config[ "radius" ] ? config[ "radius" ] : 3.0;
+	var width = config[ "width" ] ? config[ "width" ] : 1.0;
+	var fill = config[ "fill" ] ? config[ "fill" ] : "gray";
+	var stroke = config[ "stroke" ] ? config[ "stroke" ] : "black";
+	
+	var styler = function( feature )
+	{
+		var style =
+		//[
+			// Background
+			/*new ol.style.Style
+			(
+				{
+					image: new ol.style.Circle( { radius: config[ "radius" ], fill: new ol.style.Fill( { color: config[ "stroke" ] } ) } )
+				}
+			),*/
+
+			// Foreground
+			new ol.style.Style
+			(
+				{
+					image: new ol.style.Circle( { radius: radius - width, fill: new ol.style.Fill( { color: fill } ) } ),
+					fill: new ol.style.Fill( { color: fill } ),
+					stroke: new ol.style.Stroke( { color: stroke, width: width } )
+				}
+			);
+		//];
+
+		//if ( label ) style.push( label );
+
+		/*if ( labelConfig && labelConfig.length > 0 )
+		{
+			var str = feature.get( labelConfig );
+			if ( ! str ) str = labelConfig;
+
+			//var str = "Label";
+
+			//var label = new ol.style.Text
+			var label = new ol.style.Style
+			(
+				{
+					text: new ol.style.Text
+					(
+						{
+							text: [ str, "4mm sans-serif" ],
+							font: "4mm Verdana, sans-serif",
+							fill: new ol.style.Fill( { color: "rgba( 0, 0, 0, 1.0 )" } ),
+							backgroundFill: new ol.style.Fill( { color: "rgba( 255, 255, 255, 0.5 )" } ),
+							padding: [ 2, 4, 2, 4 ],
+							overflow: true
+						}
+					)
+				}
+			);
+
+			//classified.setText( label );
+			style.push( label );
+		}*/
+
+		return style;
+	};
+	
+	return styler;
+};
+
+netgis.Map.prototype.styleMeasure = function( feature )
+{
+	var geom = feature.getGeometry();
+	var cfg = this.config[ "measure" ];
+	
+	// Line
+	var style = new ol.style.Style
+	(
+		{
+			fill: new ol.style.Fill( { color: cfg[ "area_fill" ] } ),
+			stroke: new ol.style.Stroke( { color: cfg[ "line_color" ], width: cfg[ "line_width" ], lineDash: cfg[ "line_dash" ] } )
+		}
+	);
+	
+	// Label
+	if ( geom instanceof ol.geom.Polygon )
+	{
+		var area = geom.getArea();
+		
+		style.setText
+		(
+			new ol.style.Text
+			(
+				{
+					text: [ netgis.util.formatArea( area, true ), "4mm sans-serif" ],
+					font: "Arial",
+					fill: new ol.style.Fill( { color: cfg[ "text_color" ] } ),
+					backgroundFill: new ol.style.Fill( { color: cfg[ "text_back" ] } ),
+					padding: [ 2, 4, 2, 4 ],
+					overflow: true
+				}
+			)
+		);
+	}
+	else if ( geom instanceof ol.geom.LineString && ( this.mode === netgis.Modes.MEASURE_LINE || this.mode === netgis.Modes.VIEW ) )
+	{
+		var len = geom.getLength();
+		
+		style.setText
+		(
+			new ol.style.Text
+			(
+				{
+					text: [ netgis.util.formatDistance( len ), "4mm sans-serif" ],
+					font: "Arial",
+					fill: new ol.style.Fill( { color: cfg[ "text_color" ] } ),
+					backgroundFill: new ol.style.Fill( { color: cfg[ "text_back" ] } ),
+					padding: [ 2, 4, 2, 4 ],
+					overflow: true
+				}
+			)
+		);
+	}
+	
+	// Points
+	if ( cfg[ "point_radius" ] && cfg[ "point_radius" ] > 0.0 )
+	{
+		var points = this.getGeometryPoints( feature );
+
+		/*
+		var shadow = new ol.style.Style
+		(
+			{
+				image: new ol.style.Circle( { radius: 5.0, fill: new ol.style.Fill( { color: "rgba( 0, 0, 0, 0.5 )" } ), displacement: [ 0, -1 ] } ),
+				geometry: points
+			}
+		);
+		*/
+
+		var outline = new ol.style.Style
+		(
+			{
+				image: new ol.style.Circle( { radius: cfg[ "point_radius" ] * 1.25, fill: new ol.style.Fill( { color: cfg[ "point_stroke" ] } ) } ),
+				geometry: points
+			}
+		);
+
+		var vertex = new ol.style.Style
+		(
+			{
+				image: new ol.style.Circle( { radius: cfg[ "point_radius" ], fill: new ol.style.Fill( { color: cfg[ "point_fill" ] } ) } ),
+				geometry: points
+			}
+		);
+
+		return [ style, outline, vertex ];
+	}
+	
+	return style;
+};
+
+netgis.Map.prototype.styleEdit = function( feature )
+{
+	var configDraw = this.config[ "styles" ][ "draw" ];
+	var configSelect = this.config[ "styles" ][ "select" ]; // select ?
+	
+	var geom = feature.getGeometry();
+	
+	var selected = ( this.hoverFeature === feature );
+	
+	if ( this.selectedFeatures.indexOf( feature ) > -1 ) selected = true;
+	
+	var radius = selected ? configSelect[ "radius" ] : configDraw[ "radius" ];
+	var fill = selected ? configSelect[ "fill" ] : configDraw[ "fill" ];
+	var stroke = selected ? configSelect[ "stroke" ] : configDraw[ "stroke" ];
+	
+	var style = new ol.style.Style
+	(
+		{
+			image: new ol.style.Circle( { radius: radius, fill: new ol.style.Fill( { color: stroke } ) } ),
+			fill: new ol.style.Fill( { color: fill } ),
+			stroke: new ol.style.Stroke( { color: stroke, width: configDraw[ "width" ] } )
+		}
+	);
+	
+	if ( selected ) style.setZIndex( 1 );
+	
+	// Text Labels
+	if ( geom instanceof ol.geom.Polygon || geom instanceof ol.geom.MultiPolygon )
+	{
+		var area = geom.getArea();
+		
+		if ( ! area || area <= 0 ) return style;
+		
+		// Labels In Viewport
+		if ( configDraw[ "viewport_labels" ] === true )
+		{
+			// NOTE: https://gis.stackexchange.com/questions/320743/openlayers-keep-text-style-label-in-visible-polygon-area
+			
+			var viewExtent = this.view.calculateExtent( this.map.getSize() );
+			var viewGeom = ol.geom.Polygon.fromExtent( viewExtent );
+			
+			var parser = new jsts.io.OL3Parser();
+			
+			var a = parser.read( geom );
+			var b = parser.read( viewGeom );
+			
+			var clip = a.intersection( b );
+			var clipGeom = parser.write( clip );
+			
+			style.setGeometry( clipGeom );
+		}
+		
+		// Label String
+		var str = "";
+		
+		// Simple Feature Titles
+		str = netgis.util.formatArea( area, true );
+		
+		var props = feature.getProperties();
+		var title = props[ "title" ];
+		
+		if ( title ) str = title + "\n" + str;
+		
+		style.setText
+		(
+			new ol.style.Text
+			(
+				{
+					text: str,
+					font: "4mm Arial, sans-serif",
+					fill: new ol.style.Fill( { color: stroke } ),
+					backgroundFill: new ol.style.Fill( { color: "rgba( 255, 255, 255, 0.5 )" } ),
+					padding: [ 2, 4, 2, 4 ]
+				}
+			)
+		);
+		
+	}
+	
+	return style;
+};
+
+netgis.Map.prototype.styleNonEdit = function( feature )
+{
+	// TODO: refactor with edit style
+	
+	var configDraw = this.config[ "styles" ][ "non_edit" ];
+	var configSelect = this.config[ "styles" ][ "select" ]; // select ?
+	
+	var geom = feature.getGeometry();
+	
+	var selected = ( this.hoverFeature === feature );
+	
+	if ( this.selectedFeatures.indexOf( feature ) > -1 ) selected = true;
+	
+	var radius = selected ? configSelect[ "radius" ] : configDraw[ "radius" ];
+	var fill = selected ? configSelect[ "fill" ] : configDraw[ "fill" ];
+	var stroke = selected ? configSelect[ "stroke" ] : configDraw[ "stroke" ];
+	
+	var style = new ol.style.Style
+	(
+		{
+			image: new ol.style.Circle( { radius: radius, fill: new ol.style.Fill( { color: stroke } ) } ),
+			fill: new ol.style.Fill( { color: fill } ),
+			stroke: new ol.style.Stroke( { color: stroke, width: configDraw[ "width" ] } )
+		}
+	);
+	
+	if ( selected ) style.setZIndex( 1 );
+	
+	// Text Labels
+	if ( geom instanceof ol.geom.Polygon )
+	{
+		var area = geom.getArea();
+		
+		if ( ! area || area <= 0 ) return style;
+		
+		// Labels In Viewport
+		if ( configDraw[ "viewport_labels" ] === true )
+		{
+			// NOTE: https://gis.stackexchange.com/questions/320743/openlayers-keep-text-style-label-in-visible-polygon-area
+			
+			var viewExtent = this.map.getView().calculateExtent( this.map.getSize() );
+			var viewGeom = ol.geom.Polygon.fromExtent( viewExtent );
+			
+			var parser = new jsts.io.OL3Parser();
+			
+			var a = parser.read( geom );
+			var b = parser.read( viewGeom );
+			
+			var clip = a.intersection( b );
+			var clipGeom = parser.write( clip );
+			
+			style.setGeometry( clipGeom );
+		}
+		
+		// Label String
+		var str = "";
+		
+		// Simple Feature Titles
+		str = netgis.util.formatArea( area, true );
+		
+		var props = feature.getProperties();
+		var title = props[ "title" ];
+		
+		if ( title ) str = title + "\n" + str;
+		
+		/*
+		// TODO: fully implement label templates
+		
+		var template = configDraw[ "labels" ];
+		
+		if ( template )
+		{
+			str = template;
+			str = netgis.util.replace( str, "{area}", netgis.util.formatArea( area, true ) );
+			
+			var props = feature.getProperties();
+			
+			for ( var k in props )
+			{
+				var v = props[ k ];
+				
+				// TODO: not executed if feature doesn't have key
+				if ( ( ! v ) || ( v === null ) ) v = "";
+				
+				str = netgis.util.replace( str, "{" + k + "}", v );
+			}
+		}
+		else
+		{
+			str = netgis.util.formatArea( area, true );
+		}
+		*/
+		
+		style.setText
+		(
+			new ol.style.Text
+			(
+				{
+					text: str,
+					font: "4mm Arial, sans-serif",
+					fill: new ol.style.Fill( { color: stroke } ),
+					backgroundFill: new ol.style.Fill( { color: "rgba( 255, 255, 255, 0.5 )" } ),
+					padding: [ 2, 4, 2, 4 ]
+				}
+			)
+		);
+		
+	}
+	
+	return style;
+};
+
+netgis.Map.prototype.styleSketch = function( feature )
+{	
+	var config = this.config[ "styles" ][ this.drawError ? "error" : "sketch" ];
+	
+	var geom = feature.getGeometry();
+	
+	var style = new ol.style.Style
+	(
+		{
+			image: new ol.style.Circle( { radius: config[ "radius" ], fill: new ol.style.Fill( { color: config[ "fill" ] } ) } ),
+			fill: new ol.style.Fill( { color: config[ "fill" ] } ),
+			stroke: new ol.style.Stroke( { color: config[ "stroke" ], width: config[ "width" ] } )
+		}
+	);
+	
+	if ( geom instanceof ol.geom.Polygon )
+	{
+		var area = geom.getArea();
+		
+		style.setText
+		(
+			new ol.style.Text
+			(
+				{
+					text: [ netgis.util.formatArea( area, true ), "4mm sans-serif" ],
+					font: "Arial",
+					fill: new ol.style.Fill( { color: config[ "stroke" ] } ),
+					backgroundFill: new ol.style.Fill( { color: "rgba( 255, 255, 255, 0.5 )" } ),
+					padding: [ 2, 4, 2, 4 ]
+				}
+			)
+		);
+	}
+	
+	var vertex = new ol.style.Style
+	(
+		{
+			image: new ol.style.Circle( { radius: config[ "radius" ], fill: new ol.style.Fill( { color: config[ "stroke" ] } ) } ),
+			geometry: this.getGeometryPoints( feature )
+		}
+	);
+	
+	return [ style, vertex ];
+};
+
+netgis.Map.prototype.styleModify = function( feature )
+{
+	var config = this.config[ "styles" ][ "modify" ];
+	
+	var style = new ol.style.Style
+	(
+		{
+			image: new ol.style.Circle( { radius: config[ "radius" ], fill: new ol.style.Fill( { color: config[ "stroke" ] } ) } ),
+			fill: new ol.style.Fill( { color: config[ "fill" ] } ),
+			stroke: new ol.style.Stroke( { color: config[ "stroke" ], width: config[ "width" ] } )
+		}
+	);
+	
+	var vertex = new ol.style.Style
+	(
+		{
+			image: new ol.style.Circle( { radius: config[ "radius" ], fill: new ol.style.Fill( { color: config[ "stroke" ] } ) } ),
+			geometry: this.getGeometryPoints( feature )
+		}
+	);
+	
+	var geom = feature.getGeometry();
+	
+	if ( geom instanceof ol.geom.Polygon )
+	{
+		var area = geom.getArea();
+		
+		style.setText
+		(
+			new ol.style.Text
+			(
+				{
+					text: [ netgis.util.formatArea( area, true ), "4mm sans-serif" ],
+					font: "Arial",
+					fill: new ol.style.Fill( { color: config[ "stroke" ] } ),
+					backgroundFill: new ol.style.Fill( { color: "rgba( 255, 255, 255, 0.5 )" } ),
+					padding: [ 2, 4, 2, 4 ]
+				}
+			)
+		);
+	}
+	
+	return [ style, vertex ];
+};
+
+netgis.Map.prototype.styleHover = function( feature )
+{
+	/*
+	this.hoverStyle = this.createStyle( configSelect[ "fill" ], configSelect[ "stroke" ], configSelect[ "width" ] );
+	this.hoverStyle.setZIndex( 1 );
+	*/
+   
+	/*
+	var config = this.config[ "styles" ][ "select" ];
+	
+	console.info( "Style Hover:", feature, config );
+   
+	var style = this.createStyle( config[ "fill" ], config[ "stroke" ], config[ "width" ] );
+	////style.setZIndex( 1 );
+	
+	return style;
+	*/
+	
+	var config = this.config[ "styles" ][ "select" ];
+	
+	var style = new ol.style.Style
+	(
+		{
+			image: new ol.style.Circle( { radius: config[ "radius" ], fill: new ol.style.Fill( { color: config[ "stroke" ] } ) } ),
+			fill: new ol.style.Fill( { color: config[ "fill" ] } ),
+			stroke: new ol.style.Stroke( { color: config[ "stroke" ], width: config[ "width" ] } ),
+			zIndex: 1
+		}
+	);
+	
+	/*var vertex = new ol.style.Style
+	(
+		{
+			image: new ol.style.Circle( { radius: config[ "radius" ], fill: new ol.style.Fill( { color: config[ "stroke" ] } ) } ),
+			geometry: this.getGeometryPoints( feature )
+		}
+	);*/
+	
+	//return [ style, vertex ];
+	
+	return style;
+};
+
+netgis.Map.prototype.getGeometryPoints = function( feature )
+{
+	var geometry = feature.getGeometry();
+
+	if ( geometry instanceof ol.geom.LineString )
+	{
+		return new ol.geom.MultiPoint( geometry.getCoordinates() );
+	}
+	else if ( geometry instanceof ol.geom.Polygon )
+	{
+		//return new ol.geom.MultiPoint( geometry.getCoordinates()[ 0 ] );
+
+		var points = [];
+		var geomCoords = geometry.getCoordinates();
+
+		for ( var g = 0; g < geomCoords.length; g++ )
+		{
+			var coords = geomCoords[ g ];
+
+			for ( var c = 0; c < coords.length; c++ )
+				points.push( coords[ c ] );
+		}
+
+		return new ol.geom.MultiPoint( points );
+	}
+	else if ( geometry instanceof ol.geom.MultiPolygon )
+	{
+		var points = [];
+		var polys = geometry.getPolygons();
+		
+		for ( var l = 0; l < polys.length; l++ )
+		{
+			var geomCoords = polys[ l ].getCoordinates();
+
+			for ( var g = 0; g < geomCoords.length; g++ )
+			{
+				var coords = geomCoords[ g ];
+
+				for ( var c = 0; c < coords.length; c++ )
+					points.push( coords[ c ] );
+			}
+		}
+		
+		return new ol.geom.MultiPoint( points );
+	}
+	else if ( geometry instanceof ol.geom.MultiLineString )
+	{
+		var points = [];
+		var lines = geometry.getPolygons();
+		
+		for ( var l = 0; l < lines.length; l++ )
+		{
+			var geomCoords = lines[ l ].getCoordinates();
+
+			for ( var g = 0; g < geomCoords.length; g++ )
+			{
+				var coords = geomCoords[ g ];
+
+				for ( var c = 0; c < coords.length; c++ )
+					points.push( coords[ c ] );
+			}
+		}
+		
+		return new ol.geom.MultiPoint( points );
+	}
+	
+	return geometry;
+};
+
+netgis.Map.prototype.redrawVectorLayers = function()
+{
+	// Force Layer Redraw
+	this.map.getLayers().forEach
+	(		
+		function( layer, i, arr )
+		{
+			if ( layer instanceof ol.layer.Vector || layer instanceof ol.layer.VectorTile )
+			{
+				layer.setStyle( layer.getStyle() );
+			}
+		}
+	);
+};
+
+netgis.Map.prototype.setSnapping = function( on )
+{
+	var config = this.config[ "tools" ][ "snapping" ];
+	
+	if ( on )
+	{
+		this.snap = new ol.interaction.Snap( { features: this.snapFeatures, pixelTolerance: config[ "tolerance" ] ? config[ "tolerance" ] : 10 } );
+		this.map.addInteraction( this.snap );
+
+		this.snapFeatures.changed();
+	}
+	else
+	{
+		if ( this.snap )
+		{
+			this.map.removeInteraction( this.snap );
+			this.snap = null;
+		}
+	}
+	
+	this.drawSnapOn = on;
+};
+
+netgis.Map.prototype.setDrawTrace = function( on )
+{
+	
+};
+
+netgis.Map.prototype.addSnapLayer = function( vectorLayer )
+{	
+	var layerFeatures = vectorLayer.getSource().getFeatures();
+			
+	for ( var j = 0; j < layerFeatures.length; j++ )
+	{
+		this.snapFeatures.push( layerFeatures[ j ] );
+	}
+};
+
+netgis.Map.prototype.removeSnapLayer = function( vectorLayer )
+{
+	var layerFeatures = vectorLayer.getSource().getFeatures();
+			
+	for ( var j = 0; j < layerFeatures.length; j++ )
+	{
+		this.snapFeatures.remove( layerFeatures[ j ] );
+	}
+};
+
+netgis.Map.prototype.setDrawBuffer = function( on, radius, segments )
+{
+	//console.info( "DRAW BUFFER:", on, radius, segments );
+	
+	if ( on )
+	{
+		var feature = this.createBufferFeature( new ol.geom.Point( this.view.getCenter() ), radius, segments );
+		this.previewLayer.getSource().addFeature( feature );
+		
+		this.drawBufferRadius = radius;
+		this.drawBufferSegments = segments;
+	}
+	else
+	{
+		this.previewLayer.getSource().clear();
+	}
+	
+	this.drawBufferOn = on;
+};
+
+netgis.Map.prototype.createLayerTMS = function( url, projection, extent, scales )
+{
+	var layer;
+	
+	if ( projection && extent && scales )
+	{
+		// Custom Tile Grid
+		var resolutions = [];
+		scales = ( scales === "map" ) ? this.config[ "map" ][ "scales" ] : scales;
+		extent = ( extent === "map" ) ? this.config[ "map" ][ "extent" ] : extent;
+
+		for ( var s = 0; s < scales.length; s++ )
+			resolutions.unshift( this.getResolutionFromScale( scales[ s ] ) );
+		
+		var source = new ol.source.TileImage
+		(
+			{
+				crossOrigin:	null,
+				projection:		this.view.getProjection(),
+				tileGrid:		new ol.tilegrid.TileGrid
+				(
+					{
+						extent: extent,
+						origin: [ extent[ 0 ], extent[ 1 ] ],
+						resolutions: resolutions
+					}
+				),
+				tileUrlFunction: function( zxy )
+				{
+					if ( zxy === null ) return undefined;
+					
+					var tileURL = url;
+					tileURL = netgis.util.replace( tileURL, "{z}", zxy[ 0 ] );
+					tileURL = netgis.util.replace( tileURL, "{x}", zxy[ 1 ] );
+					tileURL = netgis.util.replace( tileURL, "{y}", zxy[ 2 ] );
+					tileURL = netgis.util.replace( tileURL, "{-y}", -zxy[ 2 ] - 1 );
+
+					return tileURL;
+				}
+			}
+		);
+
+		layer = new ol.layer.Tile
+		(
+			{
+				source:	source
+			}
+		);
+	}
+	else
+	{
+		// Default Tile Grid
+		layer = new ol.layer.Tile
+		(
+			{
+				source: new ol.source.XYZ
+				(
+					{
+						url: url,
+						crossOrigin: "anonymous"
+					}
+				)
+			}
+		);
+	}
+	
+	return layer;
+};
+
+netgis.Map.prototype.createLayerWMS = function( url, layerName, format, tiled, user, password )
+{
+	var params =
+	{
+		url: url,
+		params:
+		{
+			"LAYERS":		layerName,
+			"FORMAT":		format ? format : "image/png",
+			"TRANSPARENT":	"true"
+			//"VERSION":		"1.1.1"
+		},
+		
+		// TODO: how to pass more custom WMS params from config ? json object ?
+		
+		/*serverType: "mapserver",
+		crossOrigin: "anonymous",*/ // TODO: causes cors errors after requests, why?
+		hidpi: false
+		//ratio: 3.0
+	};
+
+	// User Auth
+	if ( user && password )
+	{
+		params.imageLoadFunction = function( image, src )
+		{
+			var request = new XMLHttpRequest();
+			request.open( "GET", src );
+			request.setRequestHeader( "Authorization", "Basic " + window.btoa( user + ":" + password ) );
+
+			request.onload = function()
+			{
+				image.getImage().src = src;
+			};
+
+			request.send();
+		};
+	}
+	
+	var source;
+	var layer;
+
+	if ( tiled )
+	{
+		source = new ol.source.TileWMS( params );
+		layer = new ol.layer.Tile( { source: source } );
+	}
+	else
+	{
+		source = new ol.source.ImageWMS( params );
+		layer = new ol.layer.Image( { source: source } );
+	}
+	
+	return layer;
+};
+
+netgis.Map.prototype.createLayerWMST = function( url, layerName, format, tiled, user, password )
+{	
+	var params =
+	{
+		url: url,
+		params:
+		{
+			"LAYERS":		layerName,
+			"FORMAT":		format ? format : "image/png",
+			"TRANSPARENT":	"true",
+			"VERSION":		"1.1.1"
+		},
+		/*serverType: "mapserver",
+		crossOrigin: "anonymous",*/ // TODO: causes cors errors after requests, why?
+		hidpi: false
+		//ratio: 3.0
+	};
+
+	// User Auth
+	if ( user && password )
+	{
+		params.imageLoadFunction = function( image, src )
+		{
+			var request = new XMLHttpRequest();
+			request.open( "GET", src );
+			request.setRequestHeader( "Authorization", "Basic " + window.btoa( user + ":" + password ) );
+
+			request.onload = function()
+			{
+				image.getImage().src = src;
+			};
+
+			request.send();
+		};
+	}
+	
+	var source;
+	var layer;
+
+	if ( tiled )
+	{
+		source = new ol.source.TileWMS( params );
+		layer = new ol.layer.Tile( { source: source } );
+	}
+	else
+	{
+		source = new ol.source.ImageWMS( params );
+		layer = new ol.layer.Image( { source: source } );
+	}
+	
+	return layer;
+};
+
+netgis.Map.prototype.createLayerWMTS = function( url )
+{
+	//console.info( "WMTS:", url );
+	
+	var resolutions = [];
+	var scales = this.client.config[ "map" ][ "scales" ]; //netgis.config.MAP_SCALES;
+	var extent = this.client.config[ "map" ][ "extent" ];
+
+	for ( var s = 0; s < scales.length; s++ )
+		resolutions.unshift( this.getResolutionFromScale( scales[ s ] ) );
+
+	var source = new ol.source.TileImage
+	(
+		{
+			crossOrigin:	null,
+			projection:		this.view.getProjection(),
+			tileGrid:		new ol.tilegrid.TileGrid
+			(
+				{
+					extent: extent,
+					origin: [ extent[ 0 ], extent[ 1 ] ],
+					resolutions: resolutions
+				}
+			),
+			tileUrlFunction: function( zxy )
+			{
+				if ( zxy === null ) return undefined;
+				
+				var tileURL = url;
+				tileURL = netgis.util.replace( tileURL, "{z}", zxy[ 0 ] );
+				tileURL = netgis.util.replace( tileURL, "{x}", zxy[ 1 ] );
+				tileURL = netgis.util.replace( tileURL, "{y}", zxy[ 2 ] );
+				tileURL = netgis.util.replace( tileURL, "{-y}", -zxy[ 2 ] );
+				
+				return tileURL;
+			}
+		}
+	);
+
+	var layer = new ol.layer.Tile
+	(
+		{
+			source:	source
+		}
+	);
+	
+	return layer;
+};
+
+netgis.Map.prototype.createLayerWMTS_01 = function( url, layerName )
+{
+	var projection = this.view.getProjection(); //ol.proj.get('EPSG:25832'); //3857 //4326 //900913 EPSG:25832
+	var projectionExtent = projection.getExtent();
+	var size = ol.extent.getWidth( projectionExtent ) / 256;
+	var resolutions = new Array( 14 );
+	var matrixIds = new Array( 14 );
+	for ( var z = 0; z < 14; ++z )
+	{
+		// generate resolutions and matrixIds arrays for this WMTS
+		resolutions[ z ] = size / Math.pow( 2, z );
+		matrixIds[ z ] = z;
+	}
+
+	source = new ol.source.WMTS
+	(
+		{
+			url: url,
+			params:
+			{
+				"LAYER":		layerName,
+				"FORMAT":		"image/png",
+				"TRANSPARENT":	"true",
+				"VERSION":		"1.1.1"
+			},
+			layer: layerName,
+			//format: 'image/png',
+			format: "image/jpeg",
+			matrixSet: "UTM32", //'g',
+			tileGrid: new ol.tilegrid.WMTS
+			(
+				{
+					origin: ol.extent.getTopLeft( projectionExtent ),
+					resolutions: resolutions,
+					matrixIds: matrixIds
+				}
+			)
+		}
+	);
+};
+
+netgis.Map.prototype.createLayerGeoJSON = function( dataOrURL )
+{
+	if ( netgis.util.isObject( dataOrURL ) )
+	{
+		// Direct Object Import
+		var format = new ol.format.GeoJSON();
+		var projection = format.readProjection( dataOrURL );
+		var features = format.readFeatures( dataOrURL, { featureProjection: this.view.getProjection() } );
+
+		// NOTE: proj4.defs[ "EPSG:4326" ]
+		// NOTE: netgis.util.foreach( proj4.defs, function( k,v ) { console.info( "DEF:", k, v ); } )
+
+		var projcode = projection.getCode();
+
+		switch ( projcode )
+		{
+			case "EPSG:3857":
+			case "EPSG:4326":
+			case this.view.getProjection().getCode():
+			{
+				// Projection OK
+				break;
+			}
+
+			default:
+			{
+				// Projection Not Supported
+				console.warn( "unsupported import projection '" + projcode + "'" );
+				break;
+			}
+		}	
+
+		////this.addImportedFeatures( features );
+
+		var layer = new ol.layer.Vector
+		(
+			{
+				source: new ol.source.Vector( { features: features /*, projection: this.view.getProjection().getCode()*/ } )
+				//style: this.styleParcel.bind( this ),
+				//zIndex: this.editLayerID + 20
+			}
+		);
+
+		return layer;
+	}
+	else if ( netgis.util.isString( dataOrURL ) )
+	{
+		// Request From URL
+		var layer = new ol.layer.Vector
+		(
+			{
+				source: new ol.source.Vector( { features: [] } )
+			}
+		);
+
+		var self = this;
+		
+		netgis.util.request
+		(
+			dataOrURL,
+			function( response )
+			{
+				var json = JSON.parse( response );
+				var responseLayer = self.createLayerGeoJSON( json );
+				layer.getSource().addFeatures( responseLayer.getSource().getFeatures() );
+			}
+		);
+
+		return layer;
+	}
+};
+
+netgis.Map.prototype.createLayerGML = function( data )
+{	
+	//NOTE: https://stackoverflow.com/questions/35935184/opening-qgis-exported-gml-in-openlayers-3
+	//NOTE: https://github.com/openlayers/openlayers/issues/5023
+	
+	console.warn( "GML support is experimental!" );
+
+	var features = [];
+	
+	var parser = new DOMParser();
+	var xml = parser.parseFromString( data, "text/xml" );
+	
+	// Features
+	var featureMembers = xml.getElementsByTagName( "gml:featureMember" );
+	
+	for ( var f = 0; f < featureMembers.length; f++ )
+	{
+		var props = {};
+		
+		var node = featureMembers[ f ];
+		var child = node.children[ 0 ];
+		
+		// Attributes
+		for ( var a = 0; a < child.attributes.length; a++ )
+		{
+			var attribute = child.attributes[ a ];
+			props[ attribute.nodeName ] = attribute.nodeValue;
+		}
+		
+		for ( var c = 0; c < child.children.length; c++ )
+		{
+			var childNode = child.children[ c ];
+			
+			if ( childNode.nodeName === "ogr:geometryProperty" ) continue;
+			
+			var parts = childNode.nodeName.split( ":" );
+			var k = parts[ parts.length - 1 ];
+			var v = childNode.innerHTML;
+			
+			props[ k ] = v;
+		}
+		
+		// Geometry
+		var geomprop = child.getElementsByTagName( "ogr:geometryProperty" )[ 0 ];
+		
+		//for ( var g = 0; g < geomprop.children.length; g++ )
+		{
+			var geom = geomprop.children[ 0 ];
+			var proj = geom.getAttribute( "srsName" );
+			
+			if ( proj && proj !== "EPSG:4326" && proj !== this.projection )
+				console.warn( "unsupported import projection:", proj );
+			
+			switch ( geom.nodeName )
+			{
+				case "gml:Polygon":
+				{
+					props[ "geometry" ] = this.gmlParsePolygon( geom, proj );
+					break;
+				}
+				
+				case "gml:MultiPolygon":
+				{
+					props[ "geometry" ] = this.gmlParseMultiPolygon( geom, proj );
+					break;
+				}
+			}
+		}
+		
+		var feature = new ol.Feature( props );
+		features.push( feature );
+	}
+	
+	////this.addImportedFeatures( features );
+	
+	var layer = new ol.layer.Vector
+	(
+		{
+			source: new ol.source.Vector( { features: features } )
+		}
+	);
+	
+	return layer;
+};
+
+netgis.Map.prototype.gmlParsePolygon = function( node, proj )
+{
+	var rings = [];
+	
+	var linearRings = node.getElementsByTagName( "gml:LinearRing" );
+	
+	for ( var r = 0; r < linearRings.length; r++ )
+	{
+		var ring = linearRings[ r ];
+		var coords = ring.getElementsByTagName( "gml:coordinates" )[ 0 ].innerHTML;
+		rings.push( this.gmlParseCoordinates( coords, proj ) );
+	}
+	
+	return new ol.geom.Polygon( rings );
+};
+
+netgis.Map.prototype.gmlParseMultiPolygon = function( node, proj )
+{
+	var polygons = [];
+					
+	var polygonMembers = node.getElementsByTagName( "gml:polygonMember" );
+
+	for ( var p = 0; p < polygonMembers.length; p++ )
+	{
+		var polygonMember = polygonMembers[ p ];
+		var polygonNode = polygonMember.getElementsByTagName( "gml:Polygon" )[ 0 ];
+		polygons.push( this.gmlParsePolygon( polygonNode, proj ) );
+	}
+	
+	return new ol.geom.MultiPolygon( polygons );
+};
+
+netgis.Map.prototype.gmlParseCoordinates = function( s, proj )
+{
+	var coords = s.split( " " );
+						
+	for ( var c = 0; c < coords.length; c++ )
+	{
+		// Split
+		coords[ c ] = coords[ c ].split( "," );
+
+		// Parse
+		for ( var xy = 0; xy < coords[ c ].length; xy++ )
+		{
+			coords[ c ][ xy ] = Number.parseFloat( coords[ c ][ xy ] );
+		}
+		
+		// Transform
+		if ( proj ) coords[ c ] = ol.proj.transform( coords[ c ], proj, this.view.getProjection() );
+	}
+	
+	return coords;
+};
+
+netgis.Map.prototype.createLayerGeoPackage = function( data )
+{
+	var layer = new ol.layer.Vector
+	(
+		{
+			source: new ol.source.Vector( { features: [] } )
+		}
+	);
+	
+	var self = this;
+	var arr = new Uint8Array( data );
+	
+	window.GeoPackage.setSqljsWasmLocateFile( function( file ) { return self.config[ "import" ][ "geopackage_lib" ] + file; } );
+	
+	window.GeoPackage.GeoPackageAPI.open( arr ).then
+	(
+		function( geoPackage )
+		{
+			var features = [];
+			var format = new ol.format.GeoJSON();
+			var tables = geoPackage.getFeatureTables();
+
+			for ( var t = 0; t < tables.length; t++ )
+			{
+				var table = tables[ t ];
+				var rows = geoPackage.queryForGeoJSONFeaturesInTable( table );
+
+				for ( var r = 0; r < rows.length; r++ )
+				{
+					var row = rows[ r ];
+					var geom = format.readGeometry( row.geometry, { featureProjection: self.view.getProjection() } );
+					var feature = new ol.Feature( { geometry: geom } );
+					features.push( feature );
+				}
+			}
+
+			////self.addImportedFeatures( features );
+			layer.getSource().addFeatures( features );
+		}
+	);
+	
+	return layer;
+};
+
+netgis.Map.prototype.createLayerSpatialite = function( data )
+{
+	var layer = new ol.layer.Vector
+	(
+		{
+			source: new ol.source.Vector( { features: [] } )
+		}
+	);
+	
+	var self = this;
+	
+	window.initSqlJs().then
+	(
+		function( SQL )
+		{
+			var features = [];
+			
+			var arr = new Uint8Array( data );
+			var db = new SQL.Database( arr );
+			
+			// Tables
+			var results = db.exec
+			(
+				"SELECT name FROM sqlite_schema WHERE type = 'table' \n\
+					AND name NOT LIKE 'sqlite_%' \n\
+					AND name NOT LIKE 'sql_%' \n\
+					AND name NOT LIKE 'idx_%' \n\
+					AND name NOT LIKE 'spatial_ref_sys%' \n\
+					AND name NOT LIKE 'spatialite_%' \n\
+					AND name NOT LIKE 'geometry_columns%' \n\
+					AND name NOT LIKE 'views_%' \n\
+					AND name NOT LIKE 'virts_%' \n\
+					AND name NOT LIKE 'SpatialIndex' \n\
+					AND name NOT LIKE 'KNN%' \n\
+					AND name NOT LIKE 'ElementaryGeometries' \n\
+				;" );
+			
+			var tables = results[ 0 ].values;
+			
+			for ( var t = 0; t < tables.length; t++ )
+			{
+				var table = tables[ t ][ 0 ];
+
+				results = db.exec( "SELECT * FROM " + table );
+				var result = results[ 0 ];
+
+				// Columns
+				var geomcol = null;
+
+				for ( var c = 0; c < result.columns.length; c++ )
+				{
+					if ( result.columns[ c ].toLowerCase() === "geometry" ) { geomcol = c; break; }
+					if ( result.columns[ c ].toLowerCase() === "geom" ) { geomcol = c; break; }
+				}
+				
+				if ( geomcol === null ) continue;
+
+				// Rows
+				var rows = result.values;
+
+				for ( var r = 0; r < rows.length; r++ )
+				{
+					var row = rows[ r ];
+					
+					// Convert WKB
+					var input = row[ geomcol ];
+					var output = new Uint8Array( input.length - 43 - 1 + 5 );
+
+					// Byte Order
+					output[ 0 ] = input[ 1 ];
+
+					// Type
+					output[ 1 ] = input[ 39 ];
+					output[ 2 ] = input[ 40 ];
+					output[ 3 ] = input[ 41 ];
+					output[ 4 ] = input[ 42 ];
+
+					// Geometry
+					var geomlen = input.length - 43 - 1;
+
+					for ( var i = 0; i < geomlen; i++ )
+					{
+						output[ 5 + i ] = input[ 43 + i ];
+					}
+
+					var wkb = new ol.format.WKB();
+					var geom = wkb.readGeometry( output, { featureProjection: self.view.getProjection() } );
+
+					features.push( new ol.Feature( { geometry: geom } ) );
+				}
+			}
+			
+			////self.addImportedFeatures( features );
+			
+			layer.getSource().addFeatures( features );
+		}
+	);
+	
+	return layer;
+};
+
+netgis.Map.prototype.createLayerShapefile = function( data )
+{
+	var layer = new ol.layer.Vector
+	(
+		{
+			source: new ol.source.Vector( { features: [] } )
+		}
+	);
+	
+	var self = this;
+	
+	shp( data ).then
+	(
+		function( geojson )
+		{			
+			//var format = new ol.format.GeoJSON( { dataProjection: "EPSG:4326", featureProjection: "EPSG:3857" } );
+			var format = new ol.format.GeoJSON();
+			var projection = format.readProjection( geojson );
+			var features = format.readFeatures( geojson, { featureProjection: self.view.getProjection() } );
+			
+			layer.getSource().addFeatures( features );
+			
+			////self.addImportedFeatures( features );
+		}
+	);
+	
+	return layer;
+};
+
+netgis.Map.prototype.createLayerWKT = function( data )
+{
+	var format = new ol.format.WKT();
+	var features = [];
+	
+	// TODO: check if data is array or single wkt string
+	
+	for ( var i = 0; i < data.length; i++ )
+	{
+		var item = data[ i ];
+		var geom = format.readGeometry( item[ "geometry" ] );
+		
+		var props = item[ "properties" ];
+		props[ "geometry" ] = geom;
+		props[ "wkt" ] = item[ "geometry" ];
+		
+		var feature = new ol.Feature( props );
+		feature.setId( item[ "id" ] );
+		features.push( feature );
+	}
+	
+	var layer = new ol.layer.Vector( { source: new ol.source.Vector( { features: features } ) } );
+	
+	return layer;
+};
+
+netgis.Map.prototype.createLayerWFS = function( url, typeName, projection, format, user, password )
+{
+	if ( url[ url.length - 1 ] !== "?" ) url = url + "?";
+	
+	url = url
+			+ "service=WFS"
+			+ "&version=1.1.0"
+			+ "&request=GetFeature";
+
+	// TODO: always get projection from map view ?
+	
+	if ( ! projection )
+		projection = this.view.getProjection().getCode();
+	
+	if ( ! format )
+		format = "application/json";
+	else
+		format = netgis.util.replace( format, " ", "+" ); // TODO: encode uri component ?
+
+	var source = new ol.source.Vector
+	(
+		{
+			format: new ol.format.GeoJSON(),
+			strategy: ol.loadingstrategy.bbox,
+			
+			loader: function( extent, resolution, proj, success, failure )
+			{
+				//proj = proj.getCode();
+				
+				var requestURL = url
+					+ "&typename=" + typeName
+					+ "&srsname=" + projection
+					+ "&bbox=" + extent.join( "," ) + "," + projection
+					+ "&outputFormat=" + format;
+				
+				var request = new XMLHttpRequest();
+				request.open( "GET", requestURL );
+				
+				if ( user && password )
+				{
+					request.setRequestHeader( "Authorization", "Basic " + window.btoa( user + ":" + password ) );
+				}
+				
+				request.onerror = function()
+				{
+					console.error( "WFS request error" );
+					failure();
+				};
+				
+				request.onload = function()
+				{
+					if ( request.status === 200 )
+					{
+						source.clear();
+						
+						var features = source.getFormat().readFeatures( request.responseText );
+						source.addFeatures( features );
+						success( features );
+					}
+					else
+					{
+						console.error( "WFS request status", request.status );
+						failure();
+					}
+				};
+				
+				request.send();
+			}
+		}
+	);
+
+	var layer = new ol.layer.Vector
+	(
+		{
+			source: source
+		}
+	);
+
+	// TODO: properly handle snap vector sources
+	var self = this;
+	source.on( "featuresloadstart", function( e ) { self.removeSnapLayer( layer ); } );
+	source.on( "featuresloadend", function( e ) { window.setTimeout( function() { self.addSnapLayer( layer ); }, 10 ); } );
+	//source.on( "featuresloaderror", function( e ) { console.info( "Layer Error:", e ); } );
+	
+	return layer;
+};
+
+netgis.Map.prototype.createLayerVectorTiles = function( url, extent, minZoom, maxZoom )
+{
+	// NOTE: https://github.com/openlayers/openlayers/issues/13592 (vector tiles layer extent)
+	// NOTE: https://stackoverflow.com/questions/44907234/how-to-set-an-extent-to-a-vectortile-layer-in-openlayers-4-2-0
+	
+	var layer = new ol.layer.VectorTile
+	(
+		{
+			extent: extent,
+			source: new ol.source.VectorTile
+			(
+				{
+					format: new ol.format.MVT(),
+					overlaps: true,
+					url: url,
+					//extent: extent, // TODO: crashes!
+					minZoom: minZoom,
+					maxZoom: maxZoom
+				}
+			)
+		}
+	);
+	
+	return layer;
+};
+
+netgis.Map.prototype.createLayerKML = function( url )
+{
+	var layer = new ol.layer.Vector( { source: new ol.source.Vector( { features: [] } ) } );
+	var self = this;
+	
+	// TODO: optional parse kml data string instead of url
+	
+	netgis.util.request
+	(
+		url,
+		function( data )
+		{			
+			var format = new ol.format.KML();
+			var features = format.readFeatures( data, { featureProjection: self.view.getProjection() } );
+			
+			for ( var i = 0; i < features.length; i++ )
+			{
+				var feature = features[ i ];
+				var props = feature.getProperties();
+				
+				var styleprops = { fill: "rgba( 127, 127, 127, 0.5 )", stroke: "rgba( 127, 127, 127, 1.0 )", radius: 5.0, width: 3.0 };
+				
+				for ( var key in props )
+				{
+					var val = props[ key ];
+					
+					switch ( key )
+					{
+						case "fill": { styleprops[ "fill" ] = val; break; }
+						case "fill-opacity": { styleprops[ "fill-opacity" ] = val; break; }
+						case "stroke": { styleprops[ "stroke" ] = val; break; }
+						case "stroke-opacity": { styleprops[ "stroke-opacity" ] = val; break; }
+						case "stroke-width": { styleprops[ "width" ] = val; break; }
+					}
+				}
+				
+				if ( styleprops[ "fill-opacity" ] )
+				{
+					var color = netgis.util.hexToRGB( styleprops[ "fill" ] );
+					color = "rgba(" + color.join( "," ) + "," + styleprops[ "fill-opacity" ] + ")";
+					styleprops[ "fill" ] = color;
+				}
+				
+				if ( styleprops[ "stroke-opacity" ] )
+				{
+					var color = netgis.util.hexToRGB( styleprops[ "stroke" ] );
+					color = "rgba(" + color.join( "," ) + "," + styleprops[ "stroke-opacity" ] + ")";
+					styleprops[ "stroke" ] = color;
+				}
+				
+				var style = new ol.style.Style
+				(
+					{
+						image: new ol.style.Circle( { radius: styleprops[ "radius" ], fill: new ol.style.Fill( { color: styleprops[ "stroke" ] } ) } ),
+						fill: new ol.style.Fill( { color: styleprops[ "fill" ] } ),
+						stroke: new ol.style.Stroke( { color: styleprops[ "stroke" ], width: styleprops[ "width" ] } )
+					}
+				);
+		
+				feature.setStyle( style );
+			}
+			
+			layer.getSource().addFeatures( features );
+		}
+	);
+	
+	return layer;
+};
+
+netgis.Map.prototype.createBufferFeature = function( srcgeom, radius, segments )
+{
+	var geom = this.createBufferGeometry( srcgeom, radius, segments );
+	var feature = new ol.Feature( { geometry: geom } );
+	
+	return feature;
+};
+
+netgis.Map.prototype.createBufferGeometry = function( srcgeom, radius, segments )
+{
+	var parser = new jsts.io.OL3Parser();
+		
+	var a = parser.read( srcgeom );
+	var b = a.buffer( radius, segments );
+	
+	if ( this.boundsLayer )
+	{
+		// Clip Buffer Preview Against Bounds
+		var bounds = this.boundsLayer.getSource().getFeatures();
+		
+		for ( var i = 0; i < bounds.length; i++ )
+		{
+			var bound = parser.read( bounds[ i ].getGeometry() );
+			
+			if ( ! b.intersects( bound ) ) continue;
+			
+			b = b.intersection( bound );
+		}
+	}
+	
+	var geom = parser.write( b );
+	
+	return geom;
+};
+
+netgis.Map.prototype.splitMultiPolygons = function( layer )
+{
+	//TODO: split only selected feature ( parameter )
+	
+	var source = layer.getSource();
+	var features = source.getFeatures();
+
+	var removeFeatures = [];
+	var newFeatures = [];
+
+	// Find Multi Features
+	for ( var i = 0; i < features.length; i++ )
+	{
+		var feature = features[ i ];
+		var geom = feature.getGeometry();
+
+		if ( geom instanceof ol.geom.MultiPolygon )
+		{
+			var polygons = geom.getPolygons();
+
+			// Create Single Features
+			for ( var j = 0; j < polygons.length; j++ )
+			{
+				var polygon = polygons[ j ];
+				var newFeature = new ol.Feature( { geometry: polygon } );
+				newFeatures.push( newFeature );
+			}
+
+			removeFeatures.push( feature );
+		}
+	}
+
+	// Remove Multi Features
+	for ( var i = 0; i < removeFeatures.length; i++ )
+	{
+		source.removeFeature( removeFeatures[ i ] );
+	}
+
+	// Add Single Features
+	source.addFeatures( newFeatures );
+};
+
+netgis.Map.prototype.clearSketchFeatures = function()
+{
+	var source = this.editLayer.getSource();
+	
+	// Clear Sketch Features
+	for ( var f = 0; f < this.sketchFeatures.length; f++ )
+	{
+		source.removeFeature( this.sketchFeatures[ f ] );
+	}
+	
+	this.sketchFeatures = [];
+};
+
+netgis.Map.prototype.updateDrawBufferPreview = function()
+{
+	if ( this.config[ "tools" ][ "editable" ] === false ) return;
+	
+	var draw = this.interactions[ this.mode ][ 0 ];
+	var overlays = draw.getOverlay().getSource().getFeatures();
+	if ( overlays.length < 1 ) return;
+	
+	var preview = this.previewLayer.getSource().getFeatures()[ 0 ];
+	if ( ! preview ) return;
+	
+	var geom = overlays[ 0 ].getGeometry();
+	var buffer = this.createBufferGeometry( geom, this.drawBufferRadius, this.drawBufferSegments );
+	preview.setGeometry( buffer );
+};
+
+netgis.Map.prototype.isPointInsideLayer = function( layer, coords )
+{
+	var features = layer.getSource().getFeatures();
+	
+	for ( var i = 0; i < features.length; i++ )
+	{
+		var geom = features[ i ].getGeometry();
+		
+		if ( geom.intersectsCoordinate( coords ) ) return true;
+	}
+	
+	return false;
+};
+
+netgis.Map.prototype.isGeomInsideLayer = function( layer, geom )
+{
+	var coords = geom.getCoordinates();
+	
+	if ( geom instanceof ol.geom.LineString )
+	{
+		if ( coords.length < 2 ) return false;
+	}
+	else if ( geom instanceof ol.geom.Polygon )
+	{
+		coords = coords[ 0 ];
+		if ( coords.length < 4 ) return false;
+		if ( geom.getArea() <= 0 ) return false;
+	}
+	
+	var parser = new jsts.io.OL3Parser();
+	var a = parser.read( geom );
+	
+	var features = layer.getSource().getFeatures();
+	
+	for ( var i = 0; i < features.length; i++ )
+	{
+		var other = features[ i ].getGeometry();
+		var b = parser.read( other );
+		
+		if ( b.contains( a ) ) return true;
+	}
+	
+	return false;
+};
+
+netgis.Map.prototype.getScaleFromResolution = function( res )
+{
+	var scale = 39.3701 * 72 * res;
+	scale = Math.round( scale );
+
+	return scale;
+};
+
+netgis.Map.prototype.getResolutionFromScale = function( scale )
+{
+	var mpu = ol.proj.Units.METERS_PER_UNIT[ this.view.getProjection().getUnits() ];
+	var ipu = mpu * 39.3701; // inches per unit = 39.3701
+	var dpi = 72;
+
+	var res = 1 / ( this.normalizeScale( scale ) * ipu * dpi );
+
+	return res;
+};
+
+netgis.Map.prototype.normalizeScale = function( scale )
+{
+	return 1 < scale ? 1 / scale : scale;
+};
+
+netgis.Map.prototype.updateEditOutput = function()
+{
+	var features = this.editLayer.getSource().getFeatures();
+	
+	//var proj = this.projection;
+	var proj = this.view.getProjection().getCode();
+	var format = new ol.format.GeoJSON();
+	var output = format.writeFeaturesObject( features, { dataProjection: proj, featureProjection: proj } );
+	
+	// Projection
+	output[ "crs" ] =
+	{
+		"type": "name",
+		"properties": { "name": "urn:ogc:def:crs:" + proj.replace( ":", "::" ) }
+	};
+	
+	// Total Area
+	var area = 0.0;
+	
+	for ( var i = 0; i < features.length; i++ )
+	{
+		var geom = features[ i ].getGeometry();
+		if ( geom instanceof ol.geom.Polygon ) area += geom.getArea();
+	}
+	
+	output[ "area" ] = area;
+	
+	//console.info( "Update Output:", output );
+	
+	//if ( ! this.editEventsSilent )
+	{
+		////this.client.invoke( netgis.Events.EDIT_FEATURES_CHANGE, output );
+		////netgis.util.invoke( this.container, netgis.Events.EDIT_FEATURES_CHANGE, output );
+		netgis.util.invoke( this.container, netgis.Events.MAP_EDIT_LAYER_CHANGE, { geojson: output } );
+	}
+};
+
+netgis.Map.prototype.updateSnapFeatures = function()
+{
+	this.snapFeatures.clear();
+	
+	var self = this;
+	
+	this.map.getLayers().forEach
+	(
+		function( layer, i, arr )
+		{
+			var id = layer.get( "id" );
+			
+			if ( id === netgis.Client.Layers.PARCEL_DISTRICTS ) return;
+			if ( id === netgis.Client.Layers.PARCEL_FIELDS ) return;
+			if ( id === netgis.Client.Layers.PARCEL_FEATURES ) return;
+			
+			if ( layer instanceof ol.layer.Vector )
+				self.addSnapLayer( layer );
+		}
+	);
+};
+
+netgis.Map.prototype.zoom = function( delta )
+{
+	this.view.animate( { zoom: this.view.getZoom() + delta, duration: 200 } );
+};
+
+netgis.Map.prototype.zoomLevel = function( z )
+{
+	this.view.animate( { zoom: z, center: this.view.getCenter(), duration: 300 } );
+};
+
+netgis.Map.prototype.zoomCoords = function( x, y, zoom )
+{
+	this.view.animate( { zoom: zoom, center: [ x, y ], duration: 500 } );
+};
+
+/**
+ * 
+ * @param {type} lon Longitude Float Number
+ * @param {type} lat
+ * @param {type} zoom
+ * @returns {undefined} */
+netgis.Map.prototype.zoomLonLat = function( lon, lat, zoom )
+{
+	this.view.animate( { zoom: zoom, center: ol.proj.fromLonLat( [ lon, lat ], this.view.getProjection() ), duration: 500 } );
+};
+
+netgis.Map.prototype.zoomExtentLonLat = function( minlon, minlat, maxlon, maxlat )
+{
+	var minxy = ol.proj.fromLonLat( [ minlon, minlat ], this.view.getProjection() );
+	var maxxy = ol.proj.fromLonLat( [ maxlon, maxlat ], this.view.getProjection() );
+	
+	this.view.fit( [ minxy[ 0 ], minxy[ 1 ], maxxy[ 0 ], maxxy[ 1 ] ] );
+};
+
+netgis.Map.prototype.zoomExtent = function( minx, miny, maxx, maxy )
+{
+	this.view.fit( [ minx, miny, maxx, maxy ] );
+};
+
+netgis.Map.prototype.zoomBBox = function( bbox, anim )
+{
+	this.view.fit( bbox, { duration: anim } );
+};
+
+netgis.Map.prototype.zoomScale = function( scale, anim )
+{
+	if ( ! anim )
+		this.view.setResolution( this.getResolutionFromScale( scale ) );
+	else
+		this.view.animate( { resolution: this.getResolutionFromScale( scale ), duration: 500 } );
+};
+
+netgis.Map.prototype.zoomFeature = function( layerID, featureID )
+{
+	var layer = this.layers[ layerID ];
+	var feature = layer.getSource().getFeatureById( featureID );
+	
+	this.view.fit( feature.getGeometry().getExtent(), { duration: 500 } );
+};
+
+netgis.Map.prototype.zoomFeatures = function( features )
+{
+	if ( ! features || features.length < 1 ) return;
+	
+	var extent = features[ 0 ].getGeometry().getExtent();
+	
+	for ( var i = 1; i < features.length; i++ )
+	{
+		extent = ol.extent.extend( extent, features[ i ].getGeometry().getExtent() );
+	}
+	
+	this.view.fit( extent, { duration: 0, padding: this.view.padding } );
+};
+
+netgis.Map.prototype.addViewHistory = function( center, zoom )
+{
+	// Check If Last View Is Similar
+	if ( this.viewHistory.length > 0 )
+	{
+		var last = this.viewHistory[ this.viewHistory.length - 1 ];
+		var similar = true;
+		
+		if ( Math.abs( center[ 0 ] - last.center[ 0 ] ) > 10.0 ) similar = false;
+		if ( Math.abs( center[ 1 ] - last.center[ 1 ] ) > 10.0 ) similar = false;
+		if ( Math.abs( zoom - last.zoom ) > 0.1 ) similar = false;
+		
+		if ( similar === true ) return;
+	}
+	
+	this.viewHistory.push( { center: center, zoom: zoom } );
+	if ( this.viewHistory.length > this.viewHistoryMax ) this.viewHistory.shift();
+	
+	this.viewIndex = this.viewHistory.length - 1;
+};
+
+netgis.Map.prototype.gotoViewHistory = function( i )
+{
+	if ( this.viewHistory.length < 1 ) return;
+	
+	var max = this.viewHistory.length - 1;
+	if ( i < 0 ) i = max;
+	if ( i > max ) i = 0;
+	
+	if ( i === this.viewIndex ) return;
+	
+	var view = this.viewHistory[ i ];
+	
+	this.viewIndex = i;
+	this.viewFromHistory = true;
+	
+	this.view.setCenter( view.center );
+	this.view.setZoom( view.zoom );
+};
+
+netgis.Map.prototype.setPadding = function( top, right, bottom, left )
+{
+	var buffer = this.paddingBuffer;
+	this.view.padding = [ top + buffer, right + buffer, bottom + buffer, left + buffer ];
+};
+
+/**
+* 
+* @param {format} string Format identifier (jpeg, png, gif)
+* @param {resx} integer Map image x resolution (pixels)
+* @param {resy} integer Map image y resolution (pixels)
+* @param {mode} boolean PDF mode (true = landscape, false = portrait)
+* @param {margin} integer PDF page margin (millimeters)
+*/
+netgis.Map.prototype.exportImage = function( format, resx, resy, mode, margin )
+{
+	//netgis.util.invoke( this.container, netgis.Events.EXPORT_BEGIN, null );
+	
+	var self = this;
+	var root = this.container;
+	var map = this.map;
+	
+	var config = this.config[ "export" ];
+	
+	// Request Logo Image
+	var logo = new Image();
+	
+	logo.onload = function()
+	{
+		//TODO: refactor map render image and image export
+		//NOTE: https://github.com/openlayers/openlayers/issues/9100
+		//NOTE: scaling / quality bugs when map pixel ratio is not 1.0
+
+		// Render Target
+		var renderContainer = document.createElement( "div" );
+		renderContainer.style.position = "fixed";
+		renderContainer.style.top = "0px";
+		renderContainer.style.left = "0px";
+		renderContainer.style.width = resx + "px";
+		renderContainer.style.height = resy + "px";
+		renderContainer.style.background = "white";
+		renderContainer.style.zIndex = -1;
+		renderContainer.style.opacity = 0.0;
+		renderContainer.style.pointerEvents = "none";
+		root.appendChild( renderContainer );
+		
+		map.setTarget( renderContainer );
+		
+		// Request Render
+		map.once
+		(
+			"rendercomplete",
+			function()
+			{
+				var mapCanvas = document.createElement( "canvas" );
+				mapCanvas.width = resx;
+				mapCanvas.height = resy;
+
+				var mapContext = mapCanvas.getContext( "2d" );
+				mapContext.webkitImageSmoothingEnabled = false;
+				mapContext.mozImageSmoothingEnabled = false;
+				mapContext.imageSmoothingEnabled = false;
+
+				// Loop Map Layers
+				Array.prototype.forEach.call
+				(
+					document.querySelectorAll( ".ol-layer canvas" ),
+					function( canvas )
+					{
+						if ( canvas.width > 0 )
+						{
+							var opacity = canvas.parentNode.style.opacity;
+							mapContext.globalAlpha = ( opacity === '' ) ? 1.0 : Number( opacity );
+
+							var transform = canvas.style.transform;
+							var matrix = transform.match( /^matrix\(([^\(]*)\)$/ )[ 1 ].split( "," ).map( Number );
+
+							CanvasRenderingContext2D.prototype.setTransform.apply( mapContext, matrix );
+
+							mapContext.drawImage( canvas, 0, 0 );
+						}
+					}
+				);
+
+				// Watermark Logo
+				mapContext.drawImage( logo, 0, 0 );
+				
+				// Timestamp
+				mapContext.fillStyle = "#fff";
+				mapContext.fillRect( 0, mapCanvas.height - 30, 140, 30 );
+				mapContext.fillStyle = "#000";
+				mapContext.font = "4mm sans-serif";
+				mapContext.fillText( netgis.util.getTimeStamp(), 10, mapCanvas.height - 10 );
+
+				// Export Map Image
+				var link = document.createElement( "a" );
+
+				switch ( format )
+				{
+					case "pdf":
+					{
+						// Dimensions
+						var landscape = mode;
+						margin = margin ? margin : 0;
+						var widthA4 = 297 - margin - margin;
+						var heightA4 = 210 - margin - margin;
+						var ratio = mapCanvas.width / mapCanvas.height;
+						
+						if ( ! landscape )
+						{
+							var w = widthA4;
+							widthA4 = heightA4;
+							heightA4 = w;
+						}
+
+						var width;
+						var height;
+
+						if ( mapCanvas.height > mapCanvas.width )
+						{
+							// Tall Canvas
+							height = heightA4;
+							width = height * ratio;
+							
+							if ( width > widthA4 )
+							{
+								width = widthA4;
+								height = width / ratio;
+							}
+						}
+						else
+						{
+							// Wide Canvas
+							width = widthA4;
+							height = width / ratio;
+							
+							if ( height > heightA4 )
+							{
+								height = heightA4;
+								width = height * ratio;
+							}
+						}
+
+						var pdf = new jsPDF( landscape ? "l" : "p" );
+
+						var x = margin;
+						x += ( widthA4 - width ) / 2;
+
+						var y = margin;
+						y += ( heightA4 - height ) / 2;
+
+						// Map Image
+						pdf.addImage( mapCanvas.toDataURL( "image/png,1.0", 1.0 ), "PNG", x, y, width, height );
+
+						// Text
+						pdf.setFillColor( 255, 255, 255 );
+						pdf.rect( x, y + height - 11, 80, 11, "F" );
+						
+						pdf.setFontSize( 8 );
+						pdf.text( "Datum: " + netgis.util.getTimeStamp(), x + 2, y + height - 2 - 4 );
+						pdf.text( "Quelle: " + window.location.href, x + 2, y + height - 2 );
+
+						// Same Tab
+						//pdf.output( "save", { filename: config.export.defaultFilename + ".pdf" } );
+
+						// New Tab (without Name)
+						var data = pdf.output( "bloburl", { filename: config[ "default_filename" ] + ".pdf" } );
+						window.open( data, "_blank" );
+
+						/*
+						// Download (with Name)
+						var data = pdf.output( "blob", { filename: config.export.defaultFilename + ".pdf" } );
+						var blob = new Blob( [ data ], { type: "octet/stream" } );
+						link.setAttribute( "download", "Export.pdf" );
+						link.setAttribute( "href", window.URL.createObjectURL( blob ) );
+						link.click();
+						//window.URL.revokeObjectURL( url );
+						*/
+
+						break;
+					}
+
+					case "jpeg":
+					{					
+						if ( window.navigator.msSaveBlob )
+						{
+							window.navigator.msSaveBlob( mapCanvas.msToBlob(), config[ "default_filename" ] + ".jpg" );
+						}
+						else
+						{
+							link.setAttribute( "download", config[ "default_filename" ] + ".jpg" );
+							link.setAttribute( "href", mapCanvas.toDataURL( "image/jpeg", 1.0 ) );
+							link.click();
+						}
+
+						break;
+					}
+
+					case "png":
+					{					
+						if ( window.navigator.msSaveBlob )
+						{
+							//if ( ! config.export.openNewTab )
+								window.navigator.msSaveBlob( mapCanvas.msToBlob(), config[ "default_filename" ] + ".png" );
+							/*else
+								window.open( mapCanvas.msToBlob(), "_blank" );*/
+						}
+						else
+						{
+							/*if ( ! config.export.openNewTab )
+							{*/
+								link.setAttribute( "download", config[ "default_filename" ] + ".png" );
+								link.setAttribute( "href", mapCanvas.toDataURL( "image/png", 1.0 ) );
+								link.click();
+							/*}
+							else
+								window.open( mapCanvas.toDataURL( "image/png", 1.0 ), "_blank" );*/
+						}
+
+						break;
+					}
+
+					case "gif":
+					{
+						link.setAttribute( "download", config[ "default_filename" ] + ".gif" );
+						
+						var gif = new GIF( { workerScript: config[ "gif_worker" ], quality: 1 } );
+						gif.addFrame( mapCanvas );
+						
+						gif.on
+						(
+							"finished",
+							function( blob )
+							{
+								link.setAttribute( "href", window.URL.createObjectURL( blob ) );
+								link.click();
+							}
+						);
+
+						gif.render();
+
+						break;
+					}
+				}   
+				
+				// Done
+				map.setTarget( root );
+				root.removeChild( renderContainer );
+				
+				netgis.util.invoke( self.container, netgis.Events.EXPORT_END, null );
+			}
+		);
+
+		// Begin Map Render
+		map.renderSync();
+	};
+	
+	// Begin Logo Load & Render
+	logo.src = config[ "logo" ];
+};
+
+netgis.Map.prototype.exportFeatures = function( nonEdits )
+{
+	var features = this.editLayer.getSource().getFeatures();
+	
+	if ( nonEdits === true )
+	{
+		var nonEditFeatures = this.nonEditLayer.getSource().getFeatures();
+		features = features.concat( nonEditFeatures );
+	}
+	
+	var format = new ol.format.GeoJSON();
+	var geojson = format.writeFeaturesObject( features, { featureProjection: this.view.getProjection(), dataProjection: "EPSG:4326" } );
+	
+	var name = this.config[ "export" ][ "default_filename" ] + ".geojson";
+	geojson[ "name" ] = name;
+	
+	netgis.util.downloadJSON( geojson, name );
+	
+	netgis.util.invoke( this.container, netgis.Events.EXPORT_END, null );
+};
+
+netgis.Map.prototype.onClientContextResponse = function( e )
+{
+	var params = e.detail;
+	this.initConfig( params.context.config );
+};
+
+netgis.Map.prototype.onEditLayerLoaded = function( e )
+{
+	var params = e.detail;
+	var geojson = params.geojson;
+	
+	// Parse Features
+	var format = new ol.format.GeoJSON();
+	var projection = format.readProjection( geojson );
+	
+	var features = format.readFeatures( geojson, { featureProjection: this.view.getProjection().getCode() } );
+	
+	// Zoom Features
+	var self = this;
+	var all = features.slice();
+	window.setTimeout( function() { self.zoomFeatures( all ); }, 10 );
+	
+	// Split Non Editables
+	var editables = [];
+	
+	for ( var i = 0; i < features.length; i++ )
+	{
+		var feature = features[ i ];
+		var props = feature.getProperties();
+		
+		var editable = props[ "editable" ];
+		
+		if ( editable === true ) editables.push( feature );
+	}
+	
+	for ( var i = 0; i < editables.length; i++ )
+	{
+		features.splice( features.indexOf( editables[ i ] ), 1 );
+	}
+	
+	// Add To Layers
+	this.editEventsSilent = true;
+	
+	this.editLayer.getSource().addFeatures( editables );
+	this.nonEditLayer.getSource().addFeatures( features );
+	
+	//this.updateSnapFeatures();
+	
+	this.editEventsSilent = false;
+};
+
+netgis.Map.prototype.onClientSetMode = function( e )
+{
+	var params = e.detail;
+	this.setMode( params.mode );
+};
+
+netgis.Map.prototype.onPanelResize = function( e )
+{
+	var params = e.detail;
+	
+	this.setPadding( 0, 0, 0, params.width );
+	
+	this.redrawVectorLayers();
+};
+
+netgis.Map.prototype.onPanelToggle = function( e )
+{
+	var params = e.detail;
+	
+	/*
+	if ( params.visible )
+		this.setPadding( 0, 0, 0, params.width );
+	else
+		this.setPadding( 0, 0, 0, 0 );
+	*/
+	
+	// Check If Any Panel Visible
+	var visible = false;
+	var width = 0;
+	var panels = this.container.parentNode.getElementsByClassName( "netgis-panel" );
+	
+	// TODO: is this the correct way ?
+	
+	for ( var i = 0; i < panels.length; i++ )
+	{
+		if ( panels[ i ].classList.contains( "netgis-show" ) )
+		{
+			visible = true;
+			width = panels[ i ].getBoundingClientRect().width;
+			break;
+		}
+	}
+	
+	if ( visible )
+	{
+		this.setPadding( 0, 0, 0, width );
+	}
+	else
+	{
+		this.setPadding( 0, 0, 0, 0 );
+	}
+	
+	this.redrawVectorLayers();
+};
+
+netgis.Map.prototype.onMapZoom = function( e )
+{
+	var params = e.detail;
+	this.zoom( params.delta );
+};
+
+netgis.Map.prototype.onMapZoomHome = function( e )
+{
+	var config = this.config;
+	
+	if ( config[ "map" ][ "bbox" ] )
+	{
+		this.zoomBBox( config[ "map" ][ "bbox" ], 500 );
+	}
+	else if ( config[ "map" ][ "center" ] )
+	{
+		var coords = config[ "map" ][ "center" ];
+		this.zoomCoords( coords[ 0 ], coords[ 1 ], config[ "map" ][ "zoom" ] );
+	}
+	else if ( config[ "map" ][ "center_lonlat" ] )
+	{
+		var coords = config[ "map" ][ "center_lonlat" ];
+		this.zoomLonLat( coords[ 0 ], coords[ 1 ], config[ "map" ][ "zoom" ] );
+	}
+};
+
+netgis.Map.prototype.onMapZoomLonLat = function( e )
+{
+	var params = e.detail;
+	this.zoomLonLat( params.lon, params.lat, params.zoom );
+};
+
+netgis.Map.prototype.onMapZoomScale = function( e )
+{
+	var params = e.detail;
+	this.zoomScale( params.scale, params.anim );
+};
+
+netgis.Map.prototype.onMapZoomLayer = function( e )
+{
+	var params = e.detail;
+	
+	var layer = this.layers[ params.id ];
+	
+	if ( ! layer ) { console.warning( "trying to zoom non existing layer", params.id ); return; }
+	
+	this.view.fit( layer.getSource().getExtent(), { duration: 600 } );
+};
+
+netgis.Map.prototype.onMapZoomLevel = function( e )
+{
+	var params = e.detail;
+	this.view.setZoom( params.z );
+};
+
+netgis.Map.prototype.onMapViewPrev = function( e )
+{
+	this.gotoViewHistory( this.viewIndex - 1 );
+};
+
+netgis.Map.prototype.onMapViewNext = function( e )
+{
+	this.gotoViewHistory( this.viewIndex + 1 );
+};
+
+netgis.Map.prototype.onMapLayerToggle = function( e )
+{
+	var params = e.detail;
+	
+	//console.info( "Map Layer Toggle:", params );
+	
+	switch ( params.id )
+	{
+		// Internal Layers
+		
+		case netgis.LayerID.EDITABLE:
+		{
+			if ( params.on )
+				this.map.addLayer( this.editLayer );
+			else
+				this.map.removeLayer( this.editLayer );
+			
+			break;
+		}
+		
+		case netgis.LayerID.NON_EDITABLE:
+		{
+			if ( params.on )
+				this.map.addLayer( this.nonEditLayer );
+			else
+				this.map.removeLayer( this.nonEditLayer );
+			
+			break;
+		}
+		
+		// Config Layers
+		
+		default:
+		{
+			if ( params.on )
+			{
+				var layers = this.config[ "layers" ];
+
+				for ( var i = 0; i < layers.length; i++ )
+				{
+					var layer = layers[ i ];
+
+					if ( layer[ "id" ] !== params.id ) continue;
+
+					this.addLayer( params.id, layer );
+				}
+			}
+			else
+			{
+				this.removeLayer( params.id );
+			}
+			
+			break;
+		}
+	}
+};
+
+netgis.Map.prototype.onMapLayerTransparency = function( e )
+{
+	var params = e.detail;
+	var layer = this.layers[ params.id ];
+	
+	if ( ! layer ) //return; // TODO: toggle layer on ?
+	{
+		netgis.util.invoke( this.container, netgis.Events.MAP_LAYER_TOGGLE, { id: params.id, on: true } );
+		layer = this.layers[ params.id ];
+	}
+	
+	layer.setOpacity( 1.0 - params.transparency );
+};
+
+netgis.Map.prototype.onMapSnapToggle = function( e )
+{
+	var params = e.detail;
+	this.setSnapping( params.on );
+};
+
+netgis.Map.prototype.onMapMoveEnd = function( e )
+{
+	var center = this.view.getCenter();
+	var zoom = this.view.getZoom();
+	var scale = this.getScaleFromResolution( this.view.getResolution() );
+	
+	if ( this.viewFromHistory === false )
+	{
+		this.addViewHistory( center, zoom );
+	}
+	
+	netgis.util.invoke( this.container, netgis.Events.MAP_VIEW_CHANGE, { center: center, zoom: zoom, scale: scale } );
+	
+	this.viewFromHistory = false;
+};
+
+netgis.Map.prototype.onPointerMove = function( e )
+{
+	var pixel = e.pixel;
+	var coords = e.coordinate;
+	
+	var hoverFeature = null;
+	var hoverLayer = null;
+	var hoverBounds = undefined;
+	
+	var self = this;
+	
+	this.map.forEachFeatureAtPixel
+	(
+		pixel,
+		function( feature, layer )
+		{
+			if ( ! layer ) return;
+			if ( layer === self.measureLayer ) return;
+			if ( layer === self.nonEditLayer ) return;
+			if ( layer === self.boundsLayer ) { hoverBounds = feature; return; }
+			if ( layer === self.previewLayer ) return;
+			
+			// TODO: no hover/interaction on imported layers for now
+			////if ( layer.get( "id" ) && netgis.util.isString( layer.get( "id" ) ) && layer.get( "id" ).search( "import-" ) !== -1 ) return false;
+			
+			hoverFeature = feature;
+			hoverLayer = layer;
+
+			return true;
+		}
+	);
+	
+	// Handle Interactions
+	switch ( this.mode )
+	{
+		case netgis.Modes.VIEW:
+		{
+			// Clickable Query Cursor
+			var queryables = this.getQueryableLayers( true );
+			
+			if ( queryables.length === 0 )
+			{
+				// No Queryable Layers But Hover Feature
+				if ( hoverFeature )
+					this.container.classList.add( "netgis-clickable" );
+				else
+					this.container.classList.remove( "netgis-clickable" );
+			}
+			else
+			{
+				// Has Queryable Layers
+				this.container.classList.add( "netgis-clickable" );
+			}
+			
+			break;
+		}
+		
+		case netgis.Modes.DRAW_POINTS:
+		case netgis.Modes.DRAW_LINES:
+		{
+			this.updateDrawBufferPreview();
+			break;
+		}
+	}
+	
+	// Inside Allowed Bounds
+	if ( this.boundsLayer && ( this.mode === netgis.Modes.DRAW_POINTS || this.mode === netgis.Modes.DRAW_LINES || this.mode === netgis.Modes.DRAW_POLYGONS ) )
+	{
+		//if ( hoverBounds !== this.hoverBounds )
+		{
+			if ( hoverBounds )
+			{
+				this.container.classList.remove( "netgis-not-allowed" );
+				this.container.removeAttribute( "title" );
+			}
+			else
+			{
+				this.container.classList.add( "netgis-not-allowed" );
+				
+				var message = this.config[ "tools" ][ "bounds_message" ];
+				if ( message && message.length > 0 ) this.container.setAttribute( "title", message );
+			}
+
+			this.hoverBounds = hoverBounds;
+		}
+	}
+	
+	// Update Feature States
+	var hoverable = true;
+	
+	////if ( this.mode === netgis.Modes.VIEW ) hoverable = false;
+	if ( this.mode === netgis.Modes.MEASURE_LINE ) hoverable = false;
+	if ( this.mode === netgis.Modes.MEASURE_AREA ) hoverable = false;
+	if ( this.mode === netgis.Modes.DRAW_POINTS ) hoverable = false;
+	if ( this.mode === netgis.Modes.DRAW_LINES ) hoverable = false;
+	if ( this.mode === netgis.Modes.DRAW_POLYGONS ) hoverable = false;
+	if ( this.mode === netgis.Modes.CUT_FEATURES_DRAW ) hoverable = false;
+	
+	if ( hoverFeature !== this.hoverFeature && hoverable )
+	{
+		if ( this.hoverFeature )
+		{
+			// Leave
+			this.onFeatureLeave( this.hoverFeature, this.hoverLayer, pixel, coords );
+		}
+		
+		if ( hoverFeature )
+		{
+			// Enter
+			this.onFeatureEnter( hoverFeature, hoverLayer, pixel, coords );
+		}
+		
+		this.redrawVectorLayers();
+		
+		this.hoverFeature = hoverFeature;
+		this.hoverLayer = hoverLayer;
+	}
+	
+	if ( hoverFeature )
+	{
+		// Hover
+		this.onFeatureHover( hoverFeature, hoverLayer, pixel, coords );
+	}
+};
+
+netgis.Map.prototype.onPointerLeave = function( e )
+{
+	if ( ! this.hoverFeature ) return;
+	
+	var pixel = [ e.offsetX, e.offsetY ];
+	this.onFeatureLeave( this.hoverFeature, this.hoverLayer, pixel, null );
+	
+	this.hoverFeature = null;
+	this.hoverLayer = null;
+};
+
+netgis.Map.prototype.onPointerClick = function( e )
+{
+	var pixel = e.pixel;
+	var coords = e.coordinate;
+	
+	////this.selectedFeatures = [];
+	
+	this.popupOverlay.setPosition( coords );
+	
+	// Map Click Event
+	var view =
+	{
+		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 ]
+	};
+	
+	var lonlat = ol.proj.toLonLat( coords, this.view.getProjection() );
+	
+	var params =
+	{
+		mode: this.mode,
+		pixel: pixel,
+		coords: coords,
+		lon: lonlat[ 0 ],
+		lat: lonlat[ 1 ],
+		overlay: this.popupOverlay.getElement(),
+		view: view
+	};
+	
+	if ( this.mode === netgis.Modes.VIEW ) netgis.util.invoke( this.container, netgis.Events.MAP_CLICK, params );
+	
+	// Check Clicked Features
+	var features = [];
+	
+	var self = this;
+	this.map.forEachFeatureAtPixel
+	(
+		pixel,
+		function( feature, layer )
+		{
+			if ( ! layer ) return;
+			if ( layer === self.nonEditLayer ) return;
+			if ( layer === self.boundsLayer ) return;
+			if ( layer === self.measureLayer ) return;
+			if ( layer === self.previewLayer ) return;
+			
+			// TODO: init seperate sketch layer ?
+			//if ( layer === self.sketchLayer ) return;
+			
+			if ( self.sketchFeatures.indexOf( feature ) > -1 ) return;
+			
+			features.push( { feature: feature, layer: layer } );
+		}
+	);
+	
+	// Selectable Mode
+	var selectable = true;
+	
+	if ( this.mode === netgis.Modes.VIEW ) selectable = false;
+	if ( this.mode === netgis.Modes.MEASURE_LINE ) selectable = false;
+	if ( this.mode === netgis.Modes.MEASURE_AREA ) selectable = false;
+	if ( this.mode === netgis.Modes.DRAW_POINTS ) selectable = false;
+	if ( this.mode === netgis.Modes.DRAW_LINES ) selectable = false;
+	if ( this.mode === netgis.Modes.DRAW_POLYGONS ) selectable = false;
+	if ( this.mode === netgis.Modes.CUT_FEATURES_DRAW ) selectable = false;
+	
+	if ( selectable )
+	{
+		// Clear Previous Selection If Not Multiple
+		if ( features.length > 0 && this.selectMultiple === false )
+			this.selectedFeatures = [];
+
+		// Deselect If Nothing Clicked
+		if ( features.length === 0 && this.selectMultiple === false )
+			this.selectedFeatures = [];
+		
+		// Deselect If Multi Reset Requested
+		if ( this.selectReset === true )
+		{
+			this.selectedFeatures = [];
+			this.selectReset = false;
+		}
+		
+		if ( this.mode === netgis.Modes.BUFFER_FEATURES_DYNAMIC )
+		{
+			this.updateBufferFeaturesSketch( this.bufferFeaturesRadius, this.bufferFeaturesSegments );
+		}
+	}
+	
+	// Feature Clicked
+	for ( var i = 0; i < features.length; i++ )
+	{
+		var feature = features[ i ];
+		
+		if ( selectable )
+		{
+			// Check Already Selected
+			var found = this.selectedFeatures.indexOf( feature.feature );
+			
+			if ( found > -1 )
+			{
+				// Remove From Selection
+				this.selectedFeatures.splice( found, 1 );
+			}
+			else
+			{
+				// Add To Selection
+				this.selectedFeatures.push( feature.feature );
+			}
+		}
+		
+		this.onFeatureClick( feature.feature, feature.layer, pixel, coords );
+		//if ( this.mode === netgis.Modes.VIEW ) this.onFeatureClick( feature.feature, feature.layer, pixel, coords );
+	}
+	
+	// Render
+	this.redrawVectorLayers();
+};
+
+netgis.Map.prototype.onContainerClick = function( e )
+{
+	var clicks = e.detail;
+	
+	if ( clicks === 2 )
+	{
+		this.onDoubleClick( e );
+	}
+};
+
+netgis.Map.prototype.onDoubleClick = function( e )
+{
+	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();
+			break;
+		}
+	}
+};
+
+netgis.Map.prototype.onRightClick = function( e )
+{
+	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();
+			break;
+		}
+	}
+	
+	e.preventDefault();
+	return false;
+};
+
+netgis.Map.prototype.onKeyDown = function( e )
+{	
+	var keycode = e.keyCode || e.which;
+	
+	var KEY_ENTER = 13;
+	var KEY_ESCAPE = 27;
+	var KEY_BACK = 8;
+	var KEY_DEL = 46;
+	var KEY_SHIFT = 16;
+	
+	//console.info( "Key Press:", keycode );
+	
+	switch ( this.mode )
+	{
+		case netgis.Modes.MEASURE_LINE:
+		{
+			if ( keycode === KEY_ENTER ) this.interactions[ netgis.Modes.MEASURE_LINE ][ 2 ].finishDrawing();
+			if ( keycode === KEY_ESCAPE ) this.interactions[ netgis.Modes.MEASURE_LINE ][ 2 ].abortDrawing();
+			break;
+		}
+		
+		case netgis.Modes.MEASURE_AREA:
+		{
+			if ( keycode === KEY_ENTER ) this.interactions[ netgis.Modes.MEASURE_AREA ][ 2 ].finishDrawing();
+			if ( keycode === KEY_ESCAPE ) this.interactions[ netgis.Modes.MEASURE_AREA ][ 2 ].abortDrawing();
+			break;
+		}
+		
+		case netgis.Modes.DRAW_LINES:
+		{
+			var draw = this.interactions[ netgis.Modes.DRAW_LINES ][ 0 ];
+			if ( keycode === KEY_ENTER ) draw.finishDrawing();
+			if ( keycode === KEY_ESCAPE ) draw.abortDrawing();
+			if ( keycode === KEY_BACK ) draw.removeLastPoint();
+			if ( keycode === KEY_DEL ) draw.abortDrawing();
+			break;
+		}
+		
+		case netgis.Modes.DRAW_POLYGONS:
+		{
+			var draw = this.interactions[ netgis.Modes.DRAW_POLYGONS ][ 0 ];
+			if ( keycode === KEY_ENTER ) draw.finishDrawing();
+			if ( keycode === KEY_ESCAPE ) draw.abortDrawing();
+			if ( keycode === KEY_BACK ) draw.removeLastPoint();
+			if ( keycode === KEY_DEL ) draw.abortDrawing();
+			break;
+		}
+		
+		case netgis.Modes.CUT_FEATURES_DRAW:
+		{
+			var draw = this.interactions[ netgis.Modes.CUT_FEATURES_DRAW ][ 0 ];
+			if ( keycode === KEY_ENTER ) draw.finishDrawing();
+			if ( keycode === KEY_ESCAPE ) draw.abortDrawing();
+			if ( keycode === KEY_BACK ) draw.removeLastPoint();
+			if ( keycode === KEY_DEL ) draw.abortDrawing();
+			
+			// Back To Select Mode While Shift Down
+			if ( keycode === KEY_SHIFT ) netgis.util.invoke( this.container, netgis.Events.CLIENT_SET_MODE, { mode: netgis.Modes.CUT_FEATURES } );
+			
+			break;
+		}
+	}
+	
+	if ( keycode === KEY_SHIFT )
+	{
+		////this.selectMultiple = true;
+		
+		if ( this.selectMultiple === false )
+			netgis.util.invoke( this.container, netgis.Events.SELECT_MULTI_TOGGLE, { on: true } );
+	}
+	
+	//this.redrawVectorLayers();
+};
+
+netgis.Map.prototype.onKeyUp = function( e )
+{
+	var keycode = e.keyCode || e.which;
+	
+	var KEY_SHIFT = 16;
+	
+	switch ( this.mode )
+	{
+		case netgis.Modes.BUFFER_FEATURES:
+		{
+			if ( this.selectMultiple )
+			{
+				netgis.util.invoke( this.container, netgis.Events.CLIENT_SET_MODE, { mode: netgis.Modes.BUFFER_FEATURES_EDIT } );
+			}
+			
+			break;
+		}
+		
+		case netgis.Modes.CUT_FEATURES:
+		{
+			if ( this.selectMultiple )
+			{
+				netgis.util.invoke( this.container, netgis.Events.CLIENT_SET_MODE, { mode: netgis.Modes.CUT_FEATURES_DRAW } );
+			}
+			
+			break;
+		}
+	}
+	
+	if ( keycode === KEY_SHIFT )
+	{
+		////this.selectMultiple = false;
+		netgis.util.invoke( this.container, netgis.Events.SELECT_MULTI_TOGGLE, { on: false } );
+		
+		// TODO: deprecated ?
+		this.selectReset = false;
+		
+		if ( this.config[ "tools" ][ "select_multi_reset" ] === true )
+		{
+			this.selectReset = true;
+		}
+	}
+};
+
+netgis.Map.prototype.onFeatureEnter = function( feature, layer, pixel, coords )
+{
+	//console.info( "FEATURE ENTER:", arguments );
+	
+	if ( ! layer ) return;
+	
+	////this.container.classList.add( "netgis-clickable" );
+	
+	//console.info( "LAYER:", layer.get( "id" ) );
+	
+	var hoverable = false;
+	/*if ( layer.get( "id" ) === netgis.Client.Layers.EDIT_LAYER ) hoverable = true;
+	if ( layer.get( "id" ) === netgis.Client.Layers.PARCEL_DISTRICTS ) hoverable = true;
+	if ( layer.get( "id" ) === netgis.Client.Layers.PARCEL_FIELDS ) hoverable = true;
+	if ( layer.get( "id" ) === netgis.Client.Layers.PARCEL_FEATURES ) hoverable = true;*/
+	
+	if ( layer === this.editLayer ) hoverable = true;
+	
+	//console.info( "Feature Enter:", feature, layer, hoverable );
+	
+	//if ( netgis.util.isString( layer.get( "id" ) ) && layer.get( "id" ).search( "import-" ) > -1 ) hoverable = false;
+	
+	//if ( layer.get( "id" ) !== netgis.Client.Layers.EDIT_LAYER && ( netgis.util.isString( layer.get( "id" ) ) && layer.get( "id" ).search( "import-" ) === -1 ) )
+	if ( hoverable )
+	{
+		////feature.setStyle( this.styleHover.bind( this ) );
+		
+		
+	}
+
+	//netgis.util.invoke( this.container, netgis.Events.MAP_FEATURE_ENTER, { pixel: pixel, coords: coords, layer: layer.get( "id" ), properties: feature.getProperties() } );
+	
+	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" );
+			feature.setStyle( this.styleHover.bind( this ) );
+			break;
+		}
+		
+		case netgis.Modes.SEARCH_PARCEL:
+		{
+			this.container.classList.add( "netgis-clickable" );
+			feature.setStyle( this.styleHover.bind( this ) );
+			break;
+		}
+	}
+	
+	netgis.util.invoke( this.container, netgis.Events.MAP_FEATURE_ENTER, { pixel: pixel, coords: coords, layer: layer.get( "id" ), properties: feature.getProperties() } );
+};
+
+netgis.Map.prototype.onFeatureHover = function( feature, layer, pixel, coords )
+{
+	
+};
+
+netgis.Map.prototype.onFeatureClick = function( feature, layer, pixel, coords )
+{
+	//console.info( "FEATURE CLICK:", this.selectedFeatures );
+	
+	var lonlat = ol.proj.toLonLat( coords, this.view.getProjection() );
+	
+	var params =
+	{
+		pixel: pixel,
+		coords: coords,
+		lon: lonlat[ 0 ],
+		lat: lonlat[ 1 ],
+		/*
+		layer: this.hoverLayer ? this.hoverLayer.get( "id" ) : null,
+		id: this.hoverFeature ? this.hoverFeature.getId() : null,
+		properties: this.hoverFeature ? this.hoverFeature.getProperties() : null
+		*/
+		layer: layer.get( "id" ),
+		id: feature.getId(),
+		properties: feature.getProperties()
+	};
+	
+	////netgis.util.invoke( this.container, netgis.Events.MAP_FEATURE_CLICK, params );
+	
+	// Handle Interactions
+	switch ( this.mode )
+	{
+		case netgis.Modes.VIEW:
+		{
+			netgis.util.invoke( this.container, netgis.Events.MAP_FEATURE_CLICK, params );
+			
+			break;
+		}
+		
+		case netgis.Modes.DELETE_FEATURES:
+		{
+			layer.getSource().removeFeature( feature );
+			this.onFeatureLeave( feature, layer );
+			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( feature, layer );
+			
+			if ( ! this.selectMultiple )
+				netgis.util.invoke( this.container, netgis.Events.CLIENT_SET_MODE, { mode: netgis.Modes.BUFFER_FEATURES_EDIT } );
+			else
+				netgis.util.invoke( this.container, netgis.Events.CLIENT_SET_MODE, { mode: netgis.Modes.BUFFER_FEATURES } );
+			
+			break;
+		}
+		
+		case netgis.Modes.BUFFER_FEATURES_DYNAMIC:
+		{
+			this.updateBufferFeaturesSketch( this.bufferFeaturesRadius, this.bufferFeaturesSegments );
+			break;
+		}
+		
+		case netgis.Modes.CUT_FEATURES:
+		{
+			if ( feature.getGeometry() instanceof ol.geom.Point )
+			{
+				//window.alert( "Trying to cut a point feature!" );
+				this.onFeatureLeave( feature, layer );
+				break;
+			}
+			
+			////this.onFeatureLeave( feature, layer );
+			
+			if ( ! this.selectMultiple )
+				netgis.util.invoke( this.container, netgis.Events.CLIENT_SET_MODE, { mode: netgis.Modes.CUT_FEATURES_DRAW } );
+			
+			break;
+		}
+	}
+};
+
+netgis.Map.prototype.onFeatureLeave = function( feature, layer, pixel, coords )
+{
+	////if ( ! layer ) return;
+	
+	//this.container.classList.remove( "netgis-clickable" );
+	
+	//console.info( "Feature Leave:", feature );
+	
+	/*if ( layer.get( "id" ) !== netgis.Client.Layers.EDIT_LAYER )
+	{
+		feature.setStyle( null );
+	}*/
+	
+	var hoverable = false;
+	if ( layer === this.editLayer ) hoverable = true;
+	
+	if ( hoverable )
+	{
+		////feature.setStyle( null );
+	}
+			
+	netgis.util.invoke( this.container, netgis.Events.MAP_FEATURE_LEAVE, { pixel: pixel, coords: coords, layer: layer ? layer.get( "id" ) : null, properties: feature.getProperties() } );
+	
+	switch ( this.mode )
+	{
+		case netgis.Modes.VIEW:
+		{
+			break;
+		}
+		
+		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" );
+			feature.setStyle( null );
+			break;
+		}
+		
+		case netgis.Modes.SEARCH_PARCEL:
+		{
+			this.container.classList.remove( "netgis-clickable" );
+			feature.setStyle( null );
+			break;
+		}
+	}
+};
+
+netgis.Map.prototype.onEditLayerAdd = function( e )
+{	
+	////this.updateEditOutput();
+	//this.updateEditLayerItem();
+	
+	
+	if ( ! this.editEventsSilent ) this.updateEditOutput();
+	
+	this.snapFeatures.push( e.feature );
+};
+
+netgis.Map.prototype.onEditLayerRemove = function( e )
+{
+	if ( ! this.editEventsSilent ) this.updateEditOutput();
+	
+	this.snapFeatures.remove( e.feature );
+};
+
+netgis.Map.prototype.onEditLayerChange = function( e )
+{
+	if ( ! this.editEventsSilent ) this.updateEditOutput();
+};
+
+netgis.Map.prototype.onCopyFeatureToEdit = function( e )
+{
+	var params = e.detail;
+	
+	var layer = this.layers[ params.source ];
+	var feature = layer.getSource().getFeatureById( params.id );
+	
+	if ( ! feature ) { console.error( "feature to copy not found", params ); return; }
+	
+	if ( ! this.editLayer.getSource().getFeatureById( params.id ) )
+	{
+		feature.setStyle( undefined );
+		this.selectedFeatures = [];
+		
+		this.editLayer.getSource().addFeature( feature );
+	}
+};
+
+netgis.Map.prototype.onGeolocToggleActive = function( e )
+{
+	var params = e.detail;
+	
+	if ( params.on )
+		this.geolocLayer.setVisible( true );
+	else
+		this.geolocLayer.setVisible( false );
+};
+
+netgis.Map.prototype.onGeolocChange = function( e )
+{
+	var params = e.detail;
+	
+	var marker = this.geolocLayer.getSource().getFeatures()[ 0 ];
+	marker.getGeometry().setCoordinates( ol.proj.fromLonLat( [ params.lon, params.lat ], this.view.getProjection() ) );
+	
+	if ( params.center === true )
+	{
+		this.zoomLonLat( params.lon, params.lat, this.view.getZoom() );
+	}
+};
+
+netgis.Map.prototype.onMeasureLineBegin = function( e )
+{
+	this.measureLayer.getSource().clear();
+};
+
+netgis.Map.prototype.onMeasureAreaBegin = function( e )
+{
+	this.measureLayer.getSource().clear();
+};
+/*
+netgis.Map.prototype.onMeasureEnd = function( e )
+{
+	var geom = e.feature.getGeometry();
+	var l = geom.getLength();
+	
+	console.info( "Measure End:", l );
+};
+*/
+
+netgis.Map.prototype.onMeasureClear = function( e )
+{
+	this.measureLayer.getSource().clear();
+};
+
+netgis.Map.prototype.onDrawBufferEnd = function( e )
+{
+	var feature = e.feature;
+	var previews = this.previewLayer.getSource().getFeatures();
+	
+	if ( previews.length === 0 ) return;
+	
+	var preview = previews[ 0 ];
+	
+	// Check Point Inside Bounds Layer
+	if ( this.boundsLayer )
+	{
+		var inside = true;
+		
+		if ( feature.getGeometry() instanceof ol.geom.Point )
+			inside = this.isPointInsideLayer( this.boundsLayer, feature.getGeometry().getCoordinates() );
+		else
+			inside = this.isGeomInsideLayer( this.boundsLayer, feature.getGeometry() );
+
+		if ( ! inside ) return;
+		
+		// Clip Buffer Preview Against Bounds
+		var parser = new jsts.io.OL3Parser();
+
+		var a = parser.read( preview.getGeometry() );
+		var bounds = this.boundsLayer.getSource().getFeatures();
+		
+		for ( var i = 0; i < bounds.length; i++ )
+		{
+			var b = parser.read( bounds[ i ].getGeometry() );
+			
+			if ( ! a.intersects( b ) ) continue;
+			
+			a = a.intersection( b );
+		}
+		
+		// TODO: handle preview intersection with multiple bounds features, create multi polygon ?
+
+		// Output
+		var geom = parser.write( a );
+		preview.setGeometry( geom );
+	}
+		
+	// Add Buffer Feature
+	var src = this.editLayer.getSource();
+	src.addFeature( preview.clone() );
+
+	// Remove Sketch Feature
+	window.setTimeout
+	(
+		function()
+		{
+			src.removeFeature( feature );
+		},
+		10
+	);
+};
+
+/*
+netgis.Map.prototype.onDrawLinesEnd = function( e )
+{
+	var preview = this.previewLayer.getSource().getFeatures()[ 0 ];
+	
+	if ( preview )
+	{
+		var src = this.editLayer.getSource();
+		
+		// Add Buffer Feature
+		src.addFeature( preview.clone() );
+	
+		// Remove Sketch Feature
+		window.setTimeout
+		(
+			function()
+			{
+				src.removeFeature( e.feature );
+			},
+			10
+		);
+	}
+};
+*/
+
+netgis.Map.prototype.onSelectMultiToggle = function( e )
+{
+	var params = e.detail;
+	this.selectMultiple = params.on;
+};
+
+netgis.Map.prototype.onDrawBufferToggle = function( e )
+{
+	var params = e.detail;
+	
+	this.setDrawBuffer( params.on, params.radius, params.segments );
+	
+	/*
+	console.info( "DRAW BUFFER:", params );
+	
+	this.drawBufferOn = params.on;
+	
+	if ( params.on )
+	{
+		var feature = this.createBufferFeature( new ol.geom.Point( this.view.getCenter() ), params.radius, params.segments );
+		this.previewLayer.getSource().addFeature( feature );
+		
+		this.drawBufferRadius = params.radius;
+		this.drawBufferSegments = params.segments;
+	}
+	else
+	{
+		this.previewLayer.getSource().clear();
+	}
+	*/
+};
+
+netgis.Map.prototype.onDrawBufferChange = function( e )
+{
+	var params = e.detail;
+	
+	this.drawBufferRadius = params.radius;
+	this.drawBufferSegments = params.segments;
+	
+	this.updateDrawBufferPreview();
+};
+
+netgis.Map.prototype.onBufferChange = function( e )
+{
+	var params = e.detail;
+   
+	this.updateBufferFeaturesSketch( params.radius, params.segments );
+	
+	this.bufferFeaturesRadius = params.radius;
+	this.bufferFeaturesSegments = params.segments;
+};
+
+netgis.Map.prototype.updateBufferFeaturesSketch = function( radius, segments )
+{
+	var features = this.selectedFeatures;
+	var source = this.editLayer.getSource();
+	
+	this.clearSketchFeatures();
+	
+	for ( var f = 0; f < features.length; f++ )
+	{
+		var target = this.selectedFeatures[ f ];
+		var feature = this.createBufferFeature( target.getGeometry(), radius, segments );
+		
+		source.addFeature( feature );
+		
+		this.sketchFeatures.push( feature );
+	}
+};
+
+netgis.Map.prototype.onBufferAccept = function( e )
+{
+	// Remove Selected Source Features
+	var features = this.selectedFeatures;
+	var source = this.editLayer.getSource();
+	
+	for ( var f = 0; f < features.length; f++ )
+	{
+		var feature = features[ f ];
+		source.removeFeature( feature );
+	}
+	
+	// Keep Sketch Features in Edit Layer
+	this.sketchFeatures = [];
+	this.selectedFeatures = [];
+};
+
+netgis.Map.prototype.onCutFeaturesDrawEnd = function( e )
+{
+	var cutter = e.feature;
+	//var target = this.selectedFeatures[ 0 ];
+	
+	//console.info( "CUT END:", this.selectedFeatures );
+	
+	for ( var i = 0; i < this.selectedFeatures.length; i++ )
+	{
+		var target = this.selectedFeatures[ i ];
+	
+		if ( target )
+		{
+			this.onFeatureLeave( target, null );
+
+			// Check Geom Type
+			if ( target.getGeometry() instanceof ol.geom.Point )
+			{
+				console.error( "trying to cut a point feature", target );
+			}
+			else
+			{
+				// Cut Process
+				var parser = new jsts.io.OL3Parser();
+
+				var a = parser.read( target.getGeometry() );
+				var b = parser.read( cutter.getGeometry() );
+
+				var c = a.difference( b );
+
+				// Output
+				var geom = parser.write( c );
+				var feature = new ol.Feature( { geometry: geom } );
+
+				var source = this.editLayer.getSource();
+				source.removeFeature( target );
+				source.addFeature( feature );
+
+				//this.selectedFeatures[ 0 ] = feature;
+			}
+		}
+	
+	}
+	
+	this.selectedFeatures = [];
+	
+	this.editEventsSilent = true;
+	this.splitMultiPolygons( this.editLayer );
+	this.editEventsSilent = false;
+	this.updateEditOutput();
+	
+	netgis.util.invoke( this.container, netgis.Events.CLIENT_SET_MODE, { mode: netgis.Modes.VIEW } );
+};
+
+netgis.Map.prototype.onImportLayerAccept = function( e )
+{
+	var params = e.detail;
+	
+	var layer = this.addLayer( params[ "id" ], params );
+	var source = layer.getSource();
+	
+	if ( source instanceof ol.source.Vector && source.getFeatures().length > 0 )
+	{
+		//if ( source.getFeatures().length === 0 ) return;
+		this.view.fit( layer.getSource().getExtent(), { duration: 600 } );
+	}
+};
+
+netgis.Map.prototype.onImportGeoportalSubmit = function( e )
+{
+	var params = e.detail;
+	
+	//console.info( "Map Geoportal Submit:", params );
+	
+	/*var id = params.layer.id;
+	
+	var config =
+	{
+		type: netgis.LayerTypes.WMS,
+		url: params.layer.url,
+		name: params.layer.name,
+		order: 10000
+	};
+	
+	this.addLayer( id, config );*/
+};
+
+netgis.Map.prototype.onImportLayerPreview = function( e )
+{
+	var params = e.detail;
+	
+	var layer = this.createLayer( params );
+	var proj = this.view.getProjection().getCode(); // TODO: layer.getSource().getProjection().getCode() ?
+	
+	netgis.util.invoke( this.container, netgis.Events.IMPORT_LAYER_PREVIEW_FEATURES, { id: params.id, title: params.title, layer: layer, proj: proj } );
+};
+
+netgis.Map.prototype.onSearchParcelReset = function( e )
+{
+	// Zoom To Parcel Districts
+	var zoom = this.config[ "searchparcel" ][ "districts_service" ][ "min_zoom" ];
+	if ( zoom ) this.view.setZoom( zoom );
+};
+
+/*
+netgis.Map.prototype.onSearchParcelFieldsResponse = function( e )
+{
+	var params = e.detail;
+	
+	console.info( "Fields:", params );
+	
+	
+};
+*/
+
+netgis.Map.prototype.onSearchParcelItemEnter = function( e )
+{
+	var params = e.detail;
+	var id = params.id;
+	
+	//console.info( "PARCEL ENTER:", id );
+	
+	var feature = this.layers[ "searchparcel_parcels" ].getSource().getFeatureById( id );
+	
+	feature.setStyle( this.styleHover.bind( this ) );
+};
+
+netgis.Map.prototype.onSearchParcelItemLeave = function( e )
+{
+	var params = e.detail;
+	var id = params.id;
+	
+	//console.info( "PARCEL LEAVE:", id );
+	
+	var feature = this.layers[ "searchparcel_parcels" ].getSource().getFeatureById( id );
+	
+	feature.setStyle( null );
+};
+
+netgis.Map.prototype.onSearchParcelItemClick = function( e )
+{
+	var params = e.detail;
+	
+	var id = params.id;
+	
+	console.info( "PARCEL CLICK:", id );
+	
+	this.zoomFeature( "searchparcel_parcels", id );
+};
+
+netgis.Map.prototype.onSearchParcelItemImport = function( e )
+{
+	var params = e.detail;
+	
+	
+};
+
+netgis.Map.prototype.onDrawPointsUpdateGeom = function( coords, geom, proj )
+{
+	if ( ! geom )
+		geom = new ol.geom.Point( coords );
+	else
+		geom.setCoordinates( coords );
+	
+	// TODO: can not use this for interactive bounds check because not fired on move ?
+	
+	return geom;
+};
+
+netgis.Map.prototype.onDrawLinesUpdateGeom = function( coords, geom, proj )
+{	
+	// NOTE: https://openlayers.org/en/latest/apidoc/module-ol_geom_LineString-LineString.html
+	// NOTE: https://openlayers.org/en/latest/apidoc/module-ol_interaction_Draw-Draw.html
+	// NOTE: https://openlayers.org/en/latest/apidoc/module-ol_interaction_Draw.html#~GeometryFunction
+	// NOTE: https://gis.stackexchange.com/questions/165971/openlayers-drawing-interaction-geometryfunction
+	
+	if ( ! geom )
+		geom = new ol.geom.LineString( coords );
+	else
+		geom.setCoordinates( coords );
+	
+	// Check Layer Contains Geom
+	var inside = this.isGeomInsideLayer( this.boundsLayer, geom );
+	
+	this.drawError = ! inside;
+	
+	// TODO: remove last coord if not inside ?
+	
+	return geom;
+};
+
+netgis.Map.prototype.onDrawPolygonsUpdateGeom = function( coords, geom, proj )
+{
+	if ( ! geom )
+	{
+		geom = new ol.geom.Polygon( coords );
+	}
+	else
+	{
+		coords = [ coords[ 0 ].concat( [ coords[ 0 ][ 0 ] ] ) ];
+		geom.setCoordinates( coords );
+	}
+	
+	// Check Layer Contains Geom
+	var inside = true;
+	
+	if ( coords[ 0 ].length < 4 )
+	{
+		// Not Yet A Polygon
+		for ( var i = 0; i < coords[ 0 ].length; i++ )
+		{
+			var c = coords[ 0 ][ i ];
+			
+			// TODO: check line between first two points instead of single points ?
+			
+			if ( ! this.isPointInsideLayer( this.boundsLayer, c ) )
+			{
+				inside = false;
+				break;
+			}
+		}
+	}
+	else
+	{
+		// Complete Polygon Check
+		inside = this.isGeomInsideLayer( this.boundsLayer, geom );
+	}
+	
+	this.drawError = ! inside;
+	
+	return geom;
+};
+
+netgis.Map.prototype.onDrawPointsEnd = function( e )
+{
+	// NOTE: https://gis.stackexchange.com/questions/252045/openlayers-map-draw-polygon-feature-inside-boundaries
+	
+	// Check Point Inside Bounds Layer
+	if ( ! this.boundsLayer ) return;
+	
+	//var action = e.target;
+	var feature = e.feature;
+	var layer = this.editLayer;
+	
+	var inside = this.isPointInsideLayer( this.boundsLayer, feature.getGeometry().getCoordinates() );
+	
+	// TODO: refactor with line / polygon draw end functions ?
+	
+	if ( ! inside )
+	{
+		window.setTimeout( function() { layer.getSource().removeFeature( feature ); }, 10 );
+	}
+};
+
+netgis.Map.prototype.onDrawLinesEnd = function( e )
+{
+	// Check Line Inside Bounds Layer
+	if ( ! this.boundsLayer ) return;
+	
+	var feature = e.feature;
+	var layer = this.editLayer;
+	
+	var inside = this.isGeomInsideLayer( this.boundsLayer, feature.getGeometry() );
+	
+	if ( ! inside )
+	{
+		window.setTimeout( function() { layer.getSource().removeFeature( feature ); }, 10 );
+	}
+};
+
+netgis.Map.prototype.onDrawPolygonsEnd = function( e )
+{
+	// Check Polygon Inside Bounds Layer
+	if ( ! this.boundsLayer ) return;
+	
+	var feature = e.feature;
+	var layer = this.editLayer;
+	
+	var inside = this.isGeomInsideLayer( this.boundsLayer, feature.getGeometry() );
+	
+	if ( ! inside )
+	{
+		window.setTimeout( function() { layer.getSource().removeFeature( feature ); }, 10 );
+	}
+};
+
+netgis.Map.prototype.onExportBegin = function( e )
+{
+	var params = e.detail;
+	
+	switch ( params.format )
+	{
+		case "geojson":
+		{
+			this.exportFeatures( params.nonEdits );
+			break;
+		}
+		
+		default:
+		{
+			this.exportImage( params.format, params.width, params.height, params.landscape, params.padding );
+			break;
+		}
+	}
+};
+
+netgis.Map.prototype.onScalebarSelectChange = function( e )
+{
+	var scale = this.scalebarSelect.value;
+	
+	netgis.util.invoke( this.scalebarSelect, netgis.Events.MAP_ZOOM_SCALE, { scale: scale, anim: true } );
+};
+
+netgis.Map.prototype.onTimeSliderShow = function( e )
+{
+	var params = e.detail;
+	
+	//console.info( "Time Slider Show:", params );
+	
+	/*this.timesliderLayer = this.createLayerWMST( params.url, params.id );
+	this.timesliderLayer.setZIndex( 30000 );
+	
+	this.map.addLayer( this.timesliderLayer );*/
+};
+
+netgis.Map.prototype.onTimeSliderHide = function( e )
+{
+	var params = e.detail;
+	
+	//console.info( "Time Slider Hide:", params );
+	
+	//this.map.removeLayer( this.timesliderLayer );
+};
+
+netgis.Map.prototype.onTimeSliderSelect = function( e )
+{
+	var params = e.detail;
+	
+	console.info( "Time Slider Select:", params );
+	
+	//this.timesliderLayer.getSource().updateParams( { "TIME": params.id } );
+	
+	this.layers[ params.layer ].getSource().updateParams( { "TIME": params.time } );
+};
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/docs/Popup.js.html b/docs/Popup.js.html new file mode 100644 index 0000000..70da1dc --- /dev/null +++ b/docs/Popup.js.html @@ -0,0 +1,251 @@ + + + + + JSDoc: Source: Popup.js + + + + + + + + + + +
+ +

Source: Popup.js

+ + + + + + +
+
+
"use strict";
+
+var netgis = netgis || {};
+
+netgis.Popup = function( options )
+{
+	if ( ! options )
+	{
+		options =
+		{
+			direction: "down"
+		};
+	}
+	
+	this.options = options;
+	
+	this.initElements();
+};
+
+netgis.Popup.prototype.initElements = function()
+{
+	// TODO: remove this on destroy?
+	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" );
+			break;
+		}
+	}
+	
+	/*
+	this.arrow = document.createElement( "div" );
+	this.arrow.className = "netgis-arrow-down";
+	this.container.appendChild( this.arrow );
+	*/
+   
+	this.arrow = document.createElement( "div" );
+	this.arrow.className = "netgis-arrow";
+	this.container.appendChild( this.arrow );
+	
+	// Closer
+	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 );
+	
+	// Loader
+	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>";
+	
+	// Wrapper
+	this.wrapper = document.createElement( "div" );
+	this.wrapper.className = "netgis-wrapper";
+	this.content.appendChild( this.wrapper );
+};
+
+netgis.Popup.prototype.attachTo = function( parent )
+{
+	parent.appendChild( this.container );
+};
+
+netgis.Popup.prototype.show = function()
+{
+	this.container.classList.add( "netgis-show" );
+	
+	// Update Width On Small Screens
+	if ( 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()
+{
+	if ( this.loader.parentNode !== this.content ) return;
+	
+	this.content.removeChild( this.loader );
+};
+
+/**
+ * Set the arrow tip pixel coordinates inside the container.
+ * Make sure to call show before this to allow bounds checking.
+ * @param {Number} x
+ * @param {Number} y
+ */
+netgis.Popup.prototype.setPosition = function( x, y )
+{
+	// Point Bounds
+	var parent = this.container.parentNode;
+	var bounds = parent.getBoundingClientRect();
+	var arrow = this.arrow.getBoundingClientRect();
+	
+	if ( x > bounds.width - arrow.width ) x = bounds.width - arrow.width;
+	if ( x < arrow.width ) x = arrow.width;
+	
+	// Point Position
+	switch ( this.options[ "direction" ] )
+	{
+		default:
+		case "down":
+		{
+			this.container.style.left = x + "px";
+			this.container.style.top = y + "px";
+			break;
+		}
+		
+		case "right":
+		{
+			this.container.style.right = ( bounds.width - x ) + "px";
+			this.container.style.top = y + "px";
+			break;
+		}
+	}
+	
+	// Keep Popup Content Inside Bounds
+	this.content.style.left = "";
+	
+	var rect = this.content.getBoundingClientRect();
+	
+	if ( rect.x < 0 )
+	{
+		this.content.style.left = -rect.x + "px";
+	}
+	else if ( rect.x + rect.width > bounds.width )
+	{
+		this.content.style.left = -( rect.x + rect.width - bounds.width ) + "px";
+	}
+};
+
+netgis.Popup.prototype.setHeader = function( title )
+{
+	var span = this.closer.getElementsByTagName( "span" )[ 0 ];
+	span.innerHTML = title;
+};
+
+netgis.Popup.prototype.setContent = function( html )
+{
+	this.wrapper.innerHTML = html;
+};
+
+netgis.Popup.prototype.clearContent = function()
+{
+	this.wrapper.innerHTML = "";
+};
+
+netgis.Popup.prototype.addContent = function( html )
+{
+	this.wrapper.innerHTML += html;
+};
+
+netgis.Popup.prototype.onDocumentPointerDown = function( e )
+{
+	////this.hide();
+};
+
+netgis.Popup.prototype.onPointerDown = function( e )
+{
+	e.stopPropagation();
+};
+
+netgis.Popup.prototype.onCloserClick = function( e )
+{	
+	this.hide();
+	//netgis.util.invoke( this.container, netgis.Events.POPUP_CLOSE, null );
+};
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/docs/Util.js.html b/docs/Util.js.html new file mode 100644 index 0000000..1a73ad9 --- /dev/null +++ b/docs/Util.js.html @@ -0,0 +1,556 @@ + + + + + JSDoc: Source: Util.js + + + + + + + + + + +
+ +

Source: Util.js

+ + + + + + +
+
+
var netgis = netgis || {};
+
+/**
+ * General Purpose Pure Static Utility Functions.
+ */
+netgis.util =
+(
+	function ()
+	{
+		"use strict";
+		
+		var isDefined = function( v )
+		{
+			return ( typeof v !== "undefined" );
+		};
+		
+		var isObject = function( v )
+		{
+			if ( typeof v === "object" && ! Array.isArray( v ) && v !== null ) return true;
+			
+			return false;
+		};
+		
+		var isString = function( v )
+		{
+			return ( typeof v === "string" || v instanceof String );
+		};
+		
+		var isMobile = function( container )
+		{
+			if ( ! container )
+				return ( document.body.getBoundingClientRect().width < 600 );
+			else
+				return ( container.getBoundingClientRect().width < 600 );
+		};
+		
+		var clone = function( obj )
+		{
+			return JSON.parse( JSON.stringify( obj ) );
+		};
+		
+		var stringToID = function( str, seperator )
+		{
+			if ( ! seperator ) seperator = "-";
+			
+			// TODO: constant blacklist array of forbidden characters ?
+			
+			var id = str.trim();
+			id = id.toLowerCase();
+			
+			id = this.replace( id, " ", seperator );
+			id = this.replace( id, "\n", seperator );
+			id = this.replace( id, "\t", seperator );
+			id = this.replace( id, "\\.", seperator );
+			id = this.replace( id, "\\,", seperator );
+			id = this.replace( id, "\\!", seperator );
+			id = this.replace( id, "\\?", seperator );
+			id = this.replace( id, ":", seperator );
+			id = this.replace( id, ";", seperator );
+			id = this.replace( id, "\"", seperator );
+			id = this.replace( id, "\'", seperator );
+			id = this.replace( id, "\\§", seperator );
+			id = this.replace( id, "\\$", seperator );
+			id = this.replace( id, "\\%", seperator );
+			id = this.replace( id, "\\&", seperator );
+			id = this.replace( id, "\\/", seperator );
+			id = this.replace( id, "\\\\", seperator );
+			id = this.replace( id, "\\(", seperator );
+			id = this.replace( id, "\\)", seperator );
+			id = this.replace( id, "\\{", seperator );
+			id = this.replace( id, "\\}", seperator );
+			id = this.replace( id, "\\[", seperator );
+			id = this.replace( id, "\\]", seperator );
+			id = this.replace( id, "=", seperator );
+			id = this.replace( id, "\\+", seperator );
+			id = this.replace( id, "\\*", seperator );
+			id = this.replace( id, "\\~", seperator );
+			id = this.replace( id, "\\^", seperator );
+			id = this.replace( id, "\\°", seperator );
+			id = this.replace( id, "²", seperator );
+			id = this.replace( id, "³", seperator );
+			id = this.replace( id, "\\#", seperator );
+			id = this.replace( id, "\\<", seperator );
+			id = this.replace( id, "\\>", seperator );
+			id = this.replace( id, "\\|", seperator );
+			id = this.replace( id, "\\@", seperator );
+			id = this.replace( id, "€", seperator );
+			id = this.replace( id, "µ", seperator );
+			
+			id = this.trim( id, seperator );
+			
+			id = this.replace( id, "ä", "ae" );
+			id = this.replace( id, "ö", "oe" );
+			id = this.replace( id, "ü", "ue" );
+			id = this.replace( id, "ß", "ss" );
+			
+			id = this.replace( id, "á", "a" );
+			id = this.replace( id, "à", "a" );
+			id = this.replace( id, "â", "a" );
+			id = this.replace( id, "é", "e" );
+			id = this.replace( id, "è", "e" );
+			id = this.replace( id, "ê", "e" );
+			id = this.replace( id, "í", "i" );
+			id = this.replace( id, "ì", "i" );
+			id = this.replace( id, "î", "i" );
+			id = this.replace( id, "ó", "o" );
+			id = this.replace( id, "ò", "o" );
+			id = this.replace( id, "ô", "o" );
+			id = this.replace( id, "ú", "u" );
+			id = this.replace( id, "ù", "u" );
+			id = this.replace( id, "û", "u" );
+			
+			return id;
+		};
+		
+		/**
+		 * Replace all string occurences.
+		 * @param {String} str
+		 * @param {String} find
+		 * @param {String} newstr
+		 * @returns {String}
+		 */
+		var replace = function( str, find, newstr )
+		{
+			return str.replace( new RegExp( find, "g" ), newstr );
+		};
+		
+		var trim = function( str, char )
+		{
+			// NOTE: https://masteringjs.io/tutorials/fundamentals/trim
+			
+			str = str.replace( new RegExp( "^" + char + "+" ), "" );
+			str = str.replace( new RegExp( char + "+$" ), "" );
+			
+			return str;
+		};
+		
+		var foreach = function( obj, fn )
+		{
+			for ( var k in obj )
+			{
+				if ( obj.hasOwnProperty( k ) )
+				{
+					fn( k, obj[ k ] );
+				}
+			}
+		};
+		
+		/**
+		 * Replace template strings in html string.
+		 * @param {type} html String with "{key}" placeholders.
+		 * @param {type} data Object of key value pairs to insert.
+		 * @returns {String} The modified html string.
+		 */
+		var template = function( html, data )
+		{
+			// Get Template: $( "#template-" + name ).text();
+			
+			foreach
+			(
+				data,
+				function( key, value )
+				{
+					html = html.replace( new RegExp( "{" + key + "}", "g" ), value );
+				}
+			);
+	
+			return html;
+		};
+		
+		/**
+		 * Create HTML element from string.
+		 * @param {String} html
+		 * @returns {Element}
+		 */
+		var create = function( html )
+		{
+			var temp = document.createElement( "tbody" );
+			temp.innerHTML = html;
+			
+			return temp.children[ 0 ];
+		};
+		
+		var insideElement = function( container, x, y )
+		{
+			var bounds = container.getBoundingClientRect();
+			
+			if ( x < bounds.left ) return false;
+			if ( y < bounds.top ) return false;
+			if ( x > bounds.right ) return false;
+			if ( y > bounds.bottom ) return false;
+			
+			return true;
+		};
+		
+		/**
+		 * Replace new line characters with HTML line breaks.
+		 * @param {String} str
+		 * @returns {String}
+		 */
+		var newlines = function( str )
+		{
+			return str.replace( new RegExp( "\n", "g" ), "<br />" );
+		};
+		
+		/**
+		 * Calculate the byte size of an object.
+		 * @param {Object} json
+		 * @returns {Object} Object with size info ( bytes, kilobytes, megabytes )
+		 */
+		var size = function( json )
+		{
+			var bytes = new TextEncoder().encode( JSON.stringify( json ) ).length;
+			var kilobytes = bytes / 1024;
+			var megabytes = kilobytes / 1024;
+			
+			return { bytes: bytes, kilobytes: kilobytes, megabytes: megabytes };
+		};
+		
+		/**
+		 * Send async GET request.
+		 * @param {String} url
+		 * @param {function} callback
+		 */
+		var request = function( url, callback, requestData, request )
+		{
+			// NOTE: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSNotSupportingCredentials
+			
+			var request = new XMLHttpRequest();
+			if ( requestData ) request._requestData = requestData;
+			
+			request.onload = function() { callback( this.responseText, this._requestData, this ); };
+			request.withCredentials = false;
+			request.open( "GET", url, true );
+			request.send();
+			
+			return request;
+		};
+		
+		var downloadJSON = function( exportObj, exportName )
+		{
+			var dataStr = "data:text/json;charset=utf-8," + encodeURIComponent( JSON.stringify( exportObj ) );
+			
+			var downloadAnchorNode = document.createElement( 'a' );
+			downloadAnchorNode.setAttribute( "href", dataStr );
+			downloadAnchorNode.setAttribute( "download", exportName );
+			document.body.appendChild( downloadAnchorNode );
+			
+			downloadAnchorNode.click();
+			downloadAnchorNode.remove();
+		};
+		
+		/**
+		 * Pad string with leading zeros.
+		 * @param {String} s The string to pad.
+		 * @param {Integer} n Minimum number of digits.
+		 * @returns {String} The padded string.
+		 */
+		var padstr = function( s, n )
+		{
+			var o = s.toString();
+			while ( o.length < n ) o = "0" + o;
+			
+			return o;
+		};
+		
+		/**
+		 * Merge object properties.
+		 * @param {Object} target Merged object properties will be written to this.
+		 * @param {Object} other The object to append to the target object.
+		 * @returns {Object} The modified target object.
+		 */
+		var merge = function( target, other )
+		{
+			return Object.assign( target, other );
+		};
+		
+		/**
+		 * @param {Boolean} ymd If true format to YYYYMMDD_HHMMSS, pretty locale otherwise
+		 * @returns {String} Formatted Date Time String (German Locale)
+		 */
+		var getTimeStamp = function( ymd )
+		{
+			var timestamp;
+			var date = new Date();
+			
+			if ( ymd === true )
+			{
+				var yyyy = date.getFullYear();
+				var mm = date.getMonth() + 1;
+				var dd = date.getDate();
+				var hh = date.getHours();
+				var mi = date.getMinutes();
+				var ss = date.getSeconds();
+				
+				if ( mm < 10 ) mm = "0" + mm;
+				if ( dd < 10 ) dd = "0" + dd;
+				if ( hh < 10 ) hh = "0" + hh;
+				if ( mi < 10 ) mi = "0" + mi;
+				if ( ss < 10 ) ss = "0" + ss;
+				
+				timestamp = [ yyyy, mm, dd, "_", hh, mi, ss ].join( "" );
+			}
+			else
+			{
+				timestamp = date.getDate() + "." + ( date.getMonth() + 1 ) + "." + date.getFullYear();
+				timestamp += " " + date.getHours() + ":" + date.getMinutes();
+			}
+			
+			return timestamp;
+		};
+		
+		/**
+		 * @returns {String} The users language locale string (defaults to German)
+		 */
+		var getUserLanguage = function()
+		{
+			var lang = navigator.language || "de-DE";
+			
+			return lang;
+		};
+		
+		/**
+		 * @param {String} path
+		 * @returns {String} file extension or empty string if none found
+		 */
+		var getFileExtension = function( path )
+		{
+			var parts = path.split( "." );
+			return ( parts.length <= 1 ) ? "" : parts[ parts.length - 1 ];
+		};
+		
+		var formatDistance = function( distance )
+		{
+			var output;
+			
+			if ( distance > 100 )
+				output = ( Math.round( distance / 1000 * 100 ) / 100 ) + " km";
+			else
+				output = ( Math.round( distance * 100 ) / 100 ) + " m";
+			
+			return output;
+		};
+		
+		var formatLength = function( len, decimals )
+		{
+			var output;
+			
+			// Normal / Large Value
+			var threshold = 1000;
+			var large = ( len > threshold );
+			
+			// Round Value
+			var i = 0;
+			
+			if ( large )
+			{
+				var METERS_PER_KILOMETER = 1000;
+				
+				if ( decimals )
+					i = Math.round( len / METERS_PER_KILOMETER * 1000 ) / 1000;
+				else
+					i = Math.round( len / METERS_PER_KILOMETER );
+			}
+			else
+			{
+				if ( decimals )
+					i = Math.round( len * 100 ) / 100;
+				else
+					i = Math.round( len );
+			}
+			
+			if ( i === 0 ) large = false;
+			
+			// Thousands Seperators
+			/*seperate = seperate || false;
+			if ( seperate ) i = i.toLocaleString( getUserLanguage() );*/
+			
+			// Build String
+			output = i + ( large ? " km" : " m" );
+			
+			// NOTE: HTML Superscript / Unicode (&sup2; etc.) not supported in OL Labels
+			
+			return output;
+		};
+		
+		/*
+		 * @param {Number} area Raw Area in Square Meters
+		 * @param {Boolean} decimals Output Rounded Decimals
+		 * @param {Number} threshold Threshold for normal (square meters) vs. large (square kilometers) values
+		 * @param {Boolean} seperate Use thousands seperators
+		 * @returns {String} Formatted Area String (Square Meters/Square Kilometers)
+		 */
+		var formatArea = function( area, decimals, threshold, seperate )
+		{
+			var output;
+			
+			// Normal / Large Value
+			threshold = threshold || 100000;
+			var large = ( area > threshold );
+			
+			// Round Value
+			var i = 0;
+			
+			if ( large )
+			{
+				var METERS_PER_KILOMETER = 1000000;
+				
+				if ( decimals )
+					i = Math.round( area / METERS_PER_KILOMETER * 1000 ) / 1000;
+				else
+					i = Math.round( area / METERS_PER_KILOMETER );
+			}
+			else
+			{
+				if ( decimals )
+					i = Math.round( area * 100 ) / 100;
+				else
+					i = Math.round( area );
+			}
+			
+			if ( i === 0 ) large = false;
+			
+			// Thousands Seperators
+			seperate = seperate || true;
+			if ( seperate ) i = i.toLocaleString( getUserLanguage() );
+			
+			// Build String
+			output = i + ( large ? " km²" : " m²" );
+			
+			// NOTE: HTML Superscript / Unicode (&sup2; etc.) not supported in OL Labels
+			
+			return output;
+		};
+		
+		var hexToRGB = function( hex )
+		{
+			if ( hex.charAt( 0 ) === "#" ) hex = hex.substr( 1 );
+				
+			var i = Number.parseInt( hex, 16 );
+			
+			var rgb =
+			[
+				( i >> 16 ) & 255,
+				( i >> 8 ) & 255,
+				i & 255
+			];
+			
+			return rgb;
+		};
+		
+		var invoke = function( src, type, params )
+		{
+			src.dispatchEvent( new CustomEvent( type, { bubbles: true, detail: params } ) );
+		};
+		
+		/**
+		 * Returns a default unbound event handler / callback function.
+		 * @param {netgis.Events} type
+		 * @param {Object} params
+		 * @returns {Function}
+		 */
+		var handler = function( type, params )
+		{
+			return function( e )
+			{
+				if ( ! params ) params = e;
+				netgis.util.invoke( this, type, params );
+			};
+		};
+
+		// Public Interface
+		var iface =
+		{
+			isDefined: isDefined,
+			isObject: isObject,
+			isString: isString,
+			isMobile: isMobile,
+			clone: clone,
+			stringToID: stringToID,
+			replace: replace,
+			trim: trim,
+			foreach: foreach,
+			template: template,
+			newlines: newlines,
+			create: create,
+			insideElement: insideElement,
+			size: size,
+			request: request,
+			downloadJSON: downloadJSON,
+			padstr: padstr,
+			merge: merge,
+			getTimeStamp: getTimeStamp,
+			getUserLanguage: getUserLanguage,
+			getFileExtension: getFileExtension,
+			formatDistance: formatDistance,
+			formatLength: formatLength,
+			formatArea: formatArea,
+			hexToRGB: hexToRGB,
+			invoke: invoke,
+			handler: handler
+		};
+
+		return iface;
+	}
+)();
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/docs/fonts/OpenSans-Bold-webfont.eot b/docs/fonts/OpenSans-Bold-webfont.eot new file mode 100644 index 0000000..5d20d91 Binary files /dev/null and b/docs/fonts/OpenSans-Bold-webfont.eot differ diff --git a/docs/fonts/OpenSans-Bold-webfont.svg b/docs/fonts/OpenSans-Bold-webfont.svg new file mode 100644 index 0000000..3ed7be4 --- /dev/null +++ b/docs/fonts/OpenSans-Bold-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/fonts/OpenSans-Bold-webfont.woff b/docs/fonts/OpenSans-Bold-webfont.woff new file mode 100644 index 0000000..1205787 Binary files /dev/null and b/docs/fonts/OpenSans-Bold-webfont.woff differ diff --git a/docs/fonts/OpenSans-BoldItalic-webfont.eot b/docs/fonts/OpenSans-BoldItalic-webfont.eot new file mode 100644 index 0000000..1f639a1 Binary files /dev/null and b/docs/fonts/OpenSans-BoldItalic-webfont.eot differ diff --git a/docs/fonts/OpenSans-BoldItalic-webfont.svg b/docs/fonts/OpenSans-BoldItalic-webfont.svg new file mode 100644 index 0000000..6a2607b --- /dev/null +++ b/docs/fonts/OpenSans-BoldItalic-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/fonts/OpenSans-BoldItalic-webfont.woff b/docs/fonts/OpenSans-BoldItalic-webfont.woff new file mode 100644 index 0000000..ed760c0 Binary files /dev/null and b/docs/fonts/OpenSans-BoldItalic-webfont.woff differ diff --git a/docs/fonts/OpenSans-Italic-webfont.eot b/docs/fonts/OpenSans-Italic-webfont.eot new file mode 100644 index 0000000..0c8a0ae Binary files /dev/null and b/docs/fonts/OpenSans-Italic-webfont.eot differ diff --git a/docs/fonts/OpenSans-Italic-webfont.svg b/docs/fonts/OpenSans-Italic-webfont.svg new file mode 100644 index 0000000..e1075dc --- /dev/null +++ b/docs/fonts/OpenSans-Italic-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/fonts/OpenSans-Italic-webfont.woff b/docs/fonts/OpenSans-Italic-webfont.woff new file mode 100644 index 0000000..ff652e6 Binary files /dev/null and b/docs/fonts/OpenSans-Italic-webfont.woff differ diff --git a/docs/fonts/OpenSans-Light-webfont.eot b/docs/fonts/OpenSans-Light-webfont.eot new file mode 100644 index 0000000..1486840 Binary files /dev/null and b/docs/fonts/OpenSans-Light-webfont.eot differ diff --git a/docs/fonts/OpenSans-Light-webfont.svg b/docs/fonts/OpenSans-Light-webfont.svg new file mode 100644 index 0000000..11a472c --- /dev/null +++ b/docs/fonts/OpenSans-Light-webfont.svg @@ -0,0 +1,1831 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/fonts/OpenSans-Light-webfont.woff b/docs/fonts/OpenSans-Light-webfont.woff new file mode 100644 index 0000000..e786074 Binary files /dev/null and b/docs/fonts/OpenSans-Light-webfont.woff differ diff --git a/docs/fonts/OpenSans-LightItalic-webfont.eot b/docs/fonts/OpenSans-LightItalic-webfont.eot new file mode 100644 index 0000000..8f44592 Binary files /dev/null and b/docs/fonts/OpenSans-LightItalic-webfont.eot differ diff --git a/docs/fonts/OpenSans-LightItalic-webfont.svg b/docs/fonts/OpenSans-LightItalic-webfont.svg new file mode 100644 index 0000000..431d7e3 --- /dev/null +++ b/docs/fonts/OpenSans-LightItalic-webfont.svg @@ -0,0 +1,1835 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/fonts/OpenSans-LightItalic-webfont.woff b/docs/fonts/OpenSans-LightItalic-webfont.woff new file mode 100644 index 0000000..43e8b9e Binary files /dev/null and b/docs/fonts/OpenSans-LightItalic-webfont.woff differ diff --git a/docs/fonts/OpenSans-Regular-webfont.eot b/docs/fonts/OpenSans-Regular-webfont.eot new file mode 100644 index 0000000..6bbc3cf Binary files /dev/null and b/docs/fonts/OpenSans-Regular-webfont.eot differ diff --git a/docs/fonts/OpenSans-Regular-webfont.svg b/docs/fonts/OpenSans-Regular-webfont.svg new file mode 100644 index 0000000..25a3952 --- /dev/null +++ b/docs/fonts/OpenSans-Regular-webfont.svg @@ -0,0 +1,1831 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/fonts/OpenSans-Regular-webfont.woff b/docs/fonts/OpenSans-Regular-webfont.woff new file mode 100644 index 0000000..e231183 Binary files /dev/null and b/docs/fonts/OpenSans-Regular-webfont.woff differ diff --git a/docs/global.html b/docs/global.html new file mode 100644 index 0000000..f5ab6a2 --- /dev/null +++ b/docs/global.html @@ -0,0 +1,1603 @@ + + + + + JSDoc: Global + + + + + + + + + + +
+ +

Global

+ + + + + + +
+ +
+ +

+ + +
+ +
+
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + +

Members

+ + + +

(readonly) Commands

+ + + + +
+ Default IDs for Built-in Commands +
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
LAYERTREE + +
SEARCHPLACE + +
SEARCHPARCEL + +
TOOLBOX + +
LEGEND + +
VIEW_PREV + +
VIEW_NEXT + +
VIEW + +
ZOOM_BOX + +
ZOOM_SCALE + +
MEASURE_LINE + +
MEASURE_AREA + +
MEASURE_CLEAR + +
DRAW_POINTS + +
DRAW_LINES + +
DRAW_POLYGONS + +
MODIFY_FEATURES + +
DELETE_FEATURES + +
BUFFER_FEATURES + +
CUT_FEATURES + +
SNAP_TOGGLE + +
IMPORT_LAYER + +
EXPORT + +
GEOLOCATION + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

(readonly) LayerID

+ + + + +
+ Default IDs for Built-in Layers +
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
EDITABLE + + "editable-layer"
NON_EDITABLE + + "non-editable-layer"
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

(readonly) LayerTypes

+ + + + +
+ Supported Layer Types +
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
TMS + + Tile Map Service
+Parameters: +
    +
  • "url": {String} URL containing {x}/{y}/{z} placeholders
  • +
XYZ + + Raster Tiles, see TMS
OSM + + OpenStreetMap Tiles, see TMS
WMTS + + Web Map Tile Service
+Parameters: +
    +
  • "url": {String} Service host URL
  • +
  • "name": {String} Service layer name
  • +
WMS + + Web Map Service
+Parameters: +
    +
  • "url": {String} Service host URL
  • +
  • "name": {String} Service layer name
  • +
  • "format": {String} Image MIME type
  • +
  • "tiled": {Boolean} Request tiled or full image
  • +
  • "username": {String} For basic auth if necessary
  • +
  • "password": {String} For basic auth if necessary
  • +
WMST + + Web Map Service Temporal
+Parameters: +
    +
  • "url": {String} Service host URL
  • +
  • "name": {String} Service layer name
  • +
  • "format": {String} Image MIME type
  • +
  • "tiled": {Boolean} Request tiled or full image
  • +
  • "username": {String} For basic auth if necessary
  • +
  • "password": {String} For basic auth if necessary
  • +
GEOJSON + + GeoJSON
+Parameters: +
    +
  • "data": {JSON} GeoJSON feature or collection
  • +
  • "url": {String} Request from URL if no data given
  • +
VTILES + + Vector Tiles
+Parameters: +
    +
  • "url": {String} Service host URL
  • +
  • "extent": {Array} Data extent if not set by server
  • +
WFS + + Web Feature Service
+Parameters: +
    +
  • "url": {String} Service host URL
  • +
  • "name": {String} Service layer type name
  • +
  • "format": {String} Response MIME type
  • +
  • "username": {String} For basic auth if necessary
  • +
  • "password": {String} For basic auth if necessary
  • +
GML + + Geography Markup Language
+Parameters: +
    +
  • "data": {String} GML document
  • +
KML + + Keyhole Markup Language
+Parameters: +
    +
  • "url": {String} KML document URL
  • +
GEOPACKAGE + + GeoPackage
+Parameters: +
    +
  • "data": {Array} GeoPackage file content
  • +
SPATIALITE + + Spatialite
+Parameters: +
    +
  • "data": {Array} Spatialite file content
  • +
SHAPEFILE + + Shapefile
+Parameters: +
    +
  • "data": {Array} Shapefile file content
  • +
WKT + + Well Known Text
+Parameters: +
    +
  • "data": {String} WKT content
  • +
HIDDEN + + Hidden Layer (not visible in Layer Tree, but may be used for feature queries etc.)
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

(readonly) Modules

+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
menu + + Menu Bar
layertree + + Layer Tree Panel
map + + Map View
controls + + Map Controls
attribution + + Map Layer Attribution
legend + + Legend Panel
geolocation + + Geolocation Controls
info + + Feature Info Popup
searchplace + + Search Place Panel
searchparcel + + Search Parcel Panel
toolbox + + Toolbox Panel
import + + Import Layer Modal
export + + Export Map Modal
timeslider + + Time Slider Panel
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

util

+ + + + +
+ General Purpose Pure Static Utility Functions +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..94039d7 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,65 @@ + + + + + JSDoc: Home + + + + + + + + + + +
+ +

Home

+ + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/netgis%0AThe%20main%20NetGIS%20Client%20class.netgis.Client.html b/docs/netgis%0AThe%20main%20NetGIS%20Client%20class.netgis.Client.html new file mode 100644 index 0000000..223d269 --- /dev/null +++ b/docs/netgis%0AThe%20main%20NetGIS%20Client%20class.netgis.Client.html @@ -0,0 +1,233 @@ + + + + + JSDoc: Class: netgis.Client + + + + + + + + + + +
+ +

Class: netgis.Client

+ + + + + + +
+ +
+ +

netgis.Client(container, config)

+ + +
+ +
+
+ + + + + + +

new netgis.Client(container, config)

+ + + + + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
container + + +Element + + + +
config + + +JSON + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/netgis.Attribution.html b/docs/netgis.Attribution.html new file mode 100644 index 0000000..e36549e --- /dev/null +++ b/docs/netgis.Attribution.html @@ -0,0 +1,328 @@ + + + + + JSDoc: Class: Attribution + + + + + + + + + + +
+ +

Class: Attribution

+ + + + + + +
+ +
+ +

+ netgis.Attribution(config)

+ + +
+ +
+
+ + + + + + +

new Attribution(config)

+ + + + + + +
+ Attribution Module. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
config + + +JSON + + + + Attribution.Config
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Members

+ + + +

(static) Config

+ + + + +
+ Config Section "attribution" +
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
prefix + + +String + + + + Prefix string to prepend
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/netgis.Client.html b/docs/netgis.Client.html new file mode 100644 index 0000000..59a2f5a --- /dev/null +++ b/docs/netgis.Client.html @@ -0,0 +1,461 @@ + + + + + JSDoc: Class: Client + + + + + + + + + + +
+ +

Class: Client

+ + + + + + +
+ +
+ +

+ netgis.Client(container, config)

+ + +
+ +
+
+ + + + + + +

new Client(container, config)

+ + + + + + +
+ The main NetGIS Client class. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
container + + +Element + + + + The HTML element to contain the client app
config + + +JSON + + + + The main client config object. Specific section options can be found inside the Modules.
+Client.Output
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Members

+ + + +

(static) Config

+ + + + +
+ Config Section "client" +
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
loading_text + + +String + + + + Text for the main loading indicator.
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

(static) Output

+ + + + +
+ Config Section "output" +
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
id + + +String + + + + Element id to write edit output to (sets the input value)
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/netgis.Controls.html b/docs/netgis.Controls.html new file mode 100644 index 0000000..6bee9ea --- /dev/null +++ b/docs/netgis.Controls.html @@ -0,0 +1,331 @@ + + + + + JSDoc: Class: Controls + + + + + + + + + + +
+ +

Class: Controls

+ + + + + + +
+ +
+ +

+ netgis.Controls(config)

+ + +
+ +
+
+ + + + + + +

new Controls(config)

+ + + + + + +
+ Map Controls Module. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
config + + +JSON + + + + Controls.Config
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Members

+ + + +

(static) Config

+ + + + +
+ Config Section "controls" +
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buttons + + +Array + + + + Map control buttons. See Commands for special ID values. +
    +
  • Button Items:
    { "id": {String}, "icon": {String}, "title": {String} }
  • +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/netgis.Export.html b/docs/netgis.Export.html new file mode 100644 index 0000000..7689b42 --- /dev/null +++ b/docs/netgis.Export.html @@ -0,0 +1,420 @@ + + + + + JSDoc: Class: Export + + + + + + + + + + +
+ +

Class: Export

+ + + + + + +
+ +
+ +

+ netgis.Export(config)

+ + +
+ +
+
+ + + + + + +

new Export(config)

+ + + + + + +
+ Export Module. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
config + + +JSON + + + + Export.Config
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Members

+ + + +

(static) Config

+ + + + +
+ Config Section "export" +
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
title + + +String + + + + Modal title
logo + + +String + + + + Exported image logo
gif_worker + + +String + + + + Path to GIFJS web worker script
default_filename + + +String + + + + Default exported file name
default_margin + + +Number + + + + Default exported image margin
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/netgis.Geolocation.html b/docs/netgis.Geolocation.html new file mode 100644 index 0000000..3c74555 --- /dev/null +++ b/docs/netgis.Geolocation.html @@ -0,0 +1,351 @@ + + + + + JSDoc: Class: Geolocation + + + + + + + + + + +
+ +

Class: Geolocation

+ + + + + + +
+ +
+ +

+ netgis.Geolocation(config)

+ + +
+ +
+
+ + + + + + +

new Geolocation(config)

+ + + + + + +
+ Geolocation Module. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
config + + +JSON + + + + Geolocation.Config
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Members

+ + + +

(static) Config

+ + + + +
+ Config Section "geolocation" +
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
marker_color + + +String + + + + Marker color
marker_title + + +String + + + + Marker title
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/netgis.Import.html b/docs/netgis.Import.html new file mode 100644 index 0000000..7c54164 --- /dev/null +++ b/docs/netgis.Import.html @@ -0,0 +1,512 @@ + + + + + JSDoc: Class: Import + + + + + + + + + + +
+ +

Class: Import

+ + + + + + +
+ +
+ +

+ netgis.Import(config)

+ + +
+ +
+
+ + + + + + +

new Import(config)

+ + + + + + +
+ Import Module. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
config + + +JSON + + + + Import.Config
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Members

+ + + +

(static) Config

+ + + + +
+ Config Section "import" +
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
title + + +String + + + + Import modal title
preview + + +Boolean + + + + Show feature preview for certain formats
wms_options + + +Array + + + + List of string options for the URL input
wfs_options + + +Array + + + + List of string options for the URL input
wfs_proxy + + +String + + + + Path to a proxy script to prepend for WFS requests
geopackage_lib + + +String + + + + Path to the GeoPackage library
geoportal_tab + + +Boolean + + + + Show Geoportal tab in import modal
geoportal_search_url + + +String + + + + URL to send search requests to, should contain {query} placeholder
geoportal_autocomplete + + +Boolean + + + + Enable Geoportal search autocomplete on key press
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/netgis.Info.html b/docs/netgis.Info.html new file mode 100644 index 0000000..6f9cdfb --- /dev/null +++ b/docs/netgis.Info.html @@ -0,0 +1,328 @@ + + + + + JSDoc: Class: Info + + + + + + + + + + +
+ +

Class: Info

+ + + + + + +
+ +
+ +

+ netgis.Info(config)

+ + +
+ +
+
+ + + + + + +

new Info(config)

+ + + + + + +
+ Feature Info Module. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
config + + +JSON + + + + Info.Config
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Members

+ + + +

(static) Config

+ + + + +
+ Config Section "info" +
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
default_format + + +String + + + + Default MIME type for Get Feature Info requests
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/netgis.LayerTree.html b/docs/netgis.LayerTree.html new file mode 100644 index 0000000..a666a62 --- /dev/null +++ b/docs/netgis.LayerTree.html @@ -0,0 +1,449 @@ + + + + + JSDoc: Class: LayerTree + + + + + + + + + + +
+ +

Class: LayerTree

+ + + + + + +
+ +
+ +

+ netgis.LayerTree(config)

+ + +
+ +
+
+ + + + + + +

new LayerTree(config)

+ + + + + + +
+ Layer Tree Module. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
config + + +JSON + + + + LayerTree.Config
+LayerTree.Folders
+Map.Layers
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Members

+ + + +

(static) Config

+ + + + +
+ Config Section "layertree" +
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
open + + +Boolean + + + + Open panel at startup
title + + +String + + + + Panel title
buttons + + +Array + + + + Additional buttons below the tree. See Commands for special ID values. +
    +
  • Button Items:
    { "id": {String}, "title": {String} }
  • +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

(static) Folders :Array

+ + + + +
+ Config Section "folders" +
    +
  • Layer Tree Folder Items:
    { "id": {String}, "title": {String}, "parent": {String}, "radio": {Boolean} }
  • +
+
+ + + +
Type:
+
    +
  • + +Array + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/netgis.Legend.html b/docs/netgis.Legend.html new file mode 100644 index 0000000..99d41c1 --- /dev/null +++ b/docs/netgis.Legend.html @@ -0,0 +1,328 @@ + + + + + JSDoc: Class: Legend + + + + + + + + + + +
+ +

Class: Legend

+ + + + + + +
+ +
+ +

+ netgis.Legend(config)

+ + +
+ +
+
+ + + + + + +

new Legend(config)

+ + + + + + +
+ Map Legend Module. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
config + + +JSON + + + + Legend.Config
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Members

+ + + +

(static) Config

+ + + + +
+ Config Section "legend" +
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
open + + +Boolean + + + + Open panel at startup.
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/netgis.Map.html b/docs/netgis.Map.html new file mode 100644 index 0000000..8bafcbb --- /dev/null +++ b/docs/netgis.Map.html @@ -0,0 +1,1558 @@ + + + + + JSDoc: Class: Map + + + + + + + + + + +
+ +

Class: Map

+ + + + + + +
+ +
+ +

+ netgis.Map(config)

+ + +
+ +
+
+ + + + + + +

new Map(config)

+ + + + + + +
+ Map Module Implementation for OpenLayers 3+. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
config + + +JSON + + + + Map.Config
+Map.Projections
+Map.Layers
+Map.Measure
+Map.Tools
+Map.Styles
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Members

+ + + +

(static) Config

+ + + + +
+ Config Section "map" +
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
projection + + +String + + + + Default map projection ID, see Projections
center + + +Array + + + + Default center coordinates, [ x, y ]
center_lonlat + + +Array + + + + Default center coordinates in Longitude/Latitude, [ lon, lat ]
zoom + + +Number + + + + Default zoom level
min_zoom + + +Number + + + + Minimum zoom level
max_zoom + + +Number + + + + Maximum zoom level
scalebar + + +Boolean + + + + Display a dynamic scalebar on the map
extent + + +Array + + + + Default map extent to zoom, [ minx, miny, maxx, maxy ]
scales + + +Array + + + + Available scale denominators, [ 500, 1000, ... ]
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

(static) Layers :Array

+ + + + +
+ Config Section "layers" +
    +
  • Basic Layer Item Parameters: +
      +
    • "id": {String} Unique layer ID, see Layer IDs to avoid conflicts
    • +
    • "folder": {String} Parent folder ID or null for top level, see LayerTree.Folders
    • +
    • "title": {String} Layer title in the layer tree
    • +
    • "attribution": {String} Copyright string for the Attribution Module
    • +
    • "active": {Boolean} Layer is visible at startup
    • +
    • "order": {Number} Order value for map layer stack sorting
    • +
    • "type": {String} Layer type, see LayerTypes for more type specific parameters
    • +
    +
  • +
  • Layer Display Parameters: +
      +
    • "min_zoom": {Number} Minimum zoom level for this layer
    • +
    • "max_zoom": {Number} Maximum zoom level for this layer
    • + +
    • "transparency": {Number} Transparency value from 0.0 (fully opaque) to 1.0 (fully transparent)
    • +
    • "fill": {String} Fill color for simple vector style in CSS format
    • +
    • "stroke": {String} Stroke color for simple vector style in CSS format
    • +
    • "width": {Number} Stroke width for simple vector style in pixels
    • +
    • "style": {JSON} Advanced vector style parameters, see Map.Styles
    • +
    +
  • +
  • Info Query Parameters (see Info Module): +
      +
    • "query": {Boolean} Enable info queries on this layer
    • +
    • "query_url": {String} Info service URL, may contain {x}, {y}, {bbox}, {proj}, {width}, {height}, {px}, {py} placeholders
    • +
    +
  • +
+
+ + + +
Type:
+
    +
  • + +Array + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

(static) Measure

+ + + + +
+ Config Section "measure" +
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
line_color + + +String + + + + Line color in CSS format
line_width + + +Number + + + + Line width in pixels
line_dash + + +Array + + + + Line dash pattern [ SpaceWidth, LineWidth ]
area_fill + + +String + + + + Area fill color in CSS format
point_radius + + +Number + + + + Point radius in pixels
point_fill + + +String + + + + Point fill color in CSS format
point_stroke + + +String + + + + Point stroke color in CSS format
text_color + + +String + + + + Text label color in CSS format
text_back + + +String + + + + Text label buffer color in CSS format
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

(static) Projections :Array

+ + + + +
+ Config Section "projections" +
    +
  • Projection Definitions:
    [ "ID", "Proj4 Definition" ]
  • +
+
+ + + +
Type:
+
    +
  • + +Array + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

(static) Styles

+ + + + +
+ Config Section "styles"
+Common Parameters: +
    +
  • "fill": {String} Fill color in CSS format
  • +
  • "stroke": {String} Stroke color in CSS format
  • +
  • "width": {Number} Stroke width in pixels
  • +
  • "radius": {Number} Point radius in pixels
  • +
  • "viewport_labels": {Boolean} Try to keep text labels inside map view (experimental)
  • +
+
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
draw + + +JSON + + + + Default draw feature style
non_edit + + +JSON + + + + Default non-editable feature style
select + + +JSON + + + + Default select feature style
sketch + + +JSON + + + + Default draw sketch feature style
error + + +JSON + + + + Default draw error style
bounds + + +JSON + + + + Default edit boundary style
modify + + +JSON + + + + Default feature modify style
parcel + + +JSON + + + + Default parcels style
import + + +JSON + + + + Default imported features style
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +

(static) Tools

+ + + + +
+ Config Section "tools" +
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
editable + + +Boolean + + + + Enable edit tools
interactive_render + + +Boolean + + + + Enable interactive rendering while editing
select_multi_reset + + +Boolean + + + + Reset multi selection after each select action
buffer + + +JSON + + + + Default buffer settings +
    +
  • "default_radius": {Number}
  • +
  • "default_segments": {Number}
  • +
snapping + + +JSON + + + + Default snapping settings +
    +
  • "show": {Boolean}
  • +
  • "active": {Boolean}
  • +
  • "tolerance": {Number}
  • +
bounds + + +String + + + + Boundary polygons for drawing tools in GeoJSON format (or leave undefined for no bounds checking)
bounds_message + + +String + + + + Message to display if editing out of bounds
show_bounds + + +Boolean + + + + Show boundary polygons on map
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/netgis.Menu.html b/docs/netgis.Menu.html new file mode 100644 index 0000000..c0cf9bc --- /dev/null +++ b/docs/netgis.Menu.html @@ -0,0 +1,378 @@ + + + + + JSDoc: Class: Menu + + + + + + + + + + +
+ +

Class: Menu

+ + + + + + +
+ +
+ +

+ netgis.Menu(config)

+ + +
+ +
+
+ + + + + + + + + + + + + +
+ Menu Bar Module. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
config + + +JSON + + + + Menu.Config
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Members

+ + + +

(static) Config

+ + + + +
+ Config Section "menu" +
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
header + + +String + + + + HTML content for the logo area in the top left.
items + + +Array + + + + An array of menu items. See Commands for special ID values. +
    +
  • Basic Items:
    { "id": {String}, "title": {String} }
  • +
  • Nested Items:
    { "title": {String}, "items": {Array} }
  • +
compact + + +Boolean + + + + Display smaller sub items in dropdowns.
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/netgis.OWS.html b/docs/netgis.OWS.html new file mode 100644 index 0000000..e17e572 --- /dev/null +++ b/docs/netgis.OWS.html @@ -0,0 +1,328 @@ + + + + + JSDoc: Class: OWS + + + + + + + + + + +
+ +

Class: OWS

+ + + + + + +
+ +
+ +

+ netgis.OWS(config)

+ + +
+ +
+
+ + + + + + +

new OWS(config)

+ + + + + + +
+ OWS Context Parsing Module. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
config + + +JSON + + + + OWS.Config
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Members

+ + + +

(static) Config

+ + + + +
+ Config Section "ows" +
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
url + + +String + + + + URL to a OWS context to load at startup.
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/netgis.SearchParcel.html b/docs/netgis.SearchParcel.html new file mode 100644 index 0000000..3694708 --- /dev/null +++ b/docs/netgis.SearchParcel.html @@ -0,0 +1,420 @@ + + + + + JSDoc: Class: SearchParcel + + + + + + + + + + +
+ +

Class: SearchParcel

+ + + + + + +
+ +
+ +

+ netgis.SearchParcel(config)

+ + +
+ +
+
+ + + + + + +

new SearchParcel(config)

+ + + + + + +
+ Search Parcels Module. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
config + + +JSON + + + + SearchParcel.Config
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Members

+ + + +

(static) Config

+ + + + +
+ Config Section "searchparcel" +
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
open + + +Boolean + + + + Show panel at startup
name_url + + +String + + + + District (Gemarkung) search URL, should contain {q} placeholder
parcel_url + + +String + + + + Parcel (Flurstück) search URL, should contain {district}, {field}, {parcelA}, {parcelB} placeholders
districts_service + + +JSON + + + + Layer settings for district features (Gemarkungen), see Map.Layers for options, e.g. LayerTypes.WFS
fields_service + + +JSON + + + + Layer settings for field features (Fluren), see Map.Layers for options, e.g. LayerTypes.WFS
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/netgis.SearchPlace.html b/docs/netgis.SearchPlace.html new file mode 100644 index 0000000..82dea4e --- /dev/null +++ b/docs/netgis.SearchPlace.html @@ -0,0 +1,420 @@ + + + + + JSDoc: Class: SearchPlace + + + + + + + + + + +
+ +

Class: SearchPlace

+ + + + + + +
+ +
+ +

+ netgis.SearchPlace(config)

+ + +
+ +
+
+ + + + + + +

new SearchPlace(config)

+ + + + + + +
+ Search Place Module. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
config + + +JSON + + + + SearchPlace.Config
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Members

+ + + +

(static) Config

+ + + + +
+ Config Section "searchplace" +
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
title + + +String + + + + Search input placeholder title
url + + +String + + + + URL to send search requests to, should contain {query} placeholder
zoom + + +Number + + + + Default zoom level for search results
marker_color + + +String + + + + Marker color for search results in CSS format
marker_title + + +String + + + + Marker title for search results
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/netgis.TimeSlider.html b/docs/netgis.TimeSlider.html new file mode 100644 index 0000000..dba93a9 --- /dev/null +++ b/docs/netgis.TimeSlider.html @@ -0,0 +1,276 @@ + + + + + JSDoc: Class: TimeSlider + + + + + + + + + + +
+ +

Class: TimeSlider

+ + + + + + +
+ +
+ +

+ netgis.TimeSlider(config)

+ + +
+ +
+
+ + + + + + +

new TimeSlider(config)

+ + + + + + +
+ Time Slider Module for WMST Layers. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
config + + +JSON + + + + TimeSlider.Config
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Members

+ + + +

(static) Config

+ + + + +
+ Config Section "timeslider" +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/netgis.Toolbox.html b/docs/netgis.Toolbox.html new file mode 100644 index 0000000..964ea5d --- /dev/null +++ b/docs/netgis.Toolbox.html @@ -0,0 +1,383 @@ + + + + + JSDoc: Class: Toolbox + + + + + + + + + + +
+ +

Class: Toolbox

+ + + + + + +
+ +
+ +

+ netgis.Toolbox(config)

+ + +
+ +
+
+ + + + + + +

new Toolbox(config)

+ + + + + + +
+ Toolbox Module +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
config + + +JSON + + + + Toolbox.Config
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Members

+ + + +

(static) Config

+ + + + +
+ Config Section "toolbox" +
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
open + + +Boolean + + + + Open panel at startup
items + + +Array + + + + Toolbox button items. See Commands for special ID values. +
    +
  • Button Items:
    { "id": {String}, "title": {String} }
  • +
options + + +Array + + + + Options panel settings for specific tools
+
    +
  • "buffer_features": { "title": {String}, "items": {Array} }
  • +
  • Option Items: { "id": {String}, "type": {String}, "title": {String} }
  • +
  • ID Values: "buffer_radius", "buffer_segments", "buffer_submit"
  • +
  • Type Values: "integer", "button"
  • +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/netgis.WMC.html b/docs/netgis.WMC.html new file mode 100644 index 0000000..cea883a --- /dev/null +++ b/docs/netgis.WMC.html @@ -0,0 +1,328 @@ + + + + + JSDoc: Class: WMC + + + + + + + + + + +
+ +

Class: WMC

+ + + + + + +
+ +
+ +

+ netgis.WMC(config)

+ + +
+ +
+
+ + + + + + +

new WMC(config)

+ + + + + + +
+ Web Map Context Parsing Module. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
config + + +JSON + + + + WMC.Config
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Members

+ + + +

(static) Config

+ + + + +
+ Config Section "wmc" +
+ + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
url + + +String + + + + URL to a WMC document to load at startup.
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/netgis.html b/docs/netgis.html new file mode 100644 index 0000000..37b9cef --- /dev/null +++ b/docs/netgis.html @@ -0,0 +1,182 @@ + + + + + JSDoc: Namespace: netgis + + + + + + + + + + +
+ +

Namespace: netgis

+ + + + + + +
+ +
+ +

netgis

+ + +
+ + + +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/scripts/linenumber.js b/docs/scripts/linenumber.js new file mode 100644 index 0000000..4354785 --- /dev/null +++ b/docs/scripts/linenumber.js @@ -0,0 +1,25 @@ +/*global document */ +(() => { + const source = document.getElementsByClassName('prettyprint source linenums'); + let i = 0; + let lineNumber = 0; + let lineId; + let lines; + let totalLines; + let anchorHash; + + if (source && source[0]) { + anchorHash = document.location.hash.substring(1); + lines = source[0].getElementsByTagName('li'); + totalLines = lines.length; + + for (; i < totalLines; i++) { + lineNumber++; + lineId = `line${lineNumber}`; + lines[i].id = lineId; + if (lineId === anchorHash) { + lines[i].className += ' selected'; + } + } + } +})(); diff --git a/docs/scripts/prettify/Apache-License-2.0.txt b/docs/scripts/prettify/Apache-License-2.0.txt new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/docs/scripts/prettify/Apache-License-2.0.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/docs/scripts/prettify/lang-css.js b/docs/scripts/prettify/lang-css.js new file mode 100644 index 0000000..041e1f5 --- /dev/null +++ b/docs/scripts/prettify/lang-css.js @@ -0,0 +1,2 @@ +PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", +/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); diff --git a/docs/scripts/prettify/prettify.js b/docs/scripts/prettify/prettify.js new file mode 100644 index 0000000..eef5ad7 --- /dev/null +++ b/docs/scripts/prettify/prettify.js @@ -0,0 +1,28 @@ +var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; +(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= +[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), +l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, +q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, +q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, +"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), +a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} +for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], +"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], +H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], +J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ +I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), +["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", +/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), +["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", +hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= +!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p th:last-child { border-right: 1px solid #ddd; } + +.ancestors, .attribs { color: #999; } +.ancestors a, .attribs a +{ + color: #999 !important; + text-decoration: none; +} + +.clear +{ + clear: both; +} + +.important +{ + font-weight: bold; + color: #950B02; +} + +.yes-def { + text-indent: -1000px; +} + +.type-signature { + color: #aaa; +} + +.name, .signature { + font-family: Consolas, Monaco, 'Andale Mono', monospace; +} + +.details { margin-top: 14px; border-left: 2px solid #DDD; } +.details dt { width: 120px; float: left; padding-left: 10px; padding-top: 6px; } +.details dd { margin-left: 70px; } +.details ul { margin: 0; } +.details ul { list-style-type: none; } +.details li { margin-left: 30px; padding-top: 6px; } +.details pre.prettyprint { margin: 0 } +.details .object-value { padding-top: 0; } + +.description { + margin-bottom: 1em; + margin-top: 1em; +} + +.code-caption +{ + font-style: italic; + font-size: 107%; + margin: 0; +} + +.source +{ + border: 1px solid #ddd; + width: 80%; + overflow: auto; +} + +.prettyprint.source { + width: inherit; +} + +.source code +{ + font-size: 100%; + line-height: 18px; + display: block; + padding: 4px 12px; + margin: 0; + background-color: #fff; + color: #4D4E53; +} + +.prettyprint code span.line +{ + display: inline-block; +} + +.prettyprint.linenums +{ + padding-left: 70px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.prettyprint.linenums ol +{ + padding-left: 0; +} + +.prettyprint.linenums li +{ + border-left: 3px #ddd solid; +} + +.prettyprint.linenums li.selected, +.prettyprint.linenums li.selected * +{ + background-color: lightyellow; +} + +.prettyprint.linenums li * +{ + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; +} + +.params .name, .props .name, .name code { + color: #4D4E53; + font-family: Consolas, Monaco, 'Andale Mono', monospace; + font-size: 100%; +} + +.params td.description > p:first-child, +.props td.description > p:first-child +{ + margin-top: 0; + padding-top: 0; +} + +.params td.description > p:last-child, +.props td.description > p:last-child +{ + margin-bottom: 0; + padding-bottom: 0; +} + +.disabled { + color: #454545; +} diff --git a/docs/styles/prettify-jsdoc.css b/docs/styles/prettify-jsdoc.css new file mode 100644 index 0000000..5a2526e --- /dev/null +++ b/docs/styles/prettify-jsdoc.css @@ -0,0 +1,111 @@ +/* JSDoc prettify.js theme */ + +/* plain text */ +.pln { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* string content */ +.str { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a keyword */ +.kwd { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a comment */ +.com { + font-weight: normal; + font-style: italic; +} + +/* a type name */ +.typ { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* a literal value */ +.lit { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* punctuation */ +.pun { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* lisp open bracket */ +.opn { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* lisp close bracket */ +.clo { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a markup tag name */ +.tag { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a markup attribute name */ +.atn { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a markup attribute value */ +.atv { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a declaration */ +.dec { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a variable name */ +.var { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* a function name */ +.fun { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; +} diff --git a/docs/styles/prettify-tomorrow.css b/docs/styles/prettify-tomorrow.css new file mode 100644 index 0000000..b6f92a7 --- /dev/null +++ b/docs/styles/prettify-tomorrow.css @@ -0,0 +1,132 @@ +/* Tomorrow Theme */ +/* Original theme - https://github.com/chriskempson/tomorrow-theme */ +/* Pretty printing styles. Used with prettify.js. */ +/* SPAN elements with the classes below are added by prettyprint. */ +/* plain text */ +.pln { + color: #4d4d4c; } + +@media screen { + /* string content */ + .str { + color: #718c00; } + + /* a keyword */ + .kwd { + color: #8959a8; } + + /* a comment */ + .com { + color: #8e908c; } + + /* a type name */ + .typ { + color: #4271ae; } + + /* a literal value */ + .lit { + color: #f5871f; } + + /* punctuation */ + .pun { + color: #4d4d4c; } + + /* lisp open bracket */ + .opn { + color: #4d4d4c; } + + /* lisp close bracket */ + .clo { + color: #4d4d4c; } + + /* a markup tag name */ + .tag { + color: #c82829; } + + /* a markup attribute name */ + .atn { + color: #f5871f; } + + /* a markup attribute value */ + .atv { + color: #3e999f; } + + /* a declaration */ + .dec { + color: #f5871f; } + + /* a variable name */ + .var { + color: #c82829; } + + /* a function name */ + .fun { + color: #4271ae; } } +/* Use higher contrast and text-weight for printable form. */ +@media print, projection { + .str { + color: #060; } + + .kwd { + color: #006; + font-weight: bold; } + + .com { + color: #600; + font-style: italic; } + + .typ { + color: #404; + font-weight: bold; } + + .lit { + color: #044; } + + .pun, .opn, .clo { + color: #440; } + + .tag { + color: #006; + font-weight: bold; } + + .atn { + color: #404; } + + .atv { + color: #060; } } +/* Style */ +/* +pre.prettyprint { + background: white; + font-family: Consolas, Monaco, 'Andale Mono', monospace; + font-size: 12px; + line-height: 1.5; + border: 1px solid #ccc; + padding: 10px; } +*/ + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; } + +/* IE indents via margin-left */ +li.L0, +li.L1, +li.L2, +li.L3, +li.L4, +li.L5, +li.L6, +li.L7, +li.L8, +li.L9 { + /* */ } + +/* Alternate shading for lines */ +li.L1, +li.L3, +li.L5, +li.L7, +li.L9 { + /* */ } diff --git a/docs/util.html b/docs/util.html new file mode 100644 index 0000000..82c0037 --- /dev/null +++ b/docs/util.html @@ -0,0 +1,165 @@ + + + + + JSDoc: Class: util + + + + + + + + + + +
+ +

Class: util

+ + + + + + +
+ +
+ +

util()

+ + +
+ +
+
+ + + + + + +

new util()

+ + + + + + +
+ General Purpose Pure Static Utility Functions +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 4.0.4 on Tue Apr 29 2025 13:39:35 GMT+0200 (Mitteleuropäische Sommerzeit) +
+ + + + + \ No newline at end of file