[fusion-commits] r1646 - in trunk: MapGuide MapGuide/php lib
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Thu Nov 6 16:49:52 EST 2008
Author: pagameba
Date: 2008-11-06 16:49:52 -0500 (Thu, 06 Nov 2008)
New Revision: 1646
Modified:
trunk/MapGuide/MapGuide.js
trunk/MapGuide/php/LoadMap.php
trunk/lib/Map.js
Log:
Re #158. Parse the BackgroundColor of the MapDefinition and return it to the client side so that the background color of the map can be updated accordingly. Requires updated templates too.
Modified: trunk/MapGuide/MapGuide.js
===================================================================
--- trunk/MapGuide/MapGuide.js 2008-11-06 21:20:28 UTC (rev 1645)
+++ trunk/MapGuide/MapGuide.js 2008-11-06 21:49:52 UTC (rev 1646)
@@ -237,7 +237,7 @@
this._sMapname = o.mapName;
this._sMapTitle = o.mapTitle;
this.mapWidget.setMetersPerUnit(o.metersPerUnit);
-
+ this.mapWidget.setBackgroundColor(o.backgroundColor);
this._oMaxExtent = OpenLayers.Bounds.fromArray(o.extent);
this.layerRoot.clear();
@@ -530,14 +530,10 @@
this.aHideGroups = [];
this.aRefreshLayers = [];
- this.oLayerOL.mergeNewParams(params);
- },
-
- drawSelection: function() {
if (this.queryLayer) {
- this.queryLayer.redraw(true);
+ this.queryLayer.redraw(true);
} else {
- this.drawMap();
+ this.oLayerOL.mergeNewParams(params);
}
},
@@ -560,7 +556,7 @@
useOverlay: this.selectionAsOverlay,
ratio: this.ratio
};
- if (behaviour != 1 && !/WebKit/.test(navigator.userAgent)) {
+ if (!/WebKit/.test(navigator.userAgent)) {
layerOptions.transitionEffect = 'resize';
}
@@ -600,8 +596,7 @@
params.selectioncolor = this.selectionColor;
params.format = this.selectionFormat;
}
- params.version = "2.0.0";
-
+
} else {
params = { //tiled version
mapdefinition: this._sResourceId,
@@ -685,7 +680,7 @@
this.oSelection = null;
}
this.bSelectionOn = true;
- this.drawSelection();
+ this.drawMap();
this.triggerEvent(Fusion.Event.MAP_SELECTION_ON);
},
@@ -815,7 +810,7 @@
this.queryLayer.setVisibility(false);
}
this.triggerEvent(Fusion.Event.MAP_SELECTION_OFF);
- this.drawSelection();
+ this.drawMap();
this.oSelection = null;
},
Modified: trunk/MapGuide/php/LoadMap.php
===================================================================
--- trunk/MapGuide/php/LoadMap.php 2008-11-06 21:20:28 UTC (rev 1645)
+++ trunk/MapGuide/php/LoadMap.php 2008-11-06 21:49:52 UTC (rev 1646)
@@ -95,8 +95,8 @@
$mapObj->mapTitle=addslashes($mapTitle);
$mapObj->mapName=addslashes($mapName);
+ $mapObj->backgroundColor = getMapBackgroundColor($map);
-
$mapObj->extent = array($oMin->GetX(), $oMin->GetY(), $oMax->GetX(), $oMax->GetY());
$layers=$map->GetLayers();
@@ -236,6 +236,19 @@
return $aLayerTypes;
}
+function getMapBackgroundColor($map) {
+ global $resourceService;
+ $resId = $map->GetMapDefinition();
+ $mapContent = $resourceService->GetResourceContent($resId);
+ $xmldoc = DOMDocument::loadXML(ByteReaderToString($mapContent));
+ $bgColor = $xmldoc->getElementsByTagName('BackgroundColor');
+ if ($bgColor->length > 0) {
+ return '#'.substr($bgColor->item(0)->nodeValue, 2);
+ } else {
+ return "#FFFFFF";
+ }
+}
+
function buildScaleRanges($layer)
{
$aScaleRanges = array();
Modified: trunk/lib/Map.js
===================================================================
--- trunk/lib/Map.js 2008-11-06 21:20:28 UTC (rev 1645)
+++ trunk/lib/Map.js 2008-11-06 21:49:52 UTC (rev 1646)
@@ -547,6 +547,10 @@
this.oMapOL.setCenter(this.oMapOL.getCenter(), this.oMapOL.getZoom(), false, true);
},
+ setBackgroundColor: function(color) {
+ this._oDomObj.style.backgroundColor = color;
+ },
+
setExtents: function(oExtents) {
if (!oExtents) {
Fusion.reportError(new Fusion.Error(Fusion.Error.WARNING,
More information about the fusion-commits
mailing list