Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShapePoint"/> class.
        /// </summary>
        /// <param name="point">The point.</param>
        /// <param name="featureline">The featureline.</param>
        /// <param name="id">The initial ID of the ShapePoint.</param>
        internal ShapePoint(Point point, Featureline featureline, int id = 0)
        {
            this.UniqueId = Guid.NewGuid().ToString();
            this._id      = id;

            this.Corridor      = featureline.Baseline.CorridorName;
            this.BaselineIndex = featureline.Baseline.Index;
            this.RegionIndex   = featureline.BaselineRegionIndex;

            this.Side = featureline.Side;
            this.Code = featureline.Code;

            var soe = featureline.GetStationOffsetElevationByPoint(point);

            this.Station   = (double)soe["Station"];
            this.Offset    = (double)soe["Offset"];
            this.Elevation = (double)soe["Elevation"];

            this.RegionRelative   = this.Station - featureline.Start;                            // 1.1.0
            this.RegionNormalized = this.RegionRelative / (featureline.End - featureline.Start); // 1.1.0

            this.Point       = point;
            this.Featureline = featureline;

            this.RevitPoint = point.Transform(RevitUtils.DocumentTotalTransform()) as Point;
        }
Exemple #2
0
        /// <summary>
        /// Updates the ShapePoint parameters Station, Offset and Elevation against the new Featureline.
        /// </summary>
        /// <param name="featureline">The featureline assigned to the ShapePoint</param>
        /// <returns></returns>
        public ShapePoint AssignFeatureline(Featureline featureline)  // 1.1.0
        {
            Utils.Log(string.Format("ShapePoint.AssignFeatureline started...", ""));

            this.Featureline = featureline;

            var soe = featureline.GetStationOffsetElevationByPoint(this.Point);

            this.Station   = (double)soe["Station"];
            this.Offset    = (double)soe["Offset"];
            this.Elevation = (double)soe["Elevation"];

            this.BaselineIndex    = featureline.Baseline.Index;
            this.RegionIndex      = featureline.BaselineRegionIndex;
            this.RegionRelative   = this.Station - featureline.Start;
            this.RegionNormalized = this.RegionRelative / (featureline.End - featureline.Start);
            this.Code             = featureline.Code;
            this.Corridor         = featureline.Baseline.CorridorName;
            this.Side             = featureline.Side;

            Utils.Log(string.Format("ShapePoint.AssignFeatureline completed.", ""));

            return(this);
        }