discontinuedPackage jet_cad_floor_plan has been discontinued and replaced by jet_cad_2d_plan.

tableLabelHeight function

double tableLabelHeight(
  1. EntityKind kind,
  2. GeometryPayload top
)

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);
}