public int size()

in baremaps-core/src/main/java/org/apache/baremaps/database/type/geometry/GeometryDataType.java [97:124]


  public int size(ByteBuffer buffer, int position) {
    var size = 0;

    // Geometry type
    var type = buffer.get(position);
    size += Byte.BYTES;

    // Size of the geometry
    if (type == 1) {
      size += pointDataType.size(buffer, position + Byte.BYTES);
    } else if (type == 2) {
      size += lineStringDataType.size(buffer, position + Byte.BYTES);
    } else if (type == 3) {
      size += polygonDataType.size(buffer, position + Byte.BYTES);
    } else if (type == 4) {
      size += multiPointDataType.size(buffer, position + Byte.BYTES);
    } else if (type == 5) {
      size += multiLineStringDataType.size(buffer, position + Byte.BYTES);
    } else if (type == 6) {
      size += multiPolygonDataType.size(buffer, position + Byte.BYTES);
    } else if (type == 7) {
      size += geometryCollectionDataType.size(buffer, position + Byte.BYTES);
    } else {
      throw new IllegalArgumentException("Unsupported geometry type: " + type);
    }

    return size;
  }