@archilogic/floor-plan-sdk 3.2.1 → 4.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/fpe.d.ts ADDED
@@ -0,0 +1,1476 @@
1
+ declare const validNodeTypes: readonly ["a:helper:spaceDivider", "a:reference:externalId", "a:reference:ifcElement", "a:reference:ifcFile", "a:relation:wall", "a:settings:display", "a:settings:generatedGroup", "box", "camera-bookmark", "closet", "column", "curtain", "door", "floor", "floorplan", "floorplanDxf", "group", "interior", "kitchen", "level", "object", "pic", "plan", "polybox", "polyfloor", "railing", "stairs", "tag", "wall", "window"];
2
+ type NodeTypes = typeof validNodeTypes[number];
3
+ type NodesByType = {
4
+ [K in NodeTypes]: SceneNode[];
5
+ };
6
+
7
+ declare class TinyEmitter$1 {
8
+ on(event: string, callback: Function, ctx?: any): this;
9
+ once(event: string, callback: Function, ctx?: any): this;
10
+ emit(event: string, ...args: any[]): this;
11
+ off(event: string, callback?: Function): this;
12
+ }
13
+
14
+ type Point2d = [number, number];
15
+ type Polygon = Point2d[];
16
+ type PolygonList = Polygon[];
17
+ type BoundingBox2d = {
18
+ x: number;
19
+ z: number;
20
+ x2: number;
21
+ z2: number;
22
+ length: number;
23
+ width: number;
24
+ };
25
+ interface Vector2d {
26
+ x: number;
27
+ z: number;
28
+ }
29
+ interface Vector extends Vector2d {
30
+ y?: number;
31
+ }
32
+ interface Vector3d extends Vector {
33
+ x: number;
34
+ y: number;
35
+ z: number;
36
+ }
37
+ type ProductId = string;
38
+ type ProductSrc = `!${ProductId}`;
39
+
40
+ type RGBArray$1 = [number, number, number];
41
+ interface MaterialDefinition {
42
+ size?: [number, number];
43
+ colorDiffuse?: RGBArray$1;
44
+ colorSpecular?: RGBArray$1;
45
+ specularCoef?: number;
46
+ mapDiffuse?: string;
47
+ mapDiffusePreview?: string;
48
+ mapDiffuseSource?: string;
49
+ mapDiffuseKey?: string;
50
+ mapSpecular?: string;
51
+ mapSpecularPreview?: string;
52
+ mapSpecularSource?: string;
53
+ mapSpecularKey?: string;
54
+ mapNormal?: string;
55
+ mapNormalPreview?: string;
56
+ mapNormalSource?: string;
57
+ mapNormalKey?: string;
58
+ mapAlpha?: string;
59
+ mapAlphaPreview?: string;
60
+ mapAlphaSource?: string;
61
+ mapAlphaKey?: string;
62
+ opacity?: number;
63
+ bsdfType?: string;
64
+ useInBaking?: boolean;
65
+ wrap?: 'repeat' | 'mirror';
66
+ receiveRealTimeShadows?: boolean;
67
+ castRealTimeShadows?: boolean;
68
+ hideAfterBaking?: boolean;
69
+ no2dOutline?: boolean;
70
+ wireframeThickness?: number;
71
+ wireframeThresholdAngle?: number;
72
+ wireframeColor?: RGBArray$1;
73
+ wireframeOpacity?: number;
74
+ lightEmissionCoef?: number;
75
+ }
76
+ type MaterialReference = string;
77
+ type Material = MaterialDefinition | MaterialReference;
78
+ interface SceneNodeMaterials {
79
+ [meshName: string]: Material;
80
+ }
81
+
82
+ declare class SceneNodeJson {
83
+ type?: NodeTypes;
84
+ id?: string;
85
+ x?: number;
86
+ y?: number;
87
+ z?: number;
88
+ ry?: number;
89
+ l?: number;
90
+ w?: number;
91
+ h?: number;
92
+ v?: string;
93
+ src?: ProductSrc;
94
+ polygon?: Polygon;
95
+ polygonHoles?: Polygon[];
96
+ locked?: boolean;
97
+ class?: string[];
98
+ usage?: string;
99
+ hCeiling?: number;
100
+ hasCeiling?: boolean;
101
+ materials?: SceneNodeMaterials;
102
+ name?: string;
103
+ customId?: string;
104
+ controlLine?: string;
105
+ baseHeight?: number;
106
+ backHasBase?: boolean;
107
+ frontHasBase?: boolean;
108
+ nodeIds?: {
109
+ [nodeId: string]: string;
110
+ };
111
+ nodeId?: string;
112
+ params?: {
113
+ [param: string]: any;
114
+ };
115
+ shape?: string;
116
+ doorType?: string;
117
+ doorAngle?: number;
118
+ doorWidth?: number;
119
+ side?: string;
120
+ hinge?: string;
121
+ threshold?: boolean;
122
+ thresholdHeight?: number;
123
+ leafWidth?: number;
124
+ leafOffset?: number;
125
+ frameOffset?: number;
126
+ fixLeafRatio?: number;
127
+ rowRatios?: number[];
128
+ columnRatios?: number[][];
129
+ frameWidth?: number;
130
+ frameLength?: number;
131
+ cooktopType?: string;
132
+ sinkType?: string;
133
+ sinkPos?: number;
134
+ cooktopPos?: number;
135
+ ovenPos?: number;
136
+ ovenType?: string;
137
+ baseBoard?: number;
138
+ highCabinetLeft?: number;
139
+ highCabinetRight?: number;
140
+ cabinetType?: string;
141
+ counterHeight?: number;
142
+ counterThickness?: number;
143
+ elementLength?: number;
144
+ wallCabinet?: boolean;
145
+ wallCabinetWidth?: number;
146
+ wallCabinetHeight?: number;
147
+ barCounter?: boolean;
148
+ fridge?: boolean;
149
+ fridgePos?: number;
150
+ microwave?: boolean;
151
+ microwavePos?: number;
152
+ extractorType?: string;
153
+ baseboard?: number;
154
+ handleWidth?: number;
155
+ handleHeight?: number;
156
+ handleLength?: number;
157
+ file?: string;
158
+ drawingOrigin?: number[];
159
+ drawingUnits?: 'kilometers' | 'meters' | 'centimeters' | 'millimeters' | 'miles' | 'feet' | 'inches';
160
+ hiddenLayers?: string[];
161
+ circulation?: string;
162
+ stairType?: string;
163
+ stepWidth?: number;
164
+ railing?: 'none' | 'left' | 'right' | 'both';
165
+ railingType?: 'verticalBars' | 'filling';
166
+ treadHeight?: number;
167
+ stepThickness?: number;
168
+ segmentation?: string;
169
+ pailing?: number;
170
+ segments?: number;
171
+ segmentDistance?: number;
172
+ railCount?: number;
173
+ rx?: number;
174
+ distance?: number;
175
+ index?: number;
176
+ visibleLevelIds?: string[];
177
+ hiddenLevelIds?: string[];
178
+ fov?: number;
179
+ mode?: string;
180
+ displayInUI?: boolean;
181
+ activeLevelId?: string;
182
+ bake?: boolean;
183
+ bakeStatus?: string;
184
+ bakedModelUrl?: string;
185
+ bakedModelStage?: string;
186
+ bakeContentHash?: string;
187
+ bakePollStage?: string;
188
+ bakePreviewStatusFileKey?: string;
189
+ bakeRegularStatusFileKey?: string;
190
+ bakeSettings?: any;
191
+ lightMapCenter?: number;
192
+ lightMapFalloff?: number;
193
+ lightMapIntensity?: number;
194
+ skyMap?: string;
195
+ _highlight?: HighlightArgs;
196
+ _isSelected?: boolean;
197
+ children?: SceneNodeJson[];
198
+ units?: string;
199
+ folds?: number;
200
+ method?: string;
201
+ }
202
+ interface SceneNodeOptions {
203
+ /** apply default schema to each node - node.addChild has this set to true by default */
204
+ setDefaults?: boolean;
205
+ /** force regenerating node ids - otherwise ids will only be generated if they are missing */
206
+ regenerateIds?: boolean;
207
+ force?: boolean;
208
+ keepTransient?: boolean;
209
+ /** provide an id for an action to be able to group multiple actions */
210
+ actionId?: string;
211
+ /** define whether the update requires an update of computed properties */
212
+ updateState?: boolean;
213
+ /** define whether an event should be broadcasted - for plugins or multiplayer */
214
+ skipHistory?: boolean;
215
+ /** relevant for plugins or multiplayer: should the event be broadcasted */
216
+ preventBroadcast?: boolean;
217
+ }
218
+ interface ToJsonOptions extends SceneNodeOptions {
219
+ /** export the mapping between old and new node ids as top-level idMap property */
220
+ exportIdMap?: boolean;
221
+ }
222
+ interface TransformArgs {
223
+ x?: number;
224
+ y?: number;
225
+ z?: number;
226
+ ry?: number;
227
+ }
228
+ type RGBArray = [number, number, number];
229
+ interface HighlightArgs {
230
+ /** color overlay for the node */
231
+ fill?: RGBArray;
232
+ /** opacity for the color overlay */
233
+ fillOpacity?: number;
234
+ /** outline for the node */
235
+ outline?: RGBArray;
236
+ /** width of the outline */
237
+ outlineWidth?: number;
238
+ }
239
+ /**
240
+ * Main class for the nodes in a scene
241
+ */
242
+ declare class SceneNode extends SceneNodeJson {
243
+ /** node type: 'wall', 'column' etc */
244
+ type: NodeTypes;
245
+ /** globally unique id for each node */
246
+ id: string;
247
+ children: SceneNode[];
248
+ private _parent;
249
+ private _scene;
250
+ private _emitter;
251
+ constructor({ node, parent, scene, emitter, options }: {
252
+ /** node params */
253
+ node: SceneNodeJson;
254
+ /** parent node */
255
+ parent?: SceneNode;
256
+ /** the scene class to get access to scene.nodesByType etc */
257
+ scene?: Scene;
258
+ /** optional emitter that emits events for all SceneNode updates */
259
+ emitter?: TinyEmitter$1;
260
+ /** scene node options */
261
+ options?: SceneNodeOptions;
262
+ });
263
+ get parent(): SceneNode;
264
+ get scene(): Scene;
265
+ get schema(): Schema;
266
+ /**
267
+ * internal method: update the properties of a scene node
268
+ * @param {Object} args - update arguments
269
+ */
270
+ _update(args?: SceneNodeJson): void;
271
+ /**
272
+ * set the attributes of a scene node
273
+ * @param {Object} args - update arguments
274
+ * @param {Object} [options] - update options
275
+ */
276
+ set(args?: SceneNodeJson, options?: SceneNodeOptions): void;
277
+ /**
278
+ * set the transform of a scene node ( this is faster than node.set )
279
+ * @param {Object} args - update arguments { x, y, z, ry }
280
+ * @param {Object} [options] - update options
281
+ */
282
+ setTransform({ x, y, z, ry }?: TransformArgs, options?: SceneNodeOptions): void;
283
+ /**
284
+ * set the materials of a scene node
285
+ * @param {Object} materials - Object containing meshKey - material definition pairs, material definition can be a name(String) or a new definition(Object)
286
+ * @param {Object} [options] - update options
287
+ */
288
+ setMaterials(materials?: SceneNodeMaterials, options?: SceneNodeOptions): void;
289
+ /**
290
+ * set transient attributes of a scene node [ v1.6 ]
291
+ * @param {Object} args - transient arguments, have to be prefixed with underscore
292
+ */
293
+ setTransient(args?: {}, options?: SceneNodeOptions): void;
294
+ /**
295
+ * method to set the transient _highlight property of a scene node
296
+ * will emit a set-transient event
297
+ */
298
+ setHighlight(args?: HighlightArgs, options?: SceneNodeOptions): void;
299
+ /**
300
+ * find node by id ( unique ) or type ( find first )
301
+ */
302
+ find(args?: {
303
+ id?: string;
304
+ type?: NodeTypes;
305
+ }): SceneNode | void;
306
+ /**
307
+ * find all children nodes by type
308
+ */
309
+ findAll(args?: {
310
+ type?: NodeTypes;
311
+ }): SceneNode[];
312
+ /**
313
+ * add child to node
314
+ * @returns {SceneNode} the new child
315
+ */
316
+ addChild(node: SceneNodeJson, options?: SceneNodeOptions): SceneNode;
317
+ /**
318
+ * remove child from node
319
+ */
320
+ removeChild(node: any, options?: SceneNodeOptions): void;
321
+ /**
322
+ * remove node from its parent
323
+ */
324
+ remove(options?: SceneNodeOptions): void;
325
+ /**
326
+ * get nodes in the scene that refer to this node, like relation or setting nodes
327
+ */
328
+ getReferringNodes(): SceneNode[];
329
+ /**
330
+ * get the world position from a local position
331
+ */
332
+ getWorldPosition(): any;
333
+ /**
334
+ * get the local position from a world position
335
+ */
336
+ getLocalPositionFromWorld(pos: SceneNodeJson): SceneNodeJson;
337
+ /**
338
+ * get list of all parent nodes
339
+ */
340
+ getParents(): SceneNode[];
341
+ /**
342
+ * export scene node to json removing transient data
343
+ */
344
+ toJson(options?: ToJsonOptions): any;
345
+ /**
346
+ * Executes the callback on this node and all descendants
347
+ */
348
+ traverse(callback: (node: SceneNode) => any): void;
349
+ }
350
+
351
+ declare enum spaceCategories {
352
+ residential = "residential",
353
+ office = "office",
354
+ parking = "parking",
355
+ lightIndustrial = "lightIndustrial"
356
+ }
357
+ type SpaceCategories = keyof typeof spaceCategories;
358
+
359
+ type NodesByName = {
360
+ [key: string]: SceneNode[];
361
+ };
362
+ type Schema = {
363
+ [K in NodeTypes]?: TypeSchema;
364
+ };
365
+ interface TypeSchemaProperty {
366
+ type?: string | string[];
367
+ description?: string;
368
+ const?: string;
369
+ pattern?: string;
370
+ items?: TypeSchemaProperty | TypeSchemaProperty[];
371
+ default?: any;
372
+ minimum?: number;
373
+ maximum?: number;
374
+ minItems?: number;
375
+ maxItems?: number;
376
+ multipleOf?: number;
377
+ enum?: string[];
378
+ patternProperties?: any;
379
+ additionalProperties?: boolean;
380
+ properties?: {
381
+ [key: string]: TypeSchemaProperty;
382
+ };
383
+ children?: TypeSchemaProperty;
384
+ }
385
+ interface TypeSchema {
386
+ type?: string;
387
+ required?: string[];
388
+ additionalProperties?: boolean;
389
+ description?: string;
390
+ properties: {
391
+ [key: string]: TypeSchemaProperty;
392
+ };
393
+ }
394
+ interface SceneOptions {
395
+ spaceContourAreaThreshold?: number;
396
+ }
397
+ /**
398
+ * Central class to load an entire scene
399
+ * scene structure is converted into a tree of SceneNode items
400
+ * nodes can be quickly accessed
401
+ * via `scene.nodesById[<uuid>]`
402
+ * or `scene.nodesByType[<type>]`
403
+ */
404
+ declare class Scene {
405
+ sceneId: string | null;
406
+ node: SceneNode | null;
407
+ /** @deprecated */
408
+ type: string;
409
+ spaceCategories: SpaceCategories[];
410
+ nodesById: {
411
+ [uuid: string]: SceneNode;
412
+ };
413
+ nodesByType: NodesByType;
414
+ nodesByName: NodesByName;
415
+ options: SceneOptions;
416
+ private _emitter;
417
+ private _schema;
418
+ private _apiVersion;
419
+ constructor({ schema, options }?: {
420
+ /** optionally initialize scene with existing schema */
421
+ schema?: Schema;
422
+ options?: SceneOptions;
423
+ });
424
+ get emitter(): TinyEmitter$1;
425
+ get schema(): Schema;
426
+ set schema(schema: Schema);
427
+ /**
428
+ * load scene structure recursively, creating sceneNodes
429
+ * and registering nodes and nodesByType
430
+ */
431
+ loadSceneStructure(sceneStructure: SceneNodeJson,
432
+ /** options will be handed to new SceneNode() */
433
+ options?: {
434
+ /** overwrite the rotation of the plan node - will be restored on planNode.toJson() */
435
+ planRotation?: number;
436
+ /** apply default schema to each node, useful when starting a plan from scratch ({type: 'plan'}) */
437
+ setDefaults?: boolean;
438
+ /** force regenerating node ids - otherwise ids will only be generated if they are missing */
439
+ regenerateIds?: boolean;
440
+ }): SceneNode;
441
+ /**
442
+ * set the scene type
443
+ * @deprecated, use setSpaceCategories() instead
444
+ */
445
+ setSceneType(): void;
446
+ _setSceneType(): void;
447
+ /**
448
+ * set the space categories
449
+ */
450
+ setSpaceCategories(): void;
451
+ /**
452
+ * compute the floor area
453
+ */
454
+ getFloorArea(): number;
455
+ /**
456
+ * add a node in scene.nodesByType, nodesById, and nodesByName
457
+ */
458
+ registerNode(node: SceneNode): void;
459
+ /**
460
+ * remove a node in scene.nodesByType, nodesById, and nodesByName
461
+ */
462
+ unregisterNode(node: SceneNode): void;
463
+ /**
464
+ * subscribe to a scene event
465
+ * * SceneNode events that change a node
466
+ * all set events fire with `{ node: <SceneNode>, args: <payload>, prevState: <oldValues>, options: <Object>, event: <eventName> }`
467
+ * * `set-transform` - x,y,z or ry is changed for a node
468
+ * * `set` - an attribute is changed for a node, like l or w
469
+ * * `set-materials` - a material for a specific mesh is changed for a node, args: `{ <meshName>: <material> }`
470
+ * * `set-transient` - transient attribute ( starting with underscore ) is changed for a node
471
+ * * SceneNode events that change the node tree
472
+ * all tree change events fire with `{ node: <SceneNode>, args: <SceneNode>, options: <Object>, event: <eventName> }`
473
+ * * `add-child` - a child (args) is added to the node
474
+ * * `remove-child` - a child (args) is removed from the node
475
+ * * Scene events:
476
+ * * `scene-structure-loading` - fires when the loadSceneStructure is starting, payload is the Scene instance
477
+ * * `scene-structure-loaded` - fires when the loadSceneStructure is complete, payload is the Scene instance
478
+ */
479
+ on(event: string, callback: any, context?: any): void;
480
+ /**
481
+ * subscribe to a scene event but remove after first emit
482
+ * otherwise like scene.on()
483
+ */
484
+ once(event: string, callback: any, context?: any): void;
485
+ /**
486
+ * unsubscribe from a scene event
487
+ */
488
+ off(event: string, callback?: any): void;
489
+ /**
490
+ * emit an event
491
+ */
492
+ emit(event: string, arg1: any, arg2?: any, arg3?: any, arg4?: any): void;
493
+ /**
494
+ * retrieve scene structure api version
495
+ */
496
+ get apiVersion(): string;
497
+ }
498
+
499
+ interface SpaceRelations {
500
+ /** space id */
501
+ node: SceneNode;
502
+ /** related nodes */
503
+ relationsById: NodeIdList;
504
+ relationsByEdgeIndex: {};
505
+ }
506
+ interface NodeIdList {
507
+ [nodeId: string]: {
508
+ /** related node */
509
+ node: SceneNode;
510
+ /** type of the relation */
511
+ relation: 'edge' | 'contained';
512
+ /** edge relations */
513
+ edgeRelations?: {
514
+ /** edge index of the space polygon [ loopIndex, edgeIndex ] */
515
+ edgeIndex?: [number, number];
516
+ /** edge index of related node */
517
+ nodeContourIndex?: number;
518
+ }[];
519
+ };
520
+ }
521
+
522
+ interface ShapeStyle {
523
+ stroke?: string | number | number[];
524
+ strokeWidth?: number | 'native';
525
+ strokeOpacity?: number;
526
+ fill?: string | number | number[] | false;
527
+ fillOpacity?: number;
528
+ }
529
+ interface BaseShape {
530
+ type: string;
531
+ style?: ShapeStyle;
532
+ }
533
+ interface LineShape extends BaseShape {
534
+ type: 'line';
535
+ start: Point2d;
536
+ end: Point2d;
537
+ }
538
+ interface ArcShape extends BaseShape {
539
+ type: 'arc';
540
+ position: Point2d;
541
+ radius: number;
542
+ startAngle: number;
543
+ endAngle: number;
544
+ }
545
+ interface CompositeShape extends BaseShape {
546
+ type: 'composite';
547
+ segments: OpenShapes[];
548
+ }
549
+ type OpenShapes = LineShape | ArcShape | PolylineShape | BezierShape;
550
+ interface CircleShape extends BaseShape {
551
+ type: 'circle';
552
+ position: Point2d;
553
+ radius: number;
554
+ }
555
+ interface RectShape extends BaseShape {
556
+ type: 'rectangle';
557
+ position: Point2d;
558
+ dimensions: [number, number];
559
+ }
560
+ interface PolygonShape extends BaseShape {
561
+ type: 'polygon';
562
+ points: Polygon;
563
+ holes?: PolygonList;
564
+ }
565
+ interface PolylineShape extends BaseShape {
566
+ type: 'polyline';
567
+ points: Polygon;
568
+ }
569
+ interface BezierShape extends BaseShape {
570
+ type: 'quadraticBezier';
571
+ points: Polygon;
572
+ }
573
+ interface TextShape extends BaseShape {
574
+ type: 'text';
575
+ position: Point2d;
576
+ text: string;
577
+ rotation?: number;
578
+ alignV?: 'center' | 'bottom' | 'top';
579
+ alignH?: 'center' | 'left' | 'right';
580
+ fontSize?: number;
581
+ }
582
+ type Shape = PolygonShape | PolylineShape | RectShape | CircleShape | LineShape | GroupShape | TextShape | ArcShape | BezierShape | CompositeShape;
583
+ interface GroupShape extends BaseShape {
584
+ type: 'group';
585
+ position?: Point2d;
586
+ rotation?: number;
587
+ children: Shape[];
588
+ }
589
+ /**
590
+ * boolean union of two or more polygon
591
+ */
592
+ declare function polygonUnion(polygons: PolygonList): PolygonList;
593
+ declare enum EndType {
594
+ etOpenSquare = 0,
595
+ etOpenRound = 1,
596
+ etOpenButt = 2,
597
+ etClosedLine = 3,
598
+ etClosedPolygon = 4
599
+ }
600
+ /**
601
+ * contour offset for one or multiple polygons
602
+ * https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibendtype
603
+ */
604
+ declare function polygonOffset(polygons: PolygonList, delta?: number, endType?: EndType, skipCleaning?: boolean): PolygonList;
605
+ /**
606
+ * boolean intersection of two or more polygon
607
+ * the subject path can be an open polyline
608
+ */
609
+ declare function polygonIntersection(polygons?: PolygonList, clipPolygons?: PolygonList, subjectPathOpen?: boolean): PolygonList;
610
+
611
+ /**
612
+ * This interface was referenced by `AuthJson`'s JSON-Schema
613
+ * via the `definition` "resourceScope".
614
+ */
615
+ type ResourceScope =
616
+ | "customFields"
617
+ | "customAttributes"
618
+ | "customAttributeValues"
619
+ | "organization"
620
+ | "dxf"
621
+ | "floor"
622
+ | "ifc"
623
+ | "job"
624
+ | "order"
625
+ | "product"
626
+ | "user"
627
+ | "team"
628
+ | "superadmin"
629
+ | "token"
630
+ | "subscription"
631
+ | "graphql";
632
+ /**
633
+ * This interface was referenced by `AuthJson`'s JSON-Schema
634
+ * via the `definition` "actionScope".
635
+ */
636
+ type ActionScope =
637
+ | "manageJoinRequests"
638
+ | "access"
639
+ | "archive"
640
+ | "bake"
641
+ | "changeRole"
642
+ | "close"
643
+ | "create"
644
+ | "createFromOrder"
645
+ | "delete"
646
+ | "export"
647
+ | "import"
648
+ | "invite"
649
+ | "query"
650
+ | "queryPublic"
651
+ | "queryPrivate"
652
+ | "read"
653
+ | "readPrivate"
654
+ | "readPublic"
655
+ | "update"
656
+ | "remove"
657
+ | "write"
658
+ | "addUser"
659
+ | "removeUser"
660
+ | "settings";
661
+ /**
662
+ * This interface was referenced by `AuthJson`'s JSON-Schema
663
+ * via the `definition` "scopeDefinitionArray".
664
+ */
665
+ type ScopeDefinitionArray = ScopeDefinition[];
666
+ /**
667
+ * This interface was referenced by `AuthJson`'s JSON-Schema
668
+ * via the `definition` "scopeDefinition".
669
+ */
670
+ interface ScopeDefinition {
671
+ resource: ResourceScope;
672
+ action?: ActionScope;
673
+ resourceId?: string;
674
+ }
675
+ /**
676
+ * This interface was referenced by `AuthJson`'s JSON-Schema
677
+ * via the `definition` "temporaryAccessToken".
678
+ */
679
+ interface TemporaryAccessToken {
680
+ authorization: string;
681
+ expiresAt: number;
682
+ }
683
+ /**
684
+ * This interface was referenced by `AuthJson`'s JSON-Schema
685
+ * via the `definition` "createTemporaryAccessToken".
686
+ */
687
+ interface CreateTemporaryAccessToken {
688
+ scopes: ScopeDefinitionArray;
689
+ durationSeconds?: number;
690
+ }
691
+
692
+ type TemporaryAccessTokenFunction = (args: CreateTemporaryAccessToken) => Promise<TemporaryAccessToken>;
693
+ interface TokenOptions {
694
+ publishableAccessToken?: string;
695
+ secretAccessToken?: string;
696
+ temporaryAccessToken?: TemporaryAccessToken;
697
+ temporaryAccessTokenFunction?: TemporaryAccessTokenFunction;
698
+ temporaryAccessTokenScopes?: ScopeDefinitionArray;
699
+ sdkVersion?: string;
700
+ }
701
+
702
+ declare class TinyEmitter {
703
+ on(event: string, callback: Function, ctx?: any): this;
704
+ once(event: string, callback: Function, ctx?: any): this;
705
+ emit(event: string, ...args: any[]): this;
706
+ off(event: string, callback?: Function): this;
707
+ }
708
+
709
+ interface AssetData {
710
+ id: string;
711
+ node: SceneNode;
712
+ polygon: Polygon;
713
+ boundingBox: BoundingBox2d;
714
+ name: string;
715
+ manufacturer: string;
716
+ productId: string;
717
+ tags: string[];
718
+ categories: string[];
719
+ subCategories: string[];
720
+ dimensions: {
721
+ width: number;
722
+ length: number;
723
+ height: number;
724
+ };
725
+ seatCapacity: number;
726
+ position: Vector3d;
727
+ rotation: number;
728
+ }
729
+ interface SpaceData {
730
+ node: SceneNode;
731
+ boundingBox: BoundingBox2d;
732
+ id: string;
733
+ usage?: string;
734
+ usageName?: string;
735
+ program?: string;
736
+ polygons: PolygonList;
737
+ assets: string[];
738
+ area: number;
739
+ center: Point2d;
740
+ customId?: string;
741
+ name?: string;
742
+ }
743
+ interface ProductData {
744
+ preview: string;
745
+ manufacturer: string;
746
+ productId: string;
747
+ name: string;
748
+ fileKey: string;
749
+ tags: string[];
750
+ categories: string[];
751
+ subCategories: string[];
752
+ boundingPoints: {
753
+ min: any;
754
+ max: any;
755
+ };
756
+ boundingBox: {
757
+ length: number;
758
+ width: number;
759
+ height: number;
760
+ };
761
+ seatCapacity: number;
762
+ texture: string;
763
+ materials: string[];
764
+ matColors: string[];
765
+ colours: string[];
766
+ order: number;
767
+ isCeilingLamp: boolean;
768
+ isCarpet: boolean;
769
+ createdAt: string;
770
+ updatedAt: string;
771
+ link: string;
772
+ _shapes?: Shape[];
773
+ }
774
+ interface ResourceData {
775
+ space: SpaceData;
776
+ asset: AssetData;
777
+ }
778
+ type ResourceType = keyof ResourceData;
779
+ type BaseResource<T extends ResourceType> = {
780
+ resourceType: T;
781
+ setHighlight: (highlightArgs?: HighlightArgs) => void;
782
+ };
783
+ type SceneResource<T extends ResourceType> = BaseResource<T> & Omit<ResourceData[T], 'node'>;
784
+ type SpaceResource = SceneResource<'space'>;
785
+ type AssetResource = SceneResource<'asset'>;
786
+
787
+ type LoadingEvent = 'loading-done' | 'loading-status' | 'product-load-stage' | 'product-load-texture' | 'product-data' | 'product-contour' | 'spaces-loaded' | 'assets-loaded';
788
+ declare enum TextureFilter {
789
+ None = 0,
790
+ Default = 1,
791
+ Grayscale = 2
792
+ }
793
+ declare class FpeLoader$1 extends TinyEmitter {
794
+ productQueue: {
795
+ [productId: string]: {
796
+ nodes: Set<SceneNode>;
797
+ /**
798
+ 0 = nothing loaded;
799
+ 1 = product data loaded;
800
+ 2 = product bounding box contour loaded;
801
+ 3 = product contour loaded
802
+ */
803
+ loadStage: number;
804
+ };
805
+ };
806
+ textureQueue: {
807
+ [textureId: string]: {
808
+ productId?: string;
809
+ nodes: Set<SceneNode>;
810
+ textureUrl: string;
811
+ applyFilter: TextureFilter;
812
+ imageData?: any;
813
+ /**
814
+ 0: nothing loaded;
815
+ 1: image texture loaded;
816
+ 2: final product texture created with contour baked in
817
+ */
818
+ loadStage: number;
819
+ error?: boolean;
820
+ texture?: any;
821
+ contourTexture?: any;
822
+ anchor?: any;
823
+ offset?: any;
824
+ position?: any;
825
+ };
826
+ };
827
+ promiseCache: Map<string, Promise<any>>;
828
+ loadStages: {
829
+ product: boolean;
830
+ productContour: boolean;
831
+ productTexture: boolean;
832
+ };
833
+ isSceneStructureLoaded: boolean;
834
+ resources: FloorPlanCore['resources'];
835
+ productContourCacheAge: number;
836
+ productDataCacheAge: number;
837
+ initialLoading: boolean;
838
+ _loadCounter: number;
839
+ on: (event: LoadingEvent, callback: Function, ctx?: any) => this;
840
+ once: (event: LoadingEvent, callback: Function, ctx?: any) => this;
841
+ off: (event: LoadingEvent, callback?: Function) => this;
842
+ emit: (event: LoadingEvent, ...args: any[]) => this;
843
+ constructor(resources: FloorPlanCore['resources'], settings: FloorPlanCore['settings']);
844
+ loadStatus({ args }: {
845
+ args: any;
846
+ }): void;
847
+ reset(): void;
848
+ }
849
+
850
+ interface StartupOptions {
851
+ /** option to hide certain elements */
852
+ hideElements?: HideableElement[];
853
+ preserveViewbox?: string;
854
+ /** option to disable panning and zooming */
855
+ panZoom?: boolean;
856
+ /** if set, panning and zooming is restricted to the scene boundingbox plus the margin */
857
+ panZoomMargin?: number;
858
+ /** rotation angle for the floor plan in degrees (counterclockwise) */
859
+ planRotation?: number | null;
860
+ /** if set room stamps have a fixed size - otherwise they adapt to the zoom level */
861
+ roomStampSize?: number;
862
+ /** toggle overlaying UI elements */
863
+ ui?: UI;
864
+ /** floor plan theming */
865
+ theme?: FloorPlanTheme;
866
+ /** mapping table for custom space labels */
867
+ spaceLabelMapping?: SpaceLabelMapping;
868
+ /** set the unit system */
869
+ units?: Units;
870
+ /** min and max zooming factor. Defaults to [3, 300] */
871
+ zoomRange?: [number, number];
872
+ }
873
+ /**
874
+ * This is the place to give the floor plan your own style
875
+ */
876
+ type FloorPlanTheme = {
877
+ /** define the background */
878
+ background?: BackgroundOptions;
879
+ /** wall contours are merged to one continuous outline, needed if you want white walls */
880
+ wallContours?: boolean;
881
+ /** render assets with textures rather than solid colors */
882
+ showAssetTextures?: boolean;
883
+ fontFamily?: string;
884
+ elements?: {
885
+ byId?: Record<string, ElementTheme>;
886
+ floorPlan?: {
887
+ grayscale: boolean;
888
+ };
889
+ roomStamp?: {
890
+ /** @deprecated show the usage information in room stamps */
891
+ showUsage?: boolean;
892
+ /** @deprecated show the area information in room stamps */
893
+ showArea?: boolean;
894
+ /** show the area information in room stamps */
895
+ roomStampDisplay?: ('usage' | 'area' | 'customId' | 'name')[];
896
+ /** text color for room stamps */
897
+ text?: RGBArray;
898
+ /** whether the room stamp text should have an outline to assist with contrast issues */
899
+ textOutline?: boolean;
900
+ };
901
+ asset?: ElementTheme;
902
+ space?: SpaceTheme;
903
+ wall?: ElementTheme;
904
+ wallContour?: ElementTheme;
905
+ box?: ElementTheme;
906
+ curtain?: ElementTheme;
907
+ closet?: ElementTheme;
908
+ door?: ElementTheme;
909
+ kitchen?: ElementTheme;
910
+ railing?: ElementTheme;
911
+ stairs?: ElementTheme;
912
+ window?: ElementTheme;
913
+ column?: ElementTheme;
914
+ polybox?: ElementTheme;
915
+ };
916
+ };
917
+ /**
918
+ * Background of the floor plan canvas
919
+ */
920
+ type BackgroundOptions = {
921
+ /** background-color: hex code for color, set to 'transparent' for transparent background */
922
+ color?: string;
923
+ /** show a dynamic grid */
924
+ showGrid?: boolean;
925
+ };
926
+ /**
927
+ * Elements that can be hidden in the floor plan
928
+ */
929
+ type HideableElement = SceneNode['type'] | 'roomStamp';
930
+ type UI = {
931
+ /** Show a dynamic scale indicator */
932
+ scale?: boolean;
933
+ /** Show the current cursor position in plan coordinates */
934
+ coordinates?: boolean;
935
+ };
936
+ /**
937
+ * Map space labels by space usage or space id to a custom name
938
+ * @example { kitchen: 'cuisine' }
939
+ */
940
+ type SpaceLabelMapping = {
941
+ [label: string]: string;
942
+ };
943
+ /**
944
+ * Which unit system and how to display the units
945
+ */
946
+ type Units = {
947
+ /** meters or feet? */
948
+ system?: 'metric' | 'imperial';
949
+ /** how many decimals should be shown for lengths? */
950
+ lengthDecimals?: number;
951
+ /** how many decimals should be shown for areas? */
952
+ areaDecimals?: number;
953
+ /** if 'area', it displays e.g. 12 m². If 'boundingBox'it displays e.g. 4 m x 3 m */
954
+ roomDimensions?: 'area' | 'boundingBox';
955
+ };
956
+ type FpeComputed = {
957
+ wallContours: PolygonList[];
958
+ relations: {
959
+ spaces: SpaceRelations[];
960
+ };
961
+ snapPoints: Polygon;
962
+ snapMargin: number;
963
+ };
964
+ type FpeCoreEvent = 'update-settings';
965
+ type Resources = {
966
+ spaces: SpaceResource[];
967
+ assets: AssetResource[];
968
+ products: {
969
+ [productId: string]: ProductData;
970
+ };
971
+ productContours: {
972
+ [productId: string]: PolygonList;
973
+ };
974
+ productBoundingBoxes: {
975
+ [productId: string]: PolygonList;
976
+ };
977
+ };
978
+ /**
979
+ * The main Floor plan engine SDK class
980
+ */
981
+ declare class FloorPlanCore {
982
+ settings: FpeConfig;
983
+ static readonly version: any;
984
+ readonly fpeId: string;
985
+ resources: Resources;
986
+ computed: FpeComputed;
987
+ loader: FpeLoader$1;
988
+ scene: Scene;
989
+ isBrowser: boolean;
990
+ utils: any;
991
+ location: {
992
+ latitude: number;
993
+ longitude: number;
994
+ };
995
+ protected _emitter: TinyEmitter;
996
+ constructor({ options, scene }?: {
997
+ options?: FpeConfig;
998
+ scene?: Scene;
999
+ });
1000
+ on(event: FpeCoreEvent, callback: Function, ctx?: any): this;
1001
+ once(event: FpeCoreEvent, callback: Function, ctx?: any): this;
1002
+ off(event: FpeCoreEvent, callback?: Function): this;
1003
+ emit(event: FpeCoreEvent, ...args: any[]): this;
1004
+ initScene(scene: any): void;
1005
+ /**
1006
+ * Load a scene with it's unique identifier the sceneId
1007
+ * @param {string} sceneId id of the scene to load
1008
+ * @param {AccessToken} accessToken Space API v2 [publishable](../space-api/v2/introduction.md#publishable-access-token) or [temporary](../space-api/v2/introduction.md#temporary-access-token) access token
1009
+ * @returns {Promise.<Boolean, Error>} returns promise which resolves when loading is done
1010
+ */
1011
+ loadScene(sceneId: string, accessTokenOptions?: TokenOptions): Promise<boolean | Error>;
1012
+ getSpaces(): void;
1013
+ /**
1014
+ * Change options after the floor plan engine instance has been created
1015
+ */
1016
+ set(args?: FpeConfig): void;
1017
+ /**
1018
+ * Get a list of spaces and assets for a specific plan position
1019
+ * @param {*} pos - plan position
1020
+ * @returns {Object} - list of spaces and assets
1021
+ */
1022
+ getResourcesFromPosition(pos: Point2d): {
1023
+ spaces: SpaceData[];
1024
+ assets: AssetData[];
1025
+ };
1026
+ /**
1027
+ * get bounding box of a scene node
1028
+ * @param {SceneNode | string} node - Element or Element id
1029
+ * @param {*} margin
1030
+ */
1031
+ getElementBoundingBox(node: any, margin?: number): BoundingBox2d;
1032
+ /**
1033
+ * Destroy the floor plan instance
1034
+ */
1035
+ destroy(): void;
1036
+ }
1037
+ interface FpeConfig extends StartupOptions {
1038
+ api?: {
1039
+ accessToken?: string;
1040
+ productDataCacheAge?: number;
1041
+ productContourCacheAge?: number;
1042
+ } & TokenOptions;
1043
+ loadTextures?: boolean;
1044
+ showFloorPlan?: boolean;
1045
+ showSpaceDividers?: boolean;
1046
+ showCeilingLamps?: boolean;
1047
+ svgViewBoxDim?: number;
1048
+ xrayMode?: boolean;
1049
+ svgMode?: boolean;
1050
+ destroyOnDomRemove?: boolean;
1051
+ }
1052
+ interface ElementTheme {
1053
+ fill?: ShapeStyle['fill'];
1054
+ fillOpacity?: number;
1055
+ stroke?: ShapeStyle['stroke'];
1056
+ }
1057
+ interface SpaceTheme extends ElementTheme {
1058
+ usage?: {
1059
+ [key: string]: ElementTheme;
1060
+ };
1061
+ program?: {
1062
+ [key: string]: ElementTheme;
1063
+ };
1064
+ }
1065
+
1066
+ interface InfoWindowArgs {
1067
+ /** pixel width of the window - default 100 */
1068
+ width?: number;
1069
+ /** pixel height of the window - default 80 */
1070
+ height?: number;
1071
+ /** coordinates of the window in meters */
1072
+ pos?: Point2d;
1073
+ /** html string as content of the info window */
1074
+ html?: string;
1075
+ /** If true , a close button will appear in the top right corner of the info window. */
1076
+ closeButton?: boolean;
1077
+ }
1078
+ interface InfoWindowState extends InfoWindowArgs {
1079
+ floorPlan?: FloorPlanEngine;
1080
+ }
1081
+ declare class InfoWindow {
1082
+ private _floorPlan;
1083
+ pos: Point2d;
1084
+ height: number;
1085
+ width: number;
1086
+ closeButton: any;
1087
+ html: any;
1088
+ el: Element;
1089
+ private _anchorPos;
1090
+ private _getPosition;
1091
+ constructor({ width, height, pos, html, closeButton, floorPlan }?: InfoWindowState);
1092
+ _createInfoWindow(): void;
1093
+ _setContent(): void;
1094
+ _updateInfoWindow(): void;
1095
+ set({ width, height, pos, html, closeButton }: {
1096
+ width: any;
1097
+ height: any;
1098
+ pos: any;
1099
+ html: any;
1100
+ closeButton: any;
1101
+ }): void;
1102
+ remove(): void;
1103
+ }
1104
+
1105
+ interface HtmlMarkerArgs {
1106
+ /** coordinates of the window in meters */
1107
+ pos?: Point2d;
1108
+ offset?: Point2d;
1109
+ /** html string as content of the info window */
1110
+ el?: HTMLElement;
1111
+ /** If true , a close button will appear in the top right corner of the info window. */
1112
+ closeButton?: boolean;
1113
+ }
1114
+ interface HtmlMarkerState extends HtmlMarkerArgs {
1115
+ floorPlan: FloorPlanEngine;
1116
+ }
1117
+ declare class HtmlMarker {
1118
+ pos: Point2d;
1119
+ size: Point2d;
1120
+ offset: Point2d;
1121
+ isHidden: boolean;
1122
+ id: string;
1123
+ el: HTMLElement;
1124
+ private _floorPlan;
1125
+ private _anchorPos;
1126
+ constructor({ pos, offset, el, floorPlan }: HtmlMarkerState);
1127
+ _updateHtmlMarker: () => void;
1128
+ _updateHtmlMarkerStyle(): void;
1129
+ set({ pos, offset }: Pick<HtmlMarkerArgs, 'pos' | 'offset'>): void;
1130
+ remove(): void;
1131
+ }
1132
+
1133
+ type FpeLoader = FloorPlanCore['loader'];
1134
+ type ScreenPosition = {
1135
+ x: number;
1136
+ y: number;
1137
+ };
1138
+ declare class Ticker {
1139
+ methods: {
1140
+ [name: string]: {
1141
+ fn: Function;
1142
+ ctx: WebGlView;
1143
+ };
1144
+ };
1145
+ add: (name: string, fn: Function, ctx: WebGlView) => void;
1146
+ remove: (name: string) => void;
1147
+ }
1148
+ type ViewEvent = 'pan' | 'zoom' | 'viewbox' | 'resize-canvas' | 'scene-rendered' | 'focus';
1149
+ type BaseLayers = 'base' | 'scene' | 'annotation' | 'helper';
1150
+ declare class WebGlView extends TinyEmitter {
1151
+ windowPos: Point2d;
1152
+ zoom: number;
1153
+ client: Point2d;
1154
+ layers: Map<string, PlanLayer>;
1155
+ viewbox: BoundingBox2d;
1156
+ viewportNeedsUpdate: boolean;
1157
+ viewportPaused: boolean;
1158
+ viewportInFocus: boolean;
1159
+ parentEl: HTMLElement;
1160
+ _settings: FpeConfig;
1161
+ redrawScene: () => void;
1162
+ gfxNodes: {
1163
+ [nodeId: string]: {
1164
+ nodeContainer?: any;
1165
+ loadStage?: number;
1166
+ textureId?: string;
1167
+ };
1168
+ };
1169
+ _dummyTexture: any;
1170
+ _oldTime: number;
1171
+ ticker?: Ticker;
1172
+ on: (event: ViewEvent, callback: Function, ctx?: any) => this;
1173
+ once: (event: ViewEvent, callback: Function, ctx?: any) => this;
1174
+ off: (event: ViewEvent, callback?: Function) => this;
1175
+ emit: (event: ViewEvent, ...args: any[]) => this;
1176
+ constructor(loader: FpeLoader, settings: FpeConfig, fpeId: string);
1177
+ /**
1178
+ * main animation loop
1179
+ */
1180
+ draw(): void;
1181
+ startAnimationLoop(): void;
1182
+ stopAnimationLoop(): void;
1183
+ updateView(): void;
1184
+ watchResize(): Promise<void>;
1185
+ get gfxNodeCount(): number;
1186
+ reset(): void;
1187
+ pause(interaction?: string): void;
1188
+ resume(interaction?: string): void;
1189
+ }
1190
+
1191
+ /** style definition used internally for rendering a node */
1192
+ interface StyleProps extends ShapeStyle {
1193
+ /** draw a dashed contour */
1194
+ dash?: boolean;
1195
+ }
1196
+
1197
+ interface GraphicArgs {
1198
+ shapes: Shape[];
1199
+ position?: Point2d;
1200
+ alpha?: number;
1201
+ clearLayer?: boolean;
1202
+ scale?: number;
1203
+ interactive?: boolean;
1204
+ id?: string;
1205
+ isHandler?: boolean;
1206
+ scaleOnZoom?: boolean;
1207
+ }
1208
+ interface PlanGraphicArgs extends GraphicArgs {
1209
+ floorPlan: FloorPlanEngine;
1210
+ [key: string]: any;
1211
+ }
1212
+ type GraphicUpdate = {
1213
+ position?: Point2d;
1214
+ style?: StyleProps;
1215
+ shapes?: Shape[];
1216
+ };
1217
+ declare class PlanGraphic {
1218
+ shapes: Shape[];
1219
+ scaleOnZoom: boolean;
1220
+ gfxScale: number;
1221
+ private floorPlan;
1222
+ constructor({ shapes, position, alpha, scale, clearLayer, interactive, id, isHandler, scaleOnZoom, baseLayer, container, floorPlan }: PlanGraphicArgs);
1223
+ set({ position, style, shapes }?: GraphicUpdate): void;
1224
+ on(event: string, callback: any, context?: any): this;
1225
+ off(event: string, callback?: any): this;
1226
+ destroy(): void;
1227
+ private addDragEvent;
1228
+ private removeDragEvent;
1229
+ }
1230
+
1231
+ declare class PlanLayer {
1232
+ graphics: Set<PlanGraphic>;
1233
+ id: string;
1234
+ private baseLayer;
1235
+ private floorPlan;
1236
+ constructor(floorPlan: FloorPlanEngine, baseLayer?: BaseLayers, id?: string);
1237
+ addGraphic(args: GraphicArgs): PlanGraphic;
1238
+ deleteGraphic(graphic: PlanGraphic): void;
1239
+ /**
1240
+ * Draw shapes on the layer
1241
+ * @deprecated
1242
+ */
1243
+ draw(args: GraphicArgs): PlanGraphic;
1244
+ drawImage({ url, width, height, mask, options }: {
1245
+ url: any;
1246
+ width: any;
1247
+ height: any;
1248
+ mask: any;
1249
+ options: any;
1250
+ }): void;
1251
+ /**
1252
+ * clear all shapes from the layer
1253
+ */
1254
+ clear(): void;
1255
+ /**
1256
+ * destroy layer and all shapes
1257
+ */
1258
+ destroy(): void;
1259
+ }
1260
+
1261
+ interface MarkerArgs {
1262
+ /** coordinates of the marker in meters */
1263
+ pos?: Point2d;
1264
+ /** color of the marker, hex code */
1265
+ color?: string;
1266
+ /** size in pixels */
1267
+ size?: number;
1268
+ floorPlan?: FloorPlanEngine;
1269
+ }
1270
+ interface MarkerUpdateArgs {
1271
+ events?: {
1272
+ [event: string]: {
1273
+ callback: any;
1274
+ context: any;
1275
+ };
1276
+ };
1277
+ }
1278
+ declare class MarkerPin {
1279
+ pos: Point2d;
1280
+ color: string;
1281
+ size: number;
1282
+ id: string;
1283
+ layer: PlanLayer;
1284
+ graphic: PlanGraphic;
1285
+ private floorPlan;
1286
+ constructor({ pos, color, size, floorPlan }: MarkerArgs);
1287
+ draw(): void;
1288
+ remove(): void;
1289
+ on(eventType: string, callback: any, context?: any): void;
1290
+ off(eventType?: string, callback?: any): void;
1291
+ set(updateArgs: MarkerUpdateArgs): void;
1292
+ }
1293
+
1294
+ type Animate = number | boolean;
1295
+
1296
+ declare class Helper extends TinyEmitter {
1297
+ floorPlan: FloorPlanEngine;
1298
+ helperId: string;
1299
+ constructor({ floorPlan, helperId }: {
1300
+ floorPlan: FloorPlanEngine;
1301
+ helperId: string;
1302
+ });
1303
+ destroy(): void;
1304
+ }
1305
+
1306
+ type FpeEvent = FpeCoreEvent | 'click' | 'dblclick' | 'context-menu' | 'mousemove' | 'drop' | 'drag-move' | 'drag-start' | 'drag-end' | 'key' | 'keyup';
1307
+ interface ExportImage {
1308
+ /** output format: png, jpg */
1309
+ format?: 'png' | 'jpg';
1310
+ /** fle name relevant if download is true */
1311
+ fileName?: string;
1312
+ /** only relevant if format is jpg */
1313
+ quality?: number;
1314
+ /** desired output format */
1315
+ output?: 'base64' | 'text';
1316
+ /** target width of the image */
1317
+ maxWidth?: number;
1318
+ /** If true, methods triggers a file download directly */
1319
+ download?: boolean;
1320
+ }
1321
+ interface FpeInteraction {
1322
+ lastSceneClick: Point2d;
1323
+ cursor: Point2d;
1324
+ cursorTarget: SceneNode;
1325
+ isDragging: boolean;
1326
+ isPanning: boolean;
1327
+ lastClick: {
1328
+ time: number;
1329
+ pos: ScreenPosition;
1330
+ };
1331
+ metaKey: boolean;
1332
+ ctrlKey: boolean;
1333
+ altKey: boolean;
1334
+ shiftKey: boolean;
1335
+ dragOffset: Point2d;
1336
+ cursorAction: 'split-wall' | 'duplicate' | 'move' | 'select' | 'none';
1337
+ _dragStart: ScreenPosition;
1338
+ preventFocusoutOnAltKeyup: boolean;
1339
+ }
1340
+ /**
1341
+ * The main Floor plan engine SDK class
1342
+ */
1343
+ declare class FloorPlanEngine extends FloorPlanCore {
1344
+ fpeNode?: HTMLElement;
1345
+ view: WebGlView;
1346
+ interaction: FpeInteraction;
1347
+ availableHelpers: {
1348
+ [name: string]: typeof Helper;
1349
+ };
1350
+ helper: {
1351
+ [name: string]: Helper;
1352
+ };
1353
+ constructor({ container, options, scene }?: {
1354
+ container?: Element;
1355
+ options?: FpeConfig;
1356
+ scene?: Scene;
1357
+ });
1358
+ prevent(e: any): void;
1359
+ /**
1360
+ * Subscribe to an event
1361
+ */
1362
+ on(event: FpeEvent, callback: Function, ctx?: any): this;
1363
+ /**
1364
+ * Subscribe to an event once
1365
+ */
1366
+ once(event: FpeEvent, callback: Function, ctx?: any): this;
1367
+ /**
1368
+ */
1369
+ off(event: FpeEvent, callback?: Function): this;
1370
+ emit(event: FpeEvent, ...args: any[]): this;
1371
+ handleDrop(evt: any): void;
1372
+ /**
1373
+ * Change options after the floor plan engine instance has been created
1374
+ * @param {StartupOptions} args - Startup options
1375
+ */
1376
+ set(args: FpeConfig): void;
1377
+ mountFloorPlan(root: Element): void;
1378
+ initDrawing(): void;
1379
+ initDrawingEvents(): void;
1380
+ generateUi(): void;
1381
+ getSceneBoundingBox(margin?: number): BoundingBox2d;
1382
+ /**
1383
+ * Get a bounding box containing the scene, with some padding
1384
+ * @param {BoundingBox2d} sceneBoundingBox - bounding box of the scene, in meters.
1385
+ * @param {number} rectLeft - left edge of a rectangle into which the scene should fit, in pixels.
1386
+ * @param {number} rectTop - top edge of a rectangle into which the scene should fit, in pixels.
1387
+ * @param {number} rectRight - right edge of a rectangle into which the scene should fit, in pixels.
1388
+ * @param {number} rectBottom - bottom edge of a rectangle into which the scene should fit, in pixels.
1389
+ * @param {number} viewportWidth - width in pixels of the canvas.
1390
+ * @param {number} viewportHeight - height in pixels of the canvas.
1391
+ * @returns {BoundingBox2d} returns a new bounding box
1392
+ */
1393
+ getZoomExtentsBoundingBox(sceneBoundingBox: BoundingBox2d, rectLeft: number, rectTop: number, rectRight: number, rectBottom: number, viewportWidth: number, viewportHeight: number): BoundingBox2d;
1394
+ /**
1395
+ * Zoom to the extent of the scene in the viewport ( wait for loadScene promise )
1396
+ * @param {number} [margin = 1] - margin around scene in meters. Defaults to 1 meter
1397
+ * @param {Animate} [animate = false] - duration in milliseconds of the animation for the viewport transform. If true, the duration will be 500ms. If false or not provided there will be no animation
1398
+ * @param {BoundingBox2d} [boundingBox = null] - bounding box to zoom to. Can for example be calculated via getZoomExtentsBoundingBox(…). If provided, the margin parameter will be ignored
1399
+ * @returns {Promise.<Boolean, Error>} returns promise which resolves when animation is done
1400
+ */
1401
+ zoomExtents(margin?: number, animate?: Animate, boundingBox?: BoundingBox2d): Promise<boolean>;
1402
+ /**
1403
+ * Zoom to the bounding box of an element ( wait for loadScene promise )
1404
+ * @param {string | SceneNode} node - id of an asset or a space or the node itself
1405
+ * @param {number} [margin = 1] - margin around scene in meters
1406
+ * @param {Animate} [animate] - duration of the animation for the viewport transform, if not provided there will be no animation
1407
+ * @returns {Promise.<Boolean, Error>} returns promise which resolves when animation is done
1408
+ */
1409
+ zoomToElement(node: any, margin?: number, animate?: Animate): Promise<boolean | Error>;
1410
+ /**
1411
+ * set zoom to a specific bounding box
1412
+ * @param {BoundingBox} bb - bounding box
1413
+ * @param {Animate} [animate] - duration of the animation for the viewport transform, if not provided there will be no animation
1414
+ * @returns {Promise.<Boolean, Error>} returns promise which resolves when animation is done
1415
+ */
1416
+ setZoom(bb: BoundingBox2d, animate?: Animate): Promise<boolean>;
1417
+ /**
1418
+ * zoom the current view by a factor
1419
+ * @param {number} factor - zoom factor, larger than 1 zooms in, smaller than 1 zooms out
1420
+ * @param {Animate} [animate = true] - duration of the animation for the viewport transform, if not provided there will be no animation
1421
+ * @returns {Promise.<Boolean, Error>} returns promise which resolves when animation is done
1422
+ */
1423
+ zoomByFactor(factor: number, animate?: Animate): Promise<boolean>;
1424
+ /**
1425
+ * Add HTML info window
1426
+ */
1427
+ addInfoWindow(args?: InfoWindowArgs): InfoWindow;
1428
+ /**
1429
+ * Add custom HTML marker
1430
+ */
1431
+ addHtmlMarker(args?: HtmlMarkerArgs): HtmlMarker;
1432
+ /**
1433
+ * Add plan marker
1434
+ */
1435
+ addMarker({ pos, color, size }?: MarkerArgs): MarkerPin;
1436
+ /**
1437
+ * Convert screen coordinates to plan coordinates
1438
+ */
1439
+ getPlanPosition(point: Point2d): Point2d;
1440
+ /**
1441
+ * Convert plan coordinates to screen coordinates
1442
+ */
1443
+ getScreenPosition(point: Point2d): Point2d;
1444
+ /**
1445
+ * create plan layer or return existing by id
1446
+ */
1447
+ addLayer({ id, baseLayer }?: {
1448
+ id?: string;
1449
+ baseLayer?: BaseLayers;
1450
+ }): PlanLayer;
1451
+ /**
1452
+ * get plan layer by name
1453
+ */
1454
+ getLayer(id: any): PlanLayer;
1455
+ /**
1456
+ * create plan graphic
1457
+ * @deprecated use floorPlan.addLayer(<name>)
1458
+ * @returns {PlanLayer}
1459
+ */
1460
+ addPlanGraphic(): PlanLayer;
1461
+ /**
1462
+ * Adds a helper and removes previous instances of it
1463
+ */
1464
+ addHelper(helper: string | typeof Helper, options?: any): Helper;
1465
+ removeHelper(helperId: string): void;
1466
+ /**
1467
+ * Export the current view as an image
1468
+ */
1469
+ exportImage({ format, fileName, quality, output, maxWidth, download }?: ExportImage): Promise<string | Error>;
1470
+ /**
1471
+ * Destroy the floor plan instance
1472
+ */
1473
+ destroy(): void;
1474
+ }
1475
+
1476
+ export { FloorPlanEngine, type GraphicArgs, type Point2d, type Polygon, type PolygonList, type Shape, polygonIntersection, polygonOffset, polygonUnion };