コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="geom"></param>
        protected override void Visit(IGeometry geom)
        {
            if (!(geom is Polygon))
            {
                return;
            }
            IEnvelope elementEnv = geom.EnvelopeInternal;

            if (!rectEnv.Intersects(elementEnv))
            {
                return;
            }
            // test each corner of rectangle for inclusion
            Coordinate rectPt = new Coordinate();

            for (int i = 0; i < 4; i++)
            {
                rectSeq.GetCoordinate(i, rectPt);
                if (!elementEnv.Contains(rectPt))
                {
                    continue;
                }
                // check rect point in poly (rect is known not to touch polygon at this point)
                if (SimplePointInAreaLocator.ContainsPointInPolygon(rectPt, (Polygon)geom))
                {
                    containsPoint = true;
                    return;
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="geomIndex"></param>
 /// <param name="p"></param>
 /// <param name="geom"></param>
 /// <returns></returns>
 private Location GetLocation(int geomIndex, Coordinate p, GeometryGraph[] geom)
 {
     // compute location only on demand
     if (_ptInAreaLocation[geomIndex] == Location.Null) 
         _ptInAreaLocation[geomIndex] = SimplePointInAreaLocator.Locate(p, geom[geomIndex].Geometry);            
     return _ptInAreaLocation[geomIndex];
 }
コード例 #3
0
        protected override void RunPtInRing(Location expectedLoc, Coordinate pt, string wkt)
        {
            var geom   = _reader.Read(wkt);
            var loc    = new SimplePointInAreaLocator(geom);
            var result = loc.Locate(pt);

            Assert.AreEqual(expectedLoc, result);
        }
コード例 #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="geomIndex"></param>
 /// <param name="p"></param>
 /// <param name="geom"></param>
 /// <returns></returns>
 public virtual Locations GetLocation(int geomIndex, ICoordinate p, GeometryGraph[] geom)
 {
     // compute location only on demand
     if (ptInAreaLocation[geomIndex] == Locations.Null)
     {
         ptInAreaLocation[geomIndex] = SimplePointInAreaLocator.Locate(p, geom[geomIndex].Geometry);
     }
     return(ptInAreaLocation[geomIndex]);
 }
コード例 #5
0
 internal virtual int GetLocation(int geomIndex, Coordinate p, GeometryGraph[] geom)
 {
     // compute location only on demand
     if (ptInAreaLocation[geomIndex] == LocationType.None)
     {
         ptInAreaLocation[geomIndex] = SimplePointInAreaLocator.Locate(p, geom[geomIndex].Geometry);
     }
     return(ptInAreaLocation[geomIndex]);
 }
コード例 #6
0
        /// <summary>
        /// Tests whether any component of the target geometry intersects the test geometry (which must be an areal geometry)
        /// </summary>
        /// <param name="testGeom">The test geometry</param>
        /// <param name="targetRepPts">The representative points of the target geometry</param>
        /// <returns>true if any component intersects the areal test geometry</returns>
        protected bool IsAnyTargetComponentInAreaTest(Geometry testGeom, IList <Coordinate> targetRepPts)
        {
            var piaLoc = new SimplePointInAreaLocator(testGeom);

            foreach (var p in targetRepPts)
            {
                var loc = piaLoc.Locate(p);
                if (loc != Location.Exterior)
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #7
0
        public static List <Feature> checkAffiliationToPolygon(Feature polygone, List <Feature> points)
        {
            var pointsContainedInPolygon = new List <Feature> ();

            foreach (Feature point in points)
            {
                bool isContained = SimplePointInAreaLocator.IsContained(point.Geometry.Coordinate, polygone.Geometry);

                if (isContained)
                {
                    pointsContainedInPolygon.Add(point);
                }
            }
            return(pointsContainedInPolygon);
        }
コード例 #8
0
        public override void Visit(Geometry geom)
        {
            if (geom == null)
            {
                throw new ArgumentNullException("geom");
            }

            if (geom.GeometryType != GeometryType.Polygon)
            {
                return;
            }

            Polygon polygon = (Polygon)geom;

            Envelope elementEnv = geom.Bounds;

            if (!rectEnv.Intersects(elementEnv))
            {
                return;
            }
            // test each corner of rectangle for inclusion
            for (int i = 0; i < 4; i++)
            {
                Coordinate rectPt = rectSeq[i];

                if (!elementEnv.Contains(rectPt))
                {
                    continue;
                }

                // check rect point in poly (rect is known not to touch polygon at this point)
                if (SimplePointInAreaLocator.ContainsPointInPolygon(rectPt, polygon))
                {
                    m_bContainsPoint = true;
                    return;
                }
            }
        }