Quantcast
Channel: DotSpatial
Viewing all articles
Browse latest Browse all 3973

New Post: Working with in memory FeatureSet and Feature DotSpatial

$
0
0
Hello

Meanwhile I found the solution somewhere on this forum, and was posted by Jany
The idea is to call this pice of code after each action against a FeatureSet (add, remove, move)
                featureLayer.DataSet.UpdateExtent();
                featureLayer.DataSet.InitializeVertices();
                featureLayer.LabelLayer?.CreateLabels();
                if(save)
                {
                featureLayer.DataSet.Save();
                featureLayer.DataSet.Close();
                }
                featureLayer.AssignFastDrawnStates();
                AppManager.Map.Refresh();
                AppManager.Map.ResetBuffer();
where featureLayer is IFeatureLayer.

There is one problem:

If we save the project with AppManager.Serialization.SaveProject() and then open the project AppManager.Serialization.OpenProject() the issue appear again.
As a solution for this I call my Save method after open the project and on short is look like this:
public void Save()
{
     foreach(var featureLayer in AppManager.Map.GetPolygonLayers())
     {
         featureLayer.DataSet.Save();
    }
}
Hope that helps someone.

Viewing all articles
Browse latest Browse all 3973

Trending Articles



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