Example #1
0
        ///<summary>
        /// Computes the <see cref="Coordinate"/> for the point on the line at the given index, offset by the given distance.
        ///</summary>
        /// <remarks>
        /// If the index is out of range the first or last point on the line will be returned.
        /// The computed point is offset to the left of the line if the offset distance is
        /// positive, to the right if negative.
        /// The Z-ordinate of the computed point will be interpolated from the Z-ordinates of the line segment containing it, if they exist.
        /// </remarks>
        /// <param name="index">The index of the desired point</param>
        /// <param name="offsetDistance">The distance the point is offset from the segment (positive is to the left, negative is to the right)</param>
        /// <returns>The Coordinate at the given index</returns>
        public Coordinate ExtractPoint(double index, double offsetDistance)
        {
            LinearLocation loc    = LengthLocationMap.GetLocation(_linearGeom, index);
            LinearLocation locLow = loc.ToLowest(_linearGeom);

            return(locLow.GetSegment(_linearGeom).PointAlongOffset(locLow.SegmentFraction, offsetDistance));
        }
Example #2
0
 /// <summary>
 /// Computes the indices for a subline of the line.
 /// (The subline must conform to the line; that is,
 /// all vertices in the subline (except possibly the first and last)
 /// must be vertices of the line and occur in the same order).
 /// </summary>
 /// <param name="subLine">A subLine of the line.</param>
 /// <returns>A pair of indices for the start and end of the subline..</returns>
 public double[] IndicesOf(IGeometry subLine)
 {
     LinearLocation[] locIndex = LocationIndexOfLine.IndicesOf(_linearGeom, subLine);
     double[]         index    =
     {
         LengthLocationMap.GetLength(_linearGeom, locIndex[0]),
         LengthLocationMap.GetLength(_linearGeom, locIndex[1])
     };
     return(index);
 }
Example #3
0
        /// <summary>
        /// Computes the length for a given <see cref="LinearLocation" />
        /// on a linear <see cref="Geometry" />.
        /// </summary>
        /// <param name="linearGeom">The linear geometry to use.</param>
        /// <param name="loc">The <see cref="LinearLocation" /> index of the location.</param>
        /// <returns>The length for the <see cref="LinearLocation" />.</returns>
        public static double GetLength(IGeometry linearGeom, LinearLocation loc)
        {
            var locater = new LengthLocationMap(linearGeom);

            return(locater.GetLength(loc));
        }
Example #4
0
        /// <summary>
        /// Computes the <see cref="LinearLocation"/> for a
        /// given length along a linear <see cref="IGeometry"/>,
        /// with control over how the location
        /// is resolved at component endpoints.
        /// </summary>
        /// <param name="linearGeom">The linear geometry to use</param>
        /// <param name="length">The length index of the location</param>
        /// <param name="resolveLower">If true lengths are resolved to the lowest possible index</param>
        public static LinearLocation GetLocation(IGeometry linearGeom, double length, bool resolveLower)
        {
            var locater = new LengthLocationMap(linearGeom);

            return(locater.GetLocation(length, resolveLower));
        }
Example #5
0
        // TODO: cache computed cumulative length for each vertex
        // TODO: support user-defined measures
        // TODO: support measure index for fast mapping to a location

        /// <summary>
        /// Computes the <see cref="LinearLocation" /> for a
        /// given length along a linear <see cref="Geometry" />.
        /// </summary>
        /// <param name="linearGeom">The linear geometry to use.</param>
        /// <param name="length">The length index of the location.</param>
        /// <returns>The <see cref="LinearLocation" /> for the length.</returns>
        public static LinearLocation GetLocation(IGeometry linearGeom, double length)
        {
            var locater = new LengthLocationMap(linearGeom);

            return(locater.GetLocation(length));
        }
Example #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="index"></param>
 /// <returns></returns>
 private LinearLocation LocationOf(double index)
 {
     return(LengthLocationMap.GetLocation(_linearGeom, index));
 }
Example #7
0
        /// <summary>
        /// Computes the <see cref="Coordinate" /> for the point
        /// on the line at the given index.
        /// If the index is out of range the first or last point on the
        /// line will be returned.
        /// </summary>
        /// <remarks>
        /// The Z-ordinate of the computed point will be interpolated from
        /// the Z-ordinates of the line segment containing it, if they exist.
        /// </remarks>
        /// <param name="index">The index of the desired point.</param>
        /// <returns>The <see cref="Coordinate" /> at the given index.</returns>
        public Coordinate ExtractPoint(double index)
        {
            LinearLocation loc = LengthLocationMap.GetLocation(_linearGeom, index);

            return(loc.GetCoordinate(_linearGeom));
        }
Example #8
0
 private LinearLocation LocationOf(double index, bool resolveLower)
 {
     return(LengthLocationMap.GetLocation(_linearGeom, index, resolveLower));
 }