[Mapbender-commits] r10314 - in trunk/mapbender/http/extensions/mobilemap2: . scripts/netgis styles

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Nov 4 00:34:31 PST 2019


Author: armin11
Date: 2019-11-04 00:34:31 -0800 (Mon, 04 Nov 2019)
New Revision: 10314

Modified:
   trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/client.html
   trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/component.js
   trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/config.js
   trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/events.js
   trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/layers.js
   trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/map.js
   trunk/mapbender/http/extensions/mobilemap2/styles/manager.css
   trunk/mapbender/http/extensions/mobilemap2/test_embed.html
Log:
New options for mobile client - allow digitize and georss - most of the old functions of wmc2ol.php should now be possible with this extension - need to be tested

Modified: trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/client.html
===================================================================
--- trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/client.html	2019-10-31 09:57:22 UTC (rev 10313)
+++ trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/client.html	2019-11-04 08:34:31 UTC (rev 10314)
@@ -382,7 +382,7 @@
 					<span data-content="title"></span>
 					<span class="pull-right">
 						<span class="btn-remove-group glyphicon glyphicon-remove" title="Dienst entfernen"></span>
-						<span class="icon-right glyphicon glyphicon-chevron-down"></span>
+						<span class="glyphicon glyphicon-chevron-down"></span>
 					</span>
 				</a>
 				<div class="collapse child-container">

Modified: trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/component.js
===================================================================
--- trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/component.js	2019-10-31 09:57:22 UTC (rev 10313)
+++ trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/component.js	2019-11-04 08:34:31 UTC (rev 10314)
@@ -133,6 +133,16 @@
 
 netgis.component.KML.prototype.name = "kml";
 
+/** GeoRSS */
+netgis.component.GeoRSS = function( data )
+{
+	this.data = data;
+	
+	return this;
+}
+
+netgis.component.GeoRSS.prototype.name = "georss";
+
 /** Extent */
 netgis.component.Extent = function( minx, miny, maxx, maxy )
 {

Modified: trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/config.js
===================================================================
--- trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/config.js	2019-10-31 09:57:22 UTC (rev 10313)
+++ trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/config.js	2019-11-04 08:34:31 UTC (rev 10314)
@@ -26,6 +26,8 @@
 	
 	/** List of available map projections (identifier and proj4 definition). */
 	MAP_PROJECTIONS:		[
+								[ "EPSG:31466", "+proj=tmerc +lat_0=0 +lon_0=6 +k=1 +x_0=2500000 +y_0=0 +ellps=bessel +towgs84=598.1,73.7,418.2,0.202,0.045,-2.455,6.7 +units=m +no_defs" ],
+
 								[ "EPSG:31467", "+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0 +ellps=bessel +datum=potsdam +units=m +no_defs" ],
 								[ "EPSG:25832", "+proj=utm +zone=32 +ellps=GRS80 +units=m +no_defs" ],
 								[ "EPSG:32632", "+proj=utm +zone=32 +ellps=WGS84 +datum=WGS84 +units=m +no_defs" ]
@@ -42,7 +44,13 @@
 	
 	/** Maximum number of map view history entries. */
 	MAX_HISTORY:			10,
-	
+
+	/** Default style for GeoRSS points. */
+	GEORSS_POINT_RADIUS:		8,
+	GEORSS_POINT_FILL_COLOR:	"#861d31",
+	GEORSS_POINT_STROKE_COLOR:	"white",
+	GEORSS_POINT_STROKE_WIDTH:	2,
+
 	/** Service URLs (avoid proxies by setting to null or empty string). */
 	//URL_WMC_PROXY:			"./scripts/proxy.php", //TODO: empty proxy to invoke from js client on same machine!!!
 	URL_WMC_PROXY:			"",

Modified: trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/events.js
===================================================================
--- trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/events.js	2019-10-31 09:57:22 UTC (rev 10313)
+++ trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/events.js	2019-11-04 08:34:31 UTC (rev 10314)
@@ -133,7 +133,9 @@
 			
 			POSITION_TOGGLE:	"position-toggle",
 			POSITION_CENTER:	"position-center",
-			POSITION_ERROR:		"position-error"
+			POSITION_ERROR:		"position-error",
+			
+			DIGITIZE_CLICK:		"digitize-click"
 		};
 		
 		return iface;

Modified: trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/layers.js
===================================================================
--- trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/layers.js	2019-10-31 09:57:22 UTC (rev 10313)
+++ trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/layers.js	2019-11-04 08:34:31 UTC (rev 10314)
@@ -44,6 +44,12 @@
 				else			
 					netgis.events.call( netgis.events.LAYERS_LOADING, { loading: false } );
 			}
+			
+			// GeoRSS
+			if ( netgis.params.get( "georss" ) )
+			{
+				createGeoRSS( decodeURIComponent( netgis.params.get( "georss" ) ) );
+			}
 		};
 		
 		var requestWmc = function( id )
@@ -171,6 +177,24 @@
 	
 			return serviceEntity;
 		};
+
+		var createGeoRSS = function( xml )
+		{
+			var data = $( $.parseXML( xml ) );
+			
+			var entity = netgis.entities.create
+			(
+				[
+					new netgis.component.Layer( -10 ),
+					new netgis.component.Title( "GeoRSS" ),
+					new netgis.component.GeoRSS( data ),
+					new netgis.component.Active()
+				],
+				true
+			);
+	
+			netgis.events.call( netgis.events.LAYERS_LOADING, { loading: false } );
+		};
 		
 		// Event Handlers
 		$( document ).ready( init );
@@ -367,7 +391,8 @@
 		var iface =
 		{
 			createService:	createService,
-			createLayer:	createLayer
+			createLayer:	createLayer,
+			createGeoRSS:	createGeoRSS
 		};
 		
 		return iface;

Modified: trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/map.js
===================================================================
--- trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/map.js	2019-10-31 09:57:22 UTC (rev 10313)
+++ trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/map.js	2019-11-04 08:34:31 UTC (rev 10314)
@@ -327,7 +327,8 @@
 			netgis.events.on( netgis.events.POSITION_CENTER, onPositionCenter );
 			
 			map.on( "moveend", onMapMoveEnd );
-			
+			if ( netgis.params.getInt( "withDigitize" ) === 1 ) map.on( "click", onDigitizeClick );
+
 			// History
 			history = [];
 			historyIndex = -1;
@@ -934,7 +935,7 @@
 			netgis.menu.clearSideContent();
 			netgis.menu.toggleSideMenu( true );
 			
-			// KML Feature Info
+			// KML / GeoRSS Feature Info
 			var features = [];
 			var pixel = map.getEventPixel( event.originalEvent );
 			
@@ -960,7 +961,7 @@
 				content += "<div class='panel panel-primary'>";
 
 				content += "<div class='panel-heading clickable' data-toggle='collapse' data-target='#" + panelId + "'>";
-				content += "<h4 class='panel-title'>" + "Zeichnungsobjekt" + "</h4>";
+				content += "<h4 class='panel-title'>" + feature.get( "title" ) + "</h4>";
 				content += "</div>";
 
 				content += "<div id='" + panelId + "' class='panel-collapse collapse'>";
@@ -1105,6 +1106,27 @@
 			// Go back to pan mode
 			//if ( ! netgis.sidebar.isVisible() ) pan();
 		};
+
+		var onDigitizeClick = function( evt )
+		{
+			var coords = evt.coordinate;
+			
+			if ( netgis.params.get( "xID" ) )
+			{
+				var id = netgis.params.getString( "xID" );
+				var element = $( "#" + id );
+				element.val( coords[ 0 ] );
+			}
+			
+			if ( netgis.params.get( "yID" ) )
+			{
+				var id = netgis.params.getString( "yID" );
+				var element = $( "#" + id );
+				element.val( coords[ 1 ] );
+			}
+			
+			netgis.events.call( netgis.events.DIGITIZE_CLICK, { x: coords[ 0 ], y: coords[ 1 ] } );
+		};
 		
 		var onPopupClose = function( event )
 		{
@@ -1139,7 +1161,138 @@
 			{
 				// Background Layers
 				createBackgroundLayers();
+
+				// GeoRSS Layers
+				var georssEntities = netgis.entities.get( [ netgis.component.Layer, netgis.component.GeoRSS ] );
 				
+				for ( var g = 0; g < georssEntities.length; g++ )
+				{
+					var georss = georssEntities[ g ];
+					var xml = georss.components.georss.data;
+					
+					var features = [];
+					
+					var entries = xml.find( "entry" );
+					
+					$.each
+					(
+						entries,
+						function( i, e )
+						{
+							var entry = $( e );
+							
+							// Geometry
+							var where = entry.find( "georss\\:where, where" ); //entry.find( "[nodeName='georss:where']" );
+							var point = where.find( "gml\\:Point, Point" );
+							var srsName = point.attr( "srsName" );
+							var pos = point.find( "gml\\:pos, pos" );
+							
+							// Coords
+							var coords = pos.text().split( " " );
+							coords[ 0 ] = parseFloat( coords[ 0 ] );
+							coords[ 1 ] = parseFloat( coords[ 1 ] );
+							
+							if ( srsName && srsName.length > 0 )
+								coords = ol.proj.transform( coords, srsName, netgis.config.MAP_PROJECTION );
+							else
+								coords = ol.proj.fromLonLat( coords, netgis.config.MAP_PROJECTION );
+							
+							// Feature
+							var feature = new ol.Feature
+							(
+								{
+									geometry: new ol.geom.Point( coords )
+								}
+							);
+					
+							// Style
+							var imageUrl = entry.find( "imageUrl" ).attr( "href" );
+							var imageSize = entry.find( "imageSize" ).text();
+							
+							if ( imageUrl )
+							{
+								imageSize = imageSize ? parseInt( imageSize ) : 10;
+								
+								var style = new ol.style.Style
+								(
+									{
+										image: new ol.style.Icon
+										(
+											{
+												src: imageUrl,
+												anchor: [ 0.5, 1.0 ],
+												//size: [ imageSize, imageSize ]
+											}
+										)
+									}
+								);
+						
+								feature.setStyle( style );
+							}
+							
+							// Properties
+							feature.set( "title", "GeoRSS-Objekt" );
+							
+							var html = "";
+							
+							var title = entry.find( "title" ).text();							
+							var link = entry.find( "link" ).attr( "href" );
+							
+							if ( title )
+							{
+								html += title;
+							}
+							
+							if ( link )
+							{
+								if ( title ) html += "<br/>";
+								html += "<a target='_blank' href='" + link + "'>" + link + "</a>";
+							}
+							
+							feature.set( "name", html );
+					
+							// Done
+							features.push( feature );
+						}
+					);
+					
+					var style = new ol.style.Style
+					(
+						{
+							image: new ol.style.Circle
+							(
+								{
+									radius: netgis.config.GEORSS_POINT_RADIUS,
+									fill: new ol.style.Fill( { color: netgis.config.GEORSS_POINT_FILL_COLOR } ),
+									stroke: new ol.style.Stroke( { color: netgis.config.GEORSS_POINT_STROKE_COLOR, width: netgis.config.GEORSS_POINT_STROKE_WIDTH } )
+								}
+							)
+						}
+					);
+					
+					var mapLayer = new ol.layer.Vector
+					(
+						{
+							source: new ol.source.Vector
+							(
+								{
+									features: features
+								}
+							),
+							style: style,
+							zIndex: 9999
+						}
+					);
+			
+					/*features = mapLayer.getSource().getFeatures();
+					for ( var f = 0; f < features.length; f++ )
+					{
+						features[ f ].set( "title", "GeoRSS-Objekt" );
+					}*/
+			
+					georss.set( new netgis.component.MapLayer( mapLayer ) );
+				}
+				
 				// KML Layers
 				var kmls = netgis.entities.get( [ netgis.component.Layer, netgis.component.KML ] );
 				
@@ -1163,6 +1316,14 @@
 						}
 					);
 			
