The attached sample allows you to draw a line by using TrackInteractiveOverlay. Then, after the line have been created it is possible to start editing it by clicking on it.
To doing so I find the Feature on the mouse position with:
wpfMap1.TrackOverlay.TrackShapeLayer.FeatureSource.GetFeaturesNearestTo(WorldPos, GeographyUnit.Meter, 5, columnNames, distanceBuffer, DistanceUnit.Meter)
This returns the Feature under the mouse position properly, but then in this lines:
wpfMap1.EditOverlay.EditShapesLayer.InternalFeatures.Add(SelectingFeatures(k).Feature)
wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures.Remove(SelectingFeatures(k).Feature)
The first (adding to EditOverlay) works (i.e. the selected Feature is properly added to EditOverlay), but the second does not (i.e TrackShapeLayer.InternalFeatures.Remove does not seem to recognize the Feature returned by GetFeature and hence the feature is not removed)
I also tried using a transactions and FeatureSource as follows:
wpfMap1.EditOverlay.EditShapesLayer.FeatureSource.Open()
wpfMap1.EditOverlay.EditShapesLayer.FeatureSource.BeginTransaction()
wpfMap1.EditOverlay.EditShapesLayer.FeatureSource.AddFeature(SelectingFeatures(k).Feature)
wpfMap1.EditOverlay.EditShapesLayer.FeatureSource.CommitTransaction()
wpfMap1.TrackOverlay.TrackShapeLayer.FeatureSource.Open()
wpfMap1.TrackOverlay.TrackShapeLayer.FeatureSource.BeginTransaction()
wpfMap1.TrackOverlay.TrackShapeLayer.FeatureSource.DeleteFeature(SelectingFeatures(k).Feature.Id)
wpfMap1.TrackOverlay.TrackShapeLayer.FeatureSource.CommitTransaction()
With same results
In order to workarround the issue I ended up with:
For Each TrackOverlayFeature In WpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures
If TrackOverlayFeature.GetWellKnownText = Feature.GetWellKnownText Then
WpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures.Remove(TrackOverlayFeature)
Exit For
End If
Next
But I don't think is the best approach.
What I am missing?
As additional questions on TrackOverlay, Is it needed to BuildIndex and so on after adding and deleting features to the TrackShapeLayer / EditShapeLayers? It seems is not, but don't know why either
I'm using dlls version 6.0.200.0
TrackAndEditInteractive.zip (84.8 KB)