Hello,
I have an InMemoryMarkerOverlay defined to which I am adding icons to a particular point like so:
private void SetupInitialIconDisplay()
{
string lSiteId = string.Empty;
Double lLatitude = 0;
Double lLongitude = 0;
string szSiteDesc = string.Empty;
int DisplayState = 2;
string DisplayText = string.Empty;
InMemoryMarkerOverlay markerOverlay = new InMemoryMarkerOverlay();
markerOverlay.Name = "IconMarkerOverlay";
markerOverlay.MapControl = winformsMap1;
markerOverlay.Columns.Add(new FeatureSourceColumn("Name"));
foreach (DataRow row in dt.Rows)
{
lSiteId = row["lSiteID"].ToString();
lLatitude = Double.Parse(row["lLatitude"].ToString());
lLongitude = Double.Parse(row["lLongitude"].ToString());
szSiteDesc = row["szSiteDesc"].ToString();
DisplayState = int.Parse(row["DisplayState"].ToString());
DisplayText = row["DisplayText"].ToString();
markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultPointMarkerStyle.Image = GetImage(DisplayState);
Feature newFeature = new Feature(lLongitude, lLatitude, lSiteId);
newFeature.ColumnValues.Add("Name", szSiteDesc);
newFeature.Tag = lSiteId.ToString();
markerOverlay.FeatureSource.BeginTransaction();
markerOverlay.FeatureSource.AddFeature(newFeature);
markerOverlay.FeatureSource.CommitTransaction();
}
markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultPointMarkerStyle.Width = 20;
markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultPointMarkerStyle.Height = 34;
markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultPointMarkerStyle.XOffset = -9;
markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultPointMarkerStyle.YOffset = -25;
markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultPointMarkerStyle.ToolTipText = "[#Name#]";
markerOverlay.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
winformsMap1.Overlays.Add("MarkerOverlay", markerOverlay);
}
What is the best way to update an icon on a particular Feature?. Icons can be red, green, or grey.
For example, say all icons are red. The app receives an update indicating that one icon should be
changed to green. What code whould work in this case?
Thanks,
Steven