private void node_DrawCompleted(object sender, DrawEventArgs e) { Pushpin pushpin = new Pushpin(); //将事件点以图钉样式加到ElementsLayerE上 if (eventPonit.IsChecked == true) { //因为事件点只有一个,因此判断是否存在事件点,如果存在就先将以前的事件点删除 if (flag == true) { elementsLayerE.Children.Clear(); } pushpin.Location = e.Geometry.Bounds.Center; pushpin.Content = "E"; pushpin.Background = new SolidColorBrush(Colors.Red); elementsLayerE.AddChild(pushpin); flag = true; //记录事件点坐标 eventp = pushpin.Location; } //将设施点以图钉样式加到ElementsLayer上 if (FacilityPoint.IsChecked == true) { pushpin.Location = e.Geometry.Bounds.Center; pushpin.Content = "F"; pushpin.Background = new SolidColorBrush(Colors.Purple); elementsLayerF.AddChild(pushpin); //用 points 数组记录设施点坐标 points.Add(pushpin.Location); } }
public GeoRSS() { InitializeComponent(); elemLayer = MyMap.Layers["MyArbitraryLayer"] as ElementsLayer; MyMap.Loaded += new RoutedEventHandler(MyMap_Loaded); var btn = new Button() { Width = 100, Height = 80, Content = "aaaa" }; fLayer.AddFeature(new Feature() { Geometry = new GeoPoint(0, 0), Style = new PredefinedMarkerStyle() { Size = 30, Color = new SolidColorBrush(Color.FromArgb(99, 00, 0xff, 00)) }, //ToolTip = new InfoBox() { Title="aaa", Description="BBBBBBBBBBb"} ToolTip = btn } ); FeaturesLayer.SetToolTipHorizontalOffset(btn, 100); MyMap.Layers.Add(fLayer); MyMap.ViewBoundsChanged += new EventHandler<ViewBoundsEventArgs>(MyMap_ViewBoundsChanged); var pp = new Pushpin() { Location = new Point2D(0, 0) }; pp.MouseLeftButtonDown += new MouseButtonEventHandler(pp_MouseLeftButtonDown); elemLayer.AddChild(pp); }
private void node_DrawCompleted(object sender, DrawEventArgs e) { if (this.pathPonit.IsChecked.Value) { //标记途经结点顺序 i++; //将结点以图钉样式加到ElementsLayer上 Pushpin pushpin = new Pushpin() { Location = e.Geometry.Bounds.Center, Content = i.ToString(System.Globalization.CultureInfo.InvariantCulture), }; elementsLayer.AddChild(pushpin); //用points数组记录结点坐标 points.Add(pushpin.Location); } if (this.barrierPoint.IsChecked.Value) { Pushpin pushpin = new Pushpin() { Location = e.Geometry.Bounds.Center, Content = "Stop", FontSize = 8, Background = new SolidColorBrush(Colors.Black), }; elementsLayer.AddChild(pushpin); //用MyBarrierPoint数组记录结点坐标 barrierPoints.Add(pushpin.Location); } }
public iServerJava6RRouteCalculateMeasure() { InitializeComponent(); _routeLayer = MyMap.Layers["RouteLayer"] as FeaturesLayer; _elementsLayer = MyMap.Layers["MyElementsLayer"] as ElementsLayer; GetFeaturesBySQLParameters param = new GetFeaturesBySQLParameters { DatasetNames = new List<string> { "Changchun:RouteDT_road" }, FilterParameter = new SuperMap.Web.iServerJava6R.FilterParameter { AttributeFilter = "RouteID = 1690", } }; GetFeaturesBySQLService ser = new GetFeaturesBySQLService(_dataUrl); ser.Failed += new EventHandler<ServiceFailedEventArgs>(ser_Failed); ser.ProcessCompleted += new EventHandler<GetFeaturesEventArgs>(ser_ProcessCompleted); ser.ProcessAsync(param); Pushpin pushpin1 = new Pushpin(); pushpin1.IsEnabled = false; pushpin1.Location = new Point2D(4020.0045, -4377.0273); pushpin1.Content = "A"; this._elementsLayer.AddChild(pushpin1); Pushpin pushpin2 = new Pushpin(); pushpin2.IsEnabled = false; pushpin2.Location = new Point2D(6214.1838, -4209.9278); pushpin2.Content = "B"; this._elementsLayer.AddChild(pushpin2); }
//将点添加到任意图层中 private void node_DrawCompleted(object sender, DrawEventArgs e) { i++; Pushpin pushPin = new Pushpin() { Location = e.Geometry.Bounds.Center, Content = i.ToString() }; elementsLayer.Children.Add(pushPin); points.Add(pushPin.Location); }
private void MyBtn100e_Click(object sender, RoutedEventArgs e) { for (int i = 1; i <= 10; i++) { for (int j = 1; j <= 10; j++) { Pushpin p = new Pushpin { Location = new Point2D(i, j), Content = new TextBlock { Text = j.ToString() + "-" + i.ToString(), FontSize = 9 } }; elementsLayer.AddChild(p); } } }
private void pp_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { e.Handled = true; slectedPP = sender as Pushpin; RssClass info = (RssClass)slectedPP.Tag; window.Content = info.Desc; window.Title = info.Title; window.Location = new Point2D(info.Lon, info.Lat); window.ShowInfoWindow(); }
private void node_DrawCompleted(object sender, DrawEventArgs e) { //标记途经结点顺序 i++; //将结点以图钉样式加到ElementsLayer上 Pushpin pushpin = new Pushpin(); pushpin.Location = e.Geometry.Bounds.Center; pushpin.Content = i.ToString(System.Globalization.CultureInfo.InvariantCulture); elementsLayer.AddChild(pushpin); //用points数组记录结点坐标 points.Add(pushpin.Location); }
private void node_DrawCompleted(object sender, DrawEventArgs e) { //标记服务区站点 i++; //将站点以图钉样式加到ElementsLayer上 Pushpin pushpin = new Pushpin(); pushpin.Location = e.Geometry.Bounds.Center; pushpin.Content = i.ToString(); pushpin.Background = new SolidColorBrush(Colors.Red); elementsLayer.AddChild(pushpin); //用points数组记录结点坐标 points.Add(pushpin.Location); //用户输入服务区半径 InputWindow weightWindow = new InputWindow(); weightWindow.Show(); weightWindow.Closed += new EventHandler(weightWindow_Closed); }
private void point_DrawCompleted(object sender, DrawEventArgs e) { Pushpin pushPin = new Pushpin(); pushPin.Location = e.Geometry.Bounds.Center; elementsLayer.AddChild(pushPin); QueryByCenterParameters queryParameters = new QueryByCenterParameters() { MapName = "changchun", Tolerance = 100, IsNearest = true, QueryParam = new QueryParam() { QueryAllLayer = false, QueryLayers = new List<QueryLayer>() { new QueryLayer() { LayerName = "RoadNet@changchun" } }, HasGeometry = true, ReturnShape = true, ExpectCount = 1, } }; queryParameters.CenterPoint = e.Geometry.Bounds.Center; QueryByCenterService queryService = new QueryByCenterService("http://localhost/IS/AjaxDemo"); queryService.ProcessAsync(queryParameters); queryService.ProcessCompleted += new EventHandler<QueryServiceEventArgs>(queryService_ProcessCompleted); }
public MainPage() { InitializeComponent(); featuresLayer = MyMap.Layers["myFeaturesLayer"] as FeaturesLayer; elementsLayer = MyMap.Layers["myElementsLayer"] as ElementsLayer; feature = new Feature(); feature.Geometry = new GeoRegion { Parts = new ObservableCollection<Point2DCollection> { new Point2DCollection() { new Point2D(0,0), new Point2D(10000000,0), new Point2D(10000000,10000000), new Point2D(0,10000000), new Point2D(0,0) }, new Point2DCollection() { new Point2D(-10000000,0), new Point2D(0,-10000000), new Point2D(-10000000,-10000000), new Point2D(-10000000,0) } } }; Feature fmline = new Feature(); fmline.Geometry = new GeoLine { Parts = new ObservableCollection<Point2DCollection> { new Point2DCollection() { new Point2D(-5000000,5000000), new Point2D(-10000000,10000000), }, new Point2DCollection() { new Point2D(5000000,-5000000), new Point2D(10000000,-10000000), } } }; Feature fpoint = new Feature() { Geometry = new GeoPoint(0, 0) }; featuresLayer.AddFeature(fpoint); featuresLayer.AddFeature(fmline); featuresLayer.Features.Add(feature); elementsLayer.Children.Clear(); Pushpin pushpin = new Pushpin { Content = "test", Location = new Point2D(0, 0) }; //elementsLayer.AddChild(pushpin); MyMap.MouseLeftButtonDown += new MouseButtonEventHandler(MyMap_MouseLeftButtonDown); MyMap.MouseLeftButtonUp += new MouseButtonEventHandler(MyMap_MouseLeftButtonUp); MyMap.MouseRightButtonDown += new MouseButtonEventHandler(MyMap_MouseRightButtonDown); MyMap.MouseRightButtonUp += new MouseButtonEventHandler(MyMap_MouseRightButtonUp); featuresLayer.MouseLeftButtonDown += new EventHandler<FeatureMouseButtonEventArgs>(featuresLayer_MouseLeftButtonDown); featuresLayer.MouseLeftButtonUp += new EventHandler<FeatureMouseButtonEventArgs>(featuresLayer_MouseLeftButtonUp); featuresLayer.MouseRightButtonDown += new EventHandler<FeatureMouseButtonEventArgs>(featuresLayer_MouseRightButtonDown); featuresLayer.MouseRightButtonUp += new EventHandler<FeatureMouseButtonEventArgs>(featuresLayer_MouseRightButtonUp); }
private void test_Click(object sender, RoutedEventArgs e) { //feature.Style = new PredefinedLineStyle { Symbol = PredefinedLineStyle.LineSymbol.Dot }; //(feature.Style as PredefinedLineStyle).Stroke = new SolidColorBrush(Colors.Green); elementsLayer.Children.Clear(); Pushpin pushpin = new Pushpin { Content = "test", Location = new Point2D(0, 0) }; elementsLayer.AddChild(pushpin); }
private void MyMap_ViewBoundsChanged(object sender, ViewBoundsEventArgs e) { #region Ellipse Ellipse myellipse = new Ellipse(); myellipse.Fill = new SolidColorBrush(Colors.Red); Rectangle2D ellbounds = new Rectangle2D(119.5, 21, 122.5, 26); this.arbitrarylayer.AddChild(myellipse, ellbounds); MyEllipseStory.Stop(); Storyboard.SetTarget(myDoubleAnimation, myellipse); MyEllipseStory.Begin(); #endregion #region Pushpin Pushpin beijing = new Pushpin(); beijing.Location = new Point2D(116.2, 39.6); this.arbitrarylayer.AddChild(beijing); Pushpin ulanBator = new Pushpin(); ulanBator.Location = new Point2D(106.5, 47.6); ulanBator.Background = new SolidColorBrush(Colors.Blue); this.arbitrarylayer.AddChild(ulanBator); Pushpin moscow = new Pushpin(); moscow.Location = new Point2D(37.4, 55.5); moscow.Background = new SolidColorBrush(Colors.Yellow); this.arbitrarylayer.AddChild(moscow); Pushpin prague = new Pushpin(); prague.Location = new Point2D(14.3, 50.1); prague.Background = new SolidColorBrush(Colors.Orange); this.arbitrarylayer.AddChild(prague); Pushpin berlin = new Pushpin(); berlin.Location = new Point2D(13.3, 52.3); berlin.Background = new SolidColorBrush(Colors.Purple); this.arbitrarylayer.AddChild(berlin); #endregion #region PolygonElement PolygonElement line = new PolygonElement(); line.Stroke = new SolidColorBrush(Colors.Yellow); line.StrokeThickness = 3; line.Opacity = 1; line.StrokeDashArray = new DoubleCollection { 3, 3 }; line.StrokeEndLineCap = PenLineCap.Triangle; Point2DCollection points = new Point2DCollection(); points.Add(new Point2D(121.3, 25)); points.Add(new Point2D(116.2, 39.6)); points.Add(new Point2D(106.5, 47.6)); points.Add(new Point2D(37.4, 55.5)); points.Add(new Point2D(14.3, 50.1)); points.Add(new Point2D(13.3, 52.3)); points.Add(new Point2D(0.1, 51.3)); line.Point2Ds = points; this.arbitrarylayer.AddChild(line); #endregion #region PolygonElement PolygonElement polygon = new PolygonElement(); polygon.Stroke = new SolidColorBrush(Colors.Purple); polygon.Opacity = 0.5; polygon.Fill = this.British; Point2DCollection gonpoints = new Point2DCollection(); gonpoints.Add(new Point2D(-8, 61)); gonpoints.Add(new Point2D(-6, 55)); gonpoints.Add(new Point2D(-8, 50)); gonpoints.Add(new Point2D(2, 50)); gonpoints.Add(new Point2D(1, 61)); polygon.Point2Ds = gonpoints; this.arbitrarylayer.AddChild(polygon); #endregion #region Button Button btn = new Button(); btn.Height = 32; btn.Width = 32; btn.Content = "点击"; btn.Click += new RoutedEventHandler(btn_Click); Rectangle2D btnbounds = new Rectangle2D(95, 29, 115, 38); btn.SetValue(ElementsLayer.BBoxProperty, btnbounds); this.arbitrarylayer.AddChild(btn); #endregion }
private void wc_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { if (e.Error != null) { return; } elementsLayer.Children.Clear(); XDocument doc = XDocument.Load(e.Result); XNamespace geo = "http://www.w3.org/2003/01/geo/wgs84_pos#"; var temp = from tt in doc.Descendants("item") select new RssClass { Lon = Convert.ToDouble(tt.Element(geo + "long") != null ? tt.Element(geo + "long").Value : "0"), Lat = Convert.ToDouble(tt.Element(geo + "lat") != null ? tt.Element(geo + "lat").Value : "0"), Title = tt.Element("title").Value, Desc = tt.Element("description").Value }; foreach (var item in temp) { Point2D lonlat = new Point2D(item.Lon, item.Lat); Pushpin pushpin = new Pushpin() { Location = lonlat, Tag = item }; pushpin.MouseLeftButtonDown += new MouseButtonEventHandler(pp_MouseLeftButtonDown); elementsLayer.AddChild(pushpin); } progress.Storyboard1.Stop(); progress.Visibility = Visibility.Collapsed; }
private void pp_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { e.Handled = true; slectedPP = sender as Pushpin; RssClass info = (RssClass)slectedPP.Tag; InfoWindow box = new InfoWindow { Title = new TextBlock() { Text = info.Title }, Description = info.Desc }; box.SetValue(FrameworkElement.HorizontalAlignmentProperty, HorizontalAlignment.Left); box.SetValue(FrameworkElement.VerticalAlignmentProperty, VerticalAlignment.Top); box.DeletedClicked += new InfoWindow.DeletedClickedHandler(box_DeletedClicked); //MyMap.OpenInfoWindow(slectedPP.Location, box); MyMap.OpenInfoWindow(slectedPP.Location, -10, -10, box); }
//将点添加到任意图层中 private void node_DrawCompleted(object sender, DrawEventArgs e) { Pushpin pushpin = new Pushpin(); pushpin.Location = e.Geometry.Bounds.Center; pushpin.Background = new SolidColorBrush(Colors.Red); arbitraryLayerE.AddChild(pushpin); eventp = pushpin.Location; }
void wc_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { if (e.Error != null) { return; } elemLayer.Children.Clear(); XDocument doc = XDocument.Load(e.Result); XNamespace geo = "http://www.w3.org/2003/01/geo/wgs84_pos#"; var temp = from tt in doc.Descendants("item") select new RssClass { Lon = Convert.ToDouble(tt.Element(geo + "long").Value), Lat = Convert.ToDouble(tt.Element(geo + "lat").Value), Title = tt.Element("title").Value, Desc = tt.Element("description").Value }; foreach (var item in temp) { Point2D lonlat = new Point2D(item.Lon, item.Lat); Point2D xy = MercatorUtility.LatLonToMeters(lonlat); Pushpin pp = new Pushpin() { Location = xy, Tag = item }; pp.MouseLeftButtonDown += new MouseButtonEventHandler(pp_MouseLeftButtonDown); elemLayer.AddChild(pp); } }