Example #1
0
        public SVLAlignmentBoundaryDeterminator(NFFGuidableAlignmentEntity alignment,
                                                double startStation, double endStation, double offsetLeft, double offsetRight)
        {
            if (alignment == null)
            {
                throw new ArgumentException($"Alignment cannot be null in constructor for {nameof(SVLAlignmentBoundaryDeterminator)}");
            }

            if (!alignment.IsMasterAlignment() || !alignment.IsStationed)
            {
                throw new ArgumentException($"Alignment must be a stationed master alignment in constructor for {nameof(SVLAlignmentBoundaryDeterminator)}");
            }

            if (offsetLeft > offsetRight)
            {
                MinMax.Swap(ref offsetLeft, ref offsetRight);
            }

            Alignment = alignment;

            StartStation = startStation;
            EndStation   = endStation;
            OffsetLeft   = offsetLeft;
            OffsetRight  = offsetRight;
        }
Example #2
0
        public bool ConstructSVLCenterlineAlignmentGeometry(NFFGuidableAlignmentEntity alignment)
        {
            if ((CalcResult = Validate(alignment)) != DesignProfilerRequestResult.OK)
            {
                return(false);
            }

            // Run through the entities in the alignment and add them to the geometry
            for (var I = 0; I < alignment.Entities.Count; I++)
            {
                AddEntityToGeometry(alignment.Entities[I]);
            }
            MoveWorkingVerticesToVertices();

            // Construct the stationing text entities along the alignment
            var StationIncrement = AlignmentLabelingInterval;
            var CurrentStation   = alignment.StartStation;

            while (CurrentStation <= alignment.EndStation + 0.001)
            {
                alignment.ComputeXY(CurrentStation, 0, out var X1, out var Y1);
                alignment.ComputeXY(CurrentStation, -1, out var X2, out var Y2);

                GeometryUtils.RectToPolar(Y1, X1, Y2, X2, out var textOrientation, out _);

                // Create an instance of the response label with the lat/lon coordinate set to the Y/X grid coordinates
                // which will be converted later by the caller
                Labels.Add(new AlignmentGeometryResponseLabel(CurrentStation, X1, Y1, Math.PI / 2 - textOrientation));

                if (CurrentStation + StationIncrement <= alignment.EndStation)
                {
                    CurrentStation += StationIncrement;
                }
                else if (CurrentStation > alignment.EndStation - 0.001)
                {
                    break;
                }
                else
                {
                    CurrentStation = alignment.EndStation;
                }
            }

            foreach (var vertices in Vertices)
            {
                vertices.FillInStationValues();
            }

            CalcResult = DesignProfilerRequestResult.OK;
            return(true);
        }
Example #3
0
        protected DesignProfilerRequestResult Validate(NFFGuidableAlignmentEntity alignment)
        {
            if (alignment.Entities.Count == 0)
            {
                return(DesignProfilerRequestResult.AlignmentContainsNoElements);
            }

            if (alignment.StartStation == Consts.NullDouble || alignment.EndStation == Consts.NullDouble)
            {
                return(DesignProfilerRequestResult.AlignmentContainsNoStationing);
            }

            if (alignment.StartStation >= alignment.EndStation)
            {
                return(DesignProfilerRequestResult.AlignmentContainsInvalidStationing);
            }

            return(DesignProfilerRequestResult.OK);
        }
Example #4
0
 public NFFGuidableAlignmentOwnedEntitiesList(NFFGuidableAlignmentEntity owner) : this()
 {
     Owner = owner;
 }