@thatopen/components 2.4.4 → 2.4.6

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
@@ -0,0 +1,92 @@
1
+ <p align="center">
2
+ <a href="https://thatopen.com/">TOC</a>
3
+ |
4
+ <a href="https://docs.thatopen.com/intro">documentation</a>
5
+ |
6
+ <a href="https://thatopen.github.io/engine_components/examples/IfcLoader/index.html">demo</a>
7
+ |
8
+ <a href="https://people.thatopen.com/">community</a>
9
+ |
10
+ <a href="https://www.npmjs.com/org/thatopen">npm package</a>
11
+ </p>
12
+
13
+ ![cover](https://thatopen.github.io/engine_components/resources/cover.png)
14
+
15
+ <h1>Open BIM Components <img src="https://thatopen.github.io/engine_components/resources/favicon.ico" width="32"/></h1>
16
+
17
+ [![NPM Package][npm]][npm-url]
18
+ [![NPM Package][npm-downloads]][npm-url]
19
+
20
+ This library is a collection of BIM tools based on [Three.js](https://github.com/mrdoob/three.js/) and other libraries. It includes pre-made features to easily build browser-based 3D BIM applications, such as postproduction, dimensions, floorplan navigation, DXF export and much more.
21
+
22
+
23
+ ## 🤝 Want our help?
24
+ Are you developing a project with our technology and would like our help?
25
+ Apply now to join [That Open Accelerator Program](https://thatopen.com/accelerator)!
26
+
27
+
28
+ ## 🧩 Integration with fragments
29
+ As you might know, we have 4 open source libraries:
30
+ - [web-ifc](https://github.com/ThatOpen/engine_web-ifc): the IFC parser and geometry engine.
31
+ - [fragments](https://github.com/ThatOpen/engine_fragment): the open source format and 3D engine.
32
+ - [components](https://github.com/ThatOpen/engine_components): a set of tools to build BIM software fast.
33
+ - [ui components](https://github.com/ThatOpen/engine_ui-components): our agnostic UI system.
34
+
35
+ Components doesn't work with this new version of Fragments yet. In the next release, at the end of Q2, all components will be updated to work with this new version of Fragments. In the meantime, you have 3 options:
36
+
37
+ - Work with Fragments and build your own BIM components from scratch.
38
+ - Work with Components (which don't use this new version of Fragments).
39
+ - Check out our [Accelerator Program](https://thatopen.com/accelerator) to get previous access to the upcoming components.
40
+
41
+ Once the release at the end of Q2 is made, Components will work natively with this new version of Fragments.
42
+
43
+ ## Packages
44
+
45
+ This library contains 2 packages:
46
+
47
+ `@thatopen/components` - The core functionality. Compatible both with browser and Node.js environments.
48
+
49
+ `@thatopen/components-front` - Features exclusive for browser environments.
50
+
51
+ ## Usage
52
+
53
+ You need to be familiar with [Three.js API](https://github.com/mrdoob/three.js/) to be able to use this library effectively. In the following example, we will create a cube in a 3D scene that can be navigated with the mouse or touch events. You can see the full example [here](https://github.com/ThatOpen/engine_components/blob/main/packages/core/src/core/Worlds/example.ts) and the deployed app [here](https://thatopen.github.io/engine_components/examples/Worlds/index.html).
54
+
55
+ ```js
56
+ /* eslint import/no-extraneous-dependencies: 0 */
57
+
58
+ import * as THREE from "three";
59
+ import * as OBC from "../..";
60
+
61
+ const container = document.getElementById("container")!;
62
+
63
+ const components = new OBC.Components();
64
+
65
+ const worlds = components.get(OBC.Worlds);
66
+
67
+ const world = worlds.create<
68
+ OBC.SimpleScene,
69
+ OBC.SimpleCamera,
70
+ OBC.SimpleRenderer
71
+ >();
72
+
73
+ world.scene = new OBC.SimpleScene(components);
74
+ world.renderer = new OBC.SimpleRenderer(components, container);
75
+ world.camera = new OBC.SimpleCamera(components);
76
+
77
+ components.init();
78
+
79
+ const material = new THREE.MeshLambertMaterial({ color: "#6528D7" });
80
+ const geometry = new THREE.BoxGeometry();
81
+ const cube = new THREE.Mesh(geometry, material);
82
+ world.scene.three.add(cube);
83
+
84
+ world.scene.setup();
85
+
86
+ world.camera.controls.setLookAt(3, 3, 3, 0, 0, 0);
87
+ ```
88
+
89
+
90
+ [npm]: https://img.shields.io/npm/v/@thatopen/components
91
+ [npm-url]: https://www.npmjs.com/package/@thatopen/components
92
+ [npm-downloads]: https://img.shields.io/npm/dw/@thatopen/components
@@ -6,7 +6,7 @@ export declare class Components implements Disposable {
6
6
  /**
7
7
  * The version of the @thatopen/components library.
8
8
  */
9
- static readonly release = "2.4.4";
9
+ static readonly release = "2.4.6";
10
10
  /** {@link Disposable.onDisposed} */
11
11
  readonly onDisposed: Event<void>;
12
12
  /**
package/dist/index.cjs CHANGED
@@ -6312,7 +6312,7 @@ const _Components = class _Components {
6312
6312
  /**
6313
6313
  * The version of the @thatopen/components library.
6314
6314
  */
6315
- __publicField(_Components, "release", "2.4.4");
6315
+ __publicField(_Components, "release", "2.4.6");
6316
6316
  let Components = _Components;
6317
6317
  class SimpleWorld extends Base {
6318
6318
  constructor() {
@@ -12775,6 +12775,9 @@ class ProjectionManager {
12775
12775
  setupOrthoCamera(height, width) {
12776
12776
  this._component.controls.mouseButtons.wheel = CameraControls.ACTION.ZOOM;
12777
12777
  this._component.controls.mouseButtons.middle = CameraControls.ACTION.ZOOM;
12778
+ this._component.controls.touches.two = CameraControls.ACTION.TOUCH_ZOOM_TRUCK;
12779
+ this._component.controls.touches.three = CameraControls.ACTION.TOUCH_ZOOM_TRUCK;
12780
+ this._component.controls.dollySpeed = 5;
12778
12781
  const pCamera = this._component.threePersp;
12779
12782
  const oCamera = this._component.threeOrtho;
12780
12783
  oCamera.zoom = 1;
@@ -12801,6 +12804,9 @@ class ProjectionManager {
12801
12804
  pCamera.position.copy(oCamera.position);
12802
12805
  pCamera.quaternion.copy(oCamera.quaternion);
12803
12806
  this._component.controls.mouseButtons.wheel = CameraControls.ACTION.DOLLY;
12807
+ this._component.controls.touches.two = CameraControls.ACTION.TOUCH_DOLLY_TRUCK;
12808
+ this._component.controls.touches.three = CameraControls.ACTION.TOUCH_DOLLY_TRUCK;
12809
+ this._component.controls.dollySpeed = 5;
12804
12810
  if (this.matchOrthoDistanceEnabled) {
12805
12811
  this._component.controls.distance = this.getDistance();
12806
12812
  } else {
@@ -26753,7 +26759,7 @@ class MiniMap {
26753
26759
  this._camera.left = frustumSize * aspect / -2;
26754
26760
  this._camera.right = frustumSize * aspect / 2;
26755
26761
  this._camera.top = frustumSize / 2;
26756
- this._camera.bottom = -frustumSize / 2;
26762
+ this._camera.bottom = -1 / 2;
26757
26763
  this._camera.updateProjectionMatrix();
26758
26764
  this.onResize.trigger(size);
26759
26765
  }
@@ -27287,12 +27293,12 @@ const getParameterXML = (name, parameter) => {
27287
27293
  if (!parameter)
27288
27294
  return parameterXML;
27289
27295
  if (parameter.type === "simple") {
27290
- parameterXML = `<ids:simpleValue>${parameter.parameter}</ids:simpleValue>`;
27296
+ parameterXML = `<simpleValue>${parameter.parameter}</simpleValue>`;
27291
27297
  }
27292
27298
  if (parameter.type === "enumeration") {
27293
27299
  const value = parameter.parameter;
27294
27300
  parameterXML = `<xs:restriction base="xs:string">
27295
- ${value.map((v) => `<xs:enumeration value="${v}" />`).join("\r\n")}
27301
+ ${value.map((v) => `<xs:enumeration value="${v}" />`).join("\n")}
27296
27302
  </xs:restriction>`;
27297
27303
  }
27298
27304
  if (parameter.type === "pattern") {
@@ -27301,9 +27307,44 @@ const getParameterXML = (name, parameter) => {
27301
27307
  <xs:pattern value="${value}" />
27302
27308
  </xs:restriction>`;
27303
27309
  }
27304
- const xml = `<ids:${name[0].toLowerCase() + name.slice(1)}>
27310
+ if (parameter.type === "bounds") {
27311
+ const { min, minInclusive, max, maxInclusive } = parameter.parameter;
27312
+ let minTag = "";
27313
+ if (min !== void 0) {
27314
+ minTag = `<xs:min${minInclusive ? "Inclusive" : "Exclusive"} value="${min}">`;
27315
+ }
27316
+ let maxTag = "";
27317
+ if (max !== void 0) {
27318
+ maxTag = `<xs:max${maxInclusive ? "Inclusive" : "Exclusive"} value="${max}">`;
27319
+ }
27320
+ parameterXML = `<xs:restriction base="xs:double">
27321
+ ${minTag}
27322
+ ${maxTag}
27323
+ </xs:restriction>`;
27324
+ }
27325
+ if (parameter.type === "length") {
27326
+ const { length, min, max } = parameter.parameter;
27327
+ let lengthTag = "";
27328
+ if (length !== void 0 && min === void 0 && max === void 0) {
27329
+ lengthTag = `<xs:length value="${length}" />`;
27330
+ }
27331
+ let minTag = "";
27332
+ if (min !== void 0 && length === void 0) {
27333
+ minTag = `<xs:minLength value="${min}" />`;
27334
+ }
27335
+ let maxTag = "";
27336
+ if (max !== void 0 && length === void 0) {
27337
+ maxTag = `<xs:maxLength value="${max}" />`;
27338
+ }
27339
+ parameterXML = `<xs:restriction base="xs:string">
27340
+ ${lengthTag}
27341
+ ${minTag}
27342
+ ${maxTag}
27343
+ </xs:restriction>`;
27344
+ }
27345
+ const xml = `<${name[0].toLowerCase() + name.slice(1)}>
27305
27346
  ${parameterXML}
27306
- </ids:${name[0].toLowerCase() + name.slice(1)}>`;
27347
+ </${name[0].toLowerCase() + name.slice(1)}>`;
27307
27348
  return xml;
27308
27349
  };
27309
27350
  class IDSAttribute extends IDSFacet {
@@ -27322,10 +27363,10 @@ class IDSAttribute extends IDSFacet {
27322
27363
  attributes += `cardinality="${this.cardinality}"`;
27323
27364
  attributes += this.instructions ? `instructions="${this.instructions}"` : "";
27324
27365
  }
27325
- return `<ids:attribute ${attributes}>
27366
+ return `<attribute ${attributes}>
27326
27367
  ${nameXML}
27327
27368
  ${valueXML}
27328
- </ids:attribute>`;
27369
+ </attribute>`;
27329
27370
  }
27330
27371
  // This can be very ineficcient as we do not have an easy way to get an entity based on an attribute
27331
27372
  // Right now, all entities must be iterated.
@@ -27461,10 +27502,10 @@ class IDSClassification extends IDSFacet {
27461
27502
  attributes += this.uri ? `uri=${this.uri}` : "";
27462
27503
  attributes += this.instructions ? `instructions="${this.instructions}"` : "";
27463
27504
  }
27464
- return `<ids:classification ${attributes}>
27505
+ return `<classification ${attributes}>
27465
27506
  ${systemXML}
27466
27507
  ${valueXML}
27467
- </ids:classification>`;
27508
+ </classification>`;
27468
27509
  }
27469
27510
  async getEntities(model, collector = {}) {
27470
27511
  var _a;
@@ -27742,10 +27783,10 @@ class IDSEntity extends IDSFacet {
27742
27783
  attributes += `cardinality="${this.cardinality}"`;
27743
27784
  attributes += this.instructions ? `instructions="${this.instructions}"` : "";
27744
27785
  }
27745
- return `<ids:entity ${attributes}>
27786
+ return `<entity ${attributes}>
27746
27787
  ${nameXML}
27747
27788
  ${predefinedTypeXML}
27748
- </ids:entity>`;
27789
+ </entity>`;
27749
27790
  }
27750
27791
  // IFCSURFACESTYLEREFRACTION is not present in the FragmentsGroup
27751
27792
  // IFCSURFACESTYLERENDERING is not present in the FragmentsGroup
@@ -27883,11 +27924,11 @@ class IDSProperty extends IDSFacet {
27883
27924
  attributes += this.uri ? `uri=${this.uri}` : "";
27884
27925
  attributes += this.instructions ? `instructions="${this.instructions}"` : "";
27885
27926
  }
27886
- return `<ids:property ${dataTypeXML} ${attributes}>
27927
+ return `<property ${dataTypeXML} ${attributes}>
27887
27928
  ${propertySetXML}
27888
27929
  ${baseNameXML}
27889
27930
  ${valueXML}
27890
- </ids:property>`;
27931
+ </property>`;
27891
27932
  }
27892
27933
  async getEntities(model, collector = {}) {
27893
27934
  var _a, _b;
@@ -28306,14 +28347,14 @@ class IDSSpecification {
28306
28347
  const identifier = this.identifier ? `identifier="${this.identifier}"` : "";
28307
28348
  const description = this.description ? `description="${this.description}"` : "";
28308
28349
  const instructions = this.instructions ? `instructions="${this.instructions}"` : "";
28309
- const xml = `<ids:specification ifcVersion="${[...this.ifcVersion].join(" ")}" ${name} ${identifier} ${description} ${instructions}>
28310
- <ids:applicability minOccurs="1" maxOccurs="unbounded">
28311
- ${[...this.applicability].map((facet) => facet.serialize("applicability"))}
28312
- </ids:applicability>
28313
- <ids:requirements>
28314
- ${[...this.requirements].map((facet) => facet.serialize("requirement"))}
28315
- </ids:requirements>
28316
- </ids:specification>`;
28350
+ const xml = `<specification ifcVersion="${[...this.ifcVersion].join(" ")}" ${name} ${identifier} ${description} ${instructions}>
28351
+ <applicability minOccurs="1" maxOccurs="unbounded">
28352
+ ${[...this.applicability].map((facet) => facet.serialize("applicability")).join("\n")}
28353
+ </applicability>
28354
+ <requirements>
28355
+ ${[...this.requirements].map((facet) => facet.serialize("requirement")).join("\n")}
28356
+ </requirements>
28357
+ </specification>`;
28317
28358
  return xml;
28318
28359
  }
28319
28360
  }
@@ -28562,22 +28603,22 @@ const _IDSSpecifications = class _IDSSpecifications extends Component {
28562
28603
  */
28563
28604
  export(info, specifications = this.list.values()) {
28564
28605
  const _specifications = specifications ?? this.list;
28565
- const xml = `<ids:ids xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://standards.buildingsmart.org/IDS http://standards.buildingsmart.org/IDS/1.0/ids.xsd" xmlns:ids="http://standards.buildingsmart.org/IDS">
28606
+ const xml = `<ids xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://standards.buildingsmart.org/IDS http://standards.buildingsmart.org/IDS/1.0/ids.xsd" xmlns:ids="http://standards.buildingsmart.org/IDS">
28566
28607
  <!-- Made with That Open Engine ${Components.release} (https://github.com/thatopen/engine_components) -->
28567
- <ids:info>
28568
- <ids:title>${info.title}</ids:title>
28569
- ${info.copyright ? `<ids:copyright>${info.copyright}</ids:copyright>` : ""}
28570
- ${info.version ? `<ids:version>${info.version}</ids:version>` : ""}
28571
- ${info.description ? `<ids:description>${info.description}</ids:description>` : ""}
28572
- ${info.author ? `<ids:author>${info.author}</ids:author>` : ""}
28573
- ${info.date ? `<ids:date>${info.date.toISOString().split("T")[0]}</ids:date>` : ""}
28574
- ${info.purpose ? `<ids:purpose>${info.purpose}</ids:purpose>` : ""}
28575
- ${info.milestone ? `<ids:milestone>${info.milestone}</ids:milestone>` : ""}
28576
- </ids:info>
28577
- <ids:specifications>
28608
+ <info>
28609
+ <title>${info.title}</title>
28610
+ ${info.copyright ? `<copyright>${info.copyright}</copyright>` : ""}
28611
+ ${info.version ? `<version>${info.version}</version>` : ""}
28612
+ ${info.description ? `<description>${info.description}</description>` : ""}
28613
+ ${info.author ? `<author>${info.author}</author>` : ""}
28614
+ ${info.date ? `<date>${info.date.toISOString().split("T")[0]}</date>` : ""}
28615
+ ${info.purpose ? `<purpose>${info.purpose}</purpose>` : ""}
28616
+ ${info.milestone ? `<milestone>${info.milestone}</milestone>` : ""}
28617
+ </info>
28618
+ <specifications>
28578
28619
  ${[..._specifications].map((spec) => spec.serialize()).join("\n")}
28579
- </ids:specifications>
28580
- </ids:ids>`;
28620
+ </specifications>
28621
+ </ids>`;
28581
28622
  return xml;
28582
28623
  }
28583
28624
  };