- Ifc: support reading IfcComplexProperty
parent
0155a5ade1
commit
2ad24f7940
|
@ -585,31 +585,29 @@ void ProcessProductRepresentation(const IfcProduct& el, aiNode* nd, std::vector<
|
|||
}
|
||||
|
||||
typedef std::map<std::string, std::string> Metadata;
|
||||
void ProcessMetadata(uint64_t relDefinesByPropertiesID, ConversionData& conv, Metadata& properties);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void ProcessMetadata(uint64_t relDefinesByPropertiesID, ConversionData& conv, Metadata& properties)
|
||||
void ProcessMetadata(const ListOf< Lazy< IfcProperty >, 1, 0 >& set, ConversionData& conv, Metadata& properties, const std::string& prefix = "")
|
||||
{
|
||||
if (const IfcRelDefinesByProperties* const pset = conv.db.GetObject(relDefinesByPropertiesID)->ToPtr<IfcRelDefinesByProperties>()) {
|
||||
if (const IfcPropertySet* const set = conv.db.GetObject(pset->RelatingPropertyDefinition->GetID())->ToPtr<IfcPropertySet>()) {
|
||||
BOOST_FOREACH(const IfcProperty& property, set->HasProperties) {
|
||||
BOOST_FOREACH(const IfcProperty& property, set) {
|
||||
const std::string& key = prefix.length() > 0 ? (prefix + "." + property.Name) : property.Name;
|
||||
if (const IfcPropertySingleValue* const singleValue = property.ToPtr<IfcPropertySingleValue>()) {
|
||||
if (singleValue->NominalValue) {
|
||||
if (const EXPRESS::STRING* str = singleValue->NominalValue.Get()->ToPtr<EXPRESS::STRING>()) {
|
||||
std::string value = static_cast<std::string>(*str);
|
||||
properties[property.Name]=value;
|
||||
properties[key]=value;
|
||||
}
|
||||
else if (const EXPRESS::REAL* val = singleValue->NominalValue.Get()->ToPtr<EXPRESS::REAL>()) {
|
||||
float value = static_cast<float>(*val);
|
||||
std::stringstream s;
|
||||
s << value;
|
||||
properties[property.Name]=s.str();
|
||||
properties[key]=s.str();
|
||||
}
|
||||
else if (const EXPRESS::INTEGER* val = singleValue->NominalValue.Get()->ToPtr<EXPRESS::INTEGER>()) {
|
||||
int64_t value = static_cast<int64_t>(*val);
|
||||
std::stringstream s;
|
||||
s << value;
|
||||
properties[property.Name]=s.str();
|
||||
properties[key]=s.str();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -637,13 +635,25 @@ void ProcessMetadata(uint64_t relDefinesByPropertiesID, ConversionData& conv, Me
|
|||
index++;
|
||||
}
|
||||
ss << "]";
|
||||
properties[property.Name]=ss.str();
|
||||
properties[key]=ss.str();
|
||||
}
|
||||
else if (const IfcComplexProperty* const complexProp = property.ToPtr<IfcComplexProperty>()) {
|
||||
ProcessMetadata(complexProp->HasProperties, conv, properties, property.Name);
|
||||
}
|
||||
else {
|
||||
properties[property.Name]="";
|
||||
properties[key]="";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void ProcessMetadata(uint64_t relDefinesByPropertiesID, ConversionData& conv, Metadata& properties)
|
||||
{
|
||||
if (const IfcRelDefinesByProperties* const pset = conv.db.GetObject(relDefinesByPropertiesID)->ToPtr<IfcRelDefinesByProperties>()) {
|
||||
if (const IfcPropertySet* const set = conv.db.GetObject(pset->RelatingPropertyDefinition->GetID())->ToPtr<IfcPropertySet>()) {
|
||||
ProcessMetadata(set->HasProperties, conv, properties);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
7404
code/IFCReaderGen.h
7404
code/IFCReaderGen.h
File diff suppressed because it is too large
Load Diff
|
@ -106,4 +106,5 @@ IfcRelDefinesByProperties
|
|||
IfcPropertySet
|
||||
IfcPropertySingleValue
|
||||
IfcProperty
|
||||
IfcComplexProperty
|
||||
IfcElementQuantity
|
||||
|
|
Loading…
Reference in New Issue