PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ 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 433 of file gserialized_estimate.c.

434{
435 char *rv;
436 int j, k;
437 int sizex = (int)roundf(stats->size[0]);
438 int sizey = (int)roundf(stats->size[1]);
440
441 for ( k = 0; k < sizey; k++ )
442 {
443 for ( j = 0; j < sizex; j++ )
444 {
445 stringbuffer_aprintf(sb, "%3d ", (int)roundf(stats->value[j + k*sizex]));
446 }
447 stringbuffer_append(sb, "\n");
448 }
449
452 return rv;
453}
stringbuffer_t * stringbuffer_create(void)
Allocate a new stringbuffer_t.
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.
char * stringbuffer_getstringcopy(stringbuffer_t *s)
Returns a newly allocated string large enough to contain the current state of the string.
void stringbuffer_destroy(stringbuffer_t *s)
Free the stringbuffer_t and all memory managed within it.
static void stringbuffer_append(stringbuffer_t *s, const char *a)
Append the specified string to the stringbuffer_t.

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: