PostGIS  2.2.7dev-r@@SVN_REVISION@@
static void lwcurvepoly_to_wkt_sb ( const LWCURVEPOLY cpoly,
stringbuffer_t sb,
int  precision,
uint8_t  variant 
)
static

Definition at line 337 of file lwout_wkt.c.

References CIRCSTRINGTYPE, COMPOUNDTYPE, dimension_qualifiers_to_wkt_sb(), empty_to_wkt_sb(), LINETYPE, lwcircstring_to_wkt_sb(), lwcompound_to_wkt_sb(), lwerror(), lwline_to_wkt_sb(), lwtype_name(), LWCURVEPOLY::nrings, LWCURVEPOLY::rings, stringbuffer_append(), LWGEOM::type, WKT_IS_CHILD, and WKT_NO_TYPE.

Referenced by lwgeom_to_wkt_sb(), and lwmsurface_to_wkt_sb().

338 {
339  int i = 0;
340 
341  if ( ! (variant & WKT_NO_TYPE) )
342  {
343  stringbuffer_append(sb, "CURVEPOLYGON"); /* "CURVEPOLYGON" */
345  }
346  if ( cpoly->nrings < 1 )
347  {
348  empty_to_wkt_sb(sb);
349  return;
350  }
351  stringbuffer_append(sb, "(");
352  variant = variant | WKT_IS_CHILD; /* Inform the sub-geometries they are childre */
353  for ( i = 0; i < cpoly->nrings; i++ )
354  {
355  int type = cpoly->rings[i]->type;
356  if ( i > 0 )
357  stringbuffer_append(sb, ",");
358  switch (type)
359  {
360  case LINETYPE:
361  /* Linestring subgeoms don't get type identifiers */
362  lwline_to_wkt_sb((LWLINE*)cpoly->rings[i], sb, precision, variant | WKT_NO_TYPE );
363  break;
364  case CIRCSTRINGTYPE:
365  /* But circstring subgeoms *do* get type identifiers */
367  break;
368  case COMPOUNDTYPE:
369  /* And compoundcurve subgeoms *do* get type identifiers */
371  break;
372  default:
373  lwerror("lwcurvepoly_to_wkt_sb: Unknown type received %d - %s", type, lwtype_name(type));
374  }
375  }
376  stringbuffer_append(sb, ")");
377 }
#define LINETYPE
Definition: liblwgeom.h:71
uint8_t variant
Definition: cu_in_twkb.c:26
LWGEOM ** rings
Definition: liblwgeom.h:519
#define COMPOUNDTYPE
Definition: liblwgeom.h:78
static void dimension_qualifiers_to_wkt_sb(const LWGEOM *geom, stringbuffer_t *sb, uint8_t variant)
Definition: lwout_wkt.c:25
static void lwcircstring_to_wkt_sb(const LWCIRCSTRING *circ, stringbuffer_t *sb, int precision, uint8_t variant)
Definition: lwout_wkt.c:182
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:188
#define WKT_IS_CHILD
uint8_t precision
Definition: cu_in_twkb.c:25
#define WKT_NO_TYPE
Well-Known Text (WKT) Output Variant Types.
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
static void lwcompound_to_wkt_sb(const LWCOMPOUND *comp, stringbuffer_t *sb, int precision, uint8_t variant)
Definition: lwout_wkt.c:292
uint8_t type
Definition: liblwgeom.h:380
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:77
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74
static void lwline_to_wkt_sb(const LWLINE *line, stringbuffer_t *sb, int precision, uint8_t variant)
Definition: lwout_wkt.c:136

Here is the call graph for this function:

Here is the caller graph for this function: