@archilogic/floor-plan-sdk 5.0.0 → 5.0.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/README.md CHANGED
@@ -10,7 +10,7 @@ npm i @archilogic/floor-plan-sdk
10
10
 
11
11
  ## API Extractor
12
12
 
13
- This package uses [API Extractor](https://api-extractor.com/) to generate [API report](./api.md) and [doc model](https://api-extractor.com/pages/overview/demo_docs/#whats-in-the-json-file) files
13
+ This package uses [API Extractor](https://api-extractor.com/) to generate [API report](./api.md) and [doc model](https://api-extractor.com/pages/overview/demo_docs/#whats-in-the-json-file) files
14
14
 
15
15
  - The API report is used to track changes to the public API. This file is internal and tracked by git
16
16
  - The doc model file is distributed with the npm package, and is used to generate the public documentation
@@ -20,23 +20,26 @@ Both files are generated by the `npm run build:api` command
20
20
  ## Usage
21
21
 
22
22
  ### npm package
23
+
23
24
  ```bash
24
25
  npm i @archilogic/floor-plan-sdk
25
26
  ```
27
+
26
28
  ```js
27
29
  import { FloorPlanEngine } from '@archilogic/floor-plan-sdk'
28
30
  ```
29
31
 
30
32
  ### es module import via CDN
33
+
31
34
  ```js
32
35
  import { FloorPlanEngine } from 'https://esm.sh/@archilogic/floor-plan-sdk'
33
36
  ```
34
37
 
35
38
  ### umd module import via CDN
39
+
36
40
  ```html
37
41
  <script src="https://unpkg.com/@archilogic/floor-plan-sdk"></script>
38
42
  <script>
39
- const { FloorPlanEngine } = FloorPlanSdk
43
+ const { FloorPlanEngine } = FloorPlanSdk
40
44
  </script>
41
45
  ```
42
-
package/dist/fpe.d.ts CHANGED
@@ -1326,7 +1326,7 @@ declare const LayoutColumnTypeValue = "element:column";
1326
1326
  declare class LayoutCurtainWall extends LayoutEdgeElementBase {
1327
1327
  type: LayoutCurtainWallType;
1328
1328
  parameters: LayoutCurtainWallParameters;
1329
- constructor(id: string, edge: SpatialGraphEdge);
1329
+ constructor(id: string, edges: SpatialGraphEdge[]);
1330
1330
  setParameters(parameters: RecursivePartial<LayoutCurtainWallParameters>): void;
1331
1331
  }
1332
1332
 
@@ -1379,10 +1379,24 @@ declare type LayoutEdgeElement = LayoutCurtainWall | LayoutSpaceDivider | Layout
1379
1379
  declare class LayoutEdgeElementBase extends LayoutElementBase {
1380
1380
  type: LayoutEdgeElementType;
1381
1381
  parameters: LayoutEdgeElementParameters;
1382
- edge: SpatialGraphEdge;
1383
- constructor(id: string, type: LayoutEdgeElementType, edge: SpatialGraphEdge);
1384
- getVertices(): SpatialGraphVertex[];
1382
+ private edges;
1383
+ private vertices;
1384
+ edgesChanged: boolean;
1385
+ constructor(id: string, type: LayoutEdgeElementType, edges: SpatialGraphEdge[]);
1386
+ setEdges(edges: SpatialGraphEdge[]): void;
1387
+ private verifyEdges;
1385
1388
  getEdges(): SpatialGraphEdge[];
1389
+ getVertices(): SpatialGraphVertex[];
1390
+ getStartVertex(): SpatialGraphVertex;
1391
+ getEndVertex(): SpatialGraphVertex;
1392
+ getAxisPoints(): [Vector2, Vector2];
1393
+ getAxisLength(): number;
1394
+ getEdgeAtLinearPosition(u: number): SpatialGraphEdge | undefined;
1395
+ getEdgesAtLinearSegment(u: number, v: number): SpatialGraphEdge[];
1396
+ /**
1397
+ * @deprecated Use getEdges() instead of edge
1398
+ */
1399
+ get edge(): SpatialGraphEdge;
1386
1400
  getAdjacentElementsByVertex(): [LayoutEdgeElement[], LayoutEdgeElement[]];
1387
1401
  getAdjacentSpacesBySide(): [LayoutSpace[], LayoutSpace[]];
1388
1402
  getSpaces(): LayoutSpace[];
@@ -1391,7 +1405,7 @@ declare class LayoutEdgeElementBase extends LayoutElementBase {
1391
1405
 
1392
1406
  declare interface LayoutEdgeElementBaseJson extends LayoutElementBaseJson {
1393
1407
  type: LayoutEdgeElementType;
1394
- edge: string;
1408
+ edge: string | string[];
1395
1409
  parameters?: LayoutEdgeElementParametersJson;
1396
1410
  }
1397
1411
 
@@ -1568,6 +1582,11 @@ declare class LayoutOpening extends LayoutOpeningElementBase {
1568
1582
  get position(): Vector3;
1569
1583
  get rotation(): number;
1570
1584
  setParameters(parameters: RecursivePartial<LayoutOpeningParameters>): void;
1585
+ getBoundingBox(localTransform?: boolean): {
1586
+ min: Vector3;
1587
+ max: Vector3;
1588
+ transform: Transform3d;
1589
+ };
1571
1590
  getSpaces(): LayoutSpace[];
1572
1591
  }
1573
1592
 
@@ -1761,7 +1780,7 @@ declare interface LayoutSpaceAttributesJson {
1761
1780
  declare class LayoutSpaceDivider extends LayoutEdgeElementBase {
1762
1781
  type: LayoutSpaceDividerType;
1763
1782
  parameters: LayoutSpaceDividerParameters;
1764
- constructor(id: string, edge: SpatialGraphEdge);
1783
+ constructor(id: string, edges: SpatialGraphEdge[]);
1765
1784
  setParameters(parameters: RecursivePartial<LayoutSpaceDividerParameters>): void;
1766
1785
  getBoundingBox(): {
1767
1786
  min: Vector3;
@@ -1959,7 +1978,7 @@ declare class LayoutWall extends LayoutEdgeElementBase {
1959
1978
  type: LayoutWallType;
1960
1979
  parameters: LayoutWallParameters;
1961
1980
  geometryProfile: LayoutWallGeometryProfile;
1962
- constructor(id: string, edge: SpatialGraphEdge);
1981
+ constructor(id: string, edges: SpatialGraphEdge[]);
1963
1982
  copyForClone(wall: LayoutWall): void;
1964
1983
  setParameters(parameters: RecursivePartial<LayoutWallParameters>): void;
1965
1984
  getBoundingBox(): {
@@ -2107,6 +2126,12 @@ declare type MeshGeometryType = typeof MeshGeometryTypeValue;
2107
2126
 
2108
2127
  declare const MeshGeometryTypeValue = "geometry:mesh";
2109
2128
 
2129
+ declare type NodesByType<NodeMap extends NodeTypeMap = {}> = {
2130
+ -readonly [K in keyof NodeMap]: InstanceType<NodeMap[K]>[];
2131
+ };
2132
+
2133
+ declare type NodeTypeMap = Record<string, any>;
2134
+
2110
2135
  declare interface NumberList extends SpaceGraphTypedValueJson {
2111
2136
  type: 'number:list';
2112
2137
  list: number[];
@@ -2364,26 +2389,86 @@ declare class SpaceGraph {
2364
2389
  spatialStructure: SpaceGraphSpatialStructure;
2365
2390
  products: SpaceGraphProduct[];
2366
2391
  productsById: Record<string, SpaceGraphProduct>;
2367
- productsByType: Record<string, SpaceGraphProduct[]>;
2392
+ productsByType: NodesByType<{
2393
+ readonly 'product:static': typeof SpaceGraphProduct;
2394
+ }>;
2368
2395
  geometries: SpaceGraphGeometryJson[];
2369
2396
  geometriesById: Record<string, SpaceGraphGeometryJson>;
2370
- geometriesByType: Record<string, SpaceGraphGeometryJson[]>;
2397
+ geometriesByType: NodesByType<{
2398
+ readonly 'geometry:plane': typeof PlaneGeometry;
2399
+ readonly 'geometry:cuboid': typeof CuboidGeometry;
2400
+ readonly 'geometry:sphere': typeof SphereGeometry;
2401
+ readonly 'geometry:extrusion': typeof ExtrusionGeometry;
2402
+ readonly 'geometry:mesh': typeof MeshGeometry;
2403
+ readonly 'geometry:uri': typeof UriGeometry;
2404
+ }>;
2371
2405
  materials: SpaceGraphMaterial[];
2372
2406
  materialsById: Record<string, SpaceGraphMaterial>;
2373
- materialsByType: Record<string, SpaceGraphMaterial[]>;
2407
+ materialsByType: NodesByType<{
2408
+ readonly 'material:embedded': typeof SpaceGraphEmbeddedMaterial;
2409
+ readonly 'material:basic': typeof SpaceGraphBasicMaterial;
2410
+ readonly 'material:color': typeof SpaceGraphColorMaterial;
2411
+ readonly 'material:standard': typeof SpaceGraphStandardMaterial;
2412
+ }>;
2374
2413
  relations: SpaceGraphRelation[];
2375
2414
  relationsById: Record<string, SpaceGraphRelation>;
2376
- relationsByType: Record<string, SpaceGraphRelation[]>;
2415
+ relationsByType: NodesByType<{
2416
+ readonly 'relation:group': typeof GroupRelation;
2417
+ }>;
2377
2418
  nodes: SpaceGraphNode[];
2378
2419
  nodesById: Record<string, SpaceGraphNode>;
2379
- nodesByType: Record<string, SpaceGraphNode[]>;
2420
+ nodesByType: NodesByType<{
2421
+ readonly 'spatialStructure:building': typeof SpaceGraphBuilding;
2422
+ readonly 'spatialStructure:floor': typeof SpaceGraphFloor;
2423
+ readonly 'spatialStructure:layout': typeof SpaceGraphLayout;
2424
+ readonly 'relation:group': typeof GroupRelation;
2425
+ readonly 'product:static': typeof SpaceGraphProduct;
2426
+ readonly 'material:embedded': typeof SpaceGraphEmbeddedMaterial;
2427
+ readonly 'material:basic': typeof SpaceGraphBasicMaterial;
2428
+ readonly 'material:color': typeof SpaceGraphColorMaterial;
2429
+ readonly 'material:standard': typeof SpaceGraphStandardMaterial;
2430
+ readonly 'geometry:plane': typeof PlaneGeometry;
2431
+ readonly 'geometry:cuboid': typeof CuboidGeometry;
2432
+ readonly 'geometry:sphere': typeof SphereGeometry;
2433
+ readonly 'geometry:extrusion': typeof ExtrusionGeometry;
2434
+ readonly 'geometry:mesh': typeof MeshGeometry;
2435
+ readonly 'geometry:uri': typeof UriGeometry;
2436
+ readonly 'spatialGraph:edge': typeof SpatialGraphEdge;
2437
+ readonly 'spatialGraph:vertex': typeof SpatialGraphVertex;
2438
+ readonly 'layout:space': typeof LayoutSpace;
2439
+ readonly 'view:2d': typeof Layout2dView;
2440
+ readonly 'view:3d': typeof Layout3dView;
2441
+ readonly 'annotation:floorPlanDxf': typeof LayoutFloorPlanDxfAnnotation;
2442
+ readonly 'annotation:floorPlanImage': typeof LayoutFloorPlanImageAnnotation;
2443
+ readonly 'element:ceiling': typeof LayoutBoundarySlab;
2444
+ readonly 'element:floor': typeof LayoutBoundarySlab;
2445
+ readonly 'element:boundaryWall': typeof LayoutBoundaryWall;
2446
+ readonly 'element:curtainWall': typeof LayoutCurtainWall;
2447
+ readonly 'element:spaceDivider': typeof LayoutSpaceDivider;
2448
+ readonly 'element:wall': typeof LayoutWall;
2449
+ readonly 'element:opening': typeof LayoutOpening;
2450
+ readonly 'element:asset': typeof LayoutAsset;
2451
+ readonly 'element:beam': typeof LayoutBeam;
2452
+ readonly 'element:casework': typeof LayoutCasework;
2453
+ readonly 'element:column': typeof LayoutColumn;
2454
+ readonly 'element:door': typeof LayoutDoor;
2455
+ readonly 'element:generic': typeof LayoutGeneric;
2456
+ readonly 'element:kitchen': typeof LayoutKitchen;
2457
+ readonly 'element:railing': typeof LayoutRailing;
2458
+ readonly 'element:ramp': typeof LayoutRamp;
2459
+ readonly 'element:roof': typeof LayoutRoof;
2460
+ readonly 'element:slab': typeof LayoutSlab;
2461
+ readonly 'element:stairs': typeof LayoutStairs;
2462
+ readonly 'element:stairFlight': typeof LayoutStairFlight;
2463
+ readonly 'element:window': typeof LayoutWindow;
2464
+ }>;
2380
2465
  private emitter;
2381
2466
  constructor();
2382
2467
  getEvents(): Record<string, Function>;
2383
2468
  copyEvents(spaceGraph: SpaceGraph): void;
2384
- deleteNodeAtIndex(nodeIndex: number, nodes: SpaceGraphNode[], nodesById: Record<string, SpaceGraphNode>, nodesByType: Record<string, SpaceGraphNode[]>): SpaceGraphNode | undefined;
2385
- insertNode(node: SpaceGraphNode, nodes: SpaceGraphNode[], nodesById: Record<string, SpaceGraphNode>, nodesByType: Record<string, SpaceGraphNode[]>): void;
2386
- removeNode(node: SpaceGraphNode, nodes: SpaceGraphNode[], nodesById: Record<string, SpaceGraphNode>, nodesByType: Record<string, SpaceGraphNode[]>): SpaceGraphNode | undefined;
2469
+ deleteNodeAtIndex(nodeIndex: number, nodes: SpaceGraphNode[], nodesById: Record<string, SpaceGraphNode>, nodesByType: NodesByType<Record<string, SpaceGraphNode>>): SpaceGraphNode | undefined;
2470
+ insertNode(node: SpaceGraphNode, nodes: SpaceGraphNode[], nodesById: Record<string, SpaceGraphNode>, nodesByType: NodesByType<Record<string, SpaceGraphNode>>): void;
2471
+ removeNode(node: SpaceGraphNode, nodes: SpaceGraphNode[], nodesById: Record<string, SpaceGraphNode>, nodesByType: NodesByType<Record<string, SpaceGraphNode>>): SpaceGraphNode | undefined;
2387
2472
  registerNode(node: SpaceGraphNode): void;
2388
2473
  unregisterNode(node: SpaceGraphNode): void;
2389
2474
  insertSpatialStructure(spatialStructure: SpaceGraphSpatialStructure): void;
@@ -2569,13 +2654,41 @@ declare class SpaceGraphLayout extends SpaceGraphSpatialStructureBase {
2569
2654
  spacesById: Record<string, LayoutSpace>;
2570
2655
  elements: LayoutElement[];
2571
2656
  elementsById: Record<string, LayoutElement>;
2572
- elementsByType: Record<string, LayoutElement[]>;
2657
+ elementsByType: NodesByType<{
2658
+ readonly 'element:ceiling': typeof LayoutBoundarySlab;
2659
+ readonly 'element:floor': typeof LayoutBoundarySlab;
2660
+ readonly 'element:boundaryWall': typeof LayoutBoundaryWall;
2661
+ readonly 'element:curtainWall': typeof LayoutCurtainWall;
2662
+ readonly 'element:spaceDivider': typeof LayoutSpaceDivider;
2663
+ readonly 'element:wall': typeof LayoutWall;
2664
+ readonly 'element:opening': typeof LayoutOpening;
2665
+ readonly 'element:asset': typeof LayoutAsset;
2666
+ readonly 'element:beam': typeof LayoutBeam;
2667
+ readonly 'element:casework': typeof LayoutCasework;
2668
+ readonly 'element:column': typeof LayoutColumn;
2669
+ readonly 'element:door': typeof LayoutDoor;
2670
+ readonly 'element:generic': typeof LayoutGeneric;
2671
+ readonly 'element:kitchen': typeof LayoutKitchen;
2672
+ readonly 'element:railing': typeof LayoutRailing;
2673
+ readonly 'element:ramp': typeof LayoutRamp;
2674
+ readonly 'element:roof': typeof LayoutRoof;
2675
+ readonly 'element:slab': typeof LayoutSlab;
2676
+ readonly 'element:stairs': typeof LayoutStairs;
2677
+ readonly 'element:stairFlight': typeof LayoutStairFlight;
2678
+ readonly 'element:window': typeof LayoutWindow;
2679
+ }>;
2573
2680
  annotations: LayoutAnnotation[];
2574
2681
  annotationsById: Record<string, LayoutAnnotation>;
2575
- annotationsByType: Record<string, LayoutAnnotation[]>;
2682
+ annotationsByType: NodesByType<{
2683
+ readonly 'annotation:floorPlanDxf': typeof LayoutFloorPlanDxfAnnotation;
2684
+ readonly 'annotation:floorPlanImage': typeof LayoutFloorPlanImageAnnotation;
2685
+ }>;
2576
2686
  views: LayoutView[];
2577
2687
  viewsById: Record<string, LayoutView>;
2578
- viewsByType: Record<string, LayoutView[]>;
2688
+ viewsByType: NodesByType<{
2689
+ readonly 'view:2d': typeof Layout2dView;
2690
+ readonly 'view:3d': typeof Layout3dView;
2691
+ }>;
2579
2692
  debugIds: boolean;
2580
2693
  suggestedIds: Record<string, boolean>;
2581
2694
  constructor(id: string);
@@ -2588,7 +2701,7 @@ declare class SpaceGraphLayout extends SpaceGraphSpatialStructureBase {
2588
2701
  createElement(type: LayoutOpeningType, id: string): LayoutOpening;
2589
2702
  createElement(type: LayoutBoundarySlabType, id: string, boundaries: LayoutBoundary[]): LayoutBoundarySlab;
2590
2703
  createElement(type: LayoutBoundaryWallType, id: string, boundaries: LayoutBoundary[]): LayoutBoundaryWall;
2591
- createElement<T extends LayoutEdgeElementType>(type: T, id: string, edge: SpatialGraphEdge): EdgeElementMap[T];
2704
+ createElement<T extends LayoutEdgeElementType>(type: T, id: string, edges: SpatialGraphEdge[]): EdgeElementMap[T];
2592
2705
  createElement<T extends LayoutTransformElementType>(type: T, id: string): TransformElementMap[T];
2593
2706
  insertNode(node: LayoutAnnotation | LayoutView): void;
2594
2707
  removeNode(node: LayoutAnnotation | LayoutView): void;
@@ -2610,6 +2723,7 @@ declare class SpaceGraphLayout extends SpaceGraphSpatialStructureBase {
2610
2723
  getUniqueId(prefix: string, nodesById: Record<string, SpaceGraphNode>): string;
2611
2724
  getSpaceId(prefix?: string): string;
2612
2725
  getElementId(element: LayoutElement, prefix?: string): string;
2726
+ getBoundingBox(): TransformBoundingBox3d;
2613
2727
  }
2614
2728
 
2615
2729
  declare interface SpaceGraphLayoutJson extends SpaceGraphSpatialStructureBaseJson {
@@ -2636,7 +2750,7 @@ declare type SpaceGraphMaterialJson = Rgb | RgbA | string | SpaceGraphMaterialRe
2636
2750
 
2637
2751
  declare type SpaceGraphMaterialResourceJson = SpaceGraphColorMaterialJson | SpaceGraphStandardMaterialJson | SpaceGraphBasicMaterialJson;
2638
2752
 
2639
- declare type SpaceGraphNode = SpaceGraphProduct | SpaceGraphGeometry | SpaceGraphMaterial | SpaceGraphRelation | SpaceGraphBuilding | SpaceGraphFloor | LayoutNode | SpaceGraphLayout;
2753
+ declare type SpaceGraphNode = SpaceGraphProduct | SpaceGraphGeometry | SpaceGraphMaterial | SpaceGraphRelation | SpaceGraphBuilding | SpaceGraphFloor | LayoutNode | SpaceGraphLayout | LayoutAnnotation;
2640
2754
 
2641
2755
  declare class SpaceGraphNodeBase extends SpaceGraphTypedValue {
2642
2756
  id: string;