Inheritance: Windows.UI.Xaml.Controls.ContentControl
        private void node_DrawCompleted(object sender, DrawEventArgs e)
        {
            //标记途经结点顺序
            i++;

            //将结点以图钉样式加到ElementsLayer上
            Pushpin pushpin = new Pushpin();
            pushpin.Location = e.Geometry.Bounds.Center;
            pushpin.Content = i.ToString();
            elementsLayer.AddChild(pushpin);

            //用points数组记录结点坐标
            points.Add(pushpin.Location);
        }
        private void node_DrawCompleted(object sender, DrawEventArgs e)
        {
            //标记服务区站点;

            //将站点以图钉样式加到ElementsLayer上
            Pushpin pushpin = new Pushpin();
            pushpin.Location = e.Geometry.Bounds.Center;
            pushpin.Content = (points.Count + 1).ToString();
            pushpin.Background = new SolidColorBrush(Colors.Red);
            elementsLayer.AddChild(pushpin);

            //用points数组记录结点坐标
            points.Add(pushpin.Location);





        }
        private void node_DrawCompleted(object sender, DrawEventArgs e)
        {
            Pushpin pushpin = new Pushpin();
            

            //将事件点以图钉样式加到ElementsLayerE上
            if (eventPonit.IsChecked == true)
            {
                //因为事件点只有一个,因此判断是否存在事件点,如果存在就先将以前的事件点删除
                if (flag == true)
                {
                    elementsLayerE.Children.Clear();
                    featuresLayer.ClearFeatures();
                }
                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);
            }
        }
        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(),
                };
                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);
            }
        }
Exemplo n.º 5
0
        private void wc_OpenReadCompleted(string content)
        {
            elementsLayer.Children.Clear();
            XDocument doc = XDocument.Parse(content);
            XNamespace geo = "http://www.w3.org/2003/01/geo/wgs84_pos#";

            var temp = (from tt in doc.Descendants("item")
                        where tt.Element(geo + "long") != null && tt.Element(geo + "lat") != null
                        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
                        }).ToList();

            foreach (var item in temp)
            {
                Point2D lonlat = new Point2D(item.Lon, item.Lat);
                Pushpin pushpin = new Pushpin() { Location = lonlat, Tag = item };
                pushpin.PointerPressed += pushpin_PointerPressed;
                pushpin.PointerReleased += pushpin_PointerReleased;
                elementsLayer.AddChild(pushpin);
            }

        }
Exemplo n.º 6
0
        void pushpin_PointerPressed(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs 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();
        }
Exemplo n.º 7
0
        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.elementsLayer.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.elementsLayer.AddChild(beijing);

            Pushpin ulanBator = new Pushpin();
            ulanBator.Location = new Point2D(106.5, 47.6);
            ulanBator.Background = new SolidColorBrush(Colors.Blue);
            this.elementsLayer.AddChild(ulanBator);

            Pushpin moscow = new Pushpin();
            moscow.Location = new Point2D(37.4, 55.5);
            moscow.Background = new SolidColorBrush(Colors.Yellow);
            this.elementsLayer.AddChild(moscow);


            Pushpin prague = new Pushpin();
            prague.Location = new Point2D(14.3, 50.1);
            prague.Background = new SolidColorBrush(Colors.Orange);
            this.elementsLayer.AddChild(prague);

            Pushpin berlin = new Pushpin();
            berlin.Location = new Point2D(13.3, 52.3);
            berlin.Background = new SolidColorBrush(Colors.Purple);
            this.elementsLayer.AddChild(berlin);
            #endregion

            #region Polylinebase
            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.elementsLayer.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.elementsLayer.AddChild(polygon);
            #endregion

            #region Button
            Button btn = new Button();
            btn.Content = "点击";
            Brush btnbackground = new SolidColorBrush(Colors.Blue);
            btn.SetValue(Button.BackgroundProperty, btnbackground);
            btn.Click += new RoutedEventHandler(btn_Click);
            Rectangle2D btnbounds = new Rectangle2D(95, 29, 115, 43);
            btn.SetValue(ElementsLayer.BBoxProperty, btnbounds);
            this.elementsLayer.AddChild(btn);
            #endregion

            MyMap.ViewBoundsChanged -= MyMap_ViewBoundsChanged;
        }