]> granicus.if.org Git - postgis/commitdiff
Remove compute_serialized_box3d
authorPaul Ramsey <pramsey@cleverelephant.ca>
Thu, 27 Oct 2011 19:23:19 +0000 (19:23 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Thu, 27 Oct 2011 19:23:19 +0000 (19:23 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@8017 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/liblwgeom.h.in
liblwgeom/lwgeom_api.c

index 45179e5e4be857ff856bb2dea658bea51c062189..e39568745eab2ede2829c036f8259247cacc3009 100644 (file)
@@ -836,13 +836,6 @@ extern int  lwgeom_getType(uint8_t type); /* returns the tttt value */
 extern uint8_t lwgeom_makeType(char hasZ, char hasM, char has_srid, int type);
 extern uint8_t lwgeom_makeType_full(char hasZ, char hasM, char has_srid, int type, char hasBBOX);
 
-/*
- * Compute bbox of serialized geom
- */
-extern BOX3D *compute_serialized_box3d(uint8_t *serialized_form);
-extern int compute_serialized_box3d_p(uint8_t *serialized_form, BOX3D *box);
-
-
 /*
  * This function computes the size in bytes
  * of the serialized geometries.
index a2ba191756fd56669c7fe1849c059beb56aba9c4..a9385083769f6b8233a63cf53ff2c68f3f70826b 100644 (file)
@@ -1553,143 +1553,6 @@ lwgeom_size_subgeom(const uint8_t *serialized_form, int geom_number)
 }
 
 
-int
-compute_serialized_box3d_p(uint8_t *srl, BOX3D *out)
-{
-       BOX3D *box = compute_serialized_box3d(srl);
-       if ( ! box ) return 0;
-       out->xmin = box->xmin;
-       out->ymin = box->ymin;
-       out->zmin = box->zmin;
-       out->xmax = box->xmax;
-       out->ymax = box->ymax;
-       out->zmax = box->zmax;
-       lwfree(box);
-
-       return 1;
-}
-
-
-/**
- * Don't forget to lwfree() result !
- */
-BOX3D *
-compute_serialized_box3d(uint8_t *srl)
-{
-       int type = lwgeom_getType(srl[0]);
-       int t;
-       uint8_t *loc = srl;
-       uint32_t nelems;
-       BOX3D *result;
-       BOX3D b1;
-       int sub_size;
-       char nboxes=0;
-
-       LWDEBUGF(2, "compute_serialized_box3d called on type %d", type);
-
-       loc += 1; /* Move past the 'type' byte. */
-
-       if (lwgeom_hasBBOX(srl[0]))
-       {
-               loc += sizeof(BOX2DFLOAT4); /* Move past the bbox */
-       }
-
-       if (lwgeom_hasSRID(srl[0]) )
-       {
-               loc +=4; /* Move past the SRID */
-       }
-
-       if (type == POINTTYPE)
-       {
-               LWPOINT *pt = lwpoint_deserialize(srl);
-
-               LWDEBUG(3, "compute_serialized_box3d: lwpoint deserialized");
-
-               result = lwpoint_compute_box3d(pt);
-
-               LWDEBUG(3, "compute_serialized_box3d: bbox found");
-
-               lwpoint_free(pt);
-               return result;
-       }
-
-       /*
-       ** For items that have elements (everything except points),
-       ** nelems == 0 => EMPTY geometry
-       */
-       nelems = lw_get_uint32_t(loc);
-       if ( nelems == 0 ) return NULL;
-
-       if (type == LINETYPE)
-       {
-               LWLINE *line = lwline_deserialize(srl);
-               result = lwline_compute_box3d(line);
-               lwline_free(line);
-               return result;
-
-       }
-       else if (type == CIRCSTRINGTYPE)
-       {
-               LWCIRCSTRING *curve = lwcircstring_deserialize(srl);
-               result = lwcircstring_compute_box3d(curve);
-               lwcircstring_free(curve);
-               return result;
-       }
-       else if (type == POLYGONTYPE)
-       {
-               LWPOLY *poly = lwpoly_deserialize(srl);
-               result = lwpoly_compute_box3d(poly);
-               lwpoly_free(poly);
-               return result;
-       }
-       else if (type == TRIANGLETYPE)
-       {
-               LWTRIANGLE *triangle = lwtriangle_deserialize(srl);
-               result = lwtriangle_compute_box3d(triangle);
-               lwtriangle_free(triangle);
-               return result;
-       }
-
-       if ( ! ( type == MULTIPOINTTYPE || type == MULTILINETYPE ||
-                type == MULTIPOLYGONTYPE || type == COLLECTIONTYPE ||
-                type == COMPOUNDTYPE || type == CURVEPOLYTYPE ||
-                type == MULTICURVETYPE || type == MULTISURFACETYPE ||
-                type == POLYHEDRALSURFACETYPE || type == TINTYPE ))
-       {
-               lwnotice("compute_serialized_box3d called on unknown type %d", type);
-               return NULL;
-       }
-
-       loc += 4;
-
-       /* each sub-type */
-       result = NULL;
-       for (t=0; t<nelems; t++)
-       {
-               if ( compute_serialized_box3d_p(loc, &b1) )
-               {
-                       LWDEBUG(3, "Geom %d have box:");
-#if POSTGIS_DEBUG_LEVEL >= 3
-                       printBOX3D(&b1);
-#endif
-
-                       if (result)
-                       {
-                               nboxes += box3d_union_p(result, &b1, result);
-                       }
-                       else
-                       {
-                               result = lwalloc(sizeof(BOX3D));
-                               memcpy(result, &b1, sizeof(BOX3D));
-                       }
-               }
-
-               sub_size = serialized_lwgeom_size(loc);
-               loc += sub_size;
-       }
-
-       return result;
-}
 
 /****************************************************************
  * memory management