private void Map_loaded(object sender, RoutedEventArgs e) { if (InitialLoad == true && !System.ComponentModel.DesignerProperties.GetIsInDesignMode(this)) { Map.Overlays.Clear(); Map.MapUnit = GeographyUnit.DecimalDegree; Map.CurrentExtent = WorldMapKitRenderLayer.DefaultExtent; //set range SetRange(); Map.MaximumScale = Map.ZoomLevelSet.ZoomLevel04.Scale; Map.MapTools.Logo.IsEnabled = false; Map.RestrictExtent = new RectangleShape(-900, 89, 900, -89); Map.MapResizeMode = MapResizeMode.PreserveScaleAndCenter; //start mouse Coordinates for map hide coordinates display on map Map.MapTools.MouseCoordinate.IsEnabled = true; Map.MapTools.MouseCoordinate.MouseCoordinateType = MouseCoordinateType.LongitudeLatitude; Map.MapTools.MouseCoordinate.VerticalAlignment = System.Windows.VerticalAlignment.Top; Map.MapTools.MouseCoordinate.Visibility = System.Windows.Visibility.Hidden; ShapeFileFeatureLayer layer = new ShapeFileFeatureLayer(@"../WorldMapKit/Countries02.shp", ShapeFileReadWriteMode.ReadOnly); layer.Open(); layer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1; layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; layer.WrappingMode = WrappingMode.WrapDateline; layer.WrappingExtent = layer.GetBoundingBox(); LayerOverlay overlay = new LayerOverlay(); overlay.Layers.Add("WorldLayer", layer); overlay.WrappingExtent = layer.GetBoundingBox(); overlay.WrappingMode = WrappingMode.WrapDateline; //overlay.TileType = TileType.SingleTile; //overlay.TileType = TileType.MultipleTile; string worldMapKitDataFolder = @"..\WorldMapKit"; WorldMapKitRenderLayer worldMapKitRenderLayer = new WorldMapKitRenderLayer(worldMapKitDataFolder); LayerOverlay worldMapKitRenderLayerOverlay = new LayerOverlay(); //FileBitmapTileCache fileBitmapTileCache = new FileBitmapTileCache(@"..\WorldMapKit", "DecimalDegreeLabels"); //overlay.TileCache = fileBitmapTileCache; overlay.Layers.Add("WMK", worldMapKitRenderLayer); Map.TrackOverlay.TrackShapeLayer.WrappingExtent = layer.GetBoundingBox(); Map.TrackOverlay.TrackShapeLayer.WrappingMode = WrappingMode.WrapDateline; Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateMaskTextStyle(("Label"), new GeoFont("Arial", 10), new GeoSolidBrush(GeoColor.SimpleColors.Black), new AreaStyle(new GeoPen(GeoColor.StandardColors.Black), new GeoSolidBrush(GeoColor.StandardColors.Transparent)), 10, 10); Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.City1("Label"); Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.Font = new GeoFont("Arial", 12); Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.XOffsetInPixel = 10; Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.YOffsetInPixel = 10; Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; Map.TrackOverlay.TrackShapeLayer.Open(); Map.TrackOverlay.TrackShapeLayer.Columns.Add(new FeatureSourceColumn("Label")); VS.ColumnName = "Color"; VST.ColumnName = "Text"; Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TStyle; Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = new AreaStyle(new GeoPen(GeoColor.StandardColors.Blue, 2)); PStyle = Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle; AStyle = Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle; LStyle = Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle; TStyle = Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle; Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = null; Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = null; Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = null; Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = null; Map.TrackOverlay.TrackShapeLayer.Columns.Add(new FeatureSourceColumn("Color")); Map.TrackOverlay.TrackShapeLayer.Columns.Add(new FeatureSourceColumn("Text")); Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(TStyle); Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(AStyle); Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(LStyle); Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(PStyle); Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(VS); Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(VST); Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; Map.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.BestPlacement = true; Map.TrackOverlay.Close(); LayerOverlay trackSymbolOverlay = new LayerOverlay(); trackSymbolOverlay.TileType = TileType.SingleTile; trackSymbolOverlay.WrappingMode = WrappingMode.WrapDateline; trackSymbolOverlay.WrappingExtent = layer.GetBoundingBox(); mapShapeLayer = new MapShapeFeatureLayer(); mapShapeLayer.WrappingMode = WrappingMode.WrapDateline; mapShapeLayer.WrappingExtent = layer.GetBoundingBox(); mapShapeLayer.Name = "MapShapeLayer"; // mapShapeLayer.DrawingMarginPercentage = 100.0; trackSymbolOverlay.Layers.Add("MapShapeLayer", mapShapeLayer); Map.Overlays.Add("overlay", overlay); Map.Overlays.Add("WorldOverlay", overlay); //Map.Overlays.Add(worldMapKitRenderLayerOverlay); Map.Overlays.Add("TrackSymbolOverlay", trackSymbolOverlay); Map.Refresh(); InitialLoad = false; //Set Display Center SetDisplayCenter(); //set Center for right click menu PointShape PS = Map.CurrentExtent.GetCenterPoint(); App.CenterLat = PS.Y; App.CenterLong = PS.X; InitializeMapSymbolProcessing(); } }