[fusion-commits] r1396 - in branches/fusion-1.0: . MapGuide
MapGuide/php MapServer MapServer/php common/php jx/lib lib
lib/OpenLayers/theme/default/img templates/mapguide/standard
templates/mapguide/standard/images widgets
widgets/BufferPanel widgets/Print widgets/Search
widgets/SelectWithin
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Thu May 8 11:34:31 EDT 2008
Author: madair
Date: 2008-05-08 11:34:30 -0400 (Thu, 08 May 2008)
New Revision: 1396
Added:
branches/fusion-1.0/lib/OpenLayers/theme/default/img/blank.gif
branches/fusion-1.0/lib/OpenLayers/theme/default/img/editing_tool_bar.png
branches/fusion-1.0/lib/OpenLayers/theme/default/img/overview_replacement.gif
branches/fusion-1.0/lib/OpenLayers/theme/default/img/view_next_off.png
branches/fusion-1.0/lib/OpenLayers/theme/default/img/view_next_on.png
branches/fusion-1.0/lib/OpenLayers/theme/default/img/view_previous_off.png
branches/fusion-1.0/lib/OpenLayers/theme/default/img/view_previous_on.png
branches/fusion-1.0/templates/mapguide/standard/images/dialog_bg.png
branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_b.png
branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_bl.png
branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_br.png
branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_l.png
branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_r.png
branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_t.png
branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_tl.png
branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_tr.png
branches/fusion-1.0/templates/mapguide/standard/images/dialog_resize.png
branches/fusion-1.0/templates/mapguide/standard/images/icon_close.png
Modified:
branches/fusion-1.0/MapGuide/MapGuide.js
branches/fusion-1.0/MapGuide/php/Buffer.php
branches/fusion-1.0/MapGuide/php/Common.php
branches/fusion-1.0/MapGuide/php/Query.php
branches/fusion-1.0/MapGuide/php/SaveMap.php
branches/fusion-1.0/MapServer/MapServer.js
branches/fusion-1.0/MapServer/php/LegendIcon.php
branches/fusion-1.0/MapServer/php/LoadMap.php
branches/fusion-1.0/MapServer/php/Measure.php
branches/fusion-1.0/MapServer/php/Query.php
branches/fusion-1.0/common/php/Xml2JSON.php
branches/fusion-1.0/config.json
branches/fusion-1.0/jx/lib/jx_combined.js
branches/fusion-1.0/lib/MGBroker.js
branches/fusion-1.0/lib/Map.js
branches/fusion-1.0/lib/fusion.js
branches/fusion-1.0/templates/mapguide/standard/ApplicationDefinition.xml
branches/fusion-1.0/templates/mapguide/standard/index.html
branches/fusion-1.0/widgets/BufferPanel/Buffer.php
branches/fusion-1.0/widgets/CenterSelection.js
branches/fusion-1.0/widgets/CursorPosition.js
branches/fusion-1.0/widgets/MapMenu.js
branches/fusion-1.0/widgets/Maptip.js
branches/fusion-1.0/widgets/Measure.js
branches/fusion-1.0/widgets/Print/printablepage.templ
branches/fusion-1.0/widgets/SaveMap.js
branches/fusion-1.0/widgets/Search/Search.php
branches/fusion-1.0/widgets/SelectRadiusValue.js
branches/fusion-1.0/widgets/SelectWithin/SelectWithin.php
branches/fusion-1.0/widgets/SelectWithin/SelectWithinPanel.templ
branches/fusion-1.0/widgets/ViewSize.js
Log:
re #58: patches applied for 1.0.5 release (MapGuide)
Modified: branches/fusion-1.0/MapGuide/MapGuide.js
===================================================================
--- branches/fusion-1.0/MapGuide/MapGuide.js 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/MapGuide/MapGuide.js 2008-05-08 15:34:30 UTC (rev 1396)
@@ -51,6 +51,8 @@
//the resource id of the current MapDefinition
_sResourceId: null,
+
+ clientAgent: 'Fusion Viewer',
initialize : function(map, mapTag, isMapWidgetLayer) {
// console.log('MapGuide.initialize');
@@ -81,8 +83,8 @@
if (ctrlClickEnabled) {
this.map = this.mapWidget.oMapOL;
this.handler = new OpenLayers.Handler.Click(this,
- {click: this.mouseUpCRTLClick.bind(this)},
- {keyMask: OpenLayers.Handler.MOD_CTRL});
+ {click: OpenLayers.Function.bind(this.mouseUpCRTLClick, this)},
+ {keyMask: OpenLayers.Handler.MOD_CTRL});
this.handler.activate();
this.nTolerance = 2; //pixels, default pixel tolernace for a point click; TBD make this configurable
}
@@ -119,21 +121,22 @@
this.session[0] = this;
var sl = Fusion.getScriptLanguage();
var scriptURL = this.arch + '/' + sl + '/CreateSession.' + sl;
- var options = {onComplete: this.createSessionCB.bind(this)};
+ var options = {onSuccess: OpenLayers.Function.bind(this.createSessionCB, this)};
Fusion.ajaxRequest(scriptURL,options);
}
if (this.session[0] instanceof Fusion.Maps.MapGuide) {
// console.log('register for event');
- this.session[0].registerForEvent(Fusion.Event.MAP_SESSION_CREATED, this.mapSessionCreated.bind(this));
+ this.session[0].registerForEvent(Fusion.Event.MAP_SESSION_CREATED,
+ OpenLayers.Function.bind(this.mapSessionCreated, this));
} else {
this.mapSessionCreated();
}
},
- createSessionCB : function(r, json) {
- if (r.status == 200 && json) {
+ createSessionCB : function(xhr) {
+ if (xhr.status == 200) {
var o;
- eval('o='+r.responseText);
+ eval('o='+xhr.responseText);
this.session[0] = o.sessionId;
this.triggerEvent(Fusion.Event.MAP_SESSION_CREATED);
}
@@ -143,7 +146,7 @@
if (this.sMapResourceId != '') {
this.loadMap(this.sMapResourceId);
}
- window.setInterval(this.pingServer.bind(this), this.keepAliveInterval * 1000);
+ window.setInterval(OpenLayers.Function.bind(this.pingServer, this), this.keepAliveInterval * 1000);
},
sessionReady: function() {
@@ -204,20 +207,20 @@
var sessionid = this.getSessionID();
- var params = 'mapid='+resourceId+"&session="+sessionid;
- var options = {onSuccess: this.mapLoaded.bind(this), parameters:params};
+ var params = {'mapid': resourceId, "session": sessionid};
+ var options = {onSuccess: OpenLayers.Function.bind(this.mapLoaded,this),
+ parameters:params};
Fusion.ajaxRequest(loadmapScript, options);
},
- mapLoaded: function(r, json) {
- if (json) {
+ mapLoaded: function(r) {
+ if (r.status == 200) {
var o;
eval('o='+r.responseText);
this._sResourceId = o.mapId;
this._sMapname = o.mapName;
this._sMapTitle = o.mapTitle;
- this._fMetersperunit = o.metersPerUnit;
- this.mapWidget._fMetersperunit = this._fMetersperunit;
+ this.mapWidget.setMetersPerUnit(o.metersPerUnit);
this._oMaxExtent = OpenLayers.Bounds.fromArray(o.extent);
@@ -284,7 +287,7 @@
//set projection units and code if supplied
//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 = this.getClosestUnits(o.metersPerUnit);
+ this.units = Fusion.getClosestUnits(o.metersPerUnit);
//add in scales array if supplied
if (o.FiniteDisplayScales && o.FiniteDisplayScales.length>0) {
@@ -315,29 +318,10 @@
this.triggerEvent(Fusion.Event.MAP_LOADED);
}
this.bMapLoaded = true;
- } else {
- Fusion.reportError( new Fusion.Error(Fusion.Error.FATAL,
- OpenLayers.String.translate('mapLoadError', r.responseText)));
}
this.mapWidget._removeWorker();
},
- getClosestUnits: function(metrsPerUnit) {
-
- var units = "degrees";
- var minDiff = 100000000;
- for (var key in OpenLayers.INCHES_PER_UNIT)
- {
- var newDiff = Math.abs((metrsPerUnit * 39.3701) - OpenLayers.INCHES_PER_UNIT[key]);
- if(newDiff < minDiff)
- {
- minDiff = newDiff;
- units = key;
- }
- }
- return units;
- },
-
//TBD: this function not yet converted for OL
reloadMap: function() {
@@ -357,13 +341,12 @@
var sessionid = this.getSessionID();
- var params = 'mapname='+this._sMapname+"&session="+sessionid;
- var options = {onSuccess: this.mapReloaded.bind(this),
- onException: this.reloadFailed.bind(this),
- parameters: params};
+ var params = {'mapname': this._sMapname, 'session': sessionid};
+ var options = {
+ onSuccess: OpenLayers.Function.bind(this.mapReloaded,this),
+ onException: OpenLayers.Function.bind(this.reloadFailed, this),
+ parameters: params};
Fusion.ajaxRequest(loadmapScript, options);
-
-
},
reloadFailed: function(r) {
@@ -373,8 +356,8 @@
},
//TBD: this function not yet converted for OL
- mapReloaded: function(r,json) {
- if (json) {
+ mapReloaded: function(r) {
+ if (r.status == 200) {
var o;
eval('o='+r.responseText);
this.parseMapLayersAndGroups(o);
@@ -390,9 +373,6 @@
this.oldLayers = null;
this.mapWidget.triggerEvent(Fusion.Event.MAP_RELOADED);
this.drawMap();
- } else {
- Fusion.reportError( new Fusion.Error(Fusion.Error.FATAL,
- OpenLayers.String.translate('mapLoadError', r.responseText)));
}
this.mapWidget._removeWorker();
},
@@ -401,18 +381,20 @@
var sl = Fusion.getScriptLanguage();
var loadmapScript = this.arch + '/' + sl + '/SetLayers.' + sl;
- var sessionid = this.getSessionID();
+ var params = {
+ 'mapname': this._sMapname,
+ 'session': this.getSessionID(),
+ 'layerindex': aLayerIndex.join()
+ };
- var params = 'mapname='+this._sMapname+"&session="+sessionid;
- params += '&layerindex=' + aLayerIndex.join();
-
- var options = {onSuccess: this.mapLayersReset.bind(this, aLayerIndex),
- parameters: params};
+ var options = {
+ onSuccess: OpenLayers.Function.bind(this.mapLayersReset, this, aLayerIndex),
+ parameters: params};
Fusion.ajaxRequest(loadmapScript, options);
},
- mapLayersReset: function(aLayerIndex,r,json) {
- if (json) {
+ mapLayersReset: function(aLayerIndex,r) {
+ if (r.status == 200) {
var o;
eval('o='+r.responseText);
if (o.success) {
@@ -464,7 +446,8 @@
return;
}
- var options = {
+ var params = {
+ ts : (new Date()).getTime(), //add a timestamp to prevent caching on the server
showLayers : this.aShowLayers.length > 0 ? this.aShowLayers.toString() : null,
hideLayers : this.aHideLayers.length > 0 ? this.aHideLayers.toString() : null,
showGroups : this.aShowGroups.length > 0 ? this.aShowGroups.toString() : null,
@@ -477,8 +460,7 @@
this.aHideGroups = [];
this.aRefreshLayers = [];
- this.oLayerOL.addOptions(options);
- this.oLayerOL.mergeNewParams({ts : (new Date()).getTime()});
+ this.oLayerOL.mergeNewParams(params);
if (this.queryLayer) this.queryLayer.redraw();
},
@@ -511,18 +493,20 @@
if ( bSingleTile ) {
params = { //single tile params
session : this.getSessionID(),
- mapname : this._sMapname
+ mapname : this._sMapname,
+ clientagent : this.clientAgent
};
- layerOptions.showLayers = this.aShowLayers.length > 0 ? this.aShowLayers.toString() : null;
- layerOptions.hideLayers = this.aHideLayers.length > 0 ? this.aHideLayers.toString() : null;
- layerOptions.showGroups = this.aShowGroups.length > 0 ? this.aShowGroups.toString() : null;
- layerOptions.hideGroups = this.aHideGroups.length > 0 ? this.aHideGroups.toString() : null;
- layerOptions.refreshLayers = this.aRefreshLayers.length > 0 ? this.aRefreshLayers.toString() : null;
+ 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;
} else {
params = { //tiled version
mapdefinition: this._sResourceId,
- basemaplayergroupname: this.groupName //assumes only one group for now
+ basemaplayergroupname: this.groupName, //assumes only one group for now
+ clientagent : this.clientAgent
};
}
@@ -561,8 +545,8 @@
hasSelection: function() { return this.bSelectionOn; },
- getSelectionCB : function(userFunc, layers, startend, r, json) {
- if (json)
+ getSelectionCB : function(userFunc, layers, startend, r) {
+ if (r.status == 200)
{
var o;
eval("o="+r.responseText);
@@ -641,10 +625,14 @@
this.mapWidget._addWorker();
var sl = Fusion.getScriptLanguage();
var setSelectionScript = this.arch + '/' + sl + '/SetSelection.' + sl;
- var params = 'mapname='+this.getMapName()+"&session="+this.getSessionID();
- params += '&selection=' + encodeURIComponent(selText);
- params += '&seq=' + Math.random();
- var options = {onSuccess: this.processQueryResults.bind(this, zoomTo), parameters:params, asynchronous:false};
+ var params = {
+ 'mapname': this.getMapName(),
+ 'session': this.getSessionID(),
+ 'selection': encodeURIComponent(selText),
+ 'seq': Math.random()
+ };
+ var options = {onSuccess: OpenLayers.Function.bind(this.processQueryResults, this, zoomTo),
+ parameters:params, asynchronous:false};
Fusion.ajaxRequest(setSelectionScript, options);
},
@@ -681,9 +669,14 @@
//this.mapWidget._addWorker();
// this._bSelectionIsLoading = true;
var s = this.arch + '/' + Fusion.getScriptLanguage() + "/Selection." + Fusion.getScriptLanguage() ;
- var params = {parameters:'session='+this.getSessionID()+'&mapname='+ this._sMapname +'&layers='+layers+'&startcount='+startcount,
- onComplete: this.getSelectionCB.bind(this, userFunc, layers, startcount)};
- Fusion.ajaxRequest(s, params);
+ var options = {
+ parameters: {'session': this.getSessionID(),
+ 'mapname': this._sMapname,
+ 'layers': layers,
+ 'startcount': startcount},
+ onSuccess: OpenLayers.Function.bind(this.getSelectionCB, this, userFunc, layers, startcount)
+ };
+ Fusion.ajaxRequest(s, options);
}
},
@@ -711,9 +704,13 @@
*/
clearSelection : function() {
if (this.hasSelection()) {
- var s = this.arch + '/' + Fusion.getScriptLanguage() + "/ClearSelection." + Fusion.getScriptLanguage() ;
- var params = {parameters:'session='+this.getSessionID()+'&mapname='+ this._sMapname, onComplete: this.selectionCleared.bind(this)};
- Fusion.ajaxRequest(s, params);
+ var s = this.arch + '/' + Fusion.getScriptLanguage() + "/ClearSelection." + Fusion.getScriptLanguage() ;
+ var options = {
+ parameters: {'session': this.getSessionID(),
+ 'mapname': this._sMapname},
+ onSuccess: OpenLayers.Function.bind(this.selectionCleared, this)
+ };
+ Fusion.ajaxRequest(s, options);
}
},
@@ -742,7 +739,8 @@
if (!this.queryLayer) {
this.queryLayer = this.createOLLayer("query layer", false, true);
this.mapWidget.oMapOL.addLayer(this.queryLayer);
- this.mapWidget.registerForEvent(Fusion.Event.MAP_LOADING, this.removeQueryLayer.bind(this));
+ this.mapWidget.registerForEvent(Fusion.Event.MAP_LOADING,
+ OpenLayers.Function.bind(this.removeQueryLayer, this));
} else {
this.queryLayer.setVisibility(true);
}
@@ -782,24 +780,32 @@
this.aLayers[j].selectedFeatureCount = 0;
}
- var geometry = options.geometry || '';
- var maxFeatures = options.maxFeatures || 0; //zero means select all features
var bPersistant = options.persistent || true;
- var selectionType = options.selectionType || this.selectionType;
- var filter = options.filter ? '&filter='+options.filter : '';
- var layers = options.layers || '';
- var extend = options.extendSelection ? '&extendselection=true' : '';
- var computed = options.computedProperties ? '&computed=true' : '';
var zoomTo = options.zoomTo ? true : false;
var sl = Fusion.getScriptLanguage();
var loadmapScript = this.arch + '/' + sl + '/Query.' + sl;
- var sessionid = this.getSessionID();
-
- var params = 'mapname='+this._sMapname+"&session="+sessionid+'&spatialfilter='+geometry+'&maxfeatures='+maxFeatures+filter+'&layers='+layers+'&variant='+selectionType+extend+computed;
- var options = {onSuccess: this.processQueryResults.bind(this, zoomTo),
- parameters: params};
- Fusion.ajaxRequest(loadmapScript, options);
+ var params = {
+ 'mapname': this._sMapname,
+ 'session': this.getSessionID(),
+ 'spatialfilter': options.geometry || '',
+ 'maxfeatures': options.maxFeatures || 0, //zero means select all features
+ 'layers': options.layers || '',
+ 'variant': options.selectionType || this.selectionType
+ }
+ if (options.filter) {
+ params.filter= options.filter;
+ }
+ if (options.extendSelection) {
+ params.extendselection = true;
+ }
+ if (options.computedProperties) {
+ params.computed = true;
+ }
+ var ajaxOptions = {
+ onSuccess: OpenLayers.Function.bind(this.processQueryResults, this, zoomTo),
+ parameters: params};
+ Fusion.ajaxRequest(loadmapScript, ajaxOptions);
},
processLayerEvents: function(layer, isEnabling) {
@@ -935,6 +941,7 @@
var persist = 0;
var selection = 'INTERSECTS';
var layerNames = '';
+ var layerAttributeFilter = 3;
var sep = '';
for (var i=0; i<this.aLayers.length; ++i) {
layerNames += sep + this.aLayers[i].layerName;
@@ -943,7 +950,8 @@
var r = new Fusion.Lib.MGRequest.MGQueryMapFeatures(this.mapWidget.getSessionID(),
this._sMapname,
sGeometry,
- maxFeatures, persist, selection, layerNames);
+ maxFeatures, persist, selection, layerNames,
+ layerAttributeFilter);
Fusion.oBroker.dispatchRequest(r, this.crtlClickDisplay.bind(this));
}
},
@@ -965,7 +973,7 @@
pingServer: function() {
var s = this.arch + '/' + Fusion.getScriptLanguage() + "/Common." + Fusion.getScriptLanguage() ;
var params = {};
- params.parameters = 'session='+this.getSessionID();
+ params.parameters = {'session': this.getSessionID()};
Fusion.ajaxRequest(s, params);
},
getGroupInfoUrl: function(groupName) {
@@ -997,7 +1005,6 @@
*
* Implements the map layer groups for MapGuide services
*/
-
Fusion.Maps.MapGuide.Group = Class.create();
Fusion.Maps.MapGuide.Group.prototype = {
oMap: null,
@@ -1142,7 +1149,6 @@
*
* Implements a scale range object for MapGuide services
*/
-
Fusion.Maps.MapGuide.ScaleRange = Class.create();
Fusion.Maps.MapGuide.ScaleRange.prototype = {
styles: null,
@@ -1165,7 +1171,8 @@
}
},
contains: function(fScale) {
- return fScale >= this.minScale && fScale <= this.maxScale;
+ var testScale = Math.round(fScale);
+ return testScale >= this.minScale && testScale <= this.maxScale;
}
};
@@ -1177,6 +1184,7 @@
Fusion.Maps.MapGuide.StyleItem = Class.create();
Fusion.Maps.MapGuide.StyleItem.prototype = {
+ clientAgent: 'Fusion Viewer',
initialize: function(o, staticIcon) {
this.legendLabel = o.legendLabel;
this.filter = o.filter;
@@ -1192,6 +1200,6 @@
},
getLegendImageURL: function(fScale, layer) {
var url = Fusion.getConfigurationItem('mapguide', 'mapAgentUrl');
- return url + "OPERATION=GETLEGENDIMAGE&SESSION=" + layer.oMap.getSessionID() + "&VERSION=1.0.0&SCALE=" + fScale + "&LAYERDEFINITION=" + encodeURIComponent(layer.resourceId) + "&THEMECATEGORY=" + this.categoryIndex + "&TYPE=" + this.geometryType;
+ return url + "OPERATION=GETLEGENDIMAGE&SESSION=" + layer.oMap.getSessionID() + "&VERSION=1.0.0&SCALE=" + fScale + "&LAYERDEFINITION=" + encodeURIComponent(layer.resourceId) + "&THEMECATEGORY=" + this.categoryIndex + "&TYPE=" + this.geometryType + "&CLIENTAGENT=" + encodeURIComponent(this.clientAgent);
}
};
Modified: branches/fusion-1.0/MapGuide/php/Buffer.php
===================================================================
--- branches/fusion-1.0/MapGuide/php/Buffer.php 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/MapGuide/php/Buffer.php 2008-05-08 15:34:30 UTC (rev 1396)
@@ -158,12 +158,10 @@
$layerSrsWkt = $spatialContext->GetCoordinateSystemWkt();
/* skip this layer if the srs is empty */
if($layerSrsWkt == "") {
- $excludedLayers ++;
continue;
}
} else {
/* skip this layer if there is no spatial context at all */
- $excludedLayers ++;
continue;
}
@@ -182,7 +180,6 @@
//
if(($arbitraryDsSrs != $arbitraryMapSrs) || ($arbitraryDsSrs && ($dsSrsUnits != $mapSrsUnits)))
{
- $excludedLayers ++;
continue;
}
@@ -191,15 +188,19 @@
$dist = $layerCs->ConvertMetersToCoordinateSystemUnits($distance);
// calculate great circle unless data source srs is arbitrary
+ $verMajor = subStr(GetSiteVersion(), 0,1);
if(!$arbitraryDsSrs) {
- $measure = new MgCoordinateSystemMeasure($layerCs);
+ if ($verMajor == '1') {
+ $measure = new MgCoordinateSystemMeasure($layerCs);
+ } else {
+ $measure = $layerCs->GetMeasure();
+ }
} else {
$measure = null;
}
// create a SRS transformer if necessary.
if($layerSrsWkt != $srsDefMap) {
- $verMajor = subStr(GetSiteVersion(), 0,1);
if ($verMajor == '1') {
$srsXform = new MgCoordinateSystemTransform($layerCs, $srsMap);
} else {
Modified: branches/fusion-1.0/MapGuide/php/Common.php
===================================================================
--- branches/fusion-1.0/MapGuide/php/Common.php 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/MapGuide/php/Common.php 2008-05-08 15:34:30 UTC (rev 1396)
@@ -74,6 +74,8 @@
$username = isset($_REQUEST['username']) ? $_REQUEST['username'] : 'Anonymous';
$password = isset($_REQUEST['password']) ? $_REQUEST['password'] : '';
$user = new MgUserInformation($username, $password);
+ $user->SetClientIp(GetClientIp());
+ $user->SetClientAgent(GetClientAgent());
$siteConnection = new MgSiteConnection();
$siteConnection->Open($user);
} else {
@@ -90,9 +92,13 @@
/* current user is re-authenticating or not? */
if (isset($_REQUEST['username']) && isset($_REQUEST['password'])) {
$user = new MgUserInformation($_REQUEST['username'], $_REQUEST['password']);
+ $user->SetClientIp(GetClientIp());
+ $user->SetClientAgent(GetClientAgent());
$user->SetMgSessionId($sessionID);
} else {
$user = new MgUserInformation($sessionID);
+ $user->SetClientIp(GetClientIp());
+ $user->SetClientAgent(GetClientAgent());
}
/* open a connection to the site. This will generate exceptions if the user
@@ -118,7 +124,6 @@
echo "</Exception>";
exit;
} catch (MgUserNotFoundException $unfe) {
- header("HTTP/1.0 500 Internal Server Error");
header('Content-type: text/xml');
echo "<Exception>";
echo "<Type>User Not Found</Type>";
@@ -256,5 +261,29 @@
return $numberString;
}
+function GetClientIp()
+{
+ $clientIp = '';
+ if (array_key_exists('HTTP_CLIENT_IP', $_SERVER)
+ && strcasecmp($_SERVER['HTTP_CLIENT_IP'], 'unknown') != 0)
+ {
+ $clientIp = $_SERVER['HTTP_CLIENT_IP'];
+ }
+ else if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)
+ && strcasecmp($_SERVER['HTTP_X_FORWARDED_FOR'], 'unknown') != 0)
+ {
+ $clientIp = $_SERVER['HTTP_X_FORWARDED_FOR'];
+ }
+ else if (array_key_exists('REMOTE_ADDR', $_SERVER))
+ {
+ $clientIp = $_SERVER['REMOTE_ADDR'];
+ }
+ return $clientIp;
+}
+function GetClientAgent()
+{
+ return "Fusion Viewer";
+}
+
?>
Modified: branches/fusion-1.0/MapGuide/php/Query.php
===================================================================
--- branches/fusion-1.0/MapGuide/php/Query.php 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/MapGuide/php/Query.php 2008-05-08 15:34:30 UTC (rev 1396)
@@ -115,6 +115,7 @@
$className = $layerObj->GetFeatureClassName();
if (!$layerObj->GetSelectable() || !$layerObj->IsVisible() ||
+ $className=='RedlineSchema:Redline' ||
!$className || $className=='rasters:RasterType' ||$className=='') {
continue;
}
Modified: branches/fusion-1.0/MapGuide/php/SaveMap.php
===================================================================
--- branches/fusion-1.0/MapGuide/php/SaveMap.php 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/MapGuide/php/SaveMap.php 2008-05-08 15:34:30 UTC (rev 1396)
@@ -29,9 +29,14 @@
*****************************************************************************/
include('Common.php');
-$format = isset($_REQUEST['format']) ? $_REQUEST['format'] : 'png';
-$layout = isset($_REQUEST['layout']) ? $_REQUEST['layout'] : null;
-$scale = isset($_REQUEST['scale']) ? $_REQUEST['scale'] : null;
+$format = isset($_REQUEST['format']) ? $_REQUEST['format'] : 'png';
+$layout = isset($_REQUEST['layout']) ? $_REQUEST['layout'] : null;
+$scale = isset($_REQUEST['scale']) ? $_REQUEST['scale'] : null;
+$imgWidth = isset($_REQUEST['width']) ? $_REQUEST['width'] : null;
+$imgHeight = isset($_REQUEST['height']) ? $_REQUEST['height'] : null;
+$pageHeight = isset($_REQUEST['pageheight']) ? $_REQUEST['pageheight'] : 11;
+$pageWidth = isset($_REQUEST['pagewidth']) ? $_REQUEST['pagewidth'] : 8.5;
+$aMargins = isset($_REQUEST['margins']) ? explode(',',$_REQUEST['margins']) : array(0,0,0,0);
try
{
@@ -43,44 +48,41 @@
$selection = new MgSelection($map);
$selection->Open($resourceService, $mapName);
+ //compute center
+ $extent = $map->GetMapExtent();
+ $centerX = $extent->GetLowerLeftCoordinate()->GetX() + ($extent->GetWidth())/2;
+ $centerY = $extent->GetLowerLeftCoordinate()->GetY() + ($extent->GetHeight())/2;
+ $geomFactory = new MgGeometryFactory();
+ $center = $geomFactory->CreateCoordinateXY($centerX, $centerY);
+
if ($format == 'DWF') {
- $extent = $map->GetMapExtent();
$oLayout = null;
if ($layout) {
$layoutId = new MgResourceIdentifier($layout);
$layoutId->Validate();
$oLayout = new MgLayout($layoutId,'Map', 'meters');
- }
- $oPlotSpec = new MgPlotSpecification(8.5,11,MgPageUnitsType::Inches);
+ };
+ $oPlotSpec = new MgPlotSpecification($pageWidth,$pageHeight,MgPageUnitsType::Inches,
+ $aMargins[0],
+ $aMargins[1],
+ $aMargins[2],
+ $aMargins[3]
+ );
$dwfVersion = new MgDwfVersion('6.01','1.2');
if ($scale) {
- //compute center point and plot with the passed scale
-
- $centerX = $extent->GetLowerLeftCoordinate()->GetX() + ($extent->GetWidth())/2;
- $centerY = $extent->GetLowerLeftCoordinate()->GetY() + ($extent->GetHeight())/2;
- $geomFactory = new MgGeometryFactory();
- $center = $geomFactory->CreateCoordinateXY($centerX, $centerY);
+ //plot with the passed scale
- //echo $centerX.", ".$centerY;exit;
- //$metersPerUnit = $map->GetMetersPerUnit();
$coordSysFactory = new MgCoordinateSystemFactory();
$coordSystem = $coordSysFactory->Create($map->GetMapSRS());
$metersPerUnit = $coordSystem->ConvertCoordinateSystemUnitsToMeters(1.0);
$metersPerPixel = 1.0/(100.0 / 2.54 * $map->GetDisplayDpi());
- //echo $metersPerPixel; exit;
$height = $map->GetDisplayHeight();
$width = $map->GetDisplayWidth();
$mapWidth = $scale * $width * $metersPerPixel/$metersPerUnit;
$mapHeight = $scale * $height * $metersPerPixel/$metersPerUnit;
- //echo $mapWidth.", ".$mapHeight;exit;
-
- // $lowerLeft = $geomFactory->CreateCoordinateXY($center->GetX() - 0.5*$mapWidth,
- // $center->GetY() - 0.5*$mapHeight);
- // $topRight = $geomFactory->CreateCoordinateXY($center->GetX() + 0.5*$mapWidth,
- // $center->GetY() + 0.5*$mapHeight);
$extent = new MgEnvelope(
$center->GetX() - 0.5*$mapWidth,
$center->GetY() - 0.5*$mapHeight,
@@ -113,8 +115,18 @@
$dwfVersion);
}
} else {
- $oImg = $renderingService->RenderMap($map, $selection, $format);
- }
+ //render as an image
+ if (isset($imgHeight) && isset($imgWidth)) {
+ $scale = $map->GetViewScale();
+ $oImg = $renderingService->RenderMap($map, $selection,
+ $center, $scale,
+ $imgWidth, $imgHeight,
+ new MgColor(255,255,255),
+ $format);
+ }else{
+ $oImg = $renderingService->RenderMap($map, $selection, $format);
+ };
+ };
}
catch (MgException $e)
{
@@ -124,16 +136,8 @@
exit;
}
-/*
+header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
-header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
- // always modified
-header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
-header("Cache-Control: post-check=0, pre-check=0", false);
-header("Pragma: no-cache"); // HTTP/1.0
-header( "Content-type: application/octet-stream" );
-header( "Content-Disposition: attachment; filename=$mapName.png" );
-*/
header( "Content-type: image/$format" );
header( "Content-disposition: attachment; filename=$mapName.$format" );
Modified: branches/fusion-1.0/MapServer/MapServer.js
===================================================================
--- branches/fusion-1.0/MapServer/MapServer.js 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/MapServer/MapServer.js 2008-05-08 15:34:30 UTC (rev 1396)
@@ -24,7 +24,7 @@
*/
/******************************************************************************
- * Class: Fusion.Maps.MapServer
+ * Class: Fusion.Maps.MapServer
*
* Implementation of the map widget for MapServer CGI interface services
*/
@@ -48,17 +48,19 @@
bMapLoaded : false,
bIsMapWidgetLayer : true, //Setthis to false for overview map layers
bLayersReversed: true, //MS returns layers bottom-most layer first, we treat layer order in reverse sense
+ mapMetadataKeys: null,
+ layerMetadataKeys: null,
//the map file
sMapFile: null,
-
+
//imagetype
_sImageType : 'png',
-
+
initialize : function(map, mapTag, isMapWidgetLayer) {
//console.log('Fusion.Maps.MapServer.initialize');
Object.inheritFrom(this, Fusion.Lib.EventMgr, []);
-
+
this.registerEventID(Fusion.Event.MAP_SESSION_CREATED);
this.registerEventID(Fusion.Event.MAP_SELECTION_ON);
this.registerEventID(Fusion.Event.MAP_SELECTION_OFF);
@@ -75,7 +77,7 @@
var extension = mapTag.extension;
this.ratio = extension.MapRatio ? extension.MapRatio[0] : '1.0';
//this.selectionType = extension.SelectionType ? extension.SelectionType[0] : 'INTERSECTS';
-
+
rootOpts = {
displayInLegend: this.bDisplayInLegend,
expandInLegend: this.bExpandInLegend,
@@ -87,9 +89,12 @@
//TODO: set other opts for group initialization as required
};
this.layerRoot = new Fusion.Maps.MapServer.Group(rootOpts,this);
-
+
this.sMapFile = extension.MapFile ? extension.MapFile[0] : '';
+ this.mapMetadataKeys = extension.MapMetadata ? extension.MapMetadata[0] : null;
+ this.layerMetadataKeys = extension.LayerMetadata ? extension.LayerMetadata[0] : null;
+
this.bSingleTile = mapTag.singleTile;// this is set by the AppDef.Map object
this.keepAliveInterval = parseInt(extension.KeepAliveInterval ? extension.KeepAliveInterval[0] : 300);
@@ -108,7 +113,7 @@
var sl = Fusion.getScriptLanguage();
var scriptURL = this.arch + '/' + sl + '/CreateSession.' + sl;
var options = {onComplete: this.createSessionCB.bind(this)};
- Fusion.ajaxRequest(scriptURL,options);
+ Fusion.ajaxRequest(scriptURL,options);
}
if (this.session[0] instanceof Fusion.Maps.MapServer) {
this.session[0].registerForEvent(Fusion.Event.MAP_SESSION_CREATED, this.mapSessionCreated.bind(this));
@@ -116,7 +121,7 @@
this.mapSessionCreated();
}
},
-
+
createSessionCB : function(r, json) {
if (r.status == 200 && json) {
var o;
@@ -140,18 +145,18 @@
getSessionID: function() {
return this.session[0];
},
-
+
getMapName: function() {
return this._sMapname;
},
-
+
getMapTitle: function() {
return this._sMapTitle;
},
-
+
loadMap: function(mapfile, options) {
while (this.mapWidget.isBusy()) {
- this.mapWidget._removeWorker();
+ this.mapWidget._removeWorker();
}
this.bMapLoaded = false;
//console.log('loadMap: ' + resourceId);
@@ -164,56 +169,64 @@
this.sMapFile = mapfile;
return;
}
-
+
if (this.bIsMapWidgetLayer) {
this.mapWidget.triggerEvent(Fusion.Event.MAP_LOADING);
} else {
this.triggerEvent(Fusion.Event.MAP_LOADING);
}
this.mapWidget._addWorker();
-
+
this._fScale = -1;
this._nDpi = 72;
-
+
options = options || {};
-
+
this._oMaxExtent = null;
this.aVisibleLayers = options.showlayers || [];
this.aVisibleGroups = options.showgroups || [];
this.aLayers = [];
-
+
this.oSelection = null;
this.aSelectionCallbacks = [];
this._bSelectionIsLoading = false;
var sl = Fusion.getScriptLanguage();
var loadmapScript = this.arch + '/' + sl + '/LoadMap.' + sl;
-
+
var sessionid = this.getSessionID();
-
- var params = 'mapfile='+mapfile+"&session="+sessionid;
- var options = {onSuccess: this.mapLoaded.bind(this),
+
+ var metadata = '';
+ if (this.mapMetadataKeys) {
+ metadata += '&map_metadata='+this.mapMetadataKeys;
+ }
+ if (this.layerMetadataKeys) {
+ metadata += '&layer_metadata='+this.layerMetadataKeys;
+ }
+
+ var params = 'mapfile='+mapfile+"&session="+sessionid+metadata;
+ var options = {onSuccess: this.mapLoaded.bind(this),
parameters: params};
Fusion.ajaxRequest(loadmapScript, options);
},
-
+
mapLoaded: function(r, json) {
- if (json)
- {
- var o;
- eval('o='+r.responseText);
+ if (json)
+ {
+ var o;
+ eval('o='+r.responseText);
this._sMapFile = o.mapId;
- this._sMapname = o.mapName;
+ this._sMapname = o.mapName;
this._sMapTitle = o.mapTitle;
- this._fMetersperunit = o.metersPerUnit;
- this.mapWidget._fMetersperunit = this._fMetersperunit;
- this._sImageType = o.imagetype;
+ this.mapWidget.setMetersPerUnit(o.metersPerUnit);
+ this._sImageType = o.imagetype;
+ this.metadata = o.metadata;
- this._oMaxExtent = OpenLayers.Bounds.fromArray(o.extent);
-
+ this._oMaxExtent = OpenLayers.Bounds.fromArray(o.extent);
+
this.layerRoot.clear();
this.layerRoot.legendLabel = this._sMapTitle;
-
+
this.parseMapLayersAndGroups(o);
var minScale = 1.0e10;
@@ -229,37 +242,24 @@
if (minScale <= 0) {
minScale = 1.0;
}
-
+
if (o.dpi) {
OpenLayers.DOTS_PER_INCH = o.dpi;
}
+ //to allow for scaling that doesn't match any of the pre-canned units
+ this.units = Fusion.getClosestUnits(o.metersPerUnit);
+
var layerOptions = {
- singleTile: true,
+ singleTile: true,
ratio: this.ratio,
+ units: this.units,
maxExtent : this._oMaxExtent,
maxResolution : 'auto',
minScale : maxScale, //OL interpretation of min/max scale is reversed from Fusion
maxScale : minScale
};
- //set OpenLayer projection units and code if supplied (OL defaults units to degrees)
- if (o.metersPerUnit == 0.0254)
- layerOptions.units = 'inches';
- else if (o.metersPerUnit == 0.3048)
- layerOptions.units = 'ft';
- else if (o.metersPerUnit == 1609.344)
- layerOptions.units = 'mi';
- else if (o.metersPerUnit == 1)
- layerOptions.units = 'm';
- //layerOptions.projection = 'EPSG:42304'; //TODO: not necessary, but can this be supplied by LoadMap?
- else if (o.metersPerUnit == 1000)
- layerOptions.units = 'km';
- else if (o.metersPerUnit == 111118.7516)
- layerOptions.units = 'dd';
-
- //this.mapWidget.setMapOptions(oMapOptions);
-
//create the OL layer for this Map layer
var params = {
layers: this.aVisibleLayers.join(' '),
@@ -293,15 +293,15 @@
}
this.bMapLoaded = true;
- }
- else
+ }
+ else
{
- Fusion.reportError( new Fusion.Error(Fusion.Error.FATAL,
+ Fusion.reportError( new Fusion.Error(Fusion.Error.FATAL,
'Failed to load requested map:\n'+r.responseText));
}
this.mapWidget._removeWorker();
},
-
+
reloadMap: function() {
this.mapWidget._addWorker();
this.aShowLayers = [];
@@ -311,22 +311,33 @@
this.aRefreshLayers = [];
this.layerRoot.clear();
this.aLayers = [];
-
+
var sl = Fusion.getScriptLanguage();
var loadmapScript = this.arch + '/' + sl + '/LoadMap.' + sl;
-
+
var sessionid = this.getSessionID();
-
- var params = 'mapname='+this._sMapname+"&session="+sessionid;
- var options = {onSuccess: this.mapReloaded.bind(this),
+ var metadata = '';
+ if (this.mapMetadataKeys) {
+ metadata += '&map_metadata='+this.mapMetadataKeys;
+ }
+ if (this.layerMetadataKeys) {
+ metadata += '&layer_metadata='+this.layerMetadataKeys;
+ }
+
+ var params = 'mapname='+this._sMapname+"&session="+sessionid+metadata;
+ var options = {onSuccess: this.mapReloaded.bind(this),
parameters: params};
Fusion.ajaxRequest(loadmapScript, options);
},
-
+
mapReloaded: function(r,json) { /* update this with OL code */
if (json) {
var o;
eval('o='+r.responseText);
+
+ //can metadata change?
+ //this.metadata = o.metadata;
+
this.parseMapLayersAndGroups(o);
this.aVisibleLayers = [];
for (var i=0; i<this.aLayers.length; i++) {
@@ -337,25 +348,25 @@
this.drawMap();
this.mapWidget.triggerEvent(Fusion.Event.MAP_RELOADED);
} else {
- Fusion.reportError( new Fusion.Error(Fusion.Error.FATAL,
+ Fusion.reportError( new Fusion.Error(Fusion.Error.FATAL,
OpenLayers.String.translate('mapLoadError', r.responseText)));
}
this.mapWidget._removeWorker();
},
-
+
reorderLayers: function(aLayerIndex) {
var sl = Fusion.getScriptLanguage();
var loadmapScript = this.arch + '/' + sl + '/SetLayers.' + sl;
-
+
var sessionid = this.getSessionID();
var params = 'mapname='+this._sMapname+"&session="+sessionid;
params += '&layerindex=' + aLayerIndex.join();
-
- var options = {onSuccess: this.mapLayersReset.bind(this, aLayerIndex),
+
+ var options = {onSuccess: this.mapLayersReset.bind(this, aLayerIndex),
parameters: params};
Fusion.ajaxRequest(loadmapScript, options);
},
-
+
mapLayersReset: function(aLayerIndex,r,json) {
if (json) {
var o;
@@ -364,7 +375,7 @@
var layerCopy = this.aLayers.clone();
this.aLayers = [];
this.aVisibleLayers = [];
-
+
for (var i=0; i<aLayerIndex.length; ++i) {
this.aLayers.push( layerCopy[ aLayerIndex[i] ] );
if (this.aLayers[i].visible) {
@@ -372,7 +383,7 @@
}
}
//this.layerRoot.clear();
-
+
this.drawMap();
this.triggerEvent(Fusion.Event.MAP_LAYER_ORDER_CHANGED);
} else {
@@ -380,7 +391,7 @@
}
}
},
-
+
parseMapLayersAndGroups: function(o) {
for (var i=0; i<o.groups.length; i++) {
var group = new Fusion.Maps.MapServer.Group(o.groups[i], this);
@@ -408,7 +419,7 @@
/**
* Function: isMapLoaded
- *
+ *
* Returns true if the Map has been laoded succesfully form the server
*/
isMapLoaded: function() {
@@ -418,13 +429,13 @@
getScale : function() {
return this.mapWidget.getScale();
},
-
+
updateLayer: function() { //to be fleshed out, add query file to layer if selection, call this before draw
if (this.hasSelection()) {
this.oLayerOL.addOptions({queryfile: this._sQueryfile});
}
},
-
+
drawMap: function() {
if (!this.bMapLoaded || this.deferredDraw) {
return;
@@ -444,7 +455,7 @@
}
this.oLayerOL.mergeNewParams(params);
},
-
+
showLayer: function( sLayer ) {
this.aVisibleLayers.push(sLayer);
this.drawMap();
@@ -502,7 +513,7 @@
hasSelection: function() { return this.bSelectionOn; },
getSelectionCB : function(userFunc, layers, startend, r, json) {
- if (json)
+ if (json)
{
var o;
eval("o="+r.responseText);
@@ -511,7 +522,7 @@
userFunc(oSelection);
}
},
-
+
/**
* advertise a new selection is available and redraw the map
*/
@@ -569,25 +580,25 @@
* selection has loaded
* @param layers {string} Optional parameter. A comma separated
* list of layer names (Roads,Parcels). If it is not
- * given, all the layers that have a selection will be used
+ * given, all the layers that have a selection will be used
*
* @param startcount {string} Optional parameter. A comma separated
* list of a statinh index and the number of features to be retured for
* each layer given in the layers parameter. Index starts at 0
* (eg: 0:4,2:6 : return 4 elements for the first layers starting at index 0 and
* six elements for layer 2 starting at index 6). If it is not
- * given, all the elemsnts will be returned.
+ * given, all the elemsnts will be returned.
*/
getSelection : function(userFunc, layers, startcount) {
-
- if (userFunc)
+
+ if (userFunc)
{
var s = this.arch + '/' + Fusion.getScriptLanguage() + "/Selection." + Fusion.getScriptLanguage() ;
- var params = {parameters:'session='+this.getSessionID()+'&mapname='+ this._sMapname+ '&layers='+layers+'&startcount='+startcount+'&queryfile='+this._sQueryfile,
+ var params = {parameters:'session='+this.getSessionID()+'&mapname='+ this._sMapname+ '&layers='+layers+'&startcount='+startcount+'&queryfile='+this._sQueryfile,
onComplete: this.getSelectionCB.bind(this, userFunc, layers, startcount)};
Fusion.ajaxRequest(s, params);
}
-
+
},
/**
@@ -595,7 +606,7 @@
*/
clearSelection : function() {
if (!this.aLayers) return;
-
+
//clear the selection count for the layers
for (var j=0; j<this.aLayers.length; ++j) {
this.aLayers[j].selectedFeatureCount = 0;
@@ -617,7 +628,7 @@
if (json) {
var o;
eval("o="+r.responseText);
- if (!o.hasSelection) {
+ if (!o.hasSelection) {
//this.drawMap();
return;
} else {
@@ -644,7 +655,7 @@
*/
query : function(options) {
this.mapWidget._addWorker();
-
+
//clear the selection count for the layers
for (var j=0; j<this.aLayers.length; ++j) {
this.aLayers[j].selectedFeatureCount = 0;
@@ -669,19 +680,19 @@
var sessionid = this.getSessionID();
var params = 'mapname='+this._sMapname+"&session="+sessionid+'&spatialfilter='+geometry+'&maxfeatures='+maxFeatures+filter+'&layers='+layers+'&variant='+selectionType+extend;
- var options = {onSuccess: this.processQueryResults.bind(this, zoomTo),
+ var options = {onSuccess: this.processQueryResults.bind(this, zoomTo),
parameters: params};
Fusion.ajaxRequest(loadmapScript, options);
},
-
+
loadStart: function() {
this.mapWidget._addWorker();
},
-
+
loadEnd: function() {
this.mapWidget._removeWorker();
},
-
+
pingServer: function() {
var s = this.arch + '/' + Fusion.getScriptLanguage() + "/Common." + Fusion.getScriptLanguage() ;
var params = {};
@@ -695,11 +706,19 @@
getLayerInfoUrl: function(layerName) {
return null;
+ },
+
+ getMetadata: function(key) {
+ if (typeof this.metadata[key] != 'undefined') {
+ return this.metadata[key];
+ } else {
+ return '';
+ }
}
};
-
+
/******************************************************************************
* Class: Fusion.Maps.MapServer.Group
*
@@ -722,27 +741,27 @@
this.visible = o.visible;
this.actuallyVisible = o.actuallyVisible;
},
-
+
clear: function() {
Fusion.Widget.Map.Group.prototype.clear.apply(this, []);
//this.oMap = null;
},
-
+
show: function() {
+ this.visible = true;
this.oMap.showGroup(this.groupName);
- this.visible = true;
},
-
+
hide: function() {
+ this.visible = false;
this.oMap.hideGroup(this.groupName);
- this.visible = false;
},
-
+
isVisible: function() {
var bParentVisible = (this.parentGroup && this.parentGroup.isVisible) ? this.parentGroup.isVisible() : true;
return this.visible && bParentVisible;
}
-
+
};
var MSLAYER_POINT_TYPE = 0;
@@ -759,11 +778,11 @@
Fusion.Maps.MapServer.Layer = Class.create();
Fusion.Maps.MapServer.Layer.prototype = {
-
+
scaleRanges: null,
-
+
oMap: null,
-
+
initialize: function(o, oMap) {
this.uniqueId = o.uniqueId;
Object.inheritFrom(this, Fusion.Widget.Map.Layer.prototype, [this.uniqueId]);
@@ -781,6 +800,7 @@
this.actuallyVisible = o.actuallyVisible;
this.editable = o.editable;
this.parentGroup = o.parentGroup;
+ this.metadata = o.metadata;
this.scaleRanges = [];
this.minScale = 1.0e10;
this.maxScale = 0;
@@ -791,13 +811,13 @@
this.maxScale = Math.max(this.maxScale, scaleRange.maxScale);
}
},
-
+
clear: function() {
Fusion.Widget.Map.Layer.prototype.clear.apply(this, []);
this.oMap = null;
this.legend = null;
},
-
+
supportsType: function(type) {
for (var i=0; i<this.layerTypes.length; i++) {
if (this.layerTypes[i] == type) {
@@ -806,7 +826,7 @@
}
return false;
},
-
+
getScaleRange: function(fScale) {
for (var i=0; i<this.scaleRanges.length; i++) {
if (this.scaleRanges[i].contains(fScale)) {
@@ -817,18 +837,26 @@
},
show: function() {
+ this.set('visible', true);
this.oMap.showLayer(this.layerName);
- this.set('visible', true);
},
hide: function() {
+ this.set('visible',false);
this.oMap.hideLayer(this.layerName);
- this.set('visible',false);
},
isVisible: function() {
var bParentVisible = this.parentGroup ? this.parentGroup.isVisible() : true;
return this.visible && bParentVisible;
+ },
+
+ getMetadata: function(key) {
+ if (typeof this.metadata[key] != 'undefined') {
+ return this.metadata[key];
+ } else {
+ return '';
+ }
}
};
@@ -848,7 +876,7 @@
if (!o.styles) {
return;
}
-
+
/*special case : if there are no classes and it is a raster layer
we set it to use the default static raster icon*/
if (o.styles.length == 0 && bRaster)
@@ -860,7 +888,7 @@
tmpsyle.staticIcon = true;
var styleItem = new Fusion.Maps.MapServer.StyleItem(tmpsyle, tmpsyle.staticIcon);
this.styles.push(styleItem);
- }
+ }
else
{
var staticIcon = o.styles.length>=1 ? false : bRaster;
@@ -871,7 +899,8 @@
}
},
contains: function(fScale) {
- return fScale >= this.minScale && fScale <= this.maxScale;
+ var testScale = Math.round(fScale);
+ return testScale >= this.minScale && testScale <= this.maxScale;
}
};
Modified: branches/fusion-1.0/MapServer/php/LegendIcon.php
===================================================================
--- branches/fusion-1.0/MapServer/php/LegendIcon.php 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/MapServer/php/LegendIcon.php 2008-05-08 15:34:30 UTC (rev 1396)
@@ -25,7 +25,7 @@
*/
/*****************************************************************************
- * Purpose: Draw a legend icon
+ * Purpose: Draw a legend icon
*****************************************************************************/
include(dirname(__FILE__).'/Common.php');
@@ -57,6 +57,14 @@
/* if the legendIconCache dir is set */
if (isset($configObj->mapserver->legendIconCacheDir)) {
$legendIconCacheDir = $configObj->mapserver->legendIconCacheDir;
+
+ // check for closing '/'
+ $legendIconCacheDir = str_replace( '\\', '/', trim( $legendIconCacheDir ) );
+ if ( substr( $legendIconCacheDir, -1 ) != '/' )
+ {
+ $legendIconCacheDir .= '/';
+ }
+
$cacheLegendIcons = true;
$str = file_get_contents($_SESSION['maps'][$mapName]);
/* create a unique location for the map icons based on
@@ -89,7 +97,7 @@
$width = 16;
if ($height <=0)
$height = 16;
-
+
$oImg = $oClass->createLegendIcon($width, $height);
/* TODO: can we figure out what the content type is? */
header('Content-type: image/png');
Modified: branches/fusion-1.0/MapServer/php/LoadMap.php
===================================================================
--- branches/fusion-1.0/MapServer/php/LoadMap.php 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/MapServer/php/LoadMap.php 2008-05-08 15:34:30 UTC (rev 1396)
@@ -41,16 +41,16 @@
/* could potentially make this optional */
$moveToSession = true;
-/**
+/**
TODO make it possible to specify only a relative path
in the WebLayout and have this code know where to
look for it on the server somehow
*/
-
+
/* only do something if a mapfile was requested */
if (isset($_REQUEST['mapfile'])) {
$oMap = ms_newMapObj($_REQUEST['mapfile']);
-
+
/* optionally move the mapfile to the session */
if ($moveToSession) {
//path to map file in the session is used by the client
@@ -70,7 +70,7 @@
$oMap->setFontSet(realpath($fontSet));
}
/* need to modify all image symbols reference in the map file
- eg STYLE
+ eg STYLE
SYMBOL "../etc/markers/target-7.gif" : this is relative to the map file
*/
for ($i=0; $i<$oMap->numlayers; $i++)
@@ -115,6 +115,14 @@
$mapObj->sessionId = $sessionID;
$mapObj->mapId = $mapId;
+ $mapObj->metadata = NULL;
+ if (isset($_REQUEST['map_metadata'])) {
+ $mapMetadataKeys = explode(',',$_REQUEST['map_metadata']);
+ foreach($mapMetadataKeys as $key) {
+ $mapObj->metadata->$key = $oMap->getMetadata($key);
+ }
+ }
+
$mapObj->metersPerUnit = GetMetersPerUnit($oMap->units);
$mapObj->dpi = $oMap->resolution;
@@ -126,7 +134,7 @@
if (!isset($_SESSION['maps'][$mapObj->mapName])) {
$_SESSION['maps'][$mapObj->mapName] = $mapId;
}
- $mapObj->extent = array( $oMap->extent->minx, $oMap->extent->miny,
+ $mapObj->extent = array( $oMap->extent->minx, $oMap->extent->miny,
$oMap->extent->maxx, $oMap->extent->maxy );
$minScale = $oMap->web->minscale == -1 ? MIN_SCALE : $oMap->web->minscale;
$maxScale = $oMap->web->maxscale == -1 ? MAX_SCALE : $oMap->web->maxscale;
@@ -138,6 +146,15 @@
{
$layer=$oMap->GetLayer($i);
$layerObj = NULL;
+
+ $layerObj->metadata = NULL;
+ if (isset($_REQUEST['layer_metadata'])) {
+ $layerMetadataKeys = explode(',',$_REQUEST['layer_metadata']);
+ foreach($layerMetadataKeys as $key) {
+ $layerObj->metadata->$key = $layer->getMetadata($key);
+ }
+ }
+
$layerObj->propertyMappings = '';
$layerObj->uniqueId = $i;
$layerObj->layerName = $layer->name;
@@ -159,42 +176,42 @@
$type = 0;
}
$layerObj->layerTypes = array($type);
-
+
$displayInLegend = strtolower($layer->getMetaData('displayInLegend'));
$layerObj->displayInLegend = $displayInLegend == 'false' ? false : true;
-
+
$expandInLegend = strtolower($layer->getMetaData('expandInLegend'));
$layerObj->expandInLegend = $expandInLegend == 'false' ? false : true;
$layerObj->resourceId = $layer->name;
$layerObj->parentGroup = $layer->group;
-
+
$legendLabel = $layer->getMetaData('legendLabel');
if ($legendLabel == '') {
$legendLabel = $layer->name;
}
$layerObj->legendLabel = $legendLabel;
-
+
$selectable = strtolower($layer->getMetaData('selectable'));
$layerObj->selectable = $selectable == 'true' ? true : false;
$layerObj->visible = ($layer->status == MS_ON || $layer->status == MS_DEFAULT);
$layerObj->actuallyVisible = true;
-
+
$editable = strtolower($layer->getMetaData('editable'));
$layerObj->editable = $editable == 'true' ? true : false;
-
- /* process the classes. The legend expects things
+
+ /* process the classes. The legend expects things
* organized by scale range so we have to first
* find all the scale breaks, then create ranges
* for each scale break pair, then slot the classes
* into the scale ranges that they apply to.
*/
-
+
$aScaleRanges = array();
//create a default scale range for the layer as a whole
$layerMin = $layer->minscale == -1 ? $minScale : $layer->minscale;
$layerMax = $layer->maxscale == -1 ? $maxScale : $layer->maxscale;
-
- //find all the unique scale breaks in this layer
+
+ //find all the unique scale breaks in this layer
$aScaleBreaks = array($layerMin, $layerMax);
for ($j=0; $j<$layer->numclasses; $j++) {
$oClass = $layer->getClass($j);
@@ -209,7 +226,7 @@
}
//sort them
sort($aScaleBreaks);
-
+
//create scale ranges for each pair of breaks
for ($j=0; $j<count($aScaleBreaks)-1; $j++) {
$scaleRange = NULL;
@@ -218,7 +235,7 @@
$scaleRange->styles = array();
array_push($aScaleRanges, $scaleRange);
}
-
+
//create classes and slot them into the scale breaks
for ($j=0; $j<$layer->numclasses; $j++) {
$oClass = $layer->getClass($j);
@@ -239,7 +256,7 @@
}
$layerObj->scaleRanges = $aScaleRanges;
array_push($mapObj->layers, $layerObj);
- }
+ }
$mapObj->groups = array();
$aGroups = $oMap->getAllGroupNames();
foreach($aGroups as $groupName) {
@@ -268,7 +285,7 @@
$b = $layer->getMetaData('groupVisible');
$group->visible = ($b == 'false') ? false : true;
$group->actuallyVisible = $layer->isVisible();
-
+
return $group;
}
Modified: branches/fusion-1.0/MapServer/php/Measure.php
===================================================================
--- branches/fusion-1.0/MapServer/php/Measure.php 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/MapServer/php/Measure.php 2008-05-08 15:34:30 UTC (rev 1396)
@@ -52,7 +52,7 @@
/*this already returns a meter*/
$distance = distHaversine($x1,$y1, $x2,$y2);
else
- {
+ {
$distance = sqrt (pow(($x2 - $x1),2) + pow(($y2 - $y1),2));
/*convert to meter*/
$distance = GetMetersPerUnit($oMap->units)*$distance;
Modified: branches/fusion-1.0/MapServer/php/Query.php
===================================================================
--- branches/fusion-1.0/MapServer/php/Query.php 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/MapServer/php/Query.php 2008-05-08 15:34:30 UTC (rev 1396)
@@ -81,8 +81,8 @@
$oMap->loadquery(getSessionSavePath()."query.qry");
}
-$bComputedProperties = isset($_REQUEST['computed']) && strcasecmp($_REQUEST['computed'], 'true') == 0;
-
+$bComputedProperties = isset($_REQUEST['computed']) && strcasecmp($_REQUEST['computed'], 'true') == 0;
+
$bAllLayers = false;
$nLayers = count($layers);
$nSelections = 0;
@@ -102,8 +102,9 @@
}
$oLayer->set('tolerance', 0);
if ($oLayer->type == MS_LAYER_RASTER || $oLayer->type == MS_LAYER_QUERY ||
- $oLayer->type == MS_LAYER_CIRCLE || $oLayer->type == MS_LAYER_CHART)
- continue;
+ $oLayer->type == MS_LAYER_CIRCLE || $oLayer->type == MS_LAYER_CHART) {
+ continue;
+ }
if (@$oLayer->queryByShape($oSpatialFilter) == MS_SUCCESS) {
@@ -123,8 +124,7 @@
header('Content-type: text/x-json');
header('X-JSON: true');
-if ($result->hasSelection)
-{
+if ($result->hasSelection) {
$oMap->savequery(getSessionSavePath()."query.qry");
$result->queryFile = getSessionSavePath()."query.qry";
@@ -139,15 +139,13 @@
$bFirstElement = 1;
$nLayers = $oMap->numlayers;
- for ($i=0; $i<$nLayers; $i++)
- {
+ for ($i=0; $i<$nLayers; $i++) {
$oLayer = $oMap->GetLayer($i);
$numResults = $oLayer->getNumResults();
- if ($numResults == 0)
+ if ($numResults == 0){
continue;
-
+ }
$oLayer->open();
-
$layerName = $oLayer->name != "" ? $oLayer->name : "Layer_".$i;
array_push($properties->layers, $layerName);
@@ -169,21 +167,70 @@
$oRes = $oLayer->getResult(0);
$oShape = $oLayer->getShape($oRes->tileindex,$oRes->shapeindex);
$selFields = array();
- while ( list($key,$val) = each($oShape->values) )
- {
- array_push($selFields, $key);
+
+ if (isset($_SESSION[$mapName][$layerName]['query_items'])) {
+ $aQueryItems = $_SESSION[$mapName][$layerName]['query_items'];
+ } else {
+ //token separator (for parsing displayed attributes on a query)
+ $tokenSeparator = ",";
+ // checking if metadata "query_include_items" is set
+ $metadataItems = $oLayer->getMetaData('query_include_items');
+ if ( ($metadataItems == "") || ($metadataItems == "all") ) {
+ while ( list($key,$val) = each($oShape->values) ) {
+ $aQueryItems[$key] = NULL;
+ }
+ } else {
+ $token = strtok($metadataItems, $tokenSeparator);
+ while ($token !== false) {
+ $aQueryItems[trim($token)] = NULL;
+ $token = strtok($tokenSeparator);
+ }
+ }
+
+ // checking if metadata "query_exclude_items" is set
+ $metadataItems = $oLayer->getMetaData('query_exclude_items');
+ if ($metadataItems != "") {
+ $token = strtok($metadataItems, $tokenSeparator);
+ while ($token !== false) {
+ if (array_key_exists($token, $aQueryItems)) {
+ unset($aQueryItems[$token]);
+ }
+ $token = strtok($tokenSeparator);
+ }
+ }
+
+ // get all alias
+ while ( list($key,$val) = each($aQueryItems) ) {
+ $keyAlias = $oLayer->getMetaData("query_".$key."_alias");
+ trim($keyAlias);
+ if ($keyAlias != "") {
+ $aQueryItems[$key] = $keyAlias;
+ }
+ }
+ $_SESSION[$mapName][$layerName]['query_items'] = $aQueryItems;
+ }
+
+ $oShape = $oLayer->getShape($oRes->tileindex,$oRes->shapeindex);
+ while ( list($key,$val) = each($oShape->values) ) {
+ if (array_key_exists($key, $aQueryItems)) {
+ array_push($selFields, $key);
- array_push($properties->$layerName->propertynames, $key);
- //TODO : we should define away to give alias to field names
- array_push($properties->$layerName->propertyvalues, $key);
+ //we check if an alias if provided
+ if (isset($aQueryItems[$key]) && ($aQueryItems[$key] != "")){
+ $key = $aQueryItems[$key];
+ }
- //TODO we do not know the types of the attributes in MS. Just output 0
- //we shouls possibly use OGR to get the attributes
- array_push($properties->$layerName->propertytypes, 0);
+ array_push($properties->$layerName->propertynames, $key);
+ //TODO : we should define away to give alias to field names
+ array_push($properties->$layerName->propertyvalues, $key);
+
+ //TODO we do not know the types of the attributes in MS. Just output 0
+ //we shouls possibly use OGR to get the attributes
+ array_push($properties->$layerName->propertytypes, 0);
+ }
}
- for ($iRes=0; $iRes < $numResults; $iRes++)
- {
+ for ($iRes=0; $iRes < $numResults; $iRes++) {
$properties->$layerName->values[$iRes] = array();
$properties->$layerName->metadata[$iRes] = array();
@@ -195,25 +242,26 @@
$maxx = $oShape->bounds->maxx;
$maxy = $oShape->bounds->maxy;
- if ($bFirstElement)
- {
+ if ($bFirstElement) {
$bFirstElement = 0;
$totalminx = $minx;
$totalminy = $miny;
$totalmaxx = $maxx;
$totalmaxy = $maxy;
+ } else {
+ if ($totalminx > $minx) {
+ $totalminx = $minx;
+ }
+ if ($totalminy > $miny) {
+ $totalminy = $miny;
+ }
+ if ($totalmaxx < $maxx) {
+ $totalmaxx = $maxx;
+ }
+ if ($totalmaxy < $maxy) {
+ $totalmaxy = $maxy;
+ }
}
- else
- {
- if ($totalminx > $minx)
- $totalminx = $minx;
- if ($totalminy > $miny)
- $totalminy = $miny;
- if ($totalmaxx < $maxx)
- $totalmaxx = $maxx;
- if ($totalmaxy < $maxy)
- $totalmaxy = $maxy;
- }
//metadata : TODO dimension, area, length and distance are not set
$dimension = 0;
@@ -229,8 +277,7 @@
array_push($properties->$layerName->metadata[$iRes], $length);
//field values
- for($iField=0; $iField < count($selFields); $iField++)
- {
+ for($iField=0; $iField < count($selFields); $iField++) {
$value = $oShape->values[$selFields[$iField]];
//$value = preg_replace( "/\r?\n/", "<br>", $value );
$value = str_replace("'", "\'", $value);
Modified: branches/fusion-1.0/common/php/Xml2JSON.php
===================================================================
--- branches/fusion-1.0/common/php/Xml2JSON.php 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/common/php/Xml2JSON.php 2008-05-08 15:34:30 UTC (rev 1396)
@@ -30,15 +30,32 @@
if (isset($_FILES['xml'])) {
$xml = file_get_contents($_FILES['xml']['tmp_name']);
-} else {
+} elseif (isset($_SERVER['HTTP_HOST'])) {
$REQUEST_VARS = array_merge($_GET, $_POST);
-
if (!isset($REQUEST_VARS['xml'])) {
die('xml not set');
}
-
+ header('Content-type: text/plain');
+ header('X-JSON: true');
$xml = rawurldecode ($REQUEST_VARS['xml']);
$xml = str_replace('\"', '"', $xml);
+ $xml = str_replace('"', "'", $xml);
+} elseif (isset($argv)) {
+ $cliArgs = arguments($argv);
+ if (isset($cliArgs['obj'])) {
+ $jsObject = $cliArgs['obj'];
+ } else {
+ $jsObject = "Fusion.appDefJson";
+ }
+ if (isset($cliArgs['file'])) {
+ $xml = file_get_contents($cliArgs['file']);
+ if (!$xml) {
+ die('file not found:'.$cliArgs['file']);
+ }
+ echo $jsObject."=";
+ }
+} else {
+ die('no XML input');
}
//print_r($xml);
$document = DOMDocument::loadXML($xml);
@@ -46,8 +63,5 @@
die ('/* invalid xml document:'.$xml.' */');
}
$root = $document->documentElement;
-
-header('Content-type: text/plain');
-header('X-JSON: true');
-echo '{"' . $root->tagName . '":' . xml2json($root) . '}';
+echo '{"' . $root->tagName . '":' . xml2json($root) . '};';
?>
\ No newline at end of file
Modified: branches/fusion-1.0/config.json
===================================================================
--- branches/fusion-1.0/config.json 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/config.json 2008-05-08 15:34:30 UTC (rev 1396)
@@ -1,21 +1,21 @@
/* This is the fusion configuration file. Adjust as necessary. */
-{
- /* The general section contains settings that are general to
+{
+ /* The general section contains settings that are general to
fusion as a whole. */
"general": {
- /* PHP is the default and only script language supported.
+ /* PHP is the default and only script language supported.
Don"t change this. */
"scriptLanguage": "php",
-
+
/* A directory on this system that fusion can use for
temporary files. */
"temporaryDirectory": "/tmp"
},
- /* The MapGuide section is required if you are installing
+ /* The MapGuide section is required if you are installing
fusion for MapGuide. */
"mapguide": {
- /* The WebTierURL is the url to mapguide, it should start
- with http and end with /mapguide. If you have installed
+ /* The WebTierURL is the url to mapguide, it should start
+ with http and end with /mapguide. If you have installed
fusion inside the www directory of MapGuide, then you can
leave this empty as it will be automatically calculated. */
"webTierUrl": ""
@@ -29,6 +29,9 @@
web-accessible temporary images. */
"imagePath": "/tmp/ms_tmp",
/* The URL to the image path configured above. */
- "imageUrl": "http://localhost/tmp/ms_tmp"
+ "imageUrl": "http://localhost/tmp/ms_tmp",
+ /* The file system path to where mapserver should put
+ web-accessible temporary legend images. */
+ "legendIconCacheDir":"/tmp/ms_tmp"
}
}
\ No newline at end of file
Modified: branches/fusion-1.0/jx/lib/jx_combined.js
===================================================================
--- branches/fusion-1.0/jx/lib/jx_combined.js 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/jx/lib/jx_combined.js 2008-05-08 15:34:30 UTC (rev 1396)
@@ -8253,7 +8253,9 @@
if (options.parentObj) {
$(options.parentObj).appendChild(this.blanket);
} else {
- document.body.appendChild(this.blanket);
+ document.body.appendChild(this.blanket);
+ var temp = new Jx.Layout(this.blanket);
+ temp.resize();
}
}
Modified: branches/fusion-1.0/lib/MGBroker.js
===================================================================
--- branches/fusion-1.0/lib/MGBroker.js 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/lib/MGBroker.js 2008-05-08 15:34:30 UTC (rev 1396)
@@ -144,7 +144,7 @@
*/
initializeRequest : function() {
this.options = { method:'post' };
- this.parameters = { version : '1.0.0', locale : Fusion.locale };
+ this.parameters = { version : '1.0.0', locale : Fusion.locale, clientagent : 'Fusion Viewer' };
},
/**
@@ -597,11 +597,13 @@
* @param maxFeatures {integer} number of maximum results (-1 to indicate no maximum)
* @param selectionPersist {boolean} save the selection (valid values are 0 and 1)
* @param selectionVariant {String} indicates the spatial operation. Valid values are 'INTERSECTS', ...
- *@param layerNames {String} comma separated list of layer names to include in the query
+ * @param layerNames {String} comma separated list of layer names to include in the query
+ * @param layerAttributeFilter {integer} bitmask determining layer selection behaviour (1=visible layers,
+ * 2=selectable layers, 4=layers with tooltips)
*
* @return {Object} an instance of Fusion.Lib.MGRequest.MGQueryMapFeatures
*/
- initialize : function( sessionId, mapName, geometry, maxFeatures, persist, selectionVariant, layerNames )
+ initialize : function( sessionId, mapName, geometry, maxFeatures, persist, selectionVariant, layerNames, layerAttributeFilter )
{
this.initializeRequest();
this.setParams( {
@@ -612,7 +614,8 @@
maxFeatures: maxFeatures,
persist: persist,
selectionVariant: selectionVariant,
- layerNames: layerNames
+ layerNames: layerNames,
+ layerAttributeFilter: layerAttributeFilter
} );
}
});
Modified: branches/fusion-1.0/lib/Map.js
===================================================================
--- branches/fusion-1.0/lib/Map.js 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/lib/Map.js 2008-05-08 15:34:30 UTC (rev 1396)
@@ -640,8 +640,36 @@
return (nPixels*resolution);
},
+ /**
+ *
+ * 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.
+ *
+ * @param metersPerUnit the value returned by LoadMap.php for meters per unit
+ */
+ setMetersPerUnit: function(metersPerUnit) {
+ if (this._fMetersperunit < 0) {
+ Fusion.initUnits(metersPerUnit);
+ this._fMetersperunit = metersPerUnit;
+ } else {
+ Fusion.reportError(new Fusion.Error(Fusion.Error.WARNING,
+ 'meters per unit value already set'));
+ }
+ },
+
/**
*
+ * returns the meters per unit value
+ *
+ * @return metersPerUnit the value as set when the map initialized
+ */
+ getMetersPerUnit: function() {
+ return this._fMetersperunit;
+ },
+
+ /**
+ *
* convert geographic into pixels.
*
* @param fGeo float distance in geographic units
@@ -705,7 +733,7 @@
},
getScale : function() {
- return Math.round(this.oMapOL.getScale());
+ return this.oMapOL.getScale();
},
getResolution : function() {
Added: branches/fusion-1.0/lib/OpenLayers/theme/default/img/blank.gif
===================================================================
(Binary files differ)
Property changes on: branches/fusion-1.0/lib/OpenLayers/theme/default/img/blank.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/fusion-1.0/lib/OpenLayers/theme/default/img/editing_tool_bar.png
===================================================================
(Binary files differ)
Property changes on: branches/fusion-1.0/lib/OpenLayers/theme/default/img/editing_tool_bar.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/fusion-1.0/lib/OpenLayers/theme/default/img/overview_replacement.gif
===================================================================
(Binary files differ)
Property changes on: branches/fusion-1.0/lib/OpenLayers/theme/default/img/overview_replacement.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/fusion-1.0/lib/OpenLayers/theme/default/img/view_next_off.png
===================================================================
(Binary files differ)
Property changes on: branches/fusion-1.0/lib/OpenLayers/theme/default/img/view_next_off.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/fusion-1.0/lib/OpenLayers/theme/default/img/view_next_on.png
===================================================================
(Binary files differ)
Property changes on: branches/fusion-1.0/lib/OpenLayers/theme/default/img/view_next_on.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/fusion-1.0/lib/OpenLayers/theme/default/img/view_previous_off.png
===================================================================
(Binary files differ)
Property changes on: branches/fusion-1.0/lib/OpenLayers/theme/default/img/view_previous_off.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/fusion-1.0/lib/OpenLayers/theme/default/img/view_previous_on.png
===================================================================
(Binary files differ)
Property changes on: branches/fusion-1.0/lib/OpenLayers/theme/default/img/view_previous_on.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: branches/fusion-1.0/lib/fusion.js
===================================================================
--- branches/fusion-1.0/lib/fusion.js 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/lib/fusion.js 2008-05-08 15:34:30 UTC (rev 1396)
@@ -892,6 +892,49 @@
}
return false;
},
+
+ /**
+ * 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.
+ *
+ * @param metersPerUnit the value returned by LoadMap.php for meters per unit
+ */
+ initUnits: function(metersPerUnit) {
+ var eps = 1000;
+ if (Math.abs(metersPerUnit-Fusion.aMeterPerUnit[Fusion.DEGREES]) < eps){
+ Fusion.aMeterPerUnit[Fusion.DEGREES] = metersPerUnit;
+ Fusion.aMeterPerUnit[Fusion.DECIMALDEGREES] = metersPerUnit;
+ Fusion.aMeterPerUnit[Fusion.DMX] = metersPerUnit;
+ var inverse = 1.0/metersPerUnit;
+ Fusion.aUnitPerMeter[Fusion.DEGREES] = inverse;
+ Fusion.aUnitPerMeter[Fusion.DECIMALDEGREES] = inverse;
+ Fusion.aUnitPerMeter[Fusion.DMX] = inverse;
+
+ var inPerUnit = OpenLayers.INCHES_PER_UNIT.m * metersPerUnit;
+ OpenLayers.INCHES_PER_UNIT["dd"] = inPerUnit;
+ OpenLayers.INCHES_PER_UNIT["degrees"] = inPerUnit;
+ }
+ },
+
+ /**
+ * 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;
+ for (var key in OpenLayers.INCHES_PER_UNIT) {
+ var newDiff = Math.abs((metersPerUnit * 39.3701) - OpenLayers.INCHES_PER_UNIT[key]);
+ if(newDiff < minDiff)
+ {
+ minDiff = newDiff;
+ units = key;
+ }
+ }
+ return units;
+ },
addWidgetStyleSheet: function(url) {
var lnk = document.createElement('link');
Modified: branches/fusion-1.0/templates/mapguide/standard/ApplicationDefinition.xml
===================================================================
--- branches/fusion-1.0/templates/mapguide/standard/ApplicationDefinition.xml 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/templates/mapguide/standard/ApplicationDefinition.xml 2008-05-08 15:34:30 UTC (rev 1396)
@@ -277,6 +277,19 @@
</Item>
</Container>
+<!-- MAP -->
+
+ <MapWidget xsi:type="WidgetType">
+ <Name>Map</Name>
+ <Type>Map</Type>
+ <StatusItem>The map.</StatusItem>
+ <Extension xsi:type="CustomContentType">
+ <MenuContainer>MapContextMenu</MenuContainer>
+ <Scales>2000000 1000000 500000 250000 125000 50000</Scales>
+ </Extension>
+ <MapId>sheboygan</MapId>
+ </MapWidget>
+
<!-- ******************************************
* Context Menu - Widgets
*
@@ -467,6 +480,13 @@
<Name>menuSelectRadius</Name>
<Type>SelectRadius</Type>
<StatusItem>Click and drag to select all features inside a circle.</StatusItem>
+ <Extension xsi:type="CustomContentType">
+ <QueryActiveLayer>true</QueryActiveLayer>
+ <RadiusTooltipContainer>RadiusTip</RadiusTooltipContainer>
+ <RadiusTooltipType>Dynamic</RadiusTooltipType>
+ <DefaultRadius>5</DefaultRadius>
+ <Tolerance>1</Tolerance>
+ </Extension>
<ImageUrl>images/icons/select-radius.png</ImageUrl>
<ImageClass/>
<Tooltip>Select Radius</Tooltip>
@@ -972,18 +992,6 @@
<Disabled/>
</Widget>
-<!-- MAP -->
-
- <MapWidget xsi:type="WidgetType">
- <Name>Map</Name>
- <Type>Map</Type>
- <StatusItem>The map.</StatusItem>
- <Extension xsi:type="CustomContentType">
- <MenuContainer>MapContextMenu</MenuContainer>
- </Extension>
- <MapId>sheboygan</MapId>
- </MapWidget>
-
<!-- OVERVIEW MAP -->
<Widget xsi:type="WidgetType">
@@ -1029,8 +1037,18 @@
<Disabled/>
</Widget>
- </WidgetSet>
+ <Widget xsi:type="WidgetType">
+ <Name>MapTip</Name>
+ <Type>Maptip</Type>
+ <Extension>
+ <Label>Map Tips</Label>
+ <Delay>350</Delay>
+ <Layer>Parcels</Layer>
+ </Extension>
+ </Widget>
+ </WidgetSet>
+
<Extension/>
</ApplicationDefinition>
Added: branches/fusion-1.0/templates/mapguide/standard/images/dialog_bg.png
===================================================================
(Binary files differ)
Property changes on: branches/fusion-1.0/templates/mapguide/standard/images/dialog_bg.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_b.png
===================================================================
(Binary files differ)
Property changes on: branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_b.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_bl.png
===================================================================
(Binary files differ)
Property changes on: branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_bl.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_br.png
===================================================================
(Binary files differ)
Property changes on: branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_br.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_l.png
===================================================================
(Binary files differ)
Property changes on: branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_l.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_r.png
===================================================================
(Binary files differ)
Property changes on: branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_r.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_t.png
===================================================================
(Binary files differ)
Property changes on: branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_t.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_tl.png
===================================================================
(Binary files differ)
Property changes on: branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_tl.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_tr.png
===================================================================
(Binary files differ)
Property changes on: branches/fusion-1.0/templates/mapguide/standard/images/dialog_glow_tr.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/fusion-1.0/templates/mapguide/standard/images/dialog_resize.png
===================================================================
(Binary files differ)
Property changes on: branches/fusion-1.0/templates/mapguide/standard/images/dialog_resize.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: branches/fusion-1.0/templates/mapguide/standard/images/icon_close.png
===================================================================
(Binary files differ)
Property changes on: branches/fusion-1.0/templates/mapguide/standard/images/icon_close.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: branches/fusion-1.0/templates/mapguide/standard/index.html
===================================================================
--- branches/fusion-1.0/templates/mapguide/standard/index.html 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/templates/mapguide/standard/index.html 2008-05-08 15:34:30 UTC (rev 1396)
@@ -14,6 +14,10 @@
background-color: #999;
cursor: 'col-resize';
}
+
+ body {
+ overflow: hidden;
+ }
#Toolbar .jxToolbar {
/*width: 100%;*/
@@ -128,6 +132,8 @@
<div id="TaskPane"></div>
<div id="Statusbar"></div>
+ <div id="MapTip"></div>
+ <div id="RadiusTip"></div>
<div id="PoweredBy" class="statusBarItem">
<a href="http://mapserver.gis.umn.edu.org/" target="_blank">
<img src="images/PoweredBy_MapServer.gif" width="137" height="18" border="0">
Modified: branches/fusion-1.0/widgets/BufferPanel/Buffer.php
===================================================================
--- branches/fusion-1.0/widgets/BufferPanel/Buffer.php 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/widgets/BufferPanel/Buffer.php 2008-05-08 15:34:30 UTC (rev 1396)
@@ -282,9 +282,8 @@
}
}
while($features->ReadNext());
-
- $features->Close();
}
+ $features->Close();
}
if($merge)
Modified: branches/fusion-1.0/widgets/CenterSelection.js
===================================================================
--- branches/fusion-1.0/widgets/CenterSelection.js 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/widgets/CenterSelection.js 2008-05-08 15:34:30 UTC (rev 1396)
@@ -61,12 +61,13 @@
* @param selection the active selection, or null if there is none
*/
centerSelection : function(selection) {
- var extents = this.getMap().getCurrentExtents();
+ var map = this.getMap();
+ var extents = map.getCurrentExtents();
var curWidth = extents[2] - extents[0];
var curHeight = extents[3] - extents[1];
- var ll = selection.getLowerLeftCoord();
- var ur = selection.getUpperRightCoord();
+ var ll = selection[map.getMapName()].getLowerLeftCoord();
+ var ur = selection[map.getMapName()].getUpperRightCoord();
var newWidth = ur.x - ll.x;
var newHeight = ur.y - ll.y;
@@ -74,14 +75,14 @@
if (newWidth < curWidth && newHeight < curHeight) {
var cx = (ur.x + ll.x) / 2;
var cy = (ur.y + ll.y) / 2;
- this.getMap().zoom(cx,cy,1);
+ map.zoom(cx,cy,1);
} else {
var buffer = 0.1;
var minx = ll.x-newWidth*buffer;
var miny = ll.y-newHeight*buffer;
var maxx = ur.x+newWidth*buffer;
var maxy = ur.y+newHeight*buffer;
- this.getMap().setExtents(new OpenLayers.Bounds(minx,miny,maxx,maxy));
+ map.setExtents(new OpenLayers.Bounds(minx,miny,maxx,maxy));
}
},
Modified: branches/fusion-1.0/widgets/CursorPosition.js
===================================================================
--- branches/fusion-1.0/widgets/CursorPosition.js 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/widgets/CursorPosition.js 2008-05-08 15:34:30 UTC (rev 1396)
@@ -111,8 +111,9 @@
p = map.pixToGeo(p.x, p.y);
if (p) {
if (this.units != Fusion.UNKNOWN) {
- p.x = Fusion.fromMeter(this.units, p.x * map._fMetersperunit);
- p.y = Fusion.fromMeter(this.units, p.y * map._fMetersperunit);
+ var convFactor = map.getMetersPerUnit();
+ p.x = Fusion.fromMeter(this.units, p.x * convFactor);
+ p.y = Fusion.fromMeter(this.units, p.y * convFactor);
}
if (this.precision >= 0) {
var factor = Math.pow(10,this.precision);
@@ -123,7 +124,6 @@
}
if (p) {
var unitAbbr = Fusion.unitAbbr(this.units);
-
this.domSpan.innerHTML = this.template.replace('{x}',p.x).replace('{y}',p.y).replace('{units}', unitAbbr).replace('{units}', unitAbbr);
}
},
Modified: branches/fusion-1.0/widgets/MapMenu.js
===================================================================
--- branches/fusion-1.0/widgets/MapMenu.js 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/widgets/MapMenu.js 2008-05-08 15:34:30 UTC (rev 1396)
@@ -36,6 +36,7 @@
{
domObj: null,
oMenu: null,
+ mapGroupData: null,
sRootFolder: '',
aMenus : null,
initialize : function(widgetTag)
@@ -46,15 +47,26 @@
this.enable();
var json = widgetTag.extension;
+
+ //If no folder is specified for enumeration, build a menu
+ //from the mapgroup alone. Folders are only supported with MapGuide.
+ //Otherwise, create a hash of mapgroup resourceId to mapGroup data
+ //to be used to assign mapgroup extensions to enumerated maps.
+
var mapGroups = Fusion.applicationDefinition.mapGroups;
+ this.mapGroupData = {};
for (var i=0; i<mapGroups.length; i++) {
var mapGroup = mapGroups[i];
- var opt = {};
- opt.label = mapGroup.mapId;
- var data = mapGroup;
- var action = new Jx.Action(this.switchMap.bind(this, data));
- var menuItem = new Jx.MenuItem(action,opt);
- this.oMenu.add(menuItem);
+ if (json.Folder) {
+ this.mapGroupData[mapGroup.maps[0].resourceId] = mapGroup;
+ } else {
+ var opt = {};
+ opt.label = mapGroup.mapId;
+ var data = mapGroup;
+ var action = new Jx.Action(this.switchMap.bind(this, data));
+ var menuItem = new Jx.MenuItem(action,opt);
+ this.oMenu.add(menuItem);
+ }
}
//get the mapdefinitions as xml if there is a folder specified
@@ -82,17 +94,32 @@
var sId = mapNode.getNodeText('ResourceId');
var sPath = sId.replace(this.sRootFolder, '');
- sPath = sPath.slice(0, sPath.lastIndexOf('/'));
- this.createFolders(sPath);
+ if (sPath.lastIndexOf('/') > -1) {
+ sPath = sPath.slice(0, sPath.lastIndexOf('/'));
+ this.createFolders(sPath);
+ } else {
+ sPath = '';
+ }
var opt = {};
opt.label = mapNode.getNodeText('Name');
+
+ // check for mapgroup data and if there is none,
// create a maptag that will be passed to the map
- // widget constructor
- var data = {maps:[{'resourceId':mapNode.getNodeText('ResourceId'),
+ // widget constructor
+ var data = null;
+ if (this.mapGroupData[mapNode.getNodeText('ResourceId')]) {
+ data = this.mapGroupData[mapNode.getNodeText('ResourceId')];
+ } else {
+ data = {maps:[{'resourceId':mapNode.getNodeText('ResourceId'),
'singleTile':true,
'type': this.arch,
'extension':{'ResourceId': [mapNode.getNodeText('ResourceId')]}
}]};
+ //set up needed accessor
+ data.getInitialView = function() {
+ return this.initialView;
+ };
+ }
var action = new Jx.Action(this.switchMap.bind(this, data));
var menuItem = new Jx.MenuItem(action,opt);
@@ -133,7 +160,14 @@
this.oMenu.show();
},
+ //change the map, preserving current extents
switchMap: function(data) {
+ var ce = this.getMap().getCurrentExtents();
+ data.initialView = {minX:ce.left,
+ minY:ce.bottom,
+ maxX:ce.right,
+ maxY:ce.top
+ };
this.getMap().loadMapGroup(data);
}
};
\ No newline at end of file
Modified: branches/fusion-1.0/widgets/Maptip.js
===================================================================
--- branches/fusion-1.0/widgets/Maptip.js 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/widgets/Maptip.js 2008-05-08 15:34:30 UTC (rev 1396)
@@ -157,15 +157,17 @@
var maxFeatures = 1;
var persist = 0;
var selection = 'INTERSECTS';
+ // only select visible layers with maptips defined (1+4)
+ var layerAttributeFilter = 5;
var maps = this.getMap().getAllMaps();
//TODO: possibly make the layer names configurable?
var layerNames = this.aLayers.toString();
var r = new Fusion.Lib.MGRequest.MGQueryMapFeatures(maps[0].getSessionID(),
maps[0]._sMapname,
sGeometry,
- maxFeatures, persist, selection, layerNames);
- oBroker.dispatchRequest(r,
- this._display.bind(this));
+ maxFeatures, persist, selection, layerNames,
+ layerAttributeFilter);
+ oBroker.dispatchRequest(r, this._display.bind(this));
},
_display: function(r) {
@@ -229,7 +231,7 @@
//console.log('maptip _hide');
this.hideTimer = null;
this.domObj.style.display = 'none';
- this.oMapTipPosition = null;
+ //this.oMapTipPosition = null;
},
mouseOverTip: function() {
Modified: branches/fusion-1.0/widgets/Measure.js
===================================================================
--- branches/fusion-1.0/widgets/Measure.js 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/widgets/Measure.js 2008-05-08 15:34:30 UTC (rev 1396)
@@ -84,7 +84,6 @@
this.asCursor = ['crosshair'];
var json = widgetTag.extension;
this.units = (json.Units && (json.Units[0] != '')) ? Fusion.unitFromName(json.Units[0]): this.units;
-
this.distPrecision = json.DistancePrecision ? parseInt(json.DistancePrecision[0]) : 4;
this.areaPrecision = json.AreaPrecision ? parseInt(json.AreaPrecision[0]) : 4;
@@ -397,7 +396,7 @@
//var mapUnits = Fusion.unitFromName(this.getMap().getUnits());
//if (mapUnits == Fusion.DEGREES || Fusion.DECIMALDEGREES)
mapUnits = Fusion.METERS;
-
+
if (mapUnits != this.units) {
o.distance = Fusion.convert(mapUnits, this.units, o.distance);
}
@@ -415,11 +414,11 @@
updateDisplay: function(outputWin) {
var outputDoc = outputWin.document;
var tbody = outputDoc.getElementById('segmentTBody');
+ var value;
if (tbody) {
this.clearDisplay(outputWin);
var totalDistance = 0;
var units = Fusion.unitAbbr(this.units);
- var value;
for (var i=0; i<this.distanceMarkers.length; i++) {
var distance = this.distanceMarkers[i].getDistance();
totalDistance += distance;
@@ -500,6 +499,7 @@
},
setParameter: function(param, value) {
+ //console.log('setParameter: ' + param + ' = ' + value);
if (param == 'Units') {
this.units = Fusion.unitFromName(value);
for (var i=0; i<this.distanceMarkers.length; i++) {
@@ -557,7 +557,7 @@
value = this.distance.toPrecision(this.precision);
}
- return this.label + ' ' + value + ' ' + this.unitAbbr;
+ return this.label + ' ' + value + ' ' + this.unitAbbr;
},
setDistance: function(distance) {
Modified: branches/fusion-1.0/widgets/Print/printablepage.templ
===================================================================
--- branches/fusion-1.0/widgets/Print/printablepage.templ 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/widgets/Print/printablepage.templ 2008-05-08 15:34:30 UTC (rev 1396)
@@ -15,6 +15,7 @@
var msie = agent.indexOf("msie") != -1;
var safari = agent.indexOf("safari") != -1;
var firefox = agent.indexOf("firefox") != -1;
+ var clientAgent = "Fusion Viewer";
var webAgent = '%s';
var scale = %s;
@@ -38,7 +39,7 @@
{
var legendElt = document.getElementById("Legend");
legendElt.style.width = "180px";
- legendElt.innerHTML = "<img id=\"legendImage\" width=\"180\" height=\"" + mapHeight + "\" src=\"" + webAgent + "?OPERATION=GETMAPLEGENDIMAGE&VERSION=1.0.0&MAPNAME=" + encodeURIComponent(mapName) + "&SESSION=" + sessionId + "&WIDTH=180&HEIGHT=" + mapHeight + "&FORMAT=PNG\" style=\"visibility: hidden\" onload=\"OnImageLoaded('legendImage');\">";
+ legendElt.innerHTML = "<img id=\"legendImage\" width=\"180\" height=\"" + mapHeight + "\" src=\"" + webAgent + "?OPERATION=GETMAPLEGENDIMAGE&VERSION=1.0.0&MAPNAME=" + encodeURIComponent(mapName) + "&SESSION=" + sessionId + "&CLIENTAGENT=" + encodeURIComponent(clientAgent) + "&WIDTH=180&HEIGHT=" + mapHeight + "&FORMAT=PNG\" style=\"visibility: hidden\" onload=\"OnImageLoaded('legendImage');\">";
}
else
mapWidth += 180;
@@ -49,7 +50,7 @@
document.getElementById("ScaleAndArrow").style.height = "0px";
}
- var imgReq = webAgent + "?OPERATION=GETMAPIMAGE&VERSION=1.0.0&FORMAT=PNG&LOCALE="+locale+"&MAPNAME=" + encodeURIComponent(mapName) + "&SESSION=" + sessionId + "&SETDISPLAYWIDTH=" + mapWidth + "&SETDISPLAYHEIGHT=" + mapHeight + "&SETDISPLAYDPI=" + dpi + "&SETVIEWSCALE=" + scale + "&SETVIEWCENTERX=" + centerX + "&SETVIEWCENTERY=" + centerY + "&SEQ=" + Math.random();
+ var imgReq = webAgent + "?OPERATION=GETMAPIMAGE&VERSION=1.0.0&FORMAT=PNG&LOCALE="+locale+"&MAPNAME=" + encodeURIComponent(mapName) + "&SESSION=" + sessionId + "&SETDISPLAYWIDTH=" + mapWidth + "&SETDISPLAYHEIGHT=" + mapHeight + "&SETDISPLAYDPI=" + dpi + "&SETVIEWSCALE=" + scale + "&SETVIEWCENTERX=" + centerX + "&SETVIEWCENTERY=" + centerY + "&SEQ=" + Math.random() + "&CLIENTAGENT=" + encodeURIComponent(clientAgent);
var mapElt = document.getElementById("Map");
mapElt.style.width = mapWidth + "px";
Modified: branches/fusion-1.0/widgets/SaveMap.js
===================================================================
--- branches/fusion-1.0/widgets/SaveMap.js 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/widgets/SaveMap.js 2008-05-08 15:34:30 UTC (rev 1396)
@@ -43,26 +43,67 @@
iframe : null,
printLayout : null,
printScale : null,
+ imageWidth : null,
+ imageHeight : null,
initialize : function(widgetTag) {
Object.inheritFrom(this, Fusion.Widget.prototype, [widgetTag, false]);
- Object.inheritFrom(this, Fusion.Tool.ButtonBase.prototype, []);
var json = widgetTag.extension;
this.format = (json.Format && json.Format[0] != '')?
json.Format[0] : 'png';
//for DWF, parse printLayouts and build menu
- if (this.format == 'DWF') {
- if (json.ResourceId) {
- this.printLayout = json.ResourceId[0];
- if (json.Scale) {
- this.printScale = json.Scale[0];
- }
- } else {
- //TODO: Warning that the widget is improperly configured
- //because we need print layout for this to work.
- //TODO: deactivate the widget?
+ if (this.format == 'DWF' && json.PrintLayout.length) {
+ Object.inheritFrom(this, Fusion.Tool.MenuBase.prototype, []);
+
+ var layouts = json.PrintLayout;
+ for (var i = 0; i < layouts.length; i++) {
+ var layout = layouts[i];
+ var opt = {};
+ opt.label = layout.Name[0];
+ var data = {rid:layout.ResourceId[0]};
+ if (layout.PageHeight) {
+ data.pageHeight = layout.PageHeight[0];
+ };
+ if (layout.PageWidth) {
+ data.pageWidth = layout.PageWidth[0];
+ };
+ if (layout.Margins) {
+ data.margins = [layout.Margins[0].Top[0],
+ layout.Margins[0].Left[0],
+ layout.Margins[0].Right[0],
+ layout.Margins[0].Bottom[0]];
+ };
+ var menuItem = null;
+ if (layout.Scale) {
+ //create entries for weblayout specified scales
+ menuItem = new Jx.SubMenu(opt);
+ for (var j=0; j < layout.Scale.length; j++) {
+ data.scale = layout.Scale[j];
+ var scaleAction = new Jx.Action(this.setLayout.bind(this, data));
+ var subMenuItem = new Jx.MenuItem(scaleAction,{label:data.scale});
+ menuItem.add(subMenuItem);
+ }
+ //add an entry for current scale
+ var currentScaleAction = new Jx.Action(this.setLayout.bind(this, data));
+ var currentScaleItem = new Jx.MenuItem(currentScaleAction,
+ {label:'Current Scale'});
+ menuItem.add(currentScaleItem);
+ } else {
+ //if there are no scales, the layout is used with current scale
+ var action = new Jx.Action(this.setLayout.bind(this, data));
+ menuItem = new Jx.MenuItem(action,opt);
+ };
+ this.oMenu.add(menuItem);
}
+ } else {
+ Object.inheritFrom(this, Fusion.Tool.ButtonBase.prototype, []);
+ if (json.Width && json.Width[0] != '') {
+ this.imageWidth = json.Width[0];
+ }
+ if (json.Height && json.Height[0] != '') {
+ this.imageHeight = json.Height[0];
+ }
}
this.enable = Fusion.Widget.SaveMap.prototype.enable;
@@ -72,6 +113,16 @@
Fusion.Tool.ButtonBase.prototype.enable.apply(this, []);
},
+ setLayout: function(data) {
+ this.printScale = data.scale;
+ this.printLayout = data.rid;
+ this.pageHeight = data.pageHeight;
+ this.pageWidth = data.pageWidth;
+ this.pageMargins = data.margins;
+
+ this.activateTool();
+ },
+
/**
* called when the button is clicked by the Fusion.Tool.ButtonBase widget
* prompts user to save the map.
@@ -85,28 +136,43 @@
}
var szLayout = '';
var szScale = '';
+ var szPageHeight = '';
+ var szPageWidth = '';
+ var szPageMargins = '';
if (this.format === 'DWF') {
if (this.printLayout) {
szLayout = '&layout=' + this.printLayout;
} else {
- //TODO: issue an error?
+ alert('DWF Save is not properly configured.');
return;
}
if (this.printScale) {
szScale = '&scale=' + this.printScale;
+ }
+ if (this.pageHeight) {
+ szPageHeight = '&pageheight=' + this.pageHeight;
}
+ if (this.pageWidth) {
+ szPageWidth = '&pagewidth=' + this.pageWidth;
+ }
+ if (this.pageMargins) {
+ szPageMargins = '&margins=' + this.pageMargins.join(',');
+ }
}
- //TODO: revisit Fusion.getWebAgentURL
- var m = this.getMap().aMaps[0];
+ var szHeight = '';
+ if (this.imageHeight) {
+ szHeight = '&height=' + this.imageHeight;
+ }
+ var szWidth = '';
+ if (this.imageWidth) {
+ szWidth = '&width=' + this.imageWidth;
+ }
+ var m = this.getMap().aMaps[0];
if(navigator.appVersion.match(/\bMSIE\b/)) {
- //var url = Fusion.getWebAgentURL() + "OPERATION=GETDYNAMICMAPOVERLAYIMAGE&FORMAT=PNG&VERSION=1.0.0&SESSION=" + this.getMap().getSessionID() + "&MAPNAME=" + this.getMap().getMapName() + "&SEQ=" + Math.random();
-
- var url = Fusion.fusionURL + '/' + m.arch + '/' + Fusion.getScriptLanguage() + "/SaveMapFrame." + Fusion.getScriptLanguage() + '?session='+m.getSessionID() + '&mapname=' + m.getMapName() + '&format=' + this.format + szLayout;
- //this.iframe.src = url;
+ var url = Fusion.fusionURL + '/' + m.arch + '/' + Fusion.getScriptLanguage() + "/SaveMapFrame." + Fusion.getScriptLanguage() + '?session='+m.getSessionID() + '&mapname=' + m.getMapName() + '&format=' + this.format + szLayout + szWidth + szHeight + szPageHeight + szPageWidth + szPageMargins;
w = open(url, "Save", 'menubar=no,height=200,width=300');
} else {
- var s = Fusion.fusionURL + '/' + m.arch + '/' + Fusion.getScriptLanguage() + "/SaveMap." + Fusion.getScriptLanguage() + '?session='+m.getSessionID() + '&mapname=' + m.getMapName() + '&format=' + this.format + szLayout;
- //console.log(s);
+ var s = Fusion.fusionURL + '/' + m.arch + '/' + Fusion.getScriptLanguage() + "/SaveMap." + Fusion.getScriptLanguage() + '?session='+m.getSessionID() + '&mapname=' + m.getMapName() + '&format=' + this.format + szLayout + szWidth + szHeight + szPageHeight + szPageWidth + szPageMargins;
this.iframe.src = s;
}
Modified: branches/fusion-1.0/widgets/Search/Search.php
===================================================================
--- branches/fusion-1.0/widgets/Search/Search.php 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/widgets/Search/Search.php 2008-05-08 15:34:30 UTC (rev 1396)
@@ -228,10 +228,20 @@
}
catch(MgException $ae)
{
+ if($features)
+ {
+ // Close the feature reader
+ $features->Close();
+ }
OnError($searchError, $ae->GetDetails());
}
catch(SearchError $e)
{
+ if($features)
+ {
+ // Close the feature reader
+ $features->Close();
+ }
OnError($e->title, $e->getMessage());
}
Modified: branches/fusion-1.0/widgets/SelectRadiusValue.js
===================================================================
--- branches/fusion-1.0/widgets/SelectRadiusValue.js 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/widgets/SelectRadiusValue.js 2008-05-08 15:34:30 UTC (rev 1396)
@@ -47,15 +47,16 @@
this.label = json.Label ? json.Label[0] : '';
this.className = json.ClassName ? json.ClassName[0] : '';
- /* a container for the widget */
- //this.domObj = document.createElement('div');
- //this.domObj.className = this.className;
-
+ this.getMap().registerForEvent(Fusion.Event.MAP_LOADED, this.mapLoaded.bind(this));
+ this.getMap().registerForEvent(Fusion.Event.MAP_EXTENTS_CHANGED, this.mapExtentsChanged.bind(this));
+ },
+
+ draw: function() {
/* put in the label */
+ var units = this.getMap().getAllMaps()[0].units;
this.domLabel = document.createElement('label');
this.domLabel.className = this.className;
- this.domLabel.innerHTML = this.label;
- //this.domObj.appendChild(label);
+ this.domLabel.innerHTML = this.label + '(' + units + ')';
/* put in the input */
this.input = document.createElement('input');
@@ -65,21 +66,32 @@
/* put into page */
this.domObj.appendChild(this.domLabel);
Event.observe(this.input, 'blur', this.onBlur.bind(this));
- this.getMap().registerForEvent(Fusion.Event.MAP_LOADED, this.mapLoaded.bind(this));
- this.getMap().registerForEvent(Fusion.Event.MAP_EXTENTS_CHANGED, this.mapExtentsChanged.bind(this));
-
},
mapLoaded: function() {
+ this.draw();
+ this.input.disabled = true;
var widgets = Fusion.getWidgetsByType('SelectRadius');
for (var i=0; i<widgets.length; i++) {
- if (widgets[i].sName == this.radiusWidgetName) {
+ if (widgets[i].widgetTag.name == this.radiusWidgetName) {
this.widget = widgets[i];
+ this.widget.registerForEvent(Fusion.Event.RADIUS_WIDGET_ACTIVATED, this.dependantEnable.bind(this));
+ break;
}
}
this.updateFromWidgetValue();
},
+ dependantEnable: function(eventId, active) {
+ if (this.widget) {
+ if (active) {
+ this.input.disabled = false;
+ } else {
+ this.input.disabled = true;
+ }
+ }
+ },
+
mapExtentsChanged: function() {
this.updateWidgetValue();
},
@@ -90,14 +102,14 @@
updateWidgetValue: function() {
if (this.widget) {
- var radius = this.getMap().geoToPixMeasure(this.input.getValue());
+ var radius = this.input.getValue();
this.widget.setRadius(radius);
}
},
updateFromWidgetValue: function() {
if (this.widget) {
- this.input.value = this.getMap().pixToGeoMeasure(this.widget.getRadius());
+ this.input.value = this.widget.getRadius();
}
}
};
\ No newline at end of file
Modified: branches/fusion-1.0/widgets/SelectWithin/SelectWithin.php
===================================================================
--- branches/fusion-1.0/widgets/SelectWithin/SelectWithin.php 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/widgets/SelectWithin/SelectWithin.php 2008-05-08 15:34:30 UTC (rev 1396)
@@ -173,6 +173,7 @@
}
$geomColl->Add($geom);
}
+ $features->Close();
}
}
if($geomColl->GetCount() == 0)
Modified: branches/fusion-1.0/widgets/SelectWithin/SelectWithinPanel.templ
===================================================================
--- branches/fusion-1.0/widgets/SelectWithin/SelectWithinPanel.templ 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/widgets/SelectWithin/SelectWithinPanel.templ 2008-05-08 15:34:30 UTC (rev 1396)
@@ -40,6 +40,7 @@
var webAgent = '%s';
var mapName = '%s';
var sessionId = '%s';
+var zoomTo = false;
function InitDocument()
{
@@ -83,11 +84,25 @@
var mapWidget = GetParent().Fusion.getMapByName(mapName);
var map = mapWidget.aMaps[0];
- var params = "mapname=" + encodeURIComponent(mapName) + "&session=" + sessionId + "&layers=" + encodeURIComponent(layerSet);
- var options = {onSuccess: map.processQueryResults.bind(map), onFailure: selectedError, parameters:params};
+ var params = {
+ "mapname": encodeURIComponent(mapName),
+ "session": sessionId,
+ "layers": encodeURIComponent(layerSet)
+ };
+ var options = {
+ onSuccess: selectedSuccess,
+ onFailure: selectedError,
+ parameters:params
+ };
GetParent().Fusion.ajaxRequest(webAgent, options);
}
+function selectedSuccess(r) {
+ var mapWidget = GetParent().Fusion.getMapByName(mapName);
+ var map = mapWidget.aMaps[0];
+ map.processQueryResults(zoomTo, r);
+}
+
function selectedError(r) {
alert(r.responseText);
}
Modified: branches/fusion-1.0/widgets/ViewSize.js
===================================================================
--- branches/fusion-1.0/widgets/ViewSize.js 2008-05-07 18:38:38 UTC (rev 1395)
+++ branches/fusion-1.0/widgets/ViewSize.js 2008-05-08 15:34:30 UTC (rev 1396)
@@ -67,8 +67,9 @@
var gw = map.pixToGeoMeasure(p.w);
var gh = map.pixToGeoMeasure(p.h);
if (this.units != Fusion.UNKNOWN) {
- gw = Fusion.fromMeter(this.units, gw * map._fMetersperunit);
- gh = Fusion.fromMeter(this.units, gh * map._fMetersperunit);
+ var convFactor = map.getMetersPerUnit();
+ gw = Fusion.fromMeter(this.units, gw * convFactor);
+ gh = Fusion.fromMeter(this.units, gh * convFactor);
}
if (this.precision >= 0) {
var factor = Math.pow(10,this.precision);
More information about the fusion-commits
mailing list