OpenLayers OpenLayers

Changeset 4025

Show
Ignore:
Timestamp:
08/24/07 13:15:44 (1 year ago)
Author:
pgiraud
Message:

deleteVertex control has a removeFeature control to work, added example to show that, next step is probably to get modifyFeature control having a removeFeature control

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/camptocamp/feature/lib/OpenLayers/Control/DeleteVertex.js

    r3983 r4025  
    4141     * @private 
    4242     */ 
    43     selectVertexControl: null, 
     43    removeControl: null, 
    4444     
    4545    /** 
     
    8484                                        control.onUnselect.apply(control, [feature]); 
    8585                                     }}); 
    86         this.selectVertexControl = new OpenLayers.Control.SelectFeature(layer, 
     86        this.removeControl = new OpenLayers.Control.RemoveFeature(layer, 
    8787                                    {geometryTypes: ["OpenLayers.Geometry.Point"], 
    88                                      onSelect: function(feature) { 
    89                                         control.onSelectVertex.apply(control, [feature]); 
    90                                      }, 
    91                                      multiple: true 
     88                                     onDone: function(feature) { 
     89                                        control.onRemoveVertex.apply(control, [feature]); 
     90                                     } 
    9291                                    }); 
     92        // TBD check if this could be done in the contructor 
     93        this.removeControl.selectControl.multiple = true; 
    9394    }, 
    9495 
     
    117118             
    118119            // TBD check this 
    119             this.selectVertexControl.deactivate(); 
     120            this.removeControl.deactivate(); 
    120121             
    121122            this.selectControl.deactivate(); 
     
    137138        this.collectVertices(feature.geometry); 
    138139        this.layer.addFeatures(this.vertices); 
    139         this.selectVertexControl.activate(); 
     140        this.removeControl.activate(); 
    140141        this.onModificationStart(this.feature); 
    141142    }, 
     
    150151        this.vertices = []; 
    151152        this.feature = null; 
    152         this.selectVertexControl.deactivate(); 
     153        this.removeControl.deactivate(); 
    153154        this.onModificationEnd(feature); 
    154155    }, 
    155156     
    156157    /** 
    157      * Called by the select vertex control selects a vertex feature. 
     158     * Called by the remove feature control selects a vertex feature. 
    158159     * @param {OpenLayers.Feature.Vector} vertex 
    159160     */ 
    160     onSelectVertex: function(vertex) { 
     161    onRemoveVertex: function(vertex) { 
    161162        vertex.geometry.parent.removeComponent(vertex.geometry); 
    162163        this.layer.removeFeatures(this.vertices); 
     
    200201    setMap: function(map) { 
    201202        this.selectControl.setMap(map); 
    202         this.selectVertexControl.setMap(map); 
     203        this.removeControl.setMap(map); 
    203204        OpenLayers.Control.prototype.setMap.apply(this, arguments); 
    204205    },