Exemplo n.º 1
0
        public override bool TryGetPoint(byte pointNum, MarkupPoint.PointType type, out MarkupPoint point)
        {
            switch (type)
            {
            case MarkupPoint.PointType.Enter:
                return(base.TryGetPoint(pointNum, type, out point));

            case MarkupPoint.PointType.Crosswalk:
                if (CrosswalkPointsDic.TryGetValue(pointNum, out MarkupCrosswalkPoint crosswalkPoint))
                {
                    point = crosswalkPoint;
                    return(true);
                }
                break;

            case MarkupPoint.PointType.Normal:
                if (NormalPointsDic.TryGetValue(pointNum, out MarkupNormalPoint normalPoint))
                {
                    point = normalPoint;
                    return(true);
                }
                break;
            }
            point = null;
            return(false);
        }
Exemplo n.º 2
0
        public void FromXml(string version, XElement config, Dictionary <ObjectId, ObjectId> map = null)
        {
            if (VersionComparer.Instance.Compare(version, "1.2") < 0)
            {
                map = VersionMigration.Befor1_2(this, map);
            }

            foreach (var pointConfig in config.Elements(MarkupPoint.XmlName))
            {
                MarkupPoint.FromXml(pointConfig, this, map);
            }

            var toInit = new Dictionary <MarkupLine, XElement>();

            foreach (var lineConfig in config.Elements(MarkupLine.XmlName))
            {
                if (MarkupLine.FromXml(lineConfig, this, map, out MarkupLine line))
                {
                    LinesDictionary[line.Id] = line;
                    toInit[line]             = lineConfig;
                }
            }
            foreach (var pair in toInit)
            {
                pair.Key.FromXml(pair.Value, map);
            }

            foreach (var fillerConfig in config.Elements(MarkupFiller.XmlName))
            {
                if (MarkupFiller.FromXml(fillerConfig, this, map, out MarkupFiller filler))
                {
                    FillersList.Add(filler);
                }
            }
        }
Exemplo n.º 3
0
        public static bool FromId(int id, Markup markup, ObjectsMap map, out MarkupPoint point)
        {
            point = null;

            var enterId = GetEnter(id);
            var num     = GetNum(id);
            var type    = GetType(id);

            if (map.TryGetValue(new ObjectId()
            {
                Segment = enterId
            }, out ObjectId targetSegment))
            {
                enterId = targetSegment.Segment;
            }
            if (map.TryGetValue(new ObjectId()
            {
                Point = GetId(enterId, num, type)
            }, out ObjectId targetPoint))
            {
                num = GetNum(targetPoint.Point);
            }

            return(markup.TryGetEnter(enterId, out Enter enter) && enter.TryGetPoint(num, type, out point));
        }
Exemplo n.º 4
0
 public bool TryGetPoint(byte pointNum, out MarkupPoint point)
 {
     if (1 <= pointNum && pointNum <= PointCount)
     {
         point = PointsList[pointNum - 1];
         return(true);
     }
     else
     {
         point = null;
         return(false);
     }
 }
Exemplo n.º 5
0
 public virtual bool TryGetPoint(byte pointNum, MarkupPoint.PointType type, out MarkupPoint point)
 {
     if (type == MarkupPoint.PointType.Enter && EnterPointsDic.TryGetValue(pointNum, out MarkupEnterPoint enterPoint))
     {
         point = enterPoint;
         return(true);
     }
     else
     {
         point = null;
         return(false);
     }
 }
Exemplo n.º 6
0
 public static bool FromXml(XElement config, Markup markup, Dictionary<ObjectId, ObjectId> map, out EnterFillerVertex enterPoint)
 {
     var pointId = config.GetAttrValue<int>(MarkupPoint.XmlName);
     if (MarkupPoint.FromId(pointId, markup, map, out MarkupPoint point))
     {
         enterPoint = new EnterFillerVertex(point);
         return true;
     }
     else
     {
         enterPoint = null;
         return false;
     }
 }
Exemplo n.º 7
0
        public void Update(MarkupPoint point)
        {
            point.Update();

            foreach (var line in GetPointLines(point))
            {
                line.UpdateTrajectory();
            }
            foreach (var filler in GetPointFillers(point))
            {
                filler.Update();
            }

            RecalculateDashes();
        }
Exemplo n.º 8
0
        public static bool FromXml(XElement config, Markup markup, ObjectsMap map, out EnterPointEdge enterPoint)
        {
            var pointId = config.GetAttrValue <int>(MarkupPoint.XmlName);

            if (MarkupPoint.FromId(pointId, markup, map, out MarkupPoint point))
            {
                enterPoint = new EnterPointEdge(point);
                return(true);
            }
            else
            {
                enterPoint = null;
                return(false);
            }
        }
Exemplo n.º 9
0
        private ILinePartEdge GetDefaultEdge(MarkupPoint point)
        {
            if (!Settings.CutLineByCrosswalk || point.Type == MarkupPoint.PointType.Normal)
            {
                return(new EnterPointEdge(point));
            }

            var intersects = Markup.GetIntersects(this).Where(i => i.IsIntersect && i.Pair.GetOther(this) is MarkupCrosswalkLine line && line.PointPair.ContainsEnter(point.Enter)).ToArray();

            if (!intersects.Any())
            {
                return(new EnterPointEdge(point));
            }

            var intersect = intersects.Aggregate((i, j) => point == End ^ (i.FirstT > i.SecondT) ? i : j);

            return(new LinesIntersectEdge(intersect.Pair));
        }
Exemplo n.º 10
0
        public static bool FromXml(XElement config, Markup markup, ObjectsMap map, out EnterFillerVertexBase enterPoint)
        {
            var pointId = config.GetAttrValue <int>(MarkupPoint.XmlName);

            if (MarkupPoint.FromId(pointId, markup, map, out MarkupPoint point))
            {
                var lineId = config.GetAttrValue <ulong>(MarkupLine.XmlName);
                if (markup.TryGetLine(lineId, map, out MarkupRegularLine line))
                {
                    enterPoint = new LineEndFillerVertex(point, line);
                }
                else
                {
                    enterPoint = new EnterFillerVertex(point);
                }
                return(true);
            }
            else
            {
                enterPoint = null;
                return(false);
            }
        }
Exemplo n.º 11
0
        public static bool FromId(int id, Markup markup, ObjectsMap map, out MarkupPoint point)
        {
            point = null;

            var enterId = GetEnter(id);
            var num     = GetNum(id);
            var type    = GetType(id);

            switch (markup.Type)
            {
            case MarkupType.Node when map.TryGetValue(new ObjectId()
                {
                    Segment = enterId
                }, out ObjectId targetSegment):
                enterId = targetSegment.Segment;

                break;

            case MarkupType.Segment when map.TryGetValue(new ObjectId()
                {
                    Node = enterId
                }, out ObjectId targetNode):
                enterId = targetNode.Node;

                break;
            }

            if (map.TryGetValue(new ObjectId()
            {
                Point = GetId(enterId, num, type)
            }, out ObjectId targetPoint))
            {
                num = GetNum(targetPoint.Point);
            }

            return(markup.TryGetEnter(enterId, out Enter enter) && enter.TryGetPoint(num, type, out point));
        }
Exemplo n.º 12
0
 public IEnumerable <MarkupLine> GetPointLines(MarkupPoint point) => LinesDictionary.Values.Where(l => l.ContainsPoint(point));
Exemplo n.º 13
0
 protected MarkupLine(NodeMarkup markup, MarkupPoint first, MarkupPoint second, bool update = true) : this(markup, new MarkupPointPair(first, second), update)
 {
 }
Exemplo n.º 14
0
 public EnterSupportPoint(MarkupPoint point)
 {
     Point = point;
     Update();
 }
Exemplo n.º 15
0
        public static bool FromId(int id, Markup markup, Dictionary <ObjectId, ObjectId> map, out MarkupPoint point)
        {
            point = null;

            var enterId = GetEnter(id);
            var num     = GetNum(id);

            if (map != null)
            {
                if (map.TryGetValue(new ObjectId()
                {
                    Segment = enterId
                }, out ObjectId targetSegment))
                {
                    enterId = targetSegment.Segment;
                }
                if (map.TryGetValue(new ObjectId()
                {
                    Point = GetId(enterId, num)
                }, out ObjectId targetPoint))
                {
                    num = GetNum(targetPoint.Point);
                }
            }

            return(markup.TryGetEnter(enterId, out Enter enter) && enter.TryGetPoint(num, out point));
        }
Exemplo n.º 16
0
 static Alignment GetAlignment(MarkupRegularLine line, MarkupPoint point) => line?.GetAlignment(point) ?? Alignment.Centre;
Exemplo n.º 17
0
 public EnterFillerVertexBase(MarkupPoint point) : base(point)
 {
 }
Exemplo n.º 18
0
 public IEnumerable <MarkupFiller> GetPointFillers(MarkupPoint point) => FillersList.Where(f => f.ContainsPoint(point));
Exemplo n.º 19
0
 protected MarkupStraightLine(Markup markup, MarkupPoint first, MarkupPoint second, StyleType styleType) : this(markup, new MarkupPointPair(first, second), styleType)
 {
 }
Exemplo n.º 20
0
 public MarkupLine(Markup markup, MarkupPoint first, MarkupPoint second) : this(markup, new MarkupPointPair(first, second))
 {
 }
Exemplo n.º 21
0
 public bool ContainsPoint(MarkupPoint point) => PointPair.ContainPoint(point);
Exemplo n.º 22
0
 public bool IsStart(MarkupPoint point) => Start == point;
Exemplo n.º 23
0
 public bool IsEnd(MarkupPoint point) => End == point;
Exemplo n.º 24
0
 public Alignment GetAlignment(MarkupPoint point) => PointPair.ContainsPoint(point) && point.IsSplit ? (IsStart(point) ? Alignment : Alignment.Invert()) : Alignment.Centre;
Exemplo n.º 25
0
 public EnterSupportPoint(MarkupPoint point) : base(point.Position)
 {
     Point = point;
 }
Exemplo n.º 26
0
 public MarkupRegularLine(Markup markup, MarkupPoint first, MarkupPoint second, RegularLineStyle style = null, Alignment alignment = Alignment.Centre, bool update = true) : this(markup, MarkupPointPair.FromPoints(first, second, out bool invert), style, !invert ? alignment : alignment.Invert(), update)
 {
 }
Exemplo n.º 27
0
 public EnterPointEdge(MarkupPoint point) : base(point)
 {
 }
Exemplo n.º 28
0
 public MarkupEnterLine(Markup markup, MarkupPoint first, MarkupPoint second) : base(markup, first, second, RegularLineStyle.RegularLineType.Dashed)
 {
 }