PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwcompound_to_wkt_sb()

static void lwcompound_to_wkt_sb ( const LWCOMPOUND comp,
stringbuffer_t sb,
int  precision,
uint8_t  variant 
)
static

Definition at line 292 of file lwout_wkt.c.

References CIRCSTRINGTYPE, dimension_qualifiers_to_wkt_sb(), empty_to_wkt_sb(), LWCOMPOUND::geoms, LINETYPE, lwcircstring_to_wkt_sb(), lwerror(), lwline_to_wkt_sb(), lwtype_name(), LWCOMPOUND::ngeoms, stringbuffer_append(), ovdump::type, LWGEOM::type, WKT_IS_CHILD, and WKT_NO_TYPE.

Referenced by lwcurvepoly_to_wkt_sb(), lwgeom_to_wkt_sb(), and lwmcurve_to_wkt_sb().

293 {
294  int i = 0;
295 
296  if ( ! (variant & WKT_NO_TYPE) )
297  {
298  stringbuffer_append(sb, "COMPOUNDCURVE"); /* "COMPOUNDCURVE" */
300  }
301  if ( comp->ngeoms < 1 )
302  {
303  empty_to_wkt_sb(sb);
304  return;
305  }
306 
307  stringbuffer_append(sb, "(");
308  variant = variant | WKT_IS_CHILD; /* Inform the sub-geometries they are childre */
309  for ( i = 0; i < comp->ngeoms; i++ )
310  {
311  int type = comp->geoms[i]->type;
312  if ( i > 0 )
313  stringbuffer_append(sb, ",");
314  /* Linestring subgeoms don't get type identifiers */
315  if ( type == LINETYPE )
316  {
317  lwline_to_wkt_sb((LWLINE*)comp->geoms[i], sb, precision, variant | WKT_NO_TYPE );
318  }
319  /* But circstring subgeoms *do* get type identifiers */
320  else if ( type == CIRCSTRINGTYPE )
321  {
323  }
324  else
325  {
326  lwerror("lwcompound_to_wkt_sb: Unknown type received %d - %s", type, lwtype_name(type));
327  }
328  }
329  stringbuffer_append(sb, ")");
330 }
#define LINETYPE
Definition: liblwgeom.h:71
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
static void lwcircstring_to_wkt_sb(const LWCIRCSTRING *circ, stringbuffer_t *sb, int precision, uint8_t variant)
Definition: lwout_wkt.c:182
LWGEOM ** geoms
Definition: liblwgeom.h:506
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
int ngeoms
Definition: liblwgeom.h:504
uint8_t type
Definition: liblwgeom.h:380
type
Definition: ovdump.py:41
#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: