mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 06:39:13 +00:00
Adapt XML serializer for changes in IFC4 decomposition and property set types
This commit is contained in:
@@ -119,7 +119,7 @@ typename V::list::ptr get_related(T* t, F f, G g) {
|
|||||||
typename V::list::ptr acc(new typename V::list);
|
typename V::list::ptr acc(new typename V::list);
|
||||||
for (typename U::list::it it = li->begin(); it != li->end(); ++it) {
|
for (typename U::list::it it = li->begin(); it != li->end(); ++it) {
|
||||||
U* u = *it;
|
U* u = *it;
|
||||||
acc->push((*u.*g)());
|
acc->push((*u.*g)()->as<V>());
|
||||||
}
|
}
|
||||||
return acc;
|
return acc;
|
||||||
}
|
}
|
||||||
@@ -142,9 +142,15 @@ void descend(IfcProduct* product, ptree& tree) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_IFC2x3
|
||||||
IfcObjectDefinition::list::ptr structures = get_related
|
IfcObjectDefinition::list::ptr structures = get_related
|
||||||
<IfcProduct, IfcRelDecomposes, IfcObjectDefinition>
|
<IfcProduct, IfcRelDecomposes, IfcObjectDefinition>
|
||||||
(product, &IfcProduct::IsDecomposedBy, &IfcRelDecomposes::RelatedObjects);
|
(product, &IfcProduct::IsDecomposedBy, &IfcRelDecomposes::RelatedObjects);
|
||||||
|
#else
|
||||||
|
IfcObjectDefinition::list::ptr structures = get_related
|
||||||
|
<IfcProduct, IfcRelAggregates, IfcObjectDefinition>
|
||||||
|
(product, &IfcProduct::IsDecomposedBy, &IfcRelAggregates::RelatedObjects);
|
||||||
|
#endif
|
||||||
|
|
||||||
for (IfcObjectDefinition::list::it it = structures->begin(); it != structures->end(); ++it) {
|
for (IfcObjectDefinition::list::it it = structures->begin(); it != structures->end(); ++it) {
|
||||||
IfcObjectDefinition* ob = *it;
|
IfcObjectDefinition* ob = *it;
|
||||||
@@ -172,9 +178,15 @@ template <>
|
|||||||
void descend(IfcProject* project, ptree& tree) {
|
void descend(IfcProject* project, ptree& tree) {
|
||||||
ptree& child = format_entity_instance(project, tree);
|
ptree& child = format_entity_instance(project, tree);
|
||||||
|
|
||||||
|
#ifdef USE_IFC2x3
|
||||||
IfcObjectDefinition::list::ptr structures = get_related
|
IfcObjectDefinition::list::ptr structures = get_related
|
||||||
<IfcProject, IfcRelDecomposes, IfcObjectDefinition>
|
<IfcProject, IfcRelDecomposes, IfcObjectDefinition>
|
||||||
(project, &IfcProject::IsDecomposedBy, &IfcRelDecomposes::RelatedObjects);
|
(project, &IfcProject::IsDecomposedBy, &IfcRelDecomposes::RelatedObjects);
|
||||||
|
#else
|
||||||
|
IfcObjectDefinition::list::ptr structures = get_related
|
||||||
|
<IfcProject, IfcRelAggregates, IfcObjectDefinition>
|
||||||
|
(project, &IfcProduct::IsDecomposedBy, &IfcRelAggregates::RelatedObjects);
|
||||||
|
#endif
|
||||||
|
|
||||||
for (IfcObjectDefinition::list::it it = structures->begin(); it != structures->end(); ++it) {
|
for (IfcObjectDefinition::list::it it = structures->begin(); it != structures->end(); ++it) {
|
||||||
IfcObjectDefinition* ob = *it;
|
IfcObjectDefinition* ob = *it;
|
||||||
|
|||||||
@@ -25,11 +25,15 @@
|
|||||||
#include "IfcUtil.h"
|
#include "IfcUtil.h"
|
||||||
|
|
||||||
void IfcEntityList::push(IfcUtil::IfcBaseClass* l) {
|
void IfcEntityList::push(IfcUtil::IfcBaseClass* l) {
|
||||||
if ( l ) ls.push_back(l);
|
if (l) {
|
||||||
|
ls.push_back(l);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void IfcEntityList::push(const IfcEntityList::ptr& l) {
|
void IfcEntityList::push(const IfcEntityList::ptr& l) {
|
||||||
for( it i = l->begin(); i != l->end(); ++i ) {
|
if (l) {
|
||||||
if ( *i ) ls.push_back(*i);
|
for( it i = l->begin(); i != l->end(); ++i ) {
|
||||||
|
if ( *i ) ls.push_back(*i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unsigned int IfcEntityList::size() const { return (unsigned int) ls.size(); }
|
unsigned int IfcEntityList::size() const { return (unsigned int) ls.size(); }
|
||||||
|
|||||||
+15
-6
@@ -80,6 +80,13 @@ namespace IfcUtil {
|
|||||||
virtual IfcSchema::Type::Enum getArgumentEntity(unsigned int i) const = 0;
|
virtual IfcSchema::Type::Enum getArgumentEntity(unsigned int i) const = 0;
|
||||||
virtual Argument* getArgument(unsigned int i) const = 0;
|
virtual Argument* getArgument(unsigned int i) const = 0;
|
||||||
virtual const char* getArgumentName(unsigned int i) const = 0;
|
virtual const char* getArgumentName(unsigned int i) const = 0;
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
typename T* as() {
|
||||||
|
return is(T::Class())
|
||||||
|
? static_cast<T*>(this)
|
||||||
|
: static_cast<T*>(0);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class IfcBaseEntity : public IfcBaseClass {
|
class IfcBaseEntity : public IfcBaseClass {
|
||||||
@@ -127,8 +134,8 @@ class IfcTemplatedEntityList {
|
|||||||
public:
|
public:
|
||||||
typedef SHARED_PTR< IfcTemplatedEntityList<T> > ptr;
|
typedef SHARED_PTR< IfcTemplatedEntityList<T> > ptr;
|
||||||
typedef typename std::vector<T*>::const_iterator it;
|
typedef typename std::vector<T*>::const_iterator it;
|
||||||
void push(T* t) {if (t) ls.push_back(t);}
|
void push(T* t) { if (t) { ls.push_back(t); } }
|
||||||
void push(ptr t) { for ( typename T::list::it it = t->begin(); it != t->end(); ++it ) push(*it); }
|
void push(ptr t) { if (t) { for ( typename T::list::it it = t->begin(); it != t->end(); ++it ) push(*it); } }
|
||||||
it begin() { return ls.begin(); }
|
it begin() { return ls.begin(); }
|
||||||
it end() { return ls.end(); }
|
it end() { return ls.end(); }
|
||||||
unsigned int size() const { return (unsigned int) ls.size(); }
|
unsigned int size() const { return (unsigned int) ls.size(); }
|
||||||
@@ -166,11 +173,13 @@ public:
|
|||||||
ls.push_back(l);
|
ls.push_back(l);
|
||||||
}
|
}
|
||||||
void push(const IfcEntityList::ptr& l) {
|
void push(const IfcEntityList::ptr& l) {
|
||||||
std::vector<IfcUtil::IfcBaseClass*> li;
|
if (l) {
|
||||||
for (std::vector<IfcUtil::IfcBaseClass*>::const_iterator jt = l->begin(); jt != l->end(); ++jt) {
|
std::vector<IfcUtil::IfcBaseClass*> li;
|
||||||
li.push_back(*jt);
|
for (std::vector<IfcUtil::IfcBaseClass*>::const_iterator jt = l->begin(); jt != l->end(); ++jt) {
|
||||||
|
li.push_back(*jt);
|
||||||
|
}
|
||||||
|
push(li);
|
||||||
}
|
}
|
||||||
push(li);
|
|
||||||
}
|
}
|
||||||
outer_it begin() const { return ls.begin(); }
|
outer_it begin() const { return ls.begin(); }
|
||||||
outer_it end() const { return ls.end(); }
|
outer_it end() const { return ls.end(); }
|
||||||
|
|||||||
Reference in New Issue
Block a user