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

New Post: Working with in memory FeatureSet and Feature DotSpatial

$
0
0
Hello All
I'm a beginner with DotSpatial and I'm stuck with a problem. I try to work with in memory feature (to keep them only in Map) until the user hit save button. The basic idea is that the user imports some dxf files and creates featureset based on layer name if the FeatureSet doesn't all ready exist, and for each polyline from dxf creates feature which will be added into a featureset.

public IFeature AddPoligons(EntityObject polyline, List<Text> textInDxf)
{
IFeatureSet featureSet = null;
//Getting the right featureset from map
foreach (var x in appManager.Map.GetPolygonLayers())
{
    if (!string.Equals(x.DataSet.Name, layerName)) continue;

    featureSet = x.DataSet as FeatureSet;
    break;
}
var polygon = CreatePolygon(polyline);

//Creating feature and adding to FeatureSet
var feature = featureSet.AddFeature(polygon);

//Populating DataRow with information
AddinfoIntoDataTable(feature, polygon, textInDxf);
return feature;
}
Everything thing looks fine, the map is updated with new polygons, can select them, view information from datatable BUT, when I try to delete a selected feature (polygon) it throws an IndexOutOfRange exception.

What I'm doing wrong there?

Please help! Thank you and sorry for my poor English.

P.S. When I created the featureSet first I saved it on the disk and then loaded into map with Map.AddLayer() method.

Viewing all articles
Browse latest Browse all 3973

Latest Images

Trending Articles



Latest Images

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