PostGIS  2.2.7dev-r@@SVN_REVISION@@
static char* lwpoly_summary ( LWPOLY poly,
int  offset 
)
static

Definition at line 112 of file lwgeom_debug.c.

References lwalloc(), LWDEBUG, lwgeom_flagchars(), lwtype_name(), POINTARRAY::npoints, LWPOLY::nrings, LWPOLY::rings, and LWPOLY::type.

Referenced by lwgeom_summary().

113 {
114  char tmp[256];
115  size_t size = 64*(poly->nrings+1)+128;
116  char *result;
117  int i;
118  char *pad="";
119  static char *nl = "\n";
120  char *zmflags = lwgeom_flagchars((LWGEOM*)poly);
121 
122  LWDEBUG(2, "lwpoly_summary called");
123 
124  result = (char *)lwalloc(size);
125 
126  sprintf(result, "%*.s%s[%s] with %i rings\n",
127  offset, pad, lwtype_name(poly->type),
128  zmflags,
129  poly->nrings);
130 
131  for (i=0; i<poly->nrings; i++)
132  {
133  sprintf(tmp,"%s ring %i has %i points",
134  pad, i, poly->rings[i]->npoints);
135  if ( i > 0 ) strcat(result,nl);
136  strcat(result,tmp);
137  }
138 
139  LWDEBUG(3, "lwpoly_summary returning");
140 
141  return result;
142 }
int npoints
Definition: liblwgeom.h:355
#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
uint8_t type
Definition: liblwgeom.h:435
POINTARRAY ** rings
Definition: liblwgeom.h:441
int nrings
Definition: liblwgeom.h:439
void * lwalloc(size_t size)
Definition: lwutil.c:199

Here is the call graph for this function:

Here is the caller graph for this function: