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

Definition at line 125 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().

126 {
127  char tmp[256];
128  size_t size = 64*(poly->nrings+1)+128;
129  char *result;
130  int i;
131  char *pad="";
132  static char *nl = "\n";
133  char *zmflags = lwgeom_flagchars((LWGEOM*)poly);
134 
135  LWDEBUG(2, "lwpoly_summary called");
136 
137  result = (char *)lwalloc(size);
138 
139  sprintf(result, "%*.s%s[%s] with %i rings\n",
140  offset, pad, lwtype_name(poly->type),
141  zmflags,
142  poly->nrings);
143 
144  for (i=0; i<poly->nrings; i++)
145  {
146  sprintf(tmp,"%s ring %i has %i points",
147  pad, i, poly->rings[i]->npoints);
148  if ( i > 0 ) strcat(result,nl);
149  strcat(result,tmp);
150  }
151 
152  LWDEBUG(3, "lwpoly_summary returning");
153 
154  return result;
155 }
int npoints
Definition: liblwgeom.h:370
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
static char * lwgeom_flagchars(LWGEOM *lwg)
Definition: lwgeom_debug.c:36
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:216
uint8_t type
Definition: liblwgeom.h:450
POINTARRAY ** rings
Definition: liblwgeom.h:456
int nrings
Definition: liblwgeom.h:454
void * lwalloc(size_t size)
Definition: lwutil.c:227

Here is the call graph for this function:

Here is the caller graph for this function: