Computes the bounding circle

@param geometry
@return
702
public static Geometry computeBoundingCircle(Geometry geometry) {
        if (geometry == null) {
            return null;
        }
        return new MinimumBoundingCircle(geometry).getCircle();
    }
714504
public boolean intersects(Geometry geometry) {
		if (isEmpty()) {
			return false;
		}
		for (LineString lineString : lineStrings) {
			if (lineString.intersects(geometry)) {
				return true;
			}
		}

		return false;
	}
1347693
public NumberExpression<Double> distanceSphere(Expression<? extends Geometry> geometry) {
        return Expressions.numberOperation(Double.class, SpatialOps.DISTANCE_SPHERE, mixin, geometry);
    }
280496
@ExportConstructor
	public static org.geomajas.geometry.Geometry constructor(String geometryType, int srid, int precision) {
		return new org.geomajas.geometry.Geometry(geometryType, srid, precision);
	}
440433
public static CoordinateSequenceDimensionFilter apply(Geometry geometry) {
        CoordinateSequenceDimensionFilter cd = new CoordinateSequenceDimensionFilter();
        geometry.apply(cd);
        return cd;
    }
738609
public static Double st3darea(Geometry geometry) {
        if (geometry == null) {
            return null;
        }
        double area = 0;
        for (int idPoly = 0; idPoly < geometry.getNumGeometries(); idPoly++) {
            Geometry subGeom = geometry.getGeometryN(idPoly);
            if (subGeom instanceof Polygon) {
                area += compute3DArea((Polygon) subGeom);
            }
        }
        return area;
    }
1240865
public static Double getMinZ(Geometry geom) {
        if (geom != null) {
            return CoordinateUtils.zMinMax(geom.getCoordinates())[0];
        } else {
            return null;
        }
    }
286991
public static Double getMaxX(Geometry geom) {
        if (geom != null) {
            return geom.getEnvelopeInternal().getMaxX();
        } else {
            return null;
        }
    }
576405
public static Point get(Geometry geometry) {
        // Get polygon from geometry
        Polygon polygon;
        if (geometry instanceof LineString) {
            // Validity of LineString is checked outside of this scope
            polygon = geometry.getFactory().createPolygon(geometry.getCoordinates());
        } else if (geometry instanceof MultiPolygon) {
            // For MultiPolygon the widest Polygon is taken
            Geometry widestGeometry = geometry.getGeometryN(0);
            for (int i = 1; i < geometry.getNumGeometries(); i++) {
                if (geometry.getGeometryN(i).getEnvelopeInternal().getWidth() >
                        widestGeometry.getEnvelopeInternal().getWidth()) {
                    widestGeometry = geometry.getGeometryN(i);
                }
            }
            polygon = (Polygon) widestGeometry;
        } else if (geometry instanceof Polygon) {
            polygon = (Polygon) geometry;
        } else {
            LOGGER.warning("Failed to get label for geometry: " + geometry);
            return geometry.getCentroid();
        }

        // As original geometry is used in other places clone it before re-projecting
        polygon = (Polygon) polygon.clone();

        // Re-project coordinates. This is needed to get proper visual results for polygons
        // distorted my Mercator projection
        polygon.apply(new CoordinateFilter() {
            @Override
            public void filter(Coordinate c) {
                c.x = longitudeToX(c.x);
                c.y = latitudeToY(c.y);
            }
        });
        polygon.geometryChanged();

        Envelope envelope = polygon.getEnvelopeInternal();

        double width = envelope.getWidth();
        double height = envelope.getHeight();
        double cellSize = Math.min(width, height);
        double h = cellSize / 2;

        // A priority queue of cells in order of their "potential" (max distance to polygon)
        PriorityQueue<Cell> cellQueue = new PriorityQueue<>(1, new MaxComparator());

        // Cover polygon with initial cells
        for (double x = envelope.getMinX(); x < envelope.getMaxX(); x += cellSize) {
            for (double y = envelope.getMinY(); y < envelope.getMaxY(); y += cellSize) {
                cellQueue.add(new Cell(x + h, y + h, h, polygon));
            }
        }

        // Take centroid as the first best guess
        Cell bestCell = getCentroidCell(polygon);

        // Special case for rectangular polygons
        Cell bboxCell = new Cell(envelope.centre().x, envelope.centre().y, 0, polygon);
        if (bboxCell.d > bestCell.d) bestCell = bboxCell;

        while (!cellQueue.isEmpty()) {
            // Pick the most promising cell from the queue
            Cell cell = cellQueue.remove();

            // Update the best cell if we found a better one
            if (cell.d > bestCell.d)
                bestCell = cell;

            // Do not drill down further if there's no chance of a better solution
            if (cell.max - bestCell.d <= PRECISION) continue;

            // Split the cell into four cells
            h = cell.h / 2;
            cellQueue.add(new Cell(cell.x - h, cell.y - h, h, polygon));
            cellQueue.add(new Cell(cell.x + h, cell.y - h, h, polygon));
            cellQueue.add(new Cell(cell.x - h, cell.y + h, h, polygon));
            cellQueue.add(new Cell(cell.x + h, cell.y + h, h, polygon));
        }

        // Return the best found point projected back to geodesic coordinates
        return geometry.getFactory().createPoint(new Coordinate(toLongitude(bestCell.x), toLatitude(bestCell.y)));
    }
491179
public JTSGeometryExpression<Geometry> union(Expression<? extends Geometry> geometry) {
        return JTSGeometryExpressions.geometryOperation(SpatialOps.UNION, mixin, geometry);
    }
1173905
private static Double compute3DArea(Polygon geometry) {
        DelaunayData delaunayData = new DelaunayData();
        delaunayData.put(geometry, DelaunayData.MODE.TESSELLATION);
        // Do triangulation
        delaunayData.triangulate();
        return delaunayData.get3DArea();
    }
503147
public Geometry createGeometry(Geometry geometry) {
		if (geometry instanceof Point) {
			return createPoint(geometry.getCoordinate());
		} else if (geometry instanceof LinearRing) {
			return createLinearRing(geometry.getCoordinates());
		} else if (geometry instanceof LineString) {
			return createLineString(geometry.getCoordinates());
		} else if (geometry instanceof Polygon) {
			Polygon polygon = (Polygon) geometry;
			LinearRing exteriorRing = createLinearRing(polygon.getExteriorRing().getCoordinates());
			LinearRing[] interiorRings = new LinearRing[polygon.getNumInteriorRing()];
			for (int n = 0; n < polygon.getNumInteriorRing(); n++) {
				interiorRings[n] = createLinearRing(polygon.getInteriorRingN(n).getCoordinates());
			}
			return new Polygon(srid, precision, exteriorRing, interiorRings);
		} else if (geometry instanceof MultiPoint) {
			Point[] clones = new Point[geometry.getNumGeometries()];
			for (int n = 0; n < geometry.getNumGeometries(); n++) {
				clones[n] = createPoint(geometry.getGeometryN(n).getCoordinate());
			}
			return new MultiPoint(srid, precision, clones);
		} else if (geometry instanceof MultiLineString) {
			LineString[] clones = new LineString[geometry.getNumGeometries()];
			for (int n = 0; n < geometry.getNumGeometries(); n++) {
				clones[n] = createLineString(geometry.getGeometryN(n).getCoordinates());
			}
			return new MultiLineString(srid, precision, clones);
		} else if (geometry instanceof MultiPolygon) {
			Polygon[] clones = new Polygon[geometry.getNumGeometries()];
			for (int n = 0; n < geometry.getNumGeometries(); n++) {
				clones[n] = (Polygon) createGeometry(geometry.getGeometryN(n));
			}
			return new MultiPolygon(srid, precision, clones);
		}
		return null;
	}
120583
public BooleanExpression overlaps(Expression<? extends Geometry> geometry) {
        return Expressions.booleanOperation(SpatialOps.OVERLAPS, mixin, geometry);
    }
9958
public JTSGeometryExpression<Geometry> difference(Expression<? extends Geometry> geometry) {
        return JTSGeometryExpressions.geometryOperation(SpatialOps.DIFFERENCE, mixin, geometry);
    }
665394
public GeometryExpression<Geometry> union(Expression<? extends Geometry> geometry) {
        return GeometryExpressions.geometryOperation(SpatialOps.UNION, mixin, geometry);
    }
794759
private List<Coordinate> getCoordinates(List<Geometry> geometries) {
		List<Coordinate> coordinates = new ArrayList<Coordinate>();
		for (Geometry geometry : geometries) {
			Coordinate[] geometryCoordinates = geometry.getCoordinates();
			for (int i = 0; i < geometryCoordinates.length; i++) {
				coordinates.add(geometryCoordinates[i]);
			}
		}
		return coordinates;
	}
1332310
public Geometry getGeometryN(int n) {
		if (isEmpty()) {
			return null;
		}
		if (n >= 0 && n < points.length) {
			return points[n];
		}
		throw new ArrayIndexOutOfBoundsException(n);
		// return this;
	}