Decode ifc strings.
This commit is contained in:
parent
482caec6a0
commit
626591698a
17
source/external/ifcimporter.js
vendored
17
source/external/ifcimporter.js
vendored
@ -140,18 +140,19 @@ OV.ImporterIfc = class extends OV.ImporterBase
|
|||||||
let propertyGroup = new OV.PropertyGroup (propSet.Name.value);
|
let propertyGroup = new OV.PropertyGroup (propSet.Name.value);
|
||||||
propSet.HasProperties.forEach (function (property) {
|
propSet.HasProperties.forEach (function (property) {
|
||||||
let meshProperty = null;
|
let meshProperty = null;
|
||||||
|
let propertyName = obj.DecodeIFCString (property.Name.value);
|
||||||
switch (property.NominalValue.label) {
|
switch (property.NominalValue.label) {
|
||||||
case 'IFCTEXT':
|
case 'IFCTEXT':
|
||||||
case 'IFCLABEL':
|
case 'IFCLABEL':
|
||||||
case 'IFCIDENTIFIER':
|
case 'IFCIDENTIFIER':
|
||||||
meshProperty = new OV.Property (OV.PropertyType.Text, property.Name.value, property.NominalValue.value);
|
meshProperty = new OV.Property (OV.PropertyType.Text, propertyName, obj.DecodeIFCString (property.NominalValue.value));
|
||||||
break;
|
break;
|
||||||
case 'IFCBOOLEAN':
|
case 'IFCBOOLEAN':
|
||||||
meshProperty = new OV.Property (OV.PropertyType.Boolean, property.Name.value, property.NominalValue.value === 'T' ? true : false);
|
meshProperty = new OV.Property (OV.PropertyType.Boolean, propertyName, property.NominalValue.value === 'T' ? true : false);
|
||||||
break;
|
break;
|
||||||
case 'IFCINTEGER':
|
case 'IFCINTEGER':
|
||||||
case 'IFCCOUNTMEASURE':
|
case 'IFCCOUNTMEASURE':
|
||||||
meshProperty = new OV.Property (OV.PropertyType.Integer, property.Name.value, property.NominalValue.value);
|
meshProperty = new OV.Property (OV.PropertyType.Integer, propertyName, property.NominalValue.value);
|
||||||
break;
|
break;
|
||||||
case 'IFCREAL':
|
case 'IFCREAL':
|
||||||
case 'IFCLENGTHMEASURE':
|
case 'IFCLENGTHMEASURE':
|
||||||
@ -164,7 +165,7 @@ OV.ImporterIfc = class extends OV.ImporterBase
|
|||||||
case 'IFCMASSPERLENGTHMEASURE':
|
case 'IFCMASSPERLENGTHMEASURE':
|
||||||
case 'IFCPLANEANGLEMEASURE':
|
case 'IFCPLANEANGLEMEASURE':
|
||||||
case 'IFCTHERMALTRANSMITTANCEMEASURE':
|
case 'IFCTHERMALTRANSMITTANCEMEASURE':
|
||||||
meshProperty = new OV.Property (OV.PropertyType.Number, property.Name.value, property.NominalValue.value);
|
meshProperty = new OV.Property (OV.PropertyType.Number, propertyName, property.NominalValue.value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// TODO
|
// TODO
|
||||||
@ -208,4 +209,12 @@ OV.ImporterIfc = class extends OV.ImporterBase
|
|||||||
}
|
}
|
||||||
return materialIndex;
|
return materialIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DecodeIFCString (ifcString)
|
||||||
|
{
|
||||||
|
// TODO: https://github.com/tomvandig/web-ifc/issues/58
|
||||||
|
let ifcUnicodeRegEx = /\\X2\\(.*?)\\X0\\/uig;
|
||||||
|
let escapedUnicode = ifcString.replace (ifcUnicodeRegEx, '\\u$1');
|
||||||
|
return decodeURIComponent (JSON.parse ('"' + escapedUnicode + '"'));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user