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

908 {
909  LWPOINT *pt;
910  LWLINE *ln;
911  LWPOLY *ply;
912  LWCOLLECTION *col;
913  int i;
914 
916  if ( geom->bbox )
918 
919  switch(geom->type)
920  {
921  case POINTTYPE:
922  pt = (LWPOINT*)geom;
923  if ( pt->point )
925  break;
926  case LINETYPE:
927  ln = (LWLINE*)geom;
928  if ( ln->points )
930  break;
931  case POLYGONTYPE:
932  ply = (LWPOLY*)geom;
933  for ( i = 0; i < ply->nrings; i++ )
934  FLAGS_SET_GEODETIC(ply->rings[i]->flags, value);
935  break;
936  case MULTIPOINTTYPE:
937  case MULTILINETYPE:
938  case MULTIPOLYGONTYPE:
939  case COLLECTIONTYPE:
940  col = (LWCOLLECTION*)geom;
941  for ( i = 0; i < col->ngeoms; i++ )
942  lwgeom_set_geodetic(col->geoms[i], value);
943  break;
944  default:
945  lwerror("lwgeom_set_geodetic: unsupported geom type: %s", lwtype_name(geom->type));
946  return;
947  }
948 }
#define LINETYPE
Definition: liblwgeom.h:86
GBOX * bbox
Definition: liblwgeom.h:398
#define POLYGONTYPE
Definition: liblwgeom.h:87
uint8_t flags
Definition: liblwgeom.h:397
#define MULTIPOINTTYPE
Definition: liblwgeom.h:88
#define FLAGS_SET_GEODETIC(flags, value)
Definition: liblwgeom.h:149
POINTARRAY * point
Definition: liblwgeom.h:411
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:369
LWGEOM ** geoms
Definition: liblwgeom.h:509
POINTARRAY ** rings
Definition: liblwgeom.h:457
int nrings
Definition: liblwgeom.h:455
uint8_t flags
Definition: liblwgeom.h:291
void lwgeom_set_geodetic(LWGEOM *geom, int value)
Set the FLAGS geodetic bit on geometry an all sub-geometries and pointlists.
Definition: lwgeom.c:907
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
uint8_t type
Definition: liblwgeom.h:396
int value
Definition: genraster.py:61
#define MULTILINETYPE
Definition: liblwgeom.h:89
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
POINTARRAY * points
Definition: liblwgeom.h:422
Here is the call graph for this function:
Here is the caller graph for this function: