[Commits] r1659 - in sandbox/redlining: . ux ux/RedLining ux/RedLining/examples ux/RedLining/ux ux/RedLining/ux/widgets ux/RedLining/ux/widgets/form

commits at geoext.org commits at geoext.org
Thu Jan 7 22:53:21 CET 2010


Author: adube
Date: 2010-01-07 22:53:21 +0100 (Thu, 07 Jan 2010)
New Revision: 1659

Added:
   sandbox/redlining/ux/
   sandbox/redlining/ux/RedLining/
   sandbox/redlining/ux/RedLining/build/
   sandbox/redlining/ux/RedLining/examples/
   sandbox/redlining/ux/RedLining/examples/RedLining.html
   sandbox/redlining/ux/RedLining/examples/RedLining.js
   sandbox/redlining/ux/RedLining/license.txt
   sandbox/redlining/ux/RedLining/tests/
   sandbox/redlining/ux/RedLining/todo.txt
   sandbox/redlining/ux/RedLining/ux/
   sandbox/redlining/ux/RedLining/ux/RedLining.js
   sandbox/redlining/ux/RedLining/ux/widgets/
   sandbox/redlining/ux/RedLining/ux/widgets/MainControler.js
   sandbox/redlining/ux/RedLining/ux/widgets/form/
   sandbox/redlining/ux/RedLining/ux/widgets/form/ComplexRedLiningForm.js
   sandbox/redlining/ux/RedLining/ux/widgets/form/EditFeatureForm.js
Log:
complexredliningform v0.1

Added: sandbox/redlining/ux/RedLining/examples/RedLining.html
===================================================================
--- sandbox/redlining/ux/RedLining/examples/RedLining.html	                        (rev 0)
+++ sandbox/redlining/ux/RedLining/examples/RedLining.html	2010-01-07 21:53:21 UTC (rev 1659)
@@ -0,0 +1,30 @@
+<html>
+    <head>
+        <title>Printing ux Example</title>
+
+        <script type="text/javascript" src="http://extjs.cachefly.net/ext-3.0.0/adapter/ext/ext-base.js"></script>
+        <script type="text/javascript" src="http://extjs.cachefly.net/ext-3.0.0/ext-all.js"></script>
+        <link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-3.0.0/resources/css/ext-all.css" />
+        <link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-3.0.0/examples/shared/examples.css" />
+        <script src="http://openlayers.org/api/2.8/OpenLayers.js"></script>
+        <script type="text/javascript" src="../../../trunk/geoext/lib/GeoExt.js"></script>
+        
+        <script type="text/javascript" src="../ux/RedLining.js"></script>
+        
+        <script type="text/javascript" src="RedLining.js"></script>
+        
+    </head>
+    <body>
+        <h1>RedLiningTool example</h1>
+        
+        <p></p>
+        
+        <p></p>
+        
+        <p></p>
+        
+        <p>See <a href="RedLining.js">RedLining.js</a> for the source code.</p>
+        
+        <div id="content"></div>
+    </body>
+</html>


Property changes on: sandbox/redlining/ux/RedLining/examples/RedLining.html
___________________________________________________________________
Name: svn:mime-type
   + text/html
Name: svn:eol-style
   + native

Added: sandbox/redlining/ux/RedLining/examples/RedLining.js
===================================================================
--- sandbox/redlining/ux/RedLining/examples/RedLining.js	                        (rev 0)
+++ sandbox/redlining/ux/RedLining/examples/RedLining.js	2010-01-07 21:53:21 UTC (rev 1659)
@@ -0,0 +1,28 @@
+var redLiningTool;
+
+Ext.onReady(function() {
+
+    var mapPanel = new GeoExt.MapPanel({
+        region: "center",
+        layers: [new OpenLayers.Layer.WMS("Global Imagery",
+            "http://labs.metacarta.com/wms/vmap0",
+            {layers: "basic"})] ,
+        center: [16,48],
+        zoom: 5
+    });
+
+    redLiningTool = new GeoExt.ux.form.ComplexRedLiningForm({
+          title: "RedLining Manager",
+        region: "east",
+        map: mapPanel.map,
+        width: 300
+    });
+    
+    new Ext.Panel({
+        renderTo: "content",
+        layout: "border",
+        width: 650,
+        height: 350,
+        items: [mapPanel, redLiningTool]
+    });
+});


Property changes on: sandbox/redlining/ux/RedLining/examples/RedLining.js
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: sandbox/redlining/ux/RedLining/license.txt
===================================================================
--- sandbox/redlining/ux/RedLining/license.txt	                        (rev 0)
+++ sandbox/redlining/ux/RedLining/license.txt	2010-01-07 21:53:21 UTC (rev 1659)
@@ -0,0 +1,43 @@
+This license applies to all code and content hosted in this directory of the
+repository. It does not apply to external code and content which may be
+checked out in working copies (due to svn:externals properties on
+subdirectories).
+
+License
+=======
+
+Copyright (c) 2008-2009, The Open Source Geospatial Foundation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+    * Neither the name of the Open Source Geospatial Foundation nor the names
+      of its contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+
+
+Notice about ExtJS
+==================
+
+The GeoExt library is for use with the ExtJS library.  ExtJS is distributed
+under the terms of the GPL v3.  See http://extjs.com/products/license.php for
+details on ExtJS licensing.


Property changes on: sandbox/redlining/ux/RedLining/license.txt
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: sandbox/redlining/ux/RedLining/todo.txt
===================================================================
--- sandbox/redlining/ux/RedLining/todo.txt	                        (rev 0)
+++ sandbox/redlining/ux/RedLining/todo.txt	2010-01-07 21:53:21 UTC (rev 1659)
@@ -0,0 +1,47 @@
+  GeoExt.ux.FeatureEditingTool
+               - Connect to a FeatureStore
+               - FeatureSelectionModel to allow the use ModifyFeature Control
+               - DrawFeature must be attach to a Layer (or LayerStore?)
+               - Single DrawFeature for all layers
+               - Single ModifyFeature for all layers
+               - User must define the geometry types available
+               - User must define the layer(s) on which he works
+               - 5 buttons (4 draw (1/geometry), 1 EditFeaturePanel)
+               - Include a Symbolizer/Styler tool
+               - Documentation to commit on server-side
+        |__GeoExt.ux.RedLiningTool
+               - Create a new empty vector layer if none is define
+               - Every geometry type (point, line, polygon, text) are added
+               - one more button (1 delete all)
+               - Include Import/Export Panel
+               - Include ImportGPXPanel
+               - Attributes are Title and Description
+
+  GeoExt.ux.ChangeOpacitySelection (maybe in OL)
+               - Change opacity of all not-selected features
+
+  GeoExt.ux.DeleteAllFeatures
+               - It's a single Button
+               - Delete all features of a layer(s)
+
+  GeoExt.ux.EditFeaturePanel
+               - Work on a FeatureStore
+               - Possibility to apply new style to all feature in a layer(s)
+               - Contain a DeleteFeature button
+               - Optional buttons (Cancel, Apply, OK)
+               - Include the Symbolizer/Styler FormPanel
+               - Include a attribute FormPanel
+
+  GeoExt.ux.LayerManagerExportPanel
+  GeoExt.ux.LayerManagerImportPanel
+               - Must be open to support other formats
+               - Must listen events to commit on server side
+
+  GeoExt.ux.ImportGPXPanel
+               - Can this be a new type of LayerManagerImportPanel?
+
+  GeoExt.ux.Symbolizer
+        |__GeoExt.ux.SymbolizerFixed
+        |__GeoExt.ux.SymbolizerSimple
+        |__GeoExt.ux.SymbolizerPanel
+               - Tool to assign a style to a layer(s)/feature(s)


