| | 1 | /* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license. |
|---|
| | 2 | * See http://svn.openlayers.org/trunk/openlayers/repository-license.txt |
|---|
| | 3 | * for the full text of the license. */ |
|---|
| | 4 | |
|---|
| | 5 | |
|---|
| | 6 | /** |
|---|
| | 7 | * @requires OpenLayers/Control/DragFeature.js |
|---|
| | 8 | * @requires OpenLayers/Control/SelectFeature.js |
|---|
| | 9 | * @requires OpenLayers/Handler/Keyboard.js |
|---|
| | 10 | * |
|---|
| | 11 | * Class: OpenLayers.Control.ModifyFeature |
|---|
| | 12 | * Control to modify features. When activated, a click renders the vertices |
|---|
| | 13 | * of a feature - these vertices can then be dragged. By default, the |
|---|
| | 14 | * delete key will delete the vertex under the mouse. New features are |
|---|
| | 15 | * added by dragging "virtual vertices" between vertices. Create a new |
|---|
| | 16 | * control with the <OpenLayers.Control.ModifyFeature> constructor. |
|---|
| | 17 | * |
|---|
| | 18 | * Inherits From: |
|---|
| | 19 | * - <OpenLayers.Control> |
|---|
| | 20 | */ |
|---|
| | 21 | OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, { |
|---|
| | 22 | |
|---|
| | 23 | /** |
|---|
| | 24 | * APIProperty: geometryTypes |
|---|
| | 25 | * {Array(String)} To restrict modification to a limited set of geometry |
|---|
| | 26 | * types, send a list of strings corresponding to the geometry class |
|---|
| | 27 | * names. |
|---|
| | 28 | */ |
|---|
| | 29 | geometryTypes: null, |
|---|
| | 30 | |
|---|
| | 31 | /** |
|---|
| | 32 | * Property: layer |
|---|
| | 33 | * {OpenLayers.Layer.Vector} |
|---|
| | 34 | */ |
|---|
| | 35 | layer: null, |
|---|
| | 36 | |
|---|
| | 37 | /** |
|---|
| | 38 | * Property: feature |
|---|
| | 39 | * {<OpenLayers.Feature.Vector>} Feature currently available for modification. |
|---|
| | 40 | */ |
|---|
| | 41 | feature: null, |
|---|
| | 42 | |
|---|
| | 43 | /** |
|---|
| | 44 | * Property: vertices |
|---|
| | 45 | * {Array(<OpenLayers.Feature.Vector>)} Verticies currently available |
|---|
| | 46 | * for dragging. |
|---|
| | 47 | */ |
|---|
| | 48 | vertices: null, |
|---|
| | 49 | |
|---|
| | 50 | /** |
|---|
| | 51 | * Property: virtualVertices |
|---|
| | 52 | * {Array(<OpenLayers.Feature.Vector>)} Virtual vertices in the middle |
|---|
| | 53 | * of each edge. |
|---|
| | 54 | */ |
|---|
| | 55 | virtualVertices: null, |
|---|
| | 56 | |
|---|
| | 57 | /** |
|---|
| | 58 | * Property: selectControl |
|---|
| | 59 | * {<OpenLayers.Control.Select>} |
|---|
| | 60 | */ |
|---|
| | 61 | selectControl: null, |
|---|
| | 62 | |
|---|
| | 63 | /** |
|---|
| | 64 | * Property: dragControl |
|---|
| | 65 | * {<OpenLayers.Control.DragFeature>} |
|---|
| | 66 | */ |
|---|
| | 67 | dragControl: null, |
|---|
| | 68 | |
|---|
| | 69 | /** |
|---|
| | 70 | * Property: keyboardHandler |
|---|
| | 71 | * {<OpenLayers.Handler.Keyboard>} |
|---|
| | 72 | */ |
|---|
| | 73 | keyboardHandler: null, |
|---|
| | 74 | |
|---|
| | 75 | /** |
|---|
| | 76 | * APIProperty: deleteCodes |
|---|
| | 77 | * {Array(Integer)} Keycodes for deleting verticies. Set to null to disable |
|---|
| | 78 | * vertex deltion by keypress. If non-null, keypresses with codes |
|---|
| | 79 | * in this array will delete vertices under the mouse. Default |
|---|
| | 80 | * is 46 and 100, the 'delete' and lowercase 'd' keys. |
|---|
| | 81 | */ |
|---|
| | 82 | deleteCodes: null, |
|---|
| | 83 | |
|---|
| | 84 | /** |
|---|
| | 85 | * APIProperty: virtualStyle |
|---|
| | 86 | * {<OpenLayers.Feature.Vector.Style>} |
|---|
| | 87 | */ |
|---|
| | 88 | virtualStyle: null, |
|---|
| | 89 | |
|---|
| | 90 | /** |
|---|
| | 91 | * APIProperty: onModificationStart |
|---|
| | 92 | * {Function} Optional function to be called when a feature is selected |
|---|
| | 93 | * to be modified. The function should expect to be called with a |
|---|
| | 94 | * feature. This could be used for example to allow to lock the |
|---|
| | 95 | * feature on server-side. |
|---|
| | 96 | */ |
|---|
| | 97 | onModificationStart: function() {}, |
|---|
| | 98 | |
|---|
| | 99 | /** |
|---|
| | 100 | * APIProperty: onModification |
|---|
| | 101 | * {Function} Optional function to be called when a feature has been |
|---|
| | 102 | * modified. The function should expect to be called with a feature. |
|---|
| | 103 | */ |
|---|
| | 104 | onModification: function() {}, |
|---|
| | 105 | |
|---|
| | 106 | /** |
|---|
| | 107 | * APIProperty: onModificationEnd |
|---|
| | 108 | * {Function} Optional function to be called when a feature is finished |
|---|
| | 109 | * being modified. The function should expect to be called with a |
|---|
| | 110 | * feature. |
|---|
| | 111 | */ |
|---|
| | 112 | onModificationEnd: function() {}, |
|---|
| | 113 | |
|---|
| | 114 | /** |
|---|
| | 115 | * Constructor: OpenLayers.Control.ModifyFeature |
|---|
| | 116 | * Create a new modify feature control. |
|---|
| | 117 | * |
|---|
| | 118 | * Parameters: |
|---|
| | 119 | * layer - {OpenLayers.Layer.Vector} Layer that contains features that |
|---|
| | 120 | * will be modified. |
|---|
| | 121 | * options - {Object} Optional object whose properties will be set on the |
|---|
| | 122 | * control. |
|---|
| | 123 | */ |
|---|
| | 124 | initialize: function(layer, options) { |
|---|
| | 125 | this.layer = layer; |
|---|
| | 126 | this.vertices = []; |
|---|
| | 127 | this.virtualVertices = []; |
|---|
| | 128 | this.styleVirtual = OpenLayers.Util.extend({}, this.layer.style); |
|---|
| | 129 | this.styleVirtual.fillOpacity = 0.3; |
|---|
| | 130 | this.styleVirtual.strokeOpacity = 0.3; |
|---|
| | 131 | this.deleteCodes = [46, 100]; |
|---|
| | 132 | OpenLayers.Control.prototype.initialize.apply(this, [options]); |
|---|
| | 133 | if(!(this.deleteCodes instanceof Array)) { |
|---|
| | 134 | this.deleteCodes = [this.deleteCodes]; |
|---|
| | 135 | } |
|---|
| | 136 | var control = this; |
|---|
| | 137 | |
|---|
| | 138 | // configure the select control |
|---|
| | 139 | var selectOptions = { |
|---|
| | 140 | geometryTypes: this.geometryTypes, |
|---|
| | 141 | onSelect: function(feature) { |
|---|
| | 142 | control.selectFeature.apply(control, [feature]); |
|---|
| | 143 | }, |
|---|
| | 144 | onUnselect: function(feature) { |
|---|
| | 145 | control.unselectFeature.apply(control, [feature]); |
|---|
| | 146 | } |
|---|
| | 147 | }; |
|---|
| | 148 | this.selectControl = new OpenLayers.Control.SelectFeature( |
|---|
| | 149 | layer, selectOptions |
|---|
| | 150 | ); |
|---|
| | 151 | |
|---|
| | 152 | // configure the drag control |
|---|
| | 153 | var dragOptions = { |
|---|
| | 154 | geometryTypes: ["OpenLayers.Geometry.Point"], |
|---|
| | 155 | snappingOptions: this.snappingOptions, |
|---|
| | 156 | onStart: function(feature, pixel) { |
|---|
| | 157 | control.dragStart.apply(control, [feature, pixel]); |
|---|
| | 158 | }, |
|---|
| | 159 | onDrag: function(feature) { |
|---|
| | 160 | control.dragVertex.apply(control, [feature]); |
|---|
| | 161 | }, |
|---|
| | 162 | onComplete: function(feature) { |
|---|
| | 163 | control.dragComplete.apply(control, [feature]); |
|---|
| | 164 | } |
|---|
| | 165 | }; |
|---|
| | 166 | this.dragControl = new OpenLayers.Control.DragFeature( |
|---|
| | 167 | layer, dragOptions |
|---|
| | 168 | ); |
|---|
| | 169 | |
|---|
| | 170 | // configure the keyboard handler |
|---|
| | 171 | var keyboardOptions = { |
|---|
| | 172 | keypress: this.handleKeypress |
|---|
| | 173 | }; |
|---|
| | 174 | this.keyboardHandler = new OpenLayers.Handler.Keyboard( |
|---|
| | 175 | this, keyboardOptions |
|---|
| | 176 | ); |
|---|
| | 177 | }, |
|---|
| | 178 | |
|---|
| | 179 | /** |
|---|
| | 180 | * APIMethod: destroy |
|---|
| | 181 | * Take care of things that are not handled in superclass. |
|---|
| | 182 | */ |
|---|
| | 183 | destroy: function() { |
|---|
| | 184 | this.layer = null; |
|---|
| | 185 | this.selectControl.destroy(); |
|---|
| | 186 | this.dragControl.destroy(); |
|---|
| | 187 | this.keyboardHandler.destroy(); |
|---|
| | 188 | OpenLayers.Control.prototype.destroy.apply(this, []); |
|---|
| | 189 | }, |
|---|
| | 190 | |
|---|
| | 191 | /** |
|---|
| | 192 | * APIMethod: activate |
|---|
| | 193 | * Activate the control and the feature handler. |
|---|
| | 194 | * |
|---|
| | 195 | * Returns: |
|---|
| | 196 | * {Boolean} Successfully activated the control and feature handler. |
|---|
| | 197 | */ |
|---|
| | 198 | activate: function() { |
|---|
| | 199 | return (this.selectControl.activate() && |
|---|
| | 200 | this.keyboardHandler.activate() && |
|---|
| | 201 | OpenLayers.Control.prototype.activate.apply(this, arguments)); |
|---|
| | 202 | }, |
|---|
| | 203 | |
|---|
| | 204 | /** |
|---|
| | 205 | * APIMethod: deactivate |
|---|
| | 206 | * Deactivate the controls. |
|---|
| | 207 | * |
|---|
| | 208 | * Returns: |
|---|
| | 209 | * {Boolean} Successfully deactivated the control. |
|---|
| | 210 | */ |
|---|
| | 211 | deactivate: function() { |
|---|
| | 212 | var deactivated = false; |
|---|
| | 213 | // the return from the controls is unimportant in this case |
|---|
| | 214 | if(OpenLayers.Control.prototype.deactivate.apply(this, arguments)) { |
|---|
| | 215 | this.layer.removeFeatures(this.vertices); |
|---|
| | 216 | this.layer.removeFeatures(this.virtualVertices); |
|---|
| | 217 | this.vertices = []; |
|---|
| | 218 | this.dragControl.deactivate(); |
|---|
| | 219 | if(this.feature) { |
|---|
| | 220 | this.selectControl.unselect.apply(this.selectControl, |
|---|
| | 221 | [this.feature]); |
|---|
| | 222 | } |
|---|
| | 223 | this.selectControl.deactivate(); |
|---|
| | 224 | this.keyboardHandler.deactivate(); |
|---|
| | 225 | deactivated = true; |
|---|
| | 226 | } |
|---|
| | 227 | return deactivated; |
|---|
| | 228 | }, |
|---|
| | 229 | |
|---|
| | 230 | /** |
|---|
| | 231 | * Method: selectFeature |
|---|
| | 232 | * Called when the select feature control selects a feature. |
|---|
| | 233 | * |
|---|
| | 234 | * Parameters: |
|---|
| | 235 | * feature - {<OpenLayers.Feature.Vector>} The selected feature. |
|---|
| | 236 | */ |
|---|
| | 237 | selectFeature: function(feature) { |
|---|
| | 238 | this.feature = feature; |
|---|
| | 239 | this.resetVertices(); |
|---|
| | 240 | this.dragControl.activate(); |
|---|
| | 241 | this.onModificationStart(this.feature); |
|---|
| | 242 | }, |
|---|
| | 243 | |
|---|
| | 244 | /** |
|---|
| | 245 | * Method: unselectFeature |
|---|
| | 246 | * Called when the select feature control unselects a feature. |
|---|
| | 247 | * |
|---|
| | 248 | * Parameters: |
|---|
| | 249 | * feature - {<OpenLayers.Feature.Vector>} The unselected feature. |
|---|
| | 250 | */ |
|---|
| | 251 | unselectFeature: function(feature) { |
|---|
| | 252 | this.layer.removeFeatures(this.vertices); |
|---|
| | 253 | this.layer.removeFeatures(this.virtualVertices); |
|---|
| | 254 | this.vertices = []; |
|---|
| | 255 | this.virtualVertices = []; |
|---|
| | 256 | this.feature = null; |
|---|
| | 257 | this.dragControl.deactivate(); |
|---|
| | 258 | this.onModificationEnd(feature); |
|---|
| | 259 | }, |
|---|
| | 260 | |
|---|
| | 261 | /** |
|---|
| | 262 | * Method: dragStart |
|---|
| | 263 | * Called by the drag feature control with before a feature is dragged. |
|---|
| | 264 | * This method is used to differentiate between points and vertices |
|---|
| | 265 | * of higher order geometries. This respects the <geometryTypes> |
|---|
| | 266 | * property and forces a select of points when the drag control is |
|---|
| | 267 | * already active (and stops events from propagating to the select |
|---|
| | 268 | * control). |
|---|
| | 269 | * |
|---|
| | 270 | * Parameters: |
|---|
| | 271 | * feature - {<OpenLayers.Feature.Vector>} The point or vertex about to be |
|---|
| | 272 | * dragged. |
|---|
| | 273 | * pixel - {<OpenLayers.Pixel>} Pixel location of the mouse event. |
|---|
| | 274 | */ |
|---|
| | 275 | dragStart: function(feature, pixel) { |
|---|
| | 276 | // only change behavior if the feature is not in the vertices array |
|---|
| | 277 | if(feature != this.feature && |
|---|
| | 278 | OpenLayers.Util.indexOf(this.vertices, feature) == -1 && |
|---|
| | 279 | OpenLayers.Util.indexOf(this.virtualVertices, feature) == -1) { |
|---|
| | 280 | if(this.feature) { |
|---|
| | 281 | // unselect the currently selected feature |
|---|
| | 282 | this.selectControl.clickFeature.apply(this.selectControl, |
|---|
| | 283 | [this.feature]); |
|---|
| | 284 | } |
|---|
| | 285 | // check any constraints on the geometry type |
|---|
| | 286 | if(this.geometryTypes == null || |
|---|
| | 287 | OpenLayers.Util.indexOf(this.geometryTypes, |
|---|
| | 288 | feature.geometry.CLASS_NAME) != -1) { |
|---|
| | 289 | // select the point |
|---|
| | 290 | this.selectControl.clickFeature.apply(this.selectControl, |
|---|
| | 291 | [feature]); |
|---|
| | 292 | /** |
|---|
| | 293 | * TBD: These lines improve workflow by letting the user |
|---|
| | 294 | * immediately start dragging after the mouse down. |
|---|
| | 295 | * However, it is very ugly to be messing with controls |
|---|
| | 296 | * and their handlers in this way. I'd like a better |
|---|
| | 297 | * solution if the workflow change is necessary. |
|---|
| | 298 | */ |
|---|
| | 299 | // prepare the point for dragging |
|---|
| | 300 | this.dragControl.overFeature.apply(this.dragControl, |
|---|
| | 301 | [feature]); |
|---|
| | 302 | this.dragControl.lastPixel = pixel; |
|---|
| | 303 | this.dragControl.dragHandler.started = true; |
|---|
| | 304 | this.dragControl.dragHandler.start = pixel; |
|---|
| | 305 | this.dragControl.dragHandler.last = pixel; |
|---|
| | 306 | } |
|---|
| | 307 | } |
|---|
| | 308 | }, |
|---|
| | 309 | |
|---|
| | 310 | /** |
|---|
| | 311 | * Method: dragVertex |
|---|
| | 312 | * Called by the drag feature control with each drag move of a vertex. |
|---|
| | 313 | * |
|---|
| | 314 | * Parameters: |
|---|
| | 315 | * vertex - {<OpenLayers.Feature.Vector>} The vertex being dragged. |
|---|
| | 316 | */ |
|---|
| | 317 | dragVertex: function(vertex) { |
|---|
| | 318 | if(this.feature.geometry.CLASS_NAME == "OpenLayers.Geometry.Point") { |
|---|
| | 319 | if(this.feature != vertex) { |
|---|
| | 320 | this.feature = vertex; |
|---|
| | 321 | } |
|---|
| | 322 | } else { |
|---|
| | 323 | if(OpenLayers.Util.indexOf(this.virtualVertices, vertex) != -1) { |
|---|
| | 324 | vertex.geometry.parent.addComponent(vertex.geometry, |
|---|
| | 325 | vertex._index); |
|---|
| | 326 | delete vertex._index; |
|---|
| | 327 | OpenLayers.Util.removeItem(this.virtualVertices, vertex); |
|---|
| | 328 | this.layer.removeFeatures(vertex); |
|---|
| | 329 | } |
|---|
| | 330 | } |
|---|
| | 331 | this.layer.drawFeature(this.feature, this.selectControl.selectStyle); |
|---|
| | 332 | this.layer.removeFeatures(this.virtualVertices); |
|---|
| | 333 | // keep the vertex on top so it gets the mouseout after dragging |
|---|
| | 334 | // this should be removed in favor of an option to draw under or |
|---|
| | 335 | // maintain node z-index |
|---|
| | 336 | this.layer.drawFeature(vertex); |
|---|
| | 337 | }, |
|---|
| | 338 | |
|---|
| | 339 | /** |
|---|
| | 340 | * Method: dragComplete |
|---|
| | 341 | * Called by the drag feature control when the feature dragging is complete. |
|---|
| | 342 | * |
|---|
| | 343 | * Parameters: |
|---|
| | 344 | * vertex - {<OpenLayers.Feature.Vector>} The vertex being dragged. |
|---|
| | 345 | */ |
|---|
| | 346 | dragComplete: function(vertex) { |
|---|
| | 347 | this.resetVertices(); |
|---|
| | 348 | this.onModification(this.feature); |
|---|
| | 349 | }, |
|---|
| | 350 | |
|---|
| | 351 | /** |
|---|
| | 352 | * Method: resetVertices |
|---|
| | 353 | */ |
|---|
| | 354 | resetVertices: function() { |
|---|
| | 355 | if(this.vertices.length > 0) { |
|---|
| | 356 | this.layer.removeFeatures(this.vertices); |
|---|
| | 357 | this.vertices = []; |
|---|
| | 358 | } |
|---|
| | 359 | if(this.virtualVertices.length > 0) { |
|---|
| | 360 | this.layer.removeFeatures(this.virtualVertices); |
|---|
| | 361 | this.virtualVertices = []; |
|---|
| | 362 | } |
|---|
| | 363 | if(this.feature.geometry.CLASS_NAME != "OpenLayers.Geometry.Point") { |
|---|
| | 364 | this.collectVertices(this.feature.geometry); |
|---|
| | 365 | this.layer.addFeatures(this.vertices); |
|---|
| | 366 | this.layer.addFeatures(this.virtualVertices); |
|---|
| | 367 | } |
|---|
| | 368 | }, |
|---|
| | 369 | |
|---|
| | 370 | /** |
|---|
| | 371 | * Method: handleKeypress |
|---|
| | 372 | * Called by the feature handler on keypress. This is used to delete |
|---|
| | 373 | * vertices and point features. If the <deleteCode> property is set, |
|---|
| | 374 | * vertices and points will be deleted when a feature is selected |
|---|
| | 375 | * for modification and the mouse is over a vertex. |
|---|
| | 376 | * |
|---|
| | 377 | * Parameters: |
|---|
| | 378 | * {Integer} Key code corresponding to the keypress event. |
|---|
| | 379 | */ |
|---|
| | 380 | handleKeypress: function(code) { |
|---|
| | 381 | // check for delete key |
|---|
| | 382 | if(OpenLayers.Util.indexOf(this.deleteCodes, code) != -1) { |
|---|
| | 383 | var vertex = this.dragControl.feature; |
|---|
| | 384 | if(vertex) { |
|---|
| | 385 | if(this.feature.geometry.CLASS_NAME == |
|---|
| | 386 | "OpenLayers.Geometry.Point") { |
|---|
| | 387 | // delete the point |
|---|
| | 388 | this.layer.removeFeatures([vertex]); |
|---|
| | 389 | } else { |
|---|
| | 390 | if(OpenLayers.Util.indexOf(this.vertices, vertex) != -1) { |
|---|
| | 391 | // remove the vertex |
|---|
| | 392 | vertex.geometry.parent.removeComponent(vertex.geometry); |
|---|
| | 393 | this.layer.drawFeature(this.feature, |
|---|
| | 394 | this.selectControl.selectStyle); |
|---|
| | 395 | this.resetVertices(); |
|---|
| | 396 | } |
|---|
| | 397 | } |
|---|
| | 398 | } |
|---|
| | 399 | } |
|---|
| | 400 | }, |
|---|
| | 401 | |
|---|
| | 402 | /** |
|---|
| | 403 | * Method: collectVertices |
|---|
| | 404 | * Collect the vertices from the modifiable feature's geometry and push |
|---|
| | 405 | * them on to the control's vertices array. |
|---|
| | 406 | */ |
|---|
| | 407 | collectVertices: function() { |
|---|
| | 408 | this.vertices = []; |
|---|
| | 409 | this.virtualVirtices = []; |
|---|
| | 410 | var control = this; |
|---|
| | 411 | function collectComponentVertices(geometry) { |
|---|
| | 412 | var i, vertex, component; |
|---|
| | 413 | if(geometry.CLASS_NAME == "OpenLayers.Geometry.Point") { |
|---|
| | 414 | vertex = new OpenLayers.Feature.Vector(geometry); |
|---|
| | 415 | control.vertices.push(vertex); |
|---|
| | 416 | } else { |
|---|
| | 417 | for(i=0; i<geometry.components.length; ++i) { |
|---|
| | 418 | component = geometry.components[i]; |
|---|
| | 419 | if(component.CLASS_NAME == "OpenLayers.Geometry.Point") { |
|---|
| | 420 | vertex = new OpenLayers.Feature.Vector(component); |
|---|
| | 421 | control.vertices.push(vertex); |
|---|
| | 422 | } else { |
|---|
| | 423 | collectComponentVertices(component); |
|---|
| | 424 | } |
|---|
| | 425 | } |
|---|
| | 426 | |
|---|
| | 427 | // add virtual vertices in the middle of each edge |
|---|
| | 428 | if(geometry.CLASS_NAME != "OpenLayers.Geometry.MultiPoint") { |
|---|
| | 429 | for(i=0; i<geometry.components.length-1; ++i) { |
|---|
| | 430 | var prevVertex = geometry.components[i]; |
|---|
| | 431 | var nextVertex = geometry.components[i + 1]; |
|---|
| | 432 | if(prevVertex.CLASS_NAME == "OpenLayers.Geometry.Point" && |
|---|
| | 433 | nextVertex.CLASS_NAME == "OpenLayers.Geometry.Point") { |
|---|
| | 434 | var x = (prevVertex.x + nextVertex.x) / 2; |
|---|
| | 435 | var y = (prevVertex.y + nextVertex.y) / 2; |
|---|
| | 436 | var point = new OpenLayers.Feature.Vector( |
|---|
| | 437 | new OpenLayers.Geometry.Point(x, y), |
|---|
| | 438 | null, control.styleVirtual |
|---|
| | 439 | ); |
|---|
| | 440 | // set the virtual parent and intended index |
|---|
| | 441 | point.geometry.parent = geometry; |
|---|
| | 442 | point._index = i + 1; |
|---|
| | 443 | control.virtualVertices.push(point); |
|---|
| | 444 | } |
|---|
| | 445 | } |
|---|
| | 446 | } |
|---|
| | 447 | } |
|---|
| | 448 | } |
|---|
| | 449 | collectComponentVertices(this.feature.geometry); |
|---|
| | 450 | }, |
|---|
| | 451 | |
|---|
| | 452 | /** |
|---|
| | 453 | * Method: setMap |
|---|
| | 454 | * Set the map property for the control and all handlers. |
|---|
| | 455 | * |
|---|
| | 456 | * Parameters: |
|---|
| | 457 | * map - {OpenLayers.Map} The control's map. |
|---|
| | 458 | */ |
|---|
| | 459 | setMap: function(map) { |
|---|
| | 460 | this.selectControl.setMap(map); |
|---|
| | 461 | this.dragControl.setMap(map); |
|---|
| | 462 | OpenLayers.Control.prototype.setMap.apply(this, arguments); |
|---|
| | 463 | }, |
|---|
| | 464 | |
|---|
| | 465 | CLASS_NAME: "OpenLayers.Control.ModifyFeature" |
|---|
| | 466 | }); |