public void ClearTrackResult() { mapControl.TrackOverlay.TrackShapeLayer.InternalFeatures.Clear(); markerMemoryLayer.InternalFeatures.Clear(); markerMemoryHighlightLayer.InternalFeatures.Clear(); mapControl.Refresh(mapControl.TrackOverlay); mapControl.Refresh(mapControl.Overlays[Resources.MarkerOverlayKey]); }
private void OverlayChecked(object sender, RoutedEventArgs e) { if (IsLoaded) { KeyValuePair <Overlay, bool> keyValuePair = (KeyValuePair <Overlay, bool>)((RadioButton)sender).DataContext; var overlaySwitchedEventArgs = new OverlaySwitchedEventArgs(keyValuePair.Key); OnOverlaySwitched(overlaySwitchedEventArgs); if (overlaySwitchedEventArgs.IsCancel) { BindingOverlays(checkedOverlay); } else { checkedOverlay = keyValuePair.Key; foreach (var overlay in wpfMap.Overlays) { if (overlay.IsBase) { overlay.IsVisible = checkedOverlay == overlay; } } wpfMap.Refresh(); } } }
public void SynchronizeState(WpfMap currentMap) { var measureOverlay = viewModel.MeasureOverlay; if (measureOverlay != null) { switch (measureOverlay.TrackMode) { case TrackMode.Rectangle: rectangleMeasure.IsChecked = true; break; case TrackMode.Square: squareMeasure.IsChecked = true; break; case TrackMode.Ellipse: ellipseMeasure.IsChecked = true; break; case TrackMode.Circle: circleMeasure.IsChecked = true; break; case TrackMode.Polygon: polygonMeasure.IsChecked = true; break; case TrackMode.Line: lineMeasure.IsChecked = true; break; case TrackMode.Custom: selectMeasure.IsChecked = true; break; case TrackMode.None: TurnOffRadioButtons(); break; } if (measureOverlay.MeasureCustomeMode == MeasureCustomeMode.Move && measureOverlay.TrackMode == TrackMode.Custom) { TurnOffRadioButtons(); move.IsChecked = true; } viewModel.SelectedPolygonTrackMode = measureOverlay.PolygonTrackMode; if (measureOverlay.ShapeLayer.MapShapes.Count > 0 && currentMap.ActualWidth > 0 && currentMap.ActualHeight > 0) { currentMap.Refresh(measureOverlay); } DataContext = null; DataContext = viewModel; viewModel.UpdateStylePreview(); } }
public override void Handle(Window owner, WpfMap map, MenuItemMessage message) { switch (message.MenuItem.Action) { case "contourlabel": Globals.IsDepthContourTextVisible = message.MenuItem.IsChecked; break; case "soundinglabel": Globals.IsSoundingTextVisible = message.MenuItem.IsChecked; break; case "lightdescription": Globals.IsLightDescriptionVisible = message.MenuItem.IsChecked; break; case "textlabel": if (message.MenuItem.IsChecked) { Globals.SymbolTextDisplayMode = NauticalChartsSymbolTextDisplayMode.English; } break; case "nationallanguagelabel": if (message.MenuItem.IsChecked) { Globals.SymbolTextDisplayMode = NauticalChartsSymbolTextDisplayMode.NationalLanguage; } break; case "notextlabel": if (message.MenuItem.IsChecked) { Globals.SymbolTextDisplayMode = NauticalChartsSymbolTextDisplayMode.None; } break; } if (map.Overlays.Contains(chartsOverlayName)) { LayerOverlay chartsOverlay = map.Overlays[chartsOverlayName] as LayerOverlay; foreach (var item in chartsOverlay.Layers) { NauticalChartsFeatureLayer nauticalChartsFeatureLayer = item as NauticalChartsFeatureLayer; nauticalChartsFeatureLayer.IsDepthContourTextVisible = Globals.IsDepthContourTextVisible; nauticalChartsFeatureLayer.IsLightDescriptionVisible = Globals.IsLightDescriptionVisible; nauticalChartsFeatureLayer.IsSoundingTextVisible = Globals.IsSoundingTextVisible; nauticalChartsFeatureLayer.SymbolTextDisplayMode = Globals.SymbolTextDisplayMode; } map.Refresh(); } }
public override void Handle(Window owner, WpfMap map, MenuItemMessage message) { Globals.IsMetaObjectsVisible = message.MenuItem.IsChecked; if (map.Overlays.Contains(chartsOverlayName)) { LayerOverlay chartsOverlay = map.Overlays[chartsOverlayName] as LayerOverlay; foreach (var item in chartsOverlay.Layers) { NauticalChartsFeatureLayer maritimeFeatureLayer = item as NauticalChartsFeatureLayer; maritimeFeatureLayer.IsMetaObjectsVisible = Globals.IsMetaObjectsVisible; } map.Refresh(); } }
public override void Handle(Window owner, WpfMap map, MenuItemMessage message) { Globals.CurrentDrawingMode = (NauticalChartsDrawingMode)Enum.Parse(typeof(NauticalChartsDrawingMode), message.MenuItem.Action, true); if (map.Overlays.Contains(chartsOverlayName)) { LayerOverlay chartsOverlay = map.Overlays[chartsOverlayName] as LayerOverlay; foreach (var item in chartsOverlay.Layers) { NauticalChartsFeatureLayer maritimeFeatureLayer = item as NauticalChartsFeatureLayer; maritimeFeatureLayer.DrawingMode = Globals.CurrentDrawingMode; } map.Refresh(); } }
internal void ApplyOverlayOpacity() { if (map.Overlays.Contains(chartsOverlayName)) { LayerOverlay overlay = ((LayerOverlay)map.Overlays[chartsOverlayName]); overlay.OverlayCanvas.Opacity = OverlayOpacity; map.Refresh(overlay); } }
public override void Handle(Window owner, WpfMap map, MenuItemMessage message) { switch (message.MenuItem.Action.ToLowerInvariant()) { case "loadcharts": { var window = new ChartsManagmentWindow(); window.Owner = owner; window.ShowDialog(); } break; case "unloadcharts": { if (map.Overlays.Contains(chartsOverlayName)) { if (MessageBox.Show("Do you want to unload all the charts?", string.Empty, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { if (map.Overlays.Contains(chartsOverlayName)) { GeoCollection <Layer> layers = (map.Overlays[chartsOverlayName] as LayerOverlay).Layers; foreach (Layer layer in layers) { layer.Close(); } layers.Clear(); ChartMessage chartMessage = new ChartMessage(ChartsManagmentViewModel.Instance.Charts); Messenger.Default.Send <ChartMessage>(chartMessage, "UnloadCharts"); ChartsManagmentViewModel.Instance.Charts.Clear(); ChartsManagmentViewModel.Instance.SelectedItem = null; ChartsManagmentViewModel.Instance.SelectedItems.Clear(); } if (map.Overlays.Contains(boundingBoxPreviewOverlayName)) { ((InMemoryFeatureLayer)((LayerOverlay)map.Overlays[boundingBoxPreviewOverlayName]).Layers[0]).InternalFeatures.Clear(); } map.Refresh(); } } } break; } }
private void Window_Loaded(object sender, RoutedEventArgs e) { WpfMap.MapUnit = GeographyUnit.DecimalDegree; WpfMap.CurrentExtent = new RectangleShape(-155.733, 95.60, 104.42, -81.9); BackgroundLayer backgroundLayer = new BackgroundLayer(new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean)); ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"..\..\SampleData\Data\Countries02.shp"); // worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1; worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay worldOverlay = new LayerOverlay(); worldOverlay.Layers.Add(backgroundLayer); worldOverlay.Layers.Add(worldLayer); WpfMap.Overlays.Add(worldOverlay); WpfMap.Refresh(); }
public override void Handle(Window owner, WpfMap map, MenuItemMessage message) { LayerOverlay adornmentOverlay; if (!map.Overlays.Contains(GraticuleOverlayName)) { var graticuleLayer = new GraticuleFeatureLayer() { GraticuleLineStyle = new LineStyle(new GeoPen(GeoColor.StandardColors.LightGray)) }; adornmentOverlay = new LayerOverlay(); adornmentOverlay.Layers.Add(graticuleLayer); map.Overlays.Add(GraticuleOverlayName, adornmentOverlay); } adornmentOverlay = map.Overlays[GraticuleOverlayName] as LayerOverlay; adornmentOverlay.IsVisible = message.MenuItem.IsChecked; map.Refresh(); }
public override void Handle(Window owner, WpfMap map, MenuItemMessage message) { /*=========================================== * Backgrounds for this sample are powered by ThinkGeo Cloud Maps and require * a Client ID and Secret. These were sent to you via email when you signed up * with ThinkGeo, or you can register now at https://cloud.thinkgeo.com. * ===========================================*/ ThinkGeoCloudRasterMapsOverlay backgroundOverlay; if (map.Overlays.Contains(thinkGeoCloudMapsOverlayName)) { backgroundOverlay = map.Overlays[thinkGeoCloudMapsOverlayName] as ThinkGeoCloudRasterMapsOverlay; } else { backgroundOverlay = new ThinkGeoCloudRasterMapsOverlay(); map.Overlays.Insert(0, backgroundOverlay); } backgroundOverlay.IsVisible = true; switch (message.MenuItem.Action.ToLowerInvariant()) { case "light": backgroundOverlay.MapType = ThinkGeoCloudRasterMapsMapType.Light; break; case "aerial": backgroundOverlay.MapType = ThinkGeoCloudRasterMapsMapType.Aerial; break; case "hybrid": backgroundOverlay.MapType = ThinkGeoCloudRasterMapsMapType.Hybrid; break; case "none": backgroundOverlay.IsVisible = false; break; } map.Refresh(backgroundOverlay); }
internal static void AddMarkerOverlayIfNotExisting(WpfMap map) { var markerOverlay = map.Overlays.OfType <SimpleMarkerOverlay>() .Where(mOverlay => mOverlay.Name.Equals(markerOverlayName, StringComparison.OrdinalIgnoreCase)) .FirstOrDefault(); if (markerOverlay == null) { markerOverlay = new AnnotationSimpleMarkerOverlay { Name = markerOverlayName, DragMode = MarkerDragMode.Drag, AddMarker = new Action <MarkerState>(tmpObj => { AddMarker(tmpObj.Position, tmpObj.ContentText, tmpObj.Id, tmpObj.StyleValue); }) }; map.Overlays.Add(markerOverlay); map.Refresh(); } }
public override void Handle(Window owner, WpfMap map, MenuItemMessage message) { WorldMapKitWmsWpfOverlay worldMapKitOverlay; if (map.Overlays.Contains(worldMapOverlayName)) { worldMapKitOverlay = map.Overlays[worldMapOverlayName] as WorldMapKitWmsWpfOverlay; } else { worldMapKitOverlay = new WorldMapKitWmsWpfOverlay(); map.Overlays.Insert(0, worldMapKitOverlay); } worldMapKitOverlay.IsVisible = true; switch (message.MenuItem.Action.ToLowerInvariant()) { case "streetmap": worldMapKitOverlay.MapType = WorldMapKitMapType.Road; break; case "aerial": worldMapKitOverlay.MapType = WorldMapKitMapType.Aerial; break; case "aerialwithlabels": worldMapKitOverlay.MapType = WorldMapKitMapType.AerialWithLabels; break; case "none": worldMapKitOverlay.IsVisible = false; break; } map.Refresh(worldMapKitOverlay); }
private void Window_Loaded(object sender, RoutedEventArgs e) { Proj4Projection proj4 = new Proj4Projection(); proj4.ExternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(2178); proj4.InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(2178); //proj4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString(); proj4.Open(); //WorldStreetsAndImageryProjection x = new WorldStreetsAndImageryProjection(); //WpfMap.MapUnit = ThinkGeo.MapSuite.GeographyUnit.DecimalDegree; WpfMap.MapUnit = ThinkGeo.MapSuite.GeographyUnit.Meter; WpfMap.CurrentExtent = new RectangleShape(6534300.78, 5593416.28, 6534296.12, 5593426.45); //var x = new WorldStreetsAndImageryOverlay() //WpfMap.Overlays.Add(x); WpfMap.Refresh(); InMemoryFeatureLayer inMemoryFeatureLayer = CreateInMemoryFeatureLayerFromTextFile(@"..\..\data\FriscoHotels.txt"); inMemoryFeatureLayer.FeatureSource.Projection = proj4; LayerOverlay layerOverlay = new LayerOverlay(); layerOverlay.TileType = TileType.SingleTile; layerOverlay.Layers.Add(inMemoryFeatureLayer); WpfMap.Overlays.Add(layerOverlay); //LayerOverlay layerOverlay = new LayerOverlay(); //layerOverlay.TileType = TileType.SingleTile; //var polygonLayer = new InMemoryFeatureLayer(); //Feature feature2 = new Feature(new PolygonShape("POLYGON((20.030485999999996 50.00571917079107,20.030485999999996 49.998476,20.03997000000004 49.998476,20.03997000000004 49.998476,20.040292010620078 50.00568354029431,20.030485999999996 50.00571917079107))")); //polygonLayer.Open(); //polygonLayer.EditTools.BeginTransaction(); //polygonLayer.EditTools.Add(feature2); ////layerOverlay.Layers.Add(inMemoryFeatureLayer); //layerOverlay.Layers.Add(polygonLayer); //WpfMap.Overlays.Add(layerOverlay); //polygonLayer.EditTools.CommitTransaction(); //polygonLayer.Close(); InMemoryFeatureLayer inMemoryLayer = new InMemoryFeatureLayer(); inMemoryLayer.FeatureSource.Projection = proj4; inMemoryLayer.InternalFeatures.Add("Polygon", new Feature(BaseShape.CreateShapeFromWellKnownData("POLYGON((6534300.78 5593416.28, 6534296.12 5593426.45, 6534280.56 5593419.19, 6534283.49 5593412.92, 6534285.3 5593409.04, 6534300.78 5593416.28))"))); inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.FromArgb(100, GeoColor.StandardColors.RoyalBlue); inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColor.StandardColors.Blue; inMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay layerOverlay2 = new LayerOverlay(); layerOverlay2.TileType = TileType.SingleTile; layerOverlay2.Layers.Add(inMemoryLayer); //WpfMap.Overlays.Add(layerOverlay); inMemoryLayer.Open(); WpfMap.CurrentExtent = inMemoryLayer.GetBoundingBox(); inMemoryLayer.Close(); WpfMap.Refresh(); }