[fusion-commits] r1501 - in trunk: MapGuide
templates/mapguide/standard
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Fri Sep 5 15:36:53 EDT 2008
Author: madair
Date: 2008-09-05 15:36:52 -0400 (Fri, 05 Sep 2008)
New Revision: 1501
Modified:
trunk/MapGuide/MapGuide.js
trunk/templates/mapguide/standard/ApplicationDefinition.xml
Log:
re #120: optionally render selections in a separate layer and allow setting the color and format for selections
- configured through AppDef
Modified: trunk/MapGuide/MapGuide.js
===================================================================
--- trunk/MapGuide/MapGuide.js 2008-09-05 14:40:48 UTC (rev 1500)
+++ trunk/MapGuide/MapGuide.js 2008-09-05 19:36:52 UTC (rev 1501)
@@ -44,16 +44,17 @@
oSelection: null,
bDisplayInLegend: true, //TODO: set this in AppDef?
bExpandInLegend: true, //TODO: set this in AppDef?
- bMapLoaded : false,
- bIsMapWidgetLayer : true, //Setthis to false for overview map layers
+ bMapLoaded: false,
+ bIsMapWidgetLayer: true, //Set this to false for overview map layers
bLayersReversed: false, //MGOS returns layers top-most layer first
+ selectionAsOverlay: false,
//the resource id of the current MapDefinition
_sResourceId: null,
clientAgent: 'Fusion Viewer',
- initialize : function(map, mapTag, isMapWidgetLayer) {
+ initialize: function(map, mapTag, isMapWidgetLayer) {
// console.log('MapGuide.initialize');
this.registerEventID(Fusion.Event.MAP_SESSION_CREATED);
@@ -70,6 +71,11 @@
this.mapInfo = mapTag.mapInfo;
var extension = mapTag.extension; //TBD: this belongs in layer tag?
this.selectionType = extension.SelectionType ? extension.SelectionType[0] : 'INTERSECTS';
+ this.selectionColor = extension.SelectionColor ? extension.SelectionColor[0] : '';
+ this.selectionFormat = extension.SelectionFormat ? extension.SelectionFormat[0] : 'PNG';
+ if (extension.SelectionAsOverlay && extension.SelectionAsOverlay[0] == 'true') {
+ this.selectionAsOverlay = true;
+ }
this.ratio = extension.MapRatio ? extension.MapRatio[0] : 1.0;
//add in the handler for CTRL-click actions for the map, not an overviewmap
@@ -131,7 +137,7 @@
}
},
- createSessionCB : function(xhr) {
+ createSessionCB: function(xhr) {
if (xhr.status == 200) {
var o;
eval('o='+xhr.responseText);
@@ -462,7 +468,7 @@
this.aRefreshLayers = [];
this.oLayerOL.mergeNewParams(params);
- if (this.queryLayer) this.queryLayer.redraw();
+ if (this.queryLayer) this.queryLayer.redraw(true);
},
/**
@@ -470,7 +476,7 @@
*
* Returns an OpenLayers MapGuide layer object
*/
- createOLLayer: function(layerName, bIsBaseLayer, bSingleTile) {
+ createOLLayer: function(layerName, bIsBaseLayer, bSingleTile, behaviour) {
var layerOptions = {
units : this.units,
isBaseLayer : bIsBaseLayer,
@@ -494,21 +500,28 @@
var params = {};
if ( bSingleTile ) {
params = { //single tile params
- session : this.getSessionID(),
- mapname : this._sMapname,
- clientagent : this.clientAgent
+ session: this.getSessionID(),
+ mapname: this._sMapname,
+ clientagent: this.clientAgent
};
params.showLayers = this.aShowLayers.length > 0 ? this.aShowLayers.toString() : null;
params.hideLayers = this.aHideLayers.length > 0 ? this.aHideLayers.toString() : null;
params.showGroups = this.aShowGroups.length > 0 ? this.aShowGroups.toString() : null;
params.hideGroups = this.aHideGroups.length > 0 ? this.aHideGroups.toString() : null;
params.refreshLayers = this.aRefreshLayers.length > 0 ? this.aRefreshLayers.toString() : null;
+
+ if (behaviour != null) {
+ params.behavior = behaviour;
+ params.version = "2.0.0";
+ params.selectioncolor = this.selectionColor;
+ params.format = this.selectionFormat;
+ }
} else {
params = { //tiled version
mapdefinition: this._sResourceId,
basemaplayergroupname: this.groupName, //assumes only one group for now
- clientagent : this.clientAgent
+ clientagent: this.clientAgent
};
}
@@ -737,9 +750,9 @@
eval('oNode='+r.responseText);
if (oNode.hasSelection) {
- if (!this.bSingleTile) {
+ if (this.selectionAsOverlay) {
if (!this.queryLayer) {
- this.queryLayer = this.createOLLayer("query layer", false, true);
+ this.queryLayer = this.createOLLayer("query layer", false, true, 1);
this.mapWidget.oMapOL.addLayer(this.queryLayer);
this.mapWidget.registerForEvent(Fusion.Event.MAP_LOADING,
OpenLayers.Function.bind(this.removeQueryLayer, this));
Modified: trunk/templates/mapguide/standard/ApplicationDefinition.xml
===================================================================
--- trunk/templates/mapguide/standard/ApplicationDefinition.xml 2008-09-05 14:40:48 UTC (rev 1500)
+++ trunk/templates/mapguide/standard/ApplicationDefinition.xml 2008-09-05 19:36:52 UTC (rev 1501)
@@ -15,9 +15,21 @@
<SingleTile>true</SingleTile>
<Extension>
<ResourceId>Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition</ResourceId>
+ <SelectionAsOverlay>true</SelectionAsOverlay>
+ <SelectionFormat>PNG8</SelectionFormat>
+ <SelectionColor>0xFF0000</SelectionColor>
</Extension>
</Map>
</MapGroup>
+ <MapGroup id="sheboygan-tiled" xsi:type="MapType">
+ <Map xsi:type="MapGuideLayerType">
+ <Type>MapGuide</Type>
+ <SingleTile>false</SingleTile>
+ <Extension>
+ <ResourceId>Library://Samples/Sheboygan/MapsTiled/Sheboygan.MapDefinition</ResourceId>
+ </Extension>
+ </Map>
+ </MapGroup>
<MapGroup id="gmap-tiled" xsi:type="MapType">
<Map xsi:type="MapGuideLayerType">
<Type>MapGuide</Type>
@@ -307,7 +319,7 @@
<StatusItem>The map.</StatusItem>
<Extension xsi:type="CustomContentType">
<MenuContainer>MapContextMenu</MenuContainer>
- <Scales>2000000 1000000 500000 250000 125000 50000</Scales>
+ <!--Scales>100000,50000,25000,12500,8000,4000</Scales-->
</Extension>
<MapId>sheboygan</MapId>
</MapWidget>
@@ -555,7 +567,7 @@
<Type>ViewOptions</Type>
<StatusItem>Switch between Imperial and Metric units</StatusItem>
<Extension xsi:type="CustomContentType">
- <DisplayUnits>meters</DisplayUnits>
+ <DisplayUnits>degrees</DisplayUnits>
</Extension>
<ImageUrl>images/icons/view-options.png</ImageUrl>
<ImageClass/>
@@ -603,6 +615,7 @@
<DistancePrecision>0</DistancePrecision>
<AreaPrecision>0</AreaPrecision>
<Units>meters</Units>
+ <Target>TaskPane</Target>
</Extension>
<ImageUrl>images/icons/measure.png</ImageUrl>
<ImageClass/>
@@ -825,6 +838,9 @@
<Type>SelectWithin</Type>
<StatusItem>Select all features that fall within the currently selected area.</StatusItem>
<ImageUrl>images/icons/select-features.png</ImageUrl>
+ <Extension>
+ <Target>TaskPane</Target>
+ </Extension>
<ImageClass/>
<Tooltip>Select Within</Tooltip>
<Label></Label>
@@ -1007,17 +1023,16 @@
<Disabled/>
</Widget>
-<!-- OVERVIEW MAP -->
+<!-- OVERVIEW MAP
<Widget xsi:type="WidgetType">
<Name>OverviewMap</Name>
<Type>OverviewMap</Type>
<Description/>
<Extension xsi:type="CustomContentType">
- <!--MapId>sheboyganOverview</MapId-->
</Extension>
</Widget>
-
+ -->
<!-- PRINT -->
<Widget xsi:type="UiWidgetType">
More information about the fusion-commits
mailing list