Index: jdbc2/src/org/postgis/ComposedGeom.java
===================================================================
RCS file: /home/cvs/postgis/postgis/jdbc2/src/org/postgis/ComposedGeom.java,v
retrieving revision 1.7
diff -u -r1.7 ComposedGeom.java
--- jdbc2/src/org/postgis/ComposedGeom.java	28 Jul 2005 12:23:16 -0000	1.7
+++ jdbc2/src/org/postgis/ComposedGeom.java	16 Jan 2006 17:55:29 -0000
@@ -262,4 +262,10 @@
             return false;
         }
     }
+    
+    public void addToBBox(PGboxbase box) {
+        for (int i = 0; i < subgeoms.length; i++) {
+            subgeoms[i].addToBBox(box);
+        }
+    }
 }
Index: jdbc2/src/org/postgis/Geometry.java
===================================================================
RCS file: /home/cvs/postgis/postgis/jdbc2/src/org/postgis/Geometry.java,v
retrieving revision 1.7
diff -u -r1.7 Geometry.java
--- jdbc2/src/org/postgis/Geometry.java	28 Jul 2005 12:23:16 -0000	1.7
+++ jdbc2/src/org/postgis/Geometry.java	16 Jan 2006 17:55:29 -0000
@@ -164,7 +164,7 @@
     protected abstract boolean equalsintern(Geometry other);
 
     /**
-     * Return the number of Points of the geometry
+     * Return the number of Points / Vertices of the geometry
      */
     public abstract int numPoints();
 
@@ -313,4 +313,12 @@
             return value;
         }
     }
+    
+    public PGbox2d getBBox() {
+        PGbox2d box = PGbox2d.getEmptyBBox();
+        addToBBox(box);
+        return box;
+    }
+    
+    public abstract void addToBBox(PGboxbase box);
 }
Index: jdbc2/src/org/postgis/PGbox2d.java
===================================================================
RCS file: /home/cvs/postgis/postgis/jdbc2/src/org/postgis/PGbox2d.java,v
retrieving revision 1.5
diff -u -r1.5 PGbox2d.java
--- jdbc2/src/org/postgis/PGbox2d.java	15 Apr 2005 14:04:34 -0000	1.5
+++ jdbc2/src/org/postgis/PGbox2d.java	16 Jan 2006 17:55:29 -0000
@@ -63,4 +63,9 @@
     protected PGboxbase newInstance() {
         return new PGbox2d();
     }
+
+    public static PGbox2d getEmptyBBox() {
+        return new PGbox2d(new Point(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY),
+                new Point(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY));
+    }
 }
Index: jdbc2/src/org/postgis/PGbox3d.java
===================================================================
RCS file: /home/cvs/postgis/postgis/jdbc2/src/org/postgis/PGbox3d.java,v
retrieving revision 1.6
diff -u -r1.6 PGbox3d.java
--- jdbc2/src/org/postgis/PGbox3d.java	15 Apr 2005 14:04:34 -0000	1.6
+++ jdbc2/src/org/postgis/PGbox3d.java	16 Jan 2006 17:55:29 -0000
@@ -56,4 +56,11 @@
     protected PGboxbase newInstance() {
         return new PGbox3d();
     }
+
+    public static PGbox2d getEmptyBBox() {
+        return new PGbox2d(new Point(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY,
+                Double.POSITIVE_INFINITY), new Point(Double.NEGATIVE_INFINITY,
+                Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY));
+    }
+
 }
Index: jdbc2/src/org/postgis/PGboxbase.java
===================================================================
RCS file: /home/cvs/postgis/postgis/jdbc2/src/org/postgis/PGboxbase.java,v
retrieving revision 1.7
diff -u -r1.7 PGboxbase.java
--- jdbc2/src/org/postgis/PGboxbase.java	15 Apr 2005 14:04:34 -0000	1.7
+++ jdbc2/src/org/postgis/PGboxbase.java	16 Jan 2006 17:55:29 -0000
@@ -171,4 +171,27 @@
      * callers in a sane way.
      */
     protected abstract PGboxbase newInstance();
+    
+    public void expandBy(Point p) {
+        if (p.x > llb.x) {
+            llb.x = p.x;
+        }
+        if (p.x < urt.x) {
+            urt.x = p.x;
+        }
+        if (p.dimension==1) return;
+        if (p.y > llb.y) {
+            llb.y = p.y;
+        }
+        if (p.y < urt.y) {
+            urt.y = p.y;
+        }
+        if (p.dimension==2) return;
+        if (p.z > llb.z) {
+            llb.z = p.z;
+        }
+        if (p.z < urt.z) {
+            urt.z = p.z;
+        }        
+    }
 }
Index: jdbc2/src/org/postgis/Point.java
===================================================================
RCS file: /home/cvs/postgis/postgis/jdbc2/src/org/postgis/Point.java,v
retrieving revision 1.11
diff -u -r1.11 Point.java
--- jdbc2/src/org/postgis/Point.java	16 Nov 2005 13:04:30 -0000	1.11
+++ jdbc2/src/org/postgis/Point.java	16 Jan 2006 17:55:30 -0000
@@ -285,4 +285,8 @@
         return super.checkConsistency() && (this.dimension == 3 || this.z == 0.0)
                 && (this.haveMeasure || this.m == 0.0);
     }
+
+    public void addToBBox(PGboxbase box) {
+        box.expandBy(this);        
+    }
 }
