[Mapbender-commits] r9923 - in trunk/mapbender/http/extensions/mobilemap2: . scripts/netgis
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Jul 12 04:19:34 PDT 2018
Author: armin11
Date: 2018-07-12 04:19:34 -0700 (Thu, 12 Jul 2018)
New Revision: 9923
Modified:
trunk/mapbender/http/extensions/mobilemap2/index.html
trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/config.js
trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/map.js
trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/menu.js
Log:
Some bugfixes and enhancements from netgis for height information and ...
Modified: trunk/mapbender/http/extensions/mobilemap2/index.html
===================================================================
--- trunk/mapbender/http/extensions/mobilemap2/index.html 2018-07-12 07:26:36 UTC (rev 9922)
+++ trunk/mapbender/http/extensions/mobilemap2/index.html 2018-07-12 11:19:34 UTC (rev 9923)
@@ -10,7 +10,6 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>GeoPortal RLP</title>
@@ -144,6 +143,10 @@
<span id="measure-close" class="glyphicon glyphicon-remove clickable" style="margin-left: 0.25em"></span>
</div>
+ <div id="result-overlay">
+ <span class="glyphicon glyphicon-record"></span>
+ </div>
+
<div id="watermark-container" class="index-top small">
<a href="http://www.geoportal.rlp.de/portal/servicebereich/impressum.html" target="_blank">© GDI-RP</a>
</div>
@@ -162,6 +165,12 @@
<span class="glyphicon glyphicon-search icon-left"></span>
<strong>Suchergebnisse:</strong>
<span class="glyphicon glyphicon-remove pull-right"></span>
+ <div id="search-message">
+ <div class="alert alert-info">
+ <strong>Ihre Ortsuche ergab keine Treffer. Tipp: Trennen Sie mehrere Suchbegriffe mit einem Komma!</strong><br/>
+ Beispiel: <i>„Von-Kuhl-Straße 49, Koblenz“</i>
+ </div>
+ </div>
</a>
</div>
</div>
Modified: trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/config.js
===================================================================
--- trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/config.js 2018-07-12 07:26:36 UTC (rev 9922)
+++ trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/config.js 2018-07-12 11:19:34 UTC (rev 9923)
@@ -55,5 +55,10 @@
URL_BACKGROUND_HYBRID: "http://www.gdi-rp-dienste2.rlp.de/mapcache/tms/1.0.0/test@UTM32",
URL_BACKGROUND_AERIAL: "http://geo4.service24.rlp.de/wms/dop_basis.fcgi",
- URL_FEATURE_INFO_PROXY: "./scripts/proxy.php"
+ URL_FEATURE_INFO_PROXY: "./scripts/proxy.php",
+",
+
+ URL_HEIGHT_PROXY: "./scripts/proxy.php",
+ URL_HEIGHT_REQUEST: "http://www.geoportal.rlp.de/mapbender/extensions/mobilemap/query/rasterqueryWms.php?&lang=de" //"http://www.gdi-rp-dienste2.rlp.de/cgi-bin/mapserv.fcgi?map=/data/umn/geoportal/dhm_query/dhm.map&" + "SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&SERVICE=WMS&LAYERS=mydhm&QUERY_LAYERS=mydhm"
+
};
Modified: trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/map.js
===================================================================
--- trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/map.js 2018-07-12 07:26:36 UTC (rev 9922)
+++ trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/map.js 2018-07-12 11:19:34 UTC (rev 9923)
@@ -45,6 +45,8 @@
var measureContent;
var measureClose;
+ var resultOverlay;
+
var backLayerHybrid;
var backLayerAerial;
@@ -227,6 +229,15 @@
map.addOverlay( measureOverlay );
+ // Search Result Overlay
+ resultOverlay = new ol.Overlay
+ (
+ {
+ element: $( "#result-overlay" )[ 0 ],
+ positioning: 'center-center'
+ }
+ );
+
// Interactions
interactions.pan = new ol.interaction.DragPan
(
@@ -535,6 +546,11 @@
addHistory( view.getCenter(), view.getZoom() );
};
+ var getScale = function()
+ {
+ return getScaleFromResolution( view.getResolution() );
+ };
+
var addHistory = function( center, zoom )
{
// No duplicates at the end
@@ -571,7 +587,7 @@
var getResolutionFromScale = function( scale )
{
var mpu = view ? ol.proj.METERS_PER_UNIT[ view.getProjection().getUnits() ] : 1.0;
- var ipu = mpu * 39.3701;
+ var ipu = mpu * 39.3701; // inches per unit = 39.3701
var dpi = 72;
var res = 1 / ( normalizeScale( scale ) * ipu * dpi );
@@ -584,6 +600,16 @@
return 1 < scale ? 1 / scale : scale;
};
+ var getScaleFromResolution = function( res )
+ {
+ var scale = 39.3701 * 72 * res;
+
+ // Round
+ scale = Math.round( scale );
+
+ return scale;
+ };
+
var createLayerWms = function( url, layerName, index )
{
//var type = ol.source.TileWMS;
@@ -813,6 +839,23 @@
netgis.events.call( netgis.events.LAYER_TOGGLE, { id: backLayer.id } );
};
+ var showPopup = function( x, y, content )
+ {
+ // Clear
+ popupContent.empty();
+
+ popupContent.append( content );
+
+ // Show Popup
+ popupContainer.fadeIn( 200 );
+ popupOverlay.setPosition( [ x, y ] );
+ };
+
+ var hidePopup = function()
+ {
+ popupContainer.fadeOut( 200 );
+ };
+
// Event Handlers
$( document ).ready( init );
@@ -897,6 +940,7 @@
popupContent.append( element );
}
+ // WMS Feature Info
var layers = netgis.entities.get( [ netgis.component.Layer, netgis.component.Active, netgis.component.Queryable ] );
//console.info( "QUERY:", layers );
@@ -969,10 +1013,53 @@
}
}
);
-
+
+ // Height Info
+ var heightUrl = netgis.config.URL_HEIGHT_REQUEST + "&coord=" + event.coordinate.join( "," );
+
+ if ( netgis.config.URL_HEIGHT_PROXY && netgis.config.URL_HEIGHT_PROXY.length > 0 )
+ heightUrl = netgis.config.URL_HEIGHT_PROXY + "?q=" + encodeURIComponent( heightUrl );
+
+ $.get
+ (
+ heightUrl,
+ {
+ },
+ function( data )
+ {
+ var panelId = "popup-panel-height";
+
+ var content = "<p></p>";
+
+ content += "<div class='panel panel-primary'>";
+
+ content += "<div class='panel-heading clickable' data-toggle='collapse' data-target='#" + panelId + "'>";
+ content += "<h4 class='panel-title'>" + "Digitales Höhenmodell" + "</h4>";
+ content += "</div>";
+
+ content += "<div id='" + panelId + "' class='panel-collapse collapse'>";
+ content += "<div class='panel-body'>";
+ content += data;
+ content += "</div>";
+ content += "</div>";
+
+ content += "</div>";
+
+ content += "</div>";
+
+ var element = $( content );
+ element.find( ".panel-heading" ).click( function() { element.find( "#" + panelId ).collapse( "toggle" ); } );
+
+ popupContent.append( element );
+ }
+ );
+
+ // Show Popup
popupContainer.fadeIn( 200 );
popupOverlay.setPosition( event.coordinate );
+ //TODO: use showPopup method
+
// Go back to pan mode
//if ( ! netgis.sidebar.isVisible() ) pan();
};
@@ -1355,13 +1442,16 @@
isPositionCenter: isPositionCenter,
setBackgroundLayer: setBackgroundLayer,
setScale: setScale,
+ getScale: getScale,
+ showPopup: showPopup,
+ hidePopup: hidePopup,
- setInteraction: setInteraction,
- interactions: interactions,
+ setInteraction: setInteraction,
+ interactions: interactions,
- update: update
+ update: update
};
return iface;
}
-)();
\ No newline at end of file
+)();
Modified: trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/menu.js
===================================================================
--- trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/menu.js 2018-07-12 07:26:36 UTC (rev 9922)
+++ trunk/mapbender/http/extensions/mobilemap2/scripts/netgis/menu.js 2018-07-12 11:19:34 UTC (rev 9923)
@@ -6,7 +6,7 @@
/**
* The NetGIS Menu module.
- * @namespace
+ * @namespace
*/
netgis.menu =
(
@@ -23,6 +23,8 @@
var searchQuery;
//var searchSpinner;
var searchButton;
+ var searchMessage;
+ var scaleItems;
var legendPanel;
var geolocationDialog;
@@ -36,6 +38,7 @@
searchList = $( "#search-list" );
//searchSpinner = $( "#search-spinner" );
searchButton = $( "#search-button" );
+ searchMessage = $( "#search-message" );
legendPanel = $( "#legend-panel" );
geolocationDialog = $( "#geolocation-dialog" );
@@ -50,19 +53,17 @@
for ( var s = 0; s < scales.length; s++ )
{
var item = "<li data-scale='" + scales[ s ] + "'>";
-
item += "<a href='#' class='btn-scale'>";
-
+ item += "<span class='icon-left glyphicon glyphicon-unchecked'></span>";
item += "1 : " + scales[ s ];
-
item += "</a>";
-
item += "</li>";
scaleMenu.append( item );
}
- scaleMenu.find( ".btn-scale" ).click( onScaleClick );
+ scaleItems = scaleMenu.find( ".btn-scale" );
+ scaleItems.click( onScaleClick );
searchInput.val( "" );
@@ -100,6 +101,8 @@
netgis.events.on( netgis.events.POSITION_TOGGLE, onPositionToggle );
netgis.events.on( netgis.events.POSITION_CENTER, onPositionCenter );
netgis.events.on( netgis.events.POSITION_ERROR, onPositionError );
+
+ netgis.events.on( netgis.events.MAP_MOVE, onMapMove );
};
//TODO: testing
@@ -575,8 +578,6 @@
var onSearchResponse = function( data, status, xhr )
{
- //console.info( "SEARCH RESPONSE:", status, data );
-
// Clear
searchList.children().first().nextAll().remove();
@@ -586,7 +587,13 @@
if ( searchResults.length > 0 )
{
searchPanel.collapse( "show" );
+ searchMessage.hide();
}
+ else
+ {
+ searchPanel.collapse( "show" );
+ searchMessage.show();
+ }
for ( var r = 0; r < searchResults.length; r++ )
{
@@ -634,7 +641,16 @@
if ( result )
{
+ if ( result.category === "str" || result.category === "haus" )
+ netgis.map.showPopup( ( parseFloat( result.minx ) + parseFloat( result.maxx ) ) / 2, ( parseFloat( result.miny ) + parseFloat( result.maxy ) ) / 2, result.title );
+ else
+ netgis.map.hidePopup();
+
netgis.map.viewExtent( result.minx, result.miny, result.maxx, result.maxy );
+
+ if ( netgis.config.MIN_SEARCH_SCALE && netgis.map.getScale() < netgis.config.MIN_SEARCH_SCALE )
+ netgis.map.setScale( netgis.config.MIN_SEARCH_SCALE );
+
searchPanel.collapse( "hide" );
$( ".navbar-collapse" ).collapse( "hide" ); //TODO: menu.hide()
}
@@ -672,6 +688,24 @@
}
};
+ var onMapMove = function( evt )
+ {
+ var scale = netgis.map.getScale();
+
+ scaleItems.each
+ (
+ function( key, value )
+ {
+ var item = $( value ).parent();
+ var icon = item.find( ".glyphicon" );
+
+ var checked = ( scale === item.data( "scale" ) );
+ icon.toggleClass( "glyphicon-check", checked );
+ icon.toggleClass( "glyphicon-unchecked", ! checked );
+ }
+ );
+ };
+
// Public Interface
var iface =
{
@@ -680,4 +714,4 @@
return iface;
}
-)();
\ No newline at end of file
+)();
More information about the Mapbender_commits
mailing list