FakePlanServices class final

A PlanServices over document for a kit's tests (spec 3a C1.11):

  • index: a SpatialIndex over document, made here;
  • camera: world to screen at scale pixels per unit (positive and finite), y up, the world origin at the screen's;
  • objectSnap: as given, for the fake's life;
  • attachments: the registry given, else one with no kind;
  • words: names at locale, numbers with decimalSeparator;
  • settingsOf: settings[toolId], the map given read at each call (never copied), so a test changes a tool's settings between events; a tool without settings there, or settings that are not an S, is an ArgumentError, as the plan's;
  • shared: one per T, the first call's; a T asked for while it is made is a StateError; the Disposable ones are disposed by dispose, last made first;
  • symbolDefinition: null (no library); symbolsState: ready;
  • liveTypeIdOf: catalog's typeIdOf, null for a handle in frozen and without a catalog.

dispose releases the index, the camera, the state and the shared objects; document is the caller's.

Implemented types

Constructors

FakePlanServices({required DraftDocument document, ParametricCatalog? catalog, Set<Handle> frozen = const {}, double scale = 1, bool objectSnap = true, KitNames names = KitNames.empty, Locale locale = const Locale('en'), String decimalSeparator = '.', Map<String, Object> settings = const {}, AttachmentRegistry? attachments})

Properties

attachments → AttachmentRegistry
Every loaded kit's attachment providers.
final
camera → CameraController
The camera, for apertures in world units.
final
document → DraftDocument
The current document.
final
hashCode → int
The hash code for this object.
no setterinherited
index → SpatialIndex
Its spatial index.
final
objectSnap → bool
The effective object-snap flag: F3 and the editor's snapping option.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
symbolsState → ValueListenable<SymbolsState>
The symbol libraries' state: the plan's own listenable, so a tool can wait for ready.
no setteroverride
words → KitWords
This kit's words at the plan's locale.
final

Methods

dispose() → void
Disposes the shared Disposables, last made first, then the index, the camera and the state. Once only.
liveTypeIdOf(Handle handle) → String?
The type id of handle's live object (spec 3a C1.5): a root-level group a loaded kit's type names (the engine's rule) that is not frozen (spec 2a E2). Null for a frozen object, an object of a kit that is not loaded (its component is kept raw), and anything else: an entity, a nested group, an instance, the root, a handle that names nothing.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
settingsOf<S extends Object>(String toolId) → S
The current settings of the tool toolId (one of this kit's tools with settings). Throws ArgumentError for another id or an S the settings are not.
override
shared<T extends Object>(T create(PlanServices)) → T
This kit's one T for the current document: create runs on the first call, later calls return the same instance. A T that is a Disposable is disposed with its document. Keyed by (kit, T), so two kits asking for the same type get one each.
override
symbolDefinition(String key) → SymbolDefinitionRef?
The symbol key, a full versioned key (kit.kind.variant@N), as a definition of the current document: the one it holds, or one to add. Null when no loaded library has key, or while the libraries load or after they failed (symbolsState tells which).
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited