[OpenLayers-Users] Is it possible to delete a point using theModifyFeature control?

Arnd Wippermann arnd.wippermann at web.de
Wed May 14 13:55:49 EDT 2008


Hi Andreas,

For this task (delete a whole feature) I have overwriten
OpenLayers.Control.ModifyFeature.prototype.handleKeypress.
With the key "k" i kill a feature (only FF).

Mit freundlichen Grüssen

Arnd Wippermann
http://gis.ibbeck.de/ginfo/



OpenLayers.Control.ModifyFeature.prototype.handleKeypress = function(code) {
    /**
     * Method: handleKeypress
     * Called by the feature handler on keypress.  This is used to delete
     *     vertices and point features.  If the <deleteCode> property is
set,
     *     vertices and points will be deleted when a feature is selected
     *     for modification and the mouse is over a vertex.
     *
     * Parameters:
     * {Integer} Key code corresponding to the keypress event.
     */
    //handleKeypress: function(code) {
        // check for delete key
        if(this.feature && OpenLayers.Util.indexOf(this.deleteCodes, code)
!= -1 && code != 107)
        {
            var vertex = this.dragControl.feature;
            if(vertex &&
               OpenLayers.Util.indexOf(this.vertices, vertex) != -1) {
                // remove the vertex
                vertex.geometry.parent.removeComponent(vertex.geometry);
                this.layer.drawFeature(this.feature,
                                       this.selectControl.selectStyle);
                this.resetVertices();
                this.onModification(this.feature);
            }
        }
        else if(this.feature && OpenLayers.Util.indexOf(this.deleteCodes,
code) != -1 && code == 107)
        {
            var obj = this.feature;
            var lyr = obj.layer;
            this.unselectFeature(obj);
            lyr.removeFeatures(obj);
        }
}
 

-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von Andreas Hocevar
Gesendet: Mittwoch, 14. Mai 2008 08:15
An: OpenLayers Users
Betreff: [OpenLayers-Users] Is it possible to delete a point using
theModifyFeature control?

A question to all vector editing gurus:

Is it possible to make the ModifyFeature control delete a point by clicking
the Del button? I know that the Del button will delete vertices on
geometries, but what about points (only one vertex)?

Is there a simple workaround to delete the whole feature instead of a
vertex?

Thanks!
Andreas.
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list