@thatopen/components 3.2.0 → 3.2.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 +76 -76
- package/dist/index.cjs +17 -9
- package/dist/index.d.ts +3 -1
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.mjs +1 -1
- package/dist/index.mjs +17 -9
- package/package.json +59 -59
package/README.md
CHANGED
|
@@ -1,76 +1,76 @@
|
|
|
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
|
-

|
|
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
|
-
## Packages
|
|
28
|
-
|
|
29
|
-
This library contains 2 packages:
|
|
30
|
-
|
|
31
|
-
`@thatopen/components` - The core functionality. Compatible both with browser and Node.js environments.
|
|
32
|
-
|
|
33
|
-
`@thatopen/components-front` - Features exclusive for browser environments.
|
|
34
|
-
|
|
35
|
-
## Usage
|
|
36
|
-
|
|
37
|
-
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).
|
|
38
|
-
|
|
39
|
-
```js
|
|
40
|
-
/* eslint import/no-extraneous-dependencies: 0 */
|
|
41
|
-
|
|
42
|
-
import * as THREE from "three";
|
|
43
|
-
import * as OBC from "../..";
|
|
44
|
-
|
|
45
|
-
const container = document.getElementById("container")!;
|
|
46
|
-
|
|
47
|
-
const components = new OBC.Components();
|
|
48
|
-
|
|
49
|
-
const worlds = components.get(OBC.Worlds);
|
|
50
|
-
|
|
51
|
-
const world = worlds.create<
|
|
52
|
-
OBC.SimpleScene,
|
|
53
|
-
OBC.SimpleCamera,
|
|
54
|
-
OBC.SimpleRenderer
|
|
55
|
-
>();
|
|
56
|
-
|
|
57
|
-
world.scene = new OBC.SimpleScene(components);
|
|
58
|
-
world.renderer = new OBC.SimpleRenderer(components, container);
|
|
59
|
-
world.camera = new OBC.SimpleCamera(components);
|
|
60
|
-
|
|
61
|
-
components.init();
|
|
62
|
-
|
|
63
|
-
const material = new THREE.MeshLambertMaterial({ color: "#6528D7" });
|
|
64
|
-
const geometry = new THREE.BoxGeometry();
|
|
65
|
-
const cube = new THREE.Mesh(geometry, material);
|
|
66
|
-
world.scene.three.add(cube);
|
|
67
|
-
|
|
68
|
-
world.scene.setup();
|
|
69
|
-
|
|
70
|
-
world.camera.controls.setLookAt(3, 3, 3, 0, 0, 0);
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
[npm]: https://img.shields.io/npm/v/@thatopen/components
|
|
75
|
-
[npm-url]: https://www.npmjs.com/package/@thatopen/components
|
|
76
|
-
[npm-downloads]: https://img.shields.io/npm/dw/@thatopen/components
|
|
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
|
+

|
|
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
|
+
## Packages
|
|
28
|
+
|
|
29
|
+
This library contains 2 packages:
|
|
30
|
+
|
|
31
|
+
`@thatopen/components` - The core functionality. Compatible both with browser and Node.js environments.
|
|
32
|
+
|
|
33
|
+
`@thatopen/components-front` - Features exclusive for browser environments.
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
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).
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
/* eslint import/no-extraneous-dependencies: 0 */
|
|
41
|
+
|
|
42
|
+
import * as THREE from "three";
|
|
43
|
+
import * as OBC from "../..";
|
|
44
|
+
|
|
45
|
+
const container = document.getElementById("container")!;
|
|
46
|
+
|
|
47
|
+
const components = new OBC.Components();
|
|
48
|
+
|
|
49
|
+
const worlds = components.get(OBC.Worlds);
|
|
50
|
+
|
|
51
|
+
const world = worlds.create<
|
|
52
|
+
OBC.SimpleScene,
|
|
53
|
+
OBC.SimpleCamera,
|
|
54
|
+
OBC.SimpleRenderer
|
|
55
|
+
>();
|
|
56
|
+
|
|
57
|
+
world.scene = new OBC.SimpleScene(components);
|
|
58
|
+
world.renderer = new OBC.SimpleRenderer(components, container);
|
|
59
|
+
world.camera = new OBC.SimpleCamera(components);
|
|
60
|
+
|
|
61
|
+
components.init();
|
|
62
|
+
|
|
63
|
+
const material = new THREE.MeshLambertMaterial({ color: "#6528D7" });
|
|
64
|
+
const geometry = new THREE.BoxGeometry();
|
|
65
|
+
const cube = new THREE.Mesh(geometry, material);
|
|
66
|
+
world.scene.three.add(cube);
|
|
67
|
+
|
|
68
|
+
world.scene.setup();
|
|
69
|
+
|
|
70
|
+
world.camera.controls.setLookAt(3, 3, 3, 0, 0, 0);
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
[npm]: https://img.shields.io/npm/v/@thatopen/components
|
|
75
|
+
[npm-url]: https://www.npmjs.com/package/@thatopen/components
|
|
76
|
+
[npm-downloads]: https://img.shields.io/npm/dw/@thatopen/components
|
package/dist/index.cjs
CHANGED
|
@@ -20800,7 +20800,7 @@ class IDSSpecification {
|
|
|
20800
20800
|
return xml;
|
|
20801
20801
|
}
|
|
20802
20802
|
}
|
|
20803
|
-
const getParameterValue = (property) => {
|
|
20803
|
+
const getParameterValue = (property, parseNumericString = true) => {
|
|
20804
20804
|
if (!property)
|
|
20805
20805
|
return void 0;
|
|
20806
20806
|
const result = {};
|
|
@@ -20818,7 +20818,7 @@ const getParameterValue = (property) => {
|
|
|
20818
20818
|
if ("enumeration" in restriction) {
|
|
20819
20819
|
result.type = "enumeration";
|
|
20820
20820
|
const enumeration = restriction.enumeration.map(
|
|
20821
|
-
({ value }) => value
|
|
20821
|
+
({ value }) => parseNumericString ? value : String(value)
|
|
20822
20822
|
);
|
|
20823
20823
|
result.parameter = enumeration;
|
|
20824
20824
|
}
|
|
@@ -20912,19 +20912,19 @@ const createMaterialFacets = (components, elements) => {
|
|
|
20912
20912
|
}
|
|
20913
20913
|
return facets;
|
|
20914
20914
|
};
|
|
20915
|
-
const createPropertyFacets = (components, elements) => {
|
|
20915
|
+
const createPropertyFacets = (components, elements, parseNumericString) => {
|
|
20916
20916
|
const facets = [];
|
|
20917
20917
|
for (const element of elements) {
|
|
20918
20918
|
const psetParameter = element.propertySet;
|
|
20919
20919
|
const baseNameParameter = element.baseName;
|
|
20920
|
-
const pset = getParameterValue(psetParameter);
|
|
20921
|
-
const baseName = getParameterValue(baseNameParameter);
|
|
20920
|
+
const pset = getParameterValue(psetParameter, parseNumericString);
|
|
20921
|
+
const baseName = getParameterValue(baseNameParameter, parseNumericString);
|
|
20922
20922
|
if (!(baseName && pset))
|
|
20923
20923
|
continue;
|
|
20924
20924
|
const facet = new IDSProperty(components, pset, baseName);
|
|
20925
20925
|
if (element.cardinality)
|
|
20926
20926
|
facet.cardinality = element.cardinality;
|
|
20927
|
-
const value = getParameterValue(element.value);
|
|
20927
|
+
const value = getParameterValue(element.value, parseNumericString);
|
|
20928
20928
|
facet.value = value;
|
|
20929
20929
|
facet.dataType = element.dataType;
|
|
20930
20930
|
facet.uri = element.uri;
|
|
@@ -21034,7 +21034,7 @@ const _IDSSpecifications = class _IDSSpecifications extends Component {
|
|
|
21034
21034
|
*
|
|
21035
21035
|
* @returns An array of IDSSpecification instances created from the parsed data.
|
|
21036
21036
|
*/
|
|
21037
|
-
load(data) {
|
|
21037
|
+
load(data, config = { parseNumericString: true }) {
|
|
21038
21038
|
const result = [];
|
|
21039
21039
|
const ids = _IDSSpecifications.xmlParser.parse(data).ids;
|
|
21040
21040
|
const { specifications } = ids;
|
|
@@ -21073,7 +21073,11 @@ const _IDSSpecifications = class _IDSSpecifications extends Component {
|
|
|
21073
21073
|
applicabilities.push(...facets2);
|
|
21074
21074
|
}
|
|
21075
21075
|
if (facetName === "property") {
|
|
21076
|
-
const facets2 = createPropertyFacets(
|
|
21076
|
+
const facets2 = createPropertyFacets(
|
|
21077
|
+
this.components,
|
|
21078
|
+
elements,
|
|
21079
|
+
config.parseNumericString
|
|
21080
|
+
);
|
|
21077
21081
|
applicabilities.push(...facets2);
|
|
21078
21082
|
}
|
|
21079
21083
|
if (facetName === "partOf") {
|
|
@@ -21111,7 +21115,11 @@ const _IDSSpecifications = class _IDSSpecifications extends Component {
|
|
|
21111
21115
|
reqs.push(...facets2);
|
|
21112
21116
|
}
|
|
21113
21117
|
if (facetName === "property") {
|
|
21114
|
-
const facets2 = createPropertyFacets(
|
|
21118
|
+
const facets2 = createPropertyFacets(
|
|
21119
|
+
this.components,
|
|
21120
|
+
elements,
|
|
21121
|
+
config.parseNumericString
|
|
21122
|
+
);
|
|
21115
21123
|
reqs.push(...facets2);
|
|
21116
21124
|
}
|
|
21117
21125
|
if (facetName === "partOf") {
|
package/dist/index.d.ts
CHANGED
|
@@ -2185,7 +2185,9 @@ export declare class IDSSpecifications extends Component {
|
|
|
2185
2185
|
*
|
|
2186
2186
|
* @returns An array of IDSSpecification instances created from the parsed data.
|
|
2187
2187
|
*/
|
|
2188
|
-
load(data: string
|
|
2188
|
+
load(data: string, config?: {
|
|
2189
|
+
parseNumericString: boolean;
|
|
2190
|
+
}): IDSSpecification[];
|
|
2189
2191
|
/**
|
|
2190
2192
|
* Exports the IDSSpecifications data into an XML string.
|
|
2191
2193
|
*
|