use of oracle.spatial.geometry.JGeometry in project querydsl by querydsl.
the class JGeometryConverter method convert.
private static JGeometry convert(LineString geometry) {
int srid = geometry.getSRID();
int dim = geometry.getCoordinateDimension();
double[] points = getPoints(geometry.getPoints());
int[] elemInfo = new int[] { 1, 2, 1 };
int gtype = dim * 1000 + (geometry.isMeasured() ? dim : 0) * 100 + GTYPE_CURVE;
return new JGeometry(gtype, srid, elemInfo, points);
}
use of oracle.spatial.geometry.JGeometry in project querydsl by querydsl.
the class JGeometryConverter method convertCollection.
// FIXME
private static GeometryCollection convertCollection(JGeometry geometry) {
JGeometry[] elements = geometry.getElements();
if (elements == null || elements.length == 0) {
return GeometryCollection.createEmpty();
}
Geometry[] geometries = new Geometry[elements.length];
for (int i = 0; i < elements.length; i++) {
geometries[i] = convert(elements[i]);
}
return new GeometryCollection(geometries);
}
use of oracle.spatial.geometry.JGeometry in project querydsl by querydsl.
the class JGeometryConverter method convertMultiPoint.
private static MultiPoint convertMultiPoint(JGeometry geometry) {
CrsId crs = CrsId.valueOf(geometry.getSRID());
JGeometry[] elements = geometry.getElements();
if (elements == null || elements.length == 0) {
return MultiPoint.createEmpty();
}
Point[] points = new Point[elements.length];
int dimensions = geometry.getDimensions();
double[] ordinates = geometry.getOrdinatesArray();
boolean measured = geometry.isLRSGeometry();
DimensionalFlag flag = DimensionalFlag.valueOf(dimensions > (measured ? 3 : 2), measured);
int offset = 0;
for (int i = 0; i < points.length; i++) {
double[] coords = new double[dimensions];
System.arraycopy(ordinates, offset, coords, 0, coords.length);
points[i] = new Point(PointCollectionFactory.create(coords, flag, crs));
offset += dimensions;
}
return new MultiPoint(points);
}
use of oracle.spatial.geometry.JGeometry in project querydsl by querydsl.
the class JGeometryConverter method convert.
private static JGeometry convert(Polygon geometry) {
int srid = geometry.getSRID();
int dim = geometry.getCoordinateDimension();
double[] points = getPoints(geometry.getPoints());
int[] elemInfo = new int[3 + geometry.getNumInteriorRing() * 3];
int offset = 0;
int pointOffset = 1;
elemInfo[offset++] = pointOffset;
// exterior
elemInfo[offset++] = 1003;
elemInfo[offset++] = 1;
pointOffset += geometry.getExteriorRing().getNumPoints() * dim;
for (int i = 0; i < geometry.getNumInteriorRing(); i++) {
elemInfo[offset++] = pointOffset;
elemInfo[offset++] = 2003;
elemInfo[offset++] = 1;
pointOffset += geometry.getInteriorRingN(i).getNumPoints() * dim;
}
int gtype = dim * 1000 + (geometry.isMeasured() ? dim : 0) * 100 + GTYPE_POLYGON;
return new JGeometry(gtype, srid, elemInfo, points);
}
use of oracle.spatial.geometry.JGeometry in project ili2db by claeis.
the class OracleColumnConverter method toIomCoord.
@Override
public IomObject toIomCoord(Object geomobj, String sqlAttrName, boolean is3D) throws java.sql.SQLException, ConverterException {
JGeometry geometry = JGeometry.load((oracle.sql.STRUCT) geomobj);
if (geometry.getType() != JGeometry.GTYPE_POINT) {
throw new ConverterException("unexpected GTYPE (" + OracleUtility.gtype2str(geometry.getType()) + ")");
} else {
int dim = geometry.getDimensions();
boolean isCurrentValue3D = (dim == 3);
if (isCurrentValue3D != is3D) {
throw new ConverterException("unexpected dimension (" + Integer.toString(dim) + ")");
} else {
double[] valuev = geometry.getFirstPoint();
IomObject coord = new Iom_jObject("COORD", null);
coord.setattrvalue("C1", Double.toString(valuev[0]));
coord.setattrvalue("C2", Double.toString(valuev[1]));
if (dim == 3) {
coord.setattrvalue("C3", Double.toString(valuev[2]));
}
return coord;
}
}
}
Aggregations