PostGIS  2.5.0dev-r@@SVN_REVISION@@
static void lwmsurface_to_wkt_sb ( const LWMSURFACE msurf,
stringbuffer_t sb,
int  precision,
uint8_t  variant 
)
static

Definition at line 452 of file lwout_wkt.c.

References CURVEPOLYTYPE, dimension_qualifiers_to_wkt_sb(), empty_to_wkt_sb(), LWMSURFACE::geoms, lwcurvepoly_to_wkt_sb(), lwerror(), lwpoly_to_wkt_sb(), lwtype_name(), LWMSURFACE::ngeoms, POLYGONTYPE, stringbuffer_append(), LWGEOM::type, WKT_IS_CHILD, and WKT_NO_TYPE.

Referenced by lwgeom_to_wkt_sb().

453 {
454  uint32_t i = 0;
455 
456  if ( ! (variant & WKT_NO_TYPE) )
457  {
458  stringbuffer_append(sb, "MULTISURFACE"); /* "MULTISURFACE" */
460  }
461  if ( msurf->ngeoms < 1 )
462  {
463  empty_to_wkt_sb(sb);
464  return;
465  }
466  stringbuffer_append(sb, "(");
467  variant = variant | WKT_IS_CHILD; /* Inform the sub-geometries they are childre */
468  for ( i = 0; i < msurf->ngeoms; i++ )
469  {
470  int type = msurf->geoms[i]->type;
471  if ( i > 0 )
472  stringbuffer_append(sb, ",");
473  switch (type)
474  {
475  case POLYGONTYPE:
476  /* Linestring subgeoms don't get type identifiers */
477  lwpoly_to_wkt_sb((LWPOLY*)msurf->geoms[i], sb, precision, variant | WKT_NO_TYPE );
478  break;
479  case CURVEPOLYTYPE:
480  /* But circstring subgeoms *do* get type identifiers */
482  break;
483  default:
484  lwerror("lwmsurface_to_wkt_sb: Unknown type received %d - %s", type, lwtype_name(type));
485  }
486  }
487  stringbuffer_append(sb, ")");
488 }
uint32_t ngeoms
Definition: liblwgeom.h:558
uint8_t variant
Definition: cu_in_twkb.c:26
#define POLYGONTYPE
Definition: liblwgeom.h:86
#define CURVEPOLYTYPE
Definition: liblwgeom.h:93
static void lwcurvepoly_to_wkt_sb(const LWCURVEPOLY *cpoly, stringbuffer_t *sb, int precision, uint8_t variant)
Definition: lwout_wkt.c:356
static void dimension_qualifiers_to_wkt_sb(const LWGEOM *geom, stringbuffer_t *sb, uint8_t variant)
Definition: lwout_wkt.c:39
static void lwpoly_to_wkt_sb(const LWPOLY *poly, stringbuffer_t *sb, int precision, uint8_t variant)
Definition: lwout_wkt.c:174
unsigned int uint32_t
Definition: uthash.h:78
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
LWGEOM ** geoms
Definition: liblwgeom.h:560
uint8_t type
Definition: liblwgeom.h:395
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190

Here is the call graph for this function:

Here is the caller graph for this function: