Based on a suggestion here, I've implemented a custom InMemoryFeatureSource which overrides GetFeaturesForDrawingCore to return a collection of just the features I've changed. Unfortunately, the application then only updates the first N features in the entire collection, not the subset I've changed. I.e. if I have 800 features and have randomly updated 100 of them, only the first 100 in the collection are getting re-drawn. Have I misunderstood how GetFeaturesForDrawingCore is supposed to work? I will have thousands of features and want all of the un-changed features to stay just as they were. Is there a fleshed-out sample that I could use for this?
Janene
public class HighSpeedInMemoryFeatureSource : ThinkGeo.MapSuite.Core.InMemoryFeatureSource
{
private Collection<Feature> dirtyFeatures = null;
public HighSpeedInMemoryFeatureSource(IEnumerable<FeatureSourceColumn> featureSourceColumns)
: base(featureSourceColumns)
{
this.dirtyFeatures = new Collection<Feature>();
}
public HighSpeedInMemoryFeatureSource(IEnumerable<FeatureSourceColumn> featureSourceColumns, IEnumerable<Feature> features)
: base(featureSourceColumns, features)
{
this.dirtyFeatures = new Collection<Feature>();
}
public HighSpeedInMemoryFeatureSource(IEnumerable<FeatureSourceColumn> featureSourceColumns, IEnumerable<BaseShape> shapes)
: base(featureSourceColumns, shapes)
{
this.dirtyFeatures = new Collection<Feature>();
}
protected override Collection<Feature> GetFeaturesForDrawingCore(RectangleShape boundingBox,
double screenWidth, double screenHeight, IEnumerable<string> returningColumnNames1)
{
if (dirtyFeatures.Count != 0) {
// Just return all the dirty features.
return dirtyFeatures;
}
Collection<Feature> drawingFeatures = new Collection<Feature>();
foreach (Feature feature in InternalFeatures) {
drawingFeatures.Add(feature);
} return drawingFeatures;
}
public void addDirtyFeature(Feature dirtyF)
{
this.dirtyFeatures.Add(dirtyF);
}
public void ClearDirtyFeatures()
{
this.dirtyFeatures.Clear();
}
}
public class HighSpeedInMemoryFeatureLayer : InMemoryFeatureLayer
{
public HighSpeedInMemoryFeatureLayer()
: this(new Collection<FeatureSourceColumn>())
{
}
public HighSpeedInMemoryFeatureLayer(IEnumerable<FeatureSourceColumn> featureSourceColumns)
{
// Create our new improved feature source and set it.
this.FeatureSource = new HighSpeedInMemoryFeatureSource(featureSourceColumns);
}
public HighSpeedInMemoryFeatureLayer(HighSpeedInMemoryFeatureSource source)
{
// Create our new improved feature source and set it.
this.FeatureSource = source;
}
}