[OpenLayers-Dev] [OpenLayers-Users] Delete Feature

Arnd Wippermann arnd.wippermann at web.de
Sun Apr 13 16:10:13 EDT 2008


Hi,

i have enhanced the ModifyFeature Control, so that I can delete a feature
with the key 'k' like kill.

OpenLayers.Control.ModifyFeature.prototype.deleteCodes = [46, 100, 107]; 
//Backspace, d, k
OpenLayers.Control.ModifyFeature.prototype.handleKeypress = function(code) {

...
...
...

        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);
            msg ="201:" + code;
        }
        //alert(msg);
}

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


Benoit PESTY wrote:
> 
> 
> Hello,
> 
> I've discovered that my problem is link with the presence of the
> "ModifyFeature" control that changes the behaviour of the Select control.
> 
> I'm a bit lost with these controls and the removeFeatures/ eraseFeatures /
> destroyFeatures methods of the Vector class.
> 
> Does someone have a clean example of how to create an Editing Toolbar with
> :
> - The create point / line / polygone buttons
> - A Delete Feature button
> - A Modify Feature button
> 
> Thanks,
> 
> Tchule.
> 
> _________________________________________________________________
> Use video conversation to talk face-to-face with Windows Live Messenger.
> http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_Refresh_messenger_video_042008
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
> 
> 

-- 
View this message in context: http://www.nabble.com/-OpenLayers-Users--Delete-Feature-tp16628555p16667351.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.




More information about the Dev mailing list