PostGIS 3.7.0dev-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 992 of file lwgeom.c.

993{
994 LWPOINT *pt;
995 LWLINE *ln;
996 LWPOLY *ply;
997 LWCOLLECTION *col;
998 uint32_t i;
999
1000 FLAGS_SET_GEODETIC(geom->flags, value);
1001 if ( geom->bbox )
1002 FLAGS_SET_GEODETIC(geom->bbox->flags, value);
1003
1004 switch(geom->type)
1005 {
1006 case POINTTYPE:
1007 pt = (LWPOINT*)geom;
1008 if ( pt->point )
1009 FLAGS_SET_GEODETIC(pt->point->flags, value);
1010 break;
1011 case LINETYPE:
1012 ln = (LWLINE*)geom;
1013 if ( ln->points )
1014 FLAGS_SET_GEODETIC(ln->points->flags, value);
1015 break;
1016 case POLYGONTYPE:
1017 ply = (LWPOLY*)geom;
1018 for ( i = 0; i < ply->nrings; i++ )
1019 FLAGS_SET_GEODETIC(ply->rings[i]->flags, value);
1020 break;
1021 case MULTIPOINTTYPE:
1022 case MULTILINETYPE:
1023 case MULTIPOLYGONTYPE:
1024 case COLLECTIONTYPE:
1025 col = (LWCOLLECTION*)geom;
1026 for ( i = 0; i < col->ngeoms; i++ )
1027 lwgeom_set_geodetic(col->geoms[i], value);
1028 break;
1029 default:
1030 lwerror("lwgeom_set_geodetic: unsupported geom type: %s", lwtype_name(geom->type));
1031 return;
1032 }
1033}
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:108
#define MULTILINETYPE
Definition liblwgeom.h:106
#define LINETYPE
Definition liblwgeom.h:103
#define MULTIPOINTTYPE
Definition liblwgeom.h:105
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition liblwgeom.h:102
#define MULTIPOLYGONTYPE
Definition liblwgeom.h:107
#define POLYGONTYPE
Definition liblwgeom.h:104
#define FLAGS_SET_GEODETIC(flags, value)
Definition liblwgeom.h:175
void lwgeom_set_geodetic(LWGEOM *geom, int value)
Set the FLAGS geodetic bit on geometry an all sub-geometries and pointlists.
Definition lwgeom.c:992
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
lwflags_t flags
Definition liblwgeom.h:353
uint32_t ngeoms
Definition liblwgeom.h:580
LWGEOM ** geoms
Definition liblwgeom.h:575
uint8_t type
Definition liblwgeom.h:462
GBOX * bbox
Definition liblwgeom.h:458
lwflags_t flags
Definition liblwgeom.h:461
POINTARRAY * points
Definition liblwgeom.h:483
POINTARRAY * point
Definition liblwgeom.h:471
POINTARRAY ** rings
Definition liblwgeom.h:519
uint32_t nrings
Definition liblwgeom.h:524
lwflags_t flags
Definition liblwgeom.h:431

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_line_interpolate_point(), geography_line_substring(), 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: