@thatopen/components 3.2.4 → 3.2.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/dist/index.cjs CHANGED
@@ -3559,8 +3559,8 @@ const _IfcLoader = class _IfcLoader extends Component {
3559
3559
  * Loads an IFC file and processes it for 3D visualization.
3560
3560
  *
3561
3561
  * @param data - The Uint8Array containing the IFC file data.
3562
- * @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
3563
- * @param name - Optional name for the fragments model.
3562
+ * @param coordinate - Boolean indicating whether to coordinate the loaded IFC data. Default is true.
3563
+ * @param name - Name for the fragments model.
3564
3564
  * @param config - Optional extra data for loading the IFC.
3565
3565
  *
3566
3566
  * @returns A Promise that resolves to the FragmentsModel containing the loaded and processed IFC data.
@@ -4655,24 +4655,19 @@ class SimpleRaycaster {
4655
4655
  }
4656
4656
  return fragResult;
4657
4657
  }
4658
- // /**
4659
- // * Casts a ray from a given origin in a given direction and returns the first item found.
4660
- // * This method also takes into account the clipping planes used by the renderer.
4661
- // *
4662
- // * @param origin - The origin of the ray.
4663
- // * @param direction - The direction of the ray.
4664
- // * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
4665
- // * @returns The first intersection found or `null` if no intersection was found.
4666
- // */
4667
- // castRayFromVector(
4668
- // origin: THREE.Vector3,
4669
- // direction: THREE.Vector3,
4670
- // items = Array.from(this.world.meshes),
4671
- // ) {
4672
- // // TODO: Implement for fragmentsmodel
4673
- // this.three.set(origin, direction);
4674
- // return this.intersect(items);
4675
- // }
4658
+ /**
4659
+ * Casts a ray from a given origin in a given direction and returns the first item found.
4660
+ * This method also takes into account the clipping planes used by the renderer.
4661
+ *
4662
+ * @param origin - The origin of the ray.
4663
+ * @param direction - The direction of the ray.
4664
+ * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
4665
+ * @returns The first intersection found or `null` if no intersection was found.
4666
+ */
4667
+ castRayFromVector(origin, direction, items = Array.from(this.world.meshes)) {
4668
+ this.three.set(origin, direction);
4669
+ return this.intersect(items);
4670
+ }
4676
4671
  intersect(items = Array.from(this.world.meshes)) {
4677
4672
  const result = this.three.intersectObjects(items);
4678
4673
  const filtered = this.filterClippingPlanes(result);
@@ -17648,6 +17643,7 @@ const _Clipper = class _Clipper extends Component {
17648
17643
  plane.world.renderer.setPlane(false, plane.three);
17649
17644
  plane.dispose();
17650
17645
  this.updateMaterialsAndPlanes();
17646
+ this.onAfterDelete.trigger(plane);
17651
17647
  });
17652
17648
  }
17653
17649
  /** {@link Disposable.dispose} */
@@ -20826,7 +20822,7 @@ class IDSSpecification {
20826
20822
  return xml;
20827
20823
  }
20828
20824
  }
20829
- const getParameterValue = (property, parseNumericString = true) => {
20825
+ const getParameterValue = (property) => {
20830
20826
  if (!property)
20831
20827
  return void 0;
20832
20828
  const result = {};
@@ -20844,7 +20840,13 @@ const getParameterValue = (property, parseNumericString = true) => {
20844
20840
  if ("enumeration" in restriction) {
20845
20841
  result.type = "enumeration";
20846
20842
  const enumeration = restriction.enumeration.map(
20847
- ({ value }) => parseNumericString ? value : String(value)
20843
+ ({ value }) => {
20844
+ if (restriction.base.includes("string"))
20845
+ return String(value);
20846
+ if (restriction.base.includes("integer") || restriction.base.includes("double"))
20847
+ return Number(value);
20848
+ return value;
20849
+ }
20848
20850
  );
20849
20851
  result.parameter = enumeration;
20850
20852
  }
@@ -20938,19 +20940,19 @@ const createMaterialFacets = (components, elements) => {
20938
20940
  }
20939
20941
  return facets;
20940
20942
  };
20941
- const createPropertyFacets = (components, elements, parseNumericString) => {
20943
+ const createPropertyFacets = (components, elements) => {
20942
20944
  const facets = [];
20943
20945
  for (const element of elements) {
20944
20946
  const psetParameter = element.propertySet;
20945
20947
  const baseNameParameter = element.baseName;
20946
- const pset = getParameterValue(psetParameter, parseNumericString);
20947
- const baseName = getParameterValue(baseNameParameter, parseNumericString);
20948
+ const pset = getParameterValue(psetParameter);
20949
+ const baseName = getParameterValue(baseNameParameter);
20948
20950
  if (!(baseName && pset))
20949
20951
  continue;
20950
20952
  const facet = new IDSProperty(components, pset, baseName);
20951
20953
  if (element.cardinality)
20952
20954
  facet.cardinality = element.cardinality;
20953
- const value = getParameterValue(element.value, parseNumericString);
20955
+ const value = getParameterValue(element.value);
20954
20956
  facet.value = value;
20955
20957
  facet.dataType = element.dataType;
20956
20958
  facet.uri = element.uri;
@@ -21061,7 +21063,7 @@ const _IDSSpecifications = class _IDSSpecifications extends Component {
21061
21063
  *
21062
21064
  * @returns An array of IDSSpecification instances created from the parsed data.
21063
21065
  */
21064
- load(data, config = { parseNumericString: true }) {
21066
+ load(data) {
21065
21067
  const result = [];
21066
21068
  const ids = _IDSSpecifications.xmlParser.parse(data).ids;
21067
21069
  const { specifications, info } = ids;
@@ -21101,11 +21103,7 @@ const _IDSSpecifications = class _IDSSpecifications extends Component {
21101
21103
  applicabilities.push(...facets2);
21102
21104
  }
21103
21105
  if (facetName === "property") {
21104
- const facets2 = createPropertyFacets(
21105
- this.components,
21106
- elements,
21107
- config.parseNumericString
21108
- );
21106
+ const facets2 = createPropertyFacets(this.components, elements);
21109
21107
  applicabilities.push(...facets2);
21110
21108
  }
21111
21109
  if (facetName === "partOf") {
@@ -21143,11 +21141,7 @@ const _IDSSpecifications = class _IDSSpecifications extends Component {
21143
21141
  reqs.push(...facets2);
21144
21142
  }
21145
21143
  if (facetName === "property") {
21146
- const facets2 = createPropertyFacets(
21147
- this.components,
21148
- elements,
21149
- config.parseNumericString
21150
- );
21144
+ const facets2 = createPropertyFacets(this.components, elements);
21151
21145
  reqs.push(...facets2);
21152
21146
  }
21153
21147
  if (facetName === "partOf") {
package/dist/index.d.ts CHANGED
@@ -2186,9 +2186,7 @@ export declare class IDSSpecifications extends Component {
2186
2186
  *
2187
2187
  * @returns An array of IDSSpecification instances created from the parsed data.
2188
2188
  */
2189
- load(data: string, config?: {
2190
- parseNumericString: boolean;
2191
- }): IDSSpecification[];
2189
+ load(data: string): IDSSpecification[];
2192
2190
  /**
2193
2191
  * Exports the IDSSpecifications data into an XML string.
2194
2192
  *
@@ -2289,8 +2287,8 @@ export declare class IfcLoader extends Component implements Disposable_2 {
2289
2287
  * Loads an IFC file and processes it for 3D visualization.
2290
2288
  *
2291
2289
  * @param data - The Uint8Array containing the IFC file data.
2292
- * @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
2293
- * @param name - Optional name for the fragments model.
2290
+ * @param coordinate - Boolean indicating whether to coordinate the loaded IFC data. Default is true.
2291
+ * @param name - Name for the fragments model.
2294
2292
  * @param config - Optional extra data for loading the IFC.
2295
2293
  *
2296
2294
  * @returns A Promise that resolves to the FragmentsModel containing the loaded and processed IFC data.
@@ -3350,6 +3348,16 @@ export declare class SimpleRaycaster implements Disposable_2 {
3350
3348
  items?: THREE.Object3D[];
3351
3349
  position?: THREE.Vector2;
3352
3350
  }): Promise<THREE.Intersection | null>;
3351
+ /**
3352
+ * Casts a ray from a given origin in a given direction and returns the first item found.
3353
+ * This method also takes into account the clipping planes used by the renderer.
3354
+ *
3355
+ * @param origin - The origin of the ray.
3356
+ * @param direction - The direction of the ray.
3357
+ * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
3358
+ * @returns The first intersection found or `null` if no intersection was found.
3359
+ */
3360
+ castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | null;
3353
3361
  private intersect;
3354
3362
  private filterClippingPlanes;
3355
3363
  }