PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ nd_stats_to_grid()

static char* nd_stats_to_grid ( const ND_STATS stats)
static

Create a printable view of the ND_STATS histogram.

Caller is responsible for freeing. Currently only prints first two dimensions.

Definition at line 537 of file gserialized_estimate.c.

538 {
539  char *rv;
540  int j, k;
541  int sizex = (int)roundf(stats->size[0]);
542  int sizey = (int)roundf(stats->size[1]);
544 
545  for ( k = 0; k < sizey; k++ )
546  {
547  for ( j = 0; j < sizex; j++ )
548  {
549  stringbuffer_aprintf(sb, "%3d ", (int)roundf(stats->value[j + k*sizex]));
550  }
551  stringbuffer_append(sb, "\n");
552  }
553 
556  return rv;
557 }
int stringbuffer_aprintf(stringbuffer_t *s, const char *fmt,...)
Appends a formatted string to the current string buffer, using the format and argument list provided.
Definition: stringbuffer.c:247
stringbuffer_t * stringbuffer_create(void)
Allocate a new stringbuffer_t.
Definition: stringbuffer.c:33
void stringbuffer_destroy(stringbuffer_t *s)
Free the stringbuffer_t and all memory managed within it.
Definition: stringbuffer.c:85
char * stringbuffer_getstringcopy(stringbuffer_t *s)
Returns a newly allocated string large enough to contain the current state of the string.
Definition: stringbuffer.c:133
static void stringbuffer_append(stringbuffer_t *s, const char *a)
Append the specified string to the stringbuffer_t.
Definition: stringbuffer.h:105
float4 size[ND_DIMS]

References ND_STATS_T::size, stringbuffer_append(), stringbuffer_aprintf(), stringbuffer_create(), stringbuffer_destroy(), stringbuffer_getstringcopy(), and ND_STATS_T::value.

Referenced by _postgis_gserialized_stats().

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