PostGIS  2.2.7dev-r@@SVN_REVISION@@
int lwgeom_calculate_gbox_geodetic ( const LWGEOM geom,
GBOX gbox 
)

Calculate the geodetic bounding box for an LWGEOM.

Z/M coordinates are ignored for this calculation. Pass in non-null, geodetic bounding box for function to fill out. LWGEOM must have been built from a GSERIALIZED to provide double aligned point arrays.

Definition at line 2615 of file lwgeodetic.c.

References COLLECTIONTYPE, GBOX::flags, LWGEOM::flags, FLAGS_GET_M, FLAGS_GET_Z, gflags(), LINETYPE, LW_FAILURE, lwcollection_calculate_gbox_geodetic(), LWDEBUGF, lwerror(), lwline_calculate_gbox_geodetic(), lwpoint_calculate_gbox_geodetic(), lwpolygon_calculate_gbox_geodetic(), lwtriangle_calculate_gbox_geodetic(), lwtype_name(), MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, POINTTYPE, POLYGONTYPE, POLYHEDRALSURFACETYPE, TINTYPE, TRIANGLETYPE, and LWGEOM::type.

Referenced by CircTreePIP(), geography_area(), lwcollection_calculate_gbox_geodetic(), lwgeom_calculate_gbox(), lwgeom_covers_lwgeom_sphere(), lwgeom_distance_spheroid(), lwpoly_covers_point2d(), lwpoly_pt_outside(), test_gbox_from_spherical_coordinates(), test_gbox_utils(), test_spheroid_area(), and test_tree_circ_pip2().

2616 {
2617  int result = LW_FAILURE;
2618  LWDEBUGF(4, "got type %d", geom->type);
2619 
2620  /* Add a geodetic flag to the incoming gbox */
2621  gbox->flags = gflags(FLAGS_GET_Z(geom->flags),FLAGS_GET_M(geom->flags),1);
2622 
2623  switch (geom->type)
2624  {
2625  case POINTTYPE:
2626  result = lwpoint_calculate_gbox_geodetic((LWPOINT*)geom, gbox);
2627  break;
2628  case LINETYPE:
2629  result = lwline_calculate_gbox_geodetic((LWLINE *)geom, gbox);
2630  break;
2631  case POLYGONTYPE:
2632  result = lwpolygon_calculate_gbox_geodetic((LWPOLY *)geom, gbox);
2633  break;
2634  case TRIANGLETYPE:
2635  result = lwtriangle_calculate_gbox_geodetic((LWTRIANGLE *)geom, gbox);
2636  break;
2637  case MULTIPOINTTYPE:
2638  case MULTILINETYPE:
2639  case MULTIPOLYGONTYPE:
2640  case POLYHEDRALSURFACETYPE:
2641  case TINTYPE:
2642  case COLLECTIONTYPE:
2643  result = lwcollection_calculate_gbox_geodetic((LWCOLLECTION *)geom, gbox);
2644  break;
2645  default:
2646  lwerror("lwgeom_calculate_gbox_geodetic: unsupported input geometry type: %d - %s",
2647  geom->type, lwtype_name(geom->type));
2648  break;
2649  }
2650  return result;
2651 }
#define LINETYPE
Definition: liblwgeom.h:71
static int lwtriangle_calculate_gbox_geodetic(const LWTRIANGLE *triangle, GBOX *gbox)
Definition: lwgeodetic.c:2573
#define POLYGONTYPE
Definition: liblwgeom.h:72
uint8_t flags
Definition: liblwgeom.h:381
#define MULTIPOINTTYPE
Definition: liblwgeom.h:73
#define TRIANGLETYPE
Definition: liblwgeom.h:83
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:82
static int lwline_calculate_gbox_geodetic(const LWLINE *line, GBOX *gbox)
Definition: lwgeodetic.c:2537
#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
static int lwpoint_calculate_gbox_geodetic(const LWPOINT *point, GBOX *gbox)
Definition: lwgeodetic.c:2531
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:124
static int lwpolygon_calculate_gbox_geodetic(const LWPOLY *poly, GBOX *gbox)
Definition: lwgeodetic.c:2543
uint8_t flags
Definition: liblwgeom.h:275
uint8_t gflags(int hasz, int hasm, int geodetic)
Construct a new flags char.
Definition: g_util.c:130
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:75
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:70
#define FLAGS_GET_M(flags)
Definition: liblwgeom.h:125
uint8_t type
Definition: liblwgeom.h:380
#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
static int lwcollection_calculate_gbox_geodetic(const LWCOLLECTION *coll, GBOX *gbox)
Definition: lwgeodetic.c:2580
#define COLLECTIONTYPE
Definition: liblwgeom.h:76

Here is the call graph for this function:

Here is the caller graph for this function: