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.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.password hbs
|
||||
|
||||
|
|
|
@ -27,7 +27,12 @@ dependencies {
|
|||
compile([group: 'com.vividsolutions', name: 'jts', version: '1.12']) {
|
||||
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) {
|
||||
transitive = false
|
||||
|
@ -38,7 +43,7 @@ dependencies {
|
|||
testCompile(project(':hibernate-testing'))
|
||||
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.microsoft', name: 'sqljdbc', version: '2.0'])
|
||||
testRuntime([group: 'com.microsoft', name: 'sqljdbc', version: '2.0'])
|
||||
// testRuntime("org.opengeo:geodb:0.7")
|
||||
// testRuntime("mysql:mysql-connector-java:5.1.15")
|
||||
testRuntime("postgresql:postgresql:8.4-701.jdbc4")
|
||||
|
|
|
@ -21,7 +21,15 @@
|
|||
|
||||
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.dialect.sqlserver.convertors.Decoders;
|
||||
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.BasicExtractor;
|
||||
|
||||
import java.sql.*;
|
||||
|
||||
/**
|
||||
* @author Karel Maesen, Geovise BVBA
|
||||
* creation-date: 8/23/11
|
||||
|
|
|
@ -21,30 +21,20 @@
|
|||
|
||||
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> {
|
||||
|
||||
private final MGeometryFactory geometryFactory;
|
||||
|
||||
public AbstractDecoder(MGeometryFactory factory) {
|
||||
this.geometryFactory = factory;
|
||||
}
|
||||
|
||||
public G decode(SqlServerGeometry nativeGeom) {
|
||||
if ( !accepts( nativeGeom ) ) {
|
||||
throw new IllegalArgumentException( getClass().getSimpleName() + " received object of type " + nativeGeom.openGisType() );
|
||||
}
|
||||
if ( nativeGeom.isEmpty() ) {
|
||||
G nullGeom = createNullGeometry();
|
||||
setSrid( nativeGeom, nullGeom );
|
||||
return nullGeom;
|
||||
}
|
||||
G result = createGeometry( nativeGeom );
|
||||
setSrid( nativeGeom, result );
|
||||
return result;
|
||||
return createGeometry( nativeGeom );
|
||||
}
|
||||
|
||||
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 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.List;
|
||||
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
|
||||
import org.hibernate.spatial.jts.mgeom.MGeometry;
|
||||
import org.geolatte.geom.Geometry;
|
||||
import org.geolatte.geom.PointCollection;
|
||||
|
||||
|
||||
abstract class AbstractEncoder<G extends Geometry> implements Encoder<G> {
|
||||
|
||||
public SqlServerGeometry encode(G geom) {
|
||||
SqlServerGeometry nativeGeom = new SqlServerGeometry();
|
||||
nativeGeom.setSrid( geom.getSRID() );
|
||||
if ( geom.isValid() ) {
|
||||
nativeGeom.setIsValid();
|
||||
}
|
||||
int srid = geom.getSRID();
|
||||
nativeGeom.setSrid( srid < 0 ? 0 : srid );
|
||||
nativeGeom.setIsValid();
|
||||
|
||||
if ( hasMValues( geom ) ) {
|
||||
if ( geom.isMeasured() ) {
|
||||
nativeGeom.setHasMValues();
|
||||
}
|
||||
|
||||
List<Coordinate> coordinates = new ArrayList<Coordinate>();
|
||||
CountingPointSequenceBuilder coordinates = new CountingPointSequenceBuilder(geom.getDimensionalFlag());
|
||||
List<Figure> figures = new ArrayList<Figure>();
|
||||
List<Shape> shapes = new ArrayList<Shape>();
|
||||
|
||||
encode( geom, -1, coordinates, figures, shapes );
|
||||
encodePoints( nativeGeom, coordinates );
|
||||
encodePoints( nativeGeom, coordinates.toPointSequence() );
|
||||
encodeFigures( nativeGeom, figures );
|
||||
encodeShapes( nativeGeom, shapes );
|
||||
return nativeGeom;
|
||||
|
@ -63,7 +60,7 @@ abstract class AbstractEncoder<G extends Geometry> implements Encoder<G> {
|
|||
* @param figures figure 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) {
|
||||
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, List<Coordinate> coordinates) {
|
||||
protected void encodePoints(SqlServerGeometry nativeGeom, PointCollection coordinates) {
|
||||
nativeGeom.setNumberOfPoints( coordinates.size() );
|
||||
nativeGeom.allocateMValueArray();
|
||||
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) {
|
||||
if ( !nativeGeom.hasZValues() && !Double.isNaN( coordinate.z ) ) {
|
||||
protected void setCoordinate(SqlServerGeometry nativeGeom, int idx, PointCollection coordinate) {
|
||||
if ( !nativeGeom.hasZValues() && !Double.isNaN( coordinate.getZ(idx) ) ) {
|
||||
nativeGeom.setHasZValues();
|
||||
nativeGeom.allocateZValueArray();
|
||||
}
|
||||
|
|
|
@ -24,17 +24,11 @@ package org.hibernate.spatial.dialect.sqlserver.convertors;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.GeometryCollection;
|
||||
|
||||
import org.hibernate.spatial.jts.mgeom.MGeometryFactory;
|
||||
import org.geolatte.geom.Geometry;
|
||||
import org.geolatte.geom.GeometryCollection;
|
||||
|
||||
abstract class AbstractGeometryCollectionDecoder<T extends GeometryCollection> extends AbstractDecoder<T> {
|
||||
|
||||
public AbstractGeometryCollectionDecoder(MGeometryFactory factory) {
|
||||
super( factory );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected OpenGisType getOpenGisType() {
|
||||
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;
|
||||
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
|
||||
import org.geolatte.geom.Geometry;
|
||||
|
||||
/**
|
||||
* Decodes native database objects to geometries of type T.
|
||||
|
|
|
@ -21,14 +21,11 @@
|
|||
|
||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||
|
||||
import org.geolatte.geom.Geometry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
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.
|
||||
*
|
||||
|
@ -39,16 +36,14 @@ public class Decoders {
|
|||
final private static List<Decoder<? extends Geometry>> DECODERS = new ArrayList<Decoder<? extends Geometry>>();
|
||||
|
||||
static {
|
||||
MGeometryFactory factory = JTS.getDefaultGeometryFactory();
|
||||
|
||||
//Decoders
|
||||
DECODERS.add( new PointDecoder( factory ) );
|
||||
DECODERS.add( new LineStringDecoder( factory ) );
|
||||
DECODERS.add( new PolygonDecoder( factory ) );
|
||||
DECODERS.add( new MultiLineStringDecoder( factory ) );
|
||||
DECODERS.add( new MultiPolygonDecoder( factory ) );
|
||||
DECODERS.add( new MultiPointDecoder( factory ) );
|
||||
DECODERS.add( new GeometryCollectionDecoder( factory ) );
|
||||
DECODERS.add( new PointDecoder() );
|
||||
DECODERS.add( new LineStringDecoder() );
|
||||
DECODERS.add( new PolygonDecoder() );
|
||||
DECODERS.add( new MultiLineStringDecoder( ) );
|
||||
DECODERS.add( new MultiPolygonDecoder( ) );
|
||||
DECODERS.add( new MultiPointDecoder( ) );
|
||||
DECODERS.add( new GeometryCollectionDecoder( ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import org.geolatte.geom.Geometry;
|
||||
|
||||
/**
|
||||
* An <code>Encoder</code> can encode
|
||||
|
|
|
@ -24,10 +24,11 @@ package org.hibernate.spatial.dialect.sqlserver.convertors;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.GeometryCollection;
|
||||
import com.vividsolutions.jts.geom.MultiLineString;
|
||||
import com.vividsolutions.jts.geom.MultiPolygon;
|
||||
import org.geolatte.geom.Geometry;
|
||||
import org.geolatte.geom.GeometryCollection;
|
||||
import org.geolatte.geom.MultiLineString;
|
||||
import org.geolatte.geom.MultiPoint;
|
||||
import org.geolatte.geom.MultiPolygon;
|
||||
|
||||
/**
|
||||
* Serializes a JTS <code>Geometry</code> to a byte-array.
|
||||
|
@ -44,7 +45,7 @@ public class Encoders {
|
|||
ENCODERS.add( new PointEncoder() );
|
||||
ENCODERS.add( new LineStringEncoder() );
|
||||
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<MultiPolygon>( OpenGisType.MULTIPOLYGON ) );
|
||||
ENCODERS.add( new GeometryCollectionEncoder<GeometryCollection>( OpenGisType.GEOMETRYCOLLECTION ) );
|
||||
|
|
|
@ -23,10 +23,8 @@ package org.hibernate.spatial.dialect.sqlserver.convertors;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.GeometryCollection;
|
||||
|
||||
import org.hibernate.spatial.jts.mgeom.MGeometryFactory;
|
||||
import org.geolatte.geom.Geometry;
|
||||
import org.geolatte.geom.GeometryCollection;
|
||||
|
||||
/**
|
||||
* <code>Decoder</code> for GeometryCollections.
|
||||
|
@ -35,9 +33,6 @@ import org.hibernate.spatial.jts.mgeom.MGeometryFactory;
|
|||
*/
|
||||
class GeometryCollectionDecoder extends AbstractGeometryCollectionDecoder<GeometryCollection> {
|
||||
|
||||
public GeometryCollectionDecoder(MGeometryFactory factory) {
|
||||
super( factory );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected OpenGisType getOpenGisType() {
|
||||
|
@ -46,7 +41,7 @@ class GeometryCollectionDecoder extends AbstractGeometryCollectionDecoder<Geomet
|
|||
|
||||
protected GeometryCollection createGeometry(List<Geometry> geometries, boolean hasM) {
|
||||
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 com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.GeometryCollection;
|
||||
import org.geolatte.geom.Geometry;
|
||||
import org.geolatte.geom.GeometryCollection;
|
||||
|
||||
/**
|
||||
* <code>Encoder</code> for GeometryCollections.
|
||||
|
@ -45,7 +44,7 @@ class GeometryCollectionEncoder<T extends GeometryCollection> extends AbstractEn
|
|||
}
|
||||
|
||||
@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() ) {
|
||||
shapes.add( new Shape( parentShapeIndex, -1, this.openGisType ) );
|
||||
return;
|
||||
|
@ -53,8 +52,12 @@ class GeometryCollectionEncoder<T extends GeometryCollection> extends AbstractEn
|
|||
int thisShapeIndex = shapes.size();
|
||||
Shape thisShape = createShape( parentShapeIndex, figures );
|
||||
shapes.add( thisShape );
|
||||
for ( int i = 0; i < geom.getNumGeometries(); i++ ) {
|
||||
Geometry component = geom.getGeometryN( i );
|
||||
if (! (geom instanceof GeometryCollection)) {
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +67,7 @@ class GeometryCollectionEncoder<T extends GeometryCollection> extends AbstractEn
|
|||
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 );
|
||||
encoder.encode( geom, thisShapeIndex, coordinates, figures, shapes );
|
||||
}
|
||||
|
|
|
@ -21,18 +21,12 @@
|
|||
|
||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.CoordinateSequence;
|
||||
import com.vividsolutions.jts.geom.LineString;
|
||||
|
||||
import org.hibernate.spatial.jts.mgeom.MCoordinate;
|
||||
import org.hibernate.spatial.jts.mgeom.MGeometryFactory;
|
||||
import org.geolatte.geom.LineString;
|
||||
import org.geolatte.geom.PointSequence;
|
||||
import org.geolatte.geom.crs.CrsId;
|
||||
|
||||
class LineStringDecoder extends AbstractDecoder<LineString> {
|
||||
|
||||
public LineStringDecoder(MGeometryFactory factory) {
|
||||
super( factory );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected OpenGisType getOpenGisType() {
|
||||
|
@ -40,7 +34,7 @@ class LineStringDecoder extends AbstractDecoder<LineString> {
|
|||
}
|
||||
|
||||
protected LineString createNullGeometry() {
|
||||
return getGeometryFactory().createLineString( (CoordinateSequence) null );
|
||||
return LineString.createEmpty();
|
||||
}
|
||||
|
||||
protected LineString createGeometry(SqlServerGeometry nativeGeom) {
|
||||
|
@ -58,19 +52,7 @@ class LineStringDecoder extends AbstractDecoder<LineString> {
|
|||
}
|
||||
|
||||
protected LineString createLineString(SqlServerGeometry nativeGeom, IndexRange pntIndexRange) {
|
||||
Coordinate[] coordinates = nativeGeom.coordinateRange( pntIndexRange );
|
||||
return createLineString( coordinates, nativeGeom.hasMValues() );
|
||||
PointSequence coordinates = nativeGeom.coordinateRange( pntIndexRange );
|
||||
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 com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.LineString;
|
||||
import org.geolatte.geom.Geometry;
|
||||
import org.geolatte.geom.LineString;
|
||||
import org.geolatte.geom.Point;
|
||||
import org.geolatte.geom.PointCollection;
|
||||
import org.geolatte.geom.PointSequence;
|
||||
|
||||
|
||||
class LineStringEncoder extends AbstractEncoder<LineString> {
|
||||
|
||||
@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 ) ) {
|
||||
throw new IllegalArgumentException( "Require LineString geometry" );
|
||||
}
|
||||
|
@ -39,16 +42,16 @@ class LineStringEncoder extends AbstractEncoder<LineString> {
|
|||
return;
|
||||
}
|
||||
int figureOffset = figures.size();
|
||||
int pointOffset = coordinates.size();
|
||||
for ( Coordinate coordinate : geom.getCoordinates() ) {
|
||||
coordinates.add( coordinate );
|
||||
int pointOffset = coordinates.getNumAdded();
|
||||
for ( Point point : (PointSequence)geom.getPoints() ) {
|
||||
coordinates.add( point );
|
||||
}
|
||||
figures.add( new Figure( FigureAttribute.Stroke, pointOffset ) );
|
||||
shapes.add( new Shape( parentShapeIndex, figureOffset, OpenGisType.LINESTRING ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void encodePoints(SqlServerGeometry nativeGeom, List<Coordinate> coordinates) {
|
||||
protected void encodePoints(SqlServerGeometry nativeGeom, PointCollection coordinates) {
|
||||
super.encodePoints( nativeGeom, coordinates );
|
||||
if ( coordinates.size() == 2 ) {
|
||||
nativeGeom.setIsSingleLineSegment();
|
||||
|
|
|
@ -23,19 +23,13 @@ package org.hibernate.spatial.dialect.sqlserver.convertors;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.LineString;
|
||||
import com.vividsolutions.jts.geom.MultiLineString;
|
||||
import org.geolatte.geom.Geometry;
|
||||
import org.geolatte.geom.LineString;
|
||||
import org.geolatte.geom.MultiLineString;
|
||||
|
||||
import org.hibernate.spatial.jts.mgeom.MGeometryFactory;
|
||||
import org.hibernate.spatial.jts.mgeom.MLineString;
|
||||
|
||||
class MultiLineStringDecoder extends AbstractGeometryCollectionDecoder<MultiLineString> {
|
||||
|
||||
public MultiLineStringDecoder(MGeometryFactory factory) {
|
||||
super( factory );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected OpenGisType getOpenGisType() {
|
||||
return OpenGisType.MULTILINESTRING;
|
||||
|
@ -44,12 +38,8 @@ class MultiLineStringDecoder extends AbstractGeometryCollectionDecoder<MultiLine
|
|||
|
||||
@Override
|
||||
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;
|
||||
return getGeometryFactory().createMultiLineString( lAr );
|
||||
return new MultiLineString( lAr );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,11 +23,9 @@ package org.hibernate.spatial.dialect.sqlserver.convertors;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.MultiPoint;
|
||||
import com.vividsolutions.jts.geom.Point;
|
||||
|
||||
import org.hibernate.spatial.jts.mgeom.MGeometryFactory;
|
||||
import org.geolatte.geom.Geometry;
|
||||
import org.geolatte.geom.MultiPoint;
|
||||
import org.geolatte.geom.Point;
|
||||
|
||||
/**
|
||||
* <code>Decoder</code> for GeometryCollections.
|
||||
|
@ -37,11 +35,6 @@ import org.hibernate.spatial.jts.mgeom.MGeometryFactory;
|
|||
|
||||
class MultiPointDecoder extends AbstractGeometryCollectionDecoder<MultiPoint> {
|
||||
|
||||
public MultiPointDecoder(MGeometryFactory factory) {
|
||||
super( factory );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected OpenGisType getOpenGisType() {
|
||||
return OpenGisType.MULTIPOINT;
|
||||
|
@ -50,7 +43,7 @@ class MultiPointDecoder extends AbstractGeometryCollectionDecoder<MultiPoint> {
|
|||
@Override
|
||||
protected MultiPoint createGeometry(List<Geometry> geometries, boolean hasM) {
|
||||
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 com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.MultiPolygon;
|
||||
import com.vividsolutions.jts.geom.Polygon;
|
||||
|
||||
import org.hibernate.spatial.jts.mgeom.MGeometryFactory;
|
||||
import org.geolatte.geom.Geometry;
|
||||
import org.geolatte.geom.MultiPolygon;
|
||||
import org.geolatte.geom.Polygon;
|
||||
|
||||
class MultiPolygonDecoder extends AbstractGeometryCollectionDecoder<MultiPolygon> {
|
||||
|
||||
public MultiPolygonDecoder(MGeometryFactory factory) {
|
||||
super( factory );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected OpenGisType getOpenGisType() {
|
||||
return OpenGisType.MULTIPOLYGON;
|
||||
|
@ -44,7 +37,7 @@ class MultiPolygonDecoder extends AbstractGeometryCollectionDecoder<MultiPolygon
|
|||
@Override
|
||||
protected MultiPolygon createGeometry(List<Geometry> geometries, boolean hasM) {
|
||||
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;
|
||||
|
||||
import com.vividsolutions.jts.geom.GeometryCollection;
|
||||
import com.vividsolutions.jts.geom.LineString;
|
||||
import com.vividsolutions.jts.geom.MultiLineString;
|
||||
import com.vividsolutions.jts.geom.MultiPoint;
|
||||
import com.vividsolutions.jts.geom.MultiPolygon;
|
||||
import com.vividsolutions.jts.geom.Point;
|
||||
import com.vividsolutions.jts.geom.Polygon;
|
||||
|
||||
import org.geolatte.geom.GeometryCollection;
|
||||
import org.geolatte.geom.LineString;
|
||||
import org.geolatte.geom.MultiLineString;
|
||||
import org.geolatte.geom.MultiPoint;
|
||||
import org.geolatte.geom.MultiPolygon;
|
||||
import org.geolatte.geom.Point;
|
||||
import org.geolatte.geom.Polygon;
|
||||
|
||||
/**
|
||||
* The type of geometry.
|
||||
|
|
|
@ -21,10 +21,11 @@
|
|||
|
||||
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.
|
||||
|
@ -32,9 +33,6 @@ import org.hibernate.spatial.jts.mgeom.MGeometryFactory;
|
|||
*/
|
||||
class PointDecoder extends AbstractDecoder<Point> {
|
||||
|
||||
public PointDecoder(MGeometryFactory factory) {
|
||||
super( factory );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected OpenGisType getOpenGisType() {
|
||||
|
@ -42,7 +40,7 @@ class PointDecoder extends AbstractDecoder<Point> {
|
|||
}
|
||||
|
||||
protected Point createNullGeometry() {
|
||||
return getGeometryFactory().createPoint( (Coordinate) null );
|
||||
return Point.createEmpty();
|
||||
}
|
||||
|
||||
protected Point createGeometry(SqlServerGeometry nativeGeom) {
|
||||
|
@ -60,8 +58,10 @@ class PointDecoder extends AbstractDecoder<Point> {
|
|||
}
|
||||
|
||||
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 com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.Point;
|
||||
import org.geolatte.geom.Geometry;
|
||||
import org.geolatte.geom.Point;
|
||||
|
||||
import org.hibernate.spatial.jts.mgeom.MCoordinate;
|
||||
|
||||
/**
|
||||
* @author Karel Maesen, Geovise BVBA.
|
||||
|
@ -48,7 +46,8 @@ class PointEncoder extends AbstractEncoder<Point> {
|
|||
public SqlServerGeometry encode(Point geom) {
|
||||
|
||||
SqlServerGeometry sqlServerGeom = new SqlServerGeometry();
|
||||
sqlServerGeom.setSrid( geom.getSRID() );
|
||||
int srid = geom.getSRID();
|
||||
sqlServerGeom.setSrid( srid < 0 ? 0 : srid );
|
||||
sqlServerGeom.setIsValid();
|
||||
|
||||
if ( geom.isEmpty() ) {
|
||||
|
@ -61,21 +60,20 @@ class PointEncoder extends AbstractEncoder<Point> {
|
|||
|
||||
sqlServerGeom.setIsSinglePoint();
|
||||
sqlServerGeom.setNumberOfPoints( 1 );
|
||||
Coordinate coordinate = geom.getCoordinate();
|
||||
if ( is3DPoint( coordinate ) ) {
|
||||
if ( geom.is3D() ) {
|
||||
sqlServerGeom.setHasZValues();
|
||||
sqlServerGeom.allocateZValueArray();
|
||||
}
|
||||
if ( isMPoint( coordinate ) ) {
|
||||
if ( geom.isMeasured() ) {
|
||||
sqlServerGeom.setHasMValues();
|
||||
sqlServerGeom.allocateMValueArray();
|
||||
}
|
||||
sqlServerGeom.setCoordinate( 0, coordinate );
|
||||
sqlServerGeom.setCoordinate( 0, geom.getPoints() );
|
||||
return sqlServerGeom;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void encode(Geometry geom, int parentIdx, List<Coordinate> coordinates, List<Figure> figures, List<Shape> shapes) {
|
||||
@Override
|
||||
protected void encode(Geometry geom, int parentIdx, CountingPointSequenceBuilder coordinates, List<Figure> figures, List<Shape> shapes) {
|
||||
if ( !( geom instanceof Point ) ) {
|
||||
throw new IllegalArgumentException( "Require Point geometry" );
|
||||
}
|
||||
|
@ -83,24 +81,15 @@ class PointEncoder extends AbstractEncoder<Point> {
|
|||
shapes.add( new Shape( parentIdx, -1, OpenGisType.POINT ) );
|
||||
return;
|
||||
}
|
||||
int pntOffset = coordinates.size();
|
||||
int pntOffset = coordinates.getNumAdded();
|
||||
int figureOffset = figures.size();
|
||||
coordinates.add( geom.getCoordinate() );
|
||||
coordinates.add( geom.getPointN(0) );
|
||||
Figure figure = new Figure( FigureAttribute.Stroke, pntOffset );
|
||||
figures.add( figure );
|
||||
Shape shape = new Shape( parentIdx, figureOffset, OpenGisType.POINT );
|
||||
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) {
|
||||
return geom instanceof Point;
|
||||
}
|
||||
|
|
|
@ -21,29 +21,24 @@
|
|||
|
||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.LinearRing;
|
||||
import com.vividsolutions.jts.geom.Polygon;
|
||||
|
||||
import org.hibernate.spatial.jts.mgeom.MGeometryFactory;
|
||||
import org.geolatte.geom.LinearRing;
|
||||
import org.geolatte.geom.PointSequence;
|
||||
import org.geolatte.geom.Polygon;
|
||||
import org.geolatte.geom.crs.CrsId;
|
||||
|
||||
/**
|
||||
* @author Karel Maesen, Geovise BVBA
|
||||
*/
|
||||
class PolygonDecoder extends AbstractDecoder<Polygon> {
|
||||
|
||||
public PolygonDecoder(MGeometryFactory factory) {
|
||||
super( factory );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected OpenGisType getOpenGisType() {
|
||||
return OpenGisType.POLYGON;
|
||||
}
|
||||
|
||||
protected Polygon createNullGeometry() {
|
||||
return getGeometryFactory().createPolygon( null, null );
|
||||
}
|
||||
return Polygon.createEmpty();
|
||||
}
|
||||
|
||||
protected Polygon createGeometry(SqlServerGeometry nativeGeom) {
|
||||
return createGeometry( nativeGeom, 0 );
|
||||
|
@ -55,23 +50,24 @@ class PolygonDecoder extends AbstractDecoder<Polygon> {
|
|||
}
|
||||
//polygons consist of one exterior ring figure, and several interior ones.
|
||||
IndexRange figureRange = nativeGeom.getFiguresForShape( shapeIndex );
|
||||
LinearRing[] holes = new LinearRing[figureRange.length() - 1];
|
||||
LinearRing shell = null;
|
||||
for ( int figureIdx = figureRange.start, i = 0; figureIdx < figureRange.end; figureIdx++ ) {
|
||||
LinearRing[] rings = new LinearRing[figureRange.length()];
|
||||
//the rings should contain all inner rings from index 1 to index length - 1
|
||||
// index = 0 should be reserved for the shell.
|
||||
for ( int figureIdx = figureRange.start, i = 1; figureIdx < figureRange.end; figureIdx++ ) {
|
||||
IndexRange pntIndexRange = nativeGeom.getPointsForFigure( figureIdx );
|
||||
if ( nativeGeom.isFigureInteriorRing( figureIdx ) ) {
|
||||
holes[i++] = toLinearRing( nativeGeom, pntIndexRange );
|
||||
rings[i++] = toLinearRing( nativeGeom, pntIndexRange );
|
||||
}
|
||||
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) {
|
||||
Coordinate[] coordinates = nativeGeom.coordinateRange( range );
|
||||
return getGeometryFactory().createLinearRing( coordinates );
|
||||
PointSequence pointSequence = nativeGeom.coordinateRange(range);
|
||||
return new LinearRing(pointSequence, CrsId.valueOf(nativeGeom.getSrid()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,12 +21,9 @@
|
|||
|
||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||
|
||||
import java.util.List;
|
||||
import org.geolatte.geom.*;
|
||||
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.LineString;
|
||||
import com.vividsolutions.jts.geom.Polygon;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <code>Encoder</code> for Polygons.
|
||||
|
@ -40,7 +37,7 @@ class PolygonEncoder extends AbstractEncoder<Polygon> {
|
|||
}
|
||||
|
||||
@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 ) ) {
|
||||
throw new IllegalArgumentException( "Polygon geometry expected." );
|
||||
}
|
||||
|
@ -52,36 +49,36 @@ class PolygonEncoder extends AbstractEncoder<Polygon> {
|
|||
int figureOffset = figures.size();
|
||||
shapes.add( new Shape( parentShapeIndex, figureOffset, OpenGisType.POLYGON ) );
|
||||
|
||||
int pointOffset = coordinates.size();
|
||||
int pointOffset = coordinates.getNumAdded();
|
||||
addExteriorRing( 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++ ) {
|
||||
addInteriorRing( geom.getInteriorRingN( idx ), coordinates, figures );
|
||||
}
|
||||
}
|
||||
|
||||
private void addInteriorRing(LineString ring, List<Coordinate> coordinates, List<Figure> figures) {
|
||||
int pointOffset = coordinates.size();
|
||||
private void addInteriorRing(LineString ring,CountingPointSequenceBuilder coordinates, List<Figure> figures) {
|
||||
int pointOffset = coordinates.getNumAdded();
|
||||
addPoints( ring, coordinates );
|
||||
Figure figure = new Figure( FigureAttribute.InteriorRing, pointOffset );
|
||||
figures.add( figure );
|
||||
|
||||
}
|
||||
|
||||
private void addPoints(LineString ring, List<Coordinate> coordinates) {
|
||||
for ( Coordinate c : ring.getCoordinates() ) {
|
||||
private void addPoints(LineString ring, CountingPointSequenceBuilder coordinates) {
|
||||
for ( Point c : ring.getPoints() ) {
|
||||
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();
|
||||
int offset = coordinates.size();
|
||||
int offset = coordinates.getNumAdded();
|
||||
addPoints( shell, coordinates );
|
||||
Figure exterior = new Figure( FigureAttribute.ExteriorRing, offset );
|
||||
figures.add( exterior );
|
||||
|
|
|
@ -25,6 +25,11 @@ import java.nio.ByteBuffer;
|
|||
import java.nio.ByteOrder;
|
||||
|
||||
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;
|
||||
|
||||
|
@ -117,22 +122,18 @@ public class SqlServerGeometry {
|
|||
return result;
|
||||
}
|
||||
|
||||
Coordinate getCoordinate(int index) {
|
||||
Coordinate coordinate;
|
||||
if ( hasMValues() ) {
|
||||
coordinate = new MCoordinate();
|
||||
( (MCoordinate) coordinate ).m = mValues[index];
|
||||
}
|
||||
else {
|
||||
coordinate = new Coordinate();
|
||||
}
|
||||
coordinate.x = points[2 * index];
|
||||
coordinate.y = points[2 * index + 1];
|
||||
if ( hasZValues() ) {
|
||||
coordinate.z = zValues[index];
|
||||
}
|
||||
return coordinate;
|
||||
}
|
||||
void copyCoordinate(int index, double[] coords, DimensionalFlag df) {
|
||||
coords[0] = points[2 * index];
|
||||
coords[1] = points[2 * index + 1];
|
||||
if (hasZValues()) {
|
||||
assert(df.is3D());
|
||||
coords[df.Z] = zValues[index];
|
||||
}
|
||||
if (hasMValues()) {
|
||||
assert (df.isMeasured());
|
||||
coords[df.M] = mValues[index];
|
||||
}
|
||||
}
|
||||
|
||||
boolean isParentShapeOf(int parent, int child) {
|
||||
return getShape( child ).parentOffset == parent;
|
||||
|
@ -186,13 +187,16 @@ public class SqlServerGeometry {
|
|||
return getShape( shpIdx ).openGisType;
|
||||
}
|
||||
|
||||
Coordinate[] coordinateRange(IndexRange range) {
|
||||
Coordinate[] coordinates = createCoordinateArray( range.end - range.start );
|
||||
for ( int idx = range.start, i = 0; idx < range.end; idx++, i++ ) {
|
||||
coordinates[i] = getCoordinate( idx );
|
||||
}
|
||||
return coordinates;
|
||||
}
|
||||
PointSequence coordinateRange(IndexRange range) {
|
||||
DimensionalFlag df = DimensionalFlag.valueOf(hasZValues(), hasMValues());
|
||||
PointSequenceBuilder psBuilder = PointSequenceBuilders.fixedSized(range.end - range.start, df);
|
||||
double[] coordinates = new double[df.getCoordinateDimension()];
|
||||
for (int idx = range.start, i = 0; idx < range.end; idx++, i++) {
|
||||
copyCoordinate(idx, coordinates, df);
|
||||
psBuilder.add(coordinates);
|
||||
}
|
||||
return psBuilder.toPointSequence();
|
||||
}
|
||||
|
||||
private Coordinate[] createCoordinateArray(int size) {
|
||||
if ( hasMValues() ) {
|
||||
|
@ -212,14 +216,14 @@ public class SqlServerGeometry {
|
|||
return shapes[index];
|
||||
}
|
||||
|
||||
void setCoordinate(int index, Coordinate coordinate) {
|
||||
points[2 * index] = coordinate.x;
|
||||
points[2 * index + 1] = coordinate.y;
|
||||
void setCoordinate(int index, PointCollection coordinate) {
|
||||
points[2 * index] = coordinate.getX(index);
|
||||
points[2 * index + 1] = coordinate.getY(index);
|
||||
if ( hasZValues() ) {
|
||||
zValues[index] = coordinate.z;
|
||||
zValues[index] = coordinate.getZ(index);
|
||||
}
|
||||
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.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.LogFactory;
|
||||
|
@ -41,6 +44,7 @@ import org.hibernate.spatial.testing.TestData;
|
|||
import org.hibernate.spatial.testing.TestSupport;
|
||||
import org.hibernate.spatial.testing.dialects.sqlserver.SQLServerExpressionTemplate;
|
||||
import org.hibernate.spatial.testing.dialects.sqlserver.SQLServerTestSupport;
|
||||
import org.hibernate.testing.AfterClassOnce;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
@ -54,7 +58,8 @@ public abstract class AbstractConvertorTest extends SpatialFunctionalTestCase {
|
|||
|
||||
private final static TestSupport support = new SQLServerTestSupport();
|
||||
|
||||
private DataSourceUtils dataSourceUtils;
|
||||
protected PointCollectionEquality pointCollectionEquality = new PointCollectionPointEquality();
|
||||
|
||||
|
||||
Map<Integer, Geometry> decodedGeoms;
|
||||
Map<Integer, Object> rawResults;
|
||||
|
@ -79,17 +84,6 @@ public abstract class AbstractConvertorTest extends SpatialFunctionalTestCase {
|
|||
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) {
|
||||
rawResults = dataSourceUtils.rawDbObjects( type.toString() );
|
||||
|
@ -107,7 +101,7 @@ public abstract class AbstractConvertorTest extends SpatialFunctionalTestCase {
|
|||
encodedGeoms = new HashMap<Integer, byte[]>();
|
||||
for ( Integer id : decodedGeoms.keySet() ) {
|
||||
Geometry geom = decodedGeoms.get( id );
|
||||
byte[] bytes = Encoders.encode( geom );
|
||||
byte[] bytes = Encoders.encode(geom);
|
||||
encodedGeoms.put( id, bytes );
|
||||
}
|
||||
}
|
||||
|
@ -125,10 +119,31 @@ public abstract class AbstractConvertorTest extends SpatialFunctionalTestCase {
|
|||
for ( Integer id : decodedGeoms.keySet() ) {
|
||||
Geometry expected = expectedGeoms.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
|
||||
protected Log getLogger() {
|
||||
return LOG;
|
||||
|
|
|
@ -21,17 +21,18 @@
|
|||
|
||||
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.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDialect;
|
||||
import org.hibernate.spatial.jts.mgeom.MCoordinate;
|
||||
import org.hibernate.testing.BeforeClassOnce;
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@RequiresDialect(SqlServer2008SpatialDialect.class)
|
||||
|
@ -65,53 +66,28 @@ public class LineStringConvertorTest extends AbstractConvertorTest {
|
|||
@Test
|
||||
public void test_coordinates() {
|
||||
|
||||
Coordinate[] received = decodedGeoms.get( 5 ).getCoordinates();
|
||||
MCoordinate[] expected = new MCoordinate[] {
|
||||
new MCoordinate( 10.0, 5.0 ),
|
||||
new MCoordinate( 20.0, 15.0 )
|
||||
};
|
||||
assertArrayEquals( received, expected );
|
||||
PointCollection received = decodedGeoms.get( 5 ).getPoints();
|
||||
PointCollection expected = PointSequenceBuilders.fixedSized( 2, DimensionalFlag.XY ).add(10, 5).add(20,15).toPointSequence();
|
||||
assertPointCollectionEquality( received, expected );
|
||||
|
||||
received = decodedGeoms.get( 6 ).getCoordinates();
|
||||
expected = new MCoordinate[] {
|
||||
new MCoordinate( 10.0, 5.0 ),
|
||||
new MCoordinate( 20.0, 15.0 ),
|
||||
new MCoordinate( 30.3, 22.4 ),
|
||||
new MCoordinate( 10.0, 30.0 )
|
||||
};
|
||||
assertArrayEquals( expected, received );
|
||||
received = decodedGeoms.get( 6 ).getPoints();
|
||||
expected = PointSequenceBuilders.fixedSized( 4, DimensionalFlag.XY).add(10,5).add(20,15).add(30.3, 22.4).add(10,30).toPointSequence();
|
||||
assertPointCollectionEquality( received, expected );
|
||||
|
||||
received = decodedGeoms.get( 7 ).getCoordinates();
|
||||
expected = new MCoordinate[] {
|
||||
new MCoordinate( 10.0, 5.0 ),
|
||||
new MCoordinate( 20.0, 15.0 )
|
||||
};
|
||||
expected[0].z = 0;
|
||||
expected[1].z = 3;
|
||||
assertArrayEquals( expected, received );
|
||||
|
||||
received = decodedGeoms.get( 7 ).getPoints();
|
||||
expected = PointSequenceBuilders.fixedSized( 2, DimensionalFlag.XYZ).add(10,5,0).add(20,15,3).toPointSequence();
|
||||
assertPointCollectionEquality( received, expected );
|
||||
|
||||
//case 9
|
||||
received = decodedGeoms.get( 9 ).getCoordinates();
|
||||
expected = new MCoordinate[] {
|
||||
new MCoordinate( 10, 5 ),
|
||||
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 );
|
||||
received = decodedGeoms.get( 9 ).getPoints();
|
||||
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();
|
||||
assertPointCollectionEquality( received, expected );
|
||||
|
||||
//case 10
|
||||
received = decodedGeoms.get( 10 ).getCoordinates();
|
||||
expected[0].m = 1;
|
||||
expected[1].m = 3;
|
||||
expected[2].m = 10;
|
||||
expected[3].m = 12;
|
||||
assertArrayEquals( expected, received );
|
||||
|
||||
received = decodedGeoms.get( 10 ).getPoints();
|
||||
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();
|
||||
assertPointCollectionEquality( received, expected );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -21,12 +21,12 @@
|
|||
|
||||
package org.hibernate.spatial.dialect.sqlserver.convertors;
|
||||
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.Point;
|
||||
import org.geolatte.geom.Point;
|
||||
import org.geolatte.geom.Points;
|
||||
import org.geolatte.geom.crs.CrsId;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDialect;
|
||||
import org.hibernate.spatial.jts.mgeom.MCoordinate;
|
||||
import org.hibernate.testing.BeforeClassOnce;
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class PointConvertorTest extends AbstractConvertorTest {
|
|||
|
||||
@Test
|
||||
public void test_verify_srid() {
|
||||
assertEquals( 0, decodedGeoms.get( 1 ).getSRID() );
|
||||
assertEquals( -1, decodedGeoms.get( 1 ).getSRID() );
|
||||
assertEquals( 4326, decodedGeoms.get( 2 ).getSRID() );
|
||||
assertEquals( 31370, decodedGeoms.get( 3 ).getSRID() );
|
||||
}
|
||||
|
@ -62,16 +62,15 @@ public class PointConvertorTest extends AbstractConvertorTest {
|
|||
|
||||
@Test
|
||||
public void test_coordinates() {
|
||||
Coordinate expected;
|
||||
Coordinate received;
|
||||
expected = new Coordinate( 10.0, 5.0 );
|
||||
assertEquals( expected, decodedGeoms.get( 1 ).getCoordinate() );
|
||||
expected = new Coordinate( 52.25, 2.53 );
|
||||
assertEquals( expected, decodedGeoms.get( 2 ).getCoordinate() );
|
||||
expected = new Coordinate( 150000.0, 200000.0 );
|
||||
assertEquals( expected, decodedGeoms.get( 3 ).getCoordinate() );
|
||||
expected = new MCoordinate( 10.0, 2.0, 1.0, 3.0 );
|
||||
assertEquals( expected, decodedGeoms.get( 4 ).getCoordinate() );
|
||||
Point expected;
|
||||
expected = Points.create( 10.0, 5.0);
|
||||
assertEquals( expected, decodedGeoms.get( 1 ).getPointN(0) );
|
||||
expected = Points.create(52.25, 2.53, CrsId.valueOf(4326));
|
||||
assertEquals( expected, decodedGeoms.get( 2 ).getPointN( 0 ) );
|
||||
expected = Points.create(150000.0, 200000.0, CrsId.valueOf(31370));
|
||||
assertEquals( expected, decodedGeoms.get( 3 ).getPointN( 0 ) );
|
||||
expected = Points.create(10.0, 2.0, 1.0, 3.0, CrsId.valueOf(4326));
|
||||
assertEquals( expected, decodedGeoms.get( 4 ).getPointN( 0 ) );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -21,32 +21,21 @@
|
|||
|
||||
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.geolatte.geom.Geometry;
|
||||
import org.geolatte.geom.codec.Wkt;
|
||||
import org.geolatte.geom.codec.WktDecodeException;
|
||||
import org.geolatte.geom.codec.WktDecoder;
|
||||
import org.geolatte.geom.jts.JTS;
|
||||
|
||||
import org.hibernate.spatial.Log;
|
||||
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>
|
||||
*
|
||||
|
@ -221,8 +210,7 @@ public class DataSourceUtils {
|
|||
cn.commit();
|
||||
stmt.close();
|
||||
LOG.info( "Loaded " + sum( insCounts ) + " rows." );
|
||||
}
|
||||
finally {
|
||||
}finally {
|
||||
try {
|
||||
if ( cn != null ) {
|
||||
cn.close();
|
||||
|
@ -363,7 +351,9 @@ public class DataSourceUtils {
|
|||
for ( TestDataElement testDataElement : testData ) {
|
||||
if ( testDataElement.type.equalsIgnoreCase( type ) ) {
|
||||
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 ) {
|
||||
System.out
|
||||
|
|
|
@ -36,12 +36,18 @@ import org.hibernate.spatial.jts.mgeom.MCoordinate;
|
|||
public class GeometryEquality {
|
||||
|
||||
public boolean test(Geometry geom1, Geometry geom2) {
|
||||
return test( geom1, geom2, false );
|
||||
}
|
||||
|
||||
private boolean test(Geometry geom1, Geometry geom2, boolean ignoreSRID) {
|
||||
if ( geom1 == null ) {
|
||||
return geom2 == null;
|
||||
}
|
||||
if ( geom1.isEmpty() ) {
|
||||
return geom2.isEmpty() && equalSRID( geom1, geom2 );
|
||||
return geom2.isEmpty();
|
||||
}
|
||||
if (!ignoreSRID && !equalSRID(geom1, geom2)) return false;
|
||||
|
||||
if ( geom1 instanceof GeometryCollection ) {
|
||||
if ( !( geom2 instanceof GeometryCollection ) ) {
|
||||
return false;
|
||||
|
@ -51,7 +57,7 @@ public class GeometryEquality {
|
|||
for ( int partIndex = 0; partIndex < expectedCollection.getNumGeometries(); partIndex++ ) {
|
||||
Geometry partExpected = expectedCollection.getGeometryN( partIndex );
|
||||
Geometry partReceived = receivedCollection.getGeometryN( partIndex );
|
||||
if ( !test( partExpected, partReceived ) ) {
|
||||
if ( !test( partExpected, partReceived, true ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +77,7 @@ public class GeometryEquality {
|
|||
*/
|
||||
private boolean equalSRID(Geometry geom1, Geometry geom2) {
|
||||
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) {
|
||||
//return geom1.equals(geom2);
|
||||
return testTypeAndVertexEquality( geom1, geom2 ) && equalSRID( geom1, geom2 );
|
||||
return testTypeAndVertexEquality( geom1, 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.Point;
|
||||
import org.geolatte.geom.jts.JTS;
|
||||
|
||||
import org.hibernate.spatial.dialect.sqlserver.convertors.Decoders;
|
||||
import org.hibernate.spatial.testing.AbstractExpectationsFactory;
|
||||
|
@ -141,7 +142,7 @@ public class SqlServerExpectationsFactory extends AbstractExpectationsFactory {
|
|||
|
||||
@Override
|
||||
protected Geometry decode(Object o) {
|
||||
return Decoders.decode( (byte[]) o );
|
||||
return JTS.to( Decoders.decode( (byte[]) o ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -30,10 +30,10 @@ hibernate.show_sql false
|
|||
|
||||
hibernate.max_fetch_depth 5
|
||||
|
||||
hibernate.dialect org.hibernate.dialect.H2Dialect
|
||||
hibernate.connection.driver_class org.h2.Driver
|
||||
hibernate.connection.url jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE
|
||||
hibernate.connection.username sa
|
||||
#hibernate.dialect org.hibernate.dialect.H2Dialect
|
||||
#hibernate.connection.driver_class org.h2.Driver
|
||||
#hibernate.connection.url jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE
|
||||
#hibernate.connection.username sa
|
||||
|
||||
#hibernate.cache.region_prefix hibernate.test
|
||||
#hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFactory
|
||||
|
@ -58,12 +58,12 @@ hibernate.connection.username sa
|
|||
#hibernate.connection.password hbs
|
||||
|
||||
|
||||
#hibernate.dialect org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDialect
|
||||
#hibernate.connection.driver_class com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
#hibernate.connection.url jdbc:sqlserver://192.168.0.100:1433;databaseName=HBS
|
||||
#hibernate.connection.username hbs
|
||||
#hibernate.connection.password hbs
|
||||
#hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFactory
|
||||
hibernate.dialect org.hibernate.spatial.dialect.sqlserver.SqlServer2008SpatialDialect
|
||||
hibernate.connection.driver_class com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
hibernate.connection.url jdbc:sqlserver://sqlserver.geovise.com:1433;databaseName=HBS
|
||||
hibernate.connection.username hbs
|
||||
hibernate.connection.password hbs
|
||||
|
||||
|
||||
##
|
||||
## MySQL 5 dialects
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# $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
|
||||
jdbcUser = hbs
|
||||
jdbcPass = hbs
|
||||
|
|
|
@ -255,43 +255,43 @@
|
|||
<id>50</id>
|
||||
<type>POINT</type>
|
||||
<wkt>POINT EMPTY</wkt>
|
||||
<srid>4326</srid>
|
||||
<srid>0</srid>
|
||||
</Element>
|
||||
<Element>
|
||||
<id>51</id>
|
||||
<type>LINESTRING</type>
|
||||
<wkt>LINESTRING EMPTY</wkt>
|
||||
<srid>4326</srid>
|
||||
<srid>0</srid>
|
||||
</Element>
|
||||
<Element>
|
||||
<id>52</id>
|
||||
<type>POLYGON</type>
|
||||
<wkt>POLYGON EMPTY</wkt>
|
||||
<srid>4326</srid>
|
||||
<srid>0</srid>
|
||||
</Element>
|
||||
<Element>
|
||||
<id>53</id>
|
||||
<type>MULTIPOINT</type>
|
||||
<wkt>MULTIPOINT EMPTY</wkt>
|
||||
<srid>4326</srid>
|
||||
<srid>0</srid>
|
||||
</Element>
|
||||
<Element>
|
||||
<id>54</id>
|
||||
<type>MULTILINESTRING</type>
|
||||
<wkt>MULTILINESTRING EMPTY</wkt>
|
||||
<srid>4326</srid>
|
||||
<srid>0</srid>
|
||||
</Element>
|
||||
<Element>
|
||||
<id>55</id>
|
||||
<type>MULTIPOLYGON</type>
|
||||
<wkt>MULTIPOLYGON EMPTY</wkt>
|
||||
<srid>4326</srid>
|
||||
<srid>0</srid>
|
||||
</Element>
|
||||
<Element>
|
||||
<id>56</id>
|
||||
<type>GEOMETRYCOLLECTION</type>
|
||||
<wkt>GEOMETRYCOLLECTION EMPTY</wkt>
|
||||
<srid>4326</srid>
|
||||
<srid>0</srid>
|
||||
</Element>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue