PostGIS  2.1.10dev-r@@SVN_REVISION@@
void lwgeom_set_geodetic ( LWGEOM geom,
int  value 
)

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

Definition at line 814 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().

815 {
816  LWPOINT *pt;
817  LWLINE *ln;
818  LWPOLY *ply;
819  LWCOLLECTION *col;
820  int i;
821 
823  if ( geom->bbox )
825 
826  switch(geom->type)
827  {
828  case POINTTYPE:
829  pt = (LWPOINT*)geom;
830  if ( pt->point )
832  break;
833  case LINETYPE:
834  ln = (LWLINE*)geom;
835  if ( ln->points )
837  break;
838  case POLYGONTYPE:
839  ply = (LWPOLY*)geom;
840  for ( i = 0; i < ply->nrings; i++ )
841  FLAGS_SET_GEODETIC(ply->rings[i]->flags, value);
842  break;
843  case MULTIPOINTTYPE:
844  case MULTILINETYPE:
845  case MULTIPOLYGONTYPE:
846  case COLLECTIONTYPE:
847  col = (LWCOLLECTION*)geom;
848  for ( i = 0; i < col->ngeoms; i++ )
849  lwgeom_set_geodetic(col->geoms[i], value);
850  break;
851  default:
852  lwerror("lwgeom_set_geodetic: unsupported geom type: %s", lwtype_name(geom->type));
853  return;
854  }
855 }
#define LINETYPE
Definition: liblwgeom.h:61
GBOX * bbox
Definition: liblwgeom.h:354
#define POLYGONTYPE
Definition: liblwgeom.h:62
uint8_t flags
Definition: liblwgeom.h:353
#define MULTIPOINTTYPE
Definition: liblwgeom.h:63
#define FLAGS_SET_GEODETIC(flags, value)
Definition: liblwgeom.h:115
POINTARRAY * point
Definition: liblwgeom.h:367
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:164
uint8_t flags
Definition: liblwgeom.h:325
LWGEOM ** geoms
Definition: liblwgeom.h:465
POINTARRAY ** rings
Definition: liblwgeom.h:413
int nrings
Definition: liblwgeom.h:411
uint8_t flags
Definition: liblwgeom.h:247
void lwgeom_set_geodetic(LWGEOM *geom, int value)
Set the FLAGS geodetic bit on geometry an all sub-geometries and pointlists.
Definition: lwgeom.c:814
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:65
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:60
uint8_t type
Definition: liblwgeom.h:352
#define MULTILINETYPE
Definition: liblwgeom.h:64
#define COLLECTIONTYPE
Definition: liblwgeom.h:66
POINTARRAY * points
Definition: liblwgeom.h:378

Here is the call graph for this function:

Here is the caller graph for this function: