PostGIS  2.5.0beta1dev-r@@SVN_REVISION@@

◆ lwgeom_calculate_gbox_cartesian()

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 678 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().

679 {
680  if ( ! lwgeom ) return LW_FAILURE;
681  LWDEBUGF(4, "lwgeom_calculate_gbox got type (%d) - %s", lwgeom->type, lwtype_name(lwgeom->type));
682 
683  switch (lwgeom->type)
684  {
685  case POINTTYPE:
686  return lwpoint_calculate_gbox_cartesian((LWPOINT *)lwgeom, gbox);
687  case LINETYPE:
688  return lwline_calculate_gbox_cartesian((LWLINE *)lwgeom, gbox);
689  case CIRCSTRINGTYPE:
690  return lwcircstring_calculate_gbox_cartesian((LWCIRCSTRING *)lwgeom, gbox);
691  case POLYGONTYPE:
692  return lwpoly_calculate_gbox_cartesian((LWPOLY *)lwgeom, gbox);
693  case TRIANGLETYPE:
694  return lwtriangle_calculate_gbox_cartesian((LWTRIANGLE *)lwgeom, gbox);
695  case COMPOUNDTYPE:
696  case CURVEPOLYTYPE:
697  case MULTIPOINTTYPE:
698  case MULTILINETYPE:
699  case MULTICURVETYPE:
700  case MULTIPOLYGONTYPE:
701  case MULTISURFACETYPE:
703  case TINTYPE:
704  case COLLECTIONTYPE:
705  return lwcollection_calculate_gbox_cartesian((LWCOLLECTION *)lwgeom, gbox);
706  }
707  /* Never get here, please. */
708  lwerror("unsupported type (%d) - %s", lwgeom->type, lwtype_name(lwgeom->type));
709  return LW_FAILURE;
710 }
#define LINETYPE
Definition: liblwgeom.h:85
#define MULTICURVETYPE
Definition: liblwgeom.h:94
static int lwpoint_calculate_gbox_cartesian(LWPOINT *point, GBOX *gbox)
Definition: g_box.c:617
#define POLYGONTYPE
Definition: liblwgeom.h:86
#define CURVEPOLYTYPE
Definition: liblwgeom.h:93
#define COMPOUNDTYPE
Definition: liblwgeom.h:92
#define MULTIPOINTTYPE
Definition: liblwgeom.h:87
static int lwpoly_calculate_gbox_cartesian(LWPOLY *poly, GBOX *gbox)
Definition: g_box.c:635
#define TRIANGLETYPE
Definition: liblwgeom.h:97
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:96
static int lwcollection_calculate_gbox_cartesian(LWCOLLECTION *coll, GBOX *gbox)
Definition: g_box.c:643
#define LW_FAILURE
Definition: liblwgeom.h:78
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
#define TINTYPE
Definition: liblwgeom.h:98
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:89
static int lwcircstring_calculate_gbox_cartesian(LWCIRCSTRING *curve, GBOX *gbox)
Definition: g_box.c:586
#define MULTISURFACETYPE
Definition: liblwgeom.h:95
static int lwline_calculate_gbox_cartesian(LWLINE *line, GBOX *gbox)
Definition: g_box.c:623
static int lwtriangle_calculate_gbox_cartesian(LWTRIANGLE *triangle, GBOX *gbox)
Definition: g_box.c:629
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
uint8_t type
Definition: liblwgeom.h:398
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:91
#define MULTILINETYPE
Definition: liblwgeom.h:88
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
#define COLLECTIONTYPE
Definition: liblwgeom.h:90
Here is the call graph for this function:
Here is the caller graph for this function: