add method

void add(
  1. Geometry geom
)

Adds a Geometry to the centroid total.

@param geom the geometry to add

Implementation

void add(Geometry geom) {
  if (geom.isEmpty()) return;
  if (geom is Point) {
    addPoint(geom.getCoordinate()!);
  } else if (geom is LineString) {
    addLineSegments(geom.getCoordinates());
  } else if (geom is Polygon) {
    Polygon poly = geom;
    addPolygon(poly);
  } else if (geom is GeometryCollection) {
    GeometryCollection gc = geom;
    for (int i = 0; i < gc.getNumGeometries(); i++) {
      add(gc.getGeometryN(i));
    }
  }
}