PostGIS  2.4.9dev-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 683 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().

684 {
685  if ( ! lwgeom ) return LW_FAILURE;
686  LWDEBUGF(4, "lwgeom_calculate_gbox got type (%d) - %s", lwgeom->type, lwtype_name(lwgeom->type));
687 
688  switch (lwgeom->type)
689  {
690  case POINTTYPE:
691  return lwpoint_calculate_gbox_cartesian((LWPOINT *)lwgeom, gbox);
692  case LINETYPE:
693  return lwline_calculate_gbox_cartesian((LWLINE *)lwgeom, gbox);
694  case CIRCSTRINGTYPE:
695  return lwcircstring_calculate_gbox_cartesian((LWCIRCSTRING *)lwgeom, gbox);
696  case POLYGONTYPE:
697  return lwpoly_calculate_gbox_cartesian((LWPOLY *)lwgeom, gbox);
698  case TRIANGLETYPE:
699  return lwtriangle_calculate_gbox_cartesian((LWTRIANGLE *)lwgeom, gbox);
700  case COMPOUNDTYPE:
701  case CURVEPOLYTYPE:
702  case MULTIPOINTTYPE:
703  case MULTILINETYPE:
704  case MULTICURVETYPE:
705  case MULTIPOLYGONTYPE:
706  case MULTISURFACETYPE:
708  case TINTYPE:
709  case COLLECTIONTYPE:
710  return lwcollection_calculate_gbox_cartesian((LWCOLLECTION *)lwgeom, gbox);
711  }
712  /* Never get here, please. */
713  lwerror("unsupported type (%d) - %s", lwgeom->type, lwtype_name(lwgeom->type));
714  return LW_FAILURE;
715 }
#define LINETYPE
Definition: liblwgeom.h:86
#define MULTICURVETYPE
Definition: liblwgeom.h:95
static int lwpoint_calculate_gbox_cartesian(LWPOINT *point, GBOX *gbox)
Definition: g_box.c:622
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define COMPOUNDTYPE
Definition: liblwgeom.h:93
#define MULTIPOINTTYPE
Definition: liblwgeom.h:88
static int lwpoly_calculate_gbox_cartesian(LWPOLY *poly, GBOX *gbox)
Definition: g_box.c:640
#define TRIANGLETYPE
Definition: liblwgeom.h:98
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:97
static int lwcollection_calculate_gbox_cartesian(LWCOLLECTION *coll, GBOX *gbox)
Definition: g_box.c:648
#define LW_FAILURE
Definition: liblwgeom.h:79
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:99
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
static int lwcircstring_calculate_gbox_cartesian(LWCIRCSTRING *curve, GBOX *gbox)
Definition: g_box.c:591
#define MULTISURFACETYPE
Definition: liblwgeom.h:96
static int lwline_calculate_gbox_cartesian(LWLINE *line, GBOX *gbox)
Definition: g_box.c:628
static int lwtriangle_calculate_gbox_cartesian(LWTRIANGLE *triangle, GBOX *gbox)
Definition: g_box.c:634
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
uint8_t type
Definition: liblwgeom.h:396
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
#define MULTILINETYPE
Definition: liblwgeom.h:89
#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:91
Here is the call graph for this function:
Here is the caller graph for this function: