Added PGbox3d accessors for LLB and URB. Added PGgeometry update to

account for SRIDs when they are present in the WKT. Submitted by
Rueben Schultz.


git-svn-id: http://svn.osgeo.org/postgis/trunk@204 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Paul Ramsey 2002-10-24 15:53:42 +00:00
parent d80dce00bd
commit 808dcb728b
2 changed files with 34 additions and 6 deletions

View file

@ -3,18 +3,24 @@ package org.postgis;
import org.postgresql.util.*;
import java.sql.*;
/*
* Updates Oct 2002
* - data members made private
* - getLLB() and getURT() methods added
*/
public class PGbox3d extends PGobject
{
/**
* The lower left bottom corner of the box.
*/
Point llb;
private Point llb;
/**
* The upper right top corner of the box.
*/
Point urt;
private Point urt;
public PGbox3d() {}
@ -48,11 +54,20 @@ public class PGbox3d extends PGobject
return getValue();
}
public Object clone()
{
public Object clone() {
PGbox3d obj = new PGbox3d(llb,urt);
obj.setType(type);
return obj;
}
/**Returns the lower left bottom corner of the box as a Point object*/
public Point getLLB() {
return llb;
}
/**Returns the upper right top corner of the box as a Point object*/
public Point getURT() {
return urt;
}
}

View file

@ -1,17 +1,24 @@
package org.postgis;
import org.postgresql.util.PGobject;
import org.postgresql.util.PGtokenizer;
import java.sql.*;
/*
* Updates Oct 2002
* - setValue() method now cheaks if the geometry has a SRID. If present,
* it is removed and only the wkt is used to create the new geometry
*/
public class PGgeometry extends PGobject
{
Geometry geom;
public PGgeometry() {}
public PGgeometry() { }
public PGgeometry(Geometry geom) {
this.geom = geom;
this.geom = geom;
}
public PGgeometry(String value) throws SQLException
@ -22,6 +29,12 @@ public class PGgeometry extends PGobject
public void setValue(String value) throws SQLException
{
value = value.trim();
if( value.startsWith("SRID")) {
//break up geometry into srid and wkt
PGtokenizer t = new PGtokenizer(value,';');
value = t.getToken(1);
}
if( value.startsWith("MULTIPOLYGON")) {
geom = new MultiPolygon(value);
} else if( value.startsWith("MULTILINESTRING")) {