- 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;
|
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>()) {
|
BOOST_FOREACH(const IfcProperty& property, set) {
|
||||||
if (const IfcPropertySet* const set = conv.db.GetObject(pset->RelatingPropertyDefinition->GetID())->ToPtr<IfcPropertySet>()) {
|
const std::string& key = prefix.length() > 0 ? (prefix + "." + property.Name) : property.Name;
|
||||||
BOOST_FOREACH(const IfcProperty& property, set->HasProperties) {
|
|
||||||
if (const IfcPropertySingleValue* const singleValue = property.ToPtr<IfcPropertySingleValue>()) {
|
if (const IfcPropertySingleValue* const singleValue = property.ToPtr<IfcPropertySingleValue>()) {
|
||||||
if (singleValue->NominalValue) {
|
if (singleValue->NominalValue) {
|
||||||
if (const EXPRESS::STRING* str = singleValue->NominalValue.Get()->ToPtr<EXPRESS::STRING>()) {
|
if (const EXPRESS::STRING* str = singleValue->NominalValue.Get()->ToPtr<EXPRESS::STRING>()) {
|
||||||
std::string value = static_cast<std::string>(*str);
|
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>()) {
|
else if (const EXPRESS::REAL* val = singleValue->NominalValue.Get()->ToPtr<EXPRESS::REAL>()) {
|
||||||
float value = static_cast<float>(*val);
|
float value = static_cast<float>(*val);
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
s << value;
|
s << value;
|
||||||
properties[property.Name]=s.str();
|
properties[key]=s.str();
|
||||||
}
|
}
|
||||||
else if (const EXPRESS::INTEGER* val = singleValue->NominalValue.Get()->ToPtr<EXPRESS::INTEGER>()) {
|
else if (const EXPRESS::INTEGER* val = singleValue->NominalValue.Get()->ToPtr<EXPRESS::INTEGER>()) {
|
||||||
int64_t value = static_cast<int64_t>(*val);
|
int64_t value = static_cast<int64_t>(*val);
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
s << value;
|
s << value;
|
||||||
properties[property.Name]=s.str();
|
properties[key]=s.str();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -637,13 +635,25 @@ void ProcessMetadata(uint64_t relDefinesByPropertiesID, ConversionData& conv, Me
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
ss << "]";
|
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 {
|
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
|
IfcPropertySet
|
||||||
IfcPropertySingleValue
|
IfcPropertySingleValue
|
||||||
IfcProperty
|
IfcProperty
|
||||||
|
IfcComplexProperty
|
||||||
IfcElementQuantity
|
IfcElementQuantity
|
||||||
|
|
Loading…
Reference in New Issue