コード例 #1
0
        /// <summary>
        /// Point the by station offset elevation.
        /// </summary>
        /// <param name="station">The station.</param>
        /// <param name="offset">The offset.</param>
        /// <param name="elevation">The elevation.</param>
        /// <param name="referToBaseline">if set to <c>true</c> [refer to baseline].</param>
        /// <returns></returns>
        public Point PointByStationOffsetElevation(double station, double offset, double elevation, bool referToBaseline)
        {
            Utils.Log(string.Format("Featureline.PointByStationOffsetElevation started...", ""));

            Baseline baseline = this._baseline;

            CoordinateSystem cs = CoordinateSystem.Identity();

            if (!referToBaseline)
            {
                cs = CoordinateSystemByStation(station);
            }
            else
            {
                cs = baseline.CoordinateSystemByStation(station);
            }

            Point p = Point.ByCoordinates(offset, 0, elevation).Transform(cs) as Point;

            cs.Dispose();

            Utils.Log(string.Format("Featureline.PointByStationOffsetElevation completed.", ""));

            return(p);
        }
コード例 #2
0
        public static Featureline ByBaselineLandFeatureline(Baseline baseline, LandFeatureline landFeatureline, int regionIndex = 0, string separator = "|")
        {
            Utils.Log(string.Format("Featureline.ByBaselineLandFeatureline started...", ""));

            IList <Featureline> output = new List <Featureline>();

            string name = landFeatureline.Name;

            PolyCurve pc = landFeatureline.Curve;

            SideType side = SideType.Right;

            double station = Convert.ToDouble(baseline.GetStationOffsetElevationByPoint(pc.StartPoint)["Station"]);
            double offset  = Convert.ToDouble(baseline.GetStationOffsetElevationByPoint(pc.StartPoint)["Offset"]);

            if (offset < 0)
            {
                side = SideType.Left;
            }

            string[] parameters = name.Split(new string[] { separator }, StringSplitOptions.None);

            string code = "UnknownCode";

            try
            {
                code = parameters[2];
            }
            catch
            { }

            Utils.Log(string.Format("Featureline.ByBaselineLandFeatureline completed.", ""));

            return(new Featureline(baseline, pc, code, side, regionIndex));
        }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Featureline"/> class.
        /// </summary>
        /// <param name="baseline">The baseline.</param>
        /// <param name="polycurve">The polycurve.</param>
        /// <param name="code">The code.</param>
        /// <param name="side">The side.</param>
        /// <param name="regionIndex">The region index</param>
        /// <param name="pointMap">The station - Point map for the Featureline</param>
        internal Featureline(Baseline baseline, PolyCurve polycurve, string code, SideType side, int regionIndex = 0, Dictionary <double, Point> pointMap = null)
        {
            this._baseline    = baseline;
            this._polycurve   = polycurve;
            this._code        = code;
            this._side        = side;
            this._regionIndex = regionIndex;
            // 20190524 -- Start
            double startStation = 0;
            double startOffset  = 0;
            double endStation   = 0;
            double endOffset    = 0;

            baseline._baseline.Alignment.StationOffset(polycurve.StartPoint.X, polycurve.StartPoint.Y, out startStation, out startOffset);
            baseline._baseline.Alignment.StationOffset(polycurve.EndPoint.X, polycurve.EndPoint.Y, out endStation, out endOffset);
            this._start = startStation;
            this._end   = endStation;

            if (pointMap != null)
            {
                this._pointmap = pointMap;
            }

            // 20190524 -- End
        }
コード例 #4
0
        /// <summary>
        /// Internal constructor
        /// </summary>
        /// <param name="baseline">The baseline that holds the baseline region.</param>
        /// <param name="blr">The internal AeccBaselineRegion</param>
        /// <param name="i">The baseline region index</param>
        internal BaselineRegion(Baseline baseline, AeccBaselineRegion blr, int i)
        {
            this._baseline = baseline;

            this._blr = blr;

            this._index = i;

            try
            {
                this._assembly = blr.AssemblyDbEntity.DisplayName;
            }
            catch (Exception ex)
            {
                Utils.Log(string.Format("ERROR: Assembly Name Failed\t{0}", ex.Message));

                this._assembly = this._index.ToString();
            }

            try
            {
                this._start = blr.StartStation; //  Math.Round(blr.StartStation, 5);  // TODO get rid of the roundings
            }
            catch (Exception ex)
            {
                Utils.Log(string.Format("ERROR: Start Station Failed\t{0}", ex.Message));

                throw new Exception("Start Station Failed\n\n" + ex.Message);
            }

            try
            {
                this._end = blr.EndStation; //  Math.Round(blr.EndStation, 5);
            }
            catch (Exception ex)
            {
                Utils.Log(string.Format("ERROR: End Station Failed\t{0}", ex.Message));

                throw new Exception("End Station Failed\n\n" + ex.Message);
            }

            try
            {
                this._stations = blr.GetSortedStations();
            }
            catch (Exception ex)
            {
                Utils.Log(string.Format("ERROR: Sorted Stations Failed\t{0}", ex.Message));

                throw new Exception("Sorted Stations Failed\n\n" + ex.Message);
            }
        }
コード例 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Featureline"/> class.
        /// </summary>
        /// <param name="baseline">The baseline.</param>
        /// <param name="polycurve">The polycurve.</param>
        /// <param name="code">The code.</param>
        /// <param name="side">The side.</param>
        /// <param name="regionIndex">The region index</param>
        internal Featureline(Baseline baseline, PolyCurve polycurve, string code, SideType side, int regionIndex = 0)
        {
            this._baseline    = baseline;
            this._polycurve   = polycurve;
            this._code        = code;
            this._side        = side;
            this._regionIndex = regionIndex;
            // 20190524 -- Start
            // var region = this.Baseline.GetBaselineRegions()[this._regionIndex];
            double startStation = 0;
            double startOffset  = 0;
            double endStation   = 0;
            double endOffset    = 0;

            baseline._baseline.Alignment.StationOffset(polycurve.StartPoint.X, polycurve.StartPoint.Y, out startStation, out startOffset);
            baseline._baseline.Alignment.StationOffset(polycurve.EndPoint.X, polycurve.EndPoint.Y, out endStation, out endOffset);
            this._start = startStation;
            this._end   = endStation;

            // 20190524 -- End
        }
コード例 #6
0
 /// <summary>
 /// Returns a CoordinateSystem by point.
 /// </summary>
 /// <param name="baseline">The baseline.</param>
 /// <param name="point">The point.</param>
 /// <returns></returns>
 public CoordinateSystem CoordinateSystemByPoint(Baseline baseline, Point point)
 {
     return(baseline.GetCoordinateSystemByPoint(point));
 }
コード例 #7
0
 /// <summary>
 /// Returns a CoordinateSystem by station.
 /// </summary>
 /// <param name="baseline">The baseline.</param>
 /// <param name="station">The station.</param>
 /// <returns></returns>
 public CoordinateSystem CoordinateSystemByStation(Baseline baseline, double station = 0)
 {
     return(baseline.CoordinateSystemByStation(station));
 }
コード例 #8
0
 /// <summary>
 /// Returns a Point by station offset elevation.
 /// </summary>
 /// <param name="baseline">The baseline.</param>
 /// <param name="station">The station.</param>
 /// <param name="offset">The offset.</param>
 /// <param name="elevation">The elevation.</param>
 /// <returns></returns>
 public Point PointByStationOffsetElevation(Baseline baseline, double station = 0, double offset = 0, double elevation = 0)
 {
     return(baseline.PointByStationOffsetElevation(station, offset, elevation));
 }
コード例 #9
0
        /// <summary>
        /// Internal constructor
        /// </summary>
        /// <param name="baseline">The baseline that holds the baseline region.</param>
        /// <param name="blr">The internal AeccBaselineRegion</param>
        /// <param name="i">The baseline region index</param>
        internal BaselineRegion(Baseline baseline, AeccBaselineRegion blr, int i)
        {
            this._baseline = baseline;

            this._blr = blr;

            this._index = i;

            try
            {
                this._assembly = blr.AssemblyDbEntity.DisplayName;
            }
            catch (Exception ex)
            {
                Utils.Log(string.Format("ERROR: Assembly Name Failed\t{0}", ex.Message));

                this._assembly = this._index.ToString();

                //throw new Exception("Assembly Name Failed\n\n" + ex.Message);
            }

            try
            {
                this._start = blr.StartStation; //  Math.Round(blr.StartStation, 5);  // TODO get rid of the roundings
            }
            catch (Exception ex)
            {
                Utils.Log(string.Format("ERROR: Start Station Failed\t{0}", ex.Message));

                throw new Exception("Start Station Failed\n\n" + ex.Message);
            }

            try
            {
                this._end = blr.EndStation; //  Math.Round(blr.EndStation, 5);
            }
            catch (Exception ex)
            {
                Utils.Log(string.Format("ERROR: End Station Failed\t{0}", ex.Message));

                throw new Exception("End Station Failed\n\n" + ex.Message);
            }

            try
            {
                this._stations = blr.GetSortedStations();
            }
            catch (Exception ex)
            {
                Utils.Log(string.Format("ERROR: Sorted Stations Failed\t{0}", ex.Message));

                throw new Exception("Sorted Stations Failed\n\n" + ex.Message);
            }

            #region OLDCODE
            //foreach (AeccAppliedAssembly a in blr.AppliedAssemblies)
            //{
            //    try
            //    {
            //        this._appliedAssemblies.Add(new AppliedAssembly(this, a, a.Corridor));  // TODO: verify why this is a list instead of a single applied assembly...
            //        // break;
            //    }
            //    catch (Exception ex)
            //    {
            //        throw new Exception("Applied Assemblies Failed\n\n" + ex.Message);
            //    }
            //}

            //foreach (AppliedAssembly aa in this._appliedAssemblies)
            //{
            //    foreach (AeccAppliedSubassembly asa in aa._appliedSubassemblies)
            //    {
            //        try
            //        {
            //            this.Subassemblies.Add(new Subassembly(asa.SubassemblyDbEntity, asa.Corridor));
            //        }
            //        catch (Exception ex)
            //        {
            //            this.Subassemblies.Add(null);
            //            throw new Exception("Applied Subassemblies Failed\n\n" + ex.Message);
            //        }
            //    }
            //}
            #endregion
        }