PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwgeom_reverse_in_place()

void lwgeom_reverse_in_place ( LWGEOM geom)

Reverse vertex order of LWGEOM.

Definition at line 102 of file lwgeom.c.

103 {
104  uint32_t i;
105  LWCOLLECTION *col;
106  if (!geom)
107  return;
108 
109  switch (geom->type)
110  {
111  case MULTIPOINTTYPE:
112  case POINTTYPE:
113  {
114  return;
115  }
116  case TRIANGLETYPE:
117  case CIRCSTRINGTYPE:
118  case LINETYPE:
119  {
120  LWLINE *line = (LWLINE *)(geom);
122  return;
123  }
124  case POLYGONTYPE:
125  {
126  LWPOLY *poly = (LWPOLY *)(geom);
127  if (!poly->rings)
128  return;
129  uint32_t r;
130  for (r = 0; r < poly->nrings; r++)
132  return;
133  }
134  case MULTICURVETYPE:
135  case MULTILINETYPE:
136  case MULTIPOLYGONTYPE:
137  case MULTISURFACETYPE:
139  case TINTYPE:
140  case COLLECTIONTYPE:
141  case COMPOUNDTYPE:
142  case CURVEPOLYTYPE:
143  {
144  col = (LWCOLLECTION *)(geom);
145  if (!col->geoms)
146  return;
147  for (i=0; i<col->ngeoms; i++)
149  return;
150  }
151  default:
152  {
153  lwerror("%s: Unknown geometry type: %s", __func__, lwtype_name(geom->type));
154  return;
155  }
156 
157  }
158 }
char * r
Definition: cu_in_wkt.c:24
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
#define COMPOUNDTYPE
Definition: liblwgeom.h:93
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define MULTILINETYPE
Definition: liblwgeom.h:89
#define MULTISURFACETYPE
Definition: liblwgeom.h:96
#define LINETYPE
Definition: liblwgeom.h:86
#define MULTIPOINTTYPE
Definition: liblwgeom.h:88
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:85
#define TINTYPE
Definition: liblwgeom.h:99
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:97
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
#define MULTICURVETYPE
Definition: liblwgeom.h:95
#define TRIANGLETYPE
Definition: liblwgeom.h:98
void ptarray_reverse_in_place(POINTARRAY *pa)
Definition: ptarray.c:341
void lwgeom_reverse_in_place(LWGEOM *geom)
Reverse vertex order of LWGEOM.
Definition: lwgeom.c:102
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
uint32_t ngeoms
Definition: liblwgeom.h:510
LWGEOM ** geoms
Definition: liblwgeom.h:512
uint8_t type
Definition: liblwgeom.h:399
POINTARRAY * points
Definition: liblwgeom.h:425
POINTARRAY ** rings
Definition: liblwgeom.h:460
uint32_t nrings
Definition: liblwgeom.h:458
unsigned int uint32_t
Definition: uthash.h:78

References CIRCSTRINGTYPE, COLLECTIONTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, LWCOLLECTION::geoms, LINETYPE, lwerror(), lwgeom_reverse_in_place(), lwtype_name(), MULTICURVETYPE, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, MULTISURFACETYPE, LWCOLLECTION::ngeoms, LWPOLY::nrings, LWLINE::points, POINTTYPE, POLYGONTYPE, POLYHEDRALSURFACETYPE, ptarray_reverse_in_place(), r, LWPOLY::rings, TINTYPE, TRIANGLETYPE, and LWGEOM::type.

Referenced by lwgeom_reverse(), LWGEOM_reverse(), lwgeom_reverse_in_place(), lwt_GetFaceEdges(), mvt_grid_and_validate_geos(), ST_IsPolygonCCW(), and test_lwcurve_linearize().

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