getGeometry method

Geometry getGeometry(
  1. Record record,
  2. LByteBuffer buffer
)

Reads the geometry, it will return {@link #SKIP} if the records is to be skipped because of the screenmap or because it does not match the target bbox

Implementation

Geometry getGeometry(Record record, LByteBuffer buffer) {
  // read the geometry, so that we can decide if this row is to be skipped or not
  Envelope envelope = record.envelope();
  Geometry geometry;
  // if (schema.getGeometryDescriptor() != null) {
  // ... if geometry is out of the target bbox, skip both geom and row
  if (targetBBox != null &&
      !targetBBox!.isNull() &&
      !targetBBox!.intersectsEnvelope(envelope)) {
    geometry = SKIP;
    // ... if the geometry is awfully small avoid reading it (unless it's a point)
    // } else if (simplificationDistance > 0
    //         && envelope.getWidth() < simplificationDistance
    //         && envelope.getHeight() < simplificationDistance) {
    //     try {
    //         // if we have the screenmap, we either have no filter, and we
    //         // can directly alter the screenmap, or we have a filter, in that
    //         // case we just check if the screenmap is already busy
    //         if (screenMap != null && screenMap.get(envelope)) {
    //             geometry = SKIP;
    //         } else {
    //             // if we are using the screenmap better provide a slightly modified
    //             // version of the geometry bounds or we'll end up with many holes
    //             // in the rendering
    //             geometry = (Geometry) record.getSimplifiedShape(screenMap);
    //         }
    //     } catch (Exception e) {
    //         geometry = (Geometry) record.getSimplifiedShape();
    //     }
    //     // ... otherwise business as usual
  } else {
    geometry = record.getShape(buffer) as Geometry;
  }
  // }
  return geometry;
}