Hi,
I am trying to edit shape on a map. The edit mode is trigger by single click on a shape. Then I display information about the shape and user can also moving the shape on the map.
Problem:
When user click on a shape, the shape is added to EditOverlay and related information is display on a datagrid. When user click on the shape again, it turns yellow (shape moving mode?), but it immediately turn back to blue. This is only the problem when I handle Map1_Click event. If I remove the Map1_Click event and just use the edit button like the one in the demo code, it works fine.
protected void Map1_Click(object sender, MapClickedEventArgs e)
{
FeatureLayer featureLayer = (FeatureLayer)CrashOverlay.Layers[ddlFeatureLayer.SelectedItem.Text];
if (!featureLayer.FeatureSource.IsOpen)
featureLayer.FeatureSource.Open();
Collection<feature></feature> selectedFeatures = featureLayer.QueryTools.GetFeaturesNearestTo(e.Position, GeographyUnit.Meter, 1,
ReturningColumnsType.AllColumns);
if (featureLayer.FeatureSource.IsOpen)
featureLayer.FeatureSource.Close();
foreach (Feature feature in selectedFeatures)
{
if(!(Map1.EditOverlay.Features.Count == 1 && Map1.EditOverlay.Features[0].Id == feature.Id))
{
Map1.EditOverlay.Features.Clear();
Map1.EditOverlay.Features.Add(feature.Id, feature);
BindFeatureAttributes(feature);
Map1.EditOverlay.TrackMode = TrackMode.Edit;
break;
}
}
}
any idea how to fix this?