Property changes on: sandbox/redlining/ux/RedLining/todo.txt
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: sandbox/redlining/ux/RedLining/ux/RedLining.js
===================================================================
--- sandbox/redlining/ux/RedLining/ux/RedLining.js	                        (rev 0)
+++ sandbox/redlining/ux/RedLining/ux/RedLining.js	2010-01-07 21:53:21 UTC (rev 1659)
@@ -0,0 +1,83 @@
+/**
+ * Copyright (c) 2008-2009 The Open Source Geospatial Foundation
+ * 
+ * Published under the BSD license.
+ * See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text
+ * of the license.
+ */
+
+/*
+ * The code in this file is based on code taken from OpenLayers.
+ *
+ * Copyright (c) 2006-2007 MetaCarta, Inc., published under the Clear BSD
+ * license.  See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license.
+ */
+ 
+(function() {
+
+    /**
+     * The relative path of this script.
+     */
+    var scriptName = "ux/RedLining.js";
+
+    /**
+     * Function returning the path of this script.
+     */
+    var getScriptLocation = function() {
+        var scriptLocation = "";
+        // If we load other scripts right before GeoExt using the same
+        // mechanism to add script resources dynamically (e.g. OpenLayers), 
+        // document.getElementsByTagName will not find the GeoExt script tag
+        // in FF2. Using document.documentElement.getElementsByTagName instead
+        // works around this issue.
+        var scripts = document.documentElement.getElementsByTagName('script');
+        for(var i=0, len=scripts.length; i<len; i++) {
+            var src = scripts[i].getAttribute('src');
+            if(src) {
+                var index = src.lastIndexOf(scriptName); 
+                // set path length for src up to a query string
+                var pathLength = src.lastIndexOf('?');
+                if(pathLength < 0) {
+                    pathLength = src.length;
+                }
+                // is it found, at the end of the URL?
+                if((index > -1) && (index + scriptName.length == pathLength)) {
+                    scriptLocation = src.slice(0, pathLength - scriptName.length);
+                    break;
+                }
+            }
+        }
+        return scriptLocation;
+    };
+
+    var jsfiles = new Array(
+        "widgets/Main.js",
+        "widgets/MainControler.js",
+        "widgets/form/EditFeatureForm.js",
+        "widgets/form/ComplexRedLiningForm.js"
+    );
+
+    var agent = navigator.userAgent;
+    var docWrite = (agent.match("MSIE") || agent.match("Safari"));
+    if(docWrite) {
+        var allScriptTags = new Array(jsfiles.length);
+    }
+    var host = getScriptLocation() + "ux/";    
+    for (var i=0, len=jsfiles.length; i<len; i++) {
+        if (docWrite) {
+            allScriptTags[i] = "<script src='" + host + jsfiles[i] +
+                               "'></script>"; 
+        } else {
+            var s = document.createElement("script");
+            s.src = host + jsfiles[i];
+            var h = document.getElementsByTagName("head").length ? 
+                       document.getElementsByTagName("head")[0] : 
+                       document.body;
+            h.appendChild(s);
+        }
+    }
+    if (docWrite) {
+        document.write(allScriptTags.join(""));
+    }
+})();


