Skip to content
This repository has been archived by the owner on Jul 31, 2022. It is now read-only.

Commit

Permalink
Support property sets in XKT and metadata #31
Browse files Browse the repository at this point in the history
  • Loading branch information
xeolabs committed Aug 19, 2021
1 parent 5e43f63 commit fc9928a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions specs/xkt_v9_metadata.schema.json
Git LFS file not shown
14 changes: 7 additions & 7 deletions src/XKTModel/XKTMetaObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ class XKTMetaObject {
/**
* @private
* @param metaObjectId
* @param propertySetId
* @param propertySetIds
* @param metaObjectType
* @param metaObjectName
* @param parentMetaObjectId
*/
constructor(metaObjectId, propertySetId, metaObjectType, metaObjectName, parentMetaObjectId) {
constructor(metaObjectId, propertySetIds, metaObjectType, metaObjectName, parentMetaObjectId) {

/**
* Unique ID of this ````XKTMetaObject```` in {@link XKTModel#metaObjects}.
Expand All @@ -42,13 +42,13 @@ class XKTMetaObject {
this.metaObjectId = metaObjectId;

/**
* Unique ID of a property set that contains additional metadata about this
* {@link XKTMetaObject}. The property can be stored in an external system, or
* within the {@link XKTModel}, as a {@link XKTPropertySet} within {@link XKTModel#propertySets}.
* Unique ID of one or more property sets that contains additional metadata about this
* {@link XKTMetaObject}. The property sets can be stored in an external system, or
* within the {@link XKTModel}, as {@link XKTPropertySet}s within {@link XKTModel#propertySets}.
*
* @type {String}
* @type {String[]}
*/
this.propertySetId = propertySetId;
this.propertySetIds = propertySetIds;

/**
* Indicates the XKTMetaObject meta object type.
Expand Down
10 changes: 5 additions & 5 deletions src/XKTModel/XKTModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,9 @@ class XKTModel {
*
* @param {*} params Method parameters.
* @param {String} params.metaObjectId Unique ID for the {@link XKTMetaObject}.
* @param {String} params.propertySetId ID of a property set that contains additional metadata about
* this {@link XKTMetaObject}. The property set could be stored externally (ie not managed at all by the XKT file),
* or could be a {@link XKTPropertySet} within {@link XKTModel#propertySets}.
* @param {String} params.propertySetIds ID of one or more property sets that contains additional metadata about
* this {@link XKTMetaObject}. The property sets could be stored externally (ie not managed at all by the XKT file),
* or could be {@link XKTPropertySet}s within {@link XKTModel#propertySets}.
* @param {String} [params.metaObjectType="default"] A meta type for the {@link XKTMetaObject}. Can be anything,
* but is usually an IFC type, such as "IfcSite" or "IfcWall".
* @param {String} [params.metaObjectName] Human-readable name for the {@link XKTMetaObject}. Defaults to the ````metaObjectId```` parameter.
Expand Down Expand Up @@ -348,12 +348,12 @@ class XKTModel {
}

const metaObjectId = params.metaObjectId;
const propertySetId = params.propertySetId;
const propertySetIds = params.propertySetIds;
const metaObjectType = params.metaObjectType || "Default";
const metaObjectName = params.metaObjectName || params.metaObjectId;
const parentMetaObjectId = params.parentMetaObjectId;

const metaObject = new XKTMetaObject(metaObjectId, propertySetId, metaObjectType, metaObjectName, parentMetaObjectId);
const metaObject = new XKTMetaObject(metaObjectId, propertySetIds, metaObjectType, metaObjectName, parentMetaObjectId);

this.metaObjects[metaObjectId] = metaObject;
this.metaObjectsList.push(metaObject);
Expand Down
8 changes: 4 additions & 4 deletions src/XKTModel/writeXKTModelToArrayBuffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function getModelData(xktModel) {

data.metadata.propertySets.push(propertySetJSON);
}

for (let metaObjectsIndex = 0; metaObjectsIndex < numMetaObjects; metaObjectsIndex++) {

const metaObject = metaObjectsList[metaObjectsIndex];
Expand All @@ -181,14 +181,14 @@ function getModelData(xktModel) {
metaObjectJSON.parent = "" + metaObject.parentMetaObjectId;
}

if (metaObject.propertySetId !== undefined && metaObject.propertySetId !== null && metaObject.propertySetId !== "") {
metaObjectJSON.propertySetId = "" + metaObject.propertySetId;
if (metaObject.propertySetIds && metaObject.propertySetIds.length > 0) {
metaObjectJSON.propertySetIds = metaObject.propertySetIds;
}

data.metadata.metaObjects.push(metaObjectJSON);
}

// console.log(JSON.stringify(data.metadata, null, "\t"))
// console.log(JSON.stringify(data.metadata, null, "\t"))

// Geometries

Expand Down

0 comments on commit fc9928a

Please sign in to comment.