PostGIS  3.0.0dev-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 936 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().

937 {
938  LWPOINT *pt;
939  LWLINE *ln;
940  LWPOLY *ply;
941  LWCOLLECTION *col;
942  uint32_t i;
943 
945  if ( geom->bbox )
947 
948  switch(geom->type)
949  {
950  case POINTTYPE:
951  pt = (LWPOINT*)geom;
952  if ( pt->point )
954  break;
955  case LINETYPE:
956  ln = (LWLINE*)geom;
957  if ( ln->points )
959  break;
960  case POLYGONTYPE:
961  ply = (LWPOLY*)geom;
962  for ( i = 0; i < ply->nrings; i++ )
963  FLAGS_SET_GEODETIC(ply->rings[i]->flags, value);
964  break;
965  case MULTIPOINTTYPE:
966  case MULTILINETYPE:
967  case MULTIPOLYGONTYPE:
968  case COLLECTIONTYPE:
969  col = (LWCOLLECTION*)geom;
970  for ( i = 0; i < col->ngeoms; i++ )
971  lwgeom_set_geodetic(col->geoms[i], value);
972  break;
973  default:
974  lwerror("lwgeom_set_geodetic: unsupported geom type: %s", lwtype_name(geom->type));
975  return;
976  }
977 }
#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:216
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:936
#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: