Beispiel #1
0
        private void RenderNormalConnectLine(RenderManager.CameraInfo cameraInfo)
        {
            var pointPair = new MarkupPointPair(SelectPoint, HoverPoint);
            var color     = EditMarkup.ExistConnection(pointPair) ? MarkupColors.Red : MarkupColors.Blue;

            var lineBezier = new Bezier3()
            {
                a = SelectPoint.Position,
                b = HoverPoint.Position,
                c = SelectPoint.Position,
                d = HoverPoint.Position,
            };

            RenderBezier(cameraInfo, color, lineBezier);

            var normal = SelectPoint.Direction.Turn90(false);

            var normalBezier = new Bezier3
            {
                a = SelectPoint.Position + SelectPoint.Direction,
                d = SelectPoint.Position + normal
            };

            normalBezier.b = normalBezier.a + normal / 2;
            normalBezier.c = normalBezier.d + SelectPoint.Direction / 2;
            RenderBezier(cameraInfo, color, normalBezier, 2f, true);
        }
Beispiel #2
0
        private void RenderNormalConnectLine(RenderManager.CameraInfo cameraInfo)
        {
            var pointPair = new MarkupPointPair(SelectPoint, HoverPoint);
            var color     = Tool.Markup.ExistLine(pointPair) ? (Utility.OnlyCtrlIsPressed ? Colors.Yellow : Colors.Red) : Colors.Purple;

            var lineBezier = new Bezier3()
            {
                a = SelectPoint.Position,
                b = HoverPoint.Position,
                c = SelectPoint.Position,
                d = HoverPoint.Position,
            };

            lineBezier.RenderBezier(new OverlayData(cameraInfo)
            {
                Color = color
            });

            var normal = SelectPoint.Direction.Turn90(false);

            var normalBezier = new Bezier3
            {
                a = SelectPoint.Position + SelectPoint.Direction,
                d = SelectPoint.Position + normal
            };

            normalBezier.b = normalBezier.a + normal / 2;
            normalBezier.c = normalBezier.d + SelectPoint.Direction / 2;
            normalBezier.RenderBezier(new OverlayData(cameraInfo)
            {
                Color = color, Width = 2f, Cut = true
            });
        }
Beispiel #3
0
        public override void OnPrimaryMouseClicked(Event e)
        {
            if (!IsHoverPoint)
            {
                return;
            }

            if (!IsSelectPoint)
            {
                base.OnPrimaryMouseClicked(e);
            }
            else
            {
                var pointPair = new MarkupPointPair(SelectPoint, HoverPoint);

                if (Tool.Markup.TryGetLine(pointPair, out MarkupLine line))
                {
                    Tool.DeleteItem(line, OnDelete);
                }
                else
                {
                    var style            = Tool.GetStyleByModifier <CrosswalkStyle, CrosswalkStyle.CrosswalkType>(CrosswalkStyle.CrosswalkType.Zebra);
                    var newCrosswalkLine = Tool.Markup.AddCrosswalkLine(pointPair, style);
                    Panel.EditCrosswalk(newCrosswalkLine?.Crosswalk);
                }

                SelectPoint = null;
                SetTarget();
            }
        }
Beispiel #4
0
        public static bool FromXml(XElement config, Markup makrup, ObjectsMap map, out MarkupLine line, out bool invert)
        {
            var lineId = config.GetAttrValue <ulong>(nameof(Id));

            if (!MarkupPointPair.FromHash(lineId, makrup, map, out MarkupPointPair pointPair, out invert))
            {
                line = null;
                return(false);
            }

            if (!makrup.TryGetLine(pointPair, out line))
            {
                var type = (LineType)config.GetAttrValue("T", (int)pointPair.DefaultType);
                switch (type)
                {
                case LineType.Regular:
                    line = new MarkupRegularLine(makrup, pointPair);
                    break;

                case LineType.Stop:
                    line = new MarkupStopLine(makrup, pointPair);
                    break;

                case LineType.Crosswalk:
                    line = new MarkupCrosswalkLine(makrup, pointPair);
                    break;

                default:
                    return(false);
                }
            }

            return(true);
        }
Beispiel #5
0
        public override void OnPrimaryMouseClicked(Event e)
        {
            if (!IsHoverPoint)
            {
                return;
            }

            if (!IsSelectPoint)
            {
                base.OnPrimaryMouseClicked(e);
            }
            else
            {
                var pointPair = new MarkupPointPair(SelectPoint, HoverPoint);

                if (Tool.Markup.TryGetLine(pointPair, out MarkupLine line))
                {
                    Tool.DeleteItem(line, () =>
                    {
                        Tool.Markup.RemoveLine(line);
                        Panel.UpdatePanel();
                    });
                }
                else
                {
                    var lineType = pointPair.IsStopLine ? NodeMarkupTool.GetStyle(StopLineStyle.StopLineType.Solid) : NodeMarkupTool.GetStyle(RegularLineStyle.RegularLineType.Dashed);
                    var newLine  = Tool.Markup.AddLine(pointPair, lineType);
                    Panel.EditLine(newLine);
                }

                SelectPoint = null;
                SetTarget();
            }
        }
Beispiel #6
0
        private void RenderNormalConnectLine(RenderManager.CameraInfo cameraInfo)
        {
            var pointPair = new MarkupPointPair(SelectPoint, HoverPoint);
            var color     = Tool.Markup.ExistLine(pointPair) ? Colors.Red : Colors.Purple;

            var lineBezier = new Bezier3()
            {
                a = SelectPoint.Position,
                b = HoverPoint.Position,
                c = SelectPoint.Position,
                d = HoverPoint.Position,
            };

            NodeMarkupTool.RenderBezier(cameraInfo, lineBezier, color);

            var normal = SelectPoint.Direction.Turn90(false);

            var normalBezier = new Bezier3
            {
                a = SelectPoint.Position + SelectPoint.Direction,
                d = SelectPoint.Position + normal
            };

            normalBezier.b = normalBezier.a + normal / 2;
            normalBezier.c = normalBezier.d + SelectPoint.Direction / 2;
            NodeMarkupTool.RenderBezier(cameraInfo, normalBezier, color, 2f, cut: true);
        }
Beispiel #7
0
        public MarkupLine(Markup markup, MarkupPointPair pointPair)
        {
            Markup    = markup;
            PointPair = pointPair;

            UpdateTrajectory();
        }
Beispiel #8
0
        public override void OnPrimaryMouseClicked(Event e)
        {
            if (!IsHoverPoint)
            {
                return;
            }

            if (!IsSelectPoint)
            {
                base.OnPrimaryMouseClicked(e);
            }
            else
            {
                var pointPair = new MarkupPointPair(SelectPoint, HoverPoint);

                if (Tool.Markup.TryGetLine(pointPair, out MarkupLine line))
                {
                    Tool.DeleteItem(line, () =>
                    {
                        Tool.Markup.RemoveLine(line);
                        Panel.UpdatePanel();
                    });
                }
                else
                {
                    var newCrosswalkLine = Tool.Markup.AddLine(pointPair, NodeMarkupTool.GetStyle(CrosswalkStyle.CrosswalkType.Zebra)) as MarkupCrosswalkLine;
                    Panel.EditCrosswalk(newCrosswalkLine?.Crosswalk);
                }

                SelectPoint = null;
                SetTarget();
            }
        }
Beispiel #9
0
        private void RenderConnectCrosswalkLine(RenderManager.CameraInfo cameraInfo)
        {
            var bezier    = new Line3(SelectPoint.Position, HoverPoint.Position).GetBezier();
            var pointPair = new MarkupPointPair(SelectPoint, HoverPoint);
            var color     = Tool.Markup.ExistLine(pointPair) ? Colors.Red : Colors.Green;

            NodeMarkupTool.RenderBezier(cameraInfo, bezier, color, MarkupCrosswalkPoint.Shift * 2, cut: true);
        }
Beispiel #10
0
        private void RenderConnectCrosswalkLine(RenderManager.CameraInfo cameraInfo)
        {
            var bezier    = new Line3(SelectPoint.Position, HoverPoint.Position).GetBezier();
            var pointPair = new MarkupPointPair(SelectPoint, HoverPoint);
            var color     = EditMarkup.ExistConnection(pointPair) ? MarkupColors.Red : MarkupColors.Green;

            RenderBezier(cameraInfo, color, bezier, MarkupCrosswalkPoint.Shift * 2, true);
        }
