/// <summary> /// 显示起点编辑器 /// </summary> public static void ForkLineShowStart(int index) { MapElement.MapObject.ForkLines[index].StartRect.Fill = CavnvasBase.GetSolid(100, Colors.Pink);//半透明 MapElement.MapObject.ForkLines[index].StartRect.StrokeThickness = 0.5; MapElement.MapObject.ForkLines[index].StartRect.Stroke = Brushes.Gray; MapElement.MapObject.ForkLines[index].StartRect.Width = MapElement.GridSize; MapElement.MapObject.ForkLines[index].StartRect.Height = MapElement.GridSize; MapElement.CvForkLine.Children.Add(MapElement.MapObject.ForkLines[index].StartRect); }
/// <summary> /// 显示终点编辑器 /// </summary> public static void RouteLineShowEnd(int index) { MapElement.MapObject.Lines[index].EndRect.Fill = CavnvasBase.GetSolid(100, Colors.Green); //半透明 MapElement.MapObject.Lines[index].EndRect.StrokeThickness = 0.5; MapElement.MapObject.Lines[index].EndRect.Stroke = Brushes.Gray; MapElement.MapObject.Lines[index].EndRect.Width = MapElement.GridSize; MapElement.MapObject.Lines[index].EndRect.Height = MapElement.GridSize; MapElement.CvRouteLine.Children.Add(MapElement.MapObject.Lines[index].EndRect); }
public static void RouteLineShowEnd(MapElement.RouteLine routeLinex) { routeLinex.EndRect.Fill = CavnvasBase.GetSolid(100, Colors.Green); //半透明 routeLinex.EndRect.StrokeThickness = 0.5; routeLinex.EndRect.Stroke = Brushes.Gray; routeLinex.EndRect.Width = MapElement.GridSize; routeLinex.EndRect.Height = MapElement.GridSize; MapElement.CvRouteLine.Children.Add(routeLinex.EndRect); }
/// <summary> /// 添加一个新的RFID并显示 /// </summary> /// <param name="canvas">画布对象</param> /// <returns>返回该RFID的索引</returns> public static int AddRFIDAndShow() { /*-------添加对象-------------------*/ //定义RFID对象 MapElement.RFID rfid = new MapElement.RFID(); //设置编号【没有元素从1开始,否则按最后一个的编号加1】 if (MapElement.MapObject.RFIDS.Count == 0) { rfid.Num = MapElement.MapObject.RFIDS.Count + 1; } else { rfid.Num = MapElement.MapObject.RFIDS.Last().Num + 1; } //添加RFID到列表 MapElement.MapObject.RFIDS.Add(rfid); /*-------绘制到界面-------------------*/ //半径 float Radius = MapElement.RFID_Radius; //当前光标位置 Point point = MapOperate.NowPoint; point.X -= MapElement.GridSize / 2; point.Y -= MapElement.GridSize / 2; //对MapElement.GridSize取余,实现移动时按照栅格移动效果 Thickness thickness = new Thickness(); thickness.Left = point.X - point.X % MapElement.GridSize; thickness.Top = point.Y - point.Y % MapElement.GridSize; //绘制 rfid.ellipse.Height = Radius * 2; rfid.ellipse.Width = Radius * 2; rfid.ellipse.Margin = thickness; rfid.ellipse.StrokeThickness = 0.5; rfid.ellipse.Fill = CavnvasBase.GetSolid(200, Colors.Green); rfid.ellipse.Stroke = CavnvasBase.GetSolid(100, Colors.Green); MapElement.CvRFID.Children.Add(rfid.ellipse); //显示编号 CavnvasBase.DrawText( rfid.ellipse.Margin.Left + Radius, rfid.ellipse.Margin.Top + Radius, rfid.Num.ToString(), Colors.Black, MapElement.CvRFID, rfid.textBlock ); /*-------设置该RFID为当前正在操作的RFID-------------------*/ return(MapElement.MapObject.RFIDS.Count - 1); }
public static void ForkLineShowEnd(MapElement.RouteForkLine routeForkLine) { //找到圆弧起点和终点坐标 PathGeometry pathGeometry = routeForkLine.Path.Data as PathGeometry; PathFigure figure = pathGeometry.Figures.First(); ArcSegment arc = figure.Segments.First() as ArcSegment; //圆弧终点 Point end = arc.Point; end.X += routeForkLine.Path.Margin.Left - MapElement.GridSize / 2; end.Y += routeForkLine.Path.Margin.Top - MapElement.GridSize / 2; //终点编辑器的位置和圆弧终点坐标同步 routeForkLine.EndRect.Margin = new Thickness(end.X, end.Y, 0, 0); routeForkLine.EndRect.Fill = CavnvasBase.GetSolid(100, Colors.Pink); //半透明 routeForkLine.EndRect.StrokeThickness = 0.5; routeForkLine.EndRect.Stroke = Brushes.Gray; routeForkLine.EndRect.Width = MapElement.GridSize; routeForkLine.EndRect.Height = MapElement.GridSize; MapElement.CvForkLine.Children.Add(routeForkLine.EndRect); }