PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ lwpoly_summary()

static char* lwpoly_summary ( LWPOLY poly,
int  offset 
)
static

Definition at line 130 of file lwgeom_debug.c.

131 {
132  char tmp[256];
133  size_t size = 64*(poly->nrings+1)+128;
134  char *result;
135  uint32_t i;
136  char *pad="";
137  static char *nl = "\n";
138  char *zmflags = lwgeom_flagchars((LWGEOM*)poly);
139 
140  LWDEBUG(2, "lwpoly_summary called");
141 
142  result = (char *)lwalloc(size);
143 
144  snprintf(result, size, "%*.s%s[%s] with %i ring%s",
145  offset, pad, lwtype_name(poly->type),
146  zmflags,
147  poly->nrings,
148  poly->nrings ?
149  ( poly->nrings > 1 ? "s:\n" : ":\n")
150  : "s");
151 
152  for (i=0; i<poly->nrings; i++)
153  {
154  snprintf(tmp, sizeof(tmp), "%s ring %i has %i points",
155  pad, i, poly->rings[i]->npoints);
156  if ( i > 0 ) strcat(result,nl);
157  strcat(result,tmp);
158  }
159 
160  LWDEBUG(3, "lwpoly_summary returning");
161 
162  return result;
163 }
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
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
POINTARRAY ** rings
Definition: liblwgeom.h:505
uint8_t type
Definition: liblwgeom.h:508
uint32_t nrings
Definition: liblwgeom.h:510
uint32_t npoints
Definition: liblwgeom.h:413

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

Referenced by lwgeom_summary().

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