[mapguide-commits] r7795 - in trunk/MgDev/Doc/samples/ol2samples: . commercial mixed tiled
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Wed Aug 21 09:37:18 PDT 2013
Author: jng
Date: 2013-08-21 09:37:17 -0700 (Wed, 21 Aug 2013)
New Revision: 7795
Added:
trunk/MgDev/Doc/samples/ol2samples/commercial/SheboyganCommercial.MapDefinition.xml
trunk/MgDev/Doc/samples/ol2samples/commercial/index.html
trunk/MgDev/Doc/samples/ol2samples/mixed/
trunk/MgDev/Doc/samples/ol2samples/mixed/SheboyganMixed.MapDefinition.xml
trunk/MgDev/Doc/samples/ol2samples/mixed/index.html
Removed:
trunk/MgDev/Doc/samples/ol2samples/querymap/
Modified:
trunk/MgDev/Doc/samples/ol2samples/tiled/index.html
Log:
#2344: Add more samples
- An example of a mixed tiled/untiled Map Definition
- An example of a WGS84.PseudoMercator Map Definition with Google/OSM layers
Added: trunk/MgDev/Doc/samples/ol2samples/commercial/SheboyganCommercial.MapDefinition.xml
===================================================================
--- trunk/MgDev/Doc/samples/ol2samples/commercial/SheboyganCommercial.MapDefinition.xml (rev 0)
+++ trunk/MgDev/Doc/samples/ol2samples/commercial/SheboyganCommercial.MapDefinition.xml 2013-08-21 16:37:17 UTC (rev 7795)
@@ -0,0 +1,116 @@
+<?xml version="1.0"?>
+<MapDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:noNamespaceSchemaLocation="MapDefinition-1.0.0.xsd">
+ <Name>Sheboygan Map</Name>
+ <CoordinateSystem>PROJCS["WGS84.PseudoMercator",GEOGCS["LL84",DATUM["WGS84",SPHEROID["WGS84",6378137.000,298.25722293]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Popular Visualisation Pseudo Mercator"],PARAMETER["false_easting",0.000],PARAMETER["false_northing",0.000],PARAMETER["central_meridian",0.00000000000000],UNIT["Meter",1.00000000000000]]</CoordinateSystem>
+ <Extents>
+ <MinX>-9769953.6613122653</MinX>
+ <MaxX>-9762220.7994439267</MaxX>
+ <MinY>5417808.8801717851</MinY>
+ <MaxY>5434161.2241863841</MaxY>
+ </Extents>
+ <BackgroundColor>ffcdbd9c</BackgroundColor>
+ <MapLayer>
+ <Name>Roads</Name>
+ <ResourceId>Library://Samples/Sheboygan/Layers/Roads.LayerDefinition</ResourceId>
+ <Selectable>false</Selectable>
+ <ShowInLegend>true</ShowInLegend>
+ <LegendLabel>Roads</LegendLabel>
+ <ExpandInLegend>true</ExpandInLegend>
+ <Visible>true</Visible>
+ <Group>Transportation</Group>
+ </MapLayer>
+ <MapLayer>
+ <Name>Rail Lines</Name>
+ <ResourceId>Library://Samples/Sheboygan/Layers/Tracks.LayerDefinition</ResourceId>
+ <Selectable>false</Selectable>
+ <ShowInLegend>true</ShowInLegend>
+ <LegendLabel>Rail Lines</LegendLabel>
+ <ExpandInLegend>true</ExpandInLegend>
+ <Visible>false</Visible>
+ <Group>Transportation</Group>
+ </MapLayer>
+ <MapLayer>
+ <Name>Districts</Name>
+ <ResourceId>Library://Samples/Sheboygan/Layers/Districts.LayerDefinition</ResourceId>
+ <Selectable>false</Selectable>
+ <ShowInLegend>true</ShowInLegend>
+ <LegendLabel>Districts</LegendLabel>
+ <ExpandInLegend>true</ExpandInLegend>
+ <Visible>true</Visible>
+ <Group>Municipal</Group>
+ </MapLayer>
+ <MapLayer>
+ <Name>Buildings</Name>
+ <ResourceId>Library://Samples/Sheboygan/Layers/Buildings.LayerDefinition</ResourceId>
+ <Selectable>false</Selectable>
+ <ShowInLegend>true</ShowInLegend>
+ <LegendLabel>Buildings</LegendLabel>
+ <ExpandInLegend>true</ExpandInLegend>
+ <Visible>true</Visible>
+ <Group>Municipal</Group>
+ </MapLayer>
+ <MapLayer>
+ <Name>Parcels</Name>
+ <ResourceId>Library://Samples/Sheboygan/Layers/Parcels.LayerDefinition</ResourceId>
+ <Selectable>true</Selectable>
+ <ShowInLegend>true</ShowInLegend>
+ <LegendLabel>Parcels</LegendLabel>
+ <ExpandInLegend>true</ExpandInLegend>
+ <Visible>true</Visible>
+ <Group>Municipal</Group>
+ </MapLayer>
+ <MapLayer>
+ <Name>Islands</Name>
+ <ResourceId>Library://Samples/Sheboygan/Layers/Islands.LayerDefinition</ResourceId>
+ <Selectable>false</Selectable>
+ <ShowInLegend>true</ShowInLegend>
+ <LegendLabel>Islands</LegendLabel>
+ <ExpandInLegend>true</ExpandInLegend>
+ <Visible>true</Visible>
+ <Group>Base Map</Group>
+ </MapLayer>
+ <MapLayer>
+ <Name>Hydrography</Name>
+ <ResourceId>Library://Samples/Sheboygan/Layers/Hydrography.LayerDefinition</ResourceId>
+ <Selectable>false</Selectable>
+ <ShowInLegend>true</ShowInLegend>
+ <LegendLabel>Hydrography</LegendLabel>
+ <ExpandInLegend>true</ExpandInLegend>
+ <Visible>true</Visible>
+ <Group>Base Map</Group>
+ </MapLayer>
+ <MapLayer>
+ <Name>CityLimits</Name>
+ <ResourceId>Library://Samples/Sheboygan/Layers/CityLimits.LayerDefinition</ResourceId>
+ <Selectable>false</Selectable>
+ <ShowInLegend>true</ShowInLegend>
+ <LegendLabel>CityLimits</LegendLabel>
+ <ExpandInLegend>true</ExpandInLegend>
+ <Visible>true</Visible>
+ <Group>Base Map</Group>
+ </MapLayer>
+ <MapLayerGroup>
+ <Name>Base Map</Name>
+ <Visible>true</Visible>
+ <ShowInLegend>true</ShowInLegend>
+ <ExpandInLegend>true</ExpandInLegend>
+ <LegendLabel>Base Map</LegendLabel>
+ <Group />
+ </MapLayerGroup>
+ <MapLayerGroup>
+ <Name>Municipal</Name>
+ <Visible>true</Visible>
+ <ShowInLegend>true</ShowInLegend>
+ <ExpandInLegend>true</ExpandInLegend>
+ <LegendLabel>Municipal</LegendLabel>
+ <Group />
+ </MapLayerGroup>
+ <MapLayerGroup>
+ <Name>Transportation</Name>
+ <Visible>true</Visible>
+ <ShowInLegend>true</ShowInLegend>
+ <ExpandInLegend>true</ExpandInLegend>
+ <LegendLabel>Transportation</LegendLabel>
+ <Group />
+ </MapLayerGroup>
+</MapDefinition>
\ No newline at end of file
Added: trunk/MgDev/Doc/samples/ol2samples/commercial/index.html
===================================================================
--- trunk/MgDev/Doc/samples/ol2samples/commercial/index.html (rev 0)
+++ trunk/MgDev/Doc/samples/ol2samples/commercial/index.html 2013-08-21 16:37:17 UTC (rev 7795)
@@ -0,0 +1,241 @@
+<html>
+ <head>
+ <title>Sheboygan map with Google/OSM layers</title>
+ <link rel="stylesheet" href="../assets/theme/default/style.css" />
+ <style type="text/css">
+ body { font-family: Verdana; font-size: 0.9em; }
+ #error { color: red; }
+ #wrap { width: 900; }
+ #map { width: 650; height: 500; float: right; }
+ #layers { width: 250; height: 500; overflow: auto; display: block-inline; float: left; }
+ #rootList { list-style-type: none; margin-left: -20px; }
+ #rootList li { list-style-type: none; }
+ .olControlMousePosition { background: #ffff66; font-size: 0.6em !important; padding: 2px; }
+
+ #baseLayerSwitcher { background: #6699FF; color: white; padding: 5px; }
+ #baseLayerSwitcher .baseLayersDiv { font-size: 0.7em; }
+ </style>
+ <script src="http://maps.google.com/maps/api/js?v=3&sensor=false"></script>
+ <script type="text/javascript" src="../assets/jquery-1.10.2.min.js"></script>
+ <script type="text/javascript" src="../assets/OpenLayers.js"></script>
+ <script type="text/javascript" src="../assets/legend.js"></script>
+ <script type="text/javascript">
+
+ //This sample is assumed to be hosted at http://servername/mapguide/ol2samples/untiled/index.html
+ var mapAgentUrl = "../../mapagent/mapagent.fcgi";
+
+ //Various features you can include in the CREATERUNTIMEMAP response.
+ var REQ_NONE = 0; //Nothing. This the default.
+ var REQ_LAYER_STRUCTURE = 1; //Information about layers and groups (required for the mask values below to have any effect)
+ var REQ_LAYER_ICONS = 2; //Icons for each layer (has no effect if REQ_LAYER_STRUCTURE is not in the bitmask)
+ var REQ_LAYER_FEATURE_SOURCE = 4; //Feature Source information for each layer (has no effect if REQ_LAYER_STRUCTURE is not in the bitmask)
+
+ var gMimeType = null;
+ var map = null;
+ var mgLayer = null;
+ var sessionId = null;
+
+ $(document).ready(function() {
+ OpenLayers.Control.DragPan.prototype.enableKinetic = false;
+ //Have a play with the bitmask values to see the differences in JSON payload size
+ //and to see how our legend control gracefully handles such situations
+ //createMap(REQ_NONE);
+ //createMap(REQ_LAYER_STRUCTURE);
+ createMap(REQ_LAYER_STRUCTURE | REQ_LAYER_FEATURE_SOURCE | REQ_LAYER_ICONS);
+ });
+
+ function createMap(reqFeatures) {
+ $.getJSON(mapAgentUrl, {
+ "OPERATION": "CREATERUNTIMEMAP",
+ "VERSION": "2.6.0",
+ "MAPDEFINITION": "Library://Samples/Sheboygan/Maps/SheboyganCommercial.MapDefinition",
+ "USERNAME": "Anonymous", //Or you can use "SESSION": "<my session id>"
+ "REQUESTEDFEATURES": reqFeatures,
+ //Optional parameters you can specify and/or experiment with
+ //"ICONFORMAT": "GIF", //Uncomment to override desired image format (default: PNG)
+ //"ICONWIDTH": 32, //Uncomment to override desired icon width (default: 16)
+ //"ICONHEIGHT": 32, //Uncomment to override desired icon height (default: 16)
+ //"ICONSPERSCALERANGE": 3, //Uncomment to observe theme compression for themes exceeding this number of rules (default: 25)
+ //"TARGETMAPNAME": "MyRuntimeMapForOpenLayers", //Uncomment if you require a specific map name be given (default: inferred from Map Definition)
+ "FORMAT": "application/json"
+ }, function(data, textStatus, jqXHR) {
+ $("#jsonSize").html(jqXHR.responseText.length);
+ loadMap(data);
+ }).error(function(jqXHR, textStatus, errorThrown) {
+ $("#error").html(jqXHR.responseText);
+ });
+ }
+
+ function loadMap(rtMapInfo) {
+ if (rtMapInfo.RuntimeMap.IconMimeType) {
+ gMimeType = rtMapInfo.RuntimeMap.IconMimeType[0];
+ $("#iconFormat").html(gMimeType);
+ }
+ var extent = new OpenLayers.Bounds(
+ parseFloat(rtMapInfo.RuntimeMap.Extents[0].LowerLeftCoordinate[0].X[0]),
+ parseFloat(rtMapInfo.RuntimeMap.Extents[0].LowerLeftCoordinate[0].Y[0]),
+ parseFloat(rtMapInfo.RuntimeMap.Extents[0].UpperRightCoordinate[0].X[0]),
+ parseFloat(rtMapInfo.RuntimeMap.Extents[0].UpperRightCoordinate[0].Y[0]));
+
+ OpenLayers.Control.CustomNavToolbar = OpenLayers.Class(OpenLayers.Control.Panel, {
+ /**
+ * Constructor: OpenLayers.Control.NavToolbar
+ * Add our two mousedefaults controls.
+ *
+ * Parameters:
+ * options - {Object} An optional object whose properties will be used
+ * to extend the control.
+ */
+ initialize: function(options) {
+ OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]);
+ this.addControls([
+ new OpenLayers.Control.Navigation(),
+ //Here it come
+ new OpenLayers.Control.ZoomBox({alwaysZoom:true})
+ ]);
+ // To make the custom navtoolbar use the regular navtoolbar style
+ this.displayClass = 'olControlNavToolbar'
+ },
+ /**
+ * Method: draw
+ * calls the default draw, and then activates mouse defaults.
+ */
+ draw: function() {
+ var div = OpenLayers.Control.Panel.prototype.draw.apply(this, arguments);
+ this.defaultControl = this.controls[0];
+ return div;
+ }
+ });
+ var mapOptions = {
+ theme: null,
+ projection: 'EPSG:900913',
+ maxExtent: extent,
+ maxResolution: 'auto',
+ controls: [
+ new OpenLayers.Control.Navigation(),
+ new OpenLayers.Control.Attribution(),
+ new OpenLayers.Control.Zoom(),
+ new OpenLayers.Control.ScaleLine(),
+ new OpenLayers.Control.MousePosition(),
+ new OpenLayers.Control.LayerSwitcher({ div: $("#baseLayerSwitcher")[0] }),
+ new OpenLayers.Control.CustomNavToolbar({alwaysZoom:true})
+ ]
+ };
+
+ if (rtMapInfo.RuntimeMap.CoordinateSystem[0].EpsgCode[0].length > 0) {
+ mapOptions.projection = "EPSG:" + rtMapInfo.RuntimeMap.CoordinateSystem[0].EpsgCode[0];
+ }
+
+ var options = {
+ isBaseLayer: false,
+ transitionEffect: "resize",
+ buffer: 1,
+ useOverlay: true,
+ useAsyncOverlay: true,
+ singleTile: true
+ };
+
+ var params = {
+ mapname: rtMapInfo.RuntimeMap.Name[0],
+ session: rtMapInfo.RuntimeMap.SessionId[0],
+ selectioncolor: '0xFF000000',
+ behavior: 2
+ };
+
+ sessionId = rtMapInfo.RuntimeMap.SessionId[0];
+
+ //Adjust the scale assumptions for MapGuide layers
+ //Tiled layers MUST use a DPI value of 96, untiled layers can use a
+ //different DPI value which will be passed to the server as a parameter.
+ //Tiled and untiled layers must adjust the OL INCHES_PER_UNIT values
+ //for any degree-based projections.
+
+ //You'll still need to do these adjustments manually, but CREATERUNTIMEMAP
+ //now provides the necessary meters-per-unit value for you to do this.
+ var metersPerUnit = parseFloat(rtMapInfo.RuntimeMap.CoordinateSystem[0].MetersPerUnit[0]);
+ var inPerUnit = OpenLayers.INCHES_PER_UNIT.m * metersPerUnit;
+ OpenLayers.INCHES_PER_UNIT["dd"] = inPerUnit;
+ OpenLayers.INCHES_PER_UNIT["degrees"] = inPerUnit;
+ OpenLayers.DOTS_PER_INCH = 96;
+
+ map = new OpenLayers.Map('map', mapOptions );
+
+ map.addLayers([
+ new OpenLayers.Layer.Google(
+ "Google Physical",
+ {type: google.maps.MapTypeId.TERRAIN}
+ ),
+ new OpenLayers.Layer.Google(
+ "Google Streets", // the default
+ {numZoomLevels: 20}
+ ),
+ new OpenLayers.Layer.Google(
+ "Google Hybrid",
+ {type: google.maps.MapTypeId.HYBRID, numZoomLevels: 20}
+ ),
+ new OpenLayers.Layer.Google(
+ "Google Satellite",
+ {type: google.maps.MapTypeId.SATELLITE, numZoomLevels: 22}
+ ),
+ new OpenLayers.Layer.OSM("OpenStreetMap")
+ ]);
+
+ mgLayer = new OpenLayers.Layer.MapGuide( "MapGuide (from CREATERUNTIMEMAP)", mapAgentUrl, params, options );
+ map.addLayer(mgLayer);
+ map.zoomToExtent(extent);
+
+ var legend = new Legend({
+ legendSelector: "#rootList",
+ stdIconRoot: "../../stdicons",
+ runtimeMap: rtMapInfo,
+ map: map,
+ mgLayerOL: mgLayer
+ });
+ legend.update();
+
+ $("#mapName").html("MapGuide mapname: " + rtMapInfo.RuntimeMap.Name[0]);
+ $("#mgSession").html("MapGuide session ID: " + sessionId);
+ $("div.olMap").css("background-color", "#" + rtMapInfo.RuntimeMap.BackgroundColor[0].substring(2));
+ startKeepAlive();
+ }
+
+ function startKeepAlive() {
+ var keepAlive = function() {
+ $.get(mapAgentUrl, {
+ "OPERATION": "GETSESSIONTIMEOUT",
+ "VERSION": "1.0.0",
+ "SESSION": sessionId
+ }, function(data, textStatus, jxXHR) {
+ $("#mgSession").html("MapGuide session ID: " + sessionId + " (last checked at: " + (new Date()) + ")");
+ setTimeout(keepAlive, parseInt(data) * 1000);
+ });
+ };
+ keepAlive();
+ }
+
+ </script>
+ </head>
+ <body>
+ <p>This example demonstrates MapGuide layer integration with Google/OSM. The map is created with CREATERUNTIMEMAP.</p>
+ <p>The Map Definition is in WGS84.PseudoMercator which allows for the MapGuide map to line up with any Google/OSM layer</p>
+ <div id="error">
+ </div>
+ <div id="wrap">
+ <div id="layers">
+ <div id="baseLayerSwitcher">
+ </div>
+ <div id="legend">
+ <strong>Layer and Groups</strong>
+ <ul id="rootList">
+ </ul>
+ </div>
+ </div>
+ <div id="map">
+ </div>
+ </div>
+ <p>JSON payload for CREATERUNTIMEMAP is: <span id="jsonSize"></span> characters</p>
+ <p>Icon format is: <span id="iconFormat"></span></p>
+ <p id="mapName"></p>
+ <p id="mgSession"></p>
+ </body>
+</html>
\ No newline at end of file
Added: trunk/MgDev/Doc/samples/ol2samples/mixed/SheboyganMixed.MapDefinition.xml
===================================================================
--- trunk/MgDev/Doc/samples/ol2samples/mixed/SheboyganMixed.MapDefinition.xml (rev 0)
+++ trunk/MgDev/Doc/samples/ol2samples/mixed/SheboyganMixed.MapDefinition.xml 2013-08-21 16:37:17 UTC (rev 7795)
@@ -0,0 +1,114 @@
+<?xml version="1.0"?>
+<MapDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:noNamespaceSchemaLocation="MapDefinition-1.0.0.xsd">
+ <Name>Sheboygan Map</Name>
+ <CoordinateSystem>GEOGCS["WGS84 Lat/Long's, Degrees, -180 ==> +180",DATUM["D_WGS_1984",SPHEROID["World_Geodetic_System_of_1984",6378137,298.257222932867]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]</CoordinateSystem>
+ <Extents>
+ <MinX>-87.764986990962839</MinX>
+ <MaxX>-87.695521510899724</MaxX>
+ <MinY>43.691398128787782</MinY>
+ <MaxY>43.797520000480347</MaxY>
+ </Extents>
+ <BackgroundColor>ffcdbd9c</BackgroundColor>
+ <MapLayer>
+ <Name>Roads</Name>
+ <ResourceId>Library://Samples/Sheboygan/Layers/Roads.LayerDefinition</ResourceId>
+ <Selectable>false</Selectable>
+ <ShowInLegend>true</ShowInLegend>
+ <LegendLabel>Roads</LegendLabel>
+ <ExpandInLegend>true</ExpandInLegend>
+ <Visible>true</Visible>
+ <Group>Other</Group>
+ </MapLayer>
+ <MapLayer>
+ <Name>Rail Lines</Name>
+ <ResourceId>Library://Samples/Sheboygan/Layers/Tracks.LayerDefinition</ResourceId>
+ <Selectable>false</Selectable>
+ <ShowInLegend>true</ShowInLegend>
+ <LegendLabel>Rail Lines</LegendLabel>
+ <ExpandInLegend>true</ExpandInLegend>
+ <Visible>false</Visible>
+ <Group>Other</Group>
+ </MapLayer>
+ <MapLayer>
+ <Name>Districts</Name>
+ <ResourceId>Library://Samples/Sheboygan/Layers/Districts.LayerDefinition</ResourceId>
+ <Selectable>false</Selectable>
+ <ShowInLegend>true</ShowInLegend>
+ <LegendLabel>Districts</LegendLabel>
+ <ExpandInLegend>true</ExpandInLegend>
+ <Visible>true</Visible>
+ <Group>Other</Group>
+ </MapLayer>
+ <MapLayerGroup>
+ <Name>Other</Name>
+ <Visible>true</Visible>
+ <ShowInLegend>true</ShowInLegend>
+ <ExpandInLegend>true</ExpandInLegend>
+ <LegendLabel>Other</LegendLabel>
+ <Group />
+ </MapLayerGroup>
+ <BaseMapDefinition>
+ <FiniteDisplayScale>1000</FiniteDisplayScale>
+ <FiniteDisplayScale>1930.69773</FiniteDisplayScale>
+ <FiniteDisplayScale>3727.59372</FiniteDisplayScale>
+ <FiniteDisplayScale>7196.85673</FiniteDisplayScale>
+ <FiniteDisplayScale>13894.95494</FiniteDisplayScale>
+ <FiniteDisplayScale>26826.95795</FiniteDisplayScale>
+ <FiniteDisplayScale>51794.74679</FiniteDisplayScale>
+ <FiniteDisplayScale>100000</FiniteDisplayScale>
+ <BaseMapLayerGroup>
+ <Name>Municipal</Name>
+ <Visible>true</Visible>
+ <ShowInLegend>true</ShowInLegend>
+ <ExpandInLegend>true</ExpandInLegend>
+ <LegendLabel>Municipal</LegendLabel>
+ <BaseMapLayer>
+ <Name>Buildings</Name>
+ <ResourceId>Library://Samples/Sheboygan/Layers/Buildings.LayerDefinition</ResourceId>
+ <Selectable>false</Selectable>
+ <ShowInLegend>true</ShowInLegend>
+ <LegendLabel>Buildings</LegendLabel>
+ <ExpandInLegend>true</ExpandInLegend>
+ </BaseMapLayer>
+ <BaseMapLayer>
+ <Name>Parcels</Name>
+ <ResourceId>Library://Samples/Sheboygan/Layers/Parcels.LayerDefinition</ResourceId>
+ <Selectable>true</Selectable>
+ <ShowInLegend>true</ShowInLegend>
+ <LegendLabel>Parcels</LegendLabel>
+ <ExpandInLegend>true</ExpandInLegend>
+ </BaseMapLayer>
+ </BaseMapLayerGroup>
+ <BaseMapLayerGroup>
+ <Name>Base Map</Name>
+ <Visible>true</Visible>
+ <ShowInLegend>true</ShowInLegend>
+ <ExpandInLegend>true</ExpandInLegend>
+ <LegendLabel>Base Map</LegendLabel>
+ <BaseMapLayer>
+ <Name>Islands</Name>
+ <ResourceId>Library://Samples/Sheboygan/Layers/Islands.LayerDefinition</ResourceId>
+ <Selectable>false</Selectable>
+ <ShowInLegend>true</ShowInLegend>
+ <LegendLabel>Islands</LegendLabel>
+ <ExpandInLegend>true</ExpandInLegend>
+ </BaseMapLayer>
+ <BaseMapLayer>
+ <Name>Hydrography</Name>
+ <ResourceId>Library://Samples/Sheboygan/Layers/Hydrography.LayerDefinition</ResourceId>
+ <Selectable>false</Selectable>
+ <ShowInLegend>true</ShowInLegend>
+ <LegendLabel>Hydrography</LegendLabel>
+ <ExpandInLegend>true</ExpandInLegend>
+ </BaseMapLayer>
+ <BaseMapLayer>
+ <Name>CityLimits</Name>
+ <ResourceId>Library://Samples/Sheboygan/Layers/CityLimits.LayerDefinition</ResourceId>
+ <Selectable>false</Selectable>
+ <ShowInLegend>true</ShowInLegend>
+ <LegendLabel>CityLimits</LegendLabel>
+ <ExpandInLegend>true</ExpandInLegend>
+ </BaseMapLayer>
+ </BaseMapLayerGroup>
+ </BaseMapDefinition>
+</MapDefinition>
\ No newline at end of file
Added: trunk/MgDev/Doc/samples/ol2samples/mixed/index.html
===================================================================
--- trunk/MgDev/Doc/samples/ol2samples/mixed/index.html (rev 0)
+++ trunk/MgDev/Doc/samples/ol2samples/mixed/index.html 2013-08-21 16:37:17 UTC (rev 7795)
@@ -0,0 +1,239 @@
+<html>
+ <head>
+ <title>Basic Sheboygan mixed map (tiled and untiled) example</title>
+ <link rel="stylesheet" href="../assets/theme/default/style.css" />
+ <style type="text/css">
+ body { font-family: Verdana; font-size: 0.9em; }
+ #error { color: red; }
+ #wrap { width: 900; }
+ #map { width: 650; height: 500; float: right; }
+ #details { width: 250; height: 500; overflow: auto; display: block-inline; float: left; }
+ #rootList { list-style-type: none; margin-left: -20px; }
+ #rootList li { list-style-type: none; }
+ .olControlMousePosition { background: #ffff66; font-size: 0.6em !important; padding: 2px; }
+ </style>
+ <script type="text/javascript" src="../assets/jquery-1.10.2.min.js"></script>
+ <script type="text/javascript" src="../assets/OpenLayers.js"></script>
+ <script type="text/javascript" src="../assets/legend.js"></script>
+ <script type="text/javascript">
+
+ //This sample is assumed to be hosted at http://servername/mapguide/ol2samples/untiled/index.html
+ var mapAgentUrl = "../../mapagent/mapagent.fcgi";
+
+ //Various features you can include in the CREATERUNTIMEMAP response.
+ var REQ_NONE = 0; //Nothing. This the default.
+ var REQ_LAYER_STRUCTURE = 1; //Information about layers and groups (required for the mask values below to have any effect)
+ var REQ_LAYER_ICONS = 2; //Icons for each layer (has no effect if REQ_LAYER_STRUCTURE is not in the bitmask)
+ var REQ_LAYER_FEATURE_SOURCE = 4; //Feature Source information for each layer (has no effect if REQ_LAYER_STRUCTURE is not in the bitmask)
+
+ var gMimeType = null;
+ var map = null;
+ var mgLayer = null;
+ var sessionId = null;
+
+ $(document).ready(function() {
+ OpenLayers.Control.DragPan.prototype.enableKinetic = false;
+ //Have a play with the bitmask values to see the differences in JSON payload size
+ //and to see how our legend control gracefully handles such situations
+ //createMap(REQ_NONE);
+ //createMap(REQ_LAYER_STRUCTURE);
+ createMap(REQ_LAYER_STRUCTURE | REQ_LAYER_FEATURE_SOURCE | REQ_LAYER_ICONS);
+ });
+
+ function createMap(reqFeatures) {
+ $.getJSON(mapAgentUrl, {
+ "OPERATION": "CREATERUNTIMEMAP",
+ "VERSION": "2.6.0",
+ "MAPDEFINITION": "Library://Samples/Sheboygan/Maps/SheboyganMixed.MapDefinition",
+ "USERNAME": "Anonymous", //Or you can use "SESSION": "<my session id>"
+ "REQUESTEDFEATURES": reqFeatures,
+ //Optional parameters you can specify and/or experiment with
+ //"ICONFORMAT": "GIF", //Uncomment to override desired image format (default: PNG)
+ //"ICONWIDTH": 32, //Uncomment to override desired icon width (default: 16)
+ //"ICONHEIGHT": 32, //Uncomment to override desired icon height (default: 16)
+ //"ICONSPERSCALERANGE": 3, //Uncomment to observe theme compression for themes exceeding this number of rules (default: 25)
+ //"TARGETMAPNAME": "MyRuntimeMapForOpenLayers", //Uncomment if you require a specific map name be given (default: inferred from Map Definition)
+ "FORMAT": "application/json"
+ }, function(data, textStatus, jqXHR) {
+ $("#jsonSize").html(jqXHR.responseText.length);
+ loadMap(data);
+ }).error(function(jqXHR, textStatus, errorThrown) {
+ $("#error").html(jqXHR.responseText);
+ });
+ }
+
+ function loadMap(rtMapInfo) {
+ if (rtMapInfo.RuntimeMap.IconMimeType) {
+ gMimeType = rtMapInfo.RuntimeMap.IconMimeType[0];
+ $("#iconFormat").html(gMimeType);
+ }
+ var extent = new OpenLayers.Bounds(
+ parseFloat(rtMapInfo.RuntimeMap.Extents[0].LowerLeftCoordinate[0].X[0]),
+ parseFloat(rtMapInfo.RuntimeMap.Extents[0].LowerLeftCoordinate[0].Y[0]),
+ parseFloat(rtMapInfo.RuntimeMap.Extents[0].UpperRightCoordinate[0].X[0]),
+ parseFloat(rtMapInfo.RuntimeMap.Extents[0].UpperRightCoordinate[0].Y[0]));
+
+ OpenLayers.Control.CustomNavToolbar = OpenLayers.Class(OpenLayers.Control.Panel, {
+ /**
+ * Constructor: OpenLayers.Control.NavToolbar
+ * Add our two mousedefaults controls.
+ *
+ * Parameters:
+ * options - {Object} An optional object whose properties will be used
+ * to extend the control.
+ */
+ initialize: function(options) {
+ OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]);
+ this.addControls([
+ new OpenLayers.Control.Navigation(),
+ //Here it come
+ new OpenLayers.Control.ZoomBox({alwaysZoom:true})
+ ]);
+ // To make the custom navtoolbar use the regular navtoolbar style
+ this.displayClass = 'olControlNavToolbar'
+ },
+ /**
+ * Method: draw
+ * calls the default draw, and then activates mouse defaults.
+ */
+ draw: function() {
+ var div = OpenLayers.Control.Panel.prototype.draw.apply(this, arguments);
+ this.defaultControl = this.controls[0];
+ return div;
+ }
+ });
+
+ var finiteScales = [];
+ if (rtMapInfo.RuntimeMap.FiniteDisplayScale) {
+ for (var i = rtMapInfo.RuntimeMap.FiniteDisplayScale.length - 1; i >= 0; i--) {
+ finiteScales.push(parseFloat(rtMapInfo.RuntimeMap.FiniteDisplayScale[i]));
+ }
+ }
+
+ var mapOptions = {
+ theme: null,
+ allOverlays: true,
+ maxExtent: extent,
+ scales: finiteScales,
+ maxResolution: 'auto',
+ controls: [
+ new OpenLayers.Control.Navigation(),
+ new OpenLayers.Control.Attribution(),
+ new OpenLayers.Control.Zoom(),
+ new OpenLayers.Control.ScaleLine(),
+ new OpenLayers.Control.MousePosition(),
+ new OpenLayers.Control.CustomNavToolbar({alwaysZoom:true})
+ ]
+ };
+
+ if (rtMapInfo.RuntimeMap.CoordinateSystem[0].EpsgCode[0].length > 0) {
+ mapOptions.projection = "EPSG:" + rtMapInfo.RuntimeMap.CoordinateSystem[0].EpsgCode[0];
+ }
+
+ var options = {
+ isBaseLayer: false,
+ transitionEffect: "resize",
+ buffer: 1,
+ useOverlay: true,
+ useAsyncOverlay: true,
+ singleTile: true
+ };
+
+ var params = {
+ mapname: rtMapInfo.RuntimeMap.Name[0],
+ session: rtMapInfo.RuntimeMap.SessionId[0],
+ selectioncolor: '0xFF000000',
+ behavior: 2
+ };
+
+ sessionId = rtMapInfo.RuntimeMap.SessionId[0];
+
+ //Adjust the scale assumptions for MapGuide layers
+ //Tiled layers MUST use a DPI value of 96, untiled layers can use a
+ //different DPI value which will be passed to the server as a parameter.
+ //Tiled and untiled layers must adjust the OL INCHES_PER_UNIT values
+ //for any degree-based projections.
+
+ //You'll still need to do these adjustments manually, but CREATERUNTIMEMAP
+ //now provides the necessary meters-per-unit value for you to do this.
+ var metersPerUnit = parseFloat(rtMapInfo.RuntimeMap.CoordinateSystem[0].MetersPerUnit[0]);
+ var inPerUnit = OpenLayers.INCHES_PER_UNIT.m * metersPerUnit;
+ OpenLayers.INCHES_PER_UNIT["dd"] = inPerUnit;
+ OpenLayers.INCHES_PER_UNIT["degrees"] = inPerUnit;
+ OpenLayers.DOTS_PER_INCH = 96;
+
+ map = new OpenLayers.Map('map', mapOptions );
+
+ var tiledLayers = {};
+ //Iterate in reverse order so any base layer groups are added in correct draw order
+ for (var i = rtMapInfo.RuntimeMap.Group.length - 1; i >= 0; i--) {
+ var group = rtMapInfo.RuntimeMap.Group[i];
+ if (group.Type[0] == "2") { //MgLayerGroupType.BaseMap
+ var layer = new OpenLayers.Layer.MapGuide("MapGuide base layer group via CREATERUNTIMEMAP: " + group.Name[0], mapAgentUrl + "?USERNAME=Anonymous", {
+ mapdefinition: rtMapInfo.RuntimeMap.MapDefinition[0],
+ basemaplayergroupname: group.Name[0]
+ }, {
+ isBaseLayer: false,
+ singleTile: false
+ });
+ map.addLayer(layer);
+ tiledLayers[group.Name[0]] = layer;
+ }
+ }
+
+ mgLayer = new OpenLayers.Layer.MapGuide( "MapGuide (from CREATERUNTIMEMAP)", mapAgentUrl, params, options );
+ map.addLayer(mgLayer);
+
+ map.zoomToMaxExtent();
+
+ var legend = new Legend({
+ legendSelector: "#rootList",
+ stdIconRoot: "../../stdicons",
+ runtimeMap: rtMapInfo,
+ map: map,
+ mgLayerOL: mgLayer,
+ mgTiledLayers: tiledLayers
+ });
+ legend.update();
+
+ $("#mapName").html("MapGuide mapname: " + rtMapInfo.RuntimeMap.Name[0]);
+ $("#mgSession").html("MapGuide session ID: " + sessionId);
+ $("div.olMap").css("background-color", "#" + rtMapInfo.RuntimeMap.BackgroundColor[0].substring(2));
+ startKeepAlive();
+ }
+
+ function startKeepAlive() {
+ var keepAlive = function() {
+ $.get(mapAgentUrl, {
+ "OPERATION": "GETSESSIONTIMEOUT",
+ "VERSION": "1.0.0",
+ "SESSION": sessionId
+ }, function(data, textStatus, jxXHR) {
+ $("#mgSession").html("MapGuide session ID: " + sessionId + " (last checked at: " + (new Date()) + ")");
+ setTimeout(keepAlive, parseInt(data) * 1000);
+ });
+ };
+ keepAlive();
+ }
+
+ </script>
+ </head>
+ <body>
+ <p>This example demonstrates loading a Map Definition with both tiled and untiled layers. The map is created with CREATERUNTIMEMAP</p>
+ <div id="error">
+ </div>
+ <div id="wrap">
+ <div id="details">
+ <strong>Layer and Groups</strong>
+ <ul id="rootList">
+ </ul>
+ </div>
+ <div id="map">
+ </div>
+ </div>
+ <p>JSON payload for CREATERUNTIMEMAP is: <span id="jsonSize"></span> characters</p>
+ <p>Icon format is: <span id="iconFormat"></span></p>
+ <p id="mapName"></p>
+ <p id="mgSession"></p>
+ </body>
+</html>
\ No newline at end of file
Modified: trunk/MgDev/Doc/samples/ol2samples/tiled/index.html
===================================================================
--- trunk/MgDev/Doc/samples/ol2samples/tiled/index.html 2013-08-21 15:40:32 UTC (rev 7794)
+++ trunk/MgDev/Doc/samples/ol2samples/tiled/index.html 2013-08-21 16:37:17 UTC (rev 7795)
@@ -140,7 +140,8 @@
map = new OpenLayers.Map('map', mapOptions );
var tiledLayers = {};
- for (var i = 0; i < rtMapInfo.RuntimeMap.Group.length; i++) {
+ //Iterate in reverse order so any base layer groups are added in correct draw order
+ for (var i = rtMapInfo.RuntimeMap.Group.length - 1; i >= 0; i--) {
var group = rtMapInfo.RuntimeMap.Group[i];
if (group.Type[0] == "2") { //MgLayerGroupType.BaseMap
var layer = new OpenLayers.Layer.MapGuide("MapGuide base layer group via CREATERUNTIMEMAP: " + group.Name[0], mapAgentUrl + "?USERNAME=Anonymous", {
More information about the mapguide-commits
mailing list