protected override void RunPtInRing(Location expectedLoc, Coordinate pt, String wkt)
       {
 	        // isPointInRing is not defined for pts on boundary
 	        if (expectedLoc == Location.Boundary)
 		        return;
 	 
           IGeometry geom = reader.Read(wkt);
           if (!(geom is Polygon))
               return;
   
           LinearRing ring = (LinearRing)((Polygon) geom).ExteriorRing;
           bool expected = expectedLoc == Location.Interior;
           MCPointInRing pir = new MCPointInRing(ring);
           bool result = pir.IsInside(pt);
           Assert.AreEqual(expected, result);
       }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="container"></param>
 /// <param name="p"></param>
 public MCSelecter(MCPointInRing container, Coordinate p)
 {
     _container = container;
     _p = p;
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="container"></param>
 /// <param name="p"></param>
 public MCSelecter(MCPointInRing container, Coordinate p)
 {
     _container = container;
     _p         = p;
 }
示例#4
0
        /// <summary>
        /// Tests that each hole is inside the polygon shell.
        /// This routine assumes that the holes have previously been tested
        /// to ensure that all vertices lie on the shell or inside it.
        /// A simple test of a single point in the hole can be used,
        /// provide the point is chosen such that it does not lie on the
        /// boundary of the shell.
        /// </summary>
        /// <param name="p">The polygon to be tested for hole inclusion.</param>
        /// <param name="graph">A GeometryGraph incorporating the polygon.</param>
        private void CheckHolesInShell(IPolygon p, GeometryGraph graph)
        {
            ILinearRing shell = p.Shell;

            IPointInRing pir = new MCPointInRing(shell);
            for (int i = 0; i < p.NumInteriorRings; i++)
            {
                ILinearRing hole = p.Holes[i];
                Coordinate holePt = FindPointNotNode(hole.Coordinates, shell, graph);

                /*
                 * If no non-node hole vertex can be found, the hole must
                 * split the polygon into disconnected interiors.
                 * This will be caught by a subsequent check.
                 */
                if (holePt == null) 
                    return;

                bool outside = !pir.IsInside(holePt);
                if(outside)
                {
                    validErr = new TopologyValidationError(TopologyValidationErrors.HoleOutsideShell, holePt);
                    return;
                }
            }            
        }