PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwcollection_summary()

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

Definition at line 74 of file lwgeom_debug.c.

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

Referenced by lwgeom_summary().

75 {
76  size_t size = 128;
77  char *result;
78  char *tmp;
79  int i;
80  static char *nl = "\n";
81  char *pad="";
82  char *zmflags = lwgeom_flagchars((LWGEOM*)col);
83 
84  LWDEBUG(2, "lwcollection_summary called");
85 
86  result = (char *)lwalloc(size);
87 
88  sprintf(result, "%*.s%s[%s] with %d elements\n",
89  offset, pad, lwtype_name(col->type),
90  zmflags,
91  col->ngeoms);
92 
93  for (i=0; i<col->ngeoms; i++)
94  {
95  tmp = lwgeom_summary(col->geoms[i], offset+2);
96  size += strlen(tmp)+1;
97  result = lwrealloc(result, size);
98 
99  LWDEBUGF(4, "Reallocated %d bytes for result", size);
100  if ( i > 0 ) strcat(result,nl);
101 
102  strcat(result, tmp);
103  lwfree(tmp);
104  }
105 
106  LWDEBUG(3, "lwcollection_summary returning");
107 
108  return result;
109 }
void lwfree(void *mem)
Definition: lwutil.c:214
uint8_t type
Definition: liblwgeom.h:487
char * lwgeom_summary(const LWGEOM *lwgeom, int offset)
Definition: lwgeom_debug.c:145
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
static char * lwgeom_flagchars(LWGEOM *lwg)
Definition: lwgeom_debug.c:23
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:188
LWGEOM ** geoms
Definition: liblwgeom.h:493
void * lwrealloc(void *mem, size_t size)
Definition: lwutil.c:207
void * lwalloc(size_t size)
Definition: lwutil.c:199
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
Here is the call graph for this function:
Here is the caller graph for this function: