[OpenLayers-Commits] r7320 - in sandbox/topp/almanac: . examples
commits at openlayers.org
commits at openlayers.org
Thu Jun 5 23:11:38 EDT 2008
Author: sbenthall
Date: 2008-06-05 23:11:37 -0400 (Thu, 05 Jun 2008)
New Revision: 7320
Removed:
sandbox/topp/almanac/StoryEditGeometry.js
sandbox/topp/almanac/examples/edit-feature.html
Log:
removing Almanac-specific code from sandbox
Deleted: sandbox/topp/almanac/StoryEditGeometry.js
===================================================================
--- sandbox/topp/almanac/StoryEditGeometry.js 2008-06-06 02:32:58 UTC (rev 7319)
+++ sandbox/topp/almanac/StoryEditGeometry.js 2008-06-06 03:11:37 UTC (rev 7320)
@@ -1,83 +0,0 @@
-
-
-var Almanac = {};
-Almanac.Control = {};
-
-Almanac.Control.StoryEditGeometry = new OpenLayers.Class(OpenLayers.Control.ToolSwitch, {
-
- selectControl: null,
-
- /**
- * Constructor: Almanac.Control.StoryModify
- * Create a new control to modify stories.
- */
- initialize: function(layer, options) {
-
- var tools = {
- point: new OpenLayers.Control.DrawFeature(layer,
- OpenLayers.Handler.Point),
- line: new OpenLayers.Control.DrawFeature(layer,
- OpenLayers.Handler.Path),
- polygon: new OpenLayers.Control.DrawFeature(layer,
- OpenLayers.Handler.Polygon),
- modify: new OpenLayers.Control.ModifyFeature(layer)
- };
-
- OpenLayers.Control.ToolSwitch.prototype.initialize.apply(this, [layer, tools, options]);
-
- this.defaultTool = 'modify';
-
- this.selectControl = this.tools['modify'].selectControl;
-
- this.layer.events.on({
- "featureadded": this.onFeatureAdded,
- scope: this
- });
-
- this.tools['modify'].events.on({
- "activate": this.selectFeature,
- scope: this
- })
-
- },
-
-
- destroy: function(){
- this.layer.events.un({
- "featureadded": this.onFeatureAdded,
- scope: this
- })
-
- this.modifyControl.events.un({
- "activate": this.selectFeature,
- scope: this
- })
-
- this.selectControl = null;
-
- OpenLayers.Control.ToolSwitch.prototype.destroy.apply(this, arguments);
- },
-
- selectFeature: function(){
- //this control maintains a maximum of one feature on its layer
- var feature = this.layer.features[0];
-
- if(feature){
- this.selectControl.select(feature);
- }
- },
-
- onFeatureAdded: function(ev){
- feature = ev.feature;
-
- for(var i = 0; i < this.layer.features.length ; i++){
- if (this.layer.features[i] !== feature) {
- this.layer.removeFeatures([vectors.features[i]]);
- }
- }
-
- this.switchTool('modify');
- },
-
- CLASS_NAME: "Almanac.Control.StoryEditGeometry"
-});
Deleted: sandbox/topp/almanac/examples/edit-feature.html
===================================================================
--- sandbox/topp/almanac/examples/edit-feature.html 2008-06-06 02:32:58 UTC (rev 7319)
+++ sandbox/topp/almanac/examples/edit-feature.html 2008-06-06 03:11:37 UTC (rev 7320)
@@ -1,115 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <title>Edit Feature</title>
- <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
- <style type="text/css">
- #map {
- width: 512px;
- height: 512px;
- border: 1px solid gray;
- }
-
- div .selected {
- background-color: #EEEEEE
- }
- </style>
- <script language="javascript" type="text/javascript" src="./lib/Firebug/firebug.js"></script>
- <script src="../lib/OpenLayers.js"></script>
- <script src="../StoryEditGeometry.js"></script>
- <script type="text/javascript">
- var map, vectors, controls, panel;
- function init(){
- map = new OpenLayers.Map('map');
- var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
- "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'});
- vectors = new OpenLayers.Layer.Vector("Vector Layer");
-
- map.addLayers([wms, vectors]);
- map.addControl(new OpenLayers.Control.LayerSwitcher());
- map.addControl(new OpenLayers.Control.MousePosition())
-
- var storyEditGeometryControl = new Almanac.Control.StoryEditGeometry(vectors);
- map.addControl(storyEditGeometryControl);
-
- panel = new OpenLayers.Control.Radio(
- [
- {
- id: "modifyFeatureTool",
- value: 'modify'
- },
- {
- id: "drawPointTool",
- value: 'point'
- },
- {
- id: "drawLineTool",
- value: 'line'
- },
- {
- id: "drawPolygonTool",
- value: 'polygon'
- }
- ]
- )
-
- var point = new OpenLayers.Geometry.Point(0, 0);
- var pointFeature = new OpenLayers.Feature.Vector(point,null);
-
- vectors.addFeatures([pointFeature]);
-
- map.addControl(panel);
-
- //oh, behave!
- panel.setOnclickBehavior('modify', storyEditGeometryControl, function(){
- storyEditGeometryControl.switchTool('modify');
- });
-
- panel.setOnclickBehavior('point', storyEditGeometryControl, function(){
- storyEditGeometryControl.switchTool('point');
- });
-
- panel.setOnclickBehavior('line', storyEditGeometryControl, function(){
- storyEditGeometryControl.switchTool('line')
- });
-
- panel.setOnclickBehavior('polygon', storyEditGeometryControl, function(){
- storyEditGeometryControl.switchTool('polygon')
- });
-
- storyEditGeometryControl.onToolActivateBehavior('modify', panel, function(){
- this.select('modify');
- })
-
- panel.activate();
- storyEditGeometryControl.activate();
-
-
- map.setCenter(new OpenLayers.LonLat(0, 0), 3);
- }
-
- </script>
-
- </head>
- <body onload="init()">
- <div id="map"></div>
- <div id="controls">
- Click to activate the tools.
- <ul id="controlToggle">
- <li>
- <div id="modifyFeatureTool">modify feature</div>
- </li>
- <li>
- <div id="drawPointTool">draw point</div>
- </li>
- <li>
- <div id ="drawLineTool">draw line</div>
- </li>
- <li>
- <div id="drawPolygonTool">draw polygon</div>
- </li>
- </ul>
- </div>
- </body>
-</html>
More information about the Commits
mailing list