PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ 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 946 of file lwgeom.c.

947{
948 LWPOINT *pt;
949 LWLINE *ln;
950 LWPOLY *ply;
951 LWCOLLECTION *col;
952 uint32_t i;
953
954 FLAGS_SET_GEODETIC(geom->flags, value);
955 if ( geom->bbox )
956 FLAGS_SET_GEODETIC(geom->bbox->flags, value);
957
958 switch(geom->type)
959 {
960 case POINTTYPE:
961 pt = (LWPOINT*)geom;
962 if ( pt->point )
963 FLAGS_SET_GEODETIC(pt->point->flags, value);
964 break;
965 case LINETYPE:
966 ln = (LWLINE*)geom;
967 if ( ln->points )
968 FLAGS_SET_GEODETIC(ln->points->flags, value);
969 break;
970 case POLYGONTYPE:
971 ply = (LWPOLY*)geom;
972 for ( i = 0; i < ply->nrings; i++ )
973 FLAGS_SET_GEODETIC(ply->rings[i]->flags, value);
974 break;
975 case MULTIPOINTTYPE:
976 case MULTILINETYPE:
977 case MULTIPOLYGONTYPE:
978 case COLLECTIONTYPE:
979 col = (LWCOLLECTION*)geom;
980 for ( i = 0; i < col->ngeoms; i++ )
981 lwgeom_set_geodetic(col->geoms[i], value);
982 break;
983 default:
984 lwerror("lwgeom_set_geodetic: unsupported geom type: %s", lwtype_name(geom->type));
985 return;
986 }
987}
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition lwutil.c:216
#define COLLECTIONTYPE
Definition liblwgeom.h:122
#define MULTILINETYPE
Definition liblwgeom.h:120
#define LINETYPE
Definition liblwgeom.h:117
#define MULTIPOINTTYPE
Definition liblwgeom.h:119
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition liblwgeom.h:116
#define MULTIPOLYGONTYPE
Definition liblwgeom.h:121
#define POLYGONTYPE
Definition liblwgeom.h:118
#define FLAGS_SET_GEODETIC(flags, value)
Definition liblwgeom.h:189
void lwgeom_set_geodetic(LWGEOM *geom, int value)
Set the FLAGS geodetic bit on geometry an all sub-geometries and pointlists.
Definition lwgeom.c:946
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition lwutil.c:190
lwflags_t flags
Definition liblwgeom.h:339
uint32_t ngeoms
Definition liblwgeom.h:566
LWGEOM ** geoms
Definition liblwgeom.h:561
uint8_t type
Definition liblwgeom.h:448
GBOX * bbox
Definition liblwgeom.h:444
lwflags_t flags
Definition liblwgeom.h:447
POINTARRAY * points
Definition liblwgeom.h:469
POINTARRAY * point
Definition liblwgeom.h:457
POINTARRAY ** rings
Definition liblwgeom.h:505
uint32_t nrings
Definition liblwgeom.h:510
lwflags_t flags
Definition liblwgeom.h:417

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

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

Here is the call graph for this function:
Here is the caller graph for this function: