private void DrawMarkerOverlays(DataTable dt, ValueMarkerStyle myValueStyle) { DataView dv = dt.DefaultView; //Assertion does not fail so they are the same. Debug.Assert(dv.Count == dt.Rows.Count); IEnumerator iterator = dv.GetEnumerator(); DataRowView drv; System.Int32 i = 0; string lon = string.Empty; string lat = string.Empty; Double dlon = 0.0; Double dlat = 0.0; string desc = string.Empty; int state = 0; while (iterator.MoveNext()) { drv = (DataRowView)iterator.Current; lon = drv.Row["lLongitude"].ToString(); lat = drv.Row["lLatitude"].ToString(); if (VerifyLatLon(lat, lon)) { dlon = Convert.ToDouble(drv.Row["lLongitude"]); dlat = Convert.ToDouble(drv.Row["lLatitude"]); desc = drv.Row["szSiteDesc"].ToString(); CreateValueMarker(state, myValueStyle, dlon, dlat, desc); AppendFeatures(Map1.MarkerOverlay, state.ToString(), dlon, dlat); } i++; } } private void CreateValueMarker(Int32 state, ValueMarkerStyle vmStyle, double lon, double lat, string hoverText) { switch (state) { case 0: vmStyle.ValueItems.Add(new MarkerValueItem(state.ToString(), new PointMarkerStyle(new WebImage("/CrossingsMap/theme/default/img/marker_green.gif", 25, 25, -11.5F, -25F), CreatePopup(CreateKey(lat), lon, lat, hoverText), CreateContext(CreateKey(lat), lon, lat)))); break; case 1: vmStyle.ValueItems.Add(new MarkerValueItem(state.ToString(), new PointMarkerStyle(new WebImage("/CrossingsMap/theme/default/img/marker.gif", 25, 25, -11.5F, -25F), CreatePopup(CreateKey(lat), lon, lat, hoverText), CreateContext(CreateKey(lat), lon, lat)))); break; case 2: vmStyle.ValueItems.Add(new MarkerValueItem(state.ToString(), new PointMarkerStyle(new WebImage("/CrossingsMap/theme/default/img/marker_grey.gif", 25, 25, -11.5F, -25F), CreatePopup(CreateKey(lat), lon, lat, hoverText), CreateContext(CreateKey(lat), lon, lat)))); break; default: break; } } private CustomPopup CreatePopup(string key, double lon, double lat, string hoverText) { try { CustomPopup popup = new CustomPopup(); StringBuilder contentHtml = new StringBuilder(); //contentHtml.Append("
") contentHtml.Append("") .Append(hoverText) .Append(""); popup.ContentHtml = contentHtml.ToString(); popup.AutoSize = true; popup.BorderWidth = 1; popup.IsVisible = false; popup.AutoPan = true; Map1.MarkerOverlay.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; return popup; } catch { return null; } }