+					// Set Features Title
+					var features = mapLayer.getSource().getFeatures();
+					
+					for ( var f = 0; f < features.length; f++ )
+					{
+						features[ f ].set( "title", "Zeichnungsobjekt" );
+					}
+			
 					kml.set( new netgis.component.MapLayer( mapLayer ) );
 					
 					//var hasStyle = mapLayer.getStyle() instanceof ol.style.Style.defaultFunction ? false : true;
@@ -1508,4 +1669,4 @@
 		
 		return iface;
 	}
-)();
\ No newline at end of file
+)();

Modified: trunk/mapbender/http/extensions/mobilemap2/styles/manager.css
===================================================================
--- trunk/mapbender/http/extensions/mobilemap2/styles/manager.css	2019-10-31 09:57:22 UTC (rev 10313)
+++ trunk/mapbender/http/extensions/mobilemap2/styles/manager.css	2019-11-04 08:34:31 UTC (rev 10314)
@@ -35,17 +35,36 @@
 .layer-list .btn-up
 {
 	color: blue;
-	/*margin-right: 0.5em;*/
-	margin-left: 0.5em;
 }
 
 .layer-list .btn-down
 {
 	color: blue;
-	/*margin-right: 1em;*/
-	margin-left: 0.5em;
 }
 
+.layer-list .pull-right
+{
+	position: absolute;
+	right: 0px;
+	top: 0px;
+	bottom: 0px;
+}
+
+.layer-list .pull-right > span
+{
+	display: block;
+	float: left;
+	height: 100%;
+	padding: 13px;
+	padding-top: 13px;
+	padding-bottom: 7px;
+}
+
+.layer-list .pull-right > span:hover
+{
+	background: lightgray;
+}
+
 #layer-results .btn-add
 {
 	color: green;

Modified: trunk/mapbender/http/extensions/mobilemap2/test_embed.html
===================================================================
--- trunk/mapbender/http/extensions/mobilemap2/test_embed.html	2019-10-31 09:57:22 UTC (rev 10313)
+++ trunk/mapbender/http/extensions/mobilemap2/test_embed.html	2019-11-04 08:34:31 UTC (rev 10314)
@@ -29,8 +29,18 @@
 	<body>
 		
 		<p>Embedded Geoportal Client:</p>
+		
 		<div id="geoportal-container" style="border: 1px solid red; width: 600px; height: 400px; margin-left: 100px;"></div>
 		
+		<hr/>
+		
+		<!-- Demo Digitize URL: "/test_embed.html?withDigitize=1&xID=input-x&yID=input-y" -->
+		<p>
+			Coordinates: 
+			<input id="input-x" type="text" />
+			<input id="input-y" type="text" />
+		</p>
+		
 		<script type="text/javascript" src="./libs/jquery/jquery.min.js"></script>
 		<script type="text/javascript" src="./libs/jquery-template/jquery.loadTemplate.min.js"></script>
 		<script type="text/javascript" src="./libs/bootstrap/js/bootstrap.min.js"></script>



More information about the Mapbender_commits mailing list