Property changes on: sandbox/redlining/ux/RedLining/ux/RedLining.js
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: sandbox/redlining/ux/RedLining/ux/widgets/MainControler.js
===================================================================
--- sandbox/redlining/ux/RedLining/ux/widgets/MainControler.js	                        (rev 0)
+++ sandbox/redlining/ux/RedLining/ux/widgets/MainControler.js	2010-01-07 21:53:21 UTC (rev 1659)
@@ -0,0 +1,133 @@
+Ext.namespace("GeoExt.ux");
+
+GeoExt.ux.MainControler = Ext.extend(Ext.util.Observable, {
+    
+    map: null,
+
+    featureStore: null,
+
+    drawControls: null,
+
+    actions: null,
+
+    featureControl: null,
+
+    layers: null,
+
+    activeLayer: null,
+    
+    constructor: function(config) {
+        Ext.apply(this, config);
+
+        this.addEvents([
+             /** api: events[activelayerchanged]
+             *  Triggered when the active layer is changed
+             *  
+             *  Listener arguments:
+             */
+            "activelayerchanged"
+        ]);
+
+        
+        GeoExt.ux.MainControler.superclass.constructor.apply(this, arguments);
+
+        this.layers = [];
+        this.drawControls = [];
+        this.actions = [];
+        
+        if(this.map instanceof GeoExt.MapPanel) {
+            this.map = this.map.map;
+        }
+
+        if(!this.map) {
+            alert("error");
+        }
+    },
+
+    addLayer: function(layer) {
+        if(!layer.map) {
+            this.map.addLayer(layer);
+        }
+        this.layers.push(layer);
+    },
+
+    setActiveLayer: function(layer) {
+        this.activeLayer = layer;
+        this.fireEvent("activelayerchanged", this, layer);
+    },
+
+    initFeatureControl: function() {
+    },
+
+    destroyFeatureControl: function() {
+    },
+
+    initDrawControls: function() {
+        var layer, control, handler, geometryTypes, geometryType,
+            options, action, iconCls;
+
+        geometryTypes = [];
+        options = {};
+        layer = this.activeLayer;
+
+        if(layer.geometryType) {
+            geometryTypes.push(layer.geometryType);
+        } else {
+            geometryTypes.push("Point");
+            geometryTypes.push("LineString");
+            geometryTypes.push("Polygon");
+            //geometryTypes.push("Label");
+        }
+
+        for(var i=0; i<geometryTypes.length; i++) {
+            geometryType = geometryTypes[i];
+
+            switch(geometryType) {
+              case "LineString":
+              case "MultiLineString":
+                handler = OpenLayers.Handler.Path;
+                break;
+              case "Point":
+              case "MultiPoint":
+                handler = OpenLayers.Handler.Point;
+                break;
+              case "Polygon":
+              case "MultiPolygon":
+                handler = OpenLayers.Handler.Polygon;
+                break;
+            }
+
+            control = new OpenLayers.Control.DrawFeature(
+                layer, handler, options);
+
+            this.drawControls.push(control);
+            this.map.addControl(control);
+
+            action = new GeoExt.Action({
+                //iconCls: "todo",
+                text: geometryType,
+                control: control,
+                map: this.map,
+                // button options
+                toggleGroup: this.map.id,
+                allowDepress: false,
+                pressed: false,
+                tooltip: "todo",
+                // check item options
+                group: this.map.id,
+                checked: false
+            });
+
+            this.actions.push(action);
+        }
+    },
+
+    destroyDrawControls: function() {
+        for(var i=0; i<this.drawControls.length; i++) {
+            this.drawControls[i].destroy();
+        }
+        this.drawControls = [];
+    },
+
+    CLASS_NAME: "GeoExt.ux.MainControler"
+});


Property changes on: sandbox/redlining/ux/RedLining/ux/widgets/MainControler.js
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: sandbox/redlining/ux/RedLining/ux/widgets/form/ComplexRedLiningForm.js
===================================================================
--- sandbox/redlining/ux/RedLining/ux/widgets/form/ComplexRedLiningForm.js	                        (rev 0)
+++ sandbox/redlining/ux/RedLining/ux/widgets/form/ComplexRedLiningForm.js	2010-01-07 21:53:21 UTC (rev 1659)
@@ -0,0 +1,108 @@
+/**
+ * Copyright (c) 2008-2009 The Open Source Geospatial Foundation
+ * 
+ * Published under the BSD license.
+ * See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text
+ * of the license.
+ */
+Ext.namespace("GeoExt.ux.form")
+
+/** api: (define)
+ *  module = GeoExt.ux.form
+ *  class = PrintForm
+ *  base_link = `Ext.form.FormPanel <http://extjs.com/deploy/dev/docs/?class=Ext.form.FormPanel>`_
+ */
+
+/** api: constructor
+ *  .. class:: ComplexRedLiningForm
+ * 
+ *  Todo
+ */
+GeoExt.ux.form.ComplexRedLiningForm = Ext.extend(Ext.form.FormPanel, {
+
+    labelWidth: 100,
+    border: false,
+    bodyStyle:'padding:5px 5px 5px 5px',
+    width: 300,
+    defaults: {width: 120},
+    defaultType: 'textfield',
+
+    map: null,
+
+    main: null,
+    
+    /** private: method[initComponent]
+     */
+    initComponent: function() {
+        this.initMap();
+        this.initMain();
+        this.initLayer();
+        this.initDrawControls();
+
+        GeoExt.ux.form.ComplexRedLiningForm.superclass.initComponent.call(this);
+    },
+    
+    /** private: method[initMain]
+     */
+    initMain: function() {
+        if(!this.main){
+            this.main = new GeoExt.ux.MainControler({
+                map: this.map
+            });
+        }
+    },
+
+    /** private: method[initMap]
+     */
+    initMap: function() {
+        if(this.map instanceof GeoExt.MapPanel) {
+            this.map = this.map.map;
+        }
+
+        if(!this.map) {
+            alert("error");
+        }
+    },
+
+    /** private: method[initLayer]
+     */
+    initLayer: function() {
+        var layer = new OpenLayers.Layer.Vector("cosmetic");
+        this.main.addLayer(layer);
+        this.main.setActiveLayer(layer);
+    },
+
+    /** private: method[initDrawControls]
+     */
+    initDrawControls: function() {
+        this.main.initDrawControls();
+
+        // Add buttons and toolbar
+        Ext.apply(this, {tbar: new Ext.Toolbar(this.main.actions)});
+
+        oItems = [];
+        oItems.push({
+              id: "testid",
+                    fieldLabel: "myOption",
+                    maxLength: 50,
+                    xtype: "checkbox"
+                });
+
+        Ext.apply(this, {items: oItems});
+
+    },
+    
+    /** private: method[beforeDestroy]
+     */
+    beforeDestroy: function() {
+        if(!this.initialConfig.layer) {
+            this.layer.destroy();
+        }
+        delete this.main;
+        delete this.map;
+    }
+    
+});
+
+/** api: xtype = gx_featureform */
+Ext.reg("gx_complexredliningform", GeoExt.ux.form.ComplexRedLiningForm);


