@TeiidFunction(name=SourceSystemFunctions.ST_SETSRID, category=FunctionCategoryConstants.GEOGRAPHY, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) public static GeographyType setSrid(GeographyType geog, int srid) { GeographyType gt = new GeographyType(); gt.setReference(geog.getReference()); gt.setSrid(srid); return gt; }
/** * This method transforms a value of the source type into a value * of the target type. * @param value Incoming value of source type * @return Outgoing value of target type * @throws TransformationException if value is an incorrect input type or * the transformation fails */ public Object transformDirect(Object value) throws TransformationException { GeographyType geog = (GeographyType)value; GeometryType geom = new GeometryType(geog.getReference()); geog.copyTo(geom); return geom; }
@Override protected Object readObject(ObjectInput in, List<Object> cache, byte version) throws IOException, ClassNotFoundException { if (version < VERSION_GEOGRAPHY) { BlobType bt = new BlobType(); bt.readExternal(in); return bt; } GeographyType bt = new GeographyType(); bt.readExternal(in); return bt; } }
public static GeographyType getGeographyType(Geometry geom) { byte[] bytes = getBytes(geom, true); GeographyType result = new GeographyType(bytes, geom.getSRID()); result.setGeoCache(geom); return result; }
/** * The default strategy assumes a blob value containing wkb * @param results * @param paramIndex * @return * @throws SQLException */ public Object retrieveGeographyValue(ResultSet results, int paramIndex) throws SQLException { GeographyType geog = null; Blob val = results.getBlob(paramIndex); if (val != null) { geog = new GeographyType(val); } return geog; }
public GeographyType() { setSrid(DEFAULT_SRID); }
@TeiidFunction(name=SourceSystemFunctions.ST_SRID, category=FunctionCategoryConstants.GEOGRAPHY, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) public static int getSrid(GeographyType geog) { return geog.getSrid(); }
@TeiidFunction(name=SourceSystemFunctions.ST_ASBINARY, category=FunctionCategoryConstants.GEOGRAPHY, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) public static BlobType asBlob(GeographyType geometry) { Blob b = geometry.getReference(); return new BlobType(b); }
@Override protected Object readObject(ObjectInput in, List<Object> cache, byte version) throws IOException, ClassNotFoundException { if (version < VERSION_GEOGRAPHY) { BlobType bt = new BlobType(); bt.readExternal(in); return bt; } GeographyType bt = new GeographyType(); bt.readExternal(in); return bt; } }
public static GeographyType getGeographyType(Geometry geom) { byte[] bytes = getBytes(geom, true); GeographyType result = new GeographyType(bytes, geom.getSRID()); result.setGeoCache(geom); return result; }
@Test public void testGeographyToGeometry() throws Exception { assertTrue(DataTypeManager.transformValue(new GeographyType(new byte[0]), DataTypeManager.DefaultDataClasses.GEOMETRY) instanceof GeometryType); //$NON-NLS-1$ }
public GeographyType(Blob blob, int srid) { super(blob); setSrid(srid); }
@TeiidFunction(name=SourceSystemFunctions.ST_SRID, category=FunctionCategoryConstants.GEOGRAPHY, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) public static int getSrid(GeographyType geog) { return geog.getSrid(); }
@TeiidFunction(name=SourceSystemFunctions.ST_ASBINARY, category=FunctionCategoryConstants.GEOGRAPHY, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) public static BlobType asBlob(GeographyType geometry) { Blob b = geometry.getReference(); return new BlobType(b); }
@TeiidFunction(name=SourceSystemFunctions.ST_SETSRID, category=FunctionCategoryConstants.GEOGRAPHY, nullOnNull=true, pushdown=PushDown.CAN_PUSHDOWN) public static GeographyType setSrid(GeographyType geog, int srid) { GeographyType gt = new GeographyType(); gt.setReference(geog.getReference()); gt.setSrid(srid); return gt; }
public GeographyType(byte[] bytes, int srid) { super(bytes); setSrid(srid); }
/** * This method transforms a value of the source type into a value * of the target type. * @param value Incoming value of source type * @return Outgoing value of target type * @throws TransformationException if value is an incorrect input type or * the transformation fails */ public Object transformDirect(Object value) throws TransformationException { GeographyType geog = (GeographyType)value; GeometryType geom = new GeometryType(geog.getReference()); geog.copyTo(geom); return geom; }
@Test public void testGeography() throws IOException, ClassNotFoundException { GeometryType geometryType = new GeometryType(new byte[0]); geometryType.setReferenceStreamId(null); geometryType.setSrid(4326); Object val = helpTestSerialization(new String[] {DataTypeManager.DefaultDataTypes.GEOGRAPHY}, new List[] {Arrays.asList(geometryType)}, BatchSerializer.VERSION_GEOGRAPHY).get(0).get(0); assertTrue(val instanceof GeographyType); assertEquals(4326, ((GeographyType)val).getSrid()); helpTestSerialization(new String[] {DataTypeManager.DefaultDataTypes.GEOGRAPHY}, new List[] {Arrays.asList(geometryType)}, (byte)0); //object serialization - should fail on the client side val = helpTestSerialization(new String[] {DataTypeManager.DefaultDataTypes.GEOGRAPHY}, new List[] {Arrays.asList(geometryType)}, (byte)1).get(0).get(0); //blob serialization assertFalse(val instanceof GeographyType); val = helpTestSerialization(new String[] {DataTypeManager.DefaultDataTypes.OBJECT}, new List[] {Arrays.asList(geometryType)}, (byte)1).get(0).get(0); //blob serialization assertFalse(val instanceof GeographyType); }
public GeographyType(byte[] bytes, int srid) { super(bytes); setSrid(srid); }
public GeographyType(Blob blob, int srid) { super(blob); setSrid(srid); }