Remove *_compute_box2d* functions that are now orphans.

git-svn-id: http://svn.osgeo.org/postgis/trunk@8006 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Paul Ramsey 2011-10-26 22:36:22 +00:00
parent 7203d4e0d2
commit b38b09da0e
9 changed files with 1 additions and 170 deletions

View file

@ -1439,15 +1439,6 @@ extern void lwpoly_reverse(LWPOLY *poly);
extern void lwtriangle_reverse(LWTRIANGLE *triangle);
extern char* lwgeom_summary(const LWGEOM *lwgeom, int offset);
extern const char *lwtype_name(uint8_t type);
extern int ptarray_compute_box2d_p(const POINTARRAY *pa, BOX2DFLOAT4 *result);
extern BOX2DFLOAT4 *ptarray_compute_box2d(const POINTARRAY *pa);
extern int lwpoint_compute_box2d_p(const LWPOINT *point, BOX2DFLOAT4 *box);
extern int lwline_compute_box2d_p(const LWLINE *line, BOX2DFLOAT4 *box);
extern int lwpoly_compute_box2d_p(const LWPOLY *poly, BOX2DFLOAT4 *box);
extern int lwtriangle_compute_box2d_p(const LWTRIANGLE *triangle, BOX2DFLOAT4 *box);
extern int lwcollection_compute_box2d_p(const LWCOLLECTION *col, BOX2DFLOAT4 *box);
extern int lwcircstring_compute_box2d_p(const LWCIRCSTRING *curve, BOX2DFLOAT4 *box);
extern BOX2DFLOAT4* lwgeom_compute_box2d(const LWGEOM *lwgeom);
extern char* lwpoint_to_latlon(const LWPOINT *p, const char *format);
extern int lwline_is_closed(const LWLINE *line);
extern int lwcircstring_is_closed(const LWCIRCSTRING *curve);
@ -1471,7 +1462,7 @@ extern BOX2DFLOAT4 *box2d_union(BOX2DFLOAT4 *b1, BOX2DFLOAT4 *b2);
/* args may overlap ! */
extern int box2d_union_p(BOX2DFLOAT4 *b1, BOX2DFLOAT4 *b2, BOX2DFLOAT4 *ubox);
extern int lwgeom_compute_box2d_p(const LWGEOM *lwgeom, BOX2DFLOAT4 *box);
void lwgeom_longitude_shift(LWGEOM *lwgeom);

View file

@ -524,17 +524,6 @@ lwcircstring_compute_box3d(const LWCIRCSTRING *curve)
}
int
lwcircstring_compute_box2d_p(const LWCIRCSTRING *curve, BOX2DFLOAT4 *result)
{
BOX3D *box = lwcircstring_compute_box3d(curve);
LWDEBUG(2, "lwcircstring_compute_box2d_p called.");
if (box == NULL) return 0;
box3d_to_box2df_p(box, result);
return 1;
}
void lwcircstring_free(LWCIRCSTRING *curve)
{
if ( curve->bbox )

View file

@ -246,24 +246,6 @@ lwcollection_serialize_buf(LWCOLLECTION *coll, uint8_t *buf, size_t *retsize)
LWDEBUG(3, "lwcollection_serialize_buf returning");
}
int
lwcollection_compute_box2d_p(const LWCOLLECTION *col, BOX2DFLOAT4 *box)
{
BOX2DFLOAT4 boxbuf;
uint32_t i;
if ( ! col->ngeoms ) return 0;
if ( ! lwgeom_compute_box2d_p(col->geoms[0], box) ) return 0;
for (i=1; i<col->ngeoms; i++)
{
if ( ! lwgeom_compute_box2d_p(col->geoms[i], &boxbuf) )
return 0;
if ( ! box2d_union_p(box, &boxbuf, box) )
return 0;
}
return 1;
}
/**
* @brief Clone #LWCOLLECTION object. #POINTARRAY are not copied.
* Bbox is cloned if present in input.

View file

@ -273,54 +273,6 @@ BOX3D *lwgeom_compute_box3d(const LWGEOM *lwgeom)
}
int
lwgeom_compute_box2d_p(const LWGEOM *lwgeom, BOX2DFLOAT4 *buf)
{
LWDEBUGF(2, "lwgeom_compute_box2d_p called of %p of type %s.",
lwgeom, lwtype_name(lwgeom->type));
switch (lwgeom->type)
{
case POINTTYPE:
return lwpoint_compute_box2d_p((LWPOINT *)lwgeom, buf);
case LINETYPE:
return lwline_compute_box2d_p((LWLINE *)lwgeom, buf);
case CIRCSTRINGTYPE:
return lwcircstring_compute_box2d_p((LWCIRCSTRING *)lwgeom, buf);
case POLYGONTYPE:
return lwpoly_compute_box2d_p((LWPOLY *)lwgeom, buf);
case TRIANGLETYPE:
return lwtriangle_compute_box2d_p((LWTRIANGLE *)lwgeom, buf);
case COMPOUNDTYPE:
case CURVEPOLYTYPE:
case MULTIPOINTTYPE:
case MULTILINETYPE:
case MULTICURVETYPE:
case MULTIPOLYGONTYPE:
case MULTISURFACETYPE:
case POLYHEDRALSURFACETYPE:
case TINTYPE:
case COLLECTIONTYPE:
return lwcollection_compute_box2d_p((LWCOLLECTION *)lwgeom, buf);
}
return 0;
}
/**
* do not forget to lwfree() result
*/
BOX2DFLOAT4*
lwgeom_compute_box2d(const LWGEOM *lwgeom)
{
BOX2DFLOAT4 *result = lwalloc(sizeof(BOX2DFLOAT4));
if ( lwgeom_compute_box2d_p(lwgeom, result) ) return result;
else
{
lwfree(result);
return NULL;
}
}
LWPOINT *
lwgeom_as_lwpoint(const LWGEOM *lwgeom)
{

View file

@ -325,12 +325,6 @@ void printLWLINE(LWLINE *line)
lwnotice("}");
}
int
lwline_compute_box2d_p(const LWLINE *line, BOX2DFLOAT4 *box)
{
return ptarray_compute_box2d_p(line->points, box);
}
/* @brief Clone LWLINE object. Serialized point lists are not copied.
*
* @see ptarray_clone

View file

@ -392,12 +392,6 @@ void printLWPOINT(LWPOINT *point)
lwnotice("}");
}
int
lwpoint_compute_box2d_p(const LWPOINT *point, BOX2DFLOAT4 *box)
{
return ptarray_compute_box2d_p(point->point, box);
}
/* @brief Clone LWPOINT object. Serialized point lists are not copied.
*
* @see ptarray_clone

View file

@ -429,24 +429,6 @@ void printLWPOLY(LWPOLY *poly)
lwnotice("}");
}
int
lwpoly_compute_box2d_p(const LWPOLY *poly, BOX2DFLOAT4 *box)
{
BOX2DFLOAT4 boxbuf;
uint32_t i;
if ( ! poly->nrings ) return 0;
if ( ! ptarray_compute_box2d_p(poly->rings[0], box) ) return 0;
for (i=1; i<poly->nrings; i++)
{
if ( ! ptarray_compute_box2d_p(poly->rings[0], &boxbuf) )
return 0;
if ( ! box2d_union_p(box, &boxbuf, box) )
return 0;
}
return 1;
}
/* @brief Clone LWLINE object. Serialized point lists are not copied.
*
* @see ptarray_clone

View file

@ -332,12 +332,6 @@ void printLWTRIANGLE(LWTRIANGLE *triangle)
lwnotice("}");
}
int
lwtriangle_compute_box2d_p(const LWTRIANGLE *triangle, BOX2DFLOAT4 *box)
{
return ptarray_compute_box2d_p(triangle->points, box);
}
/* @brief Clone LWTRIANGLE object. Serialized point lists are not copied.
*
* @see ptarray_clone

View file

@ -322,53 +322,6 @@ ptarray_flip_coordinates(POINTARRAY *pa)
}
/**
* @brief calculate the 2d bounding box of a set of points
* write result to the provided BOX2DFLOAT4
* Return 0 if bounding box is NULL (empty geom)
*/
int
ptarray_compute_box2d_p(const POINTARRAY *pa, BOX2DFLOAT4 *result)
{
BOX3D box3d;
/* Note: we perform the calculation using BOX3D and then
convert to BOX2DFLOAT4 to prevent cumulative floating
point rounding errors when calculating using BOX2DFLOAT4
directly. */
if (pa->npoints == 0) return 0;
ptarray_compute_box3d_p(pa, &box3d);
box3d_to_box2df_p(&box3d, result);
return 1;
}
/**
* @brief Calculate the 2d bounding box of a set of points.
* @return allocated #BOX2DFLOAT4 or NULL (for empty array).
*/
BOX2DFLOAT4 *
ptarray_compute_box2d(const POINTARRAY *pa)
{
BOX3D box3d;
BOX2DFLOAT4 *result;
/* Note: we perform the calculation using BOX3D and then
convert to BOX2DFLOAT4 to prevent cumulative floating
point rounding errors when calculating using BOX2DFLOAT4
directly. */
result = lwalloc(sizeof(BOX2DFLOAT4));
ptarray_compute_box3d_p(pa, &box3d);
box3d_to_box2df_p(&box3d, result);
return result;
}
/**
* @brief Returns a modified #POINTARRAY so that no segment is
* longer than the given distance (computed using 2d).