public static GeometryType symDifference(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException { Geometry g1 = getGeometry(geom1); Geometry g2 = getGeometry(geom2); return getGeometryType(g1.symDifference(g2)); }
public static Boolean intersects(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException { Geometry g1 = getGeometry(geom1); Geometry g2 = getGeometry(geom2); return g1.intersects(g2); }
public static GeometryType intersection(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException { Geometry g1 = getGeometry(geom1); Geometry g2 = getGeometry(geom2); return getGeometryType(g1.intersection(g2)); }
public static Boolean contains(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException { Geometry g1 = getGeometry(geom1); Geometry g2 = getGeometry(geom2); return g1.contains(g2); }
public static GeometryType exteriorRing(GeometryType geom) throws FunctionExecutionException { Geometry g = getGeometry(geom); if (!(g instanceof Polygon)) { return null; } return getGeometryType(((Polygon)g).getExteriorRing()); }
public static Boolean disjoint(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException { Geometry g1 = getGeometry(geom1); Geometry g2 = getGeometry(geom2); return g1.disjoint(g2); }
public static GeometryType pointN(GeometryType geom, int i) throws FunctionExecutionException { Geometry g = getGeometry(geom); if (!(g instanceof LineString)) { return null; } LineString g2 = (LineString)g; if (i < 0 || i >= g2.getNumPoints()) { return null; } return getGeometryType(g2.getPointN(i)); }
public static Boolean contains(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException { Geometry g1 = getGeometry(geom1); Geometry g2 = getGeometry(geom2); return g1.contains(g2); }
public static GeometryType pointOnSurface(GeometryType geom) throws FunctionExecutionException { Geometry g = getGeometry(geom); Point point = g.getInteriorPoint(); if (point == null) { return null; } return getGeometryType(point, geom.getSrid()); }
public static Boolean within(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException { Geometry g1 = getGeometry(geom1); Geometry g2 = getGeometry(geom2); return g1.within(g2); }
public static GeometryType pointN(GeometryType geom, int i) throws FunctionExecutionException { Geometry g = getGeometry(geom); if (!(g instanceof LineString)) { return null; } LineString g2 = (LineString)g; if (i < 0 || i >= g2.getNumPoints()) { return null; } return getGeometryType(g2.getPointN(i), geom.getSrid()); }
public static Boolean relate(GeometryType geom1, GeometryType geom2, String intersectionPattern) throws FunctionExecutionException { Geometry g1 = getGeometry(geom1); Geometry g2 = getGeometry(geom2); return g1.relate(g2, intersectionPattern); }
public static GeometryType polygon(GeometryType geom, int srid) throws FunctionExecutionException { Geometry g = getGeometry(geom); if (!(g instanceof LineString)) { throw new FunctionExecutionException(QueryPlugin.Event.TEIID31207, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31207)); } LineString ls = (LineString)g; Geometry result = GEOMETRY_FACTORY.createPolygon(ls.getCoordinateSequence()); return getGeometryType(result, srid); }
public static Boolean crosses(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException { Geometry g1 = getGeometry(geom1); Geometry g2 = getGeometry(geom2); return g1.crosses(g2); }
public static Integer numInteriorRings(GeometryType geom) throws FunctionExecutionException { Geometry g = getGeometry(geom); if (!(g instanceof Polygon)) { return null; } return ((Polygon)g).getNumInteriorRing(); }
public static Integer numInteriorRings(GeometryType geom) throws FunctionExecutionException { Geometry g = getGeometry(geom); if (!(g instanceof Polygon)) { return null; } return ((Polygon)g).getNumInteriorRing(); }
public static Boolean isClosed(GeometryType geom) throws FunctionExecutionException { Geometry g = getGeometry(geom); if (!(g instanceof LineString)) { return false; } LineString lineString = ((LineString)g); return lineString.isClosed(); }
public static ClobType geometryToClob(GeometryType geometry, boolean withSrid) throws FunctionExecutionException { Geometry jtsGeometry = getGeometry(geometry); int srid = jtsGeometry.getSRID(); StringBuilder geomText = new StringBuilder(); if (withSrid && srid != GeometryType.UNKNOWN_SRID) { geomText.append("SRID=").append(jtsGeometry.getSRID()).append(";"); //$NON-NLS-1$ //$NON-NLS-2$ } geomText.append(jtsGeometry.toText()); return new ClobType(new ClobImpl(geomText.toString())); }
public static Geometry getGeometry(GeometryType geom) throws FunctionExecutionException { try { return getGeometry(geom.getBinaryStream(), geom.getSrid(), false); } catch (SQLException e) { throw new FunctionExecutionException(e); } }
public static BlobType asBlob(GeometryType geometry, String encoding) throws FunctionExecutionException { if ("NDR".equals(encoding)) { //$NON-NLS-1$ return new BlobType(GeometryUtils.getBytes(GeometryUtils.getGeometry(geometry), false)); } Blob b = geometry.getReference(); return new BlobType(b); }