Exemplo n.º 1
0
 public override void GetUIComponents(MarkupStopLine line, List <EditorItem> components, UIComponent parent, bool isTemplate = false)
 {
     base.GetUIComponents(line, components, parent, isTemplate);
     components.Add(AddBaseProperty(this, parent));
     components.Add(AddHeightProperty(this, parent));
     components.Add(AddSpaceProperty(this, parent));
 }
Exemplo n.º 2
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);
                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);
        }
Exemplo n.º 3
0
        protected override IStyleData Calculate(MarkupStopLine stopLine, ITrajectory trajectory, MarkupLOD lod)
        {
            var offset = ((stopLine.Start.Direction + stopLine.End.Direction) / -2).normalized * (Width / 2);

            return(new MarkupStyleParts(StyleHelper.CalculateSolid(trajectory, lod, CalculateDashes)));

            MarkupStylePart CalculateDashes(ITrajectory dashTrajectory) => StyleHelper.CalculateSolidPart(dashTrajectory, offset, offset, Width, Color);
        }
Exemplo n.º 4
0
        protected override IEnumerable <MarkupStyleDash> Calculate(MarkupStopLine stopLine, ILineTrajectory trajectory)
        {
            var offset = ((stopLine.Start.Direction + stopLine.End.Direction) / -2).normalized * (Width / 2);

            return(StyleHelper.CalculateSolid(trajectory, CalculateDashes));

            IEnumerable <MarkupStyleDash> CalculateDashes(ILineTrajectory dashTrajectory)
            {
                yield return(StyleHelper.CalculateSolidDash(dashTrajectory, offset, offset, Width, Color));
            }
        }
Exemplo n.º 5
0
        protected override IStyleData Calculate(MarkupStopLine stopLine, ITrajectory trajectory, MarkupLOD lod)
        {
            var offsetNormal = ((stopLine.Start.Direction + stopLine.End.Direction) / -2).normalized;
            var offsetLeft   = offsetNormal * (Width / 2);
            var offsetRight  = offsetNormal * (Width / 2 + 2 * Offset);

            return(new MarkupStyleParts(StyleHelper.CalculateSolid(trajectory, lod, CalculateDashes)));

            IEnumerable <MarkupStylePart> CalculateDashes(ITrajectory dashTrajectory)
            {
                yield return(StyleHelper.CalculateSolidPart(dashTrajectory, offsetLeft, offsetLeft, Width, Color));

                yield return(StyleHelper.CalculateSolidPart(dashTrajectory, offsetRight, offsetRight, Width, Color));
            }
        }
Exemplo n.º 6
0
        protected override IStyleData Calculate(MarkupStopLine stopLine, ITrajectory trajectory, MarkupLOD lod)
        {
            if (!CheckDashedLod(lod, Base, Height))
            {
                return(new MarkupStyleParts());
            }

            var styleData = new MarkupStyleParts(StyleHelper.CalculateDashed(trajectory, Base, Space, CalculateDashes));

            foreach (var dash in styleData)
            {
                dash.MaterialType = MaterialType.Triangle;
            }

            return(styleData);
        }
Exemplo n.º 7
0
        protected override IStyleData Calculate(MarkupStopLine stopLine, ITrajectory trajectory, MarkupLOD lod)
        {
            if (!CheckDashedLod(lod, Width, DashLength))
            {
                return(new MarkupStyleParts());
            }

            var offset = ((stopLine.Start.Direction + stopLine.End.Direction) / -2).normalized * (Width / 2);

            return(new MarkupStyleParts(StyleHelper.CalculateDashed(trajectory, DashLength, SpaceLength, CalculateDashes)));

            IEnumerable <MarkupStylePart> CalculateDashes(ITrajectory dashTrajectory, float startT, float endT)
            {
                yield return(StyleHelper.CalculateDashedPart(dashTrajectory, startT, endT, DashLength, offset, offset, Width, Color));
            }
        }
Exemplo n.º 8
0
        protected override IStyleData Calculate(MarkupStopLine stopLine, ITrajectory trajectory, MarkupLOD lod)
        {
            var offsetNormal = ((stopLine.Start.Direction + stopLine.End.Direction) / -2).normalized;
            var solidOffset  = offsetNormal * (Width / 2);
            var dashedOffset = offsetNormal * (Width / 2 + 2 * Offset);

            var dashes = new List <MarkupStylePart>();

            dashes.AddRange(StyleHelper.CalculateSolid(trajectory, lod, CalculateSolidDash));
            if (CheckDashedLod(lod, Width, DashLength))
            {
                dashes.AddRange(StyleHelper.CalculateDashed(trajectory, DashLength, SpaceLength, CalculateDashedDash));
            }

            return(new MarkupStyleParts(dashes));

            MarkupStylePart CalculateSolidDash(ITrajectory lineTrajectory) => StyleHelper.CalculateSolidPart(lineTrajectory, solidOffset, solidOffset, Width, Color);

            IEnumerable <MarkupStylePart> CalculateDashedDash(ITrajectory lineTrajectory, float startT, float endT)
            {
                yield return(StyleHelper.CalculateDashedPart(lineTrajectory, startT, endT, DashLength, dashedOffset, dashedOffset, Width, Color));
            }
        }
Exemplo n.º 9
0
 public virtual void GetUIComponents(MarkupStopLine line, List <EditorItem> components, UIComponent parent, bool isTemplate = false)
 {
 }
Exemplo n.º 10
0
 protected abstract IStyleData Calculate(MarkupStopLine stopLine, ITrajectory trajectory, MarkupLOD lod);
Exemplo n.º 11
0
 protected override IStyleData Calculate(MarkupStopLine line, ITrajectory trajectory, MarkupLOD lod) => new MarkupStyleLineMesh(trajectory, Width, Elevation, MaterialType.Pavement);