[OpenLayers-Users] Cannot delete MultiPolygons completely

Tobias Reinicke ramotswa at gmail.com
Tue Sep 25 03:16:59 PDT 2012


Ok, do you have something like this in your code somewhere?
I can't remember where I got it from in the first place, but it will delete
all the features that have no fid anymore, which may help.



var DeleteFeature = OpenLayers.Class(OpenLayers.Control, {
    initialize: function (layer, options) {
        OpenLayers.Control.prototype.initialize.apply(this, [options]);
        this.layer = layer;
        this.handler = new OpenLayers.Handler.Feature(
            this, layer, { click: this.clickFeature }
        );
    },
    clickFeature: function (feature) {
        // if feature doesn't have a fid, destroy it
        if (feature.fid == undefined) {
            this.layer.destroyFeatures([feature]);
        } else {
            feature.state = OpenLayers.State.DELETE;
            this.layer.events.triggerEvent("afterfeaturemodified",
                                           { feature: feature });
            feature.renderIntent = "select";
            this.layer.drawFeature(feature);
        }
    },
    setMap: function (map) {
        this.handler.setMap(map);
        OpenLayers.Control.prototype.setMap.apply(this, arguments);
    },
    CLASS_NAME: "OpenLayers.Control.DeleteFeature"
});




Toby

On 25 September 2012 09:48, vGIS <valentino1s73s at gmx.net> wrote:

> The WFS-T Source is GeoServer and I also have a SaveStrategy and tryed your
> code, but it worked not for me. After saving, the features are still
> there...
>
>
>
> --
> View this message in context:
> http://osgeo-org.1560.n6.nabble.com/Cannot-delete-MultiPolygons-completely-tp5004085p5004210.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120925/be6336e5/attachment.html>


More information about the Users mailing list