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