private void mapControl_MouseDown(object sender, MouseButtonEventArgs e) { if (Keyboard.Modifiers == ModifierKeys.Shift) { GeoPoint centerPoint = vectorLayer.ScreenToGeoPoint(e.GetPosition(vectorLayer)); double radius = (double)seRadius.Value; MapDot dot = new MapDot() { Location = centerPoint }; dot.Size = 6; itemsStorage.Items.Add(dot); MapEllipse defaultEllipse = MapEllipse.CreateByCenter(mapControl.CoordinateSystem, centerPoint, radius * 2, radius * 2); defaultEllipse.Fill = Brushes.Transparent; defaultEllipse.Stroke = Brushes.White; itemsStorage.Items.Add(defaultEllipse); MapPolyline equalDistance = new EquidistantCircleCreator(vectorLayer).CreateCircle(centerPoint, radius); equalDistance.Stroke = Brushes.GreenYellow; itemsStorage.Items.Add(equalDistance); MapPolyline ScreenCircle = new ScreenCircleCreator(vectorLayer).CreateCircle(centerPoint, radius); ScreenCircle.Stroke = Brushes.Red; itemsStorage.Items.Add(ScreenCircle); } }
private void FillInformationLayer() { // Create extended property set. // It can be shared between the number // of the map shapes. ExtendedPropertySet propertySet = new ExtendedPropertySet(); propertySet.RegisterProperty("Name", "City Name", typeof(string), String.Empty); propertySet.RegisterProperty("Population", "Population", typeof(int), 0); MapEllipse sofiaEllipse = new MapEllipse() { ShapeFill = new MapShapeFill() { Stroke = new SolidColorBrush(Colors.Red), StrokeThickness = 2, Fill = new SolidColorBrush(Colors.Transparent) }, Width = 20, Height = 20, Location = new Location(42.6957539183824, 23.3327663758679), }; // Create extended data for the ellipse // using existing property set. ExtendedData sofiaData = new ExtendedData(propertySet); // Set the extended properties. sofiaData.SetValue("Name", "Sofia"); sofiaData.SetValue("Population", 1300000); // Assign extended data to the map shape. sofiaEllipse.ExtendedData = sofiaData; // Assign tooltip which uses the extended properties. ToolTip tooltip = new ToolTip(); Binding tooltipBinding = new Binding() { Converter = new ExtendedDataConverter(), ConverterParameter = "{Name}: {Population} people", Source = sofiaEllipse.ExtendedData }; tooltip.SetBinding(System.Windows.Controls.ToolTip.ContentProperty, tooltipBinding); ToolTipService.SetToolTip(sofiaEllipse, tooltip); this.informationLayer.Items.Add(sofiaEllipse); }
private void InitializeData() { Ellipse = new MapEllipse { Fill = TransparentBrush, IsHitTestVisible = false, Stroke = ColoredBrush, StrokeStyle = new StrokeStyle() { Thickness = 4 } }; var dot = new MapDot() { Fill = CenterFillBrush, Stroke = TransparentBrush, Size = 20, IsHitTestVisible = false }; CenterMarkers = new List <MapDot>(); CenterMarkers.Add(dot); dot = new MapDot() { Fill = TransparentBrush, Stroke = CenterBorderBrush, Size = 32, StrokeStyle = new StrokeStyle() { Thickness = 5 }, IsHitTestVisible = false }; CenterMarkers.Add(dot); var storage = new MapItemStorage(); storage.Items.Add(Ellipse); foreach (var marker in CenterMarkers) { storage.Items.Add(marker); } this.Data = storage; }
public SCMap AddEllipse(double[] location, double width, double height, EllipseOptions options = null) { options ??= new EllipseOptions(); var mapItem = new MapEllipse(); if (location == null || location.Length != 2) { throw new Exception("Location must be double array with 2 elements."); } mapItem.Location = CreateCoordPoint(location[0], location[1]); mapItem.Height = height; mapItem.Width = width; options.ConfigureMapItem(this, mapItem); return(this); }