LuciadFusion can handle IFC data as two separate services:

  1. An OGC3DTILES service containing the geometry

  2. A WFS service containing the feature information

This tutorial shows you how to visualize and handle these services in LuciadRIA.

See the LuciadFusion documentation for information about setting up the two services.

Visualizing the IFC geometry information

The geometry is served as an OGC3DTILES service. You must load it as such:

  1. Find the endpoint URL of the service.

  2. Create an OGC3DTilesModel.

  3. Create an Tileset3DLayer.

    • You must specify the idProperty, because we need that property to handle selection. See Program: Register a selection listener.

    • You can pass other options to the layer constructor. See the TileSet3DLayer documentation for more information.

  4. Add the layer to the map.

Program: Creating a TileSet3DLayer
const tilesetUrl = "https://fusionurl/ogc/3dtiles/dataset/tileset.json";
const model: OGC3DTilesModel = await OGC3DTilesModel.create(tilesetUrl);
const ogc3dTilesLayer = new TileSet3DLayer(model, {
  idProperty: "FeatureID",
  selectable: true
});
map.layerTree.addChild(ogc3dTilesLayer);

You can register a selection handler with the Map to detect when a user clicks in the view, and find the FeatureID of the object clicked by the user.

Program: Register a selection listener
map.on("SelectionChanged", () => {
  const selectedObjects = map.selectedObjects;
  if (selectedObjects.length === 1 && selectedObjects[0].selected.length === 1) {
    const feature = selectedObjects[0].selected[0] as Feature;
    const featureID = feature.properties["FeatureID"];
  }
});

Visualizing the IFC feature information

The feature information is served as a WFS service. You can query it using a WFSFeatureStore object. To create such an object, follow these steps:

  1. Find the endpoint URL of the service.

  2. Create a WFSCapabilities object.

  3. Find the feature type name. Program: Create a WFSFeatureStore assumes that there is only one feature type.

  4. Create the feature store.

Program: Create a WFSFeatureStore
const featuresUrl = "https://fusionurl/ogc/wfs/dataset_features";
const wfsCapabilities = await WFSCapabilities.fromURL(featuresUrl);
const typeName = wfsCapabilities.featureTypes[0].name;
const featureStore = WFSFeatureStore.createFromCapabilities(wfsCapabilities, typeName, {outputFormat: "json"});

You can use the WFSFeatureStore to perform queries on the WFS service. We highlight two use cases as examples: Requesting all FeatureIDs of the dataset and Requesting all information of a given FeatureID.

For more information about writing queries for a WFS service, see the WFSFeatureStore.query() documentation.

Requesting all FeatureIDs of the dataset

Program: Request all FeatureIDs of the dataset
const cursor: Cursor = await Promise.resolve(featureStore.query({propertyNames: ["FeatureID"]}));
while (cursor.hasNext()) {
  const feature: Feature = cursor.next();
  const featureProps = feature.properties;
  const featureId = featureProps.FeatureID;
  // ... other properties will have null values
}

Requesting all information of a given FeatureID

Program: Request all information of a given FeatureID
const cursor: Cursor = await Promise.resolve(featureStore.query({filter: identifiers([featureID])}));
while (cursor.hasNext()) {
  const feature: Feature = cursor.next();
  const featureProps = feature.properties;
  // ...
}

Apart from the feature data that was present in the IFC file, the returned data also contains the bounding box of the requested feature. This snippet illustrates how to use that in your LuciadRIA application to fit the view to a given feature.

Program: Fit the view to a feature
const shape: Shape = createExtrudedShape(
    feature.geometry.reference,
    feature.geometry,
    feature.properties.MinZ,
    feature.properties.MaxZ);
map.mapNavigator.fit({bounds: shape.bounds!, animate: true});

Note that you can’t use the feature.geometry directly: because the GeoJSON geometry only contains 2D data, you must re-construct the 3D bounding box using the feature’s MinZ and MaxZ properties.