[Commits] r2628 - in sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing: examples lib/GeoExt.ux/widgets

commits at geoext.org commits at geoext.org
Mon Mar 21 21:14:50 CET 2011


Author: adube
Date: 2011-03-21 21:14:50 +0100 (Mon, 21 Mar 2011)
New Revision: 2628

Modified:
   sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/examples/WFSTFeatureEditing.js
   sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets/WFSTFeatureEditingManager.js
   sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets/WFSTFeatureEditingPanel.js
   sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets/WFSTFeatureEditingStatusBar.js
Log:
WFSTFeatureEditing - WFSCapabilitiesStore added, layers added to map

Modified: sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/examples/WFSTFeatureEditing.js
===================================================================
--- sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/examples/WFSTFeatureEditing.js	2011-03-21 18:34:34 UTC (rev 2627)
+++ sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/examples/WFSTFeatureEditing.js	2011-03-21 20:14:50 UTC (rev 2628)
@@ -1,8 +1,10 @@
-var manager, mapPanel, tree, toolbar;
+var manager, mapPanel, tree, toolbar, url;
 
 Ext.onReady(function() {
     Ext.QuickTips.init();
 
+    url = "http://dev8.mapgears.com/cgi-bin/tinyows-trunk";
+
     var actions = [];
     var action = new Ext.Action({
       text: 'Dummy',
@@ -50,4 +52,10 @@
     });
 
     map.setCenter(new OpenLayers.LonLat(-10762333.581055,5968203.1676758), 2);
+
+    manager = new GeoExt.ux.WFSTFeatureEditingManager({
+        'map': mapPanel.map,
+        'toolbar': toolbar,
+        'url': url
+    });
 });

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-03-21 18:34:34 UTC (rev 2627)
+++ sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets/WFSTFeatureEditingManager.js	2011-03-21 20:14:50 UTC (rev 2628)
@@ -0,0 +1,111 @@
+Ext.namespace("GeoExt.ux");
+
+GeoExt.ux.WFSTFeatureEditingManager = Ext.extend(Ext.util.Observable, {
+
+/* CONSTANT */
+
+    DEFAULT_CAPABILITIES_PARAMS: {
+        'SERVICE': "WFS",
+        'REQUEST': "GetCapabilities",
+        'VERSION': "1.0.0"
+    },
+
+    DEFAULT_PROTOCOL_OPTIONS: {
+        featureNS: "http://localhost"
+    },
+
+/* API */
+
+    toolbar: null,
+
+    url: null,
+
+    map: null,
+
+    capabilitiesParams: null,
+
+    protocolOptions: null,
+
+
+/* PRIVATE*/
+
+    mainPanel: null,
+
+    statusBar: null,
+
+    /** private: method[constructor]
+     *  Private constructor override.
+     */
+    constructor: function(config) {
+        Ext.apply(this, config);
+        arguments.callee.superclass.constructor.call(this, config);
+        this.initMainTools();
+        this.url && this.createToolsFromURL(this.url);
+    },
+
+    initMainTools: function() {
+        
+    },
+
+    createToolsFromURL: function(url) {
+        var wfsCapURL = Ext.urlAppend(url, Ext.urlEncode(Ext.applyIf(
+            this.capabilitiesParams || {}, this.DEFAULT_CAPABILITIES_PARAMS
+        )));
+
+        var wfsCapStore = new GeoExt.data.WFSCapabilitiesStore( {
+            url: wfsCapURL,
+            listeners: {
+                load: {
+                    fn: this.onWFSCapabilitiesStoreLoad,
+                    scope: this
+                }
+            },
+            protocolOptions: Ext.applyIf(
+                this.protocolOptions || {}, this.DEFAULT_PROTOCOL_OPTIONS),
+            layerOptions: {
+                // todo: delegate to WFSCapabilitiesReader
+                projection: new OpenLayers.Projection(this.map.getProjection()),
+                visibility: false,
+                //displayInLayerSwitcher: false,
+                //minScale: 250000
+            }
+        });
+    
+        wfsCapStore.load();
+    },
+
+    onWFSCapabilitiesStoreLoad: function(store, records, options) {
+        var layers = [];
+        Ext.each(records, function(record, index) {
+            var layer = record.getLayer().clone();
+            // todo : create SaveStrategy in WFSCapabilitiesReader
+            // find the save strategy and keep a reference to it
+/*
+            Ext.each(layer.strategies, function(strategy, strategyIndex) {
+                if (strategy instanceof OpenLayers.Strategy.Save) {
+                    layer.saveStrategy = strategy;
+                    strategy.events.on({
+                        "success": onCommitSuccess,
+                        "fail": onCommitFail,
+                        scope: strategy
+                    });
+                    return false;
+                }
+            });
+*/
+            layers.push(layer);
+        });
+        this.map.addLayers( layers.reverse() );
+/*
+        Ext.each(layers, function(layer, index) {
+            OpenLayers.loadURL(layer.protocol.url, {
+                'SERVICE': "WFS",
+                'REQUEST': "DescribeFeatureType",
+                'VERSION': "1.0.0",
+                'TYPENAME': layer.protocol.featureType
+            }, layer, wfsDFTSuccess, wfsDFTFailure
+            );
+        });
+*/
+    }
+});

Modified: sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets/WFSTFeatureEditingPanel.js
===================================================================
--- sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets/WFSTFeatureEditingPanel.js	2011-03-21 18:34:34 UTC (rev 2627)
+++ sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets/WFSTFeatureEditingPanel.js	2011-03-21 20:14:50 UTC (rev 2628)
@@ -0,0 +1,8 @@
+Ext.namespace("GeoExt.ux");
+
+GeoExt.ux.WFSTFeatureEditingPanel = Ext.extend(Ext.Panel, {
+    constructor: function(config) {
+        Ext.apply(this, config);
+        arguments.callee.superclass.constructor.call(this, config);
+    }
+});

Modified: sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets/WFSTFeatureEditingStatusBar.js
===================================================================
--- sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets/WFSTFeatureEditingStatusBar.js	2011-03-21 18:34:34 UTC (rev 2627)
+++ sandbox/mapgears/geoext.ux/ux/WFSTFeatureEditing/lib/GeoExt.ux/widgets/WFSTFeatureEditingStatusBar.js	2011-03-21 20:14:50 UTC (rev 2628)
@@ -0,0 +1,17 @@
+Ext.namespace("GeoExt.ux");
+
+if (Ext.ux.StatusBar) {
+
+    /** api: constructor
+     *  .. class:: WFSTFeatureEditingStatusBar
+     */
+    GeoExt.ux.WFSTFeatureEditingStatusBar = Ext.extend(Ext.ux.StatusBar, {
+
+        /** private: method[constructor]
+         */
+        constructor: function(config) {
+            Ext.apply(this, config);
+            arguments.callee.superclass.constructor.call(this, config);
+        }
+    });
+}



More information about the Commits mailing list