visit method

void visit(
  1. Geometry geom
)
override

Implementation

void visit(Geometry geom) {
  // if test geometry is not polygonal this check is not needed
  if (!(geom is Polygon)) return;

  // skip if envelopes do not intersect
  Envelope elementEnv = geom.getEnvelopeInternal();
  if (!rectEnv.intersectsEnvelope(elementEnv)) return;

  // test each corner of rectangle for inclusion
  Coordinate rectPt = new Coordinate.empty2D();
  for (int i = 0; i < 4; i++) {
    rectSeq.getCoordinateInto(i, rectPt);
    if (!elementEnv.containsCoordinate(rectPt)) continue;
    // check rect point in poly (rect is known not to touch polygon at this
    // point)
    if (SimplePointInAreaLocator.containsPointInPolygon(
        rectPt, geom as Polygon)) {
      _containsPoint = true;
      return;
    }
  }
}