PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwmcurve_to_wkt_sb()

static void lwmcurve_to_wkt_sb ( const LWMCURVE mcurv,
stringbuffer_t sb,
int  precision,
uint8_t  variant 
)
static

Definition at line 399 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(), ovdump::type, LWGEOM::type, WKT_IS_CHILD, and WKT_NO_TYPE.

Referenced by lwgeom_to_wkt_sb().

400 {
401  int i = 0;
402 
403  if ( ! (variant & WKT_NO_TYPE) )
404  {
405  stringbuffer_append(sb, "MULTICURVE"); /* "MULTICURVE" */
407  }
408  if ( mcurv->ngeoms < 1 )
409  {
410  empty_to_wkt_sb(sb);
411  return;
412  }
413  stringbuffer_append(sb, "(");
414  variant = variant | WKT_IS_CHILD; /* Inform the sub-geometries they are childre */
415  for ( i = 0; i < mcurv->ngeoms; i++ )
416  {
417  int type = mcurv->geoms[i]->type;
418  if ( i > 0 )
419  stringbuffer_append(sb, ",");
420  switch (type)
421  {
422  case LINETYPE:
423  /* Linestring subgeoms don't get type identifiers */
424  lwline_to_wkt_sb((LWLINE*)mcurv->geoms[i], sb, precision, variant | WKT_NO_TYPE );
425  break;
426  case CIRCSTRINGTYPE:
427  /* But circstring subgeoms *do* get type identifiers */
429  break;
430  case COMPOUNDTYPE:
431  /* And compoundcurve subgeoms *do* get type identifiers */
433  break;
434  default:
435  lwerror("lwmcurve_to_wkt_sb: Unknown type received %d - %s", type, lwtype_name(type));
436  }
437  }
438  stringbuffer_append(sb, ")");
439 }
int ngeoms
Definition: liblwgeom.h:546
#define LINETYPE
Definition: liblwgeom.h:86
uint8_t variant
Definition: cu_in_twkb.c:26
#define COMPOUNDTYPE
Definition: liblwgeom.h:93
static void dimension_qualifiers_to_wkt_sb(const LWGEOM *geom, stringbuffer_t *sb, uint8_t variant)
Definition: lwout_wkt.c:39
static void lwcircstring_to_wkt_sb(const LWCIRCSTRING *circ, stringbuffer_t *sb, int precision, uint8_t variant)
Definition: lwout_wkt.c:196
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:218
#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:69
void stringbuffer_append(stringbuffer_t *s, const char *a)
Append the specified string to the stringbuffer_t.
Definition: stringbuffer.c:134
static void lwcompound_to_wkt_sb(const LWCOMPOUND *comp, stringbuffer_t *sb, int precision, uint8_t variant)
Definition: lwout_wkt.c:306
LWGEOM ** geoms
Definition: liblwgeom.h:548
uint8_t type
Definition: liblwgeom.h:396
type
Definition: ovdump.py:41
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
static void lwline_to_wkt_sb(const LWLINE *line, stringbuffer_t *sb, int precision, uint8_t variant)
Definition: lwout_wkt.c:150
Here is the call graph for this function:
Here is the caller graph for this function: