Quantcast
Channel: DotSpatial Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1128

Commented Issue: Removing layer with map.layers.remove destroys underlying FS [23896]

$
0
0
When using map.layers.remove the underlying featureset is no longer available.

This is problematic when using IMPLs with another control to add/remove layers.
Comments: ** Comment from web user: danames **

Please try this code and let me know if it works for you. - Dan

```
//Create the feature set and lock it
DotSpatial.Data.IFeatureSet fs = DotSpatial.Data.FeatureSet.Open("C:\\Data\\USA\\cities.shp");
fs.LockDispose();

//Add the featureset to the map
DotSpatial.Controls.IMapLayer impl = map1.Layers.Add(fs);

//Remove the layer from the map
map1.Layers.Remove(impl);

//Add it again <----normally this would crash because fs is destroyed, but we locked it.
map1.Layers.Add(fs);
```


Viewing all articles
Browse latest Browse all 1128

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>