示例#1
0
        /// <summary>
        /// Creates a stop.
        /// </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>
        public Stop(RouteLayer layer, Point p, ShapeStyle style) : base(layer, p, style)
        {
            // add a pin
            Pin = new Pin {
                Color = style.Color, Width = style.Size, Height = style.Size
            };
            Children.Add(Pin);

            // overlay pin with a text block
            Children.Add(new TextBlock
            {
                Text            = "",
                Foreground      = new SolidColorBrush(Colors.Black),
                FontSize        = style.Size * 0.3125,
                FontWeight      = FontWeight.FromOpenTypeWeight(800),
                RenderTransform = new RotateTransform(-45),
                Effect          = new DropShadowEffect
                {
                    ShadowDepth = 0.125 * style.Size,
                    Direction   = 45,
                    Color       = Colors.White,
                    Opacity     = 0.5,
                    BlurRadius  = 0.125 * style.Size
                }
            });

            // position subordinate elements
            SetLeft(Children[1], 0.25 * style.Size);
            SetTop(Children[1], 0.4375 * style.Size);

            ShapeCanvas.SetAnchor(this, LocationAnchor.RightBottom);
            layer.Shapes.Add(this);
        }
 /// <summary>
 /// Creates the route.
 /// </summary>
 /// <param name="layer">The route layer the route belongs to.</param>
 public Route(RouteLayer layer)
 {
     this.layer      = layer;
     timer.Tick     += Timer_Elapsed;
     finalPolyline   = new RoutePolylineWithDragAndDrop(layer, this);
     previewPolyline = new RoutePolylineWithDragAndDrop(layer);
 }
示例#3
0
        /// <summary>
        /// Displays the temporary via way point
        /// </summary>
        /// <param name="layer">Assigned route layer</param>
        /// <param name="route">Assigned route</param>
        /// <param name="p">Position of the via way point (word coordinates)</param>
        public static void Show(RouteLayer layer, Route route, System.Windows.Point p)
        {
            if (instance == null)
            {
                instance = new TemporaryVia(layer, p, RouteLayer.TMPVIA_STYLE)
                {
                    ZIndex = 999
                }
            }
            ;

            instance.Route = route;
            instance.Point = p;
        }
示例#4
0
        /// <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;
        }
示例#5
0
        /// <summary>
        /// Creates a via 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>
        public Via(RouteLayer layer, System.Windows.Point p, ShapeStyle style)
            : base(layer, p, style)
        {
            Children.Add(new Ball
            {
                Color  = style.Color,
                Stroke = Colors.Black,
                Width  = style.Size,
                Height = style.Size
            });

            // must set a tool tip for the ToolTipOpening event to be raised.
            ToolTip              = "<null>";
            base.ToolTipOpening += ToolTipOpening;

            ShapeCanvas.SetAnchor(this, LocationAnchor.Center);
            layer.Shapes.Add(this);
        }
 /// <summary>
 /// Create a route polyline.
 /// </summary>
 /// <param name="layer">The layer the route and the polyline belongs to.</param>
 /// <param name="route">The route the polyline belongs to</param>
 public RoutePolylineWithDragAndDrop(RouteLayer layer, Route route = null) : base(layer)
 {
     this.route = route;
 }
示例#7
0
 /// <summary>
 /// Creates the temporary via way point.
 /// </summary>
 /// <param name="layer">Assigned Routing layer</param>
 /// <param name="p">Position of the via way point (word coordinates)</param>
 /// <param name="style">Style of the way point</param>
 private TemporaryVia(RouteLayer layer, System.Windows.Point p, ShapeStyle style)
     : base(layer, p, style)
 {
 }