コード例 #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
        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;
                }
            }
        }