public static readonly string UniqueKey = "StationLayer"; public override Overlay GetOverlay(bool google) { FeatureSourceMarkerOverlay markerOverlay = new FeatureSourceMarkerOverlay(UniqueKey); MsSql2008FeatureSource source = new MsSql2008FeatureSource(System.Configuration.ConfigurationManager.ConnectionStrings["Location"].ConnectionString, "stationLayer", "oid"); source.Srid = 0; markerOverlay.FeatureSource = source; markerOverlay.SuppressingGridSize = 100; PropertyInfo zoomProperty = typeof(MarkerZoomLevelSet).GetProperty(String.Format("ZoomLevel{0:00}", 5)); MarkerZoomLevel zoomLevel = (MarkerZoomLevel)zoomProperty.GetValue(markerOverlay.ZoomLevelSet, null); switch (LayersManager.Settings.UserSetting.StationsFilter) { case "pps": zoomLevel.CustomMarkerStyle = GetValueStyle("pps", "True", GetStyle()); break; case "klm": zoomLevel.CustomMarkerStyle = GetValueStyle("klm", "True", GetStyle()); break; case "dium": zoomLevel.CustomMarkerStyle = GetValueStyle("dium", "True", GetStyle()); break; default: zoomLevel.CustomMarkerStyle = GetStyle(); break; } zoomLevel.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; MapControl.CustomOverlays.Add(markerOverlay); } private PointMarkerStyle GetStyle() { WebImage image = new WebImage(String.Format("Images/Marks/{0}.png", LayersManager.Settings.UserSetting.IconStation), 16, 16, 0f, -16f); PointMarkerStyle style = new PointMarkerStyle(); style.WebImage = image; style.Popup.ContentHtml = "
Info ([#RailwayNumber#]) [#StationNumber#] [#Name#]
Dium
"; style.Popup.AutoSize = true; style.Popup.BackgroundColor = GeoColor.StandardColors.White; style.Popup.BorderColor = GeoColor.StandardColors.LightGray; style.Popup.BorderWidth = 1; return style; } private ValueMarkerStyle GetValueStyle(string columnName, string columnValue, MarkerStyle style) { System.Collections.ObjectModel.Collection values = new System.Collections.ObjectModel.Collection(); values.Add(new MarkerValueItem(columnValue, style)); ValueMarkerStyle newStyle = new ValueMarkerStyle(columnName, values); return newStyle; }