/// <summary> /// This method updates the route polyline, especially by providing a new geometry. /// The DragAndDrop handling is corrected. /// </summary> /// <param name="points">Points defining the new geometry for the polyline.</param> /// <param name="toolTip">Tool tip of the hole polyline.</param> /// <param name="style">Display style of the polyline.</param> public void Update(IEnumerable <Point> points, string toolTip, ShapeStyle style) { if (route != null && !PointsExists()) { // remove drag and drop behavior InProcessDragDropBehavior.RemoveDragHandler(MapPolyline, Drag); InProcessDragDropBehavior.SetEnableDragDrop(MapPolyline, true); InProcessDragDropBehavior.RemoveDragHandler(AnimatedPolyline, Drag); InProcessDragDropBehavior.SetEnableDragDrop(AnimatedPolyline, true); } Dispose(); Points = points; ToolTip = toolTip; Color = style == null ? Colors.Black : style.Color; if (route == null || PointsExists()) { return; } // add drag and drop behavior InProcessDragDropBehavior.SetEnableDragDrop(MapPolyline, true); InProcessDragDropBehavior.AddDragHandler(MapPolyline, Drag); InProcessDragDropBehavior.SetEnableDragDrop(AnimatedPolyline, true); InProcessDragDropBehavior.AddDragHandler(AnimatedPolyline, Drag); }
/// <summary> /// Creates the way point /// </summary> /// <param name="layer">Assigned route layer</param> /// <param name="p">Position of the way point (world coordinates)</param> /// <param name="style">Style of the way point</param> protected WayPoint(RouteLayer layer, Point p, ShapeStyle style) { this.layer = layer; Width = Height = style.Size; // set initial position and show polyline // do not use Point property to avoid LocationChanged event in initialization ShapeCanvas.SetLocation(this, p); // drag and drop handlers InProcessDragDropBehavior.AddDragHandler(this, Drag); InProcessDragDropBehavior.AddDragMoveHandler(this, DragMove); InProcessDragDropBehavior.SetEnableDragDrop(this, true); // handler for context menu MouseRightButtonDown += WayPoint_MouseRightButtonDown; }