public void AddUlfEntity(double station, double ulf)
        {
            double x = StationToXConverter.ToX(station);

            _points.Add(new Point3d(x, _yTopOfBand, ulf));
            _points.Add(new Point3d(x, _yBottomOfBand, ulf));
        }
예제 #2
0
        /// <summary>
        /// Takes 2 stations and cases and returns a list of appropraite endpoints for a
        /// line connection those stations, respecting jumps between databands.
        /// </summary>
        /// <param name="csFrom">Station and case of starting point.</param>
        /// <param name="csTo">Station and case of ending point.</param>
        /// <returns></returns>
        public static List <(SimplePoint2d, SimplePoint2d)> TranslateLine(CaseStation csFrom, CaseStation csTo)
        {
            double stationFrom = csFrom.Station;
            double stationTo   = csTo.Station;

            List <(double, double)> modelXJumps =
                StationToXConverter.FindModelXsOfJumps(stationFrom, stationTo);

            double xFrom = csFrom.X;
            double xTo   = csTo.X;
            List <(double, double)> modelXOfLineEndPoints =
                GetModelXOfLineEndPoints(xFrom, modelXJumps, xTo);

            double yFrom = csFrom.Y;
            double yTo   = csTo.Y;
            List <(double, double)> modelYOfLineEndPoints = GetModelYOfLineEndPoints(yFrom, modelXOfLineEndPoints, yTo);

            var linePoints = new List <(SimplePoint2d, SimplePoint2d)>();
            int linecount  = modelXOfLineEndPoints.Count;

            for (int i = 0; i < linecount; i++)
            {
                double        point1X = modelXOfLineEndPoints[i].Item1;
                double        point1Y = modelYOfLineEndPoints[i].Item1;
                SimplePoint2d point1  = new SimplePoint2d(point1X, point1Y);

                double        point2X = modelXOfLineEndPoints[i].Item2;
                double        point2Y = modelYOfLineEndPoints[i].Item2;
                SimplePoint2d point2  = new SimplePoint2d(point2X, point2Y);

                linePoints.Add((point1, point2));
            }
            return(linePoints);
        }
예제 #3
0
        public void FindStationsOfJumps_From1stToLastDB_FindsAllJumps(double fromStation,
                                                                      double toStation,
                                                                      List <double> expectedJumps)
        {
            List <double> actualJumps = StationToXConverter.FindStationsOfJumps(fromStation, toStation);

            Assert.Equal(expectedJumps, actualJumps);
        }
예제 #4
0
        public void ToX_GivenRandomValidStations_CalculatesCorrectXValue(double station,
                                                                         double expectedX,
                                                                         string message)
        {
            output.WriteLine(message);
            double actualX = StationToXConverter.ToX(station);

            Assert.Equal(expectedX, actualX);
        }
예제 #5
0
        public void ToX_Station58760_Returns3560020()
        {
            double expected = 3560020;
            double station  = 58760;

            double actual = StationToXConverter.ToX(station);

            Assert.Equal(expected, actual);
        }
예제 #6
0
        public void ToX_Station70790_Returns3584030()
        {
            double expected = 3584030;
            double station  = 70790;

            double actual = StationToXConverter.ToX(station);

            Assert.Equal(expected, actual);
        }
예제 #7
0
        public void ToX_ValueBeyondScope_ThrowsArgumentException(double station, string message)
        {
            output.WriteLine(message);

            Assert.Throws <ArgumentException>(() => StationToXConverter.ToX(station));
        }