PostGIS  2.2.7dev-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 648 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().

649 {
650  if ( ! lwgeom ) return LW_FAILURE;
651  LWDEBUGF(4, "lwgeom_calculate_gbox got type (%d) - %s", lwgeom->type, lwtype_name(lwgeom->type));
652 
653  switch (lwgeom->type)
654  {
655  case POINTTYPE:
656  return lwpoint_calculate_gbox_cartesian((LWPOINT *)lwgeom, gbox);
657  case LINETYPE:
658  return lwline_calculate_gbox_cartesian((LWLINE *)lwgeom, gbox);
659  case CIRCSTRINGTYPE:
660  return lwcircstring_calculate_gbox_cartesian((LWCIRCSTRING *)lwgeom, gbox);
661  case POLYGONTYPE:
662  return lwpoly_calculate_gbox_cartesian((LWPOLY *)lwgeom, gbox);
663  case TRIANGLETYPE:
664  return lwtriangle_calculate_gbox_cartesian((LWTRIANGLE *)lwgeom, gbox);
665  case COMPOUNDTYPE:
666  case CURVEPOLYTYPE:
667  case MULTIPOINTTYPE:
668  case MULTILINETYPE:
669  case MULTICURVETYPE:
670  case MULTIPOLYGONTYPE:
671  case MULTISURFACETYPE:
673  case TINTYPE:
674  case COLLECTIONTYPE:
675  return lwcollection_calculate_gbox_cartesian((LWCOLLECTION *)lwgeom, gbox);
676  }
677  /* Never get here, please. */
678  lwerror("unsupported type (%d) - %s", lwgeom->type, lwtype_name(lwgeom->type));
679  return LW_FAILURE;
680 }
#define LINETYPE
Definition: liblwgeom.h:71
#define MULTICURVETYPE
Definition: liblwgeom.h:80
static int lwpoint_calculate_gbox_cartesian(LWPOINT *point, GBOX *gbox)
Definition: g_box.c:587
#define POLYGONTYPE
Definition: liblwgeom.h:72
#define CURVEPOLYTYPE
Definition: liblwgeom.h:79
#define COMPOUNDTYPE
Definition: liblwgeom.h:78
#define MULTIPOINTTYPE
Definition: liblwgeom.h:73
static int lwpoly_calculate_gbox_cartesian(LWPOLY *poly, GBOX *gbox)
Definition: g_box.c:605
#define TRIANGLETYPE
Definition: liblwgeom.h:83
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:82
static int lwcollection_calculate_gbox_cartesian(LWCOLLECTION *coll, GBOX *gbox)
Definition: g_box.c:613
#define LW_FAILURE
Definition: liblwgeom.h:64
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:188
#define TINTYPE
Definition: liblwgeom.h:84
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:75
static int lwcircstring_calculate_gbox_cartesian(LWCIRCSTRING *curve, GBOX *gbox)
Definition: g_box.c:556
#define MULTISURFACETYPE
Definition: liblwgeom.h:81
static int lwline_calculate_gbox_cartesian(LWLINE *line, GBOX *gbox)
Definition: g_box.c:593
static int lwtriangle_calculate_gbox_cartesian(LWTRIANGLE *triangle, GBOX *gbox)
Definition: g_box.c:599
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:70
uint8_t type
Definition: liblwgeom.h:380
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:77
#define MULTILINETYPE
Definition: liblwgeom.h:74
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74
#define COLLECTIONTYPE
Definition: liblwgeom.h:76

Here is the call graph for this function:

Here is the caller graph for this function: