]> granicus.if.org Git - postgis/commitdiff
Added PGbox3d accessors for LLB and URB. Added PGgeometry update to
authorPaul Ramsey <pramsey@cleverelephant.ca>
Thu, 24 Oct 2002 15:53:42 +0000 (15:53 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Thu, 24 Oct 2002 15:53:42 +0000 (15:53 +0000)
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

jdbc/org/postgis/PGbox3d.java
jdbc/org/postgis/PGgeometry.java

index c169d539070c2b061f1fc655431fd9193e6a8086..73f632182d3d64f32bc9aef5ba317b1a2b71d4ce 100644 (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;
+       }
+       
 }
index 08f59bf72466f69cc6cce7126bb6e8b4f62ed5b9..95e6d7c00311fb15bf2353778769f2da6615843c 100644 (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")) {