[fusion-commits] r2576 - in trunk: layers/MapGuide text widgets widgets/Redline widgets/Redline/classes widgets/widgetinfo
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Thu Sep 6 23:07:04 PDT 2012
Author: jng
Date: 2012-09-06 23:07:04 -0700 (Thu, 06 Sep 2012)
New Revision: 2576
Modified:
trunk/layers/MapGuide/MapGuideViewerApi.js
trunk/text/en.json
trunk/widgets/Measure.js
trunk/widgets/Redline.js
trunk/widgets/Redline/classes/markupeditor.php
trunk/widgets/Redline/editmarkup.php
trunk/widgets/SelectPolygon.js
trunk/widgets/SelectRadius.js
trunk/widgets/widgetinfo/redline.xml
Log:
This submission includes the following changes:
- #538: Use the MapMessage notification for digitization prompts where possible. The widgets affected by this include:
- Measure
- Redline
- Select Polygon
- Select Radius
- Fix/Improve the Redline widget:
- Close a dangling MgFeatureReader in markupeditor.php
- #538: Add a new extension property UseMapMessage, that indicates whether the MapMessage notification bar will be use for any digitization prompts (default: true)
- Update ClearDigitization() with a boolean parameter indicating if the underlying OpenLayers digitizer should be deactivated as well
- Call ClearDigitization() on Redline widget deactivation if available to ensure no dangling digitizers are left behind when transitioning to another widget.
Modified: trunk/layers/MapGuide/MapGuideViewerApi.js
===================================================================
--- trunk/layers/MapGuide/MapGuideViewerApi.js 2012-09-07 05:53:11 UTC (rev 2575)
+++ trunk/layers/MapGuide/MapGuideViewerApi.js 2012-09-07 06:07:04 UTC (rev 2576)
@@ -83,10 +83,12 @@
mgApiStartDigitizing('polygon', handler)
}
-function ClearDigitization() {
+function ClearDigitization(bCancelHandler) {
if (mgApiDigitizingLayer) {
mgApiDigitizingLayer.removeFeatures(mgApiDigitizingLayer.features);
}
+ if (bCancelHandler)
+ mgApiDeactivate();
}
//Theses are the Geometry classes used in the MapGuide Viewer API
@@ -192,12 +194,12 @@
window.setTimeout(mgApiDeactivate, 100);
return false;
-}
-
-function mgApiDeactivate() {
- if (mgApiActiveControl) {
- mgApiActiveControl.deactivate();
- mgApiActiveControl = null;
+}
+
+function mgApiDeactivate() {
+ if (mgApiActiveControl) {
+ mgApiActiveControl.deactivate();
+ mgApiActiveControl = null;
}
if (mgApiActiveWidget) {
//var Fusion = window.top.Fusion;
Modified: trunk/text/en.json
===================================================================
--- trunk/text/en.json 2012-09-07 05:53:11 UTC (rev 2575)
+++ trunk/text/en.json 2012-09-07 06:07:04 UTC (rev 2576)
@@ -80,5 +80,6 @@
'openStreetMap':'Open Street Map',
'openStreetMapTransportMap':'Open Street Map (TransportMap)',
'openStreetMapCycleMap':'Open Street Map (CycleMap)',
-'end': ''
+'end': '',
+'measureInProgress':'Measurement is currently in progress'
};
Modified: trunk/widgets/Measure.js
===================================================================
--- trunk/widgets/Measure.js 2012-09-07 05:53:11 UTC (rev 2575)
+++ trunk/widgets/Measure.js 2012-09-07 06:07:04 UTC (rev 2576)
@@ -448,6 +448,7 @@
activate: function() {
this.control.activate();
+ this.getMap().message.info(OpenLayers.i18n("measureInProgress"));
this.resetMeasure();
OpenLayers.Event.observe(document,"keypress",this.keyHandler);
this.loadDisplayPanel();
@@ -505,6 +506,7 @@
OpenLayers.Event.stopObserving(document, 'keypress', this.keyHandler);
this.control.deactivate();
this.control.cancel();
+ this.getMap().message.clear();
this.getMap().supressContextMenu(false);
},
Modified: trunk/widgets/Redline/classes/markupeditor.php
===================================================================
--- trunk/widgets/Redline/classes/markupeditor.php 2012-09-07 05:53:11 UTC (rev 2575)
+++ trunk/widgets/Redline/classes/markupeditor.php 2012-09-07 06:07:04 UTC (rev 2576)
@@ -44,6 +44,7 @@
$text = trim($featureReader->GetString('Text'));
$features[$id] = $text;
}
+ $featureReader->Close();
return $features;
}
Modified: trunk/widgets/Redline/editmarkup.php
===================================================================
--- trunk/widgets/Redline/editmarkup.php 2012-09-07 05:53:11 UTC (rev 2575)
+++ trunk/widgets/Redline/editmarkup.php 2012-09-07 06:07:04 UTC (rev 2576)
@@ -117,6 +117,11 @@
{
var digitizeInfo = document.getElementById("digitizeInfo");
digitizeInfo.innerHTML = text;
+ var widget = Fusion.getWidgetsByType("Redline")[0];
+ if (widget.mapMessagePrompt) {
+ var map = Fusion.getMapByName(mapName).mapWidget;
+ map.message.info(text);
+ }
}
function SubmitCommand(cmd)
@@ -167,7 +172,7 @@
textLabel = window.prompt("<?=$promptLabelLocal?>", "");
textInput.value = (textLabel != null) ? textLabel : "";
}
- ClearDigitization();
+ ClearDigitization(true);
}
function OnPointDigitized(point)
@@ -216,7 +221,7 @@
if(polygon.Count < 3)
{
// invalid polygon
- ClearDigitization();
+ ClearDigitization(true);
return;
}
@@ -271,6 +276,7 @@
function CloseEditor()
{
+ ClearDigitization(true);
var editForm = document.getElementById("editForm");
editForm.action = "markupmain.php";
Modified: trunk/widgets/Redline.js
===================================================================
--- trunk/widgets/Redline.js 2012-09-07 05:53:11 UTC (rev 2575)
+++ trunk/widgets/Redline.js 2012-09-07 06:07:04 UTC (rev 2576)
@@ -50,6 +50,9 @@
// Indicates whether to autogenerate redline layer names or to prompt the user for one.
autogenerateLayerNames: true,
+
+ // Indicates whether to use the MapMessage component to display digitization prompts
+ mapMessagePrompt: true,
initializeWidget: function(widgetTag) {
var json = widgetTag.extension;
@@ -61,6 +64,9 @@
if (json.AutogenerateLayerNames)
this.autogenerateLayerNames = (json.AutogenerateLayerNames[0] == "true");
+ if (json.UseMapMessagePrompt)
+ this.mapMessagePrompt = (json.UseMapMessagePrompt[0] == "true");
+
// register Redline specific events
this.registerEventID(Fusion.Event.REDLINE_FEATURE_ADDED);
@@ -84,8 +90,13 @@
}
},
- // desactivate the redline widget
+ // deactivate the redline widget
deactivate: function() {
+ if (this.taskPane) {
+ this.taskPane.abortActiveDigitization();
+ }
+ if (this.mapMessagePrompt)
+ this.mapWidget.message.clear(); //Clear digization prompts
}
});
@@ -136,5 +147,11 @@
}
//outputWin.parent = window;
this.taskPaneWin = outputWin;
+ },
+
+ abortActiveDigitization: function() {
+ //This function exists if MapGuideViewerApi.js was included in
+ if (this.taskPaneWin.ClearDigitization)
+ this.taskPaneWin.ClearDigitization(true);
}
});
Modified: trunk/widgets/SelectPolygon.js
===================================================================
--- trunk/widgets/SelectPolygon.js 2012-09-07 05:53:11 UTC (rev 2575)
+++ trunk/widgets/SelectPolygon.js 2012-09-07 06:07:04 UTC (rev 2576)
@@ -76,8 +76,10 @@
*/
activate: function() {
this.handler.activate();
- this.getMap().setCursor(this.asCursor);
- this.getMap().supressContextMenu(true);
+ var map = this.getMap();
+ map.message.info(OpenLayers.i18n("selectPolygonPrompt"))
+ map.setCursor(this.asCursor);
+ map.supressContextMenu(true);
},
/**
@@ -88,8 +90,10 @@
deactivate: function()
{
this.handler.deactivate();
- this.getMap().setCursor('auto');
- this.getMap().supressContextMenu(false);
+ var map = this.getMap();
+ map.message.clear();
+ map.setCursor('auto');
+ map.supressContextMenu(false);
},
/**
Modified: trunk/widgets/SelectRadius.js
===================================================================
--- trunk/widgets/SelectRadius.js 2012-09-07 05:53:11 UTC (rev 2575)
+++ trunk/widgets/SelectRadius.js 2012-09-07 06:07:04 UTC (rev 2576)
@@ -117,6 +117,7 @@
map.setCursor(this.asCursor);
/*map units for tool tip*/
this.units = map.units;
+ map.message.info(OpenLayers.i18n("selectRadiusPrompt"))
map.supressContextMenu(true);
this.triggerEvent(Fusion.Event.RADIUS_WIDGET_ACTIVATED, true);
},
@@ -128,8 +129,10 @@
**/
deactivate: function() {
this.handler.deactivate();
- this.getMap().setCursor('auto');
- this.getMap().supressContextMenu(false);
+ var map = this.getMap();
+ map.message.clear();
+ map.setCursor('auto');
+ map.supressContextMenu(false);
/*icon button*/
this.triggerEvent(Fusion.Event.RADIUS_WIDGET_ACTIVATED, false);
},
Modified: trunk/widgets/widgetinfo/redline.xml
===================================================================
--- trunk/widgets/widgetinfo/redline.xml 2012-09-07 05:53:11 UTC (rev 2575)
+++ trunk/widgets/widgetinfo/redline.xml 2012-09-07 06:07:04 UTC (rev 2576)
@@ -33,4 +33,12 @@
<DefaultValue>true</DefaultValue>
<IsMandatory>false</IsMandatory>
</Parameter>
+ <Parameter>
+ <Name>UseMapMessage</Name>
+ <Description>Indicates to use the map message bar for digitization prompts. Default is true</Description>
+ <Type>boolean</Type>
+ <Label>UseMapMessage</Label>
+ <DefaultValue>true</DefaultValue>
+ <IsMandatory>false</IsMandatory>
+ </Parameter>
</WidgetInfo>
More information about the fusion-commits
mailing list