Exemplo n.º 1
0
        public void Btn_Submit(string startPos, string stopPos)
        {
            pntList = new List <Point>();
            Point pnt = new Point(centerInfo.X, centerInfo.Y);

            pntList.Add(pnt);
            curRoad = new BusRoad(this.MarkLayer, this.GraphicsLayer);
            curRoad.AddNode(centerInfo.MarketName, centerInfo.X, centerInfo.Y, "../images/bus/stop.PNG");
            for (int i = 0; i < stopsData.Count; i++)
            {
                pnt = new Point(stopsData[i].X, stopsData[i].Y);
                pntList.Add(pnt);
                curRoad.AddNode(stopsData[i].StopName, stopsData[i].X, stopsData[i].Y, "../images/bus/stop.PNG");
            }

            pnt = new Point(marketInfo.X, marketInfo.Y);
            pntList.Add(pnt);
            IMSPolyline line = new IMSPolyline(ZDIMS.Interface.CoordinateType.Logic);

            line.Points          = pntList;
            line.StrokeThickness = 2;
            line.Stroke          = new SolidColorBrush(Colors.Red);
            line.Draw();
            this.GraphicsLayer.AddGraphics(line);

            curRoad.AddNode(marketInfo.MarketName, marketInfo.X, marketInfo.Y, "../images/bus/stop.PNG");
            this.Show();
        }
Exemplo n.º 2
0
 public void Draw()
 {
     if (GraphicsLayer != null && RoadCoorArr.Length > 0)
     {
         if (m_road == null)
         {
             m_road = new IMSPolyline(CoordinateType.Logic);
             m_road.Shape.Stroke = new SolidColorBrush(Colors.Red);
             GraphicsLayer.AddGraphics(m_road);
         }
         for (int i = 0; i < RoadCoorArr.Length - 1; i += 2)
         {
             if (RoadCoorArr[i].Length > 0 && RoadCoorArr[i + 1].Length > 0)
             {
                 m_road.Points.Add(new Point(Convert.ToDouble(RoadCoorArr[i]), Convert.ToDouble(RoadCoorArr[i + 1])));
             }
         }
         m_road.Draw();
         for (int i = 0; i < m_stopList.Count; i++)
         {
             MarkLayer.AddMark(m_stopList[i]);
             m_stopList[i].RevisedPosition();
         }
         this.GraphicsLayer.MapContainer.PanTo(Convert.ToDouble(RoadCoorArr[0]), Convert.ToDouble(RoadCoorArr[1]));
     }
 }
        public void Btn_Submit(string startPos, string stopPos)
        {
            pntList = new List <Point>();
            Point pnt = new Point(centerInfo.X, centerInfo.Y);

            pntList.Add(pnt);
            curRoad = new BusRoad(this.MarkLayer, this.GraphicsLayer);
            curRoad.AddNode(centerInfo.MarketName, centerInfo.X, centerInfo.Y, "../images/bus/stop.PNG");
            for (int i = 0; i < stopsData.Count; i++)
            {
                pnt = new Point(stopsData[i].X, stopsData[i].Y);
                pntList.Add(pnt);
                curRoad.AddNode(stopsData[i].StopName, stopsData[i].X, stopsData[i].Y, "../images/bus/stop.PNG");
            }

            pnt = new Point(marketInfo.X, marketInfo.Y);
            pntList.Add(pnt);
            IMSPolyline line = new IMSPolyline();

            line.Points          = pntList;
            line.StrokeThickness = 2;
            line.Draw();
            this.GraphicsLayer.AddGraphics(line);
            curRoad.AddNode(marketInfo.MarketName, marketInfo.X, marketInfo.Y, "../images/bus/stop.PNG");
            //trackplaycontrol track = new trackplaycontrol();
            //track.MarkLayer = this.MarkLayer;
            //track.Points = pntList;

            // track.Show();
            //GetBusChangeRlt(startPos, stopPos, new UploadStringCompletedEventHandler(OnGetBusRlt));
        }
