PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwpoly_to_wkt_sb()

static void lwpoly_to_wkt_sb ( const LWPOLY poly,
stringbuffer_t sb,
int  precision,
uint8_t  variant 
)
static

Definition at line 155 of file lwout_wkt.c.

References dimension_qualifiers_to_wkt_sb(), empty_to_wkt_sb(), lwpoly_is_empty(), LWPOLY::nrings, ptarray_to_wkt_sb(), LWPOLY::rings, stringbuffer_append(), and WKT_NO_TYPE.

Referenced by lwgeom_to_wkt_sb(), lwmpoly_to_wkt_sb(), lwmsurface_to_wkt_sb(), and lwpsurface_to_wkt_sb().

156 {
157  int i = 0;
158  if ( ! (variant & WKT_NO_TYPE) )
159  {
160  stringbuffer_append(sb, "POLYGON"); /* "POLYGON" */
162  }
163  if ( lwpoly_is_empty(poly) )
164  {
165  empty_to_wkt_sb(sb);
166  return;
167  }
168 
169  stringbuffer_append(sb, "(");
170  for ( i = 0; i < poly->nrings; i++ )
171  {
172  if ( i > 0 )
173  stringbuffer_append(sb, ",");
174  ptarray_to_wkt_sb(poly->rings[i], sb, precision, variant);
175  }
176  stringbuffer_append(sb, ")");
177 }
uint8_t variant
Definition: cu_in_twkb.c:26
static void dimension_qualifiers_to_wkt_sb(const LWGEOM *geom, stringbuffer_t *sb, uint8_t variant)
Definition: lwout_wkt.c:25
POINTARRAY ** rings
Definition: liblwgeom.h:441
uint8_t precision
Definition: cu_in_twkb.c:25
#define WKT_NO_TYPE
Well-Known Text (WKT) Output Variant Types.
int lwpoly_is_empty(const LWPOLY *poly)
Definition: lwpoly.c:332
int nrings
Definition: liblwgeom.h:439
static void ptarray_to_wkt_sb(const POINTARRAY *ptarray, stringbuffer_t *sb, int precision, uint8_t variant)
Definition: lwout_wkt.c:69
static void empty_to_wkt_sb(stringbuffer_t *sb)
Definition: lwout_wkt.c:55
void stringbuffer_append(stringbuffer_t *s, const char *a)
Append the specified string to the stringbuffer_t.
Definition: stringbuffer.c:127
Here is the call graph for this function:
Here is the caller graph for this function: