///<summary>
        /// Determines the <see cref="GeoAPI.Geometries.Location"/> of a point in a ring.
        /// This method is an exemplar of how to use this class.
        ///</summary>
        /// <param name="p">The point to test</param>
        /// <param name="ring">An array of Coordinates forming a ring</param>
        /// <returns>The location of the point in the ring</returns>
        public static Location LocatePointInRing(Coordinate p, Coordinate[] ring)
        {
            var counter = new RayCrossingCounter(p);

            for (int i = 1; i < ring.Length; i++)
            {
                var p1 = ring[i];
                var p2 = ring[i - 1];
                counter.CountSegment(p1, p2);
                if (counter.IsOnSegment)
                    return counter.Location;
            }
            return counter.Location;
        }
        /// <summary>
        /// Determines the <see cref="Location"/> of a point in a ring.
        /// </summary>
        /// <param name="p">The point to test</param>
        /// <param name="ring">A coordinate sequence forming a ring</param>
        /// <returns>The location of the point in the ring</returns>
        public static Location LocatePointInRing(Coordinate p, ICoordinateSequence ring)
        {
            var counter = new RayCrossingCounter(p);

            var p1 = new Coordinate();
            var p2 = new Coordinate();
            for (var i = 1; i < ring.Count; i++)
            {
                ring.GetCoordinate(i, p1);
                ring.GetCoordinate(i - 1, p2);
                counter.CountSegment(p1, p2);
                if (counter.IsOnSegment)
                    return counter.Location;
            }
            return counter.Location;
        }
Пример #3
0
        ///<summary>
        /// Determines the <see cref="GeoAPI.Geometries.Location"/> of a point in a ring.
        /// This method is an exemplar of how to use this class.
        ///</summary>
        /// <param name="p">The point to test</param>
        /// <param name="ring">An array of Coordinates forming a ring</param>
        /// <returns>The location of the point in the ring</returns>
        public static Location LocatePointInRing(Coordinate p, Coordinate[] ring)
        {
            var counter = new RayCrossingCounter(p);

            for (int i = 1; i < ring.Length; i++)
            {
                var p1 = ring[i];
                var p2 = ring[i - 1];
                counter.CountSegment(p1, p2);
                if (counter.IsOnSegment)
                {
                    return(counter.Location);
                }
            }
            return(counter.Location);
        }
Пример #4
0
        /// <summary>
        /// Determines the <see cref="Location"/> of a point in a ring.
        /// </summary>
        /// <param name="p">The point to test</param>
        /// <param name="ring">A coordinate sequence forming a ring</param>
        /// <returns>The location of the point in the ring</returns>
        public static Location LocatePointInRing(Coordinate p, ICoordinateSequence ring)
        {
            var counter = new RayCrossingCounter(p);

            var p1 = new Coordinate();
            var p2 = new Coordinate();

            for (var i = 1; i < ring.Count; i++)
            {
                ring.GetCoordinate(i, p1);
                ring.GetCoordinate(i - 1, p2);
                counter.CountSegment(p1, p2);
                if (counter.IsOnSegment)
                {
                    return(counter.Location);
                }
            }
            return(counter.Location);
        }
Пример #5
0
 public void VisitItem(LineSegment seg)
 {
     _counter.CountSegment(seg.GetCoordinate(0), seg.GetCoordinate(1));
 }