[Commits] r1568 - in sandbox/cmoullet/ux: . Redlining Redlining/examples Redlining/ux Redlining/ux/control
commits at geoext.org
commits at geoext.org
Tue Dec 8 07:33:45 CET 2009
Author: cmoullet
Date: 2009-12-08 07:33:45 +0100 (Tue, 08 Dec 2009)
New Revision: 1568
Added:
sandbox/cmoullet/ux/Redlining/
sandbox/cmoullet/ux/Redlining/examples/
sandbox/cmoullet/ux/Redlining/examples/RedliningExample.html
sandbox/cmoullet/ux/Redlining/examples/RedliningExample.js
sandbox/cmoullet/ux/Redlining/ux/
sandbox/cmoullet/ux/Redlining/ux/control/
sandbox/cmoullet/ux/Redlining/ux/control/RedliningPolygonControl.js
Log:
Tests of redlining... not working and not sure of the architecture
Added: sandbox/cmoullet/ux/Redlining/examples/RedliningExample.html
===================================================================
--- sandbox/cmoullet/ux/Redlining/examples/RedliningExample.html (rev 0)
+++ sandbox/cmoullet/ux/Redlining/examples/RedliningExample.html 2009-12-08 06:33:45 UTC (rev 1568)
@@ -0,0 +1,15 @@
+<html>
+<head>
+ <title>Redlining Example</title>
+ <script type="text/javascript" src="http://extjs.cachefly.net/builds/ext-cdn-771.js"></script>
+ <link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-2.2.1/resources/css/ext-all.css"/>
+ <link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-2.2.1/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/control/RedliningPolygonControl.js"></script>
+ <script type="text/javascript" src="RedliningExample.js"></script>
+
+</head>
+<body>
+</body>
+</html>
Added: sandbox/cmoullet/ux/Redlining/examples/RedliningExample.js
===================================================================
--- sandbox/cmoullet/ux/Redlining/examples/RedliningExample.js (rev 0)
+++ sandbox/cmoullet/ux/Redlining/examples/RedliningExample.js 2009-12-08 06:33:45 UTC (rev 1568)
@@ -0,0 +1,109 @@
+var mapPanel;
+
+var treePanel;
+
+var viewport;
+
+var layer;
+
+Ext.onReady(function() {
+
+ var bluemarble = new OpenLayers.Layer.WMS(
+ "Bluemarble",
+ "http://sigma.openplans.org/geoserver/wms?",
+ {layers: 'bluemarble'},
+ {singleTile: true}
+ );
+
+ var map = new OpenLayers.Map();
+
+ var center = new OpenLayers.LonLat(4.6, 46.9);
+
+ var mouse = new OpenLayers.Control.MousePosition();
+
+ map.addControl(mouse);
+ mouse.activate();
+
+ var toolbar = [];
+
+ var redliningLayer = new OpenLayers.Layer.Vector("redliningLayer");
+ map.addLayers([redliningLayer]);
+
+ var action = new GeoExt.Action({
+ text: "Draw Polygon",
+ control: new GeoExt.ux.RedliningPolygonControl(
+ redliningLayer,
+ OpenLayers.Handler.Polygon,
+ {
+ map: map
+ }
+ ),
+ map: map,
+ toggleGroup: "draw",
+ allowDepress: true,
+ tooltip: "draw polygon",
+ group: "draw"
+ });
+ toolbar.push(action);
+
+ toolbar.push({
+ text: 'Permalink',
+ enableToggle: false,
+ handler: function() {
+ alert('TODO not implemented')
+ }
+ });
+
+
+ var mapStore = new GeoExt.data.LayerStore({
+ map: map,
+ layers: [bluemarble]
+ });
+
+ var treeItem = new Ext.tree.TreePanel({
+ root: new GeoExt.tree.LayerContainer({
+ text: 'Map Layers',
+ layerStore: mapStore,
+ leaf: false,
+ expanded: true
+ }),
+ enableDD: true
+ });
+
+ viewport = new Ext.Viewport({
+ layout: "border",
+ id: 'mainViewport',
+ items: [
+ {
+ region: "center",
+ id: "mappanel",
+ title: "2D Map",
+ xtype: "gx_mappanel",
+ map: map,
+ layers: mapStore,
+ center: center,
+ zoom: 5,
+ split: true,
+ tbar: toolbar
+ },
+ {
+ region: "west",
+ id: "treepanel",
+ title: "Layer Tree",
+ width: 200
+ },
+ {
+ region: "south",
+ layout: 'fit',
+ id: "readme",
+ title: 'README',
+ margins: {left: 5,top: 5, bottom: 5, right: 5},
+ html: '<p style="font-size:12pt;color:#15428B;font-weight:bold;margin:5">Redlining Example</p>'
+ }
+ ]
+ });
+ treePanel = Ext.getCmp("treepanel");
+ treePanel.add(treeItem);
+ treePanel.doLayout();
+ viewport.doLayout();
+});
\ No newline at end of file
Added: sandbox/cmoullet/ux/Redlining/ux/control/RedliningPolygonControl.js
===================================================================
--- sandbox/cmoullet/ux/Redlining/ux/control/RedliningPolygonControl.js (rev 0)
+++ sandbox/cmoullet/ux/Redlining/ux/control/RedliningPolygonControl.js 2009-12-08 06:33:45 UTC (rev 1568)
@@ -0,0 +1,43 @@
+/**
+ * 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');
+
+GeoExt.ux.RedliningPolygonControl = OpenLayers.Class(OpenLayers.Control.DrawFeature, {
+
+ map: null,
+ highlightCtrl: null,
+ selectCtrl: null,
+ modifyCtrl: null,
+
+ initialize: function(options) {
+ OpenLayers.Control.DrawFeature.prototype.initialize.apply(this, arguments);
+ // Highlight the feature onHover
+ this.highlightCtrl = new OpenLayers.Control.SelectFeature(this.layer, {
+ hover: true,
+ highlightOnly: true
+ });
+
+ // Select the feature
+ this.selectCtrl = new OpenLayers.Control.SelectFeature(this.layer, {
+ clickout: true
+ });
+
+ // Modifiy the feature
+ this.modifyCtrl = new OpenLayers.Control.ModifyFeature(this.layer, {
+ clickout: true
+ });
+ this.map.addControl(this.highlightCtrl);
+ this.map.addControl(this.selectCtrl);
+ this.map.addControl(this.modifyCtrl);
+
+ this.highlightCtrl.activate();
+ this.selectCtrl.activate();
+ this.modifyCtrl.activate();
+ }
+});
\ No newline at end of file
More information about the Commits
mailing list