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

Definition at line 433 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().

434 {
435  int i = 0;
436 
437  if ( ! (variant & WKT_NO_TYPE) )
438  {
439  stringbuffer_append(sb, "MULTISURFACE"); /* "MULTISURFACE" */
440  dimension_qualifiers_to_wkt_sb((LWGEOM*)msurf, sb, variant);
441  }
442  if ( msurf->ngeoms < 1 )
443  {
444  empty_to_wkt_sb(sb);
445  return;
446  }
447  stringbuffer_append(sb, "(");
448  variant = variant | WKT_IS_CHILD; /* Inform the sub-geometries they are childre */
449  for ( i = 0; i < msurf->ngeoms; i++ )
450  {
451  int type = msurf->geoms[i]->type;
452  if ( i > 0 )
453  stringbuffer_append(sb, ",");
454  switch (type)
455  {
456  case POLYGONTYPE:
457  /* Linestring subgeoms don't get type identifiers */
458  lwpoly_to_wkt_sb((LWPOLY*)msurf->geoms[i], sb, precision, variant | WKT_NO_TYPE );
459  break;
460  case CURVEPOLYTYPE:
461  /* But circstring subgeoms *do* get type identifiers */
462  lwcurvepoly_to_wkt_sb((LWCURVEPOLY*)msurf->geoms[i], sb, precision, variant);
463  break;
464  default:
465  lwerror("lwmsurface_to_wkt_sb: Unknown type recieved %d - %s", type, lwtype_name(type));
466  }
467  }
468  stringbuffer_append(sb, ")");
469 }
#define POLYGONTYPE
Definition: liblwgeom.h:62
#define CURVEPOLYTYPE
Definition: liblwgeom.h:69
static void lwcurvepoly_to_wkt_sb(const LWCURVEPOLY *cpoly, stringbuffer_t *sb, int precision, uint8_t variant)
Definition: lwout_wkt.c:337
static void dimension_qualifiers_to_wkt_sb(const LWGEOM *geom, stringbuffer_t *sb, uint8_t variant)
Definition: lwout_wkt.c:25
static void lwpoly_to_wkt_sb(const LWPOLY *poly, stringbuffer_t *sb, int precision, uint8_t variant)
Definition: lwout_wkt.c:155
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
int ngeoms
Definition: liblwgeom.h:515
LWGEOM ** geoms
Definition: liblwgeom.h:517
uint8_t type
Definition: liblwgeom.h:352

Here is the call graph for this function:

Here is the caller graph for this function: