[fusion-commits] r2123 - in sandbox/jxlib-3.0: . layers
layers/Generic layers/MapGuide layers/MapGuide/php
layers/MapServer lib text widgets widgets/BufferPanel
widgets/Theme widgets/Theme/classes
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Wed Mar 31 15:07:52 EDT 2010
Author: madair
Date: 2010-03-31 15:07:52 -0400 (Wed, 31 Mar 2010)
New Revision: 2123
Modified:
sandbox/jxlib-3.0/
sandbox/jxlib-3.0/BUILDING.TXT
sandbox/jxlib-3.0/COPYING.TXT
sandbox/jxlib-3.0/build.xml
sandbox/jxlib-3.0/layers/Generic/Generic.js
sandbox/jxlib-3.0/layers/Layers.js
sandbox/jxlib-3.0/layers/MapGuide/MapGuide.js
sandbox/jxlib-3.0/layers/MapGuide/php/GetSelectionProperties.php
sandbox/jxlib-3.0/layers/MapGuide/php/SaveSelection.php
sandbox/jxlib-3.0/layers/MapServer/MapServer.js
sandbox/jxlib-3.0/lib/ApplicationDefinition.js
sandbox/jxlib-3.0/lib/Map.js
sandbox/jxlib-3.0/lib/fusion.js
sandbox/jxlib-3.0/text/fr
sandbox/jxlib-3.0/widgets/BufferPanel/BufferPanel.templ
sandbox/jxlib-3.0/widgets/MapMenu.js
sandbox/jxlib-3.0/widgets/Measure.js
sandbox/jxlib-3.0/widgets/OverviewMap.js
sandbox/jxlib-3.0/widgets/SelectAttribute.js
sandbox/jxlib-3.0/widgets/TaskPane.js
sandbox/jxlib-3.0/widgets/Theme/classes/theme.php
sandbox/jxlib-3.0/widgets/Theme/thememain.php
Log:
merge of Fusion trunk rev 2053-2114; except for Legend.js which will need some work to resolve conflicts; this allows the MapMenu widget to switch between maps in different projections
Property changes on: sandbox/jxlib-3.0
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk:1958-2051
+ /trunk:1958-2051,2053-2117
Modified: sandbox/jxlib-3.0/BUILDING.TXT
===================================================================
--- sandbox/jxlib-3.0/BUILDING.TXT 2010-03-31 02:31:02 UTC (rev 2122)
+++ sandbox/jxlib-3.0/BUILDING.TXT 2010-03-31 19:07:52 UTC (rev 2123)
@@ -16,10 +16,8 @@
For some tasks, external executable files are used and must be available for
execution on the PATH environment variable.
-This script requires an HTDOCS environment variable be set to point to the
-document root directory of your web server.
+Targets available include:
-targets available include:
prepare - creates a "build" subdirectory with all files required to be put on
the web server
deploy - places a copy of the build directory in the web server HTDOCS directory
@@ -42,11 +40,14 @@
Properties that can be set (and their defaults) include:
-<property name="sfName" value="${build.home}/lib/fusionSF"/>
-<property name="cssOutput" value="${sfName}"/>
-<property name="cssFiles" value=""/>
-<property name="appDef" value=""/>
+ <property name="YUIcompressor" value="${basedir}/utils/yuicompressor-2.3.6.jar"/>
+ <property name="sfName" value="fusionSF"/>
+ <property name="buildOutput" value="${build.home}/lib/${sfName}"/>
+ <property name="cssOutput" value="${build.home}/lib/${sfName}"/>
+ <property name="cssFiles" value=""/>
+ <property name="PHP" value="/usr/local/php5cgi/bin/php"/>
+
These properties can be assigned a value when ant is invoked by using the
-D command line option, e.g.:
Modified: sandbox/jxlib-3.0/COPYING.TXT
===================================================================
--- sandbox/jxlib-3.0/COPYING.TXT 2010-03-31 02:31:02 UTC (rev 2122)
+++ sandbox/jxlib-3.0/COPYING.TXT 2010-03-31 19:07:52 UTC (rev 2123)
@@ -1,14 +1,9 @@
Fusion License
-Scriptaculous and prototype are third party libraries included in the jx
-directory and are distributed under their own licenses. Please see
-MIT-LICENSE in the Scriptaculous directory for more information.
+Mootools is a third party library included in the jx distribution and is
+distributed under an MIT-style license. Please see the jxlib.uncompressed.js
+file for more information.
-ExplorerCanvas is Copyright 2006 Google Inc. and is distributed under
-the Apache License Version 2.0, January 2004.
-
-JavaScript Scalebar for MapServer (widgets/scalebar/) is Copyright (c) 2005 Tim Schaub of CommEn Space (http://www.commenspace.org) and is distributed under the LGPL license.
-
This license applies to all files obtained with the fusion source that are not
explicitly covered by a separate license.
Modified: sandbox/jxlib-3.0/build.xml
===================================================================
--- sandbox/jxlib-3.0/build.xml 2010-03-31 02:31:02 UTC (rev 2122)
+++ sandbox/jxlib-3.0/build.xml 2010-03-31 19:07:52 UTC (rev 2123)
@@ -74,7 +74,7 @@
<property environment="env"/>
<property name="app.name" value="fusion"/>
<property name="app.path" value="/${app.name}"/>
- <property name="app.version" value="1.1.x"/>
+ <property name="app.version" value="2.0.x"/>
<property name="build.home" value="${basedir}/build"/>
<property name="deploy.home" value="${basedir}/../${app.name}"/>
<property name="dist.home" value="${basedir}/dist"/>
@@ -155,8 +155,7 @@
<arg value="-i ./"/>
<arg value="-o html ./docs"/>
<arg value="-p ./docs/NaturalDocs"/>
- <arg value="-xi ./scriptaculous"/>
- <arg value="-xi ./lib"/>
+ <arg value="-xi ./lib"/>
<arg value="-r"/>
-->
<arg line="/c perl C:\Progra~1\NaturalDocs\NaturalDocs -i ./lib -i ./widgets -o html ./docs/NaturalDocs -p ./docs/NaturalDocs -r"/>
@@ -213,6 +212,7 @@
<filelist dir="${build.home}/lib"
files=" SingleFile.js
fusion.js
+ proj4js-compressed.js
OpenLayers/OpenLayers.js
jxlib.uncompressed.js
Error.js
Modified: sandbox/jxlib-3.0/layers/Generic/Generic.js
===================================================================
--- sandbox/jxlib-3.0/layers/Generic/Generic.js 2010-03-31 02:31:02 UTC (rev 2122)
+++ sandbox/jxlib-3.0/layers/Generic/Generic.js 2010-03-31 19:07:52 UTC (rev 2123)
@@ -166,12 +166,22 @@
}
if (!this.oLayerOL) {
- if (!this.mapTag.layerOptions.maxExtent) {
- this.mapTag.layerOptions.maxExtent = new OpenLayers.Bounds(-20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892);
- }
if (typeof this.mapTag.layerOptions.sphericalMercator == 'undefined') {
this.mapTag.layerOptions.sphericalMercator = true;
}
+ if (this.mapTag.layerOptions.sphericalMercator) {
+ if (!this.mapTag.layerOptions.maxExtent) {
+ this.mapTag.layerOptions.maxExtent = new OpenLayers.Bounds(-20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892);
+ }
+ this.mapTag.layerOptions.units = "m";
+ this.mapTag.layerOptions.projection = "EPSG:3785";
+ } else {
+ if (!this.mapTag.layerOptions.maxExtent) {
+ this.mapTag.layerOptions.maxExtent = new OpenLayers.Bounds(-180,-90,180,90);
+ }
+ this.mapTag.layerOptions.units = "dd";
+ this.mapTag.layerOptions.projection = "EPSG:4326";
+ }
if (typeof this.mapTag.layerOptions.numZoomLevels == 'undefined') {
this.mapTag.layerOptions.numZoomLevels = 20;
}
@@ -180,6 +190,7 @@
this.mapWidget.oMapOL.setOptions({fractionalZoom: false});
}
+
this.oLayerOL.events.register("loadstart", this, this.loadStart);
this.oLayerOL.events.register("loadend", this, this.loadEnd);
this.oLayerOL.events.register("loadcancel", this, this.loadEnd);
Modified: sandbox/jxlib-3.0/layers/Layers.js
===================================================================
--- sandbox/jxlib-3.0/layers/Layers.js 2010-03-31 02:31:02 UTC (rev 2122)
+++ sandbox/jxlib-3.0/layers/Layers.js 2010-03-31 19:07:52 UTC (rev 2123)
@@ -76,17 +76,6 @@
this.sMapResourceId = mapTag.resourceId ? mapTag.resourceId : '';
this.mapInfo = mapTag.mapInfo;
this.layerType = mapTag.type;
-
- //projection info from the extension
- if (mapTag.extension.ProjectionCode) {
- this.projCode = mapTag.extension.ProjectionCode[0];
- }
- if (mapTag.extension.ProjectionDef) {
- var projDef = mapTag.extension.ProjectionDef[0];
- this.projCode = "APP-DEF-PROJ";
- Proj4js.defs[this.projCode] = projDef;
- }
-
},
/**
@@ -111,7 +100,7 @@
},
getMetadata: function(key) {
- if (typeof this.metadata[key] != 'undefined') {
+ if (this.metadata && typeof this.metadata[key] != 'undefined') {
return this.metadata[key];
} else {
return '';
Modified: sandbox/jxlib-3.0/layers/MapGuide/MapGuide.js
===================================================================
--- sandbox/jxlib-3.0/layers/MapGuide/MapGuide.js 2010-03-31 02:31:02 UTC (rev 2122)
+++ sandbox/jxlib-3.0/layers/MapGuide/MapGuide.js 2010-03-31 19:07:52 UTC (rev 2123)
@@ -85,7 +85,7 @@
this.nTolerance = 2; //pixels, default pixel tolernace for a point click; TBD make this configurable
}
}
-
+
rootOpts = {
displayInLegend: this.bDisplayInLegend,
expandInLegend: this.bExpandInLegend,
@@ -300,12 +300,12 @@
}
//set projection units and code if supplied
+ if (o.epsg != 0) {
+ this.mapTag.layerOptions.projection = "EPSG:" + o.epsg;
+ }
//TODO: consider passing the metersPerUnit value into the framework
//to allow for scaling that doesn't match any of the pre-canned units
- this.units = Fusion.getClosestUnits(o.metersPerUnit);
- if (this.projCode) {
- this.mapWidget.setProjection(this.projCode);
- }
+ this.mapTag.layerOptions.units = Fusion.getClosestUnits(o.metersPerUnit);
//add in scales array if supplied
if (o.FiniteDisplayScales && o.FiniteDisplayScales.length>0) {
@@ -568,14 +568,13 @@
}
var layerOptions = {
- units: this.units,
maxResolution: 'auto',
useOverlay: this.selectionAsOverlay,
useAsyncOverlay: this.useAsyncOverlay,
ratio: this.ratio
};
if ((behavior & 1) == 0 && !/WebKit/.test(navigator.userAgent)) {
- //layerOptions.transitionEffect = 'resize';
+ layerOptions.transitionEffect = 'resize';
}
//add in scales array if supplied
Modified: sandbox/jxlib-3.0/layers/MapGuide/php/GetSelectionProperties.php
===================================================================
--- sandbox/jxlib-3.0/layers/MapGuide/php/GetSelectionProperties.php 2010-03-31 02:31:02 UTC (rev 2122)
+++ sandbox/jxlib-3.0/layers/MapGuide/php/GetSelectionProperties.php 2010-03-31 19:07:52 UTC (rev 2123)
@@ -179,7 +179,7 @@
} catch(MgException $e) {
- echo "/* SetSelection Exception: " . $e->GetDetails()."*/";
+ echo "ERROR: " . $e->GetDetails() . "\n";
}
function GetParameters($params)
Modified: sandbox/jxlib-3.0/layers/MapGuide/php/SaveSelection.php
===================================================================
--- sandbox/jxlib-3.0/layers/MapGuide/php/SaveSelection.php 2010-03-31 02:31:02 UTC (rev 2122)
+++ sandbox/jxlib-3.0/layers/MapGuide/php/SaveSelection.php 2010-03-31 19:07:52 UTC (rev 2123)
@@ -93,7 +93,7 @@
} catch(MgException $e) {
- echo "/* SetSelection Exception: " . $e->GetDetails()."*/";
+ echo "ERROR: " . $e->GetDetails() . "\n";
}
function GetParameters($params)
Modified: sandbox/jxlib-3.0/layers/MapServer/MapServer.js
===================================================================
--- sandbox/jxlib-3.0/layers/MapServer/MapServer.js 2010-03-31 02:31:02 UTC (rev 2122)
+++ sandbox/jxlib-3.0/layers/MapServer/MapServer.js 2010-03-31 19:07:52 UTC (rev 2123)
@@ -254,16 +254,12 @@
if (o.projString.length > 0) {
var epsg = o.projString.indexOf("init=");
if (epsg >= 0) {
- this.projCode = o.projString.substring(epsg+5).toUpperCase();
+ this.mapTag.layerOptions.projection = o.projString.substring(epsg+5).toUpperCase();
} else {
- this.projCode = o.mapName.toUpperCase();
- Proj4js.defs[this.projCode] = o.projString;
+ this.mapTag.layerOptions.projection = o.mapName.toUpperCase();
+ Proj4js.defs[this.mapTag.layerOptions.projection] = o.projString;
}
}
- if (this.projCode) {
- this.mapWidget.setProjection(this.projCode);
- }
- this.mapWidget.setMetersPerUnit(o.metersPerUnit);
this.mapTag.layerOptions.maxExtent = OpenLayers.Bounds.fromArray(o.extent);
@@ -293,12 +289,11 @@
}
//to allow for scaling that doesn't match any of the pre-canned units
- this.units = Fusion.getClosestUnits(o.metersPerUnit);
+ this.mapTag.layerOptions.units = Fusion.getClosestUnits(o.metersPerUnit);
var layerOptions = {
singleTile: true,
ratio: this.ratio,
- units: this.units,
maxResolution: 'auto',
minScale: maxScale, //OL interpretation of min/max scale is reversed from Fusion
maxScale: minScale
@@ -330,7 +325,6 @@
if (this.bIsMapWidgetLayer) {
this.mapWidget.addMap(this);
- this.mapWidget.oMapOL.units = this.oLayerOL.units;
}
this.bMapLoaded = true;
}
@@ -842,6 +836,14 @@
Fusion.ajaxRequest(s, params);
},
+ getMetadata: function(key) {
+ if (this.metadata && typeof this.metadata[key] != 'undefined') {
+ return this.metadata[key];
+ } else {
+ return '';
+ }
+ },
+
getGroupInfoUrl: function(groupName) {
return null;
},
Modified: sandbox/jxlib-3.0/lib/ApplicationDefinition.js
===================================================================
--- sandbox/jxlib-3.0/lib/ApplicationDefinition.js 2010-03-31 02:31:02 UTC (rev 2122)
+++ sandbox/jxlib-3.0/lib/ApplicationDefinition.js 2010-03-31 19:07:52 UTC (rev 2123)
@@ -486,6 +486,7 @@
type: null,
singleTile: false,
extension: null,
+
initialize: function(jsonNode) {
/* TODO: type can be any supported OpenLayers type */
this.type = jsonNode.Type[0];
@@ -522,6 +523,22 @@
this.layerParams[key] = tagParams[0][key][0];
}
}
+
+ //projection info from the extension
+ //this.layerOptions.projection = "EPSG:4326"; //default to WGS84 lat long
+ if (this.extension.ProjectionCode) {
+ this.layerOptions.projection = this.extension.ProjectionCode[0];
+ }
+ if (this.extension.ProjectionDef) {
+ var projDef = this.extension.ProjectionDef[0];
+ if (!this.layerOptions.projection) {
+ this.layerOptions.projection = "APP-DEF-PROJ";
+ }
+ Proj4js.defs[this.layerOptions.projection] = projDef;
+ }
+ if (!this.layerOptions.projection) {
+ this.layerOptions.projection = "EPSG:4326";
+ }
switch (this.type) {
case 'MapGuide':
@@ -530,7 +547,19 @@
Fusion.require('layers/' + this.type + '/' + this.type + '.js');
}
break;
+ case "Google":
+ case "Yahoo":
+ case "VirtualEarth":
+ this.layerOptions.isBaseLayer = true;
+ this.layerOptions.sphericalMercator = true;
+ this.layerOptions.displayProjection = "EPSG:4326";
+ //no break here continue below to set EPSG:3785 as projCode
default:
+ if (this.layerOptions.sphericalMercator) {
+ this.layerOptions.projection = "EPSG:3785"; //commercial map layer projection spherical mercator
+ } else {
+ this.layerOptions.projection = "EPSG:4326"; //WGS84 lat long
+ }
if ( !Fusion.Layers.Generic ) {
Fusion.require('layers/Generic/Generic.js');
}
Modified: sandbox/jxlib-3.0/lib/Map.js
===================================================================
--- sandbox/jxlib-3.0/lib/Map.js 2010-03-31 02:31:02 UTC (rev 2122)
+++ sandbox/jxlib-3.0/lib/Map.js 2010-03-31 19:07:52 UTC (rev 2123)
@@ -27,6 +27,7 @@
* Class: Fusion.Widget.Map
*
* generic class for map widgets. Provides common utility classes.
+ * This class provides a wrapper around the OpenLayers Map object.
* **********************************************************************/
Fusion.Event.MAP_EXTENTS_CHANGED = Fusion.Event.lastEventId++;
@@ -45,6 +46,7 @@
Fusion.Event.MAP_SCALE_RANGE_LOADED = Fusion.Event.lastEventId++;
Fusion.Event.MAP_MAP_GROUP_LOADED = Fusion.Event.lastEventId++;
+
Fusion.Constant.LAYER_POINT_TYPE = 0;
Fusion.Constant.LAYER_LINE_TYPE = 1;
Fusion.Constant.LAYER_POLYGON_TYPE = 2;
@@ -53,37 +55,69 @@
Fusion.Constant.LAYER_DWF_TYPE = 5;
Fusion.Widget.Map = OpenLayers.Class(Fusion.Lib.EventMgr, {
+
+ /** The DOM object that holds the map */
_oDomObj: null,
+
+ /** The id of DOM object */
_sDomObj: '',
+
+ /** The internal name used for the map, usually assigned by the server */
_sMapname: '',
- _nWidth: -1,
- _nHeight: -1,
+
+ /** conversion factor to convert from map units to meters */
_fMetersperunit: -1,
+
+ /** scale denominator value */
_fScale: -1,
+
+ /** Dots per inch setting for the server */
_nDpi: 96,
+
+ /** The current bounds of the map, this is updated on every map draw */
_oCurrentExtents: null,
+
+ /** The maximum extent of the map */
maxExtent: new OpenLayers.Bounds(),
+
+ /** counter of worker threads for the ActivityIndicator widget */
_nWorkers: 0,
+
+ /** The context menu object for right click */
oContextMenu: null,
+
+ /** flag to disable the map context menu, set this in the Map extension */
bSupressContextMenu: false,
-
+
+ /** an array to hold all the individual map layer objects */
aMaps: null,
+
+ /** flag to indicate if all the map layers are loaded */
mapsLoaded: false,
+
+ /** the root of the layer structure for the Legend */
layerRoot: null,
+
+ /** flag to indicate if the map is tiled or not, set in the Map extension */
singleTile: true,
+
+ /** flag to indicate if fractional zoom is supported, ie. allow any scale
+ * value rather than a fixed set of scales
+ */
fractionalZoom: true,
+
+ /** The DOM object that holds the map */
maxScale: null, //set this to a large number in AppDef to zoom out beyond maxExtent, e.g. 1 billion
/**
* construct a new view Fusion.Widget.Map class.
*/
- initialize : function(widgetTag, mapGroup, widgetSet) {
+ initialize: function(widgetTag, mapGroup, widgetSet) {
this.widgetTag = widgetTag;
var name = widgetTag.name;
this.aMaps = [];
this.buttonSet = new Jx.ButtonSet();
this.widgetSet = widgetSet;
- this._nCellSize = -1;
this._sDomObj = name;
this._oDomObj = $(this._sDomObj);
this.layerRoot = new Fusion.Layers.Group({
@@ -102,6 +136,7 @@
this.fractionalZoom = widgetTag.extension.FractionalZoom[0]=='false'?false:true;
}
+ //if there is a scales array specified, use that set and turn off fraczoom
var scalesArray = null;
if (widgetTag.extension.Scales) {
scalesArray = widgetTag.extension.Scales[0].split(',');
@@ -114,11 +149,13 @@
this.maxScale = parseInt(widgetTag.extension.MaxExtent[0]);
}
+ //set the maxExtent
var maxExtent = null;
if (widgetTag.extension.MaxExtent) {
maxExtent = OpenLayers.Bounds.fromString(widgetTag.extension.MaxExtent[0]);
}
+ //create the OpenLayers Map object
OpenLayers.DOTS_PER_INCH = this._nDpi;
if (!this.oMapOL) {
var options = {
@@ -137,6 +174,7 @@
this.oMapOL = new OpenLayers.Map(this._sDomObj, options );
}
+ //Fusion specific modifications to the OL map window style
this.oMapOL.viewPortDiv.style.position = 'absolute'; //not the top level container so set it to absolute
this.oMapOL.viewPortDiv.style.zIndex = 0; //must explicitly set the z-index for FF3
@@ -192,11 +230,29 @@
this.loadMapGroup(mapGroup);
},
+ /**
+ * Function: mapLoaded
+ *
+ * Callback for when all maps have been loaded
+ *
+ * Parameter: none.
+ *
+ * Return: none
+ */
mapLoaded: function() {
this.setViewOptions(this.getUnits());
this.loadScaleRanges(OpenLayers.Function.bind(this.scaleRangesLoaded, this));
},
+ /**
+ * Function: setMenu
+ *
+ * Attaches a context menu as defined in the AppDef to the map
+ *
+ * Parameter: none.
+ *
+ * Return: none
+ */
setMenu: function() {
if (this.widgetTag.extension.MenuContainer) {
var contextMenu = new Jx.Menu.Context();
@@ -208,6 +264,15 @@
}
},
+ /**
+ * Function: loadMapGroup
+ *
+ * Controls the creation of Layers based on the MapGroup object passed in
+ *
+ * Parameter: {Object} mapGroup - a representation of the MapGroup object
+ *
+ * Return: none
+ */
loadMapGroup: function(mapGroup) {
//clear any existing selection
this.mapsLoaded = false;
@@ -220,7 +285,10 @@
this.aMaps[i].oLayerOL.destroy();
}
}
-
+
+ this._fMetersperunit = -1;
+ this.oMapOL.center = null;
+ this.maxExtent = new OpenLayers.Bounds();
this.aMaps = [];
this.layerRoot.clear();
@@ -237,9 +305,20 @@
}
this.aMaps[i].registerForEvent(Fusion.Event.LAYER_LOADED, OpenLayers.Function.bind(this.layerLoaded,this));
}
- this.triggerEvent(Fusion.Event.MAP_MAP_GROUP_LOADED);
+ this.triggerEvent(Fusion.Event.MAP_MAP_GROUP_LOADED);
},
+ /**
+ * Function: layerLoaded
+ *
+ * Called after each layer is loaded in the OL viewport. Nothing happens
+ * here until the last layer is laoded, then it sets the OL baselayer and
+ * zooms to the initial extent.
+ *
+ * Parameter: none
+ *
+ * Return: none
+ */
layerLoaded: function() {
for (var i=0; i<this.aMaps.length; ++i) {
if (!this.aMaps[i].isMapLoaded()) {
@@ -271,10 +350,14 @@
},
/**
- * Method: wheelChange
+ * Function: wheelChange
*
+ * handles mouse wheel events by accummulating the events and setting a timer
+ * to do the actual zoom in/out
+ *
* Parameters:
- * evt - {Event}
+ * evt - {Event} the mouse wheel event object
+ * deltaZ - {Integer} the number of ticks wheeled
*/
wheelChange: function(evt, deltaZ) {
if (this.wheelTimer) {
@@ -287,6 +370,17 @@
this.wheelTimer = setTimeout(OpenLayers.Function.bind(function(){this.doWheelChange(evt, deltaZ);}, this), 200);
},
+ /**
+ * Function: doWheelChange
+ *
+ * Carries out the actual map zoom based on the wheel movement
+ *
+ * Parameters:
+ * evt - {Event} the mouse wheel event object
+ * deltaZ - {Integer} the number of ticks wheeled
+ *
+ * Return: none
+ */
doWheelChange: function(evt, deltaZ) {
this.wheelTimer = null;
if (this.cumulativeDelta == 0) {
@@ -333,19 +427,43 @@
},
/**
- * returns the dom element
+ * Function: getDomObj
+ *
+ * returns the dom element for this widget
+ *
+ * Parameters: none
+ *
+ * Return: none
*/
getDomObj: function() {
return this._oDomObj;
},
+ /**
+ * Function: getMapName
+ *
+ * returns the name of the baselayer map
+ *
+ * Parameters: none
+ *
+ * Return: {String} the name of the baselayer map
+ */
getMapName: function() {
//TODO: what is the mapname in the case of multiple map layer objects?
//just return baselayer mapname for now
return this.aMaps[0].getMapName();
},
+ /**
+ * Function: getMapTitle
+ *
+ * returns the Title of the baselayer map. This is a human-readable title
+ *
+ * Parameters: none
+ *
+ * Return: {String} the Title of the baselayer map
+ */
getMapTitle: function() {
//TODO: what is the map title in the case of multiple map layer objects?
//just return baselayer mapTitle for now
@@ -358,31 +476,61 @@
return this.aMaps[0].getMetadata(key);
},
+ /**
+ * Function: getSessionID
+ *
+ * returns the server session ID
+ *
+ * Parameters: none
+ *
+ * Return: {String} the session ID
+ */
getSessionID: function() {
//TODO: what is the mapname in the case of multiple map layer objects?
//just return baselayer session ID for now
return this.aMaps[0].getSessionID();
},
+ /**
+ * Function: getDomId
+ *
+ * returns the ID of dom element for this widget
+ *
+ * Parameters: none
+ *
+ * Return: {String} the id of the DOM element
+ */
getDomId: function() {
return this._sDomObj;
},
+ /**
+ * Function: setMapOptions
+ *
+ * sets options on the OpenLayers map object, a wrapper for the OL function
+ *
+ * Parameters: {Object} options - has of option key/value pairs
+ *
+ * Return: none
+ */
setMapOptions: function(options) {
this.oMapOL.setOptions(options);
},
+ /**
+ * Function: addMap
+ *
+ * adds a map/Layer to the map and registers some event handlers on the map
+ *
+ * Parameters: {Object} map - the map object to tbe added (really a layer object)
+ *
+ * Return: none
+ */
addMap: function(map) {
if (map.mapTag.layerOptions.maxExtent) {
- this.projection = map.projection;
- this.units = map.units;
this.maxExtent.extend(map.mapTag.layerOptions.maxExtent);
- this.oMapOL.setOptions({
- maxExtent: this.maxExtent,
- units: map.units,
- projection: this.projection
- });
+ this.oMapOL.setOptions({maxExtent: this.maxExtent});
}
//if bRestrictExtent is null, use the default OL behaviour with somewhat restricted map navigation
@@ -396,19 +544,44 @@
}
}
this.oMapOL.addLayer(map.oLayerOL);
- map.registerForEvent(Fusion.Event.MAP_LOADED,
- OpenLayers.Function.bind(this.mapLoadHandler, this));
+ if (map.oLayerOL.isBaseLayer) {
+ this.projection = map.projection;
+ this.units = map.units;
+ this.oMapOL.setOptions({
+ units: map.units,
+ projection: this.projection
+ });
+ }
+
map.registerForEvent(Fusion.Event.MAP_SELECTION_OFF,
OpenLayers.Function.bind(this.selectionHandler, this));
map.registerForEvent(Fusion.Event.MAP_SELECTION_ON,
OpenLayers.Function.bind(this.selectionHandler, this));
},
+ /**
+ * Function: getAllMaps
+ *
+ * returns the array of map objects
+ *
+ * Parameters: none
+ *
+ * Return: {Array} the array of map Objects
+ */
getAllMaps: function() {
return this.aMaps;
},
- //this uses setTimeout so this method can be called from an IFRAME
+ /**
+ * Function: reloadMap
+ *
+ * Called to reload all the map objects.
+ * this uses setTimeout so this method can be called from an IFRAME
+ *
+ * Parameters: none
+ *
+ * Return: none
+ */
reloadMap: function() {
for (var i=0; i<this.aMaps.length; ++i) {
var map = this.aMaps[i];
@@ -416,6 +589,17 @@
}
},
+ /**
+ * Function: loadScaleRanges
+ *
+ * Loads the ScaleRange objects separate from the LoadMap sequence since
+ * this also generates sprites and is a relatively expensive operation.
+ *
+ * Parameters: {Function} userFunc - a user defined function to be called as a
+ * callback
+ *
+ * Return: none
+ */
loadScaleRanges: function() {
for (var i=0; i<this.aMaps.length; ++i) {
var map = this.aMaps[i];
@@ -426,7 +610,9 @@
/**
* Function: query
*
- * dispatch query requests to maps
+ * dispatch query requests to the maps
+ *
+ * Parameters: {object} options - query options to be passed to each map
*/
query: function(options) {
this.lastQueryOptions = options;
@@ -437,25 +623,14 @@
},
/**
- * Function: mapLoadHandler
+ * Function: selectionHandler
*
* handle selection events from maps and republish for
* widgets as appropriate
- */
- mapLoadHandler: function() {
- ++this.mapLoadCounter;
- if (this.mapLoadCounter == this.aMaps.length) {
- this._oInitialExtents = null;
- this.fullExtents();
- this.triggerEvent(Fusion.Event.MAP_LOADED);
- }
- },
-
- /**
- * Function: selectionHandler
*
- * handle selection events from maps and republish for
- * widgets as appropriate
+ * Parameters: none
+ *
+ * Return: none
*/
selectionHandler: function() {
if (this.hasSelection()) {
@@ -468,7 +643,9 @@
/**
* Function: hasSelection
*
- * returns true if any map has a selection
+ * cehck to see if any of the maps have an active selection
+ *
+ * Returns: {Boolean} - true if any map has a selection
*/
hasSelection: function() {
for (var i=0; i<this.aMaps.length; i++ ) {
@@ -495,7 +672,7 @@
/**
* Function: getSelection
*
- * returns the current selection asynchronously in case we
+ * initiates a call to get the current selection asynchronously in case we
* need to retrieve the details from the server
*/
getSelection: function(callback, layers, startcount) {
@@ -523,7 +700,11 @@
/**
* Function: setSelection
*
- * sets a Selection XML back to the server
+ * sets a Selection XML back to the server for each of the maps
+ *
+ * Parameters:
+ * {String} selText - the selection string
+ * {Boolean} zoomTo - if set, will zoom to the selection on completion
*/
setSelection: function(selText, zoomTo) {
for (var i=0; i<this.aMaps.length; i++ ) {
@@ -536,6 +717,10 @@
*
* accumulate the selection results from each map and when all have
* reported in, pass the results to the callback function
+ *
+ * Parameters:
+ * {Object} map - the map object that has the selection
+ * {Object} oSelection - the Fusion selection object
*/
accumulateSelection: function(map, oSelection) {
this.oSelection[map._sMapname] = oSelection;
@@ -553,25 +738,33 @@
* Function: setActiveLayer
*
* sets the active layer for selection/manipulation
+ *
+ * Parameters:
+ * {Object} oLayer - the layer to be set as active
*/
- setActiveLayer: function( oLayer ) {
- this.oActiveLayer = oLayer;
- if (oLayer) {
- this.oActiveMap = oLayer.map;
- }
- this.triggerEvent(Fusion.Event.MAP_ACTIVE_LAYER_CHANGED, oLayer);
- },
+ setActiveLayer: function( oLayer ) {
+ this.oActiveLayer = oLayer;
+ if (oLayer) {
+ this.oActiveMap = oLayer.map;
+ }
+ this.triggerEvent(Fusion.Event.MAP_ACTIVE_LAYER_CHANGED, oLayer);
+ },
/**
* Function: getActiveLayer
*
* returns the active layer for selection/manipulation
+ *
+ * Returns:
+ * {Object} the active layer
*/
getActiveLayer: function() {
return this.oActiveLayer;
},
/**
+ * Function: _addWorker
+ *
* indicate that a new asynchronous process has started and make sure the
* visual indicator is visible for the user. This is intended to be used
* internally by gMap but could be used by external tools if appropriate.
@@ -583,6 +776,8 @@
},
/**
+ * Function: _removeWorker
+ *
* indicate that an asynchronous process has completed and hide the
* visual indicator if no remaining processes are active. This is
* intended to be used internally by gMap but could be used by
@@ -597,19 +792,57 @@
this.triggerEvent(Fusion.Event.MAP_BUSY_CHANGED, this);
},
+ /**
+ * Function: mapExtentsChanged
+ *
+ * OpenLayers event handler for whenever the map changes either zoom level
+ * of the center has changed. This in turn triggers the Fusion event.
+ *
+ * Parameters: none
+ *
+ * Return: none
+ */
mapExtentsChanged: function() {
this._oCurrentExtents = this.oMapOL.getExtent();
this.triggerEvent(Fusion.Event.MAP_EXTENTS_CHANGED);
},
+ /**
+ * Function: isBusy
+ *
+ * check to see if there are any outstanding requests to the server
+ *
+ * Parameters: none
+ *
+ * Return: {Boolean} true if there are active requests
+ */
isBusy: function() {
return this._nWorkers > 0;
},
+ /**
+ * Function: sizeChanged
+ *
+ * callback for when the browser window size changes, simply calls resize
+ * on the map viewport layout object
+ *
+ * Parameters: none
+ *
+ * Return: none
+ */
sizeChanged: function() {
this.resize();
},
+ /**
+ * Function: resize
+ *
+ * handles the resizing of the maps and triggers a Fusion event
+ *
+ * Parameters: none
+ *
+ * Return: none
+ */
resize: function() {
if (!this.mapsLoaded) {
return;
@@ -617,29 +850,57 @@
//console.log('Fusion.Widget.Map.resize');
this.oMapOL.updateSize();
var d = $(this.getDomObj()).getContentBoxSize();
- this._nWidth = d.width;
- this._nHeight = d.height;
if (this._oCurrentExtents) {
this.setExtents(this._oCurrentExtents);
}
this.triggerEvent(Fusion.Event.MAP_RESIZED, this);
},
+ /**
+ * Function: redraw
+ *
+ * redraws the map using current extents and zoom level. A dummy parameter
+ * is added to the map request to ensure the map request is not cached.
+ *
+ * Parameters: none
+ *
+ * Return: none
+ */
redraw: function() {
for (var i=0; i<this.aMaps.length; i++ ) {
- if(this.aMaps[i].oLayerOL.params){
+ if(this.aMaps[i].oLayerOL.params){
this.aMaps[i].oLayerOL.params.ts = (new Date()).getTime();
//mergeNewParams calls redraw on the layer, which will get called below anyway
//this.aMaps[i].oLayerOL.mergeNewParams({ts : (new Date()).getTime()});
- }
+ }
}
this.oMapOL.setCenter(this.oMapOL.getCenter(), this.oMapOL.getZoom(), false, true);
},
+ /**
+ * Function: setBackgroundColor
+ *
+ * sets the background color for the map
+ *
+ * Parameters: {String} color - the CSS color value to set as background
+ *
+ * Return: none
+ */
setBackgroundColor: function(color) {
this._oDomObj.style.backgroundColor = color;
},
+ /**
+ * Function: setExtents
+ *
+ * handle selection events from maps and republish for
+ * widgets as appropriate
+ *
+ * Parameters: {Object} oExtents - an OpenLayers.Bounds object or an array
+ * of 4 values that will be converted to Bounds
+ *
+ * Return: none
+ */
setExtents: function(oExtents) {
if (!oExtents) {
Fusion.reportError(new Fusion.Error(Fusion.Error.WARNING,
@@ -660,10 +921,14 @@
},
/**
+ * Function: setInitialExtents
+ *
* determine the initialExtents of the map from (in order of precedence):
* 1. a URL query parameter called 'extent'
* 2. an <InitialView> specified in the MapGroup in AppDef
* 3. the maxExtent as specified by the LoadMap call (default)
+ *
+ * Returns: {Object} an OpenLayers.Bounds object which is the initial extent
*/
setInitialExtents: function() {
var initialExtents;
@@ -692,7 +957,12 @@
},
/**
- * sets the extent by examining all mapgroup map extents
+ * Function: getMapGroupExtent
+ *
+ * gets the intitial extents from all maps with or without including the
+ * extent of any Generic/commercial layers
+ *
+ * Return: {Object} an OpenLayers.Bounds object which is the initial extent
*/
getMapGroupExtent: function(includeGenericLayers) {
var initialExtent;
@@ -706,6 +976,8 @@
},
/**
+ * Function: fullExtents
+ *
* sets the extent of the map to the max as returned by loadMap
*/
fullExtents: function() {
@@ -713,10 +985,34 @@
this.setExtents(extents);
},
+ /**
+ * Function: isMapLoaded
+ *
+ * returns if the map has finished loading (based on setting the
+ * _oCurrentExtent value)
+ *
+ * Returns {Boolean} true if the map is loaded and extent has been set
+ */
isMapLoaded: function() {
return (this._oCurrentExtents) ? true : false;
},
+ /**
+ * Function: zoom
+ *
+ * sets the map zoom and extent.
+ *
+ * Parameters:
+ * fX {Float} - new x coordinate value in map units
+ * fY {Float} - new y coordinate value in map units
+ * nFactor {Float} - zoom factor; positive values zoom in, negative out
+ * - if set to 0 or 1, the map is just recentered
+ * - if the map has fractional zoom enabled, the map resolution
+ * will be modified by this factor
+ * - with fixed scales, zoom up or down one level, depending on the sign
+ *
+ * Returns: none
+ */
zoom: function(fX, fY, nFactor) {
//do this differntly with OL code??
if (nFactor == 1 || nFactor == 0) {
@@ -753,15 +1049,63 @@
}
},
+ /**
+ * Function: zoom
+ *
+ * sets the map zoom and extent.
+ *
+ * Parameters:
+ * fX {Float} - new x coordinate value in map units
+ * fY {Float} - new y coordinate value in map units
+ * nFactor {Float} - zoom factor; positive values zoom in, negative out
+ * - if set to 0 or 1, the map is just recentered
+ * - if the map has fractional zoom enabled, the map resolution
+ * will be modified by this factor
+ * - with fixed scales, zoom up or down one level, depending on the sign
+ *
+ * Returns: none
+ */
zoomToScale: function(fScale) {
var center = this.getCurrentCenter();
var extent = this.getExtentFromPoint(center.x, center.y, fScale);
this.setExtents(extent);
},
- queryRect : function(fMinX, fMinY, fMaxX, fMaxY) { },
+ /**
+ * Function: zoom
+ *
+ * sets the map zoom and extent.
+ *
+ * Parameters:
+ * fX {Float} - new x coordinate value in map units
+ * fY {Float} - new y coordinate value in map units
+ * nFactor {Float} - zoom factor; positive values zoom in, negative out
+ * - if set to 0 or 1, the map is just recentered
+ * - if the map has fractional zoom enabled, the map resolution
+ * will be modified by this factor
+ * - with fixed scales, zoom up or down one level, depending on the sign
+ *
+ * Returns: none
+ */
+ queryRect: function(fMinX, fMinY, fMaxX, fMaxY) { },
- queryPoint : function(fX, fY) { },
+ /**
+ * Function: zoom
+ *
+ * sets the map zoom and extent.
+ *
+ * Parameters:
+ * fX {Float} - new x coordinate value in map units
+ * fY {Float} - new y coordinate value in map units
+ * nFactor {Float} - zoom factor; positive values zoom in, negative out
+ * - if set to 0 or 1, the map is just recentered
+ * - if the map has fractional zoom enabled, the map resolution
+ * will be modified by this factor
+ * - with fixed scales, zoom up or down one level, depending on the sign
+ *
+ * Returns: none
+ */
+ queryPoint: function(fX, fY) { },
/**
*
@@ -773,7 +1117,7 @@
* @return an object with geographic coordinates in x and y properties of the
* object.
*/
- pixToGeo : function( pX, pY ) {
+ pixToGeo: function( pX, pY ) {
var lonLat = this.oMapOL.getLonLatFromPixel( new OpenLayers.Pixel(pX,pY) );
if (lonLat != null) {
return {x:lonLat.lon, y:lonLat.lat};
@@ -791,7 +1135,7 @@
* @return an object with pixel coordinates in x and y properties of the
* object.
*/
- geoToPix : function( gX, gY ) {
+ geoToPix: function( gX, gY ) {
if (!(this._oCurrentExtents)) {
return null;
}
@@ -807,7 +1151,7 @@
*
* @return geographic measure
*/
- pixToGeoMeasure : function(nPixels) {
+ pixToGeoMeasure: function(nPixels) {
var resolution = this.oMapOL.getResolution();
return (nPixels*resolution);
},
@@ -818,12 +1162,10 @@
*
* @param projCode projection code
*/
- setProjection: function(projCode) {
- if (!Proj4js.defs[projCode]) {
- Fusion.reportError( new Fusion.Error(Fusion.Error.WARNING,
- 'Projection definition not found for:'+projCode));
- }
+ setProjection: function(projCode, units) {
+ this.projection = projCode;
this.oMapOL.projection = projCode;
+ this.oMapOL.units = units;
},
/**
Modified: sandbox/jxlib-3.0/lib/fusion.js
===================================================================
--- sandbox/jxlib-3.0/lib/fusion.js 2010-03-31 02:31:02 UTC (rev 2122)
+++ sandbox/jxlib-3.0/lib/fusion.js 2010-03-31 19:07:52 UTC (rev 2123)
@@ -98,7 +98,7 @@
Lib: {},
/***************************************************************************
- * Class: Fusion.Maps
+ * Class: Fusion.Layers
*
* A set of classes that implement layer functionality for various server
* technologies.
@@ -112,21 +112,40 @@
***************************************************************************/
Constant: {},
+ /**
+ * Pointer to the Application Definition, parsed into all the Fusion
+ * objects: MapGroups, WidgetSets
+ */
applicationDefinition: null,
/**
- * URL to the configuration file to use for this application. The
- * configuration file must be located on the same domain as the
- * application template.
+ * URL of a proxy script if the map server is on a different domain/port
+ * that the application template to get around the same-origin policy
*/
- sConfigFileURL : "",
-
- sWebAgentURL : "",
- sWebTierURL : "",
- sRedirectScript : "",
- bForceRedirect : false,
- sScriptLang : "",
- locale : 'en',
+ sRedirectScript: "",
+
+ /**
+ * A flag to force XHR calls through the proxy, defaults to false
+ */
+ bForceRedirect: false,
+
+ /**
+ * the script programming language for server-side programming.
+ * Typically set to 'php' but other server languages may be used.
+ */
+ sScriptLang: "php",
+
+ /**
+ * the locale setting for the browser and for localization of Fusion.
+ * This is the same as the locale setting in OpenLayers and is used as
+ * the file name for localization files in the /text subdirectory
+ */
+ locale: 'en',
+
+ /**
+ * the hash of strings used for localization of Fusion. Strings are
+ * indexed by a key which is used in calls to OpenLayers.i18n()
+ */
Strings: {}, //locale specific strings
/** URL to the directory from which fusion.js was loaded */
@@ -134,18 +153,25 @@
/**
* configuration object that holds the server configuration as
- * loaded from fusion/config.xml
+ * loaded from fusion/config.json
*/
configuration: null,
- /* broker instance for communicating with the mapagent */
+ /**
+ * broker instance for communicating with the mapagent, typically only
+ * used with MapGuide
+ */
oBroker: null,
/** An array of scripts that are queued to be loaded */
- aScripts : [],
+ aScripts: [],
/** An array of scripts that are currently being loaded */
aLoadingScripts: [],
- /** The current state during initialization of the application */
+
+ /**
+ * The current state during initialization of the application. Valid
+ * states are enumerated below
+ */
loadState: null,
/** API loading has not begun */
@@ -157,7 +183,11 @@
/** Loading is complete */
LOAD_COMPLETE: 3,
- /** unit related stuff */
+ /**
+ * unit related stuff - the following values are the keys into the
+ * unit related arrays below: aUnitPerMeter, aMeterPerUnit, aUnitNames
+ * and aUnitAbbr
+ */
UNKNOWN: 0,
INCHES: 1,
FEET: 2,
@@ -172,6 +202,9 @@
DECIMALDEGREES: 11,
DMS: 12,
PIXELS: 13,
+ /**
+ * conversion factors to go from the specified units to meters
+ */
aUnitPerMeter: [1.0, /* 0 - UNKNOWN */
39.37, /* 1 - INCHES */
3.2808, /* 2 - FEET */
@@ -187,6 +220,9 @@
0.000009044, /* 12 - DMS */
1.0 /* 13 - PIXELS */
],
+ /**
+ * conversion factors to go from meters to the specified units
+ */
aMeterPerUnit: [1.0, /* 0 - UNKNOWN */
0.0254, /* 1 - INCHES */
0.3048, /* 2 - FEET */
@@ -201,9 +237,17 @@
111061.75033, /* 11 - DECIMALDEGREES */
111061.75033, /* 12 - DMS */
1.0 /* 13 - PIXELS */],
+
+ /**
+ * the units names spelled out fully
+ */
aUnitNames: ['Unknown','Inches', 'Feet', 'Yards', 'Miles', 'Nautical Miles',
'Millimeters', 'Centimeters', 'Meters', 'Kilometers',
'Degrees', 'Decimal Degrees', 'Degrees Minutes Seconds', 'Pixels'],
+
+ /**
+ * unit names abbreviations
+ */
aUnitAbbr: ['unk', 'in', 'ft', 'yd', 'mi', 'nm',
'mm', 'cm', 'm', 'km',
'°', '°', '°', 'px'],
@@ -211,24 +255,28 @@
/**
* Function: initialize
*
- * Initialize the Fusion application.
+ * Initialize the Fusion application. This method must be called from
+ * the template's onload method once all script files have been loaded.
+ * Applications can register for the event Fusion.Event.FUSION_INITIALIZED
+ * to carry out further application initialization when all the Fusion
+ * objects have been created and are available.
*
* @param {Object} options
*
* Optional paramters that can be passed to initialize are:
*
- * {String} applicationDefinition - a URL or resource ID
+ * {String} applicationDefinitionURL - a URL or resource ID
* for an ApplicationDefinition file
* {String} sessionId - a session id to start the application
* with. Normally, applications are started without
* a session id and create one. However, sometimes
* it is desirable to use an existing session.
*/
- initialize : function(options) {
+ initialize: function(options) {
options = options || {};
var sessionIdParam = this.getQueryParam('Session');
- // Override the pre-created sessionId by user specified sessionId(if exist)
- this.sessionId = sessionIdParam || options.sessionId || this.sessionId;
+ // Override the pre-created sessionId by user specified sessionId(if exist)
+ this.sessionId = sessionIdParam || options.sessionId || this.sessionId;
if (options.applicationDefinitionURL) {
this.applicationDefinitionURL = options.applicationDefinitionURL;
@@ -249,15 +297,12 @@
}
this.initializeLocale();
- this.sWebagentURL = "";
- this.sScriptLang = "";
-
/*
- * if the application has been loaded from the same host as
- * fusion is installed in, then technically we don't need to
- * use the redirect script because we conform to the
- * Same Origin Policy for XmlHttpRequest to work.
- */
+ * if the application has been loaded from the same host as
+ * fusion is installed in, then technically we don't need to
+ * use the redirect script because we conform to the
+ * Same Origin Policy for XmlHttpRequest to work.
+ */
var test = window.location.protocol+'//'+window.location.host;
var configUrl = 'config.json';
//if (this.fusionURL.indexOf(test,0) == 0) {
@@ -268,9 +313,6 @@
configUrl += '&method=get';
}
- /*script language*/
- this.sScriptLang = 'php';
-
if (Fusion.configuration) {
//config.json loaded via single file build
this.serverSet();
@@ -284,6 +326,19 @@
}
},
+ /**
+ * Function: initializeLocale
+ *
+ * Initialize the Strings hash with the requested locale. This method
+ * simply extends the OpenLayers strings hash with strings specific
+ * to Fusion. Add strings to the files in fusion/text/[locale].json.
+ * This method can be called before Fusion.initialize() if localized
+ * strings are required in the template initialization.
+ *
+ * @param {String} locale - the locale value e.g. 'en-CA' or simply 'en'
+ * for English
+ *
+ */
initializeLocale: function(locale) {
OpenLayers.Lang.setCode(locale ? locale : window._FusionLocale);
this.locale = OpenLayers.Lang.code;
@@ -333,6 +388,7 @@
break;
}
},
+
/**
* Function: loadQueuedScripts
*
@@ -379,7 +435,7 @@
*
* The url of the script.
*/
- queueScript : function(url) {
+ queueScript: function(url) {
if(!document.getElementById(url) && !this.aScripts[url]) {
var script = document.createElement('script');
script.defer = false;
@@ -393,6 +449,7 @@
this.aScripts.push(script);
}
},
+
/**
* Function: scriptFailed
*
@@ -438,11 +495,12 @@
}
}
},
+
/**
* Function: checkLoadingScripts
*
- * check if scripts have loaded. In IE, scripts don't seem to fire the onload
- * event. Safari also seems to have some problems.
+ * check if scripts have loaded. In IE, scripts don't seem to fire the
+ * onload event. Safari also seems to have some problems.
*/
checkLoadingScripts: function() {
var agt=navigator.userAgent.toLowerCase();
@@ -461,13 +519,15 @@
}
}
},
+
/**
* Function: loadConfig
*
- * asynchronously load the application definition through the broker and config
- * manager.
+ * asynchronously load the application definition. For MapGuide, also
+ * set up the broker object. Once the AppDef is loaded/created advance
+ * the laod state.
*/
- loadConfig : function() {
+ loadConfig: function() {
var mapAgentUrl = this.getConfigurationItem('mapguide', 'mapAgentUrl');
if (mapAgentUrl) {
this.oBroker = new Fusion.Lib.MGBroker();
@@ -495,7 +555,7 @@
* Parameter {Object} r
* an XMLHttpRequest object
*/
- getConfigCB : function(r) {
+ getConfigCB: function(r) {
if (r.responseText) {
eval("this.configuration="+r.responseText);
this.serverSet();
@@ -514,11 +574,11 @@
* Parameter {Object} r
* an XMLHttpRequest object
*/
- serverSet : function() {
+ serverSet: function() {
var s = this.configuration.mapguide.webTierUrl;
/* if it is set, use it ... otherwise assume fusion is installed in
- * the default location and compute the web tier url from that
- */
+ * the default location and compute the web tier url from that
+ */
if (s) {
var nLength = s.length;
var slastChar = s.charAt((nLength-1));
@@ -570,8 +630,8 @@
*
* Parameter: {Object} options
*
- * optional parameters to send with the request, passed directly to
- * Prototype's Ajax.Request function
+ * optional parameters to send with the request, passed directly to the
+ * OpenLayers Ajax.Request function
*/
ajaxRequest: function(scriptURL, options) {
//console.log('options.parameters='+options.parameters);
@@ -613,22 +673,18 @@
},
/**
- * Function: convertXML
+ * Function: getXmlAsJson
*
- * Optionally convert XML to JSON using a server-side script
+ * Convert XML to JSON using a server-side script
* for requests that aren't available in JSON.
*
- * Parameter: {XmlHttpRequest} r
+ * Parameter: {String} url - the URL of the XML object to be converted;
+ * this can be any URL and is not prepended with the Fusion URL
*
- * the XmlHttpRequest object
+ * Parameter: {Function} callback - a callback function to be called if
+ * the request is successful
*
- * Parameter: json
- *
* boolean indicator if the content is JSON or not.
- *
- * Parameter: callback
- *
- * callback method to be executed on success and will be passed a parsed json object
*/
getXmlAsJson: function(url, callback) {
var options = {
@@ -639,6 +695,25 @@
var temp = new OpenLayers.Ajax.Request(url, options);
},
+ /**
+ * Function: xml2json
+ *
+ * Callback method to convert the XNR response into an actual json object
+ * and triggers the call to the callback method
+ *
+ * Parameter: callback
+ *
+ * callback method to be executed on success and will be passed a parsed json object
+ *
+ * Parameter: {XmlHttpRequest} r
+ *
+ * the XmlHttpRequest object
+ *
+ * Parameter: json
+ *
+ * boolean indicator if the content is JSON or not (set by OpenLayers)
+ *
+ */
xml2json: function(callback, r, json) {
if (json) {
var o;
@@ -676,7 +751,7 @@
*
* Returns: {Object} a map object or null if not found.
*/
- getMapByName : function(name) {
+ getMapByName: function(name) {
var map = null;
if (this.applicationDefinition) {
map = this.applicationDefinition.getMapByName(name);
@@ -687,7 +762,7 @@
/**
* Function: getMapById
*
- * return a map widget that is associated with the given dom element
+ * return a map widget that is associated with the given DOM element
* by id.
*
* Parameter: {String} id
@@ -696,7 +771,7 @@
*
* Returns: {Object} a map object or null if not found.
*/
- getMapById : function(id) {
+ getMapById: function(id) {
var map = null;
if (this.applicationDefinition) {
map = this.applicationDefinition.getMapById(id);
@@ -707,7 +782,8 @@
/**
* Function: getMapByIndice
*
- * return the map widget at the given index
+ * return the map widget at the given index if there are more than one
+ * map elements specified in the AppDef
*
* Parameter: {String} indice
*
@@ -715,7 +791,7 @@
*
* Returns: {Object} a map object or null if not found.
*/
- getMapByIndice : function(indice) {
+ getMapByIndice: function(indice) {
var map = null;
if (this.applicationDefinition) {
map = this.applicationDefinition.getMapByIndice(indice);
@@ -770,6 +846,13 @@
return widgets;
},
+ /**
+ * Function getSearchDefinitions
+ *
+ * returns the SearchDefinition objects as defined in the AppDef.
+ *
+ * Returns: {Array} an array of searchDefinitions, which may be empty
+ */
getSearchDefinitions: function() {
if (this.applicationDefinition) {
return this.applicationDefinition.searchDefinitions;
@@ -778,6 +861,13 @@
}
},
+ /**
+ * Function getSearchCategories
+ *
+ * returns the SearchCategory objects as defined in the AppDef.
+ *
+ * Returns: {Array} an array of searchCategories, which may be empty
+ */
getSearchCategories: function() {
if (this.applicationDefinition) {
return this.applicationDefinition.searchCategories;
@@ -786,12 +876,21 @@
}
},
+ /**
+ * Function getApplicationDefinitionURL
+ *
+ * returns the URL of the Application Definition
+ *
+ * Returns: {String} a URL
+ */
getApplicationDefinitionURL: function() { return this.applicationDefinitionURL; },
- /**
+ /**
* Function: getApplicationURL
*
* returns the applicaiton's absolute URL minus the filename.html part
+ *
+ * Returns: {String} a URL
*/
getApplicationURL: function() {
var path = window.location.pathname;
@@ -802,8 +901,26 @@
return window.location.protocol + "//" + window.location.host + path;
},
+ /**
+ * Function: getFusionURL
+ *
+ * returns the application's absolute URL minus the filename.html part
+ *
+ * Returns: {String} a URL
+ */
getFusionURL: function() {return this.fusionURL;},
+ /**
+ * Function: getConfigurationItem
+ *
+ * returns individual elements out of the Fusion config.json file
+ *
+ * Parameter: {String} arch - the server architecture (mapguide or mapserver)
+ *
+ * Parameter: {String} key - the config item to be returned
+ *
+ * Returns: {String} a the value for the key of null if not found
+ */
getConfigurationItem: function(arch, key) {
if (this.configuration[arch] && (this.configuration[arch][key]!='undefined')) {
return this.configuration[arch][key];
@@ -811,16 +928,73 @@
return null;
},
+ /**
+ * Function: getScriptLanguage
+ *
+ * Accessor to return the server-side script language
+ *
+ * Returns: {String} the script language e.g. 'php'
+ */
getScriptLanguage: function() { return this.configuration.general.scriptLanguage; },
+ /**
+ * Function: getRedirectScript
+ *
+ * Accessor to return the URL of the redirect script
+ *
+ * Returns: {String} a URL
+ */
getRedirectScript: function() { return this.sRedirectScript; },
+ /**
+ * Function: getBroker
+ *
+ * Accessor to return the broker object (for MapGuide only). The broker
+ * is used to prepare various queries to the MapGuide server.
+ *
+ * Returns: {Object} the broker object
+ */
getBroker: function() { return this.oBroker; },
+ /**
+ * Function: require
+ *
+ * Marks a JavaScript file as required which puts it into the queue for
+ * loading during Fusion initialization. Widget code is included
+ * through this mecahnism
+ *
+ * Parameter: {String} url - the URL of the JS file to be loaded
+ *
+ * Returns: none
+ */
require: function(url) { this.queueScript(url); },
+ /**
+ * Function: reportError
+ *
+ * Triggers the Fusion.Event.FUSION_ERROR and passes along the error
+ * object to the callback functions registered for this event. Widgets
+ * call Fusion.reportError(o) to inform the system of errors.
+ * Applications will typically register an event listener for the error
+ * event and do something to report the error to the user.
+ * By default, errors are not reported since there is no listener
+ *
+ * Parameter: {Object} o - the error object which is typically a string
+ *
+ * Returns: none
+ */
reportError: function(o) { this.triggerEvent(Fusion.Event.FUSION_ERROR, o); },
+ /**
+ * Function: unitFromName
+ *
+ * returns index into the units array for the given unit name or
+ * abbreviation
+ *
+ * Parameter: {String} unit - the units name to look up
+ *
+ * Returns: {Integer} index into the units array
+ */
unitFromName: function(unit) {
switch(unit.toLowerCase()) {
case 'unknown':
@@ -879,6 +1053,16 @@
}
},
+ /**
+ * Function: unitFromName
+ *
+ * Given a unit, this method returns if the units system is one of:
+ * imperial, metric, degrees or device units
+ *
+ * Parameter: {Integer} unit - the units array index
+ *
+ * Returns: {String} the units system
+ */
unitSystem: function(unit) {
switch(unit) {
@@ -904,12 +1088,31 @@
}
},
+ /**
+ * Function: unitName
+ *
+ * Given a unit, this method returns the units name
+ *
+ * Parameter: {Integer} unit - the units array index
+ *
+ * Returns: {String} the units name
+ */
unitName: function(unit) {
if (unit >= Fusion.UNKNOWN && unit <= Fusion.PIXELS) {
return (Fusion.aUnitNames[unit]);
}
return 'Unknown';
},
+
+ /**
+ * Function: unitAbbr
+ *
+ * Given a unit, this method returns the units abbreviation
+ *
+ * Parameter: {Integer} unit - the units array index
+ *
+ * Returns: {String} the units abbreviation
+ */
unitAbbr: function(unit) {
if (unit >= Fusion.UNKNOWN && unit <= Fusion.PIXELS) {
return (Fusion.aUnitAbbr[unit]);
@@ -917,6 +1120,17 @@
return 'Unk';
},
+ /**
+ * Function: toMeter
+ *
+ * Converts a length value from native units into meters. This is the
+ * identity transform if the input units are meters
+ *
+ * Parameter: {Integer} unit - the units array index
+ * Parameter: {Float} value - the value to be converted
+ *
+ * Returns: {Float} the value in meters
+ */
toMeter: function(unit, value) {
if (unit == Fusion.UNKNOWN) {
return value;
@@ -926,6 +1140,18 @@
}
return false;
},
+
+ /**
+ * Function: fromMeter
+ *
+ * Converts a length value from meters into native units. This is the
+ * identity transform if the native units are meters
+ *
+ * Parameter: {Integer} unit - the units array index
+ * Parameter: {Float} value - the value to be converted
+ *
+ * Returns: {Float} the value in native units
+ */
fromMeter: function(unit, value) {
if (unit == Fusion.UNKNOWN) {
return value;
@@ -935,6 +1161,18 @@
}
return false;
},
+
+ /**
+ * Function: convert
+ *
+ * Converts a length value from one unit system into another.
+ *
+ * Parameter: {Integer} unitsIn - the units array index of the input
+ * Parameter: {Integer} unitsOut - the units array index of the output
+ * Parameter: {Float} value - the value to be converted
+ *
+ * Returns: {Float} the value in output units
+ */
convert: function(unitsIn, unitsOut, value) {
if (unitsIn >= Fusion.UNKNOWN && unitsIn < Fusion.PIXELS &&
unitsOut >= Fusion.UNKNOWN && unitsOut < Fusion.PIXELS) {
@@ -944,11 +1182,15 @@
},
/**
- * initializes the meters per unit values when a new map is loaded. Some systems make different
- * assumptions for the conversion of degrees to meters so this makes sure both Fusion and
- * OpenLayers are using the same value.
+ * Function: initUnits
*
- * @param metersPerUnit the value returned by LoadMap.php for meters per unit
+ * initializes the meters per unit values when a new map is loaded.
+ * Some systems make different assumptions for the conversion of degrees
+ * to meters so this makes sure both Fusion and OpenLayers are using
+ * the same value.
+ *
+ * Parameter: {Float} metersPerUnit - the value returned by LoadMap.php
+ * for meters per unit
*/
initUnits: function(metersPerUnit) {
var eps = 1000;
@@ -967,11 +1209,13 @@
}
},
- /**
- * find the OpenLayers units identifier given the Fusion metersPerUnit value
- *
- * @param metersPerUnit the value returned by LoadMap.php for meters per unit
- */
+ /**
+ * Function: getClosestUnits
+ *
+ * find the OpenLayers units identifier given the Fusion metersPerUnit value
+ *
+ * @param metersPerUnit the value returned by LoadMap.php for meters per unit
+ */
getClosestUnits: function(metersPerUnit) {
var units = "degrees";
var minDiff = 100000000;
@@ -986,6 +1230,16 @@
return units;
},
+ /**
+ * Function: addWidgetStyleSheet
+ *
+ * Dynamically load a CSS stylesheet. The url will be prepended with
+ * the Fusion URL.
+ *
+ * Parameter: {String} url - the URL of the CSS file to be loaded
+ *
+ * Returns: none
+ */
addWidgetStyleSheet: function(url) {
var lnk = document.createElement('link');
var hd = document.getElementsByTagName('HEAD')[0];
@@ -995,6 +1249,15 @@
lnk.href = Fusion.getFusionURL()+url;
},
+ /**
+ * Function: parseQueryString
+ *
+ * An initialization time function to parse the application URL parameters
+ * and stores them in an array. They can be retrieved using
+ * Fusion.getQueryParam(key).
+ *
+ * Returns: {Array} an array of the query params from when the page was loaded
+ */
parseQueryString: function() {
this.queryParams = [];
var s=window.location.search;
@@ -1009,6 +1272,15 @@
return this.queryParams;
},
+ /**
+ * Function: getQueryParam
+ *
+ * Returns the query parameter value for a given parameter name
+ *
+ * Parameter: {String} p - the parameter to lookup
+ *
+ * Returns: parameter value or the empty string '' if not found
+ */
getQueryParam: function(p) {
if (!this.queryParams) {
this.parseQueryString();
@@ -1029,7 +1301,7 @@
/**
* Function: _getScriptLocation
- * Return the path to this script.
+ * Return the path to this script for bootstrapping Fusion.
*
* Returns:
* {String} Path to this script
@@ -1074,10 +1346,12 @@
var locale = navigator.language ?
navigator.language.substring(0,2): //e.g. en-CA becomes just en
navigator.userLanguage.substring(0,2);//only use the prefix part for now,
- var s = window.location.search.toLowerCase();
+ var s = window.location.search;
var idx = s.indexOf('locale=');
if (idx>0) {
- locale = s.substring(idx+7,idx+9);
+ var temp = s.substring(idx+7);
+ var idx2 = temp.indexOf('&');
+ locale = temp.substring(0,idx2<0?temp.length:idx2);
}
window._FusionLocale = locale;
@@ -1196,50 +1470,54 @@
document.writeln('<script src="' + src + '"><\/script>');
}
- var getXmlHttpRequest = function(){
+ var getXmlHttpRequest = function(){
try { return new XMLHttpRequest(); }
- catch (e) { try { return new ActiveXObject('Msxml2.XMLHTTP'); }
- catch (e) { try { return new ActiveXObject('Microsoft.XMLHTTP'); }
- catch (e) { return null; }}}
- }
-
- /**
- * Function: createSessionId
- *
- * Pre-create a session to avoid the 401 Unauthorized dialog
- *
- */
- var createSessionId = function(){
- var xhr = getXmlHttpRequest();
- xhr.open("GET", Fusion.fusionURL+"layers/MapGuide/php/CreateSession.php",false);
- xhr.send(null);
- var o;
- eval('o='+xhr.responseText);
- Fusion.sessionId = o.sessionId;
- }
-
- var appDefUrl = Fusion.getQueryParam('ApplicationDefinition');
- if(appDefUrl && (
- appDefUrl.indexOf('Library') == 0 ||
- appDefUrl.indexOf('Session') == 0)){
- createSessionId();
- var xhr = new getXmlHttpRequest();
- var mapAgentUrl = getAgentUrl();
- xhr.open("GET", mapAgentUrl + "?OPERATION=GETRESOURCECONTENT&VERSION=1.0.0&LOCALE=en&CLIENTAGENT=MapGuide+Developer&RESOURCEID=" + appDefUrl + "&FORMAT=text%2Fxml&SESSION="+ Fusion.sessionId, false);
- xhr.send(null);
- var appDefXML = xhr.responseXML.documentElement;
-
- if(appDefXML){
- var googleElement = appDefXML.getElementsByTagName("GoogleScript")[0];
- var yahooElement = appDefXML.getElementsByTagName("YahooScript")[0];
- var veElement = appDefXML.getElementsByTagName("VirtualEarthScript")[0];
+ catch (e) { try { return new ActiveXObject('Msxml2.XMLHTTP'); }
+ catch (e) { try { return new ActiveXObject('Microsoft.XMLHTTP'); }
+ catch (e) { return null; }}}
+ }
- addElement(googleElement);
- addElement(yahooElement);
- addElement(veElement);
- }
- }
-
+ /**
+ * Function: createSessionId
+ *
+ * Pre-create a session to avoid the 401 Unauthorized dialog
+ *
+ */
+ var createSessionId = function(){
+ var xhr = getXmlHttpRequest();
+ xhr.open("GET", Fusion.fusionURL+"layers/MapGuide/php/CreateSession.php",false);
+ xhr.send(null);
+ var o;
+ eval('o='+xhr.responseText);
+ Fusion.sessionId = o.sessionId;
+ }
+
+ var appDefUrl = Fusion.getQueryParam('ApplicationDefinition');
+ if(appDefUrl && (
+ appDefUrl.indexOf('Library') == 0 ||
+ appDefUrl.indexOf('Session') == 0)){
+ var passedSessionId = Fusion.getQueryParam('Session');
+ if(passedSessionId == null || passedSessionId == "" ){
+ createSessionId();
+ }else{
+ Fusion.sessionId = passedSessionId;
+ }
+ var xhr = new getXmlHttpRequest();
+ var mapAgentUrl = getAgentUrl();
+ xhr.open("GET", mapAgentUrl + "?OPERATION=GETRESOURCECONTENT&VERSION=1.0.0&LOCALE=en&CLIENTAGENT=MapGuide+Developer&RESOURCEID=" + appDefUrl + "&FORMAT=text%2Fxml&SESSION="+ Fusion.sessionId, false);
+ xhr.send(null);
+ var appDefXML = xhr.responseXML.documentElement;
+
+ if(appDefXML){
+ var googleElement = appDefXML.getElementsByTagName("GoogleScript")[0];
+ var yahooElement = appDefXML.getElementsByTagName("YahooScript")[0];
+ var veElement = appDefXML.getElementsByTagName("VirtualEarthScript")[0];
+
+ addElement(googleElement);
+ addElement(yahooElement);
+ addElement(veElement);
+ }
+ }
})();
Modified: sandbox/jxlib-3.0/text/fr
===================================================================
--- sandbox/jxlib-3.0/text/fr 2010-03-31 02:31:02 UTC (rev 2122)
+++ sandbox/jxlib-3.0/text/fr 2010-03-31 19:07:52 UTC (rev 2123)
@@ -112,7 +112,9 @@
COLORPICKERHEXFORMAT = Hex format
# MeasureUI
-MEASURETITLE = Measure Distance
+MEASUREDISTANCETITLE = Measure Distance
+MEASUREAREATITLE = Measure Area
+MEASUREBOTHTITLE = Measure Distance And Area
MEASUREINFO = Click a start and end point.
RESUME = Resume
STOP = Stop
@@ -123,6 +125,8 @@
SEGMENT = Segment
TOTAL = Total
LENGTH = Length
+TOTALLENGTH = Total Length
+TOTALAREA = Total Area
MEASUREERROR = Measure Error
# Measure
@@ -132,6 +136,97 @@
MEASURETOTAL = total
MEASURELAYER = Measure
+# FeatureInfoUI
+FEATUREINFOTITLE = Feature Information
+FEATUREINFOSUBTITLE = Select a Layer
+FEATUREINFOLAYER = Layer:
+FEATUREINFOSELECTFEATURE= Select Features:
+FEATUREINFODIGITIZE = Digitize:
+FEATUREINFOPOINT = Point
+FEATUREINFORECTANGLE = Rectangle
+FEATUREINFOPOLYGON = Polygon
+FEATUREINFOTOTAL = Total:
+FEATUREINFONOSELECTED = no features selected.
+FEATUREINFOERROR = Error
+FEATUREINFOFETCHINFO = fetching feature info ...
+FEATUREINFOFEATURESEL = features selected
+FEATUREINFOAREA = Area:
+FEATUREINFOAREAUNDEFINE = areaIdx undefined
+FEATUREINFONOINFO = no layer info
+FEATUREINFONOFEATUREIN = no features in selected layer.
+
+# QueryUI
+QUERYTITLE = Query Features
+QUERYSELECTLAYER = Select a Layer
+QUERYLAYER = Layer:
+QUERYPROPERTYFILTER = Property Filter
+QUERYPROPERTY = Property:
+QUERYOPERATOR = Operator:
+QUERYVALUE = Value:
+QUERYSPATIALFILTER = Spatial Filter
+QUERYDIGITIZE = Digitize:
+QUERYRECTANGLE = Rectangle
+QUERYPOLYGON = Polygon
+QUERYCLEAR = Clear
+QUERYOUTPUT = Output
+QUERYOUTPUTPROPERTY = Output property:
+QUERYEXECUTE = Execute
+QUERYMAXRESULT = Max results:
+QUERYRESULTS = Results
+QUERYSCALE = Scale:
+QUERYZOOM = Zoom
+QUERYSELECT = Select
+QUERYERROR = Error
+QUERYEQUALTO = Equal to
+QUERYNOTEQUALTO = Not equal to
+QUERYGREATTHAN = Greater than
+QUERYGREATTHANEQUAL = Greater than or equal to
+QUERYLESSTHAN = Less than
+QUERYLESSTHANEQUAL = Less than or equal to
+QUERYBEGIN = Begins with
+QUERYCONTAINS = Contains
+
+# Theme UI
+THEMETITLE = Theme Layer
+THEMESELECTLAYER = Select a Layer
+THEMELAYER = Layer:
+THEMENAME = Theme Name:
+THEMECONDITIONS = Define Conditions
+THEMEPROPERTY = Property:
+THEMEMIN = Min:
+THEMEMAX = Max:
+THEMEDISTRIBUTION = Distribution:
+THEMERULE = # of Rules:
+THEMESCALERANGE = Scale Range
+THEMESTYLERAMP = Style Ramp
+THEMEFILLTRANS = Fill Transparency:
+THEMEFILLCOLOR = Fill Color:
+THEMEFROM = From:
+THEMETO = To:
+THEMEBORDERCOLOR = Border Color:
+THEMEAPPLY = Apply
+THEMEERROR = Error
+THEMEINDIVIDUAL = Individual
+THEMEEQUAL = Equal
+THEMESTANDARD = Standard Deviation
+THEMEQUANTILE = Quantile
+THEMEJENKS = Jenks (Natural Breaks)
+
+# Redline UI
+REDLINEOPTIONS = Digitizing Options
+REDLINESELECTLAYER = Select Layer:
+REDLINENEW = New
+REDLINERENAME = Rename
+REDLINEREMOVE = Remove
+REDLINEDRAW = Draw:
+REDLINEPOINT = Point
+REDLINELINE = Line
+REDLINERECTANGLE = Rectangle
+REDLINEPOLYGON = Polygon
+REDLINESAVE = Save
+REDLINEUPLOAD = Upload
+REDLINEFEATURES = Features
+
# HtmlViewerAbout
HTMLABOUTTITLE = About %s
HTMLABOUTTITLEBAR = MapGuide Viewer
Modified: sandbox/jxlib-3.0/widgets/BufferPanel/BufferPanel.templ
===================================================================
--- sandbox/jxlib-3.0/widgets/BufferPanel/BufferPanel.templ 2010-03-31 02:31:02 UTC (rev 2122)
+++ sandbox/jxlib-3.0/widgets/BufferPanel/BufferPanel.templ 2010-03-31 19:07:52 UTC (rev 2123)
@@ -57,6 +57,7 @@
var decimalSeparator = "__#DECIMALSEPARATOR#__";
var agent = navigator.userAgent.toLowerCase();
var msie = agent.indexOf("msie") != -1;
+var mapName;
function InitDocument()
{
@@ -70,7 +71,7 @@
{
var list = document.getElementById("layers");
var listNames = document.getElementById("layerNames");
- var mapName = document.getElementById('Frm').mapname.value;
+ mapName = document.getElementById('Frm').mapname.value;
list.options.length = 0;
var map = GetParent().Fusion.getMapByName(mapName);
var layers = map.aMaps[0].getSelectedLayers();
@@ -219,6 +220,9 @@
function OnCancel()
{
+ if(mapName == "undefined")
+ return;
+
var map = GetParent().Fusion.getMapByName(mapName);
map.clearSelection();
//mf.GotoHomePage();
Modified: sandbox/jxlib-3.0/widgets/MapMenu.js
===================================================================
--- sandbox/jxlib-3.0/widgets/MapMenu.js 2010-03-31 02:31:02 UTC (rev 2122)
+++ sandbox/jxlib-3.0/widgets/MapMenu.js 2010-03-31 19:07:52 UTC (rev 2123)
@@ -216,6 +216,17 @@
//change the map, preserving current extents
switchMap: function(data) {
var ce = this.getMap().getCurrentExtents();
+ var dest = null;
+ for (var i=0; i<data.maps.length; ++i) {
+ dest = new OpenLayers.Projection(data.maps[i].layerOptions.projection);
+ if (data.maps[i].layerOptions.isBaseLayer) {
+ break;
+ }
+ }
+ if (!dest) {
+ dest = new OpenLayers.Projection("EPSG:4326");
+ }
+ ce = ce.transform(this.oMap.oMapOL.getProjectionObject(), dest);
data.initialView = {minX:ce.left,
minY:ce.bottom,
maxX:ce.right,
Modified: sandbox/jxlib-3.0/widgets/Measure.js
===================================================================
--- sandbox/jxlib-3.0/widgets/Measure.js 2010-03-31 02:31:02 UTC (rev 2122)
+++ sandbox/jxlib-3.0/widgets/Measure.js 2010-03-31 19:07:52 UTC (rev 2123)
@@ -306,6 +306,9 @@
}
this.totalLength = quantity.toPrecision(this.distPrecision);
} else {
+ if(geom.getArea() == 0)
+ return;
+
var cg = geom.getCentroid();
at = this.getMap().geoToPix(cg.x, cg.y);
quantity = geom.getGeodesicArea(proj);
@@ -355,7 +358,8 @@
onKeyPress: function(e) {
var charCode = (e.charCode ) ? e.charCode : ((e.keyCode) ? e.keyCode : e.which);
if (charCode == OpenLayers.Event.KEY_ESC) {
- this.control.cancel();
+ this.deactivate();
+ this.activate();
}
},
@@ -581,6 +585,10 @@
}
var tDist = outputDoc.getElementById('totalDistance');
tDist.innerHTML = '';
+ var tArea = outputDoc.getElementById('totalArea');
+ if(tArea){
+ tArea.innerHTML = '';
+ }
}
},
Modified: sandbox/jxlib-3.0/widgets/OverviewMap.js
===================================================================
--- sandbox/jxlib-3.0/widgets/OverviewMap.js 2010-03-31 02:31:02 UTC (rev 2122)
+++ sandbox/jxlib-3.0/widgets/OverviewMap.js 2010-03-31 19:07:52 UTC (rev 2123)
@@ -59,7 +59,7 @@
} else {
this.mapObject = new Fusion.Layers.Generic(this, mapTag, false);
}
- this.mapObject.registerForEvent(Fusion.Event.LAYER_LOADED, OpenLayers.Function.bind(this.loadOverview, this));
+ //this.mapObject.registerForEvent(Fusion.Event.LAYER_LOADED, OpenLayers.Function.bind(this.loadOverview, this));
//first set the size to the size of the DOM element if available
if (this.domObj) {
@@ -73,28 +73,23 @@
this.oMapOptions = {}; //TODO: allow setting some mapOptions in AppDef
- //this.getMap().registerForEvent(Fusion.Event.MAP_LOADED, OpenLayers.Function.bind(this.mapWidgetLoaded, this));
+ this.getMap().registerForEvent(Fusion.Event.MAP_LOADED, OpenLayers.Function.bind(this.mapWidgetLoaded, this));
},
mapWidgetLoaded: function()
{
var mapWidget = this.getMap();
- if (this.sMapGroupId && (mapWidget.projection == this.mapObject.projection) ) {
- this.loadOverview([this.mapObject.oLayerOL]);
+ if (this.sMapGroupId) {// && (mapWidget.projection == this.mapObject.projection) ) {
+ this.loadOverview(this.mapObject.oLayerOL);
} else {
//just use the base map layer
- var extent = this.oMap._oCurrentExtents;
- this.loadOverview([this.getMap().oMapOL.baseLayer.clone()]);
+ //setTimeout(OpenLayers.Function.bind(this.loadOverview, this), 5000);
+ this.loadOverview();
}
},
- keymapLoaded: function()
+ loadOverview: function(layer)
{
- this.mapObject.oLayerOL.isBaseLayer = true;
- },
-
- loadOverview: function()
- {
if (this.control) {
this.control.destroy();
}
@@ -102,22 +97,25 @@
var size = $(this.domObj).getContentBoxSize();
this.oSize = new OpenLayers.Size(size.width, size.height);
- this.mapObject.oLayerOL.isBaseLayer = true;
- if (this.mapObject.oLayerOL.singleTile) {
+ if (!layer) {
+ layer = this.getMap().oMapOL.baseLayer.clone();
+ }
+ layer.isBaseLayer = true;
+ layer.ratio = 1.0;
+ if (layer.singleTile) {
this.oMapOptions.numZoomLevels = 3; //TODO: make this configurable?
}
- this.mapObject.oLayerOL.ratio = 1.0;
- var mapOpts = {
+ var options = {
div: this.domObj,
size: this.oSize,
minRatio: this.nMinRatio,
maxRatio: this.nMaxRatio,
mapOptions: this.oMapOptions,
- layers: [this.mapObject.oLayerOL]
+ layers: [layer]
};
- this.control = new OpenLayers.Control.OverviewMap(mapOpts);
+ this.control = new OpenLayers.Control.OverviewMap(options);
if (size.width == 0 || size.height == 0) {
return; //don't try to load if the container is not visible
} else {
Modified: sandbox/jxlib-3.0/widgets/SelectAttribute.js
===================================================================
--- sandbox/jxlib-3.0/widgets/SelectAttribute.js 2010-03-31 02:31:02 UTC (rev 2122)
+++ sandbox/jxlib-3.0/widgets/SelectAttribute.js 2010-03-31 19:07:52 UTC (rev 2123)
@@ -107,19 +107,21 @@
},
setAttributeOptions: function(event) {
- this.propsList.empty();
- var layer = this.layerList[this.layerList.selectedIndex].value;
- var attrs = this.attrs[layer].propertyvalues;
- var props = this.attrs[layer].propertynames;
- for (var i=0; i<attrs.length; ++i) {
- this.propsList.add(new Option(attrs[i],props[i]),null);
- }
- var map = this.getMap();
- for (var i=0; i<map.aMaps[0].aLayers.length; ++i) {
- if (map.aMaps[0].aLayers[i].layerName == layer) {
- map.setActiveLayer(map.aMaps[0].aLayers[i]);
- break;
+ if (this.drawn) {
+ this.propsList.empty();
+ var layer = this.layerList[this.layerList.selectedIndex].value;
+ var attrs = this.attrs[layer].propertyvalues;
+ var props = this.attrs[layer].propertynames;
+ for (var i=0; i<attrs.length; ++i) {
+ this.propsList.add(new Option(attrs[i],props[i]),null);
}
+ var map = this.getMap();
+ for (var i=0; i<map.aMaps[0].aLayers.length; ++i) {
+ if (map.aMaps[0].aLayers[i].layerName == layer) {
+ map.setActiveLayer(map.aMaps[0].aLayers[i]);
+ break;
+ }
+ }
}
},
Modified: sandbox/jxlib-3.0/widgets/TaskPane.js
===================================================================
--- sandbox/jxlib-3.0/widgets/TaskPane.js 2010-03-31 02:31:02 UTC (rev 2122)
+++ sandbox/jxlib-3.0/widgets/TaskPane.js 2010-03-31 19:07:52 UTC (rev 2123)
@@ -28,8 +28,9 @@
*
* A utility widget that holds output from other widgets.
****************************************************************************/
+
+Fusion.Event.TASK_PANE_LOADED = Fusion.Event.lastEventId++;
-
Fusion.Widget.TaskPane = OpenLayers.Class(Fusion.Widget, {
aExecutedTasks: null, //array of URLs for tasks execcuted in the TaskPane
nCurrentTask: -1,
@@ -125,6 +126,7 @@
//is added to the DOM
this.oTaskPane.domObj.resize();
+ Fusion.registerEventID(Fusion.Event.TASK_PANE_LOADED);
Fusion.registerForEvent(Fusion.Event.FUSION_INITIALIZED, OpenLayers.Function.bind(this.setTaskMenu, this));
this.getMap().registerForEvent(Fusion.Event.MAP_LOADED, OpenLayers.Function.bind(this.setInitialContent, this, initialTask));
},
@@ -160,6 +162,8 @@
},
setContent: function(url) {
+ Fusion.triggerEvent(Fusion.Event.TASK_PANE_LOADED);
+
if (this.nCurrentTask < this.aExecutedTasks.length-1) {
//this.aExecutedTasks.splice(this.nCurrentTask, this.aExecutedTasks.length - this.nCurrentTask);
}
Modified: sandbox/jxlib-3.0/widgets/Theme/classes/theme.php
===================================================================
--- sandbox/jxlib-3.0/widgets/Theme/classes/theme.php 2010-03-31 02:31:02 UTC (rev 2122)
+++ sandbox/jxlib-3.0/widgets/Theme/classes/theme.php 2010-03-31 19:07:52 UTC (rev 2123)
@@ -53,7 +53,10 @@
if((substr($layer->GetName(), 0, 1) != "_") && (substr(strtoupper($layer->GetFeatureSourceId()), 0, 7) != "SESSION"))
{
$resId = new MgResourceIdentifier($layer->GetFeatureSourceId());
- $schemaClass = explode(':', $layer->GetFeatureClassName());
+ $layerFeatureClassName = $layer->GetFeatureClassName();
+ if($layerFeatureClassName == "")
+ continue;
+ $schemaClass = explode(':', $layerFeatureClassName);
$classDef = $featureService->GetClassDefinition($resId, $schemaClass[0], $schemaClass[1]);
$propDef = $classDef->GetProperties()->GetItem($layer->GetFeatureGeometryName());
@@ -233,9 +236,17 @@
$doc = DOMDocument::loadXML($byteReader->ToString());
$version = $doc->documentElement->getAttribute('version');
$template = 'templates/arearuletemplate-'.$version.'.xml';
- $nodeList = $doc->getElementsByTagName('VectorScaleRange');
+ $layerDefList = $doc->getElementsByTagName('VectorLayerDefinition');
+ $layerDef = $layerDefList->item(0);
+ $nodeList = $layerDef->getElementsByTagName('VectorScaleRange');
$vectorScaleRangecElement = $nodeList->item($this->args['SCALERANGEINDEX']);
+ $listLength = $nodeList->length;
+ for($index = 0; $index < $listLength; $index++)
+ {
+ $layerDef->removeChild($nodeList->item(0));
+ }
+ $layerDef->appendChild($vectorScaleRangecElement);
$areaTypeStyle = $vectorScaleRangecElement->getElementsByTagName('AreaTypeStyle')->item(0);
// Remove any existing <AreaRule> elements.
Modified: sandbox/jxlib-3.0/widgets/Theme/thememain.php
===================================================================
--- sandbox/jxlib-3.0/widgets/Theme/thememain.php 2010-03-31 02:31:02 UTC (rev 2122)
+++ sandbox/jxlib-3.0/widgets/Theme/thememain.php 2010-03-31 19:07:52 UTC (rev 2123)
@@ -124,6 +124,11 @@
function OnLayerChange()
{
var layerSelect = document.getElementById("layerSelect");
+
+ if(layerSelect.value == ""){
+ return;
+ }
+
var propertySelect = document.getElementById("propertySelect");
var scaleSelect = document.getElementById("scaleSelect");
More information about the fusion-commits
mailing list