authoring library

The kit authoring toolkit, pure Dart: the catalog language, the library builder, the shared shape helpers, the geometry snapshot and the conformance test. A kit's generator runs it under plain dart run.

Classes

Catalog
A kit's symbols, in library order.
CatalogArc
An arc from the angle start through the signed sweep, both in radians: a positive sweep turns counter-clockwise from start, a negative one clockwise.
CatalogCircle
CatalogLine
CatalogPolyline
A polyline through points; closed repeats the first point.
CatalogShape
One drawn shape of a symbol.
CatalogSymbol
One symbol of a kit's library. A unit draws its outline first (K3 rule 11): a closed polyline or a circle. A retired symbol stays in the library and leaves the gallery (contract R2).
CatalogUnit
A symbol's service unit (umbrella A6).
KitNames
A kit's words by locale. Word ids: symbol:<key>, category:<kit id>/<English category>, sub-project 2's tool:<tool id>, type:<type id>, property:<type id>.<property>, and 2b's unit:<kit id>/<unit kind>. Every id carries its kit's id, so two kits never share one.
KitProblem
KitText
A word id and its arguments, put into words when read (KitWords.text). Equal by its id and its arguments' values, whatever their order.
LibraryComponent
A library's kit and format, on its root.
ManifestComponent
A plan's format and its kits' versions, on its root.
PlanWords
A kit's words at the plan's current locale, as a property reads them.
SymbolBox
The local box of a symbol: left = minX, right = maxX, front = minY, back = maxY in the definition's coordinates.
SymbolComponent
A symbol's identity and display data, on a definition's handle.
SymbolEntry
One symbol of a library: its identity, its unit or null, its definition and its leaves, ascending by handle (draw order).
SymbolLibrary
A validated library: its kit and its entries in definition-handle order.
UnitComponent
A served unit: its kind, its capacity and its labelling.
UnitKinds
The unit kinds the contract names. Others are allowed.

Enums

KitProblemCode
UnitLabelling
How a placed unit's label is formed.

Constants

chairSize → const double
A chair's side, in millimetres.
chairTuck → const double
How deep a chair sits under its table's edge.
stoolRadius → const double
A bar stool's seat radius (Ø 380).
stoolTuck → const double
How far a stool's seat reaches under its top's edge.

Functions

boxOfDefinition(DraftDocument doc, Handle definition) → SymbolBox?
The local box of the definition definition in doc, from its live leaves (the entities it owns); null when definition names no definition or none of its leaves draws.
boxOfEntry(SymbolEntry entry) → SymbolBox?
The local box of entry, computed on the first call and the same object on every later call for the same entry (spec D2: once per entry).
boxOfLeaves(Iterable<(EntityKind, GeometryPayload)> leaves) → SymbolBox?
The local box of leaves (each a kind and its payload, in the definition's coordinates), or null when none of them draws.
buildLibraryDocument(Catalog catalog) → DraftDocument
The library document of catalog. Deterministic: handles ascend in catalog order (a definition, its leaves, the next definition). Every leaf is on layer 0 with BYBLOCK linetype, colour, lineweight and transparency and no flag (K3 rule 14). The caller disposes the document.
chairAt(double cx, double cy, double facing) → List<CatalogShape>
A chair facing a table: its seat (a closed 450 x 450 square) centred at (cx, cy) and its back line, the table in direction facing (radians from +x). The back line is 60 in from the edge away from the table.
chairsAround(double cx, double cy, double r, int count) → List<CatalogShape>
count chairs around a round top of radius r centred at (cx, cy), at equal angles from the bottom, each tucked chairTuck under the edge.
cleanCoordinate(double v) → double
v rounded to 1e-6 mm, with -0 made 0: the dust of a rotation (1e-13 off a whole millimetre) never reaches a library. A sub-micrometre value is never meaningful in a symbol.
conformance({required Catalog catalog, required Uint8List committedLibrary, required String committedSnapshot, required KitNames names, required List<String> locales, Map<String, Set<String>> sameAsEnglish = const {}, Iterable<String> typeIds = const [], Iterable<String> toolIds = const [], Iterable<String> propertyIds = const []}) → List<KitProblem>
The problems of a kit: its catalog, its committedLibrary bytes, its committedSnapshot text, its names and its declared non-English locales. sameAsEnglish lists, per locale, the word ids whose right word is the English one. Empty when the kit conforms.
encodeLibrary(Catalog catalog) → Uint8List
The .jetlib bytes of catalog: the codec's JSON of buildLibraryDocument, UTF-8. The same catalog gives the same bytes.
encodeSnapshot(Map<String, String> snapshot) → String
snapshot as its file: one entry per line, sorted by key.
fillText(String template, Map<String, Object> args) → String
template with each placeholder {name} that args has replaced by '${args[name]}'; a placeholder without an argument is left as written, an argument the template does not name is ignored.
footprintOf(SymbolBox box) → Aabb2
box as the engine's box, the shape AttachmentQuery.footprint takes: x from left to right, y from front to back, in the definition's coordinates.
geometrySnapshot(Catalog catalog) → SplayTreeMap<String, String>
Each symbol of catalog by key@version, sorted, as a canonical JSON text: keys sorted, numbers in Dart's shortest round-trip form, -0 as 0.
inset(double x, double y, double w, double h, double d) → CatalogShape
rect of a w x h outline at (x, y), inset by d on every side.
isCodeId(String id) → bool
Whether id is a type id or a tool id (spec 2a P1): a kit id, then one or more dot-separated segments of lower-case letters and digits joined by single hyphens. architecture.wall, restaurant.booth.corner.
isKind(String kind) → bool
Whether kind is a target kind, a size family or a unit kind: lower-case letters and digits joined by single hyphens.
isKitId(String id) → bool
Whether id is a kit id: a lower-case letter, then lower-case letters and digits. No dot and no hyphen: it is the first segment of every key, type id and tool id.
isOrthonormal(Transform2 g) → bool
Whether g's linear part is orthonormal (spec 09c W-8, S-10): |a² + b² − 1|, |c² + d² − 1| and |ac + bd| each at most Tolerance.standard.linear. A mirror is orthonormal; a scale is not.
isSymbolKey(String key) → bool
Whether key is a symbol key: a kit id, then two or more dot-separated segments, each lower-case letters and digits joined by single hyphens.
kitOfKey(String id) → String
The first dot-separated segment of id (a key, a type id or a tool id): its kit. id itself when it holds no dot.
numberedNameIndex(String name, Iterable<String Function(int n)> patterns, {String fold(String)?}) → int?
The n of name when name is one of patterns at n, compared by fold (none: exactly); otherwise null. n is a positive integer written without a leading zero, after a space, at the end.
parseSnapshot(String text) → SplayTreeMap<String, String>
A committed snapshot's text, each entry re-encoded compactly. Only white space is normalised: key order and number spelling are kept, so an entry written by hand with 1 where geometrySnapshot writes 1.0 reads as changed (the comparison fails closed). Throws FormatException when text is not a JSON object of objects.
placeholdersOf(String template) → Set<String>
The names of template's placeholders.
placementTransform({required Vector2 at, required Vector2 basePoint, int? quarterTurns, (double, double)? rotation, bool mirrored = false}) → Transform2
translation(at) · rotation · scale(mirrored ? -1 : 1, 1) · translation(-basePoint): the definition's base point lands on at (spec F-2), and a mirror flips the local x axis whatever the rotation.
poly(List<CatalogPoint> points) → CatalogShape
A closed polyline through points.
rect(double x, double y, double w, double h) → CatalogShape
A closed axis-aligned rectangle from (x, y), w wide and h tall.
registerKitComponents(ComponentRegistry registry) → void
Registers jetcad.library, jetcad.manifest, jetcad.symbol and jetcad.unit on registry, and nothing else. Once per registry: register replaces a type's store.
servedTopOfEntry(SymbolEntry entry) → Aabb2
The served top of entry in its definition's coordinates (spec 2b S2, SymbolDefinitionRef.top): its first leaf's box when that leaf is a circle or a closed polyline (today's tableTopOf, jet_cad_floor_plan/lib/src/service/table_picker.dart:92-110), else the symbol's box (boxOfEntry); empty when no leaf draws. The entry's leaves are ascending by handle, so the first is the lowest.
stoolAt(double cx, double cy) → List<CatalogShape>
A bar stool at (cx, cy): its seat (Ø 380), then a Ø 300 footrest.
stoolsAround(double cx, double cy, double r, int count) → List<CatalogShape>
count stools around a round top of radius r centred at (cx, cy), at equal angles from the bottom, each reaching stoolTuck under the edge.
updateSnapshot(Map<String, String> committed, Map<String, String> current) → SplayTreeMap<String, String>
The generator's merge: every entry of committed as it is, plus the entries of current it lacks. Never rewrites an existing entry, so a changed geometry shows as a failing conformance test, never as a quietly regenerated file.

Typedefs

CatalogPoint = (double, double)
A point, (x, y) in millimetres.
SymbolLeaf = ({GeometryPayload payload, EntityRecord record})
A leaf of a symbol: its record (the library's handles and geomIndex) and its geometry.

Exceptions / Errors

SymbolLibraryError
A library the decoder refuses: rule is the spec's K3 rule (1-15), message names the offending key or handle.