PostGIS  2.5.7dev-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.

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 }
static int lwpoint_calculate_gbox_cartesian(LWPOINT *point, GBOX *gbox)
Definition: g_box.c:617
static int lwpoly_calculate_gbox_cartesian(LWPOLY *poly, GBOX *gbox)
Definition: g_box.c:635
static int lwtriangle_calculate_gbox_cartesian(LWTRIANGLE *triangle, GBOX *gbox)
Definition: g_box.c:629
static int lwline_calculate_gbox_cartesian(LWLINE *line, GBOX *gbox)
Definition: g_box.c:623
static int lwcircstring_calculate_gbox_cartesian(LWCIRCSTRING *curve, GBOX *gbox)
Definition: g_box.c:586
static int lwcollection_calculate_gbox_cartesian(LWCOLLECTION *coll, GBOX *gbox)
Definition: g_box.c:643
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
#define COMPOUNDTYPE
Definition: liblwgeom.h:93
#define LW_FAILURE
Definition: liblwgeom.h:79
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define MULTILINETYPE
Definition: liblwgeom.h:89
#define MULTISURFACETYPE
Definition: liblwgeom.h:96
#define LINETYPE
Definition: liblwgeom.h:86
#define MULTIPOINTTYPE
Definition: liblwgeom.h:88
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
#define TINTYPE
Definition: liblwgeom.h:99
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:97
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
#define MULTICURVETYPE
Definition: liblwgeom.h:95
#define TRIANGLETYPE
Definition: liblwgeom.h:98
#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
uint8_t type
Definition: liblwgeom.h:399

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

Here is the call graph for this function:
Here is the caller graph for this function: