PostGIS  2.1.10dev-r@@SVN_REVISION@@
static void lwmcurve_to_wkt_sb ( const LWMCURVE mcurv,
stringbuffer_t sb,
int  precision,
uint8_t  variant 
)
static

Definition at line 385 of file lwout_wkt.c.

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

Referenced by lwgeom_to_wkt_sb().

386 {
387  int i = 0;
388 
389  if ( ! (variant & WKT_NO_TYPE) )
390  {
391  stringbuffer_append(sb, "MULTICURVE"); /* "MULTICURVE" */
392  dimension_qualifiers_to_wkt_sb((LWGEOM*)mcurv, sb, variant);
393  }
394  if ( mcurv->ngeoms < 1 )
395  {
396  empty_to_wkt_sb(sb);
397  return;
398  }
399  stringbuffer_append(sb, "(");
400  variant = variant | WKT_IS_CHILD; /* Inform the sub-geometries they are childre */
401  for ( i = 0; i < mcurv->ngeoms; i++ )
402  {
403  int type = mcurv->geoms[i]->type;
404  if ( i > 0 )
405  stringbuffer_append(sb, ",");
406  switch (type)
407  {
408  case LINETYPE:
409  /* Linestring subgeoms don't get type identifiers */
410  lwline_to_wkt_sb((LWLINE*)mcurv->geoms[i], sb, precision, variant | WKT_NO_TYPE );
411  break;
412  case CIRCSTRINGTYPE:
413  /* But circstring subgeoms *do* get type identifiers */
414  lwcircstring_to_wkt_sb((LWCIRCSTRING*)mcurv->geoms[i], sb, precision, variant );
415  break;
416  case COMPOUNDTYPE:
417  /* And compoundcurve subgeoms *do* get type identifiers */
418  lwcompound_to_wkt_sb((LWCOMPOUND*)mcurv->geoms[i], sb, precision, variant );
419  break;
420  default:
421  lwerror("lwmcurve_to_wkt_sb: Unknown type recieved %d - %s", type, lwtype_name(type));
422  }
423  }
424  stringbuffer_append(sb, ")");
425 }
int ngeoms
Definition: liblwgeom.h:502
#define LINETYPE
Definition: liblwgeom.h:61
#define COMPOUNDTYPE
Definition: liblwgeom.h:68
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
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:164
#define WKT_IS_CHILD
#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:128
static void lwcompound_to_wkt_sb(const LWCOMPOUND *comp, stringbuffer_t *sb, int precision, uint8_t variant)
Definition: lwout_wkt.c:292
LWGEOM ** geoms
Definition: liblwgeom.h:504
uint8_t type
Definition: liblwgeom.h:352
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:67
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: