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>
        /// Calculates the new ShapePoint location on the new Featureline using the Station, Offset and Elevation parameters.
        /// </summary>
        /// <param name="featureline">The featureline used to update the ShapePoint</param>
        /// <returns></returns>
        public ShapePoint UpdateByFeatureline(Featureline featureline)
        {
            Utils.Log(string.Format("ShapePoint.UpdateByFeatureline started...", ""));

            var p = featureline.PointByStationOffsetElevation(this.Station, this.Offset, this.Elevation, false);

            this.Point       = p;
            this.RevitPoint  = this.Point.Transform(RevitUtils.DocumentTotalTransform()) as Point;
            this.Featureline = featureline;

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

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

            return(this);
        }
Exemple #3
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);
        }
Exemple #4
0
        /// <summary>
        /// Bies the point featureline.
        /// </summary>
        /// <param name="point">The point.</param>
        /// <param name="featureline">The featureline.</param>
        /// <returns></returns>
        public static ShapePoint ByPointFeatureline(Point point, Featureline featureline)
        {
            ShapePoint sp = new ShapePoint(point, featureline);

            return(sp);
        }