Property changes on: sandbox/redlining/ux/RedLining/ux/widgets/form/ComplexRedLiningForm.js
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Added: sandbox/redlining/ux/RedLining/ux/widgets/form/EditFeatureForm.js
===================================================================
--- sandbox/redlining/ux/RedLining/ux/widgets/form/EditFeatureForm.js	                        (rev 0)
+++ sandbox/redlining/ux/RedLining/ux/widgets/form/EditFeatureForm.js	2010-01-07 21:53:21 UTC (rev 1659)
@@ -0,0 +1,83 @@
+/**
+ * Copyright (c) 2008-2009 The Open Source Geospatial Foundation
+ * 
+ * Published under the BSD license.
+ * See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text
+ * of the license.
+ */
+Ext.namespace("GeoExt.ux.form")
+
+/** api: (define)
+ *  module = GeoExt.ux.form
+ *  class = PrintForm
+ *  base_link = `Ext.form.FormPanel <http://extjs.com/deploy/dev/docs/?class=Ext.form.FormPanel>`_
+ */
+
+/** api: constructor
+ *  .. class:: EditFeatureForm
+ * 
+ *  Todo
+ */
+GeoExt.ux.form.EditFeatureForm = Ext.extend(Ext.form.FormPanel, {
+    
+    /** api: config[map]
+     *  ``GeoExt.MapPanel``|``OpenLayers.Map`` The map the drag control will
+     *  be added to. Optional if a layer is provided and the layer has already
+     *  been added to a map.
+     */
+    
+    /** private: property[map]
+     *  ``OpenLayers.Map`` The map that layer and control will be added to.
+     */
+    map: null,
+    
+    /** api: config[layer]
+     *  ``OpenLayers.Layer.Vector`` The layer used to render extent and handle
+     *  features to. Optional, will be created if not provided.
+     */
+
+    /** private: property[layer]
+     *  ``OpenLayers.Layer.Vector`` The layer used to render extent and handle
+     *  features to.
+     */
+    layer: null,
+    
+    /** private: method[initComponent]
+     */
+    initComponent: function() {
+        GeoExt.ux.form.EditFeatureForm.superclass.initComponent.call(this);
+        if(this.map instanceof GeoExt.MapPanel) {
+            this.map = this.map.map;
+        }
+        if(!this.map) {
+            this.map = this.layer.map;
+        }
+    },
+    
+    /** private: method[initLayer]
+     */
+    initLayer: function() {
+        if(!this.layer) {
+            this.layer = new OpenLayers.Layer.Vector(null, {
+                displayInLayerSwitcher: false
+            });
+        }
+        if(!this.layer.map) {
+            this.map.addLayer(this.layer);
+        }
+    },
+    
+    /** private: method[beforeDestroy]
+     */
+    beforeDestroy: function() {
+        if(!this.initialConfig.layer) {
+            this.layer.destroy();
+        }
+        delete this.layer;
+        delete this.map;
+    }
+    
+});
+
+/** api: xtype = gx_featureform */
+Ext.reg("gx_editfeatureform", GeoExt.ux.form.EditFeatureForm);


Property changes on: sandbox/redlining/ux/RedLining/ux/widgets/form/EditFeatureForm.js
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native



More information about the Commits mailing list