PostGIS  2.1.10dev-r@@SVN_REVISION@@
int lwgeom_calculate_gbox_cartesian ( const LWGEOM lwgeom,
GBOX gbox 
)

Calculate the 2-4D bounding box of a geometry.

Z/M coordinates are honored for this calculation, though for curves they are not included in calculations of curvature.

Definition at line 607 of file g_box.c.

References CIRCSTRINGTYPE, COLLECTIONTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, LINETYPE, LW_FAILURE, lwcircstring_calculate_gbox_cartesian(), lwcollection_calculate_gbox_cartesian(), LWDEBUGF, lwerror(), lwline_calculate_gbox_cartesian(), lwpoint_calculate_gbox_cartesian(), lwpoly_calculate_gbox_cartesian(), lwtriangle_calculate_gbox_cartesian(), lwtype_name(), MULTICURVETYPE, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, MULTISURFACETYPE, POINTTYPE, POLYGONTYPE, POLYHEDRALSURFACETYPE, TINTYPE, TRIANGLETYPE, and LWGEOM::type.

Referenced by lwcollection_calculate_gbox_cartesian(), lwgeom_calculate_gbox(), lwgeom_geohash(), lwgeom_to_geojson(), and test_lwgeom_calculate_gbox().

608 {
609  if ( ! lwgeom ) return LW_FAILURE;
610  LWDEBUGF(4, "lwgeom_calculate_gbox got type (%d) - %s", lwgeom->type, lwtype_name(lwgeom->type));
611 
612  switch (lwgeom->type)
613  {
614  case POINTTYPE:
615  return lwpoint_calculate_gbox_cartesian((LWPOINT *)lwgeom, gbox);
616  case LINETYPE:
617  return lwline_calculate_gbox_cartesian((LWLINE *)lwgeom, gbox);
618  case CIRCSTRINGTYPE:
619  return lwcircstring_calculate_gbox_cartesian((LWCIRCSTRING *)lwgeom, gbox);
620  case POLYGONTYPE:
621  return lwpoly_calculate_gbox_cartesian((LWPOLY *)lwgeom, gbox);
622  case TRIANGLETYPE:
623  return lwtriangle_calculate_gbox_cartesian((LWTRIANGLE *)lwgeom, gbox);
624  case COMPOUNDTYPE:
625  case CURVEPOLYTYPE:
626  case MULTIPOINTTYPE:
627  case MULTILINETYPE:
628  case MULTICURVETYPE:
629  case MULTIPOLYGONTYPE:
630  case MULTISURFACETYPE:
632  case TINTYPE:
633  case COLLECTIONTYPE:
634  return lwcollection_calculate_gbox_cartesian((LWCOLLECTION *)lwgeom, gbox);
635  }
636  /* Never get here, please. */
637  lwerror("unsupported type (%d) - %s", lwgeom->type, lwtype_name(lwgeom->type));
638  return LW_FAILURE;
639 }
#define LINETYPE
Definition: liblwgeom.h:61
#define MULTICURVETYPE
Definition: liblwgeom.h:70
static int lwpoint_calculate_gbox_cartesian(LWPOINT *point, GBOX *gbox)
Definition: g_box.c:546
#define POLYGONTYPE
Definition: liblwgeom.h:62
#define CURVEPOLYTYPE
Definition: liblwgeom.h:69
#define COMPOUNDTYPE
Definition: liblwgeom.h:68
#define MULTIPOINTTYPE
Definition: liblwgeom.h:63
static int lwpoly_calculate_gbox_cartesian(LWPOLY *poly, GBOX *gbox)
Definition: g_box.c:564
#define TRIANGLETYPE
Definition: liblwgeom.h:73
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:72
static int lwcollection_calculate_gbox_cartesian(LWCOLLECTION *coll, GBOX *gbox)
Definition: g_box.c:572
#define LW_FAILURE
Definition: liblwgeom.h:54
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:164
#define TINTYPE
Definition: liblwgeom.h:74
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:65
static int lwcircstring_calculate_gbox_cartesian(LWCIRCSTRING *curve, GBOX *gbox)
Definition: g_box.c:515
#define MULTISURFACETYPE
Definition: liblwgeom.h:71
static int lwline_calculate_gbox_cartesian(LWLINE *line, GBOX *gbox)
Definition: g_box.c:552
static int lwtriangle_calculate_gbox_cartesian(LWTRIANGLE *triangle, GBOX *gbox)
Definition: g_box.c:558
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:60
uint8_t type
Definition: liblwgeom.h:352
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:67
#define MULTILINETYPE
Definition: liblwgeom.h:64
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
#define COLLECTIONTYPE
Definition: liblwgeom.h:66

Here is the call graph for this function:

Here is the caller graph for this function: