[fusion-commits] r1416 - in branches/fusion-1.0: lib widgets
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Wed Jun 4 09:54:14 EDT 2008
Author: madair
Date: 2008-06-04 09:54:14 -0400 (Wed, 04 Jun 2008)
New Revision: 1416
Modified:
branches/fusion-1.0/lib/Map.js
branches/fusion-1.0/widgets/ViewOptions.js
Log:
closes #73: move init of viewOptions into Map object
Modified: branches/fusion-1.0/lib/Map.js
===================================================================
--- branches/fusion-1.0/lib/Map.js 2008-06-03 17:23:42 UTC (rev 1415)
+++ branches/fusion-1.0/lib/Map.js 2008-06-04 13:54:14 UTC (rev 1416)
@@ -140,6 +140,8 @@
this.registerEventID(Fusion.Event.MAP_SELECTION_ON);
this.registerEventID(Fusion.Event.MAP_SELECTION_OFF);
+ this.registerForEvent(Fusion.Event.MAP_LOADED, this.mapLoaded.bind(this));
+
//register for OL map extent change events
this.oMapOL.events.register('moveend', this, this.mapExtentsChanged);
@@ -150,6 +152,10 @@
this.bFetchingSelection = false;
},
+ mapLoaded: function() {
+ this.setViewOptions(this.getUnits());
+ },
+
setMenu: function() {
if (this.widgetTag.extension.MenuContainer) {
var contextMenu = new Jx.ContextMenu();
@@ -670,6 +676,25 @@
return this._fMetersperunit;
},
+ /**
+ *
+ * initializes all widgets with the map units after the map has loaded
+ *
+ */
+ setViewOptions: function(data) {
+ for (var i=0; i<Fusion.applicationDefinition.widgetSets.length; ++i) {
+ var widgetSet = Fusion.applicationDefinition.widgetSets[i];
+ for (var j=0; j<widgetSet.widgetInstances.length; ++j) {
+ var widget = widgetSet.widgetInstances[j];
+ for (var k=0; k<widget.paramRegister.length; ++k) {
+ if (widget.paramRegister[k] == 'Units') {
+ widget.setParameter('Units', data);
+ }
+ }
+ }
+ }
+ },
+
/**
*
* convert geographic into pixels.
Modified: branches/fusion-1.0/widgets/ViewOptions.js
===================================================================
--- branches/fusion-1.0/widgets/ViewOptions.js 2008-06-03 17:23:42 UTC (rev 1415)
+++ branches/fusion-1.0/widgets/ViewOptions.js 2008-06-04 13:54:14 UTC (rev 1416)
@@ -66,20 +66,6 @@
setMapUnits: function() {
var units = this.displayUnits ? this.displayUnits : this.getMap().getUnits();
- this.setViewOptions(units);
- },
-
- setViewOptions: function(data) {
- for (var i=0; i<Fusion.applicationDefinition.widgetSets.length; ++i) {
- var widgetSet = Fusion.applicationDefinition.widgetSets[i];
- for (var j=0; j<widgetSet.widgetInstances.length; ++j) {
- var widget = widgetSet.widgetInstances[j];
- for (var k=0; k<widget.paramRegister.length; ++k) {
- if (widget.paramRegister[k] == 'Units') {
- widget.setParameter('Units', data);
- }
- }
- }
- }
+ this.getMap().setViewOptions(units);
}
};
More information about the fusion-commits
mailing list