@thatopen/components 3.2.0 → 3.2.2
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 +20 -10
- package/dist/index.d.ts +4 -1
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.mjs +1 -1
- package/dist/index.mjs +20 -10
- 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;
|
|
@@ -20982,6 +20982,7 @@ const _IDSSpecifications = class _IDSSpecifications extends Component {
|
|
|
20982
20982
|
constructor(components) {
|
|
20983
20983
|
super(components);
|
|
20984
20984
|
__publicField(this, "enabled", true);
|
|
20985
|
+
__publicField(this, "IDSInfo");
|
|
20985
20986
|
__publicField(this, "list", new DataMap());
|
|
20986
20987
|
components.add(_IDSSpecifications.uuid, this);
|
|
20987
20988
|
}
|
|
@@ -21034,10 +21035,11 @@ const _IDSSpecifications = class _IDSSpecifications extends Component {
|
|
|
21034
21035
|
*
|
|
21035
21036
|
* @returns An array of IDSSpecification instances created from the parsed data.
|
|
21036
21037
|
*/
|
|
21037
|
-
load(data) {
|
|
21038
|
+
load(data, config = { parseNumericString: true }) {
|
|
21038
21039
|
const result = [];
|
|
21039
21040
|
const ids = _IDSSpecifications.xmlParser.parse(data).ids;
|
|
21040
|
-
const { specifications } = ids;
|
|
21041
|
+
const { specifications, info } = ids;
|
|
21042
|
+
this.IDSInfo = { ...info };
|
|
21041
21043
|
if (specifications && specifications.specification) {
|
|
21042
21044
|
const specs = Array.isArray(specifications.specification) ? specifications.specification : [specifications.specification];
|
|
21043
21045
|
for (const spec of specs) {
|
|
@@ -21073,7 +21075,11 @@ const _IDSSpecifications = class _IDSSpecifications extends Component {
|
|
|
21073
21075
|
applicabilities.push(...facets2);
|
|
21074
21076
|
}
|
|
21075
21077
|
if (facetName === "property") {
|
|
21076
|
-
const facets2 = createPropertyFacets(
|
|
21078
|
+
const facets2 = createPropertyFacets(
|
|
21079
|
+
this.components,
|
|
21080
|
+
elements,
|
|
21081
|
+
config.parseNumericString
|
|
21082
|
+
);
|
|
21077
21083
|
applicabilities.push(...facets2);
|
|
21078
21084
|
}
|
|
21079
21085
|
if (facetName === "partOf") {
|
|
@@ -21111,7 +21117,11 @@ const _IDSSpecifications = class _IDSSpecifications extends Component {
|
|
|
21111
21117
|
reqs.push(...facets2);
|
|
21112
21118
|
}
|
|
21113
21119
|
if (facetName === "property") {
|
|
21114
|
-
const facets2 = createPropertyFacets(
|
|
21120
|
+
const facets2 = createPropertyFacets(
|
|
21121
|
+
this.components,
|
|
21122
|
+
elements,
|
|
21123
|
+
config.parseNumericString
|
|
21124
|
+
);
|
|
21115
21125
|
reqs.push(...facets2);
|
|
21116
21126
|
}
|
|
21117
21127
|
if (facetName === "partOf") {
|
package/dist/index.d.ts
CHANGED
|
@@ -2153,6 +2153,7 @@ export declare class IDSSpecifications extends Component {
|
|
|
2153
2153
|
static uuid: "9f0b9f78-9b2e-481a-b766-2fbfd01f342c";
|
|
2154
2154
|
enabled: boolean;
|
|
2155
2155
|
static xmlParser: XMLParser;
|
|
2156
|
+
IDSInfo?: IDSInfo;
|
|
2156
2157
|
constructor(components: Components);
|
|
2157
2158
|
readonly list: DataMap<string, IDSSpecification>;
|
|
2158
2159
|
/**
|
|
@@ -2185,7 +2186,9 @@ export declare class IDSSpecifications extends Component {
|
|
|
2185
2186
|
*
|
|
2186
2187
|
* @returns An array of IDSSpecification instances created from the parsed data.
|
|
2187
2188
|
*/
|
|
2188
|
-
load(data: string
|
|
2189
|
+
load(data: string, config?: {
|
|
2190
|
+
parseNumericString: boolean;
|
|
2191
|
+
}): IDSSpecification[];
|
|
2189
2192
|
/**
|
|
2190
2193
|
* Exports the IDSSpecifications data into an XML string.
|
|
2191
2194
|
*
|