Exemplo n.º 4
0
        public void setstopsData()
        {
            List <stops> list = new List <stops>();
            stops        tmp  = new stops();

            tmp.X        = 12728647.712585449;
            tmp.Y        = 3579603.3365478516;
            tmp.StopName = "团结村";
            list.Add(tmp);

            tmp          = new stops();
            tmp.X        = 12729488.519714356;
            tmp.Y        = 3578924.9580688477;
            tmp.StopName = "徐东大街";
            list.Add(tmp);


            tmp          = new stops();
            tmp.X        = 12730635.074890137;
            tmp.Y        = 3577921.7222900391;
            tmp.StopName = "徐东大街";
            list.Add(tmp);


            tmp          = new stops();
            tmp.X        = 12731867.621704102;
            tmp.Y        = 3577596.8649902344;
            tmp.StopName = "东湖路";
            list.Add(tmp);

            stopsData = new List <stops>();
            pntList   = new List <Point>();
            stopsData = list;
            Point pnt;

            curRoad = new BusRoad(this.markLayer1, this.graphicsLayer1);
            for (int i = 0; i < stopsData.Count; i++)
            {
                pnt = new Point(stopsData[i].X, stopsData[i].Y);
                pntList.Add(pnt);
                curRoad.AddNode(stopsData[i].StopName, stopsData[i].X, stopsData[i].Y, "../images/bus/stop.PNG");
            }

            IMSPolyline line = new IMSPolyline(CoordinateType.Logic);

            line.Points          = pntList;
            line.Stroke          = new SolidColorBrush(Colors.Red);
            line.StrokeThickness = 2;
            line.Draw();
            line.Flicker();
            this.graphicsLayer1.AddGraphics(line);
            this.iMSMap1.SetCenter(pntList[0].X, pntList[0].Y);
            //return list;
        }
        private void OnSubmit(object sender, UploadStringCompletedEventArgs e)
        {
            LinePnts = new List <Point>();
            CPathAnalyzeResult obj = _spatial.OnNetAnalyse(e);

            if (obj == null || obj.Paths == null)
            {
                return;
            }
            CNetPath  path        = obj.Paths[0];
            int       edgeNum     = path.Edges.Length;
            Paragraph myParagraph = new Paragraph();

            myParagraph.Inlines.Add(new Run()
            {
                Text = "1.从起点出发"
            });
            Bold       bold;
            IMSMark    mark;
            StackPanel panel;

            for (int i = 0; i < edgeNum; i++)
            {
                CNetEdge edge = path.Edges[i];
                if (i != 0)
                {
                    myParagraph.Inlines.Add(new Run()
                    {
                        Text = (i + 1).ToString() + "."
                    });
                }
                myParagraph.Inlines.Add(new Run()
                {
                    Text = "经"
                });
                bold = new Bold()
                {
                    Foreground = new SolidColorBrush(Colors.Red)
                };
                bold.Inlines.Add(edge.FieldValus[2]);
                myParagraph.Inlines.Add(bold);
                if (i != edgeNum - 1)
                {
                    myParagraph.Inlines.Add(new Run()
                    {
                        Text = "到达"
                    });
                    bold = new Bold()
                    {
                        Foreground = new SolidColorBrush(Colors.Red)
                    };
                    bold.Inlines.Add(path.Nodes[i + 1].FieldValus[0] + "\n");
                    myParagraph.Inlines.Add(bold);
                }
                else
                {
                    myParagraph.Inlines.Add(new Run()
                    {
                        Text = "到达终点"
                    });
                }
                if (GraphicsLayer != null)
                {
                    if (m_road == null)
                    {
                        m_road = new IMSPolyline(CoordinateType.Logic);
                        m_road.Shape.Stroke = new SolidColorBrush(Colors.Red);
                        GraphicsLayer.AddGraphics(m_road);
                    }
                    for (int j = 0; j < edge.Dots.Length; j++)
                    {
                        m_road.Points.Add(new Point(edge.Dots[j].x, edge.Dots[j].y));
                        LinePnts.Add(new Point(edge.Dots[j].x, edge.Dots[j].y));
                    }
                    panel = new StackPanel()
                    {
                        Orientation = Orientation.Horizontal
                    };
                    panel.Children.Add(new Image()
                    {
                        Source = new BitmapImage(new Uri("/images/bus/stop.png", UriKind.Relative))
                    });
                    panel.Children.Add(new TextBlock()
                    {
                        Text = edge.FieldValus[2]
                    });
                    mark = new IMSMark(panel, CoordinateType.Logic)
                    {
                        EnableDrag = false, EnableAnimation = false
                    };
                    mark.X = edge.Dots[edge.Dots.Length / 2].x;
                    mark.Y = edge.Dots[edge.Dots.Length / 2].y;
                    m_markLayer.AddMark(mark);
                    m_stopList.Add(mark);
                }
            }
            m_road.Draw();
            if (netWindow == null)
            {
                netWindow = new NetWindow();
            }
            if (netWindow != null)
            {
                this.netWindow.g_graphicLayer = this.GraphicsLayer;
                this.netWindow.m_markLayer    = this.m_markLayer;
                this.netWindow.OgicPnts       = this.LinePnts;
                netWindow.Show();
                this.netWindow.Margin = new Thickness(0, 120, 0, 0);
                this.netWindow.HorizontalAlignment = HorizontalAlignment.Right;
                this.netWindow.roadReslut.Blocks.Add(myParagraph);
            }
            SuccessFlag = true;
        }
Exemplo n.º 6
0
        private void OnSubmit(object sender, UploadStringCompletedEventArgs e)
        {
            ClearRoad();
            roadReslut.Blocks.Clear();
            if (e.Error != null)
            {
                MessageBox.Show("分析失败,错误原因为:" + e.Error.Message, "提示", MessageBoxButton.OK);
                return;
            }
            try
            {
                if (e.Result.IndexOf("COperResult") > -1)
                {
                    COperResult res = VectorObj.GetObject(e, typeof(COperResult)) as COperResult;
                    MessageBox.Show(res.ErrorInfo, "提示", MessageBoxButton.OK);
                    return;
                }
                CPathAnalyzeResult obj = _spatial.OnNetAnalyse(e);
                if (obj == null || obj.Paths == null)
                {
                    return;
                }
                CNetPath  path        = obj.Paths[0];
                int       edgeNum     = path.Edges.Length;
                Paragraph myParagraph = new Paragraph();
                myParagraph.Inlines.Add(new Run()
                {
                    Text = "1.从起点出发"
                });
                Bold       bold;
                IMSMark    mark;
                StackPanel panel;
                for (int i = 0; i < edgeNum; i++)
                {
                    CNetEdge edge = path.Edges[i];
                    if (i != 0)
                    {
                        myParagraph.Inlines.Add(new Run()
                        {
                            Text = (i + 1).ToString() + "."
                        });
                    }
                    myParagraph.Inlines.Add(new Run()
                    {
                        Text = "经"
                    });
                    bold = new Bold()
                    {
                        Foreground = new SolidColorBrush(Colors.Red)
                    };
                    bold.Inlines.Add(edge.FieldValus[2]);
                    myParagraph.Inlines.Add(bold);
                    if (i != edgeNum - 1)
                    {
                        myParagraph.Inlines.Add(new Run()
                        {
                            Text = "到达"
                        });
                        bold = new Bold()
                        {
                            Foreground = new SolidColorBrush(Colors.Red)
                        };
                        bold.Inlines.Add(path.Nodes[i + 1].FieldValus[0] + "\n");
                        myParagraph.Inlines.Add(bold);
                    }
                    else
                    {
                        myParagraph.Inlines.Add(new Run()
                        {
                            Text = "到达终点"
                        });
                    }
                    if (GraphicsLayer != null)
                    {
                        if (m_road == null)
                        {
                            m_road = new IMSPolyline(CoordinateType.Logic);
                            m_road.Shape.Stroke = new SolidColorBrush(Colors.Red);
                            GraphicsLayer.AddGraphics(m_road);
                        }
                        for (int j = 0; j < edge.Dots.Length; j++)
                        {
                            m_road.Points.Add(new Point(edge.Dots[j].x, edge.Dots[j].y));
                        }
                        panel = new StackPanel()
                        {
                            Orientation = Orientation.Horizontal
                        };
                        panel.Children.Add(new Image()
                        {
                            Source = new BitmapImage(new Uri("../images/bus/stop.png", UriKind.Relative))
                        });
                        panel.Children.Add(new TextBlock()
                        {
                            Text = edge.FieldValus[2]
                        });
                        mark = new IMSMark(panel, CoordinateType.Logic, MarkLayer)
                        {
                            EnableAnimation = false, EnableDrag = false
                        };
                        mark.X = edge.Dots[edge.Dots.Length / 2].x;
                        mark.Y = edge.Dots[edge.Dots.Length / 2].y;
                        MarkLayer.AddMark(mark);
                        m_stopList.Add(mark);
                    }
                }


                m_road.Draw();
                roadReslut.Blocks.Add(myParagraph);
                radioButton1.IsChecked = false;
                radioButton2.IsChecked = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "提示", MessageBoxButton.OK);
            }
        }
Exemplo n.º 7
0
        private void reDrawMeasurePnts(GraphicsLayer gLayer, IGraphics graphics, List <Point> logPntArr)
        {
            IsDrawOver = true;
            this.m_graphicsLayer.RemoveGraphics(this.measurePnts[this.measurePnts.Count - 1]);
            this.measurePnts.RemoveAt(this.measurePnts.Count - 1);
            if (this.measureMarks != null && this.measureMarks.Count != 0)
            {
                this.mymarklayer.RemoveMark(this.measureMarks[this.measureMarks.Count - 1]);
                this.measureMarks.RemoveAt(this.measureMarks.Count - 1);
            }
            if (this.measureCenterMarks != null && this.measureCenterMarks.Count != 0)
            {
                this.mymarklayer.RemoveMark(this.measureCenterMarks[this.measureCenterMarks.Count - 1]);
                this.measureCenterMarks.RemoveAt(this.measureCenterMarks.Count - 1);

                this.mymarklayer.RemoveMark(this.measureCenterMarks[this.measureCenterMarks.Count - 1]);
                this.measureCenterMarks.RemoveAt(this.measureCenterMarks.Count - 1);
            }
            switch (graphics.DrawingType)
            {
            case DrawingType.Polyline:
                IMSPolyline pl = new IMSPolyline(CoordinateType.Logic)
                {
                    EnableEdit = true
                };
                this.m_graphicsLayer.AddGraphics(pl);
                for (int i = 0; i < logPntArr.Count; i++)
                {
                    pl.Points.Add(logPntArr[i]);
                }
                pl.Draw();

                pl.EditMark1DragInCallback   += new EditMarkDelegate(markLengthMove);
                pl.EditMark1DragOverCallback += new EditMarkDelegate(markOver);
                pl.EditMark2DragInCallback   += new EditMarkDelegate(mark2LengthMove);
                pl.EditMark2DragOverCallback += new EditMarkDelegate(mark2LengthOver);
                pl.EnableEdit = false;
                measureGraphic.Add(pl);
                break;

            case DrawingType.Polygon:
                IMSPolygon p2 = new IMSPolygon(CoordinateType.Logic)
                {
                    EnableEdit = true
                };
                this.m_graphicsLayer.AddGraphics(p2);
                for (int i = 0; i < logPntArr.Count; i++)
                {
                    p2.Points.Add(logPntArr[i]);
                }
                p2.Draw();
                p2.EditMark1DragInCallback   += new EditMarkDelegate(markAreaMove);
                p2.EditMark1DragOverCallback += new EditMarkDelegate(markOver);
                p2.EnableEdit = false;
                measureGraphic.Add(p2);
                break;
            }
            //   if (this.measureMark != null)
            //   {
            //   (this.measureMark.MarkControl as Label).Content = "";
            //    (this.measureMark.MarkControl as Label).Visibility = System.Windows.Visibility.Collapsed;
            //   }
            //    if (this.measurePnts != null)
            //     {
            //        for (int i = 0; i < this.measurePnts.Count; i++)
            //        {
            //            this.m_graphicsLayer.RemoveGraphics(this.measurePnts[i]);
            //       }
            //   }
            this.m_mapContainer.MouseMove -= new MouseEventHandler(m_graphicsLayer_MouseMove);
        }