Hi all,
I'm trying to follow the demo of the bounding box, and I'm just not having any luck. The problem occurs when I'm trying to create the InMemoryFeatureSource. VS gives me an error stating 'An Item with the same key has already been added.' I assumed this was an error on my part, but wasn't sure. I started looking into the API, however, and I can't figure out the constructor for the InMemoryFeatureSource. Why is the first IEnumberable<FeatureSourceColumn> needed? Maybe I just don't understand the purpose of the class, but shouldn't the second list of <Features> take care of anything the first list would need? Code follows, if it's of any use, though it's not working.
public void GetBoundingBoxByInMemoryMarkerOverlay(InMemoryMarkerOverlay inMem)
{
if (inMem.Features.Count > 1)
{
Collection<Feature> features = new Collection<Feature>();
foreach(string key in inMem.Features.Keys){
features.Add(inMem.Features[key]);
}
InMemoryFeatureSource inMemSource = new InMemoryFeatureSource(new List<FeatureSourceColumn>(), features);
inMemSource.Open();
MainMap.CurrentExtent = inMemSource.GetBoundingBox();
inMemSource.Close();
}
}