@archilogic/floor-plan-sdk 5.0.0-beta.0
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/README.md +31 -0
- package/dist/fpe.d.ts +1447 -0
- package/dist/fpe.es.js +822 -0
- package/dist/fpe.umd.js +822 -0
- package/package.json +24 -0
package/dist/fpe.d.ts
ADDED
|
@@ -0,0 +1,1447 @@
|
|
|
1
|
+
declare class TinyEmitter {
|
|
2
|
+
on(event: string, callback: Function, ctx?: any): this;
|
|
3
|
+
once(event: string, callback: Function, ctx?: any): this;
|
|
4
|
+
emit(event: string, ...args: any[]): this;
|
|
5
|
+
off(event: string, callback?: Function): this;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
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"];
|
|
9
|
+
declare type NodeTypes = typeof validNodeTypes[number];
|
|
10
|
+
declare type NodesByType = {
|
|
11
|
+
[K in NodeTypes]: SceneNode[];
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
declare type Point2d = [number, number];
|
|
15
|
+
declare type Polygon = Point2d[];
|
|
16
|
+
declare type PolygonList = Polygon[];
|
|
17
|
+
declare 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
|
+
declare type ProductId = string;
|
|
38
|
+
declare type ProductSrc = `!${ProductId}`;
|
|
39
|
+
|
|
40
|
+
declare 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
|
+
declare type MaterialReference = string;
|
|
77
|
+
declare 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
|
+
declare 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;
|
|
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
|
+
}
|
|
356
|
+
declare type SpaceCategories = keyof typeof spaceCategories;
|
|
357
|
+
|
|
358
|
+
declare type NodesByName = {
|
|
359
|
+
[key: string]: SceneNode[];
|
|
360
|
+
};
|
|
361
|
+
declare type Schema = {
|
|
362
|
+
[K in NodeTypes]?: TypeSchema;
|
|
363
|
+
};
|
|
364
|
+
interface TypeSchemaProperty {
|
|
365
|
+
type?: string | string[];
|
|
366
|
+
description?: string;
|
|
367
|
+
const?: string;
|
|
368
|
+
pattern?: string;
|
|
369
|
+
items?: TypeSchemaProperty | TypeSchemaProperty[];
|
|
370
|
+
default?: any;
|
|
371
|
+
minimum?: number;
|
|
372
|
+
maximum?: number;
|
|
373
|
+
minItems?: number;
|
|
374
|
+
maxItems?: number;
|
|
375
|
+
multipleOf?: number;
|
|
376
|
+
enum?: string[];
|
|
377
|
+
patternProperties?: any;
|
|
378
|
+
additionalProperties?: boolean;
|
|
379
|
+
properties?: {
|
|
380
|
+
[key: string]: TypeSchemaProperty;
|
|
381
|
+
};
|
|
382
|
+
children?: TypeSchemaProperty;
|
|
383
|
+
}
|
|
384
|
+
interface TypeSchema {
|
|
385
|
+
type?: string;
|
|
386
|
+
required?: string[];
|
|
387
|
+
additionalProperties?: boolean;
|
|
388
|
+
description?: string;
|
|
389
|
+
properties: {
|
|
390
|
+
[key: string]: TypeSchemaProperty;
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
interface SceneOptions {
|
|
394
|
+
spaceContourAreaThreshold?: number;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Central class to load an entire scene
|
|
398
|
+
* scene structure is converted into a tree of SceneNode items
|
|
399
|
+
* nodes can be quickly accessed
|
|
400
|
+
* via `scene.nodesById[<uuid>]`
|
|
401
|
+
* or `scene.nodesByType[<type>]`
|
|
402
|
+
*/
|
|
403
|
+
declare class Scene {
|
|
404
|
+
sceneId: string | null;
|
|
405
|
+
node: SceneNode | null;
|
|
406
|
+
/** @deprecated */
|
|
407
|
+
type: string;
|
|
408
|
+
spaceCategories: SpaceCategories[];
|
|
409
|
+
nodesById: {
|
|
410
|
+
[uuid: string]: SceneNode;
|
|
411
|
+
};
|
|
412
|
+
nodesByType: NodesByType;
|
|
413
|
+
nodesByName: NodesByName;
|
|
414
|
+
options: SceneOptions;
|
|
415
|
+
private _emitter;
|
|
416
|
+
private _schema;
|
|
417
|
+
private _apiVersion;
|
|
418
|
+
constructor({ schema, options }?: {
|
|
419
|
+
/** optionally initialize scene with existing schema */
|
|
420
|
+
schema?: Schema;
|
|
421
|
+
options?: SceneOptions;
|
|
422
|
+
});
|
|
423
|
+
get emitter(): TinyEmitter;
|
|
424
|
+
get schema(): Schema;
|
|
425
|
+
set schema(schema: Schema);
|
|
426
|
+
/**
|
|
427
|
+
* load scene structure recursively, creating sceneNodes
|
|
428
|
+
* and registering nodes and nodesByType
|
|
429
|
+
*/
|
|
430
|
+
loadSceneStructure(sceneStructure: SceneNodeJson,
|
|
431
|
+
/** options will be handed to new SceneNode() */
|
|
432
|
+
options?: {
|
|
433
|
+
/** overwrite the rotation of the plan node - will be restored on planNode.toJson() */
|
|
434
|
+
planRotation?: number;
|
|
435
|
+
/** apply default schema to each node, useful when starting a plan from scratch ({type: 'plan'}) */
|
|
436
|
+
setDefaults?: boolean;
|
|
437
|
+
/** force regenerating node ids - otherwise ids will only be generated if they are missing */
|
|
438
|
+
regenerateIds?: boolean;
|
|
439
|
+
}): SceneNode;
|
|
440
|
+
/**
|
|
441
|
+
* set the scene type
|
|
442
|
+
* @deprecated, use setSpaceCategories() instead
|
|
443
|
+
*/
|
|
444
|
+
setSceneType(): void;
|
|
445
|
+
_setSceneType(): void;
|
|
446
|
+
/**
|
|
447
|
+
* set the space categories
|
|
448
|
+
*/
|
|
449
|
+
setSpaceCategories(): void;
|
|
450
|
+
/**
|
|
451
|
+
* compute the floor area
|
|
452
|
+
*/
|
|
453
|
+
getFloorArea(): number;
|
|
454
|
+
/**
|
|
455
|
+
* add a node in scene.nodesByType, nodesById, and nodesByName
|
|
456
|
+
*/
|
|
457
|
+
registerNode(node: SceneNode): void;
|
|
458
|
+
/**
|
|
459
|
+
* remove a node in scene.nodesByType, nodesById, and nodesByName
|
|
460
|
+
*/
|
|
461
|
+
unregisterNode(node: SceneNode): void;
|
|
462
|
+
/**
|
|
463
|
+
* subscribe to a scene event
|
|
464
|
+
* * SceneNode events that change a node
|
|
465
|
+
* all set events fire with `{ node: <SceneNode>, args: <payload>, prevState: <oldValues>, options: <Object>, event: <eventName> }`
|
|
466
|
+
* * `set-transform` - x,y,z or ry is changed for a node
|
|
467
|
+
* * `set` - an attribute is changed for a node, like l or w
|
|
468
|
+
* * `set-materials` - a material for a specific mesh is changed for a node, args: `{ <meshName>: <material> }`
|
|
469
|
+
* * `set-transient` - transient attribute ( starting with underscore ) is changed for a node
|
|
470
|
+
* * SceneNode events that change the node tree
|
|
471
|
+
* all tree change events fire with `{ node: <SceneNode>, args: <SceneNode>, options: <Object>, event: <eventName> }`
|
|
472
|
+
* * `add-child` - a child (args) is added to the node
|
|
473
|
+
* * `remove-child` - a child (args) is removed from the node
|
|
474
|
+
* * Scene events:
|
|
475
|
+
* * `scene-structure-loading` - fires when the loadSceneStructure is starting, payload is the Scene instance
|
|
476
|
+
* * `scene-structure-loaded` - fires when the loadSceneStructure is complete, payload is the Scene instance
|
|
477
|
+
*/
|
|
478
|
+
on(event: string, callback: any, context?: any): void;
|
|
479
|
+
/**
|
|
480
|
+
* subscribe to a scene event but remove after first emit
|
|
481
|
+
* otherwise like scene.on()
|
|
482
|
+
*/
|
|
483
|
+
once(event: string, callback: any, context?: any): void;
|
|
484
|
+
/**
|
|
485
|
+
* unsubscribe from a scene event
|
|
486
|
+
*/
|
|
487
|
+
off(event: string, callback?: any): void;
|
|
488
|
+
/**
|
|
489
|
+
* emit an event
|
|
490
|
+
*/
|
|
491
|
+
emit(event: string, arg1: any, arg2?: any, arg3?: any, arg4?: any): void;
|
|
492
|
+
/**
|
|
493
|
+
* retrieve scene structure api version
|
|
494
|
+
*/
|
|
495
|
+
get apiVersion(): string;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
interface SpaceRelations {
|
|
499
|
+
/** space id */
|
|
500
|
+
node: SceneNode;
|
|
501
|
+
/** related nodes */
|
|
502
|
+
relationsById: NodeIdList;
|
|
503
|
+
relationsByEdgeIndex: {};
|
|
504
|
+
}
|
|
505
|
+
interface NodeIdList {
|
|
506
|
+
[nodeId: string]: {
|
|
507
|
+
/** related node */
|
|
508
|
+
node: SceneNode;
|
|
509
|
+
/** type of the relation */
|
|
510
|
+
relation: 'edge' | 'contained';
|
|
511
|
+
/** edge relations */
|
|
512
|
+
edgeRelations?: {
|
|
513
|
+
/** edge index of the space polygon [ loopIndex, edgeIndex ] */
|
|
514
|
+
edgeIndex?: [number, number];
|
|
515
|
+
/** edge index of related node */
|
|
516
|
+
nodeContourIndex?: number;
|
|
517
|
+
}[];
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
interface ShapeStyle {
|
|
522
|
+
stroke?: string | number | number[];
|
|
523
|
+
strokeWidth?: number | 'native';
|
|
524
|
+
strokeOpacity?: number;
|
|
525
|
+
fill?: string | number | number[] | false;
|
|
526
|
+
fillOpacity?: number;
|
|
527
|
+
}
|
|
528
|
+
interface BaseShape {
|
|
529
|
+
type: string;
|
|
530
|
+
style?: ShapeStyle;
|
|
531
|
+
}
|
|
532
|
+
interface LineShape extends BaseShape {
|
|
533
|
+
type: 'line';
|
|
534
|
+
start: Point2d;
|
|
535
|
+
end: Point2d;
|
|
536
|
+
}
|
|
537
|
+
interface ArcShape extends BaseShape {
|
|
538
|
+
type: 'arc';
|
|
539
|
+
position: Point2d;
|
|
540
|
+
radius: number;
|
|
541
|
+
startAngle: number;
|
|
542
|
+
endAngle: number;
|
|
543
|
+
}
|
|
544
|
+
interface CompositeShape extends BaseShape {
|
|
545
|
+
type: 'composite';
|
|
546
|
+
segments: OpenShapes[];
|
|
547
|
+
}
|
|
548
|
+
declare type OpenShapes = LineShape | ArcShape | PolylineShape | BezierShape;
|
|
549
|
+
interface CircleShape extends BaseShape {
|
|
550
|
+
type: 'circle';
|
|
551
|
+
position: Point2d;
|
|
552
|
+
radius: number;
|
|
553
|
+
}
|
|
554
|
+
interface RectShape extends BaseShape {
|
|
555
|
+
type: 'rectangle';
|
|
556
|
+
position: Point2d;
|
|
557
|
+
dimensions: [number, number];
|
|
558
|
+
}
|
|
559
|
+
interface PolygonShape extends BaseShape {
|
|
560
|
+
type: 'polygon';
|
|
561
|
+
points: Polygon;
|
|
562
|
+
holes?: PolygonList;
|
|
563
|
+
}
|
|
564
|
+
interface PolylineShape extends BaseShape {
|
|
565
|
+
type: 'polyline';
|
|
566
|
+
points: Polygon;
|
|
567
|
+
}
|
|
568
|
+
interface BezierShape extends BaseShape {
|
|
569
|
+
type: 'quadraticBezier';
|
|
570
|
+
points: Polygon;
|
|
571
|
+
}
|
|
572
|
+
interface TextShape extends BaseShape {
|
|
573
|
+
type: 'text';
|
|
574
|
+
position: Point2d;
|
|
575
|
+
text: string;
|
|
576
|
+
rotation?: number;
|
|
577
|
+
alignV?: 'center' | 'bottom' | 'top';
|
|
578
|
+
alignH?: 'center' | 'left' | 'right';
|
|
579
|
+
fontSize?: number;
|
|
580
|
+
}
|
|
581
|
+
declare type Shape = PolygonShape | PolylineShape | RectShape | CircleShape | LineShape | GroupShape | TextShape | ArcShape | BezierShape | CompositeShape;
|
|
582
|
+
interface GroupShape extends BaseShape {
|
|
583
|
+
type: 'group';
|
|
584
|
+
position?: Point2d;
|
|
585
|
+
rotation?: number;
|
|
586
|
+
children: Shape[];
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* boolean union of two or more polygon
|
|
590
|
+
*/
|
|
591
|
+
declare function polygonUnion(polygons: PolygonList): PolygonList;
|
|
592
|
+
declare enum EndType {
|
|
593
|
+
etOpenSquare = 0,
|
|
594
|
+
etOpenRound = 1,
|
|
595
|
+
etOpenButt = 2,
|
|
596
|
+
etClosedLine = 3,
|
|
597
|
+
etClosedPolygon = 4
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* contour offset for one or multiple polygons
|
|
601
|
+
* https://sourceforge.net/p/jsclipper/wiki/documentation/#clipperlibendtype
|
|
602
|
+
*/
|
|
603
|
+
declare function polygonOffset(polygons: PolygonList, delta?: number, endType?: EndType, skipCleaning?: boolean): PolygonList;
|
|
604
|
+
/**
|
|
605
|
+
* boolean intersection of two or more polygon
|
|
606
|
+
* the subject path can be an open polyline
|
|
607
|
+
*/
|
|
608
|
+
declare function polygonIntersection(polygons?: PolygonList, clipPolygons?: PolygonList, subjectPathOpen?: boolean): PolygonList;
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* This interface was referenced by `Auth`'s JSON-Schema
|
|
612
|
+
* via the `definition` "resourceScope".
|
|
613
|
+
*/
|
|
614
|
+
type ResourceScope =
|
|
615
|
+
| "customFields"
|
|
616
|
+
| "dxf"
|
|
617
|
+
| "floor"
|
|
618
|
+
| "ifc"
|
|
619
|
+
| "job"
|
|
620
|
+
| "order"
|
|
621
|
+
| "product"
|
|
622
|
+
| "user"
|
|
623
|
+
| "group"
|
|
624
|
+
| "superadmin"
|
|
625
|
+
| "token"
|
|
626
|
+
| "subscription";
|
|
627
|
+
/**
|
|
628
|
+
* This interface was referenced by `Auth`'s JSON-Schema
|
|
629
|
+
* via the `definition` "actionScope".
|
|
630
|
+
*/
|
|
631
|
+
type ActionScope =
|
|
632
|
+
| "access"
|
|
633
|
+
| "archive"
|
|
634
|
+
| "bake"
|
|
635
|
+
| "changeRole"
|
|
636
|
+
| "close"
|
|
637
|
+
| "create"
|
|
638
|
+
| "delete"
|
|
639
|
+
| "duplicate"
|
|
640
|
+
| "export"
|
|
641
|
+
| "import"
|
|
642
|
+
| "invite"
|
|
643
|
+
| "query"
|
|
644
|
+
| "queryPublic"
|
|
645
|
+
| "queryPrivate"
|
|
646
|
+
| "read"
|
|
647
|
+
| "readPrivate"
|
|
648
|
+
| "readPublic"
|
|
649
|
+
| "update"
|
|
650
|
+
| "remove"
|
|
651
|
+
| "write"
|
|
652
|
+
| "addUser"
|
|
653
|
+
| "removeUser";
|
|
654
|
+
/**
|
|
655
|
+
* This interface was referenced by `Auth`'s JSON-Schema
|
|
656
|
+
* via the `definition` "scopeDefinitionArray".
|
|
657
|
+
*/
|
|
658
|
+
type ScopeDefinitionArray = ScopeDefinition[];
|
|
659
|
+
/**
|
|
660
|
+
* This interface was referenced by `Auth`'s JSON-Schema
|
|
661
|
+
* via the `definition` "scopeDefinition".
|
|
662
|
+
*/
|
|
663
|
+
interface ScopeDefinition {
|
|
664
|
+
resource: ResourceScope;
|
|
665
|
+
action?: ActionScope;
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* This interface was referenced by `Auth`'s JSON-Schema
|
|
669
|
+
* via the `definition` "temporaryAccessToken".
|
|
670
|
+
*/
|
|
671
|
+
interface TemporaryAccessToken {
|
|
672
|
+
authorization: string;
|
|
673
|
+
expiresAt: number;
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* This interface was referenced by `Auth`'s JSON-Schema
|
|
677
|
+
* via the `definition` "createTemporaryAccessToken".
|
|
678
|
+
*/
|
|
679
|
+
interface CreateTemporaryAccessToken {
|
|
680
|
+
scopes: ScopeDefinitionArray;
|
|
681
|
+
durationSeconds?: number;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
declare type TemporaryAccessTokenFunction = (args: CreateTemporaryAccessToken) => Promise<TemporaryAccessToken>;
|
|
685
|
+
interface TokenOptions {
|
|
686
|
+
publishableAccessToken?: string;
|
|
687
|
+
secretAccessToken?: string;
|
|
688
|
+
temporaryAccessToken?: TemporaryAccessToken;
|
|
689
|
+
temporaryAccessTokenFunction?: TemporaryAccessTokenFunction;
|
|
690
|
+
temporaryAccessTokenScopes?: ScopeDefinitionArray;
|
|
691
|
+
sdkVersion?: string;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
interface AssetData {
|
|
695
|
+
id: string;
|
|
696
|
+
node: SceneNode;
|
|
697
|
+
polygon: Polygon;
|
|
698
|
+
boundingBox: BoundingBox2d;
|
|
699
|
+
name: string;
|
|
700
|
+
manufacturer: string;
|
|
701
|
+
productId: string;
|
|
702
|
+
tags: string[];
|
|
703
|
+
categories: string[];
|
|
704
|
+
subCategories: string[];
|
|
705
|
+
dimensions: {
|
|
706
|
+
width: number;
|
|
707
|
+
length: number;
|
|
708
|
+
height: number;
|
|
709
|
+
};
|
|
710
|
+
seatCapacity: number;
|
|
711
|
+
position: Vector3d;
|
|
712
|
+
rotation: number;
|
|
713
|
+
}
|
|
714
|
+
interface SpaceData {
|
|
715
|
+
node: SceneNode;
|
|
716
|
+
boundingBox: BoundingBox2d;
|
|
717
|
+
id: string;
|
|
718
|
+
usage?: string;
|
|
719
|
+
usageName?: string;
|
|
720
|
+
program?: string;
|
|
721
|
+
polygons: PolygonList;
|
|
722
|
+
assets: string[];
|
|
723
|
+
area: number;
|
|
724
|
+
center: Point2d;
|
|
725
|
+
customId?: string;
|
|
726
|
+
name?: string;
|
|
727
|
+
}
|
|
728
|
+
interface ProductData {
|
|
729
|
+
preview: string;
|
|
730
|
+
manufacturer: string;
|
|
731
|
+
productId: string;
|
|
732
|
+
name: string;
|
|
733
|
+
fileKey: string;
|
|
734
|
+
tags: string[];
|
|
735
|
+
categories: string[];
|
|
736
|
+
subCategories: string[];
|
|
737
|
+
boundingPoints: {
|
|
738
|
+
min: any;
|
|
739
|
+
max: any;
|
|
740
|
+
};
|
|
741
|
+
boundingBox: {
|
|
742
|
+
length: number;
|
|
743
|
+
width: number;
|
|
744
|
+
height: number;
|
|
745
|
+
};
|
|
746
|
+
seatCapacity: number;
|
|
747
|
+
texture: string;
|
|
748
|
+
materials: string[];
|
|
749
|
+
matColors: string[];
|
|
750
|
+
colours: string[];
|
|
751
|
+
order: number;
|
|
752
|
+
isCeilingLamp: boolean;
|
|
753
|
+
isCarpet: boolean;
|
|
754
|
+
createdAt: string;
|
|
755
|
+
updatedAt: string;
|
|
756
|
+
link: string;
|
|
757
|
+
_shapes?: Shape[];
|
|
758
|
+
}
|
|
759
|
+
interface ResourceData {
|
|
760
|
+
space: SpaceData;
|
|
761
|
+
asset: AssetData;
|
|
762
|
+
}
|
|
763
|
+
declare type ResourceType = keyof ResourceData;
|
|
764
|
+
declare type BaseResource<T extends ResourceType> = {
|
|
765
|
+
resourceType: T;
|
|
766
|
+
setHighlight: (highlightArgs?: HighlightArgs) => void;
|
|
767
|
+
};
|
|
768
|
+
declare type SceneResource<T extends ResourceType> = BaseResource<T> & Omit<ResourceData[T], 'node'>;
|
|
769
|
+
declare type SpaceResource = SceneResource<'space'>;
|
|
770
|
+
declare type AssetResource = SceneResource<'asset'>;
|
|
771
|
+
|
|
772
|
+
declare type LoadingEvent = 'loading-done' | 'loading-status' | 'product-load-stage' | 'product-load-texture' | 'product-data' | 'product-contour' | 'spaces-loaded' | 'assets-loaded';
|
|
773
|
+
declare class FpeLoader$1 extends TinyEmitter {
|
|
774
|
+
productQueue: {
|
|
775
|
+
[productId: string]: {
|
|
776
|
+
nodes: Set<SceneNode>;
|
|
777
|
+
/**
|
|
778
|
+
0 = nothing loaded;
|
|
779
|
+
1 = product data loaded;
|
|
780
|
+
2 = product bounding box contour loaded;
|
|
781
|
+
3 = product contour loaded
|
|
782
|
+
*/
|
|
783
|
+
loadStage: number;
|
|
784
|
+
};
|
|
785
|
+
};
|
|
786
|
+
textureQueue: {
|
|
787
|
+
[textureId: string]: {
|
|
788
|
+
productId?: string;
|
|
789
|
+
nodes: Set<SceneNode>;
|
|
790
|
+
textureUrl: string;
|
|
791
|
+
applyFilter: boolean;
|
|
792
|
+
imageData?: any;
|
|
793
|
+
/**
|
|
794
|
+
0: nothing loaded;
|
|
795
|
+
1: image texture loaded;
|
|
796
|
+
2: final product texture created with contour baked in
|
|
797
|
+
*/
|
|
798
|
+
loadStage: number;
|
|
799
|
+
error?: boolean;
|
|
800
|
+
texture?: any;
|
|
801
|
+
anchor?: any;
|
|
802
|
+
offset?: any;
|
|
803
|
+
position?: any;
|
|
804
|
+
};
|
|
805
|
+
};
|
|
806
|
+
promiseCache: Map<string, Promise<any>>;
|
|
807
|
+
loadStages: {
|
|
808
|
+
product: boolean;
|
|
809
|
+
productContour: boolean;
|
|
810
|
+
productTexture: boolean;
|
|
811
|
+
};
|
|
812
|
+
isSceneStructureLoaded: boolean;
|
|
813
|
+
resources: FloorPlanCore['resources'];
|
|
814
|
+
productContourCacheAge: number;
|
|
815
|
+
productDataCacheAge: number;
|
|
816
|
+
initialLoading: boolean;
|
|
817
|
+
_loadCounter: number;
|
|
818
|
+
on: (event: LoadingEvent, callback: Function, ctx?: any) => this;
|
|
819
|
+
once: (event: LoadingEvent, callback: Function, ctx?: any) => this;
|
|
820
|
+
off: (event: LoadingEvent, callback?: Function) => this;
|
|
821
|
+
emit: (event: LoadingEvent, ...args: any[]) => this;
|
|
822
|
+
constructor(resources: FloorPlanCore['resources'], settings: FloorPlanCore['settings']);
|
|
823
|
+
loadStatus({ args }: {
|
|
824
|
+
args: any;
|
|
825
|
+
}): void;
|
|
826
|
+
reset(): void;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
interface StartupOptions {
|
|
830
|
+
/** option to hide certain elements */
|
|
831
|
+
hideElements?: HideableElement[];
|
|
832
|
+
preserveViewbox?: string;
|
|
833
|
+
/** option to disable panning and zooming */
|
|
834
|
+
panZoom?: boolean;
|
|
835
|
+
/** if set, panning and zooming is restricted to the scene boundingbox plus the margin */
|
|
836
|
+
panZoomMargin?: number;
|
|
837
|
+
/** rotation angle for the floor plan in degrees (counterclockwise) */
|
|
838
|
+
planRotation?: number;
|
|
839
|
+
/** if set room stamps have a fixed size - otherwise they adapt to the zoom level */
|
|
840
|
+
roomStampSize?: number;
|
|
841
|
+
/** toggle overlaying UI elements */
|
|
842
|
+
ui?: UI;
|
|
843
|
+
/** floor plan theming */
|
|
844
|
+
theme?: Theme;
|
|
845
|
+
/** mapping table for custom space labels */
|
|
846
|
+
spaceLabelMapping?: SpaceLabelMapping;
|
|
847
|
+
/** set the unit system */
|
|
848
|
+
units?: Units;
|
|
849
|
+
/** min and max zooming factor. Defaults to [3, 300] */
|
|
850
|
+
zoomRange?: [number, number];
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* This is the place to give the floor plan your own style
|
|
854
|
+
*/
|
|
855
|
+
declare type Theme = {
|
|
856
|
+
/** define the background */
|
|
857
|
+
background?: BackgroundOptions;
|
|
858
|
+
/** wall contours are merged to one continuous outline, needed if you want white walls */
|
|
859
|
+
wallContours?: boolean;
|
|
860
|
+
/** render assets with textures rather than solid colors */
|
|
861
|
+
showAssetTextures?: boolean;
|
|
862
|
+
nativeLines?: boolean;
|
|
863
|
+
fontFamily?: string;
|
|
864
|
+
elements?: {
|
|
865
|
+
roomStamp?: {
|
|
866
|
+
/** @deprecated show the usage information in room stamps */
|
|
867
|
+
showUsage?: boolean;
|
|
868
|
+
/** @deprecated show the area information in room stamps */
|
|
869
|
+
showArea?: boolean;
|
|
870
|
+
/** show the area information in room stamps */
|
|
871
|
+
roomStampDisplay?: ('usage' | 'area' | 'customId' | 'name')[];
|
|
872
|
+
/** text color for room stamps */
|
|
873
|
+
text?: RGBArray;
|
|
874
|
+
/** whether the room stamp text should have an outline to assist with contrast issues */
|
|
875
|
+
textOutline?: boolean;
|
|
876
|
+
};
|
|
877
|
+
asset?: ElementTheme;
|
|
878
|
+
space?: SpaceTheme;
|
|
879
|
+
wall?: ElementTheme;
|
|
880
|
+
wallContour?: ElementTheme;
|
|
881
|
+
box?: ElementTheme;
|
|
882
|
+
curtain?: ElementTheme;
|
|
883
|
+
closet?: ElementTheme;
|
|
884
|
+
door?: ElementTheme;
|
|
885
|
+
kitchen?: ElementTheme;
|
|
886
|
+
railing?: ElementTheme;
|
|
887
|
+
stairs?: ElementTheme;
|
|
888
|
+
window?: ElementTheme;
|
|
889
|
+
};
|
|
890
|
+
};
|
|
891
|
+
/**
|
|
892
|
+
* Background of the floor plan canvas
|
|
893
|
+
*/
|
|
894
|
+
declare type BackgroundOptions = {
|
|
895
|
+
/** background-color: hex code for color, set to 'transparent' for transparent background */
|
|
896
|
+
color?: string;
|
|
897
|
+
/** show a dynamic grid */
|
|
898
|
+
showGrid?: boolean;
|
|
899
|
+
};
|
|
900
|
+
/**
|
|
901
|
+
* Elements that can be hidden in the floor plan
|
|
902
|
+
*/
|
|
903
|
+
declare type HideableElement = 'interior' | 'roomStamp';
|
|
904
|
+
declare type UI = {
|
|
905
|
+
/** Show a dynamic scale indicator */
|
|
906
|
+
scale?: boolean;
|
|
907
|
+
/** Show the current cursor position in plan coordinates */
|
|
908
|
+
coordinates?: boolean;
|
|
909
|
+
};
|
|
910
|
+
/**
|
|
911
|
+
* Map space labels by space usage or space id to a custom name
|
|
912
|
+
* @example { kitchen: 'cuisine' }
|
|
913
|
+
*/
|
|
914
|
+
declare type SpaceLabelMapping = {
|
|
915
|
+
[label: string]: string;
|
|
916
|
+
};
|
|
917
|
+
/**
|
|
918
|
+
* Which unit system and how to display the units
|
|
919
|
+
*/
|
|
920
|
+
declare type Units = {
|
|
921
|
+
/** meters or feet? */
|
|
922
|
+
system?: 'metric' | 'imperial';
|
|
923
|
+
/** how many decimals should be shown for lengths? */
|
|
924
|
+
lengthDecimals?: number;
|
|
925
|
+
/** how many decimals should be shown for areas? */
|
|
926
|
+
areaDecimals?: number;
|
|
927
|
+
/** if 'area', it displays e.g. 12 m². If 'boundingBox'it displays e.g. 4 m x 3 m */
|
|
928
|
+
roomDimensions?: 'area' | 'boundingBox';
|
|
929
|
+
};
|
|
930
|
+
declare type FpeComputed = {
|
|
931
|
+
wallContours: PolygonList[];
|
|
932
|
+
relations: {
|
|
933
|
+
spaces: SpaceRelations[];
|
|
934
|
+
};
|
|
935
|
+
snapPoints: Polygon;
|
|
936
|
+
snapMargin: number;
|
|
937
|
+
};
|
|
938
|
+
declare type FpeCoreEvent = 'update-settings';
|
|
939
|
+
declare type Resources = {
|
|
940
|
+
spaces: SpaceResource[];
|
|
941
|
+
assets: AssetResource[];
|
|
942
|
+
products: {
|
|
943
|
+
[productId: string]: ProductData;
|
|
944
|
+
};
|
|
945
|
+
productContours: {
|
|
946
|
+
[productId: string]: PolygonList;
|
|
947
|
+
};
|
|
948
|
+
productBoundingBoxes: {
|
|
949
|
+
[productId: string]: PolygonList;
|
|
950
|
+
};
|
|
951
|
+
};
|
|
952
|
+
/**
|
|
953
|
+
* The main Floor plan engine SDK class
|
|
954
|
+
*/
|
|
955
|
+
declare class FloorPlanCore {
|
|
956
|
+
settings: FpeConfig;
|
|
957
|
+
readonly fpeId: string;
|
|
958
|
+
resources: Resources;
|
|
959
|
+
computed: FpeComputed;
|
|
960
|
+
loader: FpeLoader$1;
|
|
961
|
+
scene: Scene;
|
|
962
|
+
version: string;
|
|
963
|
+
isBrowser: boolean;
|
|
964
|
+
utils: any;
|
|
965
|
+
protected _emitter: TinyEmitter;
|
|
966
|
+
constructor({ options, scene }?: {
|
|
967
|
+
options?: FpeConfig;
|
|
968
|
+
scene?: Scene;
|
|
969
|
+
});
|
|
970
|
+
on(event: FpeCoreEvent, callback: Function, ctx?: any): this;
|
|
971
|
+
once(event: FpeCoreEvent, callback: Function, ctx?: any): this;
|
|
972
|
+
off(event: FpeCoreEvent, callback?: Function): this;
|
|
973
|
+
emit(event: FpeCoreEvent, ...args: any[]): this;
|
|
974
|
+
initScene(scene: any): void;
|
|
975
|
+
/**
|
|
976
|
+
* Load a scene with it's unique identifier the sceneId
|
|
977
|
+
* @param {string} sceneId id of the scene to load
|
|
978
|
+
* @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
|
|
979
|
+
* @returns {Promise.<Boolean, Error>} returns promise which resolves when loading is done
|
|
980
|
+
*/
|
|
981
|
+
loadScene(sceneId: string, accessTokenOptions?: TokenOptions): Promise<boolean | Error>;
|
|
982
|
+
getSpaces(): void;
|
|
983
|
+
/**
|
|
984
|
+
* Change options after the floor plan engine instance has been created
|
|
985
|
+
*/
|
|
986
|
+
set(args?: FpeConfig): void;
|
|
987
|
+
/**
|
|
988
|
+
* Get a list of spaces and assets for a specific plan position
|
|
989
|
+
* @param {*} pos - plan position
|
|
990
|
+
* @returns {Object} - list of spaces and assets
|
|
991
|
+
*/
|
|
992
|
+
getResourcesFromPosition(pos: Point2d): {
|
|
993
|
+
spaces: SpaceData[];
|
|
994
|
+
assets: AssetData[];
|
|
995
|
+
};
|
|
996
|
+
/**
|
|
997
|
+
* get bounding box of a scene node
|
|
998
|
+
* @param {SceneNode | string} node - Element or Element id
|
|
999
|
+
* @param {*} margin
|
|
1000
|
+
*/
|
|
1001
|
+
getElementBoundingBox(node: any, margin?: number): BoundingBox2d;
|
|
1002
|
+
/**
|
|
1003
|
+
* Destroy the floor plan instance
|
|
1004
|
+
*/
|
|
1005
|
+
destroy(): void;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
interface FpeConfig extends StartupOptions {
|
|
1009
|
+
api?: {
|
|
1010
|
+
accessToken?: string;
|
|
1011
|
+
sdkVersion?: string;
|
|
1012
|
+
productDataCacheAge?: number;
|
|
1013
|
+
productContourCacheAge?: number;
|
|
1014
|
+
} & TokenOptions;
|
|
1015
|
+
loadTextures?: boolean;
|
|
1016
|
+
showFloorPlan?: boolean;
|
|
1017
|
+
showSpaceDividers?: boolean;
|
|
1018
|
+
showCeilingLamps?: boolean;
|
|
1019
|
+
svgViewBoxDim?: number;
|
|
1020
|
+
xrayMode?: boolean;
|
|
1021
|
+
svgMode?: boolean;
|
|
1022
|
+
destroyOnDomRemove?: boolean;
|
|
1023
|
+
}
|
|
1024
|
+
interface ElementTheme {
|
|
1025
|
+
fill?: RGBArray;
|
|
1026
|
+
fillOpacity?: number;
|
|
1027
|
+
stroke?: RGBArray;
|
|
1028
|
+
strokeWidth?: number;
|
|
1029
|
+
}
|
|
1030
|
+
interface SpaceTheme extends ElementTheme {
|
|
1031
|
+
usage?: {
|
|
1032
|
+
[key: string]: ElementTheme;
|
|
1033
|
+
};
|
|
1034
|
+
program?: {
|
|
1035
|
+
[key: string]: ElementTheme;
|
|
1036
|
+
};
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
interface InfoWindowArgs {
|
|
1040
|
+
/** pixel width of the window - default 100 */
|
|
1041
|
+
width?: number;
|
|
1042
|
+
/** pixel height of the window - default 80 */
|
|
1043
|
+
height?: number;
|
|
1044
|
+
/** coordinates of the window in meters */
|
|
1045
|
+
pos?: Point2d;
|
|
1046
|
+
/** html string as content of the info window */
|
|
1047
|
+
html?: string;
|
|
1048
|
+
/** If true , a close button will appear in the top right corner of the info window. */
|
|
1049
|
+
closeButton?: boolean;
|
|
1050
|
+
}
|
|
1051
|
+
interface InfoWindowState extends InfoWindowArgs {
|
|
1052
|
+
floorPlan?: FloorPlanEngine;
|
|
1053
|
+
}
|
|
1054
|
+
declare class InfoWindow {
|
|
1055
|
+
private _floorPlan;
|
|
1056
|
+
pos: Point2d;
|
|
1057
|
+
height: number;
|
|
1058
|
+
width: number;
|
|
1059
|
+
closeButton: any;
|
|
1060
|
+
html: any;
|
|
1061
|
+
el: Element;
|
|
1062
|
+
private _anchorPos;
|
|
1063
|
+
private _getPosition;
|
|
1064
|
+
constructor({ width, height, pos, html, closeButton, floorPlan }?: InfoWindowState);
|
|
1065
|
+
_createInfoWindow(): void;
|
|
1066
|
+
_setContent(): void;
|
|
1067
|
+
_updateInfoWindow(): void;
|
|
1068
|
+
set({ width, height, pos, html, closeButton }: {
|
|
1069
|
+
width: any;
|
|
1070
|
+
height: any;
|
|
1071
|
+
pos: any;
|
|
1072
|
+
html: any;
|
|
1073
|
+
closeButton: any;
|
|
1074
|
+
}): void;
|
|
1075
|
+
remove(): void;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
interface HtmlMarkerArgs {
|
|
1079
|
+
/** coordinates of the window in meters */
|
|
1080
|
+
pos?: Point2d;
|
|
1081
|
+
offset?: Point2d;
|
|
1082
|
+
/** html string as content of the info window */
|
|
1083
|
+
el?: HTMLElement;
|
|
1084
|
+
/** If true , a close button will appear in the top right corner of the info window. */
|
|
1085
|
+
closeButton?: boolean;
|
|
1086
|
+
}
|
|
1087
|
+
interface HtmlMarkerState extends HtmlMarkerArgs {
|
|
1088
|
+
floorPlan: FloorPlanEngine;
|
|
1089
|
+
}
|
|
1090
|
+
declare class HtmlMarker {
|
|
1091
|
+
pos: Point2d;
|
|
1092
|
+
size: Point2d;
|
|
1093
|
+
offset: Point2d;
|
|
1094
|
+
isHidden: boolean;
|
|
1095
|
+
id: string;
|
|
1096
|
+
el: HTMLElement;
|
|
1097
|
+
private _floorPlan;
|
|
1098
|
+
private _anchorPos;
|
|
1099
|
+
constructor({ pos, offset, el, floorPlan }: HtmlMarkerState);
|
|
1100
|
+
_updateHtmlMarker: () => void;
|
|
1101
|
+
_updateHtmlMarkerStyle(): void;
|
|
1102
|
+
set({ pos, offset }: Pick<HtmlMarkerArgs, 'pos' | 'offset'>): void;
|
|
1103
|
+
remove(): void;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
declare type FpeLoader = FloorPlanCore['loader'];
|
|
1107
|
+
declare type ScreenPosition = {
|
|
1108
|
+
x: number;
|
|
1109
|
+
y: number;
|
|
1110
|
+
};
|
|
1111
|
+
declare class Ticker {
|
|
1112
|
+
methods: {
|
|
1113
|
+
[name: string]: {
|
|
1114
|
+
fn: Function;
|
|
1115
|
+
ctx: WebGlView;
|
|
1116
|
+
};
|
|
1117
|
+
};
|
|
1118
|
+
add: (name: string, fn: Function, ctx: WebGlView) => void;
|
|
1119
|
+
remove: (name: string) => void;
|
|
1120
|
+
}
|
|
1121
|
+
declare type ViewEvent = 'pan' | 'zoom' | 'viewbox' | 'resize-canvas' | 'scene-rendered' | 'focus';
|
|
1122
|
+
declare type BaseLayers = 'base' | 'scene' | 'annotation' | 'helper';
|
|
1123
|
+
declare class WebGlView extends TinyEmitter {
|
|
1124
|
+
windowPos: Point2d;
|
|
1125
|
+
zoom: number;
|
|
1126
|
+
client: Point2d;
|
|
1127
|
+
layers: Map<string, PlanLayer>;
|
|
1128
|
+
viewbox: BoundingBox2d;
|
|
1129
|
+
viewportNeedsUpdate: boolean;
|
|
1130
|
+
viewportPaused: boolean;
|
|
1131
|
+
viewportInFocus: boolean;
|
|
1132
|
+
parentEl: HTMLElement;
|
|
1133
|
+
_settings: FpeConfig;
|
|
1134
|
+
redrawScene: () => void;
|
|
1135
|
+
gfxNodes: {
|
|
1136
|
+
[nodeId: string]: {
|
|
1137
|
+
nodeContainer?: any;
|
|
1138
|
+
loadStage?: number;
|
|
1139
|
+
textureId?: string;
|
|
1140
|
+
};
|
|
1141
|
+
};
|
|
1142
|
+
_dummyTexture: any;
|
|
1143
|
+
_oldTime: number;
|
|
1144
|
+
ticker?: Ticker;
|
|
1145
|
+
on: (event: ViewEvent, callback: Function, ctx?: any) => this;
|
|
1146
|
+
once: (event: ViewEvent, callback: Function, ctx?: any) => this;
|
|
1147
|
+
off: (event: ViewEvent, callback?: Function) => this;
|
|
1148
|
+
emit: (event: ViewEvent, ...args: any[]) => this;
|
|
1149
|
+
constructor(loader: FpeLoader, settings: FpeConfig, fpeId: string);
|
|
1150
|
+
/**
|
|
1151
|
+
* main animation loop
|
|
1152
|
+
*/
|
|
1153
|
+
draw(): void;
|
|
1154
|
+
startAnimationLoop(): void;
|
|
1155
|
+
stopAnimationLoop(): void;
|
|
1156
|
+
updateView(): void;
|
|
1157
|
+
watchResize(): Promise<void>;
|
|
1158
|
+
get gfxNodeCount(): number;
|
|
1159
|
+
reset(): void;
|
|
1160
|
+
pause(interaction?: string): void;
|
|
1161
|
+
resume(interaction?: string): void;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
/** style definition used internally for rendering a node */
|
|
1165
|
+
interface StyleProps extends ShapeStyle {
|
|
1166
|
+
/** draw a dashed contour */
|
|
1167
|
+
dash?: boolean;
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
interface DrawGraphic {
|
|
1171
|
+
shapes: Shape[];
|
|
1172
|
+
pos?: Point2d;
|
|
1173
|
+
alpha?: number;
|
|
1174
|
+
clearLayer?: boolean;
|
|
1175
|
+
scale?: number;
|
|
1176
|
+
interactive?: boolean;
|
|
1177
|
+
id?: string;
|
|
1178
|
+
isHandler?: boolean;
|
|
1179
|
+
scaleOnZoom?: boolean;
|
|
1180
|
+
}
|
|
1181
|
+
interface PlanGraphicArgs extends DrawGraphic {
|
|
1182
|
+
floorPlan: FloorPlanEngine;
|
|
1183
|
+
}
|
|
1184
|
+
declare type GraphicUpdate = {
|
|
1185
|
+
pos?: Point2d;
|
|
1186
|
+
style?: StyleProps;
|
|
1187
|
+
shapes?: Shape[];
|
|
1188
|
+
};
|
|
1189
|
+
declare class PlanGraphic {
|
|
1190
|
+
shapes: Shape[];
|
|
1191
|
+
scaleOnZoom: boolean;
|
|
1192
|
+
gfxScale: number;
|
|
1193
|
+
private floorPlan;
|
|
1194
|
+
constructor({ shapes, pos, alpha, scale, clearLayer, interactive, id, isHandler, scaleOnZoom, baseLayer, container, floorPlan }: PlanGraphicArgs);
|
|
1195
|
+
set({ pos, style, shapes }?: GraphicUpdate): void;
|
|
1196
|
+
on(event: string, callback: any, context?: any): this;
|
|
1197
|
+
off(event: string, callback?: any): this;
|
|
1198
|
+
destroy(): void;
|
|
1199
|
+
private addDragEvent;
|
|
1200
|
+
private removeDragEvent;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
declare class PlanLayer {
|
|
1204
|
+
graphics: Set<PlanGraphic>;
|
|
1205
|
+
id: string;
|
|
1206
|
+
private baseLayer;
|
|
1207
|
+
private floorPlan;
|
|
1208
|
+
constructor(floorPlan: FloorPlanEngine, baseLayer?: BaseLayers, id?: string);
|
|
1209
|
+
addGraphic(args: DrawGraphic): PlanGraphic;
|
|
1210
|
+
deleteGraphic(graphic: PlanGraphic): void;
|
|
1211
|
+
/**
|
|
1212
|
+
* Draw shapes on the layer
|
|
1213
|
+
* @deprecated
|
|
1214
|
+
*/
|
|
1215
|
+
draw(args: DrawGraphic): PlanGraphic;
|
|
1216
|
+
drawImage({ url, width, height, mask, options }: {
|
|
1217
|
+
url: any;
|
|
1218
|
+
width: any;
|
|
1219
|
+
height: any;
|
|
1220
|
+
mask: any;
|
|
1221
|
+
options: any;
|
|
1222
|
+
}): void;
|
|
1223
|
+
/**
|
|
1224
|
+
* clear all shapes from the layer
|
|
1225
|
+
*/
|
|
1226
|
+
clear(): void;
|
|
1227
|
+
/**
|
|
1228
|
+
* destroy layer and all shapes
|
|
1229
|
+
*/
|
|
1230
|
+
destroy(): void;
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
interface MarkerArgs {
|
|
1234
|
+
/** coordinates of the marker in meters */
|
|
1235
|
+
pos?: Point2d;
|
|
1236
|
+
/** color of the marker, hex code */
|
|
1237
|
+
color?: string;
|
|
1238
|
+
/** size in pixels */
|
|
1239
|
+
size?: number;
|
|
1240
|
+
floorPlan?: FloorPlanEngine;
|
|
1241
|
+
}
|
|
1242
|
+
interface MarkerUpdateArgs {
|
|
1243
|
+
events?: {
|
|
1244
|
+
[event: string]: {
|
|
1245
|
+
callback: any;
|
|
1246
|
+
context: any;
|
|
1247
|
+
};
|
|
1248
|
+
};
|
|
1249
|
+
}
|
|
1250
|
+
declare class MarkerPin {
|
|
1251
|
+
pos: Point2d;
|
|
1252
|
+
color: string;
|
|
1253
|
+
size: number;
|
|
1254
|
+
id: string;
|
|
1255
|
+
layer: PlanLayer;
|
|
1256
|
+
graphic: PlanGraphic;
|
|
1257
|
+
private floorPlan;
|
|
1258
|
+
constructor({ pos, color, size, floorPlan }: MarkerArgs);
|
|
1259
|
+
draw(): void;
|
|
1260
|
+
remove(): void;
|
|
1261
|
+
on(eventType: string, callback: any, context?: any): void;
|
|
1262
|
+
off(eventType?: string, callback?: any): void;
|
|
1263
|
+
set(updateArgs: MarkerUpdateArgs): void;
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
declare type Animate = number | boolean;
|
|
1267
|
+
|
|
1268
|
+
declare class Helper extends TinyEmitter {
|
|
1269
|
+
floorPlan: FloorPlanEngine;
|
|
1270
|
+
helperId: string;
|
|
1271
|
+
constructor({ floorPlan, helperId }: {
|
|
1272
|
+
floorPlan: FloorPlanEngine;
|
|
1273
|
+
helperId: string;
|
|
1274
|
+
});
|
|
1275
|
+
destroy(): void;
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
declare type FpeEvent = FpeCoreEvent | 'click' | 'dblclick' | 'context-menu' | 'mousemove' | 'drop' | 'drag-move' | 'drag-start' | 'drag-end' | 'key' | 'keyup';
|
|
1279
|
+
interface ExportImage {
|
|
1280
|
+
/** output format: png, jpg */
|
|
1281
|
+
format?: 'png' | 'jpg';
|
|
1282
|
+
/** fle name relevant if download is true */
|
|
1283
|
+
fileName?: string;
|
|
1284
|
+
/** only relevant if format is jpg */
|
|
1285
|
+
quality?: number;
|
|
1286
|
+
/** desired output format */
|
|
1287
|
+
output?: 'base64' | 'text';
|
|
1288
|
+
/** target width of the image */
|
|
1289
|
+
maxWidth?: number;
|
|
1290
|
+
/** If true, methods triggers a file download directly */
|
|
1291
|
+
download?: boolean;
|
|
1292
|
+
}
|
|
1293
|
+
interface FpeInteraction {
|
|
1294
|
+
lastSceneClick: Point2d;
|
|
1295
|
+
cursor: Point2d;
|
|
1296
|
+
cursorTarget: SceneNode;
|
|
1297
|
+
isDragging: boolean;
|
|
1298
|
+
isPanning: boolean;
|
|
1299
|
+
lastClick: {
|
|
1300
|
+
time: number;
|
|
1301
|
+
pos: ScreenPosition;
|
|
1302
|
+
};
|
|
1303
|
+
metaKey: boolean;
|
|
1304
|
+
ctrlKey: boolean;
|
|
1305
|
+
altKey: boolean;
|
|
1306
|
+
shiftKey: boolean;
|
|
1307
|
+
dragOffset: Point2d;
|
|
1308
|
+
cursorAction: 'split-wall' | 'duplicate' | 'move' | 'select' | 'none';
|
|
1309
|
+
_dragStart: ScreenPosition;
|
|
1310
|
+
}
|
|
1311
|
+
/**
|
|
1312
|
+
* The main Floor plan engine SDK class
|
|
1313
|
+
*/
|
|
1314
|
+
declare class FloorPlanEngine extends FloorPlanCore {
|
|
1315
|
+
fpeNode?: HTMLElement;
|
|
1316
|
+
view: WebGlView;
|
|
1317
|
+
interaction: FpeInteraction;
|
|
1318
|
+
availableHelpers: {
|
|
1319
|
+
[name: string]: typeof Helper;
|
|
1320
|
+
};
|
|
1321
|
+
helper: {
|
|
1322
|
+
[name: string]: Helper;
|
|
1323
|
+
};
|
|
1324
|
+
constructor({ container, options, scene }?: {
|
|
1325
|
+
container?: Element;
|
|
1326
|
+
options?: FpeConfig;
|
|
1327
|
+
scene?: Scene;
|
|
1328
|
+
});
|
|
1329
|
+
prevent(e: any): void;
|
|
1330
|
+
/**
|
|
1331
|
+
* Subscribe to an event
|
|
1332
|
+
*/
|
|
1333
|
+
on(event: FpeEvent, callback: Function, ctx?: any): this;
|
|
1334
|
+
/**
|
|
1335
|
+
* Subscribe to an event once
|
|
1336
|
+
*/
|
|
1337
|
+
once(event: FpeEvent, callback: Function, ctx?: any): this;
|
|
1338
|
+
/**
|
|
1339
|
+
*/
|
|
1340
|
+
off(event: FpeEvent, callback?: Function): this;
|
|
1341
|
+
emit(event: FpeEvent, ...args: any[]): this;
|
|
1342
|
+
handleDrop(evt: any): void;
|
|
1343
|
+
/**
|
|
1344
|
+
* Change options after the floor plan engine instance has been created
|
|
1345
|
+
* @param {StartupOptions} args - Startup options
|
|
1346
|
+
*/
|
|
1347
|
+
set(args: FpeConfig): void;
|
|
1348
|
+
mountFloorPlan(root: Element): void;
|
|
1349
|
+
initDrawing(): void;
|
|
1350
|
+
initDrawingEvents(): void;
|
|
1351
|
+
generateUi(): void;
|
|
1352
|
+
getSceneBoundingBox(margin?: number): BoundingBox2d;
|
|
1353
|
+
/**
|
|
1354
|
+
* Get a bounding box containing the scene, with some padding
|
|
1355
|
+
* @param {BoundingBox2d} sceneBoundingBox - bounding box of the scene, in meters.
|
|
1356
|
+
* @param {number} rectLeft - left edge of a rectangle into which the scene should fit, in pixels.
|
|
1357
|
+
* @param {number} rectTop - top edge of a rectangle into which the scene should fit, in pixels.
|
|
1358
|
+
* @param {number} rectRight - right edge of a rectangle into which the scene should fit, in pixels.
|
|
1359
|
+
* @param {number} rectBottom - bottom edge of a rectangle into which the scene should fit, in pixels.
|
|
1360
|
+
* @param {number} viewportWidth - width in pixels of the canvas.
|
|
1361
|
+
* @param {number} viewportHeight - height in pixels of the canvas.
|
|
1362
|
+
* @returns {BoundingBox2d} returns a new bounding box
|
|
1363
|
+
*/
|
|
1364
|
+
getZoomExtentsBoundingBox(sceneBoundingBox: BoundingBox2d, rectLeft: number, rectTop: number, rectRight: number, rectBottom: number, viewportWidth: number, viewportHeight: number): BoundingBox2d;
|
|
1365
|
+
/**
|
|
1366
|
+
* Zoom to the extent of the scene in the viewport ( wait for loadScene promise )
|
|
1367
|
+
* @param {number} [margin = 1] - margin around scene in meters. Defaults to 1 meter
|
|
1368
|
+
* @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
|
|
1369
|
+
* @param {BoundingBox2d} [boundingBox = null] - bounding box to zoom to. Can for example be calculated via getZoomExtentsBoundingBox(…). If provided, the margin parameter will be ignored
|
|
1370
|
+
* @returns {Promise.<Boolean, Error>} returns promise which resolves when animation is done
|
|
1371
|
+
*/
|
|
1372
|
+
zoomExtents(margin?: number, animate?: Animate, boundingBox?: BoundingBox2d): Promise<boolean>;
|
|
1373
|
+
/**
|
|
1374
|
+
* Zoom to the bounding box of an element ( wait for loadScene promise )
|
|
1375
|
+
* @param {string | SceneNode} node - id of an asset or a space or the node itself
|
|
1376
|
+
* @param {number} [margin = 1] - margin around scene in meters
|
|
1377
|
+
* @param {Animate} [animate] - duration of the animation for the viewport transform, if not provided there will be no animation
|
|
1378
|
+
* @returns {Promise.<Boolean, Error>} returns promise which resolves when animation is done
|
|
1379
|
+
*/
|
|
1380
|
+
zoomToElement(node: any, margin?: number, animate?: Animate): Promise<boolean | Error>;
|
|
1381
|
+
/**
|
|
1382
|
+
* set zoom to a specific bounding box
|
|
1383
|
+
* @param {BoundingBox} bb - bounding box
|
|
1384
|
+
* @param {Animate} [animate] - duration of the animation for the viewport transform, if not provided there will be no animation
|
|
1385
|
+
* @returns {Promise.<Boolean, Error>} returns promise which resolves when animation is done
|
|
1386
|
+
*/
|
|
1387
|
+
setZoom(bb: BoundingBox2d, animate?: Animate): Promise<boolean>;
|
|
1388
|
+
/**
|
|
1389
|
+
* zoom the current view by a factor
|
|
1390
|
+
* @param {number} factor - zoom factor, larger than 1 zooms in, smaller than 1 zooms out
|
|
1391
|
+
* @param {Animate} [animate = true] - duration of the animation for the viewport transform, if not provided there will be no animation
|
|
1392
|
+
* @returns {Promise.<Boolean, Error>} returns promise which resolves when animation is done
|
|
1393
|
+
*/
|
|
1394
|
+
zoomByFactor(factor: number, animate?: Animate): Promise<boolean>;
|
|
1395
|
+
/**
|
|
1396
|
+
* Add HTML info window
|
|
1397
|
+
*/
|
|
1398
|
+
addInfoWindow(args?: InfoWindowArgs): InfoWindow;
|
|
1399
|
+
/**
|
|
1400
|
+
* Add custom HTML marker
|
|
1401
|
+
*/
|
|
1402
|
+
addHtmlMarker(args?: HtmlMarkerArgs): HtmlMarker;
|
|
1403
|
+
/**
|
|
1404
|
+
* Add plan marker
|
|
1405
|
+
*/
|
|
1406
|
+
addMarker({ pos, color, size }?: MarkerArgs): MarkerPin;
|
|
1407
|
+
/**
|
|
1408
|
+
* Convert screen coordinates to plan coordinates
|
|
1409
|
+
*/
|
|
1410
|
+
getPlanPosition(point: Point2d): Point2d;
|
|
1411
|
+
/**
|
|
1412
|
+
* Convert plan coordinates to screen coordinates
|
|
1413
|
+
*/
|
|
1414
|
+
getScreenPosition(point: Point2d): Point2d;
|
|
1415
|
+
/**
|
|
1416
|
+
* create plan layer or return existing by id
|
|
1417
|
+
*/
|
|
1418
|
+
addLayer({ id, baseLayer }?: {
|
|
1419
|
+
id?: string;
|
|
1420
|
+
baseLayer?: BaseLayers;
|
|
1421
|
+
}): PlanLayer;
|
|
1422
|
+
/**
|
|
1423
|
+
* get plan layer by name
|
|
1424
|
+
*/
|
|
1425
|
+
getLayer(id: any): PlanLayer;
|
|
1426
|
+
/**
|
|
1427
|
+
* create plan graphic
|
|
1428
|
+
* @deprecated use floorPlan.addLayer(<name>)
|
|
1429
|
+
* @returns {PlanLayer}
|
|
1430
|
+
*/
|
|
1431
|
+
addPlanGraphic(): PlanLayer;
|
|
1432
|
+
/**
|
|
1433
|
+
* Adds a helper and removes previous instances of it
|
|
1434
|
+
*/
|
|
1435
|
+
addHelper(helper: string | typeof Helper, options?: any): Helper;
|
|
1436
|
+
removeHelper(helperId: string): void;
|
|
1437
|
+
/**
|
|
1438
|
+
* Export the current view as an image
|
|
1439
|
+
*/
|
|
1440
|
+
exportImage({ format, fileName, quality, output, maxWidth, download }?: ExportImage): Promise<string | Error>;
|
|
1441
|
+
/**
|
|
1442
|
+
* Destroy the floor plan instance
|
|
1443
|
+
*/
|
|
1444
|
+
destroy(): void;
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
export { FloorPlanEngine, Point2d, Polygon, PolygonList, Shape, polygonIntersection, polygonOffset, polygonUnion };
|