]> granicus.if.org Git - postgis/commitdiff
Added getbox2d_internal
authorSandro Santilli <strk@keybit.net>
Thu, 16 Sep 2004 09:05:10 +0000 (09:05 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 16 Sep 2004 09:05:10 +0000 (09:05 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@824 b70326c6-7e19-0410-871a-916f4a2858ee

lwgeom/lwgeom.h
lwgeom/lwgeom_api.c

index a3c217163959fb44cf0043a5cfeabe9b52119d1d..5ca6b387618e1c1d73638a4a437a5ddd37cef108 100644 (file)
@@ -542,10 +542,17 @@ extern BOX3D *combine_boxes(BOX3D *b1, BOX3D *b2);
 // otherwise we need to compute it.
 // WARNING! the EMPTY geom will result in a random BOX2D returned
 extern BOX2DFLOAT4 getbox2d(char *serialized_form);
+
 // this function writes to 'box' and returns 0 if serialized_form
 // does not have a bounding box (empty geom)
 extern int getbox2d_p(char *serialized_form, BOX2DFLOAT4 *box);
 
+// this function returns a pointer to the 'internal' bounding
+// box of a serialized-form geometry. If the geometry does
+// not have an embedded bounding box the function returns NULL.
+// READ-ONLY!
+extern const BOX2DFLOAT4 * getbox2d_internal(char *serialized_form);
+
 // Expand given box of 'd' units in all directions 
 void expand_box2d(BOX2DFLOAT4 *box, double d);
 void expand_box3d(BOX3D *box, double d);
index 45582b1867324a5a2fa8d750614ae3c1597d9c33..e134c9ce643c1d87792a66dd747c5ec2014f2c00 100644 (file)
@@ -374,7 +374,6 @@ BOX2DFLOAT4 getbox2d(char *serialized_form)
        return result;
 }
 
-
 // same as getbox2d, but modifies box instead of returning result on the stack
 int
 getbox2d_p(char *serialized_form, BOX2DFLOAT4 *box)
@@ -409,6 +408,21 @@ getbox2d_p(char *serialized_form, BOX2DFLOAT4 *box)
        return 1;
 }
 
+// this function returns a pointer to the 'internal' bounding
+// box of a serialized-form geometry. If the geometry does
+// not have an embedded bounding box the function returns NULL.
+// READ-ONLY!
+const BOX2DFLOAT4 *
+getbox2d_internal(char *serialized_form)
+{
+       unsigned char type = (unsigned char) serialized_form[0];
+
+       // No embedded bounding box ...
+       if (!lwgeom_hasBBOX(type)) return NULL;
+
+       return (BOX2DFLOAT4 *)(serialized_form+1);
+}
+
 //************************************************************************
 // POINTARRAY support functions