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

◆ lwcollection_summary()

static char * lwcollection_summary ( LWCOLLECTION col,
int  offset 
)
static

Definition at line 89 of file lwgeom_debug.c.

90{
91 size_t size = 128;
92 char *result;
93 char *tmp;
94 uint32_t i;
95 static char *nl = "\n";
96 char *pad="";
97 char *zmflags = lwgeom_flagchars((LWGEOM*)col);
98
99 LWDEBUG(2, "lwcollection_summary called");
100
101 result = (char *)lwalloc(size);
102
103 snprintf(result, size, "%*.s%s[%s] with %d element%s",
104 offset, pad, lwtype_name(col->type),
105 zmflags,
106 col->ngeoms,
107 col->ngeoms ?
108 ( col->ngeoms > 1 ? "s:\n" : ":\n")
109 : "s");
110
111 for (i=0; i<col->ngeoms; i++)
112 {
113 tmp = lwgeom_summary(col->geoms[i], offset+2);
114 size += strlen(tmp)+1;
115 result = lwrealloc(result, size);
116
117 LWDEBUGF(4, "Reallocated %d bytes for result", size);
118 if ( i > 0 ) strcat(result,nl);
119
120 strcat(result, tmp);
121 lwfree(tmp);
122 }
123
124 LWDEBUG(3, "lwcollection_summary returning");
125
126 return result;
127}
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition cu_print.c:267
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition lwutil.c:216
void * lwrealloc(void *mem, size_t size)
Definition lwutil.c:242
void * lwalloc(size_t size)
Definition lwutil.c:227
void lwfree(void *mem)
Definition lwutil.c:248
static char * lwgeom_flagchars(LWGEOM *lwg)
char * lwgeom_summary(const LWGEOM *lwgeom, int offset)
#define LWDEBUG(level, msg)
Definition lwgeom_log.h:101
#define LWDEBUGF(level, msg,...)
Definition lwgeom_log.h:106
uint32_t ngeoms
Definition liblwgeom.h:580
uint8_t type
Definition liblwgeom.h:578
LWGEOM ** geoms
Definition liblwgeom.h:575

References LWCOLLECTION::geoms, lwalloc(), LWDEBUG, LWDEBUGF, lwfree(), lwgeom_flagchars(), lwgeom_summary(), lwrealloc(), lwtype_name(), LWCOLLECTION::ngeoms, result, and LWCOLLECTION::type.

Referenced by lwgeom_summary().

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