PostGIS  2.5.2dev-r@@SVN_REVISION@@

◆ lwgeom_set_geodetic()

void lwgeom_set_geodetic ( LWGEOM geom,
int  value 
)

Set the FLAGS geodetic bit on geometry an all sub-geometries and pointlists.

Definition at line 952 of file lwgeom.c.

References LWGEOM::bbox, COLLECTIONTYPE, GBOX::flags, POINTARRAY::flags, LWGEOM::flags, FLAGS_SET_GEODETIC, LWCOLLECTION::geoms, LINETYPE, lwerror(), lwtype_name(), MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, LWCOLLECTION::ngeoms, LWPOLY::nrings, LWPOINT::point, LWLINE::points, POINTTYPE, POLYGONTYPE, LWPOLY::rings, and LWGEOM::type.

Referenced by geography_centroid(), geography_centroid_from_mline(), geography_centroid_from_mpoly(), geography_from_geometry(), geography_point_outside(), geography_segmentize(), geometry_distance_spheroid(), geometry_from_geography(), gserialized_geography_from_lwgeom(), and lwgeom_project_spheroid().

953 {
954  LWPOINT *pt;
955  LWLINE *ln;
956  LWPOLY *ply;
957  LWCOLLECTION *col;
958  uint32_t i;
959 
961  if ( geom->bbox )
963 
964  switch(geom->type)
965  {
966  case POINTTYPE:
967  pt = (LWPOINT*)geom;
968  if ( pt->point )
970  break;
971  case LINETYPE:
972  ln = (LWLINE*)geom;
973  if ( ln->points )
975  break;
976  case POLYGONTYPE:
977  ply = (LWPOLY*)geom;
978  for ( i = 0; i < ply->nrings; i++ )
979  FLAGS_SET_GEODETIC(ply->rings[i]->flags, value);
980  break;
981  case MULTIPOINTTYPE:
982  case MULTILINETYPE:
983  case MULTIPOLYGONTYPE:
984  case COLLECTIONTYPE:
985  col = (LWCOLLECTION*)geom;
986  for ( i = 0; i < col->ngeoms; i++ )
987  lwgeom_set_geodetic(col->geoms[i], value);
988  break;
989  default:
990  lwerror("lwgeom_set_geodetic: unsupported geom type: %s", lwtype_name(geom->type));
991  return;
992  }
993 }
#define LINETYPE
Definition: liblwgeom.h:85
GBOX * bbox
Definition: liblwgeom.h:400
#define POLYGONTYPE
Definition: liblwgeom.h:86
uint8_t flags
Definition: liblwgeom.h:399
#define MULTIPOINTTYPE
Definition: liblwgeom.h:87
#define FLAGS_SET_GEODETIC(flags, value)
Definition: liblwgeom.h:148
uint32_t ngeoms
Definition: liblwgeom.h:509
POINTARRAY * point
Definition: liblwgeom.h:413
uint32_t nrings
Definition: liblwgeom.h:457
unsigned int uint32_t
Definition: uthash.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
uint8_t flags
Definition: liblwgeom.h:371
LWGEOM ** geoms
Definition: liblwgeom.h:511
POINTARRAY ** rings
Definition: liblwgeom.h:459
uint8_t flags
Definition: liblwgeom.h:293
void lwgeom_set_geodetic(LWGEOM *geom, int value)
Set the FLAGS geodetic bit on geometry an all sub-geometries and pointlists.
Definition: lwgeom.c:952
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:89
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
uint8_t type
Definition: liblwgeom.h:398
int value
Definition: genraster.py:61
#define MULTILINETYPE
Definition: liblwgeom.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
POINTARRAY * points
Definition: liblwgeom.h:424
Here is the call graph for this function:
Here is the caller graph for this function: