PostGIS 3.6.2dev-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 437 of file gserialized_estimate.c.

438{
439 char *rv;
440 int j, k;
441 int sizex = (int)roundf(stats->size[0]);
442 int sizey = (int)roundf(stats->size[1]);
444
445 for ( k = 0; k < sizey; k++ )
446 {
447 for ( j = 0; j < sizex; j++ )
448 {
449 stringbuffer_aprintf(sb, "%3d ", (int)roundf(stats->value[j + k*sizex]));
450 }
451 stringbuffer_append(sb, "\n");
452 }
453
456 return rv;
457}
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: