Пример #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)
 {
 }