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); }
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); } } }
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)); }
public bool TryGetPoint(byte pointNum, out MarkupPoint point) { if (1 <= pointNum && pointNum <= PointCount) { point = PointsList[pointNum - 1]; return(true); } else { point = null; return(false); } }
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); } }
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; } }
public void Update(MarkupPoint point) { point.Update(); foreach (var line in GetPointLines(point)) { line.UpdateTrajectory(); } foreach (var filler in GetPointFillers(point)) { filler.Update(); } RecalculateDashes(); }
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); } }
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)); }
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); } }
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)); }
public IEnumerable <MarkupLine> GetPointLines(MarkupPoint point) => LinesDictionary.Values.Where(l => l.ContainsPoint(point));
protected MarkupLine(NodeMarkup markup, MarkupPoint first, MarkupPoint second, bool update = true) : this(markup, new MarkupPointPair(first, second), update) { }
public EnterSupportPoint(MarkupPoint point) { Point = point; Update(); }
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)); }
static Alignment GetAlignment(MarkupRegularLine line, MarkupPoint point) => line?.GetAlignment(point) ?? Alignment.Centre;
public EnterFillerVertexBase(MarkupPoint point) : base(point) { }
public IEnumerable <MarkupFiller> GetPointFillers(MarkupPoint point) => FillersList.Where(f => f.ContainsPoint(point));
protected MarkupStraightLine(Markup markup, MarkupPoint first, MarkupPoint second, StyleType styleType) : this(markup, new MarkupPointPair(first, second), styleType) { }
public MarkupLine(Markup markup, MarkupPoint first, MarkupPoint second) : this(markup, new MarkupPointPair(first, second)) { }
public bool ContainsPoint(MarkupPoint point) => PointPair.ContainPoint(point);
public bool IsStart(MarkupPoint point) => Start == point;
public bool IsEnd(MarkupPoint point) => End == point;
public Alignment GetAlignment(MarkupPoint point) => PointPair.ContainsPoint(point) && point.IsSplit ? (IsStart(point) ? Alignment : Alignment.Invert()) : Alignment.Centre;
public EnterSupportPoint(MarkupPoint point) : base(point.Position) { Point = point; }
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) { }
public EnterPointEdge(MarkupPoint point) : base(point) { }
public MarkupEnterLine(Markup markup, MarkupPoint first, MarkupPoint second) : base(markup, first, second, RegularLineStyle.RegularLineType.Dashed) { }