in src/apps/filters/h3ToComponents.c [46:103]
void doCell(H3Index h, bool verboseMode) {
int h3Mode = H3_GET_MODE(h);
int h3Res = H3_GET_RESOLUTION(h);
int h3BaseCell = H3_GET_BASE_CELL(h);
if (verboseMode) {
const char* modes[] = {
"RESERVED", // 0
"Hexagon", // 1
"Unidirectional Edge", // 2
"INVALID", // 3
"INVALID", // 4
"INVALID", // 5
"INVALID", // 6
"INVALID", // 7
"INVALID", // 8
"INVALID", // 9
"INVALID", // 10
"INVALID", // 11
"INVALID", // 12
"INVALID", // 13
"INVALID", // 14
"INVALID", // 15
};
printf("╔════════════╗\n");
char hStr[BUFF_SIZE];
H3_EXPORT(h3ToString)(h, hStr, BUFF_SIZE);
printf("║ H3Index ║ %s\n", hStr);
printf("╠════════════╣\n");
printf("║ Mode ║ %s (%i)\n", modes[h3Mode], h3Mode);
printf("║ Resolution ║ %i\n", h3Res);
if (h3Mode == H3_UNIEDGE_MODE) {
printf("║ Edge ║ %i\n", H3_GET_RESERVED_BITS(h));
}
printf("║ Base Cell ║ %i\n", h3BaseCell);
for (int i = 1; i <= h3Res; i++) {
printf("║%3i Child ║ %c\n", i,
resDigitToChar(H3_GET_INDEX_DIGIT(h, i)));
}
printf("╚════════════╝\n\n");
} else {
if (h3Mode == H3_HEXAGON_MODE) {
printf("%d:%d:%d:", h3Mode, h3Res, h3BaseCell);
for (int i = 1; i <= h3Res; i++) {
printf("%c", resDigitToChar(H3_GET_INDEX_DIGIT(h, i)));
}
printf("\n");
} else if (h3Mode == H3_UNIEDGE_MODE) {
printf("%d:%d:%d:%d:", h3Mode, H3_GET_RESERVED_BITS(h), h3Res,
h3BaseCell);
for (int i = 1; i <= h3Res; i++) {
printf("%c", resDigitToChar(H3_GET_INDEX_DIGIT(h, i)));
}
printf("\n");
} else {
printf("INVALID INDEX\n");
}
}
}