Beispiel #1
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);
                if ((type & makrup.SupportLines) == 0)
                {
                    return(false);
                }

                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 #2
0
        public static IEnumerable <IFillerVertex> GetBeginCandidates(Markup markup)
        {
            foreach (var intersect in markup.Intersects)
            {
                yield return(new IntersectFillerVertex(intersect.Pair));
            }

            foreach (var enter in markup.Enters)
            {
                foreach (var point in enter.Points)
                {
                    yield return(new EnterFillerVertex(point, Alignment.Centre));

                    if (point.IsSplit)
                    {
                        yield return(new EnterFillerVertex(point, Alignment.Left));

                        yield return(new EnterFillerVertex(point, Alignment.Right));
                    }
                }
            }
        }
Beispiel #3
0
        public static MarkupLine FromStyle(Markup markup, MarkupPointPair pointPair, Style.StyleType style)
        {
            switch (style & Style.StyleType.GroupMask)
            {
            case Style.StyleType.StopLine:
                return(new MarkupStopLine(markup, pointPair, (StopLineStyle.StopLineType)(int) style));

            case Style.StyleType.Crosswalk:
                return(new MarkupCrosswalkLine(markup, pointPair, (CrosswalkStyle.CrosswalkType)(int) style));

            case Style.StyleType.RegularLine:
            default:
                var regularStyle = (RegularLineStyle.RegularLineType)(int) style;
                if (regularStyle == RegularLineStyle.RegularLineType.Empty)
                {
                    return(pointPair.IsNormal ? new MarkupNormalLine(markup, pointPair) : new MarkupRegularLine(markup, pointPair));
                }
                else
                {
                    return(pointPair.IsNormal ? new MarkupNormalLine(markup, pointPair, regularStyle) : new MarkupRegularLine(markup, pointPair, regularStyle));
                }
            }
        }
Beispiel #4
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);
            }
        }
Beispiel #5
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));
        }
Beispiel #6
0
        public static List <IFillerVertex> GetBeginCandidates(Markup markup)
        {
            var points = new List <IFillerVertex>();

            foreach (var intersect in markup.Intersects)
            {
                points.Add(new IntersectFillerVertex(intersect.Pair));
            }

            foreach (var enter in markup.Enters)
            {
                foreach (var point in enter.Points)
                {
                    points.Add(new EnterFillerVertex(point, Alignment.Centre));
                    if (point.IsSplit)
                    {
                        points.Add(new EnterFillerVertex(point, Alignment.Left));
                        points.Add(new EnterFillerVertex(point, Alignment.Right));
                    }
                }
            }

            return(points);
        }
Beispiel #7
0
 public MarkupRegularLine(Markup markup, MarkupPointPair pointPair) : base(markup, pointPair)
 {
 }
Beispiel #8
0
 private void ClipSidewalkChanged() => Markup.Update(this, true, false);
Beispiel #9
0
 private void AlignmentChanged() => Markup.Update(this, true, true);
Beispiel #10
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)
 {
 }
Beispiel #11
0
 public MarkupCrosswalkLine(Markup markup, MarkupPointPair pointPair, CrosswalkStyle.CrosswalkType crosswalkType = CrosswalkStyle.CrosswalkType.Existent) : base(markup, pointPair, false)
 {
     Crosswalk = new MarkupCrosswalk(Markup, this, crosswalkType);
     Update(true);
     Markup.AddCrosswalk(Crosswalk);
 }
Beispiel #12
0
 public MarkupEnterLine(Markup markup, MarkupPoint first, MarkupPoint second) : base(markup, first, second, RegularLineStyle.RegularLineType.Dashed)
 {
 }
Beispiel #13
0
 protected override void RuleChanged() => Markup.Update(this, true);
Beispiel #14
0
 public MarkupStopLine(Markup markup, MarkupPointPair pointPair, StopLineStyle.StopLineType lineType = StopLineStyle.StopLineType.Solid) : base(markup, pointPair, lineType)
 {
 }
Beispiel #15
0
 public static bool TryGetMarkup(ushort nodeId, out Markup markup) => NodesMarkup.TryGetValue(nodeId, out markup);
Beispiel #16
0
 private void RuleChanged() => Markup.Update(this);
Beispiel #17
0
 public MarkupLine(Markup markup, MarkupPointPair pointPair, Style.StyleType lineType) : this(markup, pointPair, TemplateManager.GetDefault <LineStyle>(lineType))
 {
 }
Beispiel #18
0
 public MarkupLine(Markup markup, MarkupPointPair pointPair, LineStyle lineStyle) : this(markup, pointPair)
 {
     AddRule(lineStyle, false, false);
     RecalculateDashes();
 }
Beispiel #19
0
 public MarkupLine(Markup markup, MarkupPoint first, MarkupPoint second) : this(markup, new MarkupPointPair(first, second))
 {
 }
Beispiel #20
0
 protected MarkupRegularLine(Markup markup, MarkupPointPair pointPair, bool update = true) : base(markup, pointPair, update)
 {
 }
Beispiel #21
0
 protected MarkupLine(Markup markup, MarkupPoint first, MarkupPoint second, bool update = true) : this(markup, new MarkupPointPair(first, second), update)
 {
 }
Beispiel #22
0
 public MarkupRegularLine(Markup markup, MarkupPointPair pointPair) : base(markup, pointPair)
 {
     RecalculateStyleData();
 }
Beispiel #23
0
 public Dependences GetDependences() => Markup.GetLineDependences(this);
Beispiel #24
0
 protected virtual void RuleChanged() => Markup.Update(this, true);
Beispiel #25
0
 protected MarkupStraightLine(Markup markup, MarkupPoint first, MarkupPoint second, StyleType styleType) : this(markup, new MarkupPointPair(first, second), styleType)
 {
 }
Beispiel #26
0
 protected void CrosswalkChanged() => Markup.Update(this, true, true);
Beispiel #27
0
 protected MarkupRegularLine(Markup markup, MarkupPointPair pointPair, bool update = true) : base(markup, pointPair, update)
 {
     RecalculateStyleData();
 }
Beispiel #28
0
 private void FillerChanged() => Markup?.Update(this, true);
Beispiel #29
0
 public FillerContour(Markup markup)
 {
     Markup = markup;
 }
Beispiel #30
0
 public MarkupNormalLine(Markup markup, MarkupPointPair pointPair, RegularLineStyle.RegularLineType lineType) : base(markup, pointPair, lineType)
 {
 }