Beispiel #11
0
        public MarkupRegularLine(Markup markup, MarkupPointPair pointPair, RegularLineStyle.RegularLineType lineType) :
            base(markup, pointPair)
        {
            var lineStyle = TemplateManager.StyleManager.GetDefault <RegularLineStyle>((Style.StyleType)(int) lineType);

            AddRule(lineStyle, false, false);
            RecalculateStyleData();
        }
Beispiel #12
0
        private void OnMakeLine(Event e)
        {
            var pointPair = new MarkupPointPair(SelectPoint, HoverPoint);
            var lineType  = pointPair.IsSomeEnter ? e.GetStopStyle() : e.GetSimpleStyle();
            var newLine   = EditMarkup.ToggleConnection(pointPair, lineType);

            Panel.EditLine(newLine);
            SelectPoint = null;
        }
Beispiel #13
0
        protected MarkupLine(Markup markup, MarkupPointPair pointPair, bool update = true)
        {
            Markup    = markup;
            PointPair = pointPair;

            if (update)
            {
                Update(true);
            }
        }
Beispiel #14
0
        private void OnMakeCrosswalk(Event e)
        {
            var pointPair = new MarkupPointPair(SelectPoint, HoverPoint);

            var newCrosswalkLine = EditMarkup.ToggleConnection(pointPair, e.GetCrosswalkStyle()) as MarkupCrosswalkLine;

            Panel.EditCrosswalk(newCrosswalkLine?.Crosswalk);

            SelectPoint = null;
            SetTarget();
        }
Beispiel #15
0
        private void RenderConnectCrosswalkLine(RenderManager.CameraInfo cameraInfo)
        {
            var bezier    = new Line3(SelectPoint.Position, HoverPoint.Position).GetBezier();
            var pointPair = new MarkupPointPair(SelectPoint, HoverPoint);
            var color     = Tool.Markup.ExistLine(pointPair) ? (Utility.OnlyCtrlIsPressed ? Colors.Yellow : Colors.Red) : Colors.Green;

            bezier.RenderBezier(new OverlayData(cameraInfo)
            {
                Color = color, Width = MarkupCrosswalkPoint.Shift * 2, Cut = true
            });
        }
Beispiel #16
0
        public MarkupCrosswalkLine(Markup markup, MarkupPointPair pointPair, CrosswalkStyle style = null) : base(markup, pointPair, update: false)
        {
            if (style == null)
            {
                style = SingletonManager <StyleTemplateManager> .Instance.GetDefault <CrosswalkStyle>(Style.StyleType.CrosswalkExistent);
            }

            Crosswalk = new MarkupCrosswalk(Markup, this, style);
            Update(true);
            Markup.AddCrosswalk(Crosswalk);
        }
Beispiel #17
0
        private void OnMakeLine(Event e)
        {
            var pointPair = new MarkupPointPair(SelectPoint, HoverPoint);

            var lineType = pointPair.IsStopLine ? e.GetStopStyle() : e.GetRegularStyle();
            var newLine  = EditMarkup.ToggleConnection(pointPair, lineType);

            Panel.EditLine(newLine);

            SelectPoint = null;
            SetTarget();
        }
Beispiel #18
0
 public bool TryGetLine <LineType>(ulong lineId, Dictionary <ObjectId, ObjectId> map, out LineType line)
     where LineType : MarkupLine
 {
     if (MarkupPointPair.FromHash(lineId, this, map, out MarkupPointPair pair))
     {
         return(TryGetLine(pair.Hash, out line));
     }
     else
     {
         line = null;
         return(false);
     }
 }
Beispiel #19
0
        public MarkupStopLine(Markup markup, MarkupPointPair pointPair, StopLineStyle style = null, Alignment firstAlignment = Alignment.Centre, Alignment secondAlignment = Alignment.Centre) : base(markup, pointPair, false)
        {
            RawStartAlignment = new PropertyEnumValue <Alignment>("AL", AlignmentChanged, firstAlignment);
            RawEndAlignment   = new PropertyEnumValue <Alignment>("AR", AlignmentChanged, secondAlignment);

            style ??= SingletonManager <StyleTemplateManager> .Instance.GetDefault <StopLineStyle>(Style.StyleType.StopLineSolid);

            var rule = new MarkupLineRawRule <StopLineStyle>(this, style, new EnterPointEdge(Start), new EnterPointEdge(End));

            SetRule(rule);

            Update(true);
            RecalculateStyleData();
        }
Beispiel #20
0
 protected MarkupStraightLine(Markup markup, MarkupPointPair pointPair, StyleType styleType) : base(markup, pointPair, false)
 {
     if (Visible)
     {
         var style = GetDefaultStyle(styleType);
         var rule  = new MarkupLineRawRule <Style>(this, style, new EnterPointEdge(Start), new EnterPointEdge(End));
         SetRule(rule);
     }
     Update(true);
     if (Visible)
     {
         RecalculateStyleData();
     }
 }
Beispiel #21
0
 public MarkupLine ToggleConnection(MarkupPointPair pointPair, Style.StyleType style)
 {
     if (LinesDictionary.TryGetValue(pointPair.Hash, out MarkupLine line))
     {
         RemoveConnect(line);
         return(null);
     }
     else
     {
         line = MarkupLine.FromStyle(this, pointPair, style);
         LinesDictionary[pointPair.Hash] = line;
         NeedRecalculateBatches          = true;
         return(line);
     }
 }
Beispiel #22
0
        public MarkupRegularLine(Markup markup, MarkupPointPair pointPair, RegularLineStyle style = null, Alignment alignment = Alignment.Centre, bool update = true) : base(markup, pointPair, false)
        {
            RawAlignment = new PropertyEnumValue <Alignment>("A", AlignmentChanged, alignment);

            if (update)
            {
                Update(true);
            }

            if (style != null)
            {
                AddRule(style, false, false);
                RecalculateStyleData();
            }
        }
Beispiel #23
0
        public static bool FromXml(XElement config, Markup makrup, Dictionary <ObjectId, ObjectId> map, out MarkupLine line)
        {
            var lineId = config.GetAttrValue <ulong>(nameof(Id));

            MarkupPointPair.FromHash(lineId, makrup, map, out MarkupPointPair pointPair);
            if (!makrup.TryGetLine(pointPair.Hash, out line))
            {
                line = new MarkupLine(makrup, pointPair);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #24
0
        private void RenderRegularConnectLine(RenderManager.CameraInfo cameraInfo)
        {
            var bezier = new Bezier3()
            {
                a = SelectPoint.Position,
                b = HoverPoint.Enter == SelectPoint.Enter ? HoverPoint.Position - SelectPoint.Position : SelectPoint.Direction,
                c = HoverPoint.Enter == SelectPoint.Enter ? SelectPoint.Position - HoverPoint.Position : HoverPoint.Direction,
                d = HoverPoint.Position,
            };

            var pointPair = new MarkupPointPair(SelectPoint, HoverPoint);
            var color     = EditMarkup.ExistConnection(pointPair) ? MarkupColors.Red : MarkupColors.Green;

            NetSegment.CalculateMiddlePoints(bezier.a, bezier.b, bezier.d, bezier.c, true, true, out bezier.b, out bezier.c);
            RenderBezier(cameraInfo, color, bezier);
        }
Beispiel #25
0
        public static bool FromXml(XElement config, MarkupLine mainLine, Dictionary <ObjectId, ObjectId> map, out LinesIntersectEdge linePoint)
        {
            var lineId = config.GetAttrValue <ulong>(MarkupLine.XmlName);

            MarkupPointPair.FromHash(lineId, mainLine.Markup, map, out MarkupPointPair pair);
            if (mainLine.Markup.TryGetLine(pair.Hash, out MarkupLine line))
            {
                linePoint = new LinesIntersectEdge(mainLine, line);
                return(true);
            }
            else
            {
                linePoint = null;
                return(false);
            }
        }
Beispiel #26
0
        protected MarkupEnterLine(Markup markup, MarkupPointPair pointPair, Style style, Alignment firstAlignment, Alignment secondAlignment) : base(markup, pointPair, false)
        {
            if (Visible)
            {
                var rule = new MarkupLineRawRule <Style>(this, style, new EnterPointEdge(Start), new EnterPointEdge(End));
                SetRule(rule);
            }

            StartAlignment = firstAlignment;
            EndAlignment   = secondAlignment;

            Update(true);
            if (Visible)
            {
                RecalculateStyleData();
            }
        }
Beispiel #27
0
        public static bool FromXml(XElement config, Markup markup, Dictionary<ObjectId, ObjectId> map, out IntersectFillerVertex linePoint)
        {
            var lineId1 = config.GetAttrValue<ulong>(MarkupPointPair.XmlName1);
            MarkupPointPair.FromHash(lineId1, markup, map, out MarkupPointPair pair1);
            var lineId2 = config.GetAttrValue<ulong>(MarkupPointPair.XmlName2);
            MarkupPointPair.FromHash(lineId2, markup, map, out MarkupPointPair pair2);

            if (markup.TryGetLine(pair1.Hash, out MarkupLine line1) && markup.TryGetLine(pair2.Hash, out MarkupLine line2))
            {
                linePoint = new IntersectFillerVertex(line1, line2);
                return true;
            }
            else
            {
                linePoint = null;
                return false;
            }
        }
Beispiel #28
0
        public override void OnPrimaryMouseClicked(Event e)
        {
            if (!IsHoverPoint)
            {
                return;
            }

            if (!IsSelectPoint)
            {
                base.OnPrimaryMouseClicked(e);
            }
            else
            {
                var pointPair = new MarkupPointPair(SelectPoint, HoverPoint);

                if (Tool.Markup.TryGetLine(pointPair, out MarkupLine line))
                {
                    if (Utility.OnlyCtrlIsPressed)
                    {
                        Panel.SelectLine(line);
                    }
                    else
                    {
                        Tool.DeleteItem(line, OnDelete);
                    }
                }
                else if (pointPair.IsStopLine)
                {
                    var style   = Tool.GetStyleByModifier <StopLineStyle, StopLineStyle.StopLineType>(NetworkType.Road, StopLineStyle.StopLineType.Solid);
                    var newLine = Tool.Markup.AddStopLine(pointPair, style);
                    Panel.SelectLine(newLine);
                }
                else
                {
                    var style   = Tool.GetStyleByModifier <RegularLineStyle, RegularLineStyle.RegularLineType>(pointPair.NetworkType, RegularLineStyle.RegularLineType.Dashed, true);
                    var newLine = Tool.Markup.AddRegularLine(pointPair, style);
                    Panel.SelectLine(newLine);
                }

                SelectPoint = null;
                SetTarget();
            }
        }
Beispiel #29
0
        private void RenderRegularConnectLine(RenderManager.CameraInfo cameraInfo)
        {
            var bezier = new Bezier3()
            {
                a = SelectPoint.Position,
                b = HoverPoint.Enter == SelectPoint.Enter ? HoverPoint.Position - SelectPoint.Position : SelectPoint.Direction,
                c = HoverPoint.Enter == SelectPoint.Enter ? SelectPoint.Position - HoverPoint.Position : HoverPoint.Direction,
                d = HoverPoint.Position,
            };

            var pointPair = new MarkupPointPair(SelectPoint, HoverPoint);
            var color     = Tool.Markup.ExistLine(pointPair) ? (Utility.OnlyCtrlIsPressed ? Colors.Yellow : Colors.Red) : Colors.Green;

            NetSegment.CalculateMiddlePoints(bezier.a, bezier.b, bezier.d, bezier.c, true, true, out bezier.b, out bezier.c);
            bezier.RenderBezier(new OverlayData(cameraInfo)
            {
                Color = color
            });
        }
Beispiel #30
0
        public MarkupLine ToggleConnection(MarkupPointPair pointPair, Style.StyleType style)
        {
            if (LinesDictionary.TryGetValue(pointPair.Hash, out MarkupLine line))
            {
                RemoveConnect(line);
                return(null);
            }
            else
            {
                if (pointPair.IsNormal && !EarlyAccess.CheckFunctionAccess(Localize.EarlyAccess_Function_PerpendicularLines))
                {
                    return(null);
                }

                line = MarkupLine.FromStyle(this, pointPair, style);
                LinesDictionary[pointPair.Hash] = line;
                NeedRecalculateBatches          = true;
                return(line);
            }
        }