HHH-6513 - Sqlserver encoder/decoders now use Geolatte-geom.
Bumps geolatte version to 0.12-SNAPSHOT
This commit is contained in:
parent
b4b626c398
commit
cf03fe2592
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
hibernate.dialect org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDialect
|
hibernate.dialect org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDialect
|
||||||
hibernate.connection.driver_class com.microsoft.sqlserver.jdbc.SQLServerDriver
|
hibernate.connection.driver_class com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||||
hibernate.connection.url jdbc:sqlserver://192.168.0.100:1433;databaseName=HBS
|
hibernate.connection.url jdbc:sqlserver://sqlserver.geovise.com:1433;databaseName=HBS
|
||||||
hibernate.connection.username hbs
|
hibernate.connection.username hbs
|
||||||
hibernate.connection.password hbs
|
hibernate.connection.password hbs
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,12 @@ dependencies {
|
||||||
compile([group: 'com.vividsolutions', name: 'jts', version: '1.12']) {
|
compile([group: 'com.vividsolutions', name: 'jts', version: '1.12']) {
|
||||||
transitive = false
|
transitive = false
|
||||||
}
|
}
|
||||||
compile([group: 'org.geolatte', name: 'geolatte-geom', version: '0.11-SNAPSHOT'])
|
compile([group: 'org.postgis', name: 'postgis-jdbc', version: '1.5.3'])
|
||||||
|
compile([group: 'postgresql', name: 'postgresql', version: '8.4-701.jdbc4'])
|
||||||
|
|
||||||
|
|
||||||
|
compile([group: 'org.geolatte', name: 'geolatte-geom', version: '0.12-SNAPSHOT'])
|
||||||
|
|
||||||
|
|
||||||
compile(libraries.dom4j) {
|
compile(libraries.dom4j) {
|
||||||
transitive = false
|
transitive = false
|
||||||
|
@ -38,7 +43,7 @@ dependencies {
|
||||||
testCompile(project(':hibernate-testing'))
|
testCompile(project(':hibernate-testing'))
|
||||||
testRuntime([group: 'commons-dbcp', name: 'commons-dbcp', version: '1.4'])
|
testRuntime([group: 'commons-dbcp', name: 'commons-dbcp', version: '1.4'])
|
||||||
// testRuntime([group: 'com.oracle.jdbc', name: 'ojdbc6', version: '11.2.0.3'])
|
// testRuntime([group: 'com.oracle.jdbc', name: 'ojdbc6', version: '11.2.0.3'])
|
||||||
// testRuntime([group: 'com.microsoft', name: 'sqljdbc', version: '2.0'])
|
testRuntime([group: 'com.microsoft', name: 'sqljdbc', version: '2.0'])
|
||||||
// testRuntime("org.opengeo:geodb:0.7")
|
// testRuntime("org.opengeo:geodb:0.7")
|
||||||
// testRuntime("mysql:mysql-connector-java:5.1.15")
|
// testRuntime("mysql:mysql-connector-java:5.1.15")
|
||||||
testRuntime("postgresql:postgresql:8.4-701.jdbc4")
|
testRuntime("postgresql:postgresql:8.4-701.jdbc4")
|
||||||
|
|
|
@ -21,7 +21,15 @@
|
||||||
|
|
||||||
package org.hibernate.spatial.dialect.sqlserver;
|
package org.hibernate.spatial.dialect.sqlserver;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import java.sql.Blob;
|
||||||
|
import java.sql.CallableStatement;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Types;
|
||||||
|
|
||||||
|
import org.geolatte.geom.Geometry;
|
||||||
|
|
||||||
import org.hibernate.spatial.GeometrySqlTypeDescriptor;
|
import org.hibernate.spatial.GeometrySqlTypeDescriptor;
|
||||||
import org.hibernate.spatial.dialect.sqlserver.convertors.Decoders;
|
import org.hibernate.spatial.dialect.sqlserver.convertors.Decoders;
|
||||||
import org.hibernate.spatial.dialect.sqlserver.convertors.Encoders;
|
import org.hibernate.spatial.dialect.sqlserver.convertors.Encoders;
|
||||||
|
@ -32,8 +40,6 @@ import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
||||||
import org.hibernate.type.descriptor.sql.BasicBinder;
|
import org.hibernate.type.descriptor.sql.BasicBinder;
|
||||||
import org.hibernate.type.descriptor.sql.BasicExtractor;
|
import org.hibernate.type.descriptor.sql.BasicExtractor;
|
||||||
|
|
||||||
import java.sql.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Karel Maesen, Geovise BVBA
|
* @author Karel Maesen, Geovise BVBA
|
||||||
* creation-date: 8/23/11
|
* creation-date: 8/23/11
|
||||||
|
|
|
@ -21,30 +21,20 @@
|
||||||
|
|
||||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
|
||||||
|
|
||||||
import org.hibernate.spatial.jts.mgeom.MGeometryFactory;
|
import org.geolatte.geom.Geometry;
|
||||||
|
|
||||||
abstract class AbstractDecoder<G extends Geometry> implements Decoder<G> {
|
abstract class AbstractDecoder<G extends Geometry> implements Decoder<G> {
|
||||||
|
|
||||||
private final MGeometryFactory geometryFactory;
|
|
||||||
|
|
||||||
public AbstractDecoder(MGeometryFactory factory) {
|
|
||||||
this.geometryFactory = factory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public G decode(SqlServerGeometry nativeGeom) {
|
public G decode(SqlServerGeometry nativeGeom) {
|
||||||
if ( !accepts( nativeGeom ) ) {
|
if ( !accepts( nativeGeom ) ) {
|
||||||
throw new IllegalArgumentException( getClass().getSimpleName() + " received object of type " + nativeGeom.openGisType() );
|
throw new IllegalArgumentException( getClass().getSimpleName() + " received object of type " + nativeGeom.openGisType() );
|
||||||
}
|
}
|
||||||
if ( nativeGeom.isEmpty() ) {
|
if ( nativeGeom.isEmpty() ) {
|
||||||
G nullGeom = createNullGeometry();
|
G nullGeom = createNullGeometry();
|
||||||
setSrid( nativeGeom, nullGeom );
|
|
||||||
return nullGeom;
|
return nullGeom;
|
||||||
}
|
}
|
||||||
G result = createGeometry( nativeGeom );
|
return createGeometry( nativeGeom );
|
||||||
setSrid( nativeGeom, result );
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean accepts(OpenGisType type) {
|
public boolean accepts(OpenGisType type) {
|
||||||
|
@ -63,15 +53,4 @@ abstract class AbstractDecoder<G extends Geometry> implements Decoder<G> {
|
||||||
|
|
||||||
protected abstract G createGeometry(SqlServerGeometry nativeGeom, int shapeIndex);
|
protected abstract G createGeometry(SqlServerGeometry nativeGeom, int shapeIndex);
|
||||||
|
|
||||||
protected MGeometryFactory getGeometryFactory() {
|
|
||||||
return this.geometryFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setSrid(SqlServerGeometry sqlServerGeom, G result) {
|
|
||||||
if ( sqlServerGeom.getSrid() != null ) {
|
|
||||||
result.setSRID( sqlServerGeom.getSrid() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,31 +24,28 @@ package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import org.geolatte.geom.Geometry;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.geolatte.geom.PointCollection;
|
||||||
|
|
||||||
import org.hibernate.spatial.jts.mgeom.MGeometry;
|
|
||||||
|
|
||||||
|
|
||||||
abstract class AbstractEncoder<G extends Geometry> implements Encoder<G> {
|
abstract class AbstractEncoder<G extends Geometry> implements Encoder<G> {
|
||||||
|
|
||||||
public SqlServerGeometry encode(G geom) {
|
public SqlServerGeometry encode(G geom) {
|
||||||
SqlServerGeometry nativeGeom = new SqlServerGeometry();
|
SqlServerGeometry nativeGeom = new SqlServerGeometry();
|
||||||
nativeGeom.setSrid( geom.getSRID() );
|
int srid = geom.getSRID();
|
||||||
if ( geom.isValid() ) {
|
nativeGeom.setSrid( srid < 0 ? 0 : srid );
|
||||||
nativeGeom.setIsValid();
|
nativeGeom.setIsValid();
|
||||||
}
|
|
||||||
|
|
||||||
if ( hasMValues( geom ) ) {
|
if ( geom.isMeasured() ) {
|
||||||
nativeGeom.setHasMValues();
|
nativeGeom.setHasMValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Coordinate> coordinates = new ArrayList<Coordinate>();
|
CountingPointSequenceBuilder coordinates = new CountingPointSequenceBuilder(geom.getDimensionalFlag());
|
||||||
List<Figure> figures = new ArrayList<Figure>();
|
List<Figure> figures = new ArrayList<Figure>();
|
||||||
List<Shape> shapes = new ArrayList<Shape>();
|
List<Shape> shapes = new ArrayList<Shape>();
|
||||||
|
|
||||||
encode( geom, -1, coordinates, figures, shapes );
|
encode( geom, -1, coordinates, figures, shapes );
|
||||||
encodePoints( nativeGeom, coordinates );
|
encodePoints( nativeGeom, coordinates.toPointSequence() );
|
||||||
encodeFigures( nativeGeom, figures );
|
encodeFigures( nativeGeom, figures );
|
||||||
encodeShapes( nativeGeom, shapes );
|
encodeShapes( nativeGeom, shapes );
|
||||||
return nativeGeom;
|
return nativeGeom;
|
||||||
|
@ -63,7 +60,7 @@ abstract class AbstractEncoder<G extends Geometry> implements Encoder<G> {
|
||||||
* @param figures figure list to append to
|
* @param figures figure list to append to
|
||||||
* @param shapes shape list to append to
|
* @param shapes shape list to append to
|
||||||
*/
|
*/
|
||||||
protected abstract void encode(Geometry geom, int parentShapeIndex, List<Coordinate> coordinates, List<Figure> figures, List<Shape> shapes);
|
protected abstract void encode(Geometry geom, int parentShapeIndex, CountingPointSequenceBuilder coordinates, List<Figure> figures, List<Shape> shapes);
|
||||||
|
|
||||||
protected void encodeShapes(SqlServerGeometry nativeGeom, List<Shape> shapes) {
|
protected void encodeShapes(SqlServerGeometry nativeGeom, List<Shape> shapes) {
|
||||||
nativeGeom.setNumberOfShapes( shapes.size() );
|
nativeGeom.setNumberOfShapes( shapes.size() );
|
||||||
|
@ -79,21 +76,17 @@ abstract class AbstractEncoder<G extends Geometry> implements Encoder<G> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean hasMValues(G geom) {
|
|
||||||
return geom instanceof MGeometry;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
protected void encodePoints(SqlServerGeometry nativeGeom, PointCollection coordinates) {
|
||||||
protected void encodePoints(SqlServerGeometry nativeGeom, List<Coordinate> coordinates) {
|
|
||||||
nativeGeom.setNumberOfPoints( coordinates.size() );
|
nativeGeom.setNumberOfPoints( coordinates.size() );
|
||||||
nativeGeom.allocateMValueArray();
|
nativeGeom.allocateMValueArray();
|
||||||
for ( int i = 0; i < coordinates.size(); i++ ) {
|
for ( int i = 0; i < coordinates.size(); i++ ) {
|
||||||
setCoordinate( nativeGeom, i, coordinates.get( i ) );
|
setCoordinate( nativeGeom, i, coordinates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setCoordinate(SqlServerGeometry nativeGeom, int idx, Coordinate coordinate) {
|
protected void setCoordinate(SqlServerGeometry nativeGeom, int idx, PointCollection coordinate) {
|
||||||
if ( !nativeGeom.hasZValues() && !Double.isNaN( coordinate.z ) ) {
|
if ( !nativeGeom.hasZValues() && !Double.isNaN( coordinate.getZ(idx) ) ) {
|
||||||
nativeGeom.setHasZValues();
|
nativeGeom.setHasZValues();
|
||||||
nativeGeom.allocateZValueArray();
|
nativeGeom.allocateZValueArray();
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,17 +24,11 @@ package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.geolatte.geom.Geometry;
|
||||||
import com.vividsolutions.jts.geom.GeometryCollection;
|
import org.geolatte.geom.GeometryCollection;
|
||||||
|
|
||||||
import org.hibernate.spatial.jts.mgeom.MGeometryFactory;
|
|
||||||
|
|
||||||
abstract class AbstractGeometryCollectionDecoder<T extends GeometryCollection> extends AbstractDecoder<T> {
|
abstract class AbstractGeometryCollectionDecoder<T extends GeometryCollection> extends AbstractDecoder<T> {
|
||||||
|
|
||||||
public AbstractGeometryCollectionDecoder(MGeometryFactory factory) {
|
|
||||||
super( factory );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected OpenGisType getOpenGisType() {
|
protected OpenGisType getOpenGisType() {
|
||||||
return OpenGisType.GEOMETRYCOLLECTION;
|
return OpenGisType.GEOMETRYCOLLECTION;
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||||
|
|
||||||
|
import org.geolatte.geom.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Karel Maesen, Geovise BVBA
|
||||||
|
* creation-date: 10/19/12
|
||||||
|
*/
|
||||||
|
public class CountingPointSequenceBuilder implements PointSequenceBuilder {
|
||||||
|
|
||||||
|
final private PointSequenceBuilder delegate;
|
||||||
|
private int num = 0;
|
||||||
|
|
||||||
|
public CountingPointSequenceBuilder(DimensionalFlag df) {
|
||||||
|
delegate = PointSequenceBuilders.variableSized(df);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PointSequenceBuilder add(double[] coordinates) {
|
||||||
|
num++;
|
||||||
|
return delegate.add(coordinates);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PointSequenceBuilder add(double x, double y) {
|
||||||
|
num++;
|
||||||
|
return delegate.add(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PointSequenceBuilder add(double x, double y, double zOrm) {
|
||||||
|
num++;
|
||||||
|
return delegate.add(x, y, zOrm);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PointSequenceBuilder add(double x, double y, double z, double m) {
|
||||||
|
num++;
|
||||||
|
return delegate.add(x, y, z, m);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PointSequenceBuilder add(Point pnt) {
|
||||||
|
num++;
|
||||||
|
return delegate.add(pnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DimensionalFlag getDimensionalFlag() {
|
||||||
|
return delegate.getDimensionalFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PointSequence toPointSequence() {
|
||||||
|
return delegate.toPointSequence();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNumAdded(){
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,7 +21,8 @@
|
||||||
|
|
||||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
|
||||||
|
import org.geolatte.geom.Geometry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decodes native database objects to geometries of type T.
|
* Decodes native database objects to geometries of type T.
|
||||||
|
|
|
@ -21,14 +21,11 @@
|
||||||
|
|
||||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||||
|
|
||||||
|
import org.geolatte.geom.Geometry;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
|
||||||
|
|
||||||
import org.hibernate.spatial.jts.JTS;
|
|
||||||
import org.hibernate.spatial.jts.mgeom.MGeometryFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decodes SQL Server Geometry objects to JTS <code>Geometry</code>s.
|
* Decodes SQL Server Geometry objects to JTS <code>Geometry</code>s.
|
||||||
*
|
*
|
||||||
|
@ -39,16 +36,14 @@ public class Decoders {
|
||||||
final private static List<Decoder<? extends Geometry>> DECODERS = new ArrayList<Decoder<? extends Geometry>>();
|
final private static List<Decoder<? extends Geometry>> DECODERS = new ArrayList<Decoder<? extends Geometry>>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
MGeometryFactory factory = JTS.getDefaultGeometryFactory();
|
|
||||||
|
|
||||||
//Decoders
|
//Decoders
|
||||||
DECODERS.add( new PointDecoder( factory ) );
|
DECODERS.add( new PointDecoder() );
|
||||||
DECODERS.add( new LineStringDecoder( factory ) );
|
DECODERS.add( new LineStringDecoder() );
|
||||||
DECODERS.add( new PolygonDecoder( factory ) );
|
DECODERS.add( new PolygonDecoder() );
|
||||||
DECODERS.add( new MultiLineStringDecoder( factory ) );
|
DECODERS.add( new MultiLineStringDecoder( ) );
|
||||||
DECODERS.add( new MultiPolygonDecoder( factory ) );
|
DECODERS.add( new MultiPolygonDecoder( ) );
|
||||||
DECODERS.add( new MultiPointDecoder( factory ) );
|
DECODERS.add( new MultiPointDecoder( ) );
|
||||||
DECODERS.add( new GeometryCollectionDecoder( factory ) );
|
DECODERS.add( new GeometryCollectionDecoder( ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.geolatte.geom.Geometry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An <code>Encoder</code> can encode
|
* An <code>Encoder</code> can encode
|
||||||
|
|
|
@ -24,10 +24,11 @@ package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.geolatte.geom.Geometry;
|
||||||
import com.vividsolutions.jts.geom.GeometryCollection;
|
import org.geolatte.geom.GeometryCollection;
|
||||||
import com.vividsolutions.jts.geom.MultiLineString;
|
import org.geolatte.geom.MultiLineString;
|
||||||
import com.vividsolutions.jts.geom.MultiPolygon;
|
import org.geolatte.geom.MultiPoint;
|
||||||
|
import org.geolatte.geom.MultiPolygon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serializes a JTS <code>Geometry</code> to a byte-array.
|
* Serializes a JTS <code>Geometry</code> to a byte-array.
|
||||||
|
@ -44,7 +45,7 @@ public class Encoders {
|
||||||
ENCODERS.add( new PointEncoder() );
|
ENCODERS.add( new PointEncoder() );
|
||||||
ENCODERS.add( new LineStringEncoder() );
|
ENCODERS.add( new LineStringEncoder() );
|
||||||
ENCODERS.add( new PolygonEncoder() );
|
ENCODERS.add( new PolygonEncoder() );
|
||||||
ENCODERS.add( new MultiPointEncoder() );
|
ENCODERS.add( new GeometryCollectionEncoder<MultiPoint>(OpenGisType.MULTIPOINT) );
|
||||||
ENCODERS.add( new GeometryCollectionEncoder<MultiLineString>( OpenGisType.MULTILINESTRING ) );
|
ENCODERS.add( new GeometryCollectionEncoder<MultiLineString>( OpenGisType.MULTILINESTRING ) );
|
||||||
ENCODERS.add( new GeometryCollectionEncoder<MultiPolygon>( OpenGisType.MULTIPOLYGON ) );
|
ENCODERS.add( new GeometryCollectionEncoder<MultiPolygon>( OpenGisType.MULTIPOLYGON ) );
|
||||||
ENCODERS.add( new GeometryCollectionEncoder<GeometryCollection>( OpenGisType.GEOMETRYCOLLECTION ) );
|
ENCODERS.add( new GeometryCollectionEncoder<GeometryCollection>( OpenGisType.GEOMETRYCOLLECTION ) );
|
||||||
|
|
|
@ -23,10 +23,8 @@ package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.geolatte.geom.Geometry;
|
||||||
import com.vividsolutions.jts.geom.GeometryCollection;
|
import org.geolatte.geom.GeometryCollection;
|
||||||
|
|
||||||
import org.hibernate.spatial.jts.mgeom.MGeometryFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>Decoder</code> for GeometryCollections.
|
* <code>Decoder</code> for GeometryCollections.
|
||||||
|
@ -35,9 +33,6 @@ import org.hibernate.spatial.jts.mgeom.MGeometryFactory;
|
||||||
*/
|
*/
|
||||||
class GeometryCollectionDecoder extends AbstractGeometryCollectionDecoder<GeometryCollection> {
|
class GeometryCollectionDecoder extends AbstractGeometryCollectionDecoder<GeometryCollection> {
|
||||||
|
|
||||||
public GeometryCollectionDecoder(MGeometryFactory factory) {
|
|
||||||
super( factory );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected OpenGisType getOpenGisType() {
|
protected OpenGisType getOpenGisType() {
|
||||||
|
@ -46,7 +41,7 @@ class GeometryCollectionDecoder extends AbstractGeometryCollectionDecoder<Geomet
|
||||||
|
|
||||||
protected GeometryCollection createGeometry(List<Geometry> geometries, boolean hasM) {
|
protected GeometryCollection createGeometry(List<Geometry> geometries, boolean hasM) {
|
||||||
Geometry[] geomArray = geometries != null ? geometries.toArray( new Geometry[geometries.size()] ) : null;
|
Geometry[] geomArray = geometries != null ? geometries.toArray( new Geometry[geometries.size()] ) : null;
|
||||||
return getGeometryFactory().createGeometryCollection( geomArray );
|
return new GeometryCollection( geomArray );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,8 @@ package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import org.geolatte.geom.Geometry;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.geolatte.geom.GeometryCollection;
|
||||||
import com.vividsolutions.jts.geom.GeometryCollection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>Encoder</code> for GeometryCollections.
|
* <code>Encoder</code> for GeometryCollections.
|
||||||
|
@ -45,7 +44,7 @@ class GeometryCollectionEncoder<T extends GeometryCollection> extends AbstractEn
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void encode(Geometry geom, int parentShapeIndex, List<Coordinate> coordinates, List<Figure> figures, List<Shape> shapes) {
|
protected void encode(Geometry geom, int parentShapeIndex, CountingPointSequenceBuilder coordinates, List<Figure> figures, List<Shape> shapes) {
|
||||||
if ( geom.isEmpty() ) {
|
if ( geom.isEmpty() ) {
|
||||||
shapes.add( new Shape( parentShapeIndex, -1, this.openGisType ) );
|
shapes.add( new Shape( parentShapeIndex, -1, this.openGisType ) );
|
||||||
return;
|
return;
|
||||||
|
@ -53,8 +52,12 @@ class GeometryCollectionEncoder<T extends GeometryCollection> extends AbstractEn
|
||||||
int thisShapeIndex = shapes.size();
|
int thisShapeIndex = shapes.size();
|
||||||
Shape thisShape = createShape( parentShapeIndex, figures );
|
Shape thisShape = createShape( parentShapeIndex, figures );
|
||||||
shapes.add( thisShape );
|
shapes.add( thisShape );
|
||||||
for ( int i = 0; i < geom.getNumGeometries(); i++ ) {
|
if (! (geom instanceof GeometryCollection)) {
|
||||||
Geometry component = geom.getGeometryN( i );
|
throw new IllegalArgumentException( "Expect GeometryCollection argument." );
|
||||||
|
}
|
||||||
|
GeometryCollection gc = (GeometryCollection) geom;
|
||||||
|
for ( int i = 0; i < gc.getNumGeometries(); i++ ) {
|
||||||
|
Geometry component = gc.getGeometryN( i );
|
||||||
encodeComponent( component, thisShapeIndex, coordinates, figures, shapes );
|
encodeComponent( component, thisShapeIndex, coordinates, figures, shapes );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +67,7 @@ class GeometryCollectionEncoder<T extends GeometryCollection> extends AbstractEn
|
||||||
return thisShape;
|
return thisShape;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void encodeComponent(Geometry geom, int thisShapeIndex, List<Coordinate> coordinates, List<Figure> figures, List<Shape> shapes) {
|
protected void encodeComponent(Geometry geom, int thisShapeIndex, CountingPointSequenceBuilder coordinates, List<Figure> figures, List<Shape> shapes) {
|
||||||
AbstractEncoder<? extends Geometry> encoder = (AbstractEncoder<? extends Geometry>) Encoders.encoderFor( geom );
|
AbstractEncoder<? extends Geometry> encoder = (AbstractEncoder<? extends Geometry>) Encoders.encoderFor( geom );
|
||||||
encoder.encode( geom, thisShapeIndex, coordinates, figures, shapes );
|
encoder.encode( geom, thisShapeIndex, coordinates, figures, shapes );
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,18 +21,12 @@
|
||||||
|
|
||||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import org.geolatte.geom.LineString;
|
||||||
import com.vividsolutions.jts.geom.CoordinateSequence;
|
import org.geolatte.geom.PointSequence;
|
||||||
import com.vividsolutions.jts.geom.LineString;
|
import org.geolatte.geom.crs.CrsId;
|
||||||
|
|
||||||
import org.hibernate.spatial.jts.mgeom.MCoordinate;
|
|
||||||
import org.hibernate.spatial.jts.mgeom.MGeometryFactory;
|
|
||||||
|
|
||||||
class LineStringDecoder extends AbstractDecoder<LineString> {
|
class LineStringDecoder extends AbstractDecoder<LineString> {
|
||||||
|
|
||||||
public LineStringDecoder(MGeometryFactory factory) {
|
|
||||||
super( factory );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected OpenGisType getOpenGisType() {
|
protected OpenGisType getOpenGisType() {
|
||||||
|
@ -40,7 +34,7 @@ class LineStringDecoder extends AbstractDecoder<LineString> {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected LineString createNullGeometry() {
|
protected LineString createNullGeometry() {
|
||||||
return getGeometryFactory().createLineString( (CoordinateSequence) null );
|
return LineString.createEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected LineString createGeometry(SqlServerGeometry nativeGeom) {
|
protected LineString createGeometry(SqlServerGeometry nativeGeom) {
|
||||||
|
@ -58,19 +52,7 @@ class LineStringDecoder extends AbstractDecoder<LineString> {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected LineString createLineString(SqlServerGeometry nativeGeom, IndexRange pntIndexRange) {
|
protected LineString createLineString(SqlServerGeometry nativeGeom, IndexRange pntIndexRange) {
|
||||||
Coordinate[] coordinates = nativeGeom.coordinateRange( pntIndexRange );
|
PointSequence coordinates = nativeGeom.coordinateRange( pntIndexRange );
|
||||||
return createLineString( coordinates, nativeGeom.hasMValues() );
|
return new LineString(coordinates, CrsId.valueOf(nativeGeom.getSrid()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private LineString createLineString(Coordinate[] coords, boolean hasM) {
|
|
||||||
if ( hasM ) {
|
|
||||||
return getGeometryFactory().createMLineString( (MCoordinate[]) coords );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return getGeometryFactory().createLineString( coords );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,14 +23,17 @@ package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import org.geolatte.geom.Geometry;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.geolatte.geom.LineString;
|
||||||
import com.vividsolutions.jts.geom.LineString;
|
import org.geolatte.geom.Point;
|
||||||
|
import org.geolatte.geom.PointCollection;
|
||||||
|
import org.geolatte.geom.PointSequence;
|
||||||
|
|
||||||
|
|
||||||
class LineStringEncoder extends AbstractEncoder<LineString> {
|
class LineStringEncoder extends AbstractEncoder<LineString> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void encode(Geometry geom, int parentShapeIndex, List<Coordinate> coordinates, List<Figure> figures, List<Shape> shapes) {
|
protected void encode(Geometry geom, int parentShapeIndex, CountingPointSequenceBuilder coordinates, List<Figure> figures, List<Shape> shapes) {
|
||||||
if ( !( geom instanceof LineString ) ) {
|
if ( !( geom instanceof LineString ) ) {
|
||||||
throw new IllegalArgumentException( "Require LineString geometry" );
|
throw new IllegalArgumentException( "Require LineString geometry" );
|
||||||
}
|
}
|
||||||
|
@ -39,16 +42,16 @@ class LineStringEncoder extends AbstractEncoder<LineString> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int figureOffset = figures.size();
|
int figureOffset = figures.size();
|
||||||
int pointOffset = coordinates.size();
|
int pointOffset = coordinates.getNumAdded();
|
||||||
for ( Coordinate coordinate : geom.getCoordinates() ) {
|
for ( Point point : (PointSequence)geom.getPoints() ) {
|
||||||
coordinates.add( coordinate );
|
coordinates.add( point );
|
||||||
}
|
}
|
||||||
figures.add( new Figure( FigureAttribute.Stroke, pointOffset ) );
|
figures.add( new Figure( FigureAttribute.Stroke, pointOffset ) );
|
||||||
shapes.add( new Shape( parentShapeIndex, figureOffset, OpenGisType.LINESTRING ) );
|
shapes.add( new Shape( parentShapeIndex, figureOffset, OpenGisType.LINESTRING ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void encodePoints(SqlServerGeometry nativeGeom, List<Coordinate> coordinates) {
|
protected void encodePoints(SqlServerGeometry nativeGeom, PointCollection coordinates) {
|
||||||
super.encodePoints( nativeGeom, coordinates );
|
super.encodePoints( nativeGeom, coordinates );
|
||||||
if ( coordinates.size() == 2 ) {
|
if ( coordinates.size() == 2 ) {
|
||||||
nativeGeom.setIsSingleLineSegment();
|
nativeGeom.setIsSingleLineSegment();
|
||||||
|
|
|
@ -23,19 +23,13 @@ package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.geolatte.geom.Geometry;
|
||||||
import com.vividsolutions.jts.geom.LineString;
|
import org.geolatte.geom.LineString;
|
||||||
import com.vividsolutions.jts.geom.MultiLineString;
|
import org.geolatte.geom.MultiLineString;
|
||||||
|
|
||||||
import org.hibernate.spatial.jts.mgeom.MGeometryFactory;
|
|
||||||
import org.hibernate.spatial.jts.mgeom.MLineString;
|
|
||||||
|
|
||||||
class MultiLineStringDecoder extends AbstractGeometryCollectionDecoder<MultiLineString> {
|
class MultiLineStringDecoder extends AbstractGeometryCollectionDecoder<MultiLineString> {
|
||||||
|
|
||||||
public MultiLineStringDecoder(MGeometryFactory factory) {
|
|
||||||
super( factory );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected OpenGisType getOpenGisType() {
|
protected OpenGisType getOpenGisType() {
|
||||||
return OpenGisType.MULTILINESTRING;
|
return OpenGisType.MULTILINESTRING;
|
||||||
|
@ -44,12 +38,8 @@ class MultiLineStringDecoder extends AbstractGeometryCollectionDecoder<MultiLine
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected MultiLineString createGeometry(List<Geometry> geometries, boolean hasM) {
|
protected MultiLineString createGeometry(List<Geometry> geometries, boolean hasM) {
|
||||||
if ( hasM ) {
|
|
||||||
MLineString[] mlAr = geometries != null ? geometries.toArray( new MLineString[geometries.size()] ) : null;
|
|
||||||
return getGeometryFactory().createMultiMLineString( mlAr );
|
|
||||||
}
|
|
||||||
LineString[] lAr = geometries != null ? geometries.toArray( new LineString[geometries.size()] ) : null;
|
LineString[] lAr = geometries != null ? geometries.toArray( new LineString[geometries.size()] ) : null;
|
||||||
return getGeometryFactory().createMultiLineString( lAr );
|
return new MultiLineString( lAr );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,11 +23,9 @@ package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.geolatte.geom.Geometry;
|
||||||
import com.vividsolutions.jts.geom.MultiPoint;
|
import org.geolatte.geom.MultiPoint;
|
||||||
import com.vividsolutions.jts.geom.Point;
|
import org.geolatte.geom.Point;
|
||||||
|
|
||||||
import org.hibernate.spatial.jts.mgeom.MGeometryFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>Decoder</code> for GeometryCollections.
|
* <code>Decoder</code> for GeometryCollections.
|
||||||
|
@ -37,11 +35,6 @@ import org.hibernate.spatial.jts.mgeom.MGeometryFactory;
|
||||||
|
|
||||||
class MultiPointDecoder extends AbstractGeometryCollectionDecoder<MultiPoint> {
|
class MultiPointDecoder extends AbstractGeometryCollectionDecoder<MultiPoint> {
|
||||||
|
|
||||||
public MultiPointDecoder(MGeometryFactory factory) {
|
|
||||||
super( factory );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected OpenGisType getOpenGisType() {
|
protected OpenGisType getOpenGisType() {
|
||||||
return OpenGisType.MULTIPOINT;
|
return OpenGisType.MULTIPOINT;
|
||||||
|
@ -50,7 +43,7 @@ class MultiPointDecoder extends AbstractGeometryCollectionDecoder<MultiPoint> {
|
||||||
@Override
|
@Override
|
||||||
protected MultiPoint createGeometry(List<Geometry> geometries, boolean hasM) {
|
protected MultiPoint createGeometry(List<Geometry> geometries, boolean hasM) {
|
||||||
Point[] points = geometries != null ? geometries.toArray( new Point[geometries.size()] ) : null;
|
Point[] points = geometries != null ? geometries.toArray( new Point[geometries.size()] ) : null;
|
||||||
return getGeometryFactory().createMultiPoint( points );
|
return new MultiPoint( points );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of Hibernate Spatial, an extension to the
|
|
||||||
* hibernate ORM solution for spatial (geographic) data.
|
|
||||||
*
|
|
||||||
* Copyright © 2007-2012 Geovise BVBA
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
|
||||||
import com.vividsolutions.jts.geom.MultiPoint;
|
|
||||||
|
|
||||||
import org.hibernate.spatial.jts.mgeom.MCoordinate;
|
|
||||||
|
|
||||||
|
|
||||||
class MultiPointEncoder extends GeometryCollectionEncoder<MultiPoint> {
|
|
||||||
|
|
||||||
public MultiPointEncoder() {
|
|
||||||
super( OpenGisType.MULTIPOINT );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean hasMValues(MultiPoint geom) {
|
|
||||||
for ( Coordinate c : geom.getCoordinates() ) {
|
|
||||||
if ( !( c instanceof MCoordinate ) ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ( !Double.isNaN( ( (MCoordinate) c ).m ) ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -23,19 +23,12 @@ package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.geolatte.geom.Geometry;
|
||||||
import com.vividsolutions.jts.geom.MultiPolygon;
|
import org.geolatte.geom.MultiPolygon;
|
||||||
import com.vividsolutions.jts.geom.Polygon;
|
import org.geolatte.geom.Polygon;
|
||||||
|
|
||||||
import org.hibernate.spatial.jts.mgeom.MGeometryFactory;
|
|
||||||
|
|
||||||
class MultiPolygonDecoder extends AbstractGeometryCollectionDecoder<MultiPolygon> {
|
class MultiPolygonDecoder extends AbstractGeometryCollectionDecoder<MultiPolygon> {
|
||||||
|
|
||||||
public MultiPolygonDecoder(MGeometryFactory factory) {
|
|
||||||
super( factory );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected OpenGisType getOpenGisType() {
|
protected OpenGisType getOpenGisType() {
|
||||||
return OpenGisType.MULTIPOLYGON;
|
return OpenGisType.MULTIPOLYGON;
|
||||||
|
@ -44,7 +37,7 @@ class MultiPolygonDecoder extends AbstractGeometryCollectionDecoder<MultiPolygon
|
||||||
@Override
|
@Override
|
||||||
protected MultiPolygon createGeometry(List<Geometry> geometries, boolean hasM) {
|
protected MultiPolygon createGeometry(List<Geometry> geometries, boolean hasM) {
|
||||||
Polygon[] polygons = geometries != null ? geometries.toArray( new Polygon[geometries.size()] ) : null;
|
Polygon[] polygons = geometries != null ? geometries.toArray( new Polygon[geometries.size()] ) : null;
|
||||||
return getGeometryFactory().createMultiPolygon( polygons );
|
return new MultiPolygon( polygons );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,13 +21,14 @@
|
||||||
|
|
||||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.GeometryCollection;
|
|
||||||
import com.vividsolutions.jts.geom.LineString;
|
import org.geolatte.geom.GeometryCollection;
|
||||||
import com.vividsolutions.jts.geom.MultiLineString;
|
import org.geolatte.geom.LineString;
|
||||||
import com.vividsolutions.jts.geom.MultiPoint;
|
import org.geolatte.geom.MultiLineString;
|
||||||
import com.vividsolutions.jts.geom.MultiPolygon;
|
import org.geolatte.geom.MultiPoint;
|
||||||
import com.vividsolutions.jts.geom.Point;
|
import org.geolatte.geom.MultiPolygon;
|
||||||
import com.vividsolutions.jts.geom.Polygon;
|
import org.geolatte.geom.Point;
|
||||||
|
import org.geolatte.geom.Polygon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of geometry.
|
* The type of geometry.
|
||||||
|
|
|
@ -21,10 +21,11 @@
|
||||||
|
|
||||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
|
||||||
import com.vividsolutions.jts.geom.Point;
|
|
||||||
|
|
||||||
import org.hibernate.spatial.jts.mgeom.MGeometryFactory;
|
import org.geolatte.geom.DimensionalFlag;
|
||||||
|
import org.geolatte.geom.Point;
|
||||||
|
import org.geolatte.geom.PointSequence;
|
||||||
|
import org.geolatte.geom.crs.CrsId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Karel Maesen, Geovise BVBA.
|
* @author Karel Maesen, Geovise BVBA.
|
||||||
|
@ -32,9 +33,6 @@ import org.hibernate.spatial.jts.mgeom.MGeometryFactory;
|
||||||
*/
|
*/
|
||||||
class PointDecoder extends AbstractDecoder<Point> {
|
class PointDecoder extends AbstractDecoder<Point> {
|
||||||
|
|
||||||
public PointDecoder(MGeometryFactory factory) {
|
|
||||||
super( factory );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected OpenGisType getOpenGisType() {
|
protected OpenGisType getOpenGisType() {
|
||||||
|
@ -42,7 +40,7 @@ class PointDecoder extends AbstractDecoder<Point> {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Point createNullGeometry() {
|
protected Point createNullGeometry() {
|
||||||
return getGeometryFactory().createPoint( (Coordinate) null );
|
return Point.createEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Point createGeometry(SqlServerGeometry nativeGeom) {
|
protected Point createGeometry(SqlServerGeometry nativeGeom) {
|
||||||
|
@ -60,8 +58,10 @@ class PointDecoder extends AbstractDecoder<Point> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Point createPoint(SqlServerGeometry nativeGeom, int pntOffset) {
|
private Point createPoint(SqlServerGeometry nativeGeom, int pntOffset) {
|
||||||
return getGeometryFactory().createPoint( nativeGeom.getCoordinate( pntOffset ) );
|
DimensionalFlag df = DimensionalFlag.valueOf(nativeGeom.hasZValues(), nativeGeom.hasMValues());
|
||||||
}
|
PointSequence pointSequence = nativeGeom.coordinateRange(new IndexRange(pntOffset, pntOffset + 1));
|
||||||
|
return new Point(pointSequence, CrsId.valueOf(nativeGeom.getSrid()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,11 +23,9 @@ package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import org.geolatte.geom.Geometry;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.geolatte.geom.Point;
|
||||||
import com.vividsolutions.jts.geom.Point;
|
|
||||||
|
|
||||||
import org.hibernate.spatial.jts.mgeom.MCoordinate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Karel Maesen, Geovise BVBA.
|
* @author Karel Maesen, Geovise BVBA.
|
||||||
|
@ -48,7 +46,8 @@ class PointEncoder extends AbstractEncoder<Point> {
|
||||||
public SqlServerGeometry encode(Point geom) {
|
public SqlServerGeometry encode(Point geom) {
|
||||||
|
|
||||||
SqlServerGeometry sqlServerGeom = new SqlServerGeometry();
|
SqlServerGeometry sqlServerGeom = new SqlServerGeometry();
|
||||||
sqlServerGeom.setSrid( geom.getSRID() );
|
int srid = geom.getSRID();
|
||||||
|
sqlServerGeom.setSrid( srid < 0 ? 0 : srid );
|
||||||
sqlServerGeom.setIsValid();
|
sqlServerGeom.setIsValid();
|
||||||
|
|
||||||
if ( geom.isEmpty() ) {
|
if ( geom.isEmpty() ) {
|
||||||
|
@ -61,21 +60,20 @@ class PointEncoder extends AbstractEncoder<Point> {
|
||||||
|
|
||||||
sqlServerGeom.setIsSinglePoint();
|
sqlServerGeom.setIsSinglePoint();
|
||||||
sqlServerGeom.setNumberOfPoints( 1 );
|
sqlServerGeom.setNumberOfPoints( 1 );
|
||||||
Coordinate coordinate = geom.getCoordinate();
|
if ( geom.is3D() ) {
|
||||||
if ( is3DPoint( coordinate ) ) {
|
|
||||||
sqlServerGeom.setHasZValues();
|
sqlServerGeom.setHasZValues();
|
||||||
sqlServerGeom.allocateZValueArray();
|
sqlServerGeom.allocateZValueArray();
|
||||||
}
|
}
|
||||||
if ( isMPoint( coordinate ) ) {
|
if ( geom.isMeasured() ) {
|
||||||
sqlServerGeom.setHasMValues();
|
sqlServerGeom.setHasMValues();
|
||||||
sqlServerGeom.allocateMValueArray();
|
sqlServerGeom.allocateMValueArray();
|
||||||
}
|
}
|
||||||
sqlServerGeom.setCoordinate( 0, coordinate );
|
sqlServerGeom.setCoordinate( 0, geom.getPoints() );
|
||||||
return sqlServerGeom;
|
return sqlServerGeom;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void encode(Geometry geom, int parentIdx, List<Coordinate> coordinates, List<Figure> figures, List<Shape> shapes) {
|
protected void encode(Geometry geom, int parentIdx, CountingPointSequenceBuilder coordinates, List<Figure> figures, List<Shape> shapes) {
|
||||||
if ( !( geom instanceof Point ) ) {
|
if ( !( geom instanceof Point ) ) {
|
||||||
throw new IllegalArgumentException( "Require Point geometry" );
|
throw new IllegalArgumentException( "Require Point geometry" );
|
||||||
}
|
}
|
||||||
|
@ -83,24 +81,15 @@ class PointEncoder extends AbstractEncoder<Point> {
|
||||||
shapes.add( new Shape( parentIdx, -1, OpenGisType.POINT ) );
|
shapes.add( new Shape( parentIdx, -1, OpenGisType.POINT ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int pntOffset = coordinates.size();
|
int pntOffset = coordinates.getNumAdded();
|
||||||
int figureOffset = figures.size();
|
int figureOffset = figures.size();
|
||||||
coordinates.add( geom.getCoordinate() );
|
coordinates.add( geom.getPointN(0) );
|
||||||
Figure figure = new Figure( FigureAttribute.Stroke, pntOffset );
|
Figure figure = new Figure( FigureAttribute.Stroke, pntOffset );
|
||||||
figures.add( figure );
|
figures.add( figure );
|
||||||
Shape shape = new Shape( parentIdx, figureOffset, OpenGisType.POINT );
|
Shape shape = new Shape( parentIdx, figureOffset, OpenGisType.POINT );
|
||||||
shapes.add( shape );
|
shapes.add( shape );
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isMPoint(Coordinate coordinate) {
|
|
||||||
return ( coordinate instanceof MCoordinate ) &&
|
|
||||||
!Double.isNaN( ( (MCoordinate) coordinate ).m );
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean is3DPoint(Coordinate coordinate) {
|
|
||||||
return !Double.isNaN( coordinate.z );
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean accepts(Geometry geom) {
|
public boolean accepts(Geometry geom) {
|
||||||
return geom instanceof Point;
|
return geom instanceof Point;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,29 +21,24 @@
|
||||||
|
|
||||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import org.geolatte.geom.LinearRing;
|
||||||
import com.vividsolutions.jts.geom.LinearRing;
|
import org.geolatte.geom.PointSequence;
|
||||||
import com.vividsolutions.jts.geom.Polygon;
|
import org.geolatte.geom.Polygon;
|
||||||
|
import org.geolatte.geom.crs.CrsId;
|
||||||
import org.hibernate.spatial.jts.mgeom.MGeometryFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Karel Maesen, Geovise BVBA
|
* @author Karel Maesen, Geovise BVBA
|
||||||
*/
|
*/
|
||||||
class PolygonDecoder extends AbstractDecoder<Polygon> {
|
class PolygonDecoder extends AbstractDecoder<Polygon> {
|
||||||
|
|
||||||
public PolygonDecoder(MGeometryFactory factory) {
|
|
||||||
super( factory );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected OpenGisType getOpenGisType() {
|
protected OpenGisType getOpenGisType() {
|
||||||
return OpenGisType.POLYGON;
|
return OpenGisType.POLYGON;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Polygon createNullGeometry() {
|
protected Polygon createNullGeometry() {
|
||||||
return getGeometryFactory().createPolygon( null, null );
|
return Polygon.createEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Polygon createGeometry(SqlServerGeometry nativeGeom) {
|
protected Polygon createGeometry(SqlServerGeometry nativeGeom) {
|
||||||
return createGeometry( nativeGeom, 0 );
|
return createGeometry( nativeGeom, 0 );
|
||||||
|
@ -55,23 +50,24 @@ class PolygonDecoder extends AbstractDecoder<Polygon> {
|
||||||
}
|
}
|
||||||
//polygons consist of one exterior ring figure, and several interior ones.
|
//polygons consist of one exterior ring figure, and several interior ones.
|
||||||
IndexRange figureRange = nativeGeom.getFiguresForShape( shapeIndex );
|
IndexRange figureRange = nativeGeom.getFiguresForShape( shapeIndex );
|
||||||
LinearRing[] holes = new LinearRing[figureRange.length() - 1];
|
LinearRing[] rings = new LinearRing[figureRange.length()];
|
||||||
LinearRing shell = null;
|
//the rings should contain all inner rings from index 1 to index length - 1
|
||||||
for ( int figureIdx = figureRange.start, i = 0; figureIdx < figureRange.end; figureIdx++ ) {
|
// index = 0 should be reserved for the shell.
|
||||||
|
for ( int figureIdx = figureRange.start, i = 1; figureIdx < figureRange.end; figureIdx++ ) {
|
||||||
IndexRange pntIndexRange = nativeGeom.getPointsForFigure( figureIdx );
|
IndexRange pntIndexRange = nativeGeom.getPointsForFigure( figureIdx );
|
||||||
if ( nativeGeom.isFigureInteriorRing( figureIdx ) ) {
|
if ( nativeGeom.isFigureInteriorRing( figureIdx ) ) {
|
||||||
holes[i++] = toLinearRing( nativeGeom, pntIndexRange );
|
rings[i++] = toLinearRing( nativeGeom, pntIndexRange );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
shell = toLinearRing( nativeGeom, pntIndexRange );
|
rings[0] = toLinearRing( nativeGeom, pntIndexRange );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return getGeometryFactory().createPolygon( shell, holes );
|
return new Polygon(rings);
|
||||||
}
|
}
|
||||||
|
|
||||||
private LinearRing toLinearRing(SqlServerGeometry nativeGeom, IndexRange range) {
|
private LinearRing toLinearRing(SqlServerGeometry nativeGeom, IndexRange range) {
|
||||||
Coordinate[] coordinates = nativeGeom.coordinateRange( range );
|
PointSequence pointSequence = nativeGeom.coordinateRange(range);
|
||||||
return getGeometryFactory().createLinearRing( coordinates );
|
return new LinearRing(pointSequence, CrsId.valueOf(nativeGeom.getSrid()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,12 +21,9 @@
|
||||||
|
|
||||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||||
|
|
||||||
import java.util.List;
|
import org.geolatte.geom.*;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import java.util.List;
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
|
||||||
import com.vividsolutions.jts.geom.LineString;
|
|
||||||
import com.vividsolutions.jts.geom.Polygon;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <code>Encoder</code> for Polygons.
|
* <code>Encoder</code> for Polygons.
|
||||||
|
@ -40,7 +37,7 @@ class PolygonEncoder extends AbstractEncoder<Polygon> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void encode(Geometry geom, int parentShapeIndex, List<Coordinate> coordinates, List<Figure> figures, List<Shape> shapes) {
|
protected void encode(Geometry geom, int parentShapeIndex, CountingPointSequenceBuilder coordinates, List<Figure> figures, List<Shape> shapes) {
|
||||||
if ( !( geom instanceof Polygon ) ) {
|
if ( !( geom instanceof Polygon ) ) {
|
||||||
throw new IllegalArgumentException( "Polygon geometry expected." );
|
throw new IllegalArgumentException( "Polygon geometry expected." );
|
||||||
}
|
}
|
||||||
|
@ -52,36 +49,36 @@ class PolygonEncoder extends AbstractEncoder<Polygon> {
|
||||||
int figureOffset = figures.size();
|
int figureOffset = figures.size();
|
||||||
shapes.add( new Shape( parentShapeIndex, figureOffset, OpenGisType.POLYGON ) );
|
shapes.add( new Shape( parentShapeIndex, figureOffset, OpenGisType.POLYGON ) );
|
||||||
|
|
||||||
int pointOffset = coordinates.size();
|
int pointOffset = coordinates.getNumAdded();
|
||||||
addExteriorRing( polygon, coordinates, figures );
|
addExteriorRing( polygon, coordinates, figures );
|
||||||
addInteriorRings( polygon, coordinates, figures );
|
addInteriorRings( polygon, coordinates, figures );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void addInteriorRings(Polygon geom, List<Coordinate> coordinates, List<Figure> figures) {
|
private void addInteriorRings(Polygon geom, CountingPointSequenceBuilder coordinates, List<Figure> figures) {
|
||||||
for ( int idx = 0; idx < geom.getNumInteriorRing(); idx++ ) {
|
for ( int idx = 0; idx < geom.getNumInteriorRing(); idx++ ) {
|
||||||
addInteriorRing( geom.getInteriorRingN( idx ), coordinates, figures );
|
addInteriorRing( geom.getInteriorRingN( idx ), coordinates, figures );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addInteriorRing(LineString ring, List<Coordinate> coordinates, List<Figure> figures) {
|
private void addInteriorRing(LineString ring,CountingPointSequenceBuilder coordinates, List<Figure> figures) {
|
||||||
int pointOffset = coordinates.size();
|
int pointOffset = coordinates.getNumAdded();
|
||||||
addPoints( ring, coordinates );
|
addPoints( ring, coordinates );
|
||||||
Figure figure = new Figure( FigureAttribute.InteriorRing, pointOffset );
|
Figure figure = new Figure( FigureAttribute.InteriorRing, pointOffset );
|
||||||
figures.add( figure );
|
figures.add( figure );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPoints(LineString ring, List<Coordinate> coordinates) {
|
private void addPoints(LineString ring, CountingPointSequenceBuilder coordinates) {
|
||||||
for ( Coordinate c : ring.getCoordinates() ) {
|
for ( Point c : ring.getPoints() ) {
|
||||||
coordinates.add( c );
|
coordinates.add( c );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addExteriorRing(Polygon geom, List<Coordinate> coordinates, List<Figure> figures) {
|
private void addExteriorRing(Polygon geom, CountingPointSequenceBuilder coordinates, List<Figure> figures) {
|
||||||
LineString shell = geom.getExteriorRing();
|
LineString shell = geom.getExteriorRing();
|
||||||
int offset = coordinates.size();
|
int offset = coordinates.getNumAdded();
|
||||||
addPoints( shell, coordinates );
|
addPoints( shell, coordinates );
|
||||||
Figure exterior = new Figure( FigureAttribute.ExteriorRing, offset );
|
Figure exterior = new Figure( FigureAttribute.ExteriorRing, offset );
|
||||||
figures.add( exterior );
|
figures.add( exterior );
|
||||||
|
|
|
@ -25,6 +25,11 @@ import java.nio.ByteBuffer;
|
||||||
import java.nio.ByteOrder;
|
import java.nio.ByteOrder;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
import org.geolatte.geom.DimensionalFlag;
|
||||||
|
import org.geolatte.geom.PointCollection;
|
||||||
|
import org.geolatte.geom.PointSequence;
|
||||||
|
import org.geolatte.geom.PointSequenceBuilder;
|
||||||
|
import org.geolatte.geom.PointSequenceBuilders;
|
||||||
|
|
||||||
import org.hibernate.spatial.jts.mgeom.MCoordinate;
|
import org.hibernate.spatial.jts.mgeom.MCoordinate;
|
||||||
|
|
||||||
|
@ -117,22 +122,18 @@ public class SqlServerGeometry {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Coordinate getCoordinate(int index) {
|
void copyCoordinate(int index, double[] coords, DimensionalFlag df) {
|
||||||
Coordinate coordinate;
|
coords[0] = points[2 * index];
|
||||||
if ( hasMValues() ) {
|
coords[1] = points[2 * index + 1];
|
||||||
coordinate = new MCoordinate();
|
if (hasZValues()) {
|
||||||
( (MCoordinate) coordinate ).m = mValues[index];
|
assert(df.is3D());
|
||||||
}
|
coords[df.Z] = zValues[index];
|
||||||
else {
|
}
|
||||||
coordinate = new Coordinate();
|
if (hasMValues()) {
|
||||||
}
|
assert (df.isMeasured());
|
||||||
coordinate.x = points[2 * index];
|
coords[df.M] = mValues[index];
|
||||||
coordinate.y = points[2 * index + 1];
|
}
|
||||||
if ( hasZValues() ) {
|
}
|
||||||
coordinate.z = zValues[index];
|
|
||||||
}
|
|
||||||
return coordinate;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean isParentShapeOf(int parent, int child) {
|
boolean isParentShapeOf(int parent, int child) {
|
||||||
return getShape( child ).parentOffset == parent;
|
return getShape( child ).parentOffset == parent;
|
||||||
|
@ -186,13 +187,16 @@ public class SqlServerGeometry {
|
||||||
return getShape( shpIdx ).openGisType;
|
return getShape( shpIdx ).openGisType;
|
||||||
}
|
}
|
||||||
|
|
||||||
Coordinate[] coordinateRange(IndexRange range) {
|
PointSequence coordinateRange(IndexRange range) {
|
||||||
Coordinate[] coordinates = createCoordinateArray( range.end - range.start );
|
DimensionalFlag df = DimensionalFlag.valueOf(hasZValues(), hasMValues());
|
||||||
for ( int idx = range.start, i = 0; idx < range.end; idx++, i++ ) {
|
PointSequenceBuilder psBuilder = PointSequenceBuilders.fixedSized(range.end - range.start, df);
|
||||||
coordinates[i] = getCoordinate( idx );
|
double[] coordinates = new double[df.getCoordinateDimension()];
|
||||||
}
|
for (int idx = range.start, i = 0; idx < range.end; idx++, i++) {
|
||||||
return coordinates;
|
copyCoordinate(idx, coordinates, df);
|
||||||
}
|
psBuilder.add(coordinates);
|
||||||
|
}
|
||||||
|
return psBuilder.toPointSequence();
|
||||||
|
}
|
||||||
|
|
||||||
private Coordinate[] createCoordinateArray(int size) {
|
private Coordinate[] createCoordinateArray(int size) {
|
||||||
if ( hasMValues() ) {
|
if ( hasMValues() ) {
|
||||||
|
@ -212,14 +216,14 @@ public class SqlServerGeometry {
|
||||||
return shapes[index];
|
return shapes[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
void setCoordinate(int index, Coordinate coordinate) {
|
void setCoordinate(int index, PointCollection coordinate) {
|
||||||
points[2 * index] = coordinate.x;
|
points[2 * index] = coordinate.getX(index);
|
||||||
points[2 * index + 1] = coordinate.y;
|
points[2 * index + 1] = coordinate.getY(index);
|
||||||
if ( hasZValues() ) {
|
if ( hasZValues() ) {
|
||||||
zValues[index] = coordinate.z;
|
zValues[index] = coordinate.getZ(index);
|
||||||
}
|
}
|
||||||
if ( hasMValues() ) {
|
if ( hasMValues() ) {
|
||||||
mValues[index] = ( (MCoordinate) coordinate ).m;
|
mValues[index] = coordinate.getM(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,10 @@ import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import org.geolatte.geom.Geometry;
|
||||||
|
import org.geolatte.geom.PointCollection;
|
||||||
|
import org.geolatte.geom.PointCollectionEquality;
|
||||||
|
import org.geolatte.geom.PointCollectionPointEquality;
|
||||||
|
|
||||||
import org.hibernate.spatial.Log;
|
import org.hibernate.spatial.Log;
|
||||||
import org.hibernate.spatial.LogFactory;
|
import org.hibernate.spatial.LogFactory;
|
||||||
|
@ -41,6 +44,7 @@ import org.hibernate.spatial.testing.TestData;
|
||||||
import org.hibernate.spatial.testing.TestSupport;
|
import org.hibernate.spatial.testing.TestSupport;
|
||||||
import org.hibernate.spatial.testing.dialects.sqlserver.SQLServerExpressionTemplate;
|
import org.hibernate.spatial.testing.dialects.sqlserver.SQLServerExpressionTemplate;
|
||||||
import org.hibernate.spatial.testing.dialects.sqlserver.SQLServerTestSupport;
|
import org.hibernate.spatial.testing.dialects.sqlserver.SQLServerTestSupport;
|
||||||
|
import org.hibernate.testing.AfterClassOnce;
|
||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
@ -54,7 +58,8 @@ public abstract class AbstractConvertorTest extends SpatialFunctionalTestCase {
|
||||||
|
|
||||||
private final static TestSupport support = new SQLServerTestSupport();
|
private final static TestSupport support = new SQLServerTestSupport();
|
||||||
|
|
||||||
private DataSourceUtils dataSourceUtils;
|
protected PointCollectionEquality pointCollectionEquality = new PointCollectionPointEquality();
|
||||||
|
|
||||||
|
|
||||||
Map<Integer, Geometry> decodedGeoms;
|
Map<Integer, Geometry> decodedGeoms;
|
||||||
Map<Integer, Object> rawResults;
|
Map<Integer, Object> rawResults;
|
||||||
|
@ -79,17 +84,6 @@ public abstract class AbstractConvertorTest extends SpatialFunctionalTestCase {
|
||||||
throw new RuntimeException( e );
|
throw new RuntimeException( e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// public void afterClass() {
|
|
||||||
// try {
|
|
||||||
// String sql = dataSourceUtils.parseSqlIn("sqlserver/drop-sqlserver-test-schema.sql");
|
|
||||||
// dataSourceUtils.executeStatement(sql);
|
|
||||||
// } catch (SQLException e) {
|
|
||||||
// throw new RuntimeException(e);
|
|
||||||
// } catch (IOException e) {
|
|
||||||
// throw new RuntimeException(e);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
public void doDecoding(OpenGisType type) {
|
public void doDecoding(OpenGisType type) {
|
||||||
rawResults = dataSourceUtils.rawDbObjects( type.toString() );
|
rawResults = dataSourceUtils.rawDbObjects( type.toString() );
|
||||||
|
@ -107,7 +101,7 @@ public abstract class AbstractConvertorTest extends SpatialFunctionalTestCase {
|
||||||
encodedGeoms = new HashMap<Integer, byte[]>();
|
encodedGeoms = new HashMap<Integer, byte[]>();
|
||||||
for ( Integer id : decodedGeoms.keySet() ) {
|
for ( Integer id : decodedGeoms.keySet() ) {
|
||||||
Geometry geom = decodedGeoms.get( id );
|
Geometry geom = decodedGeoms.get( id );
|
||||||
byte[] bytes = Encoders.encode( geom );
|
byte[] bytes = Encoders.encode(geom);
|
||||||
encodedGeoms.put( id, bytes );
|
encodedGeoms.put( id, bytes );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,10 +119,31 @@ public abstract class AbstractConvertorTest extends SpatialFunctionalTestCase {
|
||||||
for ( Integer id : decodedGeoms.keySet() ) {
|
for ( Integer id : decodedGeoms.keySet() ) {
|
||||||
Geometry expected = expectedGeoms.get( id );
|
Geometry expected = expectedGeoms.get( id );
|
||||||
Geometry received = decodedGeoms.get( id );
|
Geometry received = decodedGeoms.get( id );
|
||||||
assertTrue( "Wrong decoding for case " + id, expected.equalsExact( received ) );
|
assertTrue( "Wrong decoding for case " + id, expected.equals( received ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AfterClassOnce
|
||||||
|
public void afterClassOnce(){
|
||||||
|
try {
|
||||||
|
String sql = dataSourceUtils.parseSqlIn( "sqlserver/drop-sqlserver-test-schema.sql" );
|
||||||
|
dataSourceUtils.executeStatement( sql );
|
||||||
|
}
|
||||||
|
catch ( SQLException e ) {
|
||||||
|
throw new RuntimeException( e );
|
||||||
|
}
|
||||||
|
catch ( IOException e ) {
|
||||||
|
throw new RuntimeException( e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void prepareTest() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void assertPointCollectionEquality(PointCollection received, PointCollection expected) {
|
||||||
|
assertTrue( pointCollectionEquality.equals( received, expected ));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Log getLogger() {
|
protected Log getLogger() {
|
||||||
return LOG;
|
return LOG;
|
||||||
|
|
|
@ -21,17 +21,18 @@
|
||||||
|
|
||||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
|
||||||
import com.vividsolutions.jts.geom.LineString;
|
import org.geolatte.geom.DimensionalFlag;
|
||||||
|
import org.geolatte.geom.LineString;
|
||||||
|
import org.geolatte.geom.PointCollection;
|
||||||
|
import org.geolatte.geom.PointSequenceBuilders;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDialect;
|
import org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDialect;
|
||||||
import org.hibernate.spatial.jts.mgeom.MCoordinate;
|
|
||||||
import org.hibernate.testing.BeforeClassOnce;
|
import org.hibernate.testing.BeforeClassOnce;
|
||||||
import org.hibernate.testing.RequiresDialect;
|
import org.hibernate.testing.RequiresDialect;
|
||||||
|
|
||||||
import static junit.framework.Assert.assertEquals;
|
import static junit.framework.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertArrayEquals;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
@RequiresDialect(SqlServer2008SpatialDialect.class)
|
@RequiresDialect(SqlServer2008SpatialDialect.class)
|
||||||
|
@ -65,53 +66,28 @@ public class LineStringConvertorTest extends AbstractConvertorTest {
|
||||||
@Test
|
@Test
|
||||||
public void test_coordinates() {
|
public void test_coordinates() {
|
||||||
|
|
||||||
Coordinate[] received = decodedGeoms.get( 5 ).getCoordinates();
|
PointCollection received = decodedGeoms.get( 5 ).getPoints();
|
||||||
MCoordinate[] expected = new MCoordinate[] {
|
PointCollection expected = PointSequenceBuilders.fixedSized( 2, DimensionalFlag.XY ).add(10, 5).add(20,15).toPointSequence();
|
||||||
new MCoordinate( 10.0, 5.0 ),
|
assertPointCollectionEquality( received, expected );
|
||||||
new MCoordinate( 20.0, 15.0 )
|
|
||||||
};
|
|
||||||
assertArrayEquals( received, expected );
|
|
||||||
|
|
||||||
received = decodedGeoms.get( 6 ).getCoordinates();
|
received = decodedGeoms.get( 6 ).getPoints();
|
||||||
expected = new MCoordinate[] {
|
expected = PointSequenceBuilders.fixedSized( 4, DimensionalFlag.XY).add(10,5).add(20,15).add(30.3, 22.4).add(10,30).toPointSequence();
|
||||||
new MCoordinate( 10.0, 5.0 ),
|
assertPointCollectionEquality( received, expected );
|
||||||
new MCoordinate( 20.0, 15.0 ),
|
|
||||||
new MCoordinate( 30.3, 22.4 ),
|
|
||||||
new MCoordinate( 10.0, 30.0 )
|
|
||||||
};
|
|
||||||
assertArrayEquals( expected, received );
|
|
||||||
|
|
||||||
received = decodedGeoms.get( 7 ).getCoordinates();
|
|
||||||
expected = new MCoordinate[] {
|
received = decodedGeoms.get( 7 ).getPoints();
|
||||||
new MCoordinate( 10.0, 5.0 ),
|
expected = PointSequenceBuilders.fixedSized( 2, DimensionalFlag.XYZ).add(10,5,0).add(20,15,3).toPointSequence();
|
||||||
new MCoordinate( 20.0, 15.0 )
|
assertPointCollectionEquality( received, expected );
|
||||||
};
|
|
||||||
expected[0].z = 0;
|
|
||||||
expected[1].z = 3;
|
|
||||||
assertArrayEquals( expected, received );
|
|
||||||
|
|
||||||
//case 9
|
//case 9
|
||||||
received = decodedGeoms.get( 9 ).getCoordinates();
|
received = decodedGeoms.get( 9 ).getPoints();
|
||||||
expected = new MCoordinate[] {
|
expected = PointSequenceBuilders.fixedSized( 4, DimensionalFlag.XYZ).add(10,5,1).add(20,15,2).add(30.3, 22.4,5).add(10,30,2).toPointSequence();
|
||||||
new MCoordinate( 10, 5 ),
|
assertPointCollectionEquality( received, expected );
|
||||||
new MCoordinate( 20, 15 ),
|
|
||||||
new MCoordinate( 30.3, 22.4 ),
|
|
||||||
new MCoordinate( 10, 30 )
|
|
||||||
};
|
|
||||||
expected[0].z = 1;
|
|
||||||
expected[1].z = 2;
|
|
||||||
expected[2].z = 5;
|
|
||||||
expected[3].z = 2;
|
|
||||||
assertArrayEquals( expected, received );
|
|
||||||
|
|
||||||
//case 10
|
//case 10
|
||||||
received = decodedGeoms.get( 10 ).getCoordinates();
|
received = decodedGeoms.get( 10 ).getPoints();
|
||||||
expected[0].m = 1;
|
expected = PointSequenceBuilders.fixedSized( 4, DimensionalFlag.XYZM).add(10,5,1,1).add(20,15,2,3).add(30.3, 22.4,5,10).add(10,30,2,12).toPointSequence();
|
||||||
expected[1].m = 3;
|
assertPointCollectionEquality( received, expected );
|
||||||
expected[2].m = 10;
|
|
||||||
expected[3].m = 12;
|
|
||||||
assertArrayEquals( expected, received );
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,12 +21,12 @@
|
||||||
|
|
||||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import org.geolatte.geom.Point;
|
||||||
import com.vividsolutions.jts.geom.Point;
|
import org.geolatte.geom.Points;
|
||||||
|
import org.geolatte.geom.crs.CrsId;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDialect;
|
import org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDialect;
|
||||||
import org.hibernate.spatial.jts.mgeom.MCoordinate;
|
|
||||||
import org.hibernate.testing.BeforeClassOnce;
|
import org.hibernate.testing.BeforeClassOnce;
|
||||||
import org.hibernate.testing.RequiresDialect;
|
import org.hibernate.testing.RequiresDialect;
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class PointConvertorTest extends AbstractConvertorTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_verify_srid() {
|
public void test_verify_srid() {
|
||||||
assertEquals( 0, decodedGeoms.get( 1 ).getSRID() );
|
assertEquals( -1, decodedGeoms.get( 1 ).getSRID() );
|
||||||
assertEquals( 4326, decodedGeoms.get( 2 ).getSRID() );
|
assertEquals( 4326, decodedGeoms.get( 2 ).getSRID() );
|
||||||
assertEquals( 31370, decodedGeoms.get( 3 ).getSRID() );
|
assertEquals( 31370, decodedGeoms.get( 3 ).getSRID() );
|
||||||
}
|
}
|
||||||
|
@ -62,16 +62,15 @@ public class PointConvertorTest extends AbstractConvertorTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_coordinates() {
|
public void test_coordinates() {
|
||||||
Coordinate expected;
|
Point expected;
|
||||||
Coordinate received;
|
expected = Points.create( 10.0, 5.0);
|
||||||
expected = new Coordinate( 10.0, 5.0 );
|
assertEquals( expected, decodedGeoms.get( 1 ).getPointN(0) );
|
||||||
assertEquals( expected, decodedGeoms.get( 1 ).getCoordinate() );
|
expected = Points.create(52.25, 2.53, CrsId.valueOf(4326));
|
||||||
expected = new Coordinate( 52.25, 2.53 );
|
assertEquals( expected, decodedGeoms.get( 2 ).getPointN( 0 ) );
|
||||||
assertEquals( expected, decodedGeoms.get( 2 ).getCoordinate() );
|
expected = Points.create(150000.0, 200000.0, CrsId.valueOf(31370));
|
||||||
expected = new Coordinate( 150000.0, 200000.0 );
|
assertEquals( expected, decodedGeoms.get( 3 ).getPointN( 0 ) );
|
||||||
assertEquals( expected, decodedGeoms.get( 3 ).getCoordinate() );
|
expected = Points.create(10.0, 2.0, 1.0, 3.0, CrsId.valueOf(4326));
|
||||||
expected = new MCoordinate( 10.0, 2.0, 1.0, 3.0 );
|
assertEquals( expected, decodedGeoms.get( 4 ).getPointN( 0 ) );
|
||||||
assertEquals( expected, decodedGeoms.get( 4 ).getCoordinate() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -21,32 +21,21 @@
|
||||||
|
|
||||||
package org.hibernate.spatial.testing;
|
package org.hibernate.spatial.testing;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.BufferedWriter;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.StringWriter;
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.sql.Statement;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Properties;
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
|
||||||
import org.apache.commons.dbcp.BasicDataSource;
|
import org.apache.commons.dbcp.BasicDataSource;
|
||||||
|
import org.geolatte.geom.Geometry;
|
||||||
import org.geolatte.geom.codec.Wkt;
|
import org.geolatte.geom.codec.Wkt;
|
||||||
import org.geolatte.geom.codec.WktDecodeException;
|
import org.geolatte.geom.codec.WktDecodeException;
|
||||||
import org.geolatte.geom.codec.WktDecoder;
|
import org.geolatte.geom.codec.WktDecoder;
|
||||||
import org.geolatte.geom.jts.JTS;
|
|
||||||
|
|
||||||
import org.hibernate.spatial.Log;
|
import org.hibernate.spatial.Log;
|
||||||
import org.hibernate.spatial.LogFactory;
|
import org.hibernate.spatial.LogFactory;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
import java.io.*;
|
||||||
|
import java.sql.*;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Unit testsuite-suite support class.</p>
|
* <p>Unit testsuite-suite support class.</p>
|
||||||
*
|
*
|
||||||
|
@ -221,8 +210,7 @@ public class DataSourceUtils {
|
||||||
cn.commit();
|
cn.commit();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
LOG.info( "Loaded " + sum( insCounts ) + " rows." );
|
LOG.info( "Loaded " + sum( insCounts ) + " rows." );
|
||||||
}
|
}finally {
|
||||||
finally {
|
|
||||||
try {
|
try {
|
||||||
if ( cn != null ) {
|
if ( cn != null ) {
|
||||||
cn.close();
|
cn.close();
|
||||||
|
@ -363,7 +351,9 @@ public class DataSourceUtils {
|
||||||
for ( TestDataElement testDataElement : testData ) {
|
for ( TestDataElement testDataElement : testData ) {
|
||||||
if ( testDataElement.type.equalsIgnoreCase( type ) ) {
|
if ( testDataElement.type.equalsIgnoreCase( type ) ) {
|
||||||
try {
|
try {
|
||||||
result.put( testDataElement.id, JTS.to( decoder.decode( testDataElement.wkt ) ) );
|
//to ensure expected geometries have the correct SRID, we prepend to the WKT string
|
||||||
|
String wkt = "SRID=" + testDataElement.srid + ";"+testDataElement.wkt;
|
||||||
|
result.put( testDataElement.id, decoder.decode( wkt ) );
|
||||||
}
|
}
|
||||||
catch ( WktDecodeException e ) {
|
catch ( WktDecodeException e ) {
|
||||||
System.out
|
System.out
|
||||||
|
|
|
@ -36,12 +36,18 @@ import org.hibernate.spatial.jts.mgeom.MCoordinate;
|
||||||
public class GeometryEquality {
|
public class GeometryEquality {
|
||||||
|
|
||||||
public boolean test(Geometry geom1, Geometry geom2) {
|
public boolean test(Geometry geom1, Geometry geom2) {
|
||||||
|
return test( geom1, geom2, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean test(Geometry geom1, Geometry geom2, boolean ignoreSRID) {
|
||||||
if ( geom1 == null ) {
|
if ( geom1 == null ) {
|
||||||
return geom2 == null;
|
return geom2 == null;
|
||||||
}
|
}
|
||||||
if ( geom1.isEmpty() ) {
|
if ( geom1.isEmpty() ) {
|
||||||
return geom2.isEmpty() && equalSRID( geom1, geom2 );
|
return geom2.isEmpty();
|
||||||
}
|
}
|
||||||
|
if (!ignoreSRID && !equalSRID(geom1, geom2)) return false;
|
||||||
|
|
||||||
if ( geom1 instanceof GeometryCollection ) {
|
if ( geom1 instanceof GeometryCollection ) {
|
||||||
if ( !( geom2 instanceof GeometryCollection ) ) {
|
if ( !( geom2 instanceof GeometryCollection ) ) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -51,7 +57,7 @@ public class GeometryEquality {
|
||||||
for ( int partIndex = 0; partIndex < expectedCollection.getNumGeometries(); partIndex++ ) {
|
for ( int partIndex = 0; partIndex < expectedCollection.getNumGeometries(); partIndex++ ) {
|
||||||
Geometry partExpected = expectedCollection.getGeometryN( partIndex );
|
Geometry partExpected = expectedCollection.getGeometryN( partIndex );
|
||||||
Geometry partReceived = receivedCollection.getGeometryN( partIndex );
|
Geometry partReceived = receivedCollection.getGeometryN( partIndex );
|
||||||
if ( !test( partExpected, partReceived ) ) {
|
if ( !test( partExpected, partReceived, true ) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +77,7 @@ public class GeometryEquality {
|
||||||
*/
|
*/
|
||||||
private boolean equalSRID(Geometry geom1, Geometry geom2) {
|
private boolean equalSRID(Geometry geom1, Geometry geom2) {
|
||||||
return geom1.getSRID() == geom2.getSRID() ||
|
return geom1.getSRID() == geom2.getSRID() ||
|
||||||
( geom1.getSRID() <1 && geom2.getSRID() < 1);
|
( geom1.getSRID() < 1 && geom2.getSRID() < 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,7 +90,7 @@ public class GeometryEquality {
|
||||||
*/
|
*/
|
||||||
protected boolean testSimpleGeometryEquality(Geometry geom1, Geometry geom2) {
|
protected boolean testSimpleGeometryEquality(Geometry geom1, Geometry geom2) {
|
||||||
//return geom1.equals(geom2);
|
//return geom1.equals(geom2);
|
||||||
return testTypeAndVertexEquality( geom1, geom2 ) && equalSRID( geom1, geom2 );
|
return testTypeAndVertexEquality( geom1, geom2);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean testTypeAndVertexEquality(Geometry geom1, Geometry geom2) {
|
protected boolean testTypeAndVertexEquality(Geometry geom1, Geometry geom2) {
|
||||||
|
|
|
@ -23,6 +23,7 @@ package org.hibernate.spatial.testing.dialects.sqlserver;
|
||||||
|
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
import com.vividsolutions.jts.geom.Geometry;
|
||||||
import com.vividsolutions.jts.geom.Point;
|
import com.vividsolutions.jts.geom.Point;
|
||||||
|
import org.geolatte.geom.jts.JTS;
|
||||||
|
|
||||||
import org.hibernate.spatial.dialect.sqlserver.convertors.Decoders;
|
import org.hibernate.spatial.dialect.sqlserver.convertors.Decoders;
|
||||||
import org.hibernate.spatial.testing.AbstractExpectationsFactory;
|
import org.hibernate.spatial.testing.AbstractExpectationsFactory;
|
||||||
|
@ -141,7 +142,7 @@ public class SqlServerExpectationsFactory extends AbstractExpectationsFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Geometry decode(Object o) {
|
protected Geometry decode(Object o) {
|
||||||
return Decoders.decode( (byte[]) o );
|
return JTS.to( Decoders.decode( (byte[]) o ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -30,10 +30,10 @@ hibernate.show_sql false
|
||||||
|
|
||||||
hibernate.max_fetch_depth 5
|
hibernate.max_fetch_depth 5
|
||||||
|
|
||||||
hibernate.dialect org.hibernate.dialect.H2Dialect
|
#hibernate.dialect org.hibernate.dialect.H2Dialect
|
||||||
hibernate.connection.driver_class org.h2.Driver
|
#hibernate.connection.driver_class org.h2.Driver
|
||||||
hibernate.connection.url jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE
|
#hibernate.connection.url jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE
|
||||||
hibernate.connection.username sa
|
#hibernate.connection.username sa
|
||||||
|
|
||||||
#hibernate.cache.region_prefix hibernate.test
|
#hibernate.cache.region_prefix hibernate.test
|
||||||
#hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFactory
|
#hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFactory
|
||||||
|
@ -58,12 +58,12 @@ hibernate.connection.username sa
|
||||||
#hibernate.connection.password hbs
|
#hibernate.connection.password hbs
|
||||||
|
|
||||||
|
|
||||||
#hibernate.dialect org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDialect
|
hibernate.dialect org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDialect
|
||||||
#hibernate.connection.driver_class com.microsoft.sqlserver.jdbc.SQLServerDriver
|
hibernate.connection.driver_class com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||||
#hibernate.connection.url jdbc:sqlserver://192.168.0.100:1433;databaseName=HBS
|
hibernate.connection.url jdbc:sqlserver://sqlserver.geovise.com:1433;databaseName=HBS
|
||||||
#hibernate.connection.username hbs
|
hibernate.connection.username hbs
|
||||||
#hibernate.connection.password hbs
|
hibernate.connection.password hbs
|
||||||
#hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFactory
|
|
||||||
|
|
||||||
##
|
##
|
||||||
## MySQL 5 dialects
|
## MySQL 5 dialects
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# $Id: hibernate-spatial-sqlserver-test.properties 182 2010-03-20 17:30:12Z maesenka $
|
# $Id: hibernate-spatial-sqlserver-test.properties 182 2010-03-20 17:30:12Z maesenka $
|
||||||
#
|
#
|
||||||
|
|
||||||
jdbcUrl = jdbc:sqlserver://192.168.0.100:1433;databaseName=HBS
|
jdbcUrl = jdbc:sqlserver://sqlserver.geovise.com:1433;databaseName=HBS
|
||||||
jdbcDriver = com.microsoft.sqlserver.jdbc.SQLServerDriver
|
jdbcDriver = com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||||
jdbcUser = hbs
|
jdbcUser = hbs
|
||||||
jdbcPass = hbs
|
jdbcPass = hbs
|
||||||
|
|
|
@ -255,43 +255,43 @@
|
||||||
<id>50</id>
|
<id>50</id>
|
||||||
<type>POINT</type>
|
<type>POINT</type>
|
||||||
<wkt>POINT EMPTY</wkt>
|
<wkt>POINT EMPTY</wkt>
|
||||||
<srid>4326</srid>
|
<srid>0</srid>
|
||||||
</Element>
|
</Element>
|
||||||
<Element>
|
<Element>
|
||||||
<id>51</id>
|
<id>51</id>
|
||||||
<type>LINESTRING</type>
|
<type>LINESTRING</type>
|
||||||
<wkt>LINESTRING EMPTY</wkt>
|
<wkt>LINESTRING EMPTY</wkt>
|
||||||
<srid>4326</srid>
|
<srid>0</srid>
|
||||||
</Element>
|
</Element>
|
||||||
<Element>
|
<Element>
|
||||||
<id>52</id>
|
<id>52</id>
|
||||||
<type>POLYGON</type>
|
<type>POLYGON</type>
|
||||||
<wkt>POLYGON EMPTY</wkt>
|
<wkt>POLYGON EMPTY</wkt>
|
||||||
<srid>4326</srid>
|
<srid>0</srid>
|
||||||
</Element>
|
</Element>
|
||||||
<Element>
|
<Element>
|
||||||
<id>53</id>
|
<id>53</id>
|
||||||
<type>MULTIPOINT</type>
|
<type>MULTIPOINT</type>
|
||||||
<wkt>MULTIPOINT EMPTY</wkt>
|
<wkt>MULTIPOINT EMPTY</wkt>
|
||||||
<srid>4326</srid>
|
<srid>0</srid>
|
||||||
</Element>
|
</Element>
|
||||||
<Element>
|
<Element>
|
||||||
<id>54</id>
|
<id>54</id>
|
||||||
<type>MULTILINESTRING</type>
|
<type>MULTILINESTRING</type>
|
||||||
<wkt>MULTILINESTRING EMPTY</wkt>
|
<wkt>MULTILINESTRING EMPTY</wkt>
|
||||||
<srid>4326</srid>
|
<srid>0</srid>
|
||||||
</Element>
|
</Element>
|
||||||
<Element>
|
<Element>
|
||||||
<id>55</id>
|
<id>55</id>
|
||||||
<type>MULTIPOLYGON</type>
|
<type>MULTIPOLYGON</type>
|
||||||
<wkt>MULTIPOLYGON EMPTY</wkt>
|
<wkt>MULTIPOLYGON EMPTY</wkt>
|
||||||
<srid>4326</srid>
|
<srid>0</srid>
|
||||||
</Element>
|
</Element>
|
||||||
<Element>
|
<Element>
|
||||||
<id>56</id>
|
<id>56</id>
|
||||||
<type>GEOMETRYCOLLECTION</type>
|
<type>GEOMETRYCOLLECTION</type>
|
||||||
<wkt>GEOMETRYCOLLECTION EMPTY</wkt>
|
<wkt>GEOMETRYCOLLECTION EMPTY</wkt>
|
||||||
<srid>4326</srid>
|
<srid>0</srid>
|
||||||
</Element>
|
</Element>
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue