PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ 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 }
void * lwrealloc(void *mem, size_t size)
Definition: lwutil.c:235
void lwfree(void *mem)
Definition: lwutil.c:242
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:216
void * lwalloc(size_t size)
Definition: lwutil.c:227
static char * lwgeom_flagchars(LWGEOM *lwg)
Definition: lwgeom_debug.c:36
char * lwgeom_summary(const LWGEOM *lwgeom, int offset)
Definition: lwgeom_debug.c:166
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
uint32_t ngeoms
Definition: liblwgeom.h:566
uint8_t type
Definition: liblwgeom.h:564
LWGEOM ** geoms
Definition: liblwgeom.h:561

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

Referenced by lwgeom_summary().

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