/** Presents struct as a double[] */ protected double[] asDoubleArray(STRUCT struct, final double DEFAULT) throws SQLException { if (struct == null) return null; return asDoubleArray(struct.getOracleAttributes(), DEFAULT); }
/** * @param rs result set of the dimension info query * @param column column of the dimension info * @return the envelope out of the dimension info (assumption: x before y or longitude before * latitude) or null, if no data is in the specified column * @throws SQLException if dimension info can not be parsed * @author Hendrik Peilke */ private Envelope decodeDiminfoEnvelope(ResultSet rs, int column) throws SQLException { ARRAY returnArray = (ARRAY) rs.getObject(column); if (returnArray == null) { throw new SQLException("no data inside the specified column"); } Datum data[] = returnArray.getOracleArray(); if (data.length < 2) { throw new SQLException("too little dimension information found in sdo_geom_metadata"); } Datum[] xInfo = ((STRUCT) data[0]).getOracleAttributes(); Datum[] yInfo = ((STRUCT) data[1]).getOracleAttributes(); Double minx = xInfo[1].doubleValue(); Double maxx = xInfo[2].doubleValue(); Double miny = yInfo[1].doubleValue(); Double maxy = yInfo[2].doubleValue(); return new Envelope(minx, maxx, miny, maxy); }
/** * Convert provided SDO_GEOMETRY to JTS Geometry. * * <p>Will return <code>null</code> as <code>null</code>. * * @param sdoGeometry datum STRUCT to be converted to a double[] * @return JTS <code>Geometry</code> representing the provided <code>datum</code> * @throws SQLException * @see net.refractions.jspatial.Converter#toObject(oracle.sql.STRUCT) */ public Geometry asGeometry(STRUCT sdoGeometry) throws SQLException { // Note Returning null for null Datum if (sdoGeometry == null) return null; Datum data[] = sdoGeometry.getOracleAttributes(); final int GTYPE = asInteger(data[0], 0); final int SRID = asInteger(data[1], SDO.SRID_NULL); final double POINT[] = asDoubleArray((STRUCT) data[2], Double.NaN); final int ELEMINFO[] = asIntArray((ARRAY) data[3], 0); final double ORDINATES[] = asDoubleArray((ARRAY) data[4], Double.NaN); return SDO.create(geometryFactory, GTYPE, SRID, POINT, ELEMINFO, ORDINATES); }
/** Presents struct as a double[] */ public static double[] toDoubleArray(STRUCT struct, final double defaultValue) throws SQLException { if (struct == null) return null; return toDoubleArray(struct.getOracleAttributes(), defaultValue); }
/** Presents struct as a double[] */ protected double[] asDoubleArray( STRUCT struct, final double DEFAULT ) throws SQLException { if( struct == null ) return null; return asDoubleArray( struct.getOracleAttributes(), DEFAULT ); }
return null; Datum data[] = struct.getOracleAttributes();
ResultSetMetaData meta = sdoGeometry.getDescriptor().getMetaData(); Datum data[] = sdoGeometry.getOracleAttributes(); final int GTYPE = asInteger( data[0], 0 ); final int SRID = asInteger( data[1], SDO.SRID_NULL );