private void NetSubmit(object sender, RoutedEventArgs e) { if (SuccessFlag == true) { if (netWindow != null) { this.netWindow.removeFlash(); ClearRoad(); this.netWindow.roadReslut.Blocks.Clear(); this.netWindow.Close(); netWindow = null; } SuccessFlag = false; CGdbInfo gdb = new CGdbInfo(); gdb.GDBName = this.GDBName; gdb.GDBSvrName = this.GDBSvrName; gdb.Password = this.Password; gdb.User = this.User; CNetAnalyse obj = new CNetAnalyse(); obj.GdbInfo = gdb; obj.NetLayerName = this.NetLayerName; obj.RequestDots = this.pathDots.Substring(0, this.pathDots.Length - 1); obj.BarrierDots = ""; obj.NearDis = 0.002; obj.FlgType = "line"; obj.NetWeight = ",Weight1,Weight1"; obj.AnalysTypeParam = AnalysType.UserMode.ToString(); _spatial = new SpacialAnalyse(this.mapDoc); _spatial.NetAnalyse(obj, new UploadStringCompletedEventHandler(OnSubmit)); } }
private void clearNet(object sender, RoutedEventArgs e) { SuccessFlag = true; ClearRoad(); if (netWindow != null) { this.netWindow.removeFlash(); this.netWindow.roadReslut.Blocks.Clear(); this.netWindow.Close(); netWindow = null; } }
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; }