private LegendAdornmentLayer GetEarthquakeLegendLayer(EarthquakeIsoLineFeatureLayer earthquakeFeatureLayer)
        {
            LegendAdornmentLayer isoLevelLegendLayer = null;

            if (mapControl.AdornmentOverlay.Layers.Contains(Resources.IsoLineLevelLegendLayerName))
            {
                isoLevelLegendLayer = (LegendAdornmentLayer)mapControl.AdornmentOverlay.Layers[Resources.IsoLineLevelLegendLayerName];
            }
            else if (earthquakeFeatureLayer != null)
            {
                isoLevelLegendLayer                   = new LegendAdornmentLayer();
                isoLevelLegendLayer.Width             = 85;
                isoLevelLegendLayer.Height            = 320;
                isoLevelLegendLayer.Location          = AdornmentLocation.LowerRight;
                isoLevelLegendLayer.ContentResizeMode = LegendContentResizeMode.Fixed;
                mapControl.AdornmentOverlay.Layers.Add(Resources.IsoLineLevelLegendLayerName, isoLevelLegendLayer);

                LegendItem flagLegendItem = new LegendItem();
                flagLegendItem.TextStyle       = new TextStyle("Magnitude", new GeoFont("Arial", 10), new GeoSolidBrush(GeoColor.StandardColors.Black));
                flagLegendItem.TextLeftPadding = -20;
                isoLevelLegendLayer.LegendItems.Add(flagLegendItem);

                for (int i = 0; i < earthquakeFeatureLayer.IsoLineLevels.Count; i++)
                {
                    LegendItem legendItem = new LegendItem();
                    legendItem.TextStyle  = new TextStyle(earthquakeFeatureLayer.IsoLineLevels[i].ToString("f2"), new GeoFont("Arial", 10), new GeoSolidBrush(GeoColor.StandardColors.Black));
                    legendItem.ImageStyle = earthquakeFeatureLayer.LevelClassBreakStyle.ClassBreaks[i].DefaultAreaStyle;
                    legendItem.ImageWidth = 25;

                    isoLevelLegendLayer.LegendItems.Add(legendItem);
                }
            }

            return(isoLevelLegendLayer);
        }
        private void AddEarthquakeLayers()
        {
            LayerOverlay earthquakeOverlay = new LayerOverlay("EarthquakeOverlay");

            //earthquakeOverlay.TileType = TileType.SingleTile;
            earthquakeOverlay.IsVisibleInOverlaySwitcher = false;
            Map1.CustomOverlays.Add(earthquakeOverlay);

            Proj4Projection proj4 = new Proj4Projection();

            proj4.InternalProjectionParametersString = Proj4Projection.GetDecimalDegreesParametersString();
            proj4.ExternalProjectionParametersString = Proj4Projection.GetSphericalMercatorParametersString();

            string dataShapefileFilePath = Server.MapPath(ConfigurationManager.AppSettings["statesPathFileName"]);

            EarthquakeHeatFeatureLayer heatLayer = new EarthquakeHeatFeatureLayer(new ShapeFileFeatureSource(dataShapefileFilePath));

            heatLayer.HeatStyle = new HeatStyle(10, 180, "MAGNITUDE", 0, 12, 100, DistanceUnit.Kilometer);
            heatLayer.FeatureSource.Projection = proj4;
            earthquakeOverlay.Layers.Add("Heat Map", heatLayer);

            ShapeFileFeatureLayer pointLayer = new ShapeFileFeatureLayer(dataShapefileFilePath);

            pointLayer.FeatureSource.Projection = proj4;
            pointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.Red, 6, GeoColor.StandardColors.White, 1);
            pointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            pointLayer.IsVisible = false;
            earthquakeOverlay.Layers.Add("Regular Point Map", pointLayer);

            EarthquakeIsoLineFeatureLayer isoLineLayer = new EarthquakeIsoLineFeatureLayer(new ShapeFileFeatureSource(dataShapefileFilePath));

            isoLineLayer.FeatureSource.Projection = proj4;
            isoLineLayer.IsVisible = false;
            earthquakeOverlay.Layers.Add("IsoLines Map", isoLineLayer);
        }
        public void SetEarthquakeLegendsVisible(Layer currentLayer)
        {
            EarthquakeIsoLineFeatureLayer earthquakeFeatureLayer = currentLayer as EarthquakeIsoLineFeatureLayer;
            LegendAdornmentLayer          earthquakeLegendLayer  = GetEarthquakeLegendLayer(earthquakeFeatureLayer);

            if (earthquakeLegendLayer != null)
            {
                earthquakeLegendLayer.IsVisible = earthquakeFeatureLayer != null;
            }
        }
        private void AddAdormentLayers()
        {
            // ScaleBar
            ScaleBarAdornmentLayer scaleBarAdormentLayer = new ScaleBarAdornmentLayer();

            scaleBarAdormentLayer.XOffsetInPixel = 10;
            scaleBarAdormentLayer.UnitFamily     = UnitSystem.Metric;
            Map1.AdornmentOverlay.Layers.Add("ScaleBarAdormentLayer", scaleBarAdormentLayer);

            // Isoline legend adorment layer
            LegendAdornmentLayer isoLevelLegendLayer = new LegendAdornmentLayer();

            isoLevelLegendLayer.IsVisible         = false;
            isoLevelLegendLayer.Width             = 85;
            isoLevelLegendLayer.Height            = 320;
            isoLevelLegendLayer.Location          = AdornmentLocation.LowerRight;
            isoLevelLegendLayer.ContentResizeMode = LegendContentResizeMode.Fixed;

            LegendItem legendTitle = new LegendItem();

            legendTitle.TextStyle       = new TextStyle("Magnitude", new GeoFont("Arial", 10), new GeoSolidBrush(GeoColor.StandardColors.Black));
            legendTitle.TextLeftPadding = -20;
            isoLevelLegendLayer.LegendItems.Add(legendTitle);   // add legend title

            // Legend items
            LayerOverlay earthquakeOverlay             = Map1.CustomOverlays["EarthquakeOverlay"] as LayerOverlay;
            EarthquakeIsoLineFeatureLayer isoLineLayer = earthquakeOverlay.Layers["IsoLines Map"] as EarthquakeIsoLineFeatureLayer;

            for (int i = 0; i < isoLineLayer.IsoLineLevels.Count; i++)
            {
                LegendItem legendItem = new LegendItem();
                legendItem.TextStyle  = new TextStyle(isoLineLayer.IsoLineLevels[i].ToString("f2"), new GeoFont("Arial", 10), new GeoSolidBrush(GeoColor.StandardColors.Black));
                legendItem.ImageStyle = isoLineLayer.LevelClassBreakStyle.ClassBreaks[i].CustomStyles[0];
                legendItem.ImageWidth = 25;

                isoLevelLegendLayer.LegendItems.Add(legendItem);
            }

            Map1.AdornmentOverlay.Layers.Add("IsoLineLevelLegendLayer", isoLevelLegendLayer);
        }
        private void InitializeOverlays()
        {
            string cacheFolder = Path.Combine(Path.GetTempPath(), "TileCache");

            WorldMapKitWmsWpfOverlay worldMapKitRoadOverlay = new WorldMapKitWmsWpfOverlay();
            worldMapKitRoadOverlay.Name = Resources.WorldMapKitOverlayRoadName;
            worldMapKitRoadOverlay.TileHeight = 512;
            worldMapKitRoadOverlay.TileWidth = 512;
            worldMapKitRoadOverlay.Projection = WorldMapKitProjection.SphericalMercator;
            worldMapKitRoadOverlay.MapType = WorldMapKitMapType.Road;
            worldMapKitRoadOverlay.IsVisible = true;
            worldMapKitRoadOverlay.TileCache = new FileBitmapTileCache(cacheFolder, Resources.WorldMapKitOverlayRoadName);
            mapControl.Overlays.Add(worldMapKitRoadOverlay);

            WorldMapKitWmsWpfOverlay worldMapKitAerialOverlay = new WorldMapKitWmsWpfOverlay();
            worldMapKitAerialOverlay.Name = Resources.WorldMapKitOverlayAerialName;
            worldMapKitAerialOverlay.TileHeight = 512;
            worldMapKitAerialOverlay.TileWidth = 512;
            worldMapKitAerialOverlay.Projection = WorldMapKitProjection.SphericalMercator;
            worldMapKitAerialOverlay.MapType = WorldMapKitMapType.Aerial;
            worldMapKitAerialOverlay.IsVisible = false;
            worldMapKitAerialOverlay.TileCache = new FileBitmapTileCache(cacheFolder, Resources.WorldMapKitOverlayAerialName);
            mapControl.Overlays.Add(worldMapKitAerialOverlay);

            WorldMapKitWmsWpfOverlay worldMapKitAerialWithLabelsOverlay = new WorldMapKitWmsWpfOverlay();
            worldMapKitAerialWithLabelsOverlay.Name = Resources.WorldMapKitOverlayAerialWithLabelsName;
            worldMapKitAerialWithLabelsOverlay.TileHeight = 512;
            worldMapKitAerialWithLabelsOverlay.TileWidth = 512;
            worldMapKitAerialWithLabelsOverlay.Projection = WorldMapKitProjection.SphericalMercator;
            worldMapKitAerialWithLabelsOverlay.MapType = WorldMapKitMapType.AerialWithLabels;
            worldMapKitAerialWithLabelsOverlay.IsVisible = false;
            worldMapKitAerialWithLabelsOverlay.TileCache = new FileBitmapTileCache(cacheFolder, Resources.WorldMapKitOverlayAerialWithLabelsName);
            mapControl.Overlays.Add(worldMapKitAerialWithLabelsOverlay);

            OpenStreetMapOverlay openStreetMapOverlay = new OpenStreetMapOverlay();
            openStreetMapOverlay.Name = Resources.OSMOverlayName;
            openStreetMapOverlay.TileHeight = 512;
            openStreetMapOverlay.TileWidth = 512;
            openStreetMapOverlay.IsVisible = false;
            openStreetMapOverlay.TileCache = new FileBitmapTileCache(cacheFolder, Resources.OSMOverlayName);
            mapControl.Overlays.Add(openStreetMapOverlay);

            BingMapsOverlay bingMapsAerialOverlay = new BingMapsOverlay();
            bingMapsAerialOverlay.Name = Resources.BingMapsAerialOverlayName;
            bingMapsAerialOverlay.TileHeight = 512;
            bingMapsAerialOverlay.TileWidth = 512;
            bingMapsAerialOverlay.MapType = BingMapsMapType.Aerial;
            bingMapsAerialOverlay.IsVisible = false;
            bingMapsAerialOverlay.TileCache = new FileBitmapTileCache(cacheFolder, Resources.BingMapsAerialOverlayName);
            mapControl.Overlays.Add(bingMapsAerialOverlay);

            BingMapsOverlay bingMapsRoadOverlay = new BingMapsOverlay();
            bingMapsRoadOverlay.Name = Resources.BingMapsRoadOverlayName;
            bingMapsRoadOverlay.TileHeight = 512;
            bingMapsRoadOverlay.TileWidth = 512;
            bingMapsRoadOverlay.MapType = BingMapsMapType.Road;
            bingMapsRoadOverlay.IsVisible = false;
            bingMapsRoadOverlay.TileCache = new FileBitmapTileCache(cacheFolder, Resources.BingMapsRoadOverlayName);
            mapControl.Overlays.Add(bingMapsRoadOverlay);

            LayerOverlay styleLayersOverLay = new LayerOverlay();
            styleLayersOverLay.TileType = TileType.SingleTile;
            mapControl.Overlays.Add(Resources.StyleLayerOverLayKey, styleLayersOverLay);

            ManagedProj4Projection wgs84ToMercatorProjection = new ManagedProj4Projection();
            wgs84ToMercatorProjection.InternalProjectionParametersString = ManagedProj4Projection.GetDecimalDegreesParametersString();
            wgs84ToMercatorProjection.ExternalProjectionParametersString = ManagedProj4Projection.GetSphericalMercatorParametersString();

            EarthquakeHeatFeatureLayer heatLayer = new EarthquakeHeatFeatureLayer(new ShapeFileFeatureSource(ConfigurationManager.AppSettings["DataShapefileFileName"]));
            heatLayer.HeatStyle = new HeatStyle(10, 100, Resources.MagnitudeColumnName, 0, 12, 100, DistanceUnit.Kilometer);
            heatLayer.FeatureSource.Projection = wgs84ToMercatorProjection;
            heatLayer.Name = Resources.HeatStyleLayerName;
            styleLayersOverLay.Layers.Add(heatLayer);

            ShapeFileFeatureLayer pointLayer = new ShapeFileFeatureLayer(ConfigurationManager.AppSettings["DataShapefileFileName"]);
            pointLayer.FeatureSource.Projection = wgs84ToMercatorProjection;
            pointLayer.Name = Resources.PointStyleLayerName;
            pointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.Red, 6, GeoColor.StandardColors.White, 1);
            pointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            styleLayersOverLay.Layers.Add(pointLayer);

            EarthquakeIsoLineFeatureLayer isoLineLayer = new EarthquakeIsoLineFeatureLayer(new ShapeFileFeatureSource(ConfigurationManager.AppSettings["DataShapefileFileName"]));
            isoLineLayer.FeatureSource.Projection = wgs84ToMercatorProjection;
            isoLineLayer.Name = Resources.IsolineStyleLayerName;
            styleLayersOverLay.Layers.Add(isoLineLayer);

            //Setup TarckOverlay.
            mapControl.TrackOverlay = new RadiusMearsureTrackInteractiveOverlay(DistanceUnit.Mile, mapControl.MapUnit);
            mapControl.TrackOverlay.TrackEnded += TrackOverlay_TrackEnded;

            LayerOverlay markerOverlay = new LayerOverlay();
            mapControl.Overlays.Add(Resources.MarkerOverlayKey, markerOverlay);

            PointStyle highLightStyle = new PointStyle();
            highLightStyle.CustomPointStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(50, GeoColor.SimpleColors.Blue), 20, GeoColor.SimpleColors.LightBlue, 1));
            highLightStyle.CustomPointStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.LightBlue, 9, GeoColor.SimpleColors.Blue, 1));

            markerMemoryLayer = new InMemoryFeatureLayer();
            markerMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.Orange, 8, GeoColor.SimpleColors.White, 1);
            markerMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            markerOverlay.Layers.Add(markerMemoryLayer);

            markerMemoryHighlightLayer = new InMemoryFeatureLayer();
            markerMemoryHighlightLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = highLightStyle;
            markerMemoryHighlightLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            markerOverlay.Layers.Add(markerMemoryHighlightLayer);

            ScaleBarAdornmentLayer scaleBarAdornmentLayer = new ScaleBarAdornmentLayer();
            scaleBarAdornmentLayer.UnitFamily = UnitSystem.Imperial;
            mapControl.AdornmentOverlay.Layers.Add(scaleBarAdornmentLayer);
        }
        private LegendAdornmentLayer GetEarthquakeLegendLayer(EarthquakeIsoLineFeatureLayer earthquakeFeatureLayer)
        {
            LegendAdornmentLayer isoLevelLegendLayer = null;
            if (mapControl.AdornmentOverlay.Layers.Contains(Resources.IsoLineLevelLegendLayerName))
            {
                isoLevelLegendLayer = (LegendAdornmentLayer)mapControl.AdornmentOverlay.Layers[Resources.IsoLineLevelLegendLayerName];
            }
            else if (earthquakeFeatureLayer != null)
            {
                isoLevelLegendLayer = new LegendAdornmentLayer();
                isoLevelLegendLayer.Width = 85;
                isoLevelLegendLayer.Height = 320;
                isoLevelLegendLayer.Location = AdornmentLocation.LowerRight;
                isoLevelLegendLayer.ContentResizeMode = LegendContentResizeMode.Fixed;
                mapControl.AdornmentOverlay.Layers.Add(Resources.IsoLineLevelLegendLayerName, isoLevelLegendLayer);

                LegendItem flagLegendItem = new LegendItem();
                flagLegendItem.TextStyle = new TextStyle("Magnitude", new GeoFont("Arial", 10), new GeoSolidBrush(GeoColor.StandardColors.Black));
                flagLegendItem.TextLeftPadding = -20;
                isoLevelLegendLayer.LegendItems.Add(flagLegendItem);

                for (int i = 0; i < earthquakeFeatureLayer.IsoLineLevels.Count; i++)
                {
                    LegendItem legendItem = new LegendItem();
                    legendItem.TextStyle = new TextStyle(earthquakeFeatureLayer.IsoLineLevels[i].ToString("f2"), new GeoFont("Arial", 10), new GeoSolidBrush(GeoColor.StandardColors.Black));
                    legendItem.ImageStyle = earthquakeFeatureLayer.LevelClassBreakStyle.ClassBreaks[i].DefaultAreaStyle;
                    legendItem.ImageWidth = 25;

                    isoLevelLegendLayer.LegendItems.Add(legendItem);
                }
            }

            return isoLevelLegendLayer;
        }
        private void InitializeOverlays()
        {
            string cacheFolder = Path.Combine(Path.GetTempPath(), "TileCache");

            WorldMapKitWmsWpfOverlay worldMapKitRoadOverlay = new WorldMapKitWmsWpfOverlay();

            worldMapKitRoadOverlay.Name       = Resources.WorldMapKitOverlayRoadName;
            worldMapKitRoadOverlay.TileHeight = 512;
            worldMapKitRoadOverlay.TileWidth  = 512;
            worldMapKitRoadOverlay.Projection = WorldMapKitProjection.SphericalMercator;
            worldMapKitRoadOverlay.MapType    = WorldMapKitMapType.Road;
            worldMapKitRoadOverlay.IsVisible  = true;
            worldMapKitRoadOverlay.TileCache  = new FileBitmapTileCache(cacheFolder, Resources.WorldMapKitOverlayRoadName);
            mapControl.Overlays.Add(worldMapKitRoadOverlay);

            WorldMapKitWmsWpfOverlay worldMapKitAerialOverlay = new WorldMapKitWmsWpfOverlay();

            worldMapKitAerialOverlay.Name       = Resources.WorldMapKitOverlayAerialName;
            worldMapKitAerialOverlay.TileHeight = 512;
            worldMapKitAerialOverlay.TileWidth  = 512;
            worldMapKitAerialOverlay.Projection = WorldMapKitProjection.SphericalMercator;
            worldMapKitAerialOverlay.MapType    = WorldMapKitMapType.Aerial;
            worldMapKitAerialOverlay.IsVisible  = false;
            worldMapKitAerialOverlay.TileCache  = new FileBitmapTileCache(cacheFolder, Resources.WorldMapKitOverlayAerialName);
            mapControl.Overlays.Add(worldMapKitAerialOverlay);

            WorldMapKitWmsWpfOverlay worldMapKitAerialWithLabelsOverlay = new WorldMapKitWmsWpfOverlay();

            worldMapKitAerialWithLabelsOverlay.Name       = Resources.WorldMapKitOverlayAerialWithLabelsName;
            worldMapKitAerialWithLabelsOverlay.TileHeight = 512;
            worldMapKitAerialWithLabelsOverlay.TileWidth  = 512;
            worldMapKitAerialWithLabelsOverlay.Projection = WorldMapKitProjection.SphericalMercator;
            worldMapKitAerialWithLabelsOverlay.MapType    = WorldMapKitMapType.AerialWithLabels;
            worldMapKitAerialWithLabelsOverlay.IsVisible  = false;
            worldMapKitAerialWithLabelsOverlay.TileCache  = new FileBitmapTileCache(cacheFolder, Resources.WorldMapKitOverlayAerialWithLabelsName);
            mapControl.Overlays.Add(worldMapKitAerialWithLabelsOverlay);

            OpenStreetMapOverlay openStreetMapOverlay = new OpenStreetMapOverlay();

            openStreetMapOverlay.Name       = Resources.OSMOverlayName;
            openStreetMapOverlay.TileHeight = 512;
            openStreetMapOverlay.TileWidth  = 512;
            openStreetMapOverlay.IsVisible  = false;
            openStreetMapOverlay.TileCache  = new FileBitmapTileCache(cacheFolder, Resources.OSMOverlayName);
            mapControl.Overlays.Add(openStreetMapOverlay);

            BingMapsOverlay bingMapsAerialOverlay = new BingMapsOverlay();

            bingMapsAerialOverlay.Name       = Resources.BingMapsAerialOverlayName;
            bingMapsAerialOverlay.TileHeight = 512;
            bingMapsAerialOverlay.TileWidth  = 512;
            bingMapsAerialOverlay.MapType    = Wpf.BingMapsMapType.Aerial;
            bingMapsAerialOverlay.IsVisible  = false;
            bingMapsAerialOverlay.TileCache  = new FileBitmapTileCache(cacheFolder, Resources.BingMapsAerialOverlayName);
            mapControl.Overlays.Add(bingMapsAerialOverlay);

            BingMapsOverlay bingMapsRoadOverlay = new BingMapsOverlay();

            bingMapsRoadOverlay.Name       = Resources.BingMapsRoadOverlayName;
            bingMapsRoadOverlay.TileHeight = 512;
            bingMapsRoadOverlay.TileWidth  = 512;
            bingMapsRoadOverlay.MapType    = Wpf.BingMapsMapType.Road;
            bingMapsRoadOverlay.IsVisible  = false;
            bingMapsRoadOverlay.TileCache  = new FileBitmapTileCache(cacheFolder, Resources.BingMapsRoadOverlayName);
            mapControl.Overlays.Add(bingMapsRoadOverlay);

            LayerOverlay styleLayersOverLay = new LayerOverlay();

            styleLayersOverLay.TileType = TileType.SingleTile;
            mapControl.Overlays.Add(Resources.StyleLayerOverLayKey, styleLayersOverLay);

            Proj4Projection wgs84ToMercatorProjection = new Proj4Projection();

            wgs84ToMercatorProjection.InternalProjectionParametersString = Proj4Projection.GetDecimalDegreesParametersString();
            wgs84ToMercatorProjection.ExternalProjectionParametersString = Proj4Projection.GetSphericalMercatorParametersString();

            EarthquakeHeatFeatureLayer heatLayer = new EarthquakeHeatFeatureLayer(new ShapeFileFeatureSource(ConfigurationManager.AppSettings["DataShapefileFileName"]));

            heatLayer.HeatStyle = new HeatStyle(10, 100, Resources.MagnitudeColumnName, 0, 12, 100, DistanceUnit.Kilometer);
            heatLayer.FeatureSource.Projection = wgs84ToMercatorProjection;
            heatLayer.Name = Resources.HeatStyleLayerName;
            styleLayersOverLay.Layers.Add(heatLayer);

            ShapeFileFeatureLayer pointLayer = new ShapeFileFeatureLayer(ConfigurationManager.AppSettings["DataShapefileFileName"]);

            pointLayer.FeatureSource.Projection = wgs84ToMercatorProjection;
            pointLayer.Name = Resources.PointStyleLayerName;
            pointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.Red, 6, GeoColor.StandardColors.White, 1);
            pointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            styleLayersOverLay.Layers.Add(pointLayer);

            EarthquakeIsoLineFeatureLayer isoLineLayer = new EarthquakeIsoLineFeatureLayer(new ShapeFileFeatureSource(ConfigurationManager.AppSettings["DataShapefileFileName"]));

            isoLineLayer.FeatureSource.Projection = wgs84ToMercatorProjection;
            isoLineLayer.Name = Resources.IsolineStyleLayerName;
            styleLayersOverLay.Layers.Add(isoLineLayer);

            //Setup TarckOverlay.
            mapControl.TrackOverlay             = new RadiusMearsureTrackInteractiveOverlay(DistanceUnit.Mile, mapControl.MapUnit);
            mapControl.TrackOverlay.TrackEnded += TrackOverlay_TrackEnded;

            LayerOverlay markerOverlay = new LayerOverlay();

            mapControl.Overlays.Add(Resources.MarkerOverlayKey, markerOverlay);

            PointStyle highLightStyle = new PointStyle();

            highLightStyle.CustomPointStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(50, GeoColor.SimpleColors.Blue), 20, GeoColor.SimpleColors.LightBlue, 1));
            highLightStyle.CustomPointStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.LightBlue, 9, GeoColor.SimpleColors.Blue, 1));

            markerMemoryLayer = new InMemoryFeatureLayer();
            markerMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.Orange, 8, GeoColor.SimpleColors.White, 1);
            markerMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            markerOverlay.Layers.Add(markerMemoryLayer);

            markerMemoryHighlightLayer = new InMemoryFeatureLayer();
            markerMemoryHighlightLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = highLightStyle;
            markerMemoryHighlightLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            markerOverlay.Layers.Add(markerMemoryHighlightLayer);

            ScaleBarAdornmentLayer scaleBarAdornmentLayer = new ScaleBarAdornmentLayer();

            scaleBarAdornmentLayer.UnitFamily = UnitSystem.Imperial;
            mapControl.AdornmentOverlay.Layers.Add(scaleBarAdornmentLayer);
        }
        private void InitializeOverlays()
        {
            string cacheFolder = Path.Combine(Path.GetTempPath(), "TileCache");

            WorldMapKitWmsDesktopOverlay worldMapKitRoadOverlay = new WorldMapKitWmsDesktopOverlay();

            worldMapKitRoadOverlay.Name       = Resources.WorldMapKitRoadOverlay;
            worldMapKitRoadOverlay.Projection = WorldMapKitProjection.SphericalMercator;
            worldMapKitRoadOverlay.IsVisible  = true;
            worldMapKitRoadOverlay.TileCache  = new FileBitmapTileCache(cacheFolder, Resources.WorldMapKitRoadOverlay);
            worldMapKitRoadOverlay.MapType    = WorldMapKitMapType.Road;
            map.Overlays.Add(Resources.WorldMapKitRoadOverlay, worldMapKitRoadOverlay);

            WorldMapKitWmsDesktopOverlay worldMapKitAerialOverlay = new WorldMapKitWmsDesktopOverlay();

            worldMapKitAerialOverlay.Name       = Resources.WorldMapKitAerialOverlay;
            worldMapKitAerialOverlay.Projection = WorldMapKitProjection.SphericalMercator;
            worldMapKitAerialOverlay.IsVisible  = false;
            worldMapKitAerialOverlay.TileCache  = new FileBitmapTileCache(cacheFolder, Resources.WorldMapKitAerialOverlay);
            worldMapKitAerialOverlay.MapType    = WorldMapKitMapType.Aerial;
            map.Overlays.Add(Resources.WorldMapKitAerialOverlay, worldMapKitAerialOverlay);

            WorldMapKitWmsDesktopOverlay worldMapKitAerialWithLabelsOverlay = new WorldMapKitWmsDesktopOverlay();

            worldMapKitAerialWithLabelsOverlay.Name       = Resources.WorldMapKitAerialWithLabelsOverlay;
            worldMapKitAerialWithLabelsOverlay.Projection = WorldMapKitProjection.SphericalMercator;
            worldMapKitAerialWithLabelsOverlay.IsVisible  = false;
            worldMapKitAerialWithLabelsOverlay.TileCache  = new FileBitmapTileCache(cacheFolder, Resources.WorldMapKitAerialWithLabelsOverlay);
            worldMapKitAerialWithLabelsOverlay.MapType    = WorldMapKitMapType.AerialWithLabels;
            map.Overlays.Add(Resources.WorldMapKitAerialWithLabelsOverlay, worldMapKitAerialWithLabelsOverlay);

            OpenStreetMapOverlay openStreetMapOverlay = new OpenStreetMapOverlay();

            openStreetMapOverlay.Name      = Resources.OSMOverlayName;
            openStreetMapOverlay.IsVisible = false;
            openStreetMapOverlay.TileCache = new FileBitmapTileCache(cacheFolder, Resources.OpenStreetMapKey);
            map.Overlays.Add(Resources.OpenStreetMapKey, openStreetMapOverlay);

            BingMapsOverlay bingMapsAerialOverlay = new BingMapsOverlay();

            bingMapsAerialOverlay.Name      = Resources.BingMapsAerialOverlayName;
            bingMapsAerialOverlay.MapType   = WinForms.BingMapsMapType.Aerial;
            bingMapsAerialOverlay.IsVisible = false;
            bingMapsAerialOverlay.TileCache = new FileBitmapTileCache(cacheFolder, Resources.BingMapsAerial);
            map.Overlays.Add(Resources.BingMapsAerial, bingMapsAerialOverlay);

            BingMapsOverlay bingMapsRoadOverlay = new BingMapsOverlay();

            bingMapsRoadOverlay.Name      = Resources.BingMapsRoadOverlayName;
            bingMapsRoadOverlay.MapType   = WinForms.BingMapsMapType.Road;
            bingMapsRoadOverlay.IsVisible = false;
            bingMapsRoadOverlay.TileCache = new FileBitmapTileCache(cacheFolder, Resources.BingMapsRoad);
            map.Overlays.Add(Resources.BingMapsRoad, bingMapsRoadOverlay);

            LayerOverlay styleLayersOverLay = new LayerOverlay();

            map.Overlays.Add(Resources.StyleLayerOverLayKey, styleLayersOverLay);

            Proj4Projection wgs84ToMercatorProjection = new Proj4Projection();

            wgs84ToMercatorProjection.InternalProjectionParametersString = Proj4Projection.GetDecimalDegreesParametersString();
            wgs84ToMercatorProjection.ExternalProjectionParametersString = Proj4Projection.GetSphericalMercatorParametersString();

            EarthquakeHeatFeatureLayer heatLayer = new EarthquakeHeatFeatureLayer(new ShapeFileFeatureSource(ConfigurationManager.AppSettings["DataShapefileFileName"]));

            heatLayer.IsVisible = false;
            heatLayer.HeatStyle = new HeatStyle(10, 100, Resources.MagnitudeColumnName, 0, 12, 100, DistanceUnit.Kilometer);
            heatLayer.FeatureSource.Projection = wgs84ToMercatorProjection;
            heatLayer.Name = Resources.HeatStyleLayerName;
            styleLayersOverLay.Layers.Add(heatLayer);

            ShapeFileFeatureLayer pointLayer = new ShapeFileFeatureLayer(ConfigurationManager.AppSettings["DataShapefileFileName"]);

            pointLayer.IsVisible = false;
            pointLayer.FeatureSource.Projection = wgs84ToMercatorProjection;
            pointLayer.Name = Resources.PointStyleLayerName;
            pointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.Red, 6, GeoColor.StandardColors.White, 1);
            pointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            styleLayersOverLay.Layers.Add(pointLayer);

            FeatureSource isoLineFeatureSource         = new ShapeFileFeatureSource(ConfigurationManager.AppSettings["DataShapefileFileName"]);
            EarthquakeIsoLineFeatureLayer isoLineLayer = new EarthquakeIsoLineFeatureLayer(isoLineFeatureSource);

            isoLineLayer.IsVisible = false;
            isoLineLayer.FeatureSource.Projection = wgs84ToMercatorProjection;
            isoLineLayer.Name = Resources.IsolineStyleLayerName;
            styleLayersOverLay.Layers.Add(isoLineLayer);

            LayerOverlay queryResultMarkerOverlay = new LayerOverlay();

            map.Overlays.Add("QueryResultMarkerOverlay", queryResultMarkerOverlay);

            PointStyle highlightStyle = new PointStyle();

            highlightStyle.CustomPointStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(50, GeoColor.SimpleColors.Blue), 20, GeoColor.SimpleColors.LightBlue, 1));
            highlightStyle.CustomPointStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.LightBlue, 9, GeoColor.SimpleColors.Blue, 1));

            markerMemoryLayer = new InMemoryFeatureLayer();
            markerMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.Orange, 8, GeoColor.SimpleColors.White, 1);
            markerMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            queryResultMarkerOverlay.Layers.Add(markerMemoryLayer);

            markerMemoryHighlightLayer = new InMemoryFeatureLayer();
            markerMemoryHighlightLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle   = highlightStyle;
            markerMemoryHighlightLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            queryResultMarkerOverlay.Layers.Add(markerMemoryHighlightLayer);
        }