///<summary> /// Determines the <see cref="Gisoft.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="Gisoft.GeoAPI.Geometries.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(); int count = ring.Count; for (var i = 1; i < count; i++) { ring.GetCoordinate(i, p1); ring.GetCoordinate(i - 1, p2); counter.CountSegment(p1, p2); if (counter.IsOnSegment) { return(counter.Location); } } return(counter.Location); }