tableLabelHeight function
min(200, 0.4 × min(w, h)), where w × h is the local bounding box of
the served top: the definition's first leaf (14s S4), a closed polyline
or a circle. Any other kind gives the full height.
Implementation
double tableLabelHeight(EntityKind kind, GeometryPayload top) {
final double side;
switch (kind) {
case EntityKind.circle:
side = 2 * top.scalars[0];
case EntityKind.polyline:
final c = top.coords;
var minX = c[0], maxX = c[0], minY = c[1], maxY = c[1];
for (var i = 2; i + 1 < c.length; i += 2) {
minX = math.min(minX, c[i]);
maxX = math.max(maxX, c[i]);
minY = math.min(minY, c[i + 1]);
maxY = math.max(maxY, c[i + 1]);
}
side = math.min(maxX - minX, maxY - minY);
default:
return kTableLabelMaxHeight;
}
return math.min(kTableLabelMaxHeight, kTableLabelTopShare * side);
}