PostGIS  2.2.8dev-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 858 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_from_geometry(), geography_segmentize(), geometry_distance_spheroid(), geometry_from_geography(), gserialized_geography_from_lwgeom(), and lwgeom_project_spheroid().

859 {
860  LWPOINT *pt;
861  LWLINE *ln;
862  LWPOLY *ply;
863  LWCOLLECTION *col;
864  int i;
865 
867  if ( geom->bbox )
869 
870  switch(geom->type)
871  {
872  case POINTTYPE:
873  pt = (LWPOINT*)geom;
874  if ( pt->point )
876  break;
877  case LINETYPE:
878  ln = (LWLINE*)geom;
879  if ( ln->points )
881  break;
882  case POLYGONTYPE:
883  ply = (LWPOLY*)geom;
884  for ( i = 0; i < ply->nrings; i++ )
885  FLAGS_SET_GEODETIC(ply->rings[i]->flags, value);
886  break;
887  case MULTIPOINTTYPE:
888  case MULTILINETYPE:
889  case MULTIPOLYGONTYPE:
890  case COLLECTIONTYPE:
891  col = (LWCOLLECTION*)geom;
892  for ( i = 0; i < col->ngeoms; i++ )
893  lwgeom_set_geodetic(col->geoms[i], value);
894  break;
895  default:
896  lwerror("lwgeom_set_geodetic: unsupported geom type: %s", lwtype_name(geom->type));
897  return;
898  }
899 }
#define LINETYPE
Definition: liblwgeom.h:71
GBOX * bbox
Definition: liblwgeom.h:382
#define POLYGONTYPE
Definition: liblwgeom.h:72
uint8_t flags
Definition: liblwgeom.h:381
#define MULTIPOINTTYPE
Definition: liblwgeom.h:73
#define FLAGS_SET_GEODETIC(flags, value)
Definition: liblwgeom.h:133
POINTARRAY * point
Definition: liblwgeom.h:395
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:188
uint8_t flags
Definition: liblwgeom.h:353
LWGEOM ** geoms
Definition: liblwgeom.h:493
POINTARRAY ** rings
Definition: liblwgeom.h:441
int nrings
Definition: liblwgeom.h:439
uint8_t flags
Definition: liblwgeom.h:275
void lwgeom_set_geodetic(LWGEOM *geom, int value)
Set the FLAGS geodetic bit on geometry an all sub-geometries and pointlists.
Definition: lwgeom.c:858
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:75
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:70
uint8_t type
Definition: liblwgeom.h:380
int value
Definition: genraster.py:61
#define MULTILINETYPE
Definition: liblwgeom.h:74
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74
#define COLLECTIONTYPE
Definition: liblwgeom.h:76
POINTARRAY * points
Definition: liblwgeom.h:406
Here is the call graph for this function:
Here is the caller graph for this function: