discontinuedPackage jet_cad_floor_plan has been discontinued and replaced by jet_cad_2d_plan.

roomInputOf function

RoomInput? roomInputOf(
  1. Handle h,
  2. Component params,
  3. Transform2 toWorld, {
  4. List<WorldWall> walls = const [],
})

h's input to the tracer from its component params and its group's accumulated transform toWorld (spec 10 D4): the one function both adapters call.

  • WallParams: the wall's uncut band, localOutlineOf among walls (its wall neighbours, ascending) taken to world through toWorld -- the ring 07 stores for the wall when it has no openings, so a doorway, a window or a gap never breaks a room (R-5: the local ring, not 07's world outline, so the band traced is the one drawn). None for 07 D2's degenerate wall (an empty ring).
  • SeparatorParams: its world segment, open. None when its length is not more than roomTrace.linear or an endpoint is not finite (D3's degenerate separator).
  • anything else: none. Boxes and openings are not inputs.

A result with a non-finite coordinate is none (S-6).

Implementation

RoomInput? roomInputOf(Handle h, Component params, Transform2 toWorld,
    {List<WorldWall> walls = const []}) {
  switch (params) {
    case final WallParams p:
      final ring = localOutlineOf(WorldWall(h, p, toWorld), walls).ring;
      if (ring.isEmpty) return null;
      final world = [for (final q in ring) toWorld.transformPoint(q)];
      if (!world.every(_finite)) return null;
      return RoomInput(h, world, closed: true);
    case final SeparatorParams p:
      final s = toWorld.transformPoint(p.start);
      final e = toWorld.transformPoint(p.end);
      if (!_finite(s) || !_finite(e)) return null;
      if (!((e - s).length > roomTrace.linear)) return null;
      return RoomInput(h, [s, e], closed: false);
    default:
      return null;
  }
}