///<summary>
 /// Determines whether a point lies in a LinearRing, using the ring envelope to short-circuit if possible.
 ///</summary>
 /// <param name="p">The point to test</param>
 /// <param name="ring">A linear ring</param>
 /// <returns><c>true</c> if the point lies inside the ring</returns>
 private static Location LocatePointInRing(Coordinate p, ILinearRing ring)
 {
     // short-circuit if point is not in ring envelope
     if (!ring.EnvelopeInternal.Intersects(p))
     {
         return(Location.Exterior);
     }
     return(PointLocation.LocateInRing(p, ring.CoordinateSequence));
 }
Ejemplo n.º 2
0
        protected override void RunPtInRing(Location expectedLoc, Coordinate pt, string wkt)
        {
            var geom = reader.Read(wkt);

            Assert.AreEqual(expectedLoc, PointLocation.LocateInRing(pt, geom.Coordinates));
            var poly = geom as Polygon;

            if (poly == null)
            {
                return;
            }

            Assert.AreEqual(expectedLoc, PointLocation.LocateInRing(pt, poly.ExteriorRing.CoordinateSequence));
        }