PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ 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 322 of file lwout_wkt.c.

323{
324 uint32_t i = 0;
325
326 if ( ! (variant & WKT_NO_TYPE) )
327 {
328 stringbuffer_append_len(sb, "COMPOUNDCURVE", 13); /* "COMPOUNDCURVE" */
330 }
331 if ( comp->ngeoms < 1 )
332 {
333 empty_to_wkt_sb(sb);
334 return;
335 }
336
337 stringbuffer_append_len(sb, "(", 1);
338 variant = variant | WKT_IS_CHILD; /* Inform the sub-geometries they are childre */
339 for ( i = 0; i < comp->ngeoms; i++ )
340 {
341 int type = comp->geoms[i]->type;
342 if ( i > 0 )
343 stringbuffer_append_len(sb, ",", 1);
344 /* Linestring subgeoms don't get type identifiers */
345 if ( type == LINETYPE )
346 {
348 }
349 /* But circstring subgeoms *do* get type identifiers */
350 else if ( type == CIRCSTRINGTYPE )
351 {
353 }
354 else
355 {
356 lwerror("lwcompound_to_wkt_sb: Unknown type received %d - %s", type, lwtype_name(type));
357 }
358 }
359 stringbuffer_append_len(sb, ")", 1);
360}
static uint8_t variant
Definition cu_in_twkb.c:26
static uint8_t precision
Definition cu_in_twkb.c:25
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition lwutil.c:216
#define LINETYPE
Definition liblwgeom.h:103
#define CIRCSTRINGTYPE
Definition liblwgeom.h:109
#define WKT_IS_CHILD
#define WKT_NO_TYPE
Well-Known Text (WKT) Output Variant Types.
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
static void lwcircstring_to_wkt_sb(const LWCIRCSTRING *circ, stringbuffer_t *sb, int precision, uint8_t variant)
Definition lwout_wkt.c:208
static void dimension_qualifiers_to_wkt_sb(const LWGEOM *geom, stringbuffer_t *sb, uint8_t variant)
Definition lwout_wkt.c:40
static void empty_to_wkt_sb(stringbuffer_t *sb)
Definition lwout_wkt.c:70
static void lwline_to_wkt_sb(const LWLINE *line, stringbuffer_t *sb, int precision, uint8_t variant)
Definition lwout_wkt.c:162
static void stringbuffer_append_len(stringbuffer_t *s, const char *a, size_t alen)
Append the specified string to the stringbuffer_t using known length.
uint32_t ngeoms
Definition liblwgeom.h:594
LWGEOM ** geoms
Definition liblwgeom.h:589
uint8_t type
Definition liblwgeom.h:462

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, precision, stringbuffer_append_len(), LWGEOM::type, variant, WKT_IS_CHILD, and WKT_NO_TYPE.

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

Here is the call graph for this function:
Here is the caller graph for this function: