Subversion Repositories hibernate-spatial

Compare Revisions

Ignore whitespace Rev 94 → Rev 93

/trunk/hibernate-spatial-postgis/src/test/java/org/hibernatespatial/postgis/test/TestPostgisCRUD.java
62,17 → 62,6
public void testSaveNullLineStringEntity() throws Exception {
delegate.testSaveNullLineStringEntity();
}
@Test
public void testSave3DPointEntity() throws Exception{
delegate.testSavePoint(3);
}
@Test
public void testSave3DLineStringEntity() throws Exception{
delegate.testSaveLineStringEntity(3);
}
 
public static junit.framework.Test suite() {
return new JUnit4TestAdapter(TestPostgisCRUD.class);
/trunk/hibernate-spatial-postgis/src/main/java/org/hibernatespatial/postgis/PGGeometryUserType.java
128,19 → 128,11
Point ll = box.getLLB();
Point ur = box.getURT();
Coordinate[] ringCoords = new Coordinate[5];
if (box instanceof org.postgis.PGbox2d){
ringCoords[0] = new Coordinate(ll.x, ll.y);
ringCoords[1] = new Coordinate(ur.x, ll.y);
ringCoords[2] = new Coordinate(ur.x, ur.y);
ringCoords[3] = new Coordinate(ll.x, ur.y);
ringCoords[4] = new Coordinate(ll.x, ll.y);
} else {
ringCoords[0] = new Coordinate(ll.x, ll.y, ll.z);
ringCoords[1] = new Coordinate(ur.x, ll.y, ll.z);
ringCoords[2] = new Coordinate(ur.x, ur.y, ur.z);
ringCoords[3] = new Coordinate(ll.x, ur.y, ur.z);
ringCoords[4] = new Coordinate(ll.x, ll.y, ll.z);
}
ringCoords[0] = new Coordinate(ll.x, ll.y);
ringCoords[1] = new Coordinate(ur.x, ll.y);
ringCoords[2] = new Coordinate(ur.x, ur.y);
ringCoords[3] = new Coordinate(ll.x, ur.y);
ringCoords[4] = new Coordinate(ll.x, ll.y);
com.vividsolutions.jts.geom.LinearRing shell = getGeometryFactory()
.createLinearRing(ringCoords);
return getGeometryFactory().createPolygon(shell, null);
224,12 → 216,8
}
 
protected com.vividsolutions.jts.geom.Point convertPoint(Point pnt) {
com.vividsolutions.jts.geom.Point g;
if(new Double(pnt.z).isNaN()) {
g = getGeometryFactory().createPoint(new Coordinate(pnt.x, pnt.y));
}else {
g = getGeometryFactory().createPoint(new Coordinate(pnt.x, pnt.y,pnt.z));
}
com.vividsolutions.jts.geom.Point g = getGeometryFactory()
.createPoint(new Coordinate(pnt.x, pnt.y));
g.setSRID(pnt.getSrid());
return g;
}
246,11 → 234,7
Point[] points) {
Coordinate[] coordinates = new Coordinate[points.length];
for (int i = 0; i < points.length; i++) {
if(new Double(points[i].z).isNaN()) {
coordinates[i] = new Coordinate(points[i].x, points[i].y);
}else {
coordinates[i] = new Coordinate(points[i].x, points[i].y,points[i].z);
}
coordinates[i] = new Coordinate(points[i].x, points[i].y);
}
return coordinates;
}
258,11 → 242,7
private Point[] toPoints(Coordinate[] coordinates) {
Point[] points = new Point[coordinates.length];
for (int i = 0; i < coordinates.length; i++) {
if(new Double(coordinates[i].z).isNaN()) {
points[i] = new Point(coordinates[i].x, coordinates[i].y);
}else {
points[i] = new Point(coordinates[i].x, coordinates[i].y,coordinates[i].z);
}
points[i] = new Point(coordinates[i].x, coordinates[i].y);
}
return points;
}
373,13 → 353,8
pgPoint.srid = point.getSRID();
pgPoint.x = point.getX();
pgPoint.y = point.getY();
if(new Double(point.getCoordinate().z).isNaN()) {
pgPoint.dimension = 2;
}else {
pgPoint.z = point.getCoordinate().z;
pgPoint.dimension = 3;
}
pgPoint.haveMeasure = false;
pgPoint.dimension = 2;
return pgPoint;
}