[Commits] r2692 - sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets

commits at geoext.org commits at geoext.org
Mon May 16 15:49:10 CEST 2011


Author: adube
Date: 2011-05-16 15:49:10 +0200 (Mon, 16 May 2011)
New Revision: 2692

Modified:
   sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets/WFSTFeatureEditingManager.js
Log:
WFSTFeatureEditing - WFSCapReader adjusted to follow newest patch in #412, layerOptions property now a 'method' that returns properties (and new objects)

Modified: sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets/WFSTFeatureEditingManager.js
===================================================================
--- sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets/WFSTFeatureEditingManager.js	2011-05-16 09:18:31 UTC (rev 2691)
+++ sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets/WFSTFeatureEditingManager.js	2011-05-16 13:49:10 UTC (rev 2692)
@@ -63,28 +63,45 @@
         featureNS: "http://localhost"
     },
 
-    /** private: property[DEFAULT_LAYER_OPTIONS]
-     *  ``Object`` Hash of options to use when creating a new
-     *             :class:`GeoExt.data.WFSCapabilitiesStore` object as the 
-     *             "layerOptions" property default values.  Used when
-     *             this.useFilter is set to false.
+    /** private: method[DEFAULT_LAYER_OPTIONS]
+     *  :return: ``Object`` The default layer options
+     *
+     *  If this.layerOptions was not defined by the user, this method is used
+     *      as a default value when not using filter mode
+     *      (this.useFilter eq false).
+     *      Used as 'layerOptions' property value when creating new 
+     *      :class:`GeoExt.data.WFSCapabilitiesStore` objects.
      */
-    DEFAULT_LAYER_OPTIONS: {
-        visibility: false,
-        displayInLayerSwitcher: false,
-        strategies: ["BBOX", "Save"]
+    DEFAULT_LAYER_OPTIONS: function() {
+        return {
+            visibility: false,
+            displayInLayerSwitcher: false,
+            projection: new OpenLayers.Projection(this.map.getProjection()),
+            strategies: [
+                new OpenLayers.Strategy.BBOX(),
+                new OpenLayers.Strategy.Save()
+            ]
+        };
     },
 
-    /** private: property[DEFAULT_LAYER_OPTIONS_USE_FILTER]
-     *  ``Object`` Hash of options to use when creating a new
-     *             :class:`GeoExt.data.WFSCapabilitiesStore` object as the 
-     *             "layerOptions" property default values.  Used when
-     *             this.useFilter is set to true.
+    /** private: method[DEFAULT_LAYER_OPTIONS_USE_FILTER]
+     *  :return: ``Object`` The default layer options when using filter mode
+     *
+     *  If this.layerOptions was not defined by the user, this method is used
+     *      as a default value when using filter mode (this.useFilter eq true).
+     *      Used as 'layerOptions' property value when creating new 
+     *      :class:`GeoExt.data.WFSCapabilitiesStore` objects.
      */
-    DEFAULT_LAYER_OPTIONS_USE_FILTER: {
-        visibility: false,
-        displayInLayerSwitcher: false,
-        strategies: ["Fixed", "Save"]
+    DEFAULT_LAYER_OPTIONS_USE_FILTER: function() {
+        return {
+            visibility: false,
+            displayInLayerSwitcher: false,
+            projection: new OpenLayers.Projection(this.map.getProjection()),
+            strategies: [
+                new OpenLayers.Strategy.Fixed(),
+                new OpenLayers.Strategy.Save()
+            ]
+        };
     },
 
     /** private: property[DEFAULT_ACTION_GROUP]
@@ -173,10 +190,13 @@
     protocolOptions: null,
 
     /** api: config[layerOptions]
-     *  ``Object`` Hash of options to use when creating a new
-     *             :class:`GeoExt.data.WFSCapabilitiesStore` object as the 
-     *             "layerOptions" property values in addition or replacement
-     *             to the ones in this.DEFAULT_LAYER_OPTIONS.
+     *  :return: ``Object`` The default layer options when using filter mode
+     *
+     *  You can set this property as a method returning layer option parameters
+     *      when creating new :class:`GeoExt.data.WFSCapabilitiesStore` objects.
+     *      If not set, one of these is used by default : 
+     *      - this.DEFAULT_LAYER_OPTIONS_USE_FILTER
+     *      - this.DEFAULT_LAYER_OPTIONS 
      */
     layerOptions: null,
 
@@ -267,6 +287,9 @@
         arguments.callee.superclass.constructor.call(this, config);
         this.queries = 0;
         this.layers = [];
+        this.layerOptions = this.layerOptions || (this.useFilter)
+            ? this.DEFAULT_LAYER_OPTIONS_USE_FILTER
+            : this.DEFAULT_LAYER_OPTIONS;
         this.addEvents(this.CUSTOM_EVENTS);
         this.initMainTools();
         this.url && this.createToolsFromURL(this.url);
@@ -343,13 +366,6 @@
             this.capabilitiesParams || {}, this.DEFAULT_CAPABILITIES_PARAMS
         )));
 
-        var layerOptions = Ext.applyIf(this.layerOptions || {}, (this.useFilter)
-                                       ? this.DEFAULT_LAYER_OPTIONS_USE_FILTER
-                                       : this.DEFAULT_LAYER_OPTIONS);
-        // todo : delegate to WFSCapabilitiesReader
-        layerOptions = Ext.applyIf(layerOptions, {
-              projection: new OpenLayers.Projection(this.map.getProjection())});
-
         var wfsCapStore = new GeoExt.data.WFSCapabilitiesStore( {
             url: wfsCapURL,
             listeners: {
@@ -360,7 +376,7 @@
             },
             protocolOptions: Ext.applyIf(
                 this.protocolOptions || {}, this.DEFAULT_PROTOCOL_OPTIONS),
-            layerOptions: layerOptions
+            layerOptions: this.layerOptions
         });
     
         wfsCapStore.load();



More information about the Commits mailing list