/// <summary> /// Adds a line to the lines layer. /// </summary> /// <param name="longitude1"></param> /// <param name="latitude1"></param> /// <param name="longitude2"></param> /// <param name="latitude2"></param> /// <param name="stroke"></param> /// <param name="fill"></param> /// <param name="dashes"></param> public void DrawLine( string layerKey, double longitude1, double latitude1, double longitude2, double latitude2, Brush stroke, Brush fill, DoubleCollection dashes, double thickness) { #if !DYN C1.WPF.Maps.C1VectorPolyline line = new C1VectorPolyline(); #else dynamic line = DynLoader.CreateC1MapsInstance("C1VectorPolyline"); #endif line.Points = new PointCollection() { new Point(longitude1, latitude1), new Point(longitude2, latitude2), }; line.StrokeDashArray = dashes; line.Stroke = stroke; line.Fill = fill; line.StrokeThickness = thickness; LinesMapsLayer ll = _layers.Find((l) => l.MapLayer.Key == layerKey) as LinesMapsLayer; System.Diagnostics.Debug.Assert(ll != null); ll.AddLine(line); }
void Grid_Loaded(object sender, RoutedEventArgs e) { Color fc = Colors.LightGray;// Color.FromArgb(0xff, 0xC0, 0x50, 0x4d); Color bk = Color.FromArgb(0xff, 0x44, 0x44, 0x44); Color bb = Colors.Black; maps.Foreground = new SolidColorBrush(fc); maps.Background = new SolidColorBrush(bk); maps.BorderBrush = new SolidColorBrush(bb); vl = new C1VectorLayer(); SolidColorBrush stroke = new SolidColorBrush(Colors.LightGray); for (int lon = -180; lon <= 180; lon += 30) { DoubleCollection dc = new DoubleCollection(); dc.Add(1); dc.Add(2); C1VectorPolyline pl = new C1VectorPolyline() { Stroke = stroke }; PointCollection pc = new PointCollection(); pc.Add(new Point(lon, -85)); pc.Add(new Point(lon, +85)); pl.Points = pc; vl.Children.Insert(0, pl); string lbl = Math.Abs(lon).ToString() + Strings.Degree; if (lon > 0) { lbl += Strings.East; } else if (lon < 0) { lbl += Strings.West; } C1VectorPlacemark pm = new C1VectorPlacemark() { GeoPoint = new Point(lon, 0), Label = lbl, LabelPosition = LabelPosition.Top }; vl.Children.Add(pm); } for (int lat = -80; lat <= 80; lat += 20) { DoubleCollection dc = new DoubleCollection(); dc.Add(1); dc.Add(2); C1VectorPolyline pl = new C1VectorPolyline() { Stroke = stroke }; PointCollection pc = new PointCollection(); pc.Add(new Point(-180, lat)); pc.Add(new Point(180, lat)); pl.Points = pc; vl.Children.Insert(0, pl); string lbl = Math.Abs(lat).ToString() + Strings.Degree; if (lat > 0) { lbl += Strings.North; } else if (lat < 0) { lbl += Strings.South; } C1VectorPlacemark pm = new C1VectorPlacemark() { GeoPoint = new Point(0, lat), Label = lbl, LabelPosition = LabelPosition.Right }; vl.Children.Add(pm); } maps.Layers.Add(vl); }
public Grid() { InitializeComponent(); Color fc = Colors.LightGray;// Color.FromArgb(0xff, 0xC0, 0x50, 0x4d); Color bk = Color.FromArgb(0xff, 0x44, 0x44, 0x44); Color bb = Colors.Black; maps.Foreground = new SolidColorBrush(fc); maps.Background = new SolidColorBrush(bk); maps.BorderBrush = new SolidColorBrush(bb); vl = new C1VectorLayer(); SolidColorBrush stroke = new SolidColorBrush(Colors.LightGray); for (int lon = -180; lon <= 180; lon += 30) { DoubleCollection dc = new DoubleCollection(); dc.Add(1); dc.Add(2); C1VectorPolyline pl = new C1VectorPolyline() { Stroke=stroke, StrokeDashArray=dc}; PointCollection pc = new PointCollection(); pc.Add( new Point(lon, -85)); pc.Add( new Point(lon, +85)); pl.Points = pc; vl.Children.Insert(0,pl); string lbl = Math.Abs(lon).ToString() + "°"; if (lon > 0) lbl += "E"; else if (lon < 0) lbl += "W"; C1VectorPlacemark pm = new C1VectorPlacemark() { GeoPoint = new Point(lon,0), Label = lbl, LabelPosition = LabelPosition.Top }; vl.Children.Add(pm); } for (int lat = -80; lat <= 80; lat += 20) { DoubleCollection dc = new DoubleCollection(); dc.Add(1); dc.Add(2); C1VectorPolyline pl = new C1VectorPolyline() { Stroke = stroke, StrokeDashArray=dc }; PointCollection pc = new PointCollection(); pc.Add(new Point(-180,lat)); pc.Add(new Point(180, lat)); pl.Points = pc; vl.Children.Insert(0,pl); string lbl = Math.Abs(lat).ToString() + "°"; if (lat > 0) lbl += "N"; else if( lat<0) lbl += "S"; C1VectorPlacemark pm = new C1VectorPlacemark() { GeoPoint = new Point(0, lat), Label = lbl, LabelPosition = LabelPosition.Right }; vl.Children.Add(pm); } maps.Layers.Add(vl); }
public Grid() { InitializeComponent(); Color fc = Colors.LightGray;// Color.FromArgb(0xff, 0xC0, 0x50, 0x4d); Color bk = Color.FromArgb(0xff, 0x44, 0x44, 0x44); Color bb = Colors.Black; maps.Foreground = new SolidColorBrush(fc); maps.Background = new SolidColorBrush(bk); maps.BorderBrush = new SolidColorBrush(bb); vl = new C1VectorLayer(); SolidColorBrush stroke = new SolidColorBrush(Colors.LightGray); for (int lon = -180; lon <= 180; lon += 30) { DoubleCollection dc = new DoubleCollection(); dc.Add(1); dc.Add(2); C1VectorPolyline pl = new C1VectorPolyline() { Stroke = stroke, StrokeDashArray = dc }; PointCollection pc = new PointCollection(); pc.Add(new Point(lon, -85)); pc.Add(new Point(lon, +85)); pl.Points = pc; vl.Children.Insert(0, pl); string lbl = Math.Abs(lon).ToString() + "°"; if (lon > 0) { lbl += "E"; } else if (lon < 0) { lbl += "W"; } C1VectorPlacemark pm = new C1VectorPlacemark() { GeoPoint = new Point(lon, 0), Label = lbl, LabelPosition = LabelPosition.Top }; vl.Children.Add(pm); } for (int lat = -80; lat <= 80; lat += 20) { DoubleCollection dc = new DoubleCollection(); dc.Add(1); dc.Add(2); C1VectorPolyline pl = new C1VectorPolyline() { Stroke = stroke, StrokeDashArray = dc }; PointCollection pc = new PointCollection(); pc.Add(new Point(-180, lat)); pc.Add(new Point(180, lat)); pl.Points = pc; vl.Children.Insert(0, pl); string lbl = Math.Abs(lat).ToString() + "°"; if (lat > 0) { lbl += "N"; } else if (lat < 0) { lbl += "S"; } C1VectorPlacemark pm = new C1VectorPlacemark() { GeoPoint = new Point(0, lat), Label = lbl, LabelPosition = LabelPosition.Right }; vl.Children.Add(pm); } maps.Layers.Add(vl); }