PostGIS  3.7.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 534 of file gserialized_estimate.c.

535 {
536  char *rv;
537  int j, k;
538  int sizex = (int)roundf(stats->size[0]);
539  int sizey = (int)roundf(stats->size[1]);
541 
542  for ( k = 0; k < sizey; k++ )
543  {
544  for ( j = 0; j < sizex; j++ )
545  {
546  stringbuffer_aprintf(sb, "%3d ", (int)roundf(stats->value[j + k*sizex]));
547  }
548  stringbuffer_append(sb, "\n");
549  }
550 
553  return rv;
554 }
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:254
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:136
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: