Hacky solution to disable schemas to speedup compilation

This commit is contained in:
Thomas Krijnen
2021-05-11 22:29:16 +02:00
parent ce76d27acc
commit 34386ea27c
12 changed files with 582 additions and 166 deletions
+31 -2
View File
@@ -496,6 +496,10 @@ endfunction()
set(SCHEMA_VERSIONS "2x3" "4" "4x1" "4x2" "4x3_rc1" "4x3_rc2") set(SCHEMA_VERSIONS "2x3" "4" "4x1" "4x2" "4x3_rc1" "4x3_rc2")
foreach(s ${SCHEMA_VERSIONS})
add_definitions(-DHAS_SCHEMA_${s})
endforeach()
if(COMPILE_SCHEMA) if(COMPILE_SCHEMA)
# @todo, this appears to be untested at the moment # @todo, this appears to be untested at the moment
@@ -573,8 +577,33 @@ if (BUILD_CONVERT)
endif() endif()
# IfcParse # IfcParse
file(GLOB IFCPARSE_H_FILES ../src/ifcparse/*.h) file(GLOB IFCPARSE_H_FILES_ALL ../src/ifcparse/*.h)
file(GLOB IFCPARSE_CPP_FILES ../src/ifcparse/*.cpp) file(GLOB IFCPARSE_CPP_FILES_ALL ../src/ifcparse/*.cpp)
foreach(s ${IFCPARSE_H_FILES_ALL})
if (NOT s MATCHES "[0-9]")
list(APPEND IFCPARSE_H_FILES "${s}")
endif()
endforeach()
foreach(s ${IFCPARSE_CPP_FILES_ALL})
if (NOT s MATCHES "[0-9]")
list(APPEND IFCPARSE_CPP_FILES "${s}")
endif()
endforeach()
foreach(s ${SCHEMA_VERSIONS})
list(APPEND IFCPARSE_H_FILES
../src/ifcparse/Ifc${s}.h
../src/ifcparse/Ifc${s}-definitions.h
)
list(APPEND IFCPARSE_CPP_FILES
../src/ifcparse/Ifc${s}.cpp
../src/ifcparse/Ifc${s}-schema.cpp
)
endforeach()
set(IFCPARSE_FILES ${IFCPARSE_CPP_FILES} ${IFCPARSE_H_FILES}) set(IFCPARSE_FILES ${IFCPARSE_CPP_FILES} ${IFCPARSE_H_FILES})
add_library(IfcParse ${IFCPARSE_FILES}) add_library(IfcParse ${IFCPARSE_FILES})
@@ -12,32 +12,56 @@ template IteratorFactoryImplementation<float, float>& iterator_implementations<f
template IteratorFactoryImplementation<float, double>& iterator_implementations<float, double>(); template IteratorFactoryImplementation<float, double>& iterator_implementations<float, double>();
template IteratorFactoryImplementation<double, double>& iterator_implementations<double, double>(); template IteratorFactoryImplementation<double, double>& iterator_implementations<double, double>();
#ifdef HAS_SCHEMA_2x3
template <typename P, typename PP> template <typename P, typename PP>
extern void init_IteratorImplementation_Ifc2x3(IteratorFactoryImplementation<P, PP>*); extern void init_IteratorImplementation_Ifc2x3(IteratorFactoryImplementation<P, PP>*);
#endif
#ifdef HAS_SCHEMA_4
template <typename P, typename PP> template <typename P, typename PP>
extern void init_IteratorImplementation_Ifc4(IteratorFactoryImplementation<P, PP>*); extern void init_IteratorImplementation_Ifc4(IteratorFactoryImplementation<P, PP>*);
#endif
#ifdef HAS_SCHEMA_4x1
template <typename P, typename PP> template <typename P, typename PP>
extern void init_IteratorImplementation_Ifc4x1(IteratorFactoryImplementation<P, PP>*); extern void init_IteratorImplementation_Ifc4x1(IteratorFactoryImplementation<P, PP>*);
#endif
#ifdef HAS_SCHEMA_4x2
template <typename P, typename PP> template <typename P, typename PP>
extern void init_IteratorImplementation_Ifc4x2(IteratorFactoryImplementation<P, PP>*); extern void init_IteratorImplementation_Ifc4x2(IteratorFactoryImplementation<P, PP>*);
#endif
#ifdef HAS_SCHEMA_4x3_rc1
template <typename P, typename PP> template <typename P, typename PP>
extern void init_IteratorImplementation_Ifc4x3_rc1(IteratorFactoryImplementation<P, PP>*); extern void init_IteratorImplementation_Ifc4x3_rc1(IteratorFactoryImplementation<P, PP>*);
#endif
#ifdef HAS_SCHEMA_4x3_rc2
template <typename P, typename PP> template <typename P, typename PP>
extern void init_IteratorImplementation_Ifc4x3_rc2(IteratorFactoryImplementation<P, PP>*); extern void init_IteratorImplementation_Ifc4x3_rc2(IteratorFactoryImplementation<P, PP>*);
#endif
template <typename P, typename PP> template <typename P, typename PP>
IteratorFactoryImplementation<P, PP>::IteratorFactoryImplementation() { IteratorFactoryImplementation<P, PP>::IteratorFactoryImplementation() {
#ifdef HAS_SCHEMA_2x3
init_IteratorImplementation_Ifc2x3(this); init_IteratorImplementation_Ifc2x3(this);
#endif
#ifdef HAS_SCHEMA_4
init_IteratorImplementation_Ifc4(this); init_IteratorImplementation_Ifc4(this);
#endif
#ifdef HAS_SCHEMA_4x1
init_IteratorImplementation_Ifc4x1(this); init_IteratorImplementation_Ifc4x1(this);
#endif
#ifdef HAS_SCHEMA_4x2
init_IteratorImplementation_Ifc4x2(this); init_IteratorImplementation_Ifc4x2(this);
#endif
#ifdef HAS_SCHEMA_4x3_rc1
init_IteratorImplementation_Ifc4x3_rc1(this); init_IteratorImplementation_Ifc4x3_rc1(this);
#endif
#ifdef HAS_SCHEMA_4x3_rc2
init_IteratorImplementation_Ifc4x3_rc2(this); init_IteratorImplementation_Ifc4x3_rc2(this);
#endif
} }
template <typename P, typename PP> template <typename P, typename PP>
+111 -39
View File
@@ -48,20 +48,44 @@ IfcGeom::impl::KernelFactoryImplementation& IfcGeom::impl::kernel_implementation
return impl; return impl;
} }
#ifdef HAS_SCHEMA_2x3
extern void init_KernelImplementation_Ifc2x3(IfcGeom::impl::KernelFactoryImplementation*); extern void init_KernelImplementation_Ifc2x3(IfcGeom::impl::KernelFactoryImplementation*);
#endif
#ifdef HAS_SCHEMA_4
extern void init_KernelImplementation_Ifc4(IfcGeom::impl::KernelFactoryImplementation*); extern void init_KernelImplementation_Ifc4(IfcGeom::impl::KernelFactoryImplementation*);
#endif
#ifdef HAS_SCHEMA_4x1
extern void init_KernelImplementation_Ifc4x1(IfcGeom::impl::KernelFactoryImplementation*); extern void init_KernelImplementation_Ifc4x1(IfcGeom::impl::KernelFactoryImplementation*);
#endif
#ifdef HAS_SCHEMA_4x2
extern void init_KernelImplementation_Ifc4x2(IfcGeom::impl::KernelFactoryImplementation*); extern void init_KernelImplementation_Ifc4x2(IfcGeom::impl::KernelFactoryImplementation*);
#endif
#ifdef HAS_SCHEMA_4x3_rc1
extern void init_KernelImplementation_Ifc4x3_rc1(IfcGeom::impl::KernelFactoryImplementation*); extern void init_KernelImplementation_Ifc4x3_rc1(IfcGeom::impl::KernelFactoryImplementation*);
#endif
#ifdef HAS_SCHEMA_4x3_rc2
extern void init_KernelImplementation_Ifc4x3_rc2(IfcGeom::impl::KernelFactoryImplementation*); extern void init_KernelImplementation_Ifc4x3_rc2(IfcGeom::impl::KernelFactoryImplementation*);
#endif
IfcGeom::impl::KernelFactoryImplementation::KernelFactoryImplementation() { IfcGeom::impl::KernelFactoryImplementation::KernelFactoryImplementation() {
#ifdef HAS_SCHEMA_2x3
init_KernelImplementation_Ifc2x3(this); init_KernelImplementation_Ifc2x3(this);
#endif
#ifdef HAS_SCHEMA_4
init_KernelImplementation_Ifc4(this); init_KernelImplementation_Ifc4(this);
#endif
#ifdef HAS_SCHEMA_4x1
init_KernelImplementation_Ifc4x1(this); init_KernelImplementation_Ifc4x1(this);
#endif
#ifdef HAS_SCHEMA_4x2
init_KernelImplementation_Ifc4x2(this); init_KernelImplementation_Ifc4x2(this);
#endif
#ifdef HAS_SCHEMA_4x3_rc1
init_KernelImplementation_Ifc4x3_rc1(this); init_KernelImplementation_Ifc4x3_rc1(this);
#endif
#ifdef HAS_SCHEMA_4x3_rc2
init_KernelImplementation_Ifc4x3_rc2(this); init_KernelImplementation_Ifc4x3_rc2(this);
#endif
} }
void IfcGeom::impl::KernelFactoryImplementation::bind(const std::string& schema_name, IfcGeom::impl::kernel_fn fn) { void IfcGeom::impl::KernelFactoryImplementation::bind(const std::string& schema_name, IfcGeom::impl::kernel_fn fn) {
@@ -132,6 +156,15 @@ IfcSchema::IfcObjectDefinition* get_decomposing_entity_impl(IfcSchema::IfcProduc
} }
namespace { namespace {
#ifdef HAS_SCHEMA_2x3
IfcUtil::IfcBaseEntity* get_RelatingObject(Ifc2x3::IfcRelDecomposes* decompose) {
return decompose->RelatingObject();
}
CREATE_GET_DECOMPOSING_ENTITY(Ifc2x3);
#endif
#ifdef HAS_SCHEMA_4
IfcUtil::IfcBaseEntity* get_RelatingObject(Ifc4::IfcRelDecomposes* decompose) { IfcUtil::IfcBaseEntity* get_RelatingObject(Ifc4::IfcRelDecomposes* decompose) {
Ifc4::IfcRelAggregates* aggr = decompose->as<Ifc4::IfcRelAggregates>(); Ifc4::IfcRelAggregates* aggr = decompose->as<Ifc4::IfcRelAggregates>();
if (aggr != nullptr) { if (aggr != nullptr) {
@@ -139,7 +172,10 @@ namespace {
} }
return nullptr; return nullptr;
} }
CREATE_GET_DECOMPOSING_ENTITY(Ifc4);
#endif
#ifdef HAS_SCHEMA_4x1
IfcUtil::IfcBaseEntity* get_RelatingObject(Ifc4x1::IfcRelDecomposes* decompose) { IfcUtil::IfcBaseEntity* get_RelatingObject(Ifc4x1::IfcRelDecomposes* decompose) {
Ifc4x1::IfcRelAggregates* aggr = decompose->as<Ifc4x1::IfcRelAggregates>(); Ifc4x1::IfcRelAggregates* aggr = decompose->as<Ifc4x1::IfcRelAggregates>();
if (aggr != nullptr) { if (aggr != nullptr) {
@@ -147,7 +183,10 @@ namespace {
} }
return nullptr; return nullptr;
} }
CREATE_GET_DECOMPOSING_ENTITY(Ifc4x1);
#endif
#ifdef HAS_SCHEMA_4x2
IfcUtil::IfcBaseEntity* get_RelatingObject(Ifc4x2::IfcRelDecomposes* decompose) { IfcUtil::IfcBaseEntity* get_RelatingObject(Ifc4x2::IfcRelDecomposes* decompose) {
Ifc4x2::IfcRelAggregates* aggr = decompose->as<Ifc4x2::IfcRelAggregates>(); Ifc4x2::IfcRelAggregates* aggr = decompose->as<Ifc4x2::IfcRelAggregates>();
if (aggr != nullptr) { if (aggr != nullptr) {
@@ -155,7 +194,10 @@ namespace {
} }
return nullptr; return nullptr;
} }
CREATE_GET_DECOMPOSING_ENTITY(Ifc4x2);
#endif
#ifdef HAS_SCHEMA_4x3_rc1
IfcUtil::IfcBaseEntity* get_RelatingObject(Ifc4x3_rc1::IfcRelDecomposes* decompose) { IfcUtil::IfcBaseEntity* get_RelatingObject(Ifc4x3_rc1::IfcRelDecomposes* decompose) {
Ifc4x3_rc1::IfcRelAggregates* aggr = decompose->as<Ifc4x3_rc1::IfcRelAggregates>(); Ifc4x3_rc1::IfcRelAggregates* aggr = decompose->as<Ifc4x3_rc1::IfcRelAggregates>();
if (aggr != nullptr) { if (aggr != nullptr) {
@@ -163,7 +205,10 @@ namespace {
} }
return nullptr; return nullptr;
} }
CREATE_GET_DECOMPOSING_ENTITY(Ifc4x3_rc1);
#endif
#ifdef HAS_SCHEMA_4x3_rc2
IfcUtil::IfcBaseEntity* get_RelatingObject(Ifc4x3_rc2::IfcRelDecomposes* decompose) { IfcUtil::IfcBaseEntity* get_RelatingObject(Ifc4x3_rc2::IfcRelDecomposes* decompose) {
Ifc4x3_rc2::IfcRelAggregates* aggr = decompose->as<Ifc4x3_rc2::IfcRelAggregates>(); Ifc4x3_rc2::IfcRelAggregates* aggr = decompose->as<Ifc4x3_rc2::IfcRelAggregates>();
if (aggr != nullptr) { if (aggr != nullptr) {
@@ -171,37 +216,47 @@ namespace {
} }
return nullptr; return nullptr;
} }
IfcUtil::IfcBaseEntity* get_RelatingObject(Ifc2x3::IfcRelDecomposes* decompose) {
return decompose->RelatingObject();
}
CREATE_GET_DECOMPOSING_ENTITY(Ifc2x3);
CREATE_GET_DECOMPOSING_ENTITY(Ifc4);
CREATE_GET_DECOMPOSING_ENTITY(Ifc4x1);
CREATE_GET_DECOMPOSING_ENTITY(Ifc4x2);
CREATE_GET_DECOMPOSING_ENTITY(Ifc4x3_rc1);
CREATE_GET_DECOMPOSING_ENTITY(Ifc4x3_rc2); CREATE_GET_DECOMPOSING_ENTITY(Ifc4x3_rc2);
#endif
} }
IfcUtil::IfcBaseEntity* IfcGeom::Kernel::get_decomposing_entity(IfcUtil::IfcBaseEntity* inst, bool include_openings) { IfcUtil::IfcBaseEntity* IfcGeom::Kernel::get_decomposing_entity(IfcUtil::IfcBaseEntity* inst, bool include_openings) {
#ifdef HAS_SCHEMA_2x3
if (inst->as<Ifc2x3::IfcProduct>()) { if (inst->as<Ifc2x3::IfcProduct>()) {
return get_decomposing_entity_impl(inst->as<Ifc2x3::IfcProduct>(), include_openings); return get_decomposing_entity_impl(inst->as<Ifc2x3::IfcProduct>(), include_openings);
} else if (inst->as<Ifc4::IfcProduct>()) {
return get_decomposing_entity_impl(inst->as<Ifc4::IfcProduct>(), include_openings);
} else if (inst->as<Ifc4x1::IfcProduct>()) {
return get_decomposing_entity_impl(inst->as<Ifc4x1::IfcProduct>(), include_openings);
} else if (inst->as<Ifc4x2::IfcProduct>()) {
return get_decomposing_entity_impl(inst->as<Ifc4x2::IfcProduct>(), include_openings);
} else if (inst->as<Ifc4x3_rc1::IfcProduct>()) {
return get_decomposing_entity_impl(inst->as<Ifc4x3_rc1::IfcProduct>(), include_openings);
} else if (inst->as<Ifc4x3_rc2::IfcProduct>()) {
return get_decomposing_entity_impl(inst->as<Ifc4x3_rc2::IfcProduct>(), include_openings);
} else if (inst->declaration().name() == "IfcProject") {
return nullptr;
} else {
throw IfcParse::IfcException("Unexpected entity " + inst->declaration().name());
} }
#endif
#ifdef HAS_SCHEMA_4
if (inst->as<Ifc4::IfcProduct>()) {
return get_decomposing_entity_impl(inst->as<Ifc4::IfcProduct>(), include_openings);
}
#endif
#ifdef HAS_SCHEMA_4x1
if (inst->as<Ifc4x1::IfcProduct>()) {
return get_decomposing_entity_impl(inst->as<Ifc4x1::IfcProduct>(), include_openings);
}
#endif
#ifdef HAS_SCHEMA_4x2
if (inst->as<Ifc4x2::IfcProduct>()) {
return get_decomposing_entity_impl(inst->as<Ifc4x2::IfcProduct>(), include_openings);
}
#endif
#ifdef HAS_SCHEMA_4x3_rc1
if (inst->as<Ifc4x3_rc1::IfcProduct>()) {
return get_decomposing_entity_impl(inst->as<Ifc4x3_rc1::IfcProduct>(), include_openings);
}
#endif
#ifdef HAS_SCHEMA_4x3_rc2
if (inst->as<Ifc4x3_rc2::IfcProduct>()) {
return get_decomposing_entity_impl(inst->as<Ifc4x3_rc2::IfcProduct>(), include_openings);
}
#endif
if (inst->declaration().name() == "IfcProject") {
return nullptr;
}
throw IfcParse::IfcException("Unexpected entity " + inst->declaration().name());
} }
namespace { namespace {
@@ -223,21 +278,38 @@ namespace {
} }
std::map<std::string, IfcUtil::IfcBaseEntity*> IfcGeom::Kernel::get_layers(IfcUtil::IfcBaseEntity* inst) { std::map<std::string, IfcUtil::IfcBaseEntity*> IfcGeom::Kernel::get_layers(IfcUtil::IfcBaseEntity* inst) {
#ifdef HAS_SCHEMA_2x3
if (inst->as<Ifc2x3::IfcProduct>()) { if (inst->as<Ifc2x3::IfcProduct>()) {
return get_layers_impl<Ifc2x3>(inst->as<Ifc2x3::IfcProduct>()); return get_layers_impl<Ifc2x3>(inst->as<Ifc2x3::IfcProduct>());
} else if (inst->as<Ifc4::IfcProduct>()) {
return get_layers_impl<Ifc4>(inst->as<Ifc4::IfcProduct>());
} else if (inst->as<Ifc4x1::IfcProduct>()) {
return get_layers_impl<Ifc4x1>(inst->as<Ifc4x1::IfcProduct>());
} else if (inst->as<Ifc4x2::IfcProduct>()) {
return get_layers_impl<Ifc4x2>(inst->as<Ifc4x2::IfcProduct>());
} else if (inst->as<Ifc4x3_rc1::IfcProduct>()) {
return get_layers_impl<Ifc4x3_rc1>(inst->as<Ifc4x3_rc1::IfcProduct>());
} else if (inst->as<Ifc4x3_rc2::IfcProduct>()) {
return get_layers_impl<Ifc4x3_rc2>(inst->as<Ifc4x3_rc2::IfcProduct>());
} else {
throw IfcParse::IfcException("Unexpected entity " + inst->declaration().name());
} }
#endif
#ifdef HAS_SCHEMA_4
if (inst->as<Ifc4::IfcProduct>()) {
return get_layers_impl<Ifc4>(inst->as<Ifc4::IfcProduct>());
}
#endif
#ifdef HAS_SCHEMA_4x1
if (inst->as<Ifc4x1::IfcProduct>()) {
return get_layers_impl<Ifc4x1>(inst->as<Ifc4x1::IfcProduct>());
}
#endif
#ifdef HAS_SCHEMA_4x2
if (inst->as<Ifc4x2::IfcProduct>()) {
return get_layers_impl<Ifc4x2>(inst->as<Ifc4x2::IfcProduct>());
}
#endif
#ifdef HAS_SCHEMA_4x3_rc1
if (inst->as<Ifc4x3_rc1::IfcProduct>()) {
return get_layers_impl<Ifc4x3_rc1>(inst->as<Ifc4x3_rc1::IfcProduct>());
}
#endif
#ifdef HAS_SCHEMA_4x3_rc2
if (inst->as<Ifc4x3_rc2::IfcProduct>()) {
return get_layers_impl<Ifc4x3_rc2>(inst->as<Ifc4x3_rc2::IfcProduct>());
}
#endif
throw IfcParse::IfcException("Unexpected entity " + inst->declaration().name());
} }
bool IfcGeom::Kernel::is_manifold(const TopoDS_Shape& a) { bool IfcGeom::Kernel::is_manifold(const TopoDS_Shape& a) {
+12
View File
@@ -5,12 +5,24 @@
#include "../ifcgeom/IfcGeomIteratorSettings.h" #include "../ifcgeom/IfcGeomIteratorSettings.h"
#include "../ifcgeom/IfcRepresentationShapeItem.h" #include "../ifcgeom/IfcRepresentationShapeItem.h"
#ifdef HAS_SCHEMA_2x3
#include "../ifcparse/Ifc2x3.h" #include "../ifcparse/Ifc2x3.h"
#endif
#ifdef HAS_SCHEMA_4
#include "../ifcparse/Ifc4.h" #include "../ifcparse/Ifc4.h"
#endif
#ifdef HAS_SCHEMA_4x1
#include "../ifcparse/Ifc4x1.h" #include "../ifcparse/Ifc4x1.h"
#endif
#ifdef HAS_SCHEMA_4x2
#include "../ifcparse/Ifc4x2.h" #include "../ifcparse/Ifc4x2.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc1
#include "../ifcparse/Ifc4x3_rc1.h" #include "../ifcparse/Ifc4x3_rc1.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc2
#include "../ifcparse/Ifc4x3_rc2.h" #include "../ifcparse/Ifc4x3_rc2.h"
#endif
#include <boost/function.hpp> #include <boost/function.hpp>
+106 -29
View File
@@ -3,23 +3,59 @@
#include <boost/algorithm/string/case_conv.hpp> #include <boost/algorithm/string/case_conv.hpp>
namespace IfcGeom { namespace IfcGeom {
#ifdef HAS_SCHEMA_2x3
extern IfcUtil::IfcBaseClass* tesselate_Ifc2x3(const TopoDS_Shape& shape, double deflection); extern IfcUtil::IfcBaseClass* tesselate_Ifc2x3(const TopoDS_Shape& shape, double deflection);
extern IfcUtil::IfcBaseClass* tesselate_Ifc4(const TopoDS_Shape& shape, double deflection);
extern IfcUtil::IfcBaseClass* tesselate_Ifc4x1(const TopoDS_Shape& shape, double deflection);
extern IfcUtil::IfcBaseClass* tesselate_Ifc4x2(const TopoDS_Shape& shape, double deflection);
extern IfcUtil::IfcBaseClass* tesselate_Ifc4x3_rc1(const TopoDS_Shape& shape, double deflection);
extern IfcUtil::IfcBaseClass* tesselate_Ifc4x3_rc2(const TopoDS_Shape& shape, double deflection);
extern IfcUtil::IfcBaseClass* serialise_Ifc2x3(const TopoDS_Shape& shape, bool advanced); extern IfcUtil::IfcBaseClass* serialise_Ifc2x3(const TopoDS_Shape& shape, bool advanced);
#endif
#ifdef HAS_SCHEMA_4
extern IfcUtil::IfcBaseClass* tesselate_Ifc4(const TopoDS_Shape& shape, double deflection);
extern IfcUtil::IfcBaseClass* serialise_Ifc4(const TopoDS_Shape& shape, bool advanced); extern IfcUtil::IfcBaseClass* serialise_Ifc4(const TopoDS_Shape& shape, bool advanced);
#endif
#ifdef HAS_SCHEMA_4x1
extern IfcUtil::IfcBaseClass* tesselate_Ifc4x1(const TopoDS_Shape& shape, double deflection);
extern IfcUtil::IfcBaseClass* serialise_Ifc4x1(const TopoDS_Shape& shape, bool advanced); extern IfcUtil::IfcBaseClass* serialise_Ifc4x1(const TopoDS_Shape& shape, bool advanced);
#endif
#ifdef HAS_SCHEMA_4x2
extern IfcUtil::IfcBaseClass* tesselate_Ifc4x2(const TopoDS_Shape& shape, double deflection);
extern IfcUtil::IfcBaseClass* serialise_Ifc4x2(const TopoDS_Shape& shape, bool advanced); extern IfcUtil::IfcBaseClass* serialise_Ifc4x2(const TopoDS_Shape& shape, bool advanced);
#endif
#ifdef HAS_SCHEMA_4x3_rc1
extern IfcUtil::IfcBaseClass* tesselate_Ifc4x3_rc1(const TopoDS_Shape& shape, double deflection);
extern IfcUtil::IfcBaseClass* serialise_Ifc4x3_rc1(const TopoDS_Shape& shape, bool advanced); extern IfcUtil::IfcBaseClass* serialise_Ifc4x3_rc1(const TopoDS_Shape& shape, bool advanced);
#endif
#ifdef HAS_SCHEMA_4x3_rc2
extern IfcUtil::IfcBaseClass* tesselate_Ifc4x3_rc2(const TopoDS_Shape& shape, double deflection);
extern IfcUtil::IfcBaseClass* serialise_Ifc4x3_rc2(const TopoDS_Shape& shape, bool advanced); extern IfcUtil::IfcBaseClass* serialise_Ifc4x3_rc2(const TopoDS_Shape& shape, bool advanced);
#endif
} }
template <typename Fn, typename T> template <typename Fn, typename T>
IfcUtil::IfcBaseClass* execute_based_on_schema(Fn fn_2x3, Fn fn_4, Fn fn_4x1, Fn fn_4x2, Fn fn_4x3_rc1, Fn fn_4x3_rc2, const std::string& schema_name, const TopoDS_Shape& shape, T t) { IfcUtil::IfcBaseClass* execute_based_on_schema(
#ifdef HAS_SCHEMA_2x3
Fn fn_2x3,
#endif
#ifdef HAS_SCHEMA_4
Fn fn_4,
#endif
#ifdef HAS_SCHEMA_4x1
Fn fn_4x1,
#endif
#ifdef HAS_SCHEMA_4x2
Fn fn_4x2,
#endif
#ifdef HAS_SCHEMA_4x3_rc1
Fn fn_4x3_rc1,
#endif
#ifdef HAS_SCHEMA_4x3_rc2
Fn fn_4x3_rc2,
#endif
const std::string& schema_name, const TopoDS_Shape& shape, T t)
{
// @todo an ugly hack to guarantee schemas are initialised. // @todo an ugly hack to guarantee schemas are initialised.
try { try {
IfcParse::schema_by_name("IFC2X3"); IfcParse::schema_by_name("IFC2X3");
@@ -27,41 +63,82 @@ IfcUtil::IfcBaseClass* execute_based_on_schema(Fn fn_2x3, Fn fn_4, Fn fn_4x1, Fn
const std::string schema_name_lower = boost::to_lower_copy(schema_name); const std::string schema_name_lower = boost::to_lower_copy(schema_name);
#ifdef HAS_SCHEMA_2x3
if (schema_name_lower == "ifc2x3") { if (schema_name_lower == "ifc2x3") {
return fn_2x3(shape, t); return fn_2x3(shape, t);
} else if (schema_name_lower == "ifc4") {
return fn_4(shape, t);
} else if (schema_name_lower == "ifc4x1") {
return fn_4x1(shape, t);
} else if (schema_name_lower == "ifc4x2") {
return fn_4x2(shape, t);
} else if (schema_name_lower == "ifc4x3_rc1") {
return fn_4x3_rc1(shape, t);
} else if (schema_name_lower == "ifc4x3_rc2") {
return fn_4x3_rc2(shape, t);
} else {
throw IfcParse::IfcException("No geometry serialization available for " + schema_name);
} }
#endif
#ifdef HAS_SCHEMA_4
if (schema_name_lower == "ifc4") {
return fn_4(shape, t);
}
#endif
#ifdef HAS_SCHEMA_4x1
if (schema_name_lower == "ifc4x1") {
return fn_4x1(shape, t);
}
#endif
#ifdef HAS_SCHEMA_4x2
if (schema_name_lower == "ifc4x2") {
return fn_4x2(shape, t);
}
#endif
#ifdef HAS_SCHEMA_4x3_rc1
if (schema_name_lower == "ifc4x3_rc1") {
return fn_4x3_rc1(shape, t);
}
#endif
#ifdef HAS_SCHEMA_4x3_rx2
if (schema_name_lower == "ifc4x3_rc2") {
return fn_4x3_rc2(shape, t);
}
#endif
throw IfcParse::IfcException("No geometry serialization available for " + schema_name);
} }
IfcUtil::IfcBaseClass* IfcGeom::tesselate(const std::string& schema_name, const TopoDS_Shape& shape, double deflection) { IfcUtil::IfcBaseClass* IfcGeom::tesselate(const std::string& schema_name, const TopoDS_Shape& shape, double deflection) {
return execute_based_on_schema( return execute_based_on_schema(
IfcGeom::tesselate_Ifc2x3, #ifdef HAS_SCHEMA_2x3
IfcGeom::tesselate_Ifc4, IfcGeom::tesselate_Ifc2x3,
IfcGeom::tesselate_Ifc4x1, #endif
IfcGeom::tesselate_Ifc4x2, #ifdef HAS_SCHEMA_4
IfcGeom::tesselate_Ifc4x3_rc1, IfcGeom::tesselate_Ifc4,
#endif
#ifdef HAS_SCHEMA_4x1
IfcGeom::tesselate_Ifc4x1,
#endif
#ifdef HAS_SCHEMA_4x2
IfcGeom::tesselate_Ifc4x2,
#endif
#ifdef HAS_SCHEMA_4x3_rc1
IfcGeom::tesselate_Ifc4x3_rc1,
#endif
#ifdef HAS_SCHEMA_4x3_rc2
IfcGeom::tesselate_Ifc4x3_rc2, IfcGeom::tesselate_Ifc4x3_rc2,
#endif
schema_name, shape, deflection); schema_name, shape, deflection);
} }
IfcUtil::IfcBaseClass* IfcGeom::serialise(const std::string& schema_name, const TopoDS_Shape& shape, bool advanced) { IfcUtil::IfcBaseClass* IfcGeom::serialise(const std::string& schema_name, const TopoDS_Shape& shape, bool advanced) {
return execute_based_on_schema( return execute_based_on_schema(
IfcGeom::serialise_Ifc2x3, #ifdef HAS_SCHEMA_2x3
IfcGeom::serialise_Ifc4, IfcGeom::serialise_Ifc2x3,
IfcGeom::serialise_Ifc4x1, #endif
IfcGeom::serialise_Ifc4x2, #ifdef HAS_SCHEMA_4
IfcGeom::serialise_Ifc4x3_rc1, IfcGeom::serialise_Ifc4,
#endif
#ifdef HAS_SCHEMA_4x1
IfcGeom::serialise_Ifc4x1,
#endif
#ifdef HAS_SCHEMA_4x2
IfcGeom::serialise_Ifc4x2,
#endif
#ifdef HAS_SCHEMA_4x3_rc1
IfcGeom::serialise_Ifc4x3_rc1,
#endif
#ifdef HAS_SCHEMA_4x3_rc2
IfcGeom::serialise_Ifc4x3_rc2, IfcGeom::serialise_Ifc4x3_rc2,
#endif
schema_name, shape, advanced); schema_name, shape, advanced);
} }
+24
View File
@@ -454,41 +454,53 @@ void IfcHierarchyHelper<Schema>::setSurfaceColour(typename Schema::IfcProductRep
} }
} }
#ifdef HAS_SCHEMA_2x3
Ifc2x3::IfcStyledItem* create_styled_item(Ifc2x3::IfcRepresentationItem* item, Ifc2x3::IfcPresentationStyleAssignment* style_assignment) { Ifc2x3::IfcStyledItem* create_styled_item(Ifc2x3::IfcRepresentationItem* item, Ifc2x3::IfcPresentationStyleAssignment* style_assignment) {
Ifc2x3::IfcPresentationStyleAssignment::list::ptr style_assignments(new Ifc2x3::IfcPresentationStyleAssignment::list); Ifc2x3::IfcPresentationStyleAssignment::list::ptr style_assignments(new Ifc2x3::IfcPresentationStyleAssignment::list);
style_assignments->push(style_assignment); style_assignments->push(style_assignment);
return new Ifc2x3::IfcStyledItem(item, style_assignments, boost::none); return new Ifc2x3::IfcStyledItem(item, style_assignments, boost::none);
} }
#endif
#ifdef HAS_SCHEMA_4
Ifc4::IfcStyledItem* create_styled_item(Ifc4::IfcRepresentationItem* item, Ifc4::IfcPresentationStyleAssignment* style_assignment) { Ifc4::IfcStyledItem* create_styled_item(Ifc4::IfcRepresentationItem* item, Ifc4::IfcPresentationStyleAssignment* style_assignment) {
IfcEntityList::ptr style_assignments(new IfcEntityList); IfcEntityList::ptr style_assignments(new IfcEntityList);
style_assignments->push(style_assignment); style_assignments->push(style_assignment);
return new Ifc4::IfcStyledItem(item, style_assignments, boost::none); return new Ifc4::IfcStyledItem(item, style_assignments, boost::none);
} }
#endif
#ifdef HAS_SCHEMA_4x1
Ifc4x1::IfcStyledItem* create_styled_item(Ifc4x1::IfcRepresentationItem* item, Ifc4x1::IfcPresentationStyleAssignment* style_assignment) { Ifc4x1::IfcStyledItem* create_styled_item(Ifc4x1::IfcRepresentationItem* item, Ifc4x1::IfcPresentationStyleAssignment* style_assignment) {
IfcEntityList::ptr style_assignments(new IfcEntityList); IfcEntityList::ptr style_assignments(new IfcEntityList);
style_assignments->push(style_assignment); style_assignments->push(style_assignment);
return new Ifc4x1::IfcStyledItem(item, style_assignments, boost::none); return new Ifc4x1::IfcStyledItem(item, style_assignments, boost::none);
} }
#endif
#ifdef HAS_SCHEMA_4x2
Ifc4x2::IfcStyledItem* create_styled_item(Ifc4x2::IfcRepresentationItem* item, Ifc4x2::IfcPresentationStyleAssignment* style_assignment) { Ifc4x2::IfcStyledItem* create_styled_item(Ifc4x2::IfcRepresentationItem* item, Ifc4x2::IfcPresentationStyleAssignment* style_assignment) {
IfcEntityList::ptr style_assignments(new IfcEntityList); IfcEntityList::ptr style_assignments(new IfcEntityList);
style_assignments->push(style_assignment); style_assignments->push(style_assignment);
return new Ifc4x2::IfcStyledItem(item, style_assignments, boost::none); return new Ifc4x2::IfcStyledItem(item, style_assignments, boost::none);
} }
#endif
#ifdef HAS_SCHEMA_4x3_rc1
Ifc4x3_rc1::IfcStyledItem* create_styled_item(Ifc4x3_rc1::IfcRepresentationItem* item, Ifc4x3_rc1::IfcPresentationStyleAssignment* style_assignment) { Ifc4x3_rc1::IfcStyledItem* create_styled_item(Ifc4x3_rc1::IfcRepresentationItem* item, Ifc4x3_rc1::IfcPresentationStyleAssignment* style_assignment) {
IfcEntityList::ptr style_assignments(new IfcEntityList); IfcEntityList::ptr style_assignments(new IfcEntityList);
style_assignments->push(style_assignment); style_assignments->push(style_assignment);
return new Ifc4x3_rc1::IfcStyledItem(item, style_assignments, boost::none); return new Ifc4x3_rc1::IfcStyledItem(item, style_assignments, boost::none);
} }
#endif
#ifdef HAS_SCHEMA_4x3_rc2
Ifc4x3_rc2::IfcStyledItem* create_styled_item(Ifc4x3_rc2::IfcRepresentationItem* item, Ifc4x3_rc2::IfcPresentationStyleAssignment* style_assignment) { Ifc4x3_rc2::IfcStyledItem* create_styled_item(Ifc4x3_rc2::IfcRepresentationItem* item, Ifc4x3_rc2::IfcPresentationStyleAssignment* style_assignment) {
IfcEntityList::ptr style_assignments(new IfcEntityList); IfcEntityList::ptr style_assignments(new IfcEntityList);
style_assignments->push(style_assignment); style_assignments->push(style_assignment);
return new Ifc4x3_rc2::IfcStyledItem(item, style_assignments, boost::none); return new Ifc4x3_rc2::IfcStyledItem(item, style_assignments, boost::none);
} }
#endif
template <typename Schema> template <typename Schema>
void IfcHierarchyHelper<Schema>::setSurfaceColour(typename Schema::IfcRepresentation* rep, void IfcHierarchyHelper<Schema>::setSurfaceColour(typename Schema::IfcRepresentation* rep,
@@ -582,9 +594,21 @@ typename Schema::IfcGeometricRepresentationContext* IfcHierarchyHelper<Schema>::
} }
} }
#ifdef HAS_SCHEMA_2x3
template IFC_PARSE_API class IfcHierarchyHelper<Ifc2x3>; template IFC_PARSE_API class IfcHierarchyHelper<Ifc2x3>;
#endif
#ifdef HAS_SCHEMA_4
template IFC_PARSE_API class IfcHierarchyHelper<Ifc4>; template IFC_PARSE_API class IfcHierarchyHelper<Ifc4>;
#endif
#ifdef HAS_SCHEMA_4x1
template IFC_PARSE_API class IfcHierarchyHelper<Ifc4x1>; template IFC_PARSE_API class IfcHierarchyHelper<Ifc4x1>;
#endif
#ifdef HAS_SCHEMA_4x2
template IFC_PARSE_API class IfcHierarchyHelper<Ifc4x2>; template IFC_PARSE_API class IfcHierarchyHelper<Ifc4x2>;
#endif
#ifdef HAS_SCHEMA_4x3_rc1
template IFC_PARSE_API class IfcHierarchyHelper<Ifc4x3_rc1>; template IFC_PARSE_API class IfcHierarchyHelper<Ifc4x3_rc1>;
#endif
#ifdef HAS_SCHEMA_4x3_rc2
template IFC_PARSE_API class IfcHierarchyHelper<Ifc4x3_rc2>; template IFC_PARSE_API class IfcHierarchyHelper<Ifc4x3_rc2>;
#endif
+128 -84
View File
@@ -32,12 +32,24 @@
#include "ifc_parse_api.h" #include "ifc_parse_api.h"
#ifdef HAS_SCHEMA_2x3
#include "../ifcparse/Ifc2x3.h" #include "../ifcparse/Ifc2x3.h"
#endif
#ifdef HAS_SCHEMA_4
#include "../ifcparse/Ifc4.h" #include "../ifcparse/Ifc4.h"
#endif
#ifdef HAS_SCHEMA_4x1
#include "../ifcparse/Ifc4x1.h" #include "../ifcparse/Ifc4x1.h"
#endif
#ifdef HAS_SCHEMA_4x2
#include "../ifcparse/Ifc4x2.h" #include "../ifcparse/Ifc4x2.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc1
#include "../ifcparse/Ifc4x3_rc1.h" #include "../ifcparse/Ifc4x3_rc1.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc2
#include "../ifcparse/Ifc4x3_rc2.h" #include "../ifcparse/Ifc4x3_rc2.h"
#endif
#include "../ifcparse/IfcFile.h" #include "../ifcparse/IfcFile.h"
@@ -45,78 +57,150 @@
#include "../ifcparse/IfcGlobalId.h" #include "../ifcparse/IfcGlobalId.h"
namespace { namespace {
IfcUtil::IfcBaseClass* get_parent_of_relation(IfcUtil::IfcBaseClass* t) { #ifdef HAS_SCHEMA_2x3
return *t->data().getArgument(
t->declaration().as_entity()->attribute_index("RelatingObject")
);
}
Ifc2x3::IfcObjectDefinition* get_parent_of_relation(Ifc2x3::IfcRelContainedInSpatialStructure* t) { Ifc2x3::IfcObjectDefinition* get_parent_of_relation(Ifc2x3::IfcRelContainedInSpatialStructure* t) {
return t->RelatingStructure(); return t->RelatingStructure();
} }
Ifc4::IfcObjectDefinition* get_parent_of_relation(Ifc4::IfcRelContainedInSpatialStructure* t) {
return t->RelatingStructure();
}
Ifc4x1::IfcObjectDefinition* get_parent_of_relation(Ifc4x1::IfcRelContainedInSpatialStructure* t) {
return t->RelatingStructure();
}
Ifc4x2::IfcObjectDefinition* get_parent_of_relation(Ifc4x2::IfcRelContainedInSpatialStructure* t) {
return t->RelatingStructure();
}
Ifc4x3_rc1::IfcObjectDefinition* get_parent_of_relation(Ifc4x3_rc1::IfcRelContainedInSpatialStructure* t) {
return t->RelatingStructure();
}
IfcEntityList::ptr get_children_of_relation(IfcUtil::IfcBaseClass* t) {
return *t->data().getArgument(
t->declaration().as_entity()->attribute_index("RelatedElements")
);
}
IfcEntityList::ptr get_children_of_relation(Ifc2x3::IfcRelContainedInSpatialStructure* t) { IfcEntityList::ptr get_children_of_relation(Ifc2x3::IfcRelContainedInSpatialStructure* t) {
return t->RelatedElements()->generalize(); return t->RelatedElements()->generalize();
} }
IfcEntityList::ptr get_children_of_relation(Ifc4::IfcRelContainedInSpatialStructure* t) {
return t->RelatedElements()->generalize();
}
IfcEntityList::ptr get_children_of_relation(Ifc4x1::IfcRelContainedInSpatialStructure* t) {
return t->RelatedElements()->generalize();
}
IfcEntityList::ptr get_children_of_relation(Ifc4x2::IfcRelContainedInSpatialStructure* t) {
return t->RelatedElements()->generalize();
}
IfcEntityList::ptr get_children_of_relation(Ifc4x3_rc1::IfcRelContainedInSpatialStructure* t) {
return t->RelatedElements()->generalize();
}
IfcEntityList::ptr get_children_of_relation(Ifc2x3::IfcRelAggregates* t) { IfcEntityList::ptr get_children_of_relation(Ifc2x3::IfcRelAggregates* t) {
return t->RelatedObjects()->generalize(); return t->RelatedObjects()->generalize();
} }
void set_children_of_relation(Ifc2x3::IfcRelContainedInSpatialStructure* t, IfcEntityList::ptr& cs) {
t->setRelatedElements(cs->as<Ifc2x3::IfcProduct>());
}
void set_children_of_relation(Ifc2x3::IfcRelAggregates* t, IfcEntityList::ptr& cs) {
t->setRelatedObjects(cs->as<Ifc2x3::IfcObjectDefinition>());
}
#endif
#ifdef HAS_SCHEMA_4
Ifc4::IfcObjectDefinition* get_parent_of_relation(Ifc4::IfcRelContainedInSpatialStructure* t) {
return t->RelatingStructure();
}
IfcEntityList::ptr get_children_of_relation(Ifc4::IfcRelContainedInSpatialStructure* t) {
return t->RelatedElements()->generalize();
}
IfcEntityList::ptr get_children_of_relation(Ifc4::IfcRelAggregates* t) { IfcEntityList::ptr get_children_of_relation(Ifc4::IfcRelAggregates* t) {
return t->RelatedObjects()->generalize(); return t->RelatedObjects()->generalize();
} }
void set_children_of_relation(Ifc4::IfcRelContainedInSpatialStructure* t, IfcEntityList::ptr& cs) {
t->setRelatedElements(cs->as<Ifc4::IfcProduct>());
}
void set_children_of_relation(Ifc4::IfcRelAggregates* t, IfcEntityList::ptr& cs) {
t->setRelatedObjects(cs->as<Ifc4::IfcObjectDefinition>());
}
#endif
#ifdef HAS_SCHEMA_4x1
Ifc4x1::IfcObjectDefinition* get_parent_of_relation(Ifc4x1::IfcRelContainedInSpatialStructure* t) {
return t->RelatingStructure();
}
IfcEntityList::ptr get_children_of_relation(Ifc4x1::IfcRelContainedInSpatialStructure* t) {
return t->RelatedElements()->generalize();
}
IfcEntityList::ptr get_children_of_relation(Ifc4x1::IfcRelAggregates* t) { IfcEntityList::ptr get_children_of_relation(Ifc4x1::IfcRelAggregates* t) {
return t->RelatedObjects()->generalize(); return t->RelatedObjects()->generalize();
} }
void set_children_of_relation(Ifc4x1::IfcRelContainedInSpatialStructure* t, IfcEntityList::ptr& cs) {
t->setRelatedElements(cs->as<Ifc4x1::IfcProduct>());
}
void set_children_of_relation(Ifc4x1::IfcRelAggregates* t, IfcEntityList::ptr& cs) {
t->setRelatedObjects(cs->as<Ifc4x1::IfcObjectDefinition>());
}
#endif
#ifdef HAS_SCHEMA_4x2
Ifc4x2::IfcObjectDefinition* get_parent_of_relation(Ifc4x2::IfcRelContainedInSpatialStructure* t) {
return t->RelatingStructure();
}
IfcEntityList::ptr get_children_of_relation(Ifc4x2::IfcRelContainedInSpatialStructure* t) {
return t->RelatedElements()->generalize();
}
IfcEntityList::ptr get_children_of_relation(Ifc4x2::IfcRelAggregates* t) { IfcEntityList::ptr get_children_of_relation(Ifc4x2::IfcRelAggregates* t) {
return t->RelatedObjects()->generalize(); return t->RelatedObjects()->generalize();
} }
void set_children_of_relation(Ifc4x2::IfcRelContainedInSpatialStructure* t, IfcEntityList::ptr& cs) {
t->setRelatedElements(cs->as<Ifc4x2::IfcProduct>());
}
void set_children_of_relation(Ifc4x2::IfcRelAggregates* t, IfcEntityList::ptr& cs) {
t->setRelatedObjects(cs->as<Ifc4x2::IfcObjectDefinition>());
}
#endif
#ifdef HAS_SCHEMA_4x3_rc1
Ifc4x3_rc1::IfcObjectDefinition* get_parent_of_relation(Ifc4x3_rc1::IfcRelContainedInSpatialStructure* t) {
return t->RelatingStructure();
}
IfcEntityList::ptr get_children_of_relation(Ifc4x3_rc1::IfcRelContainedInSpatialStructure* t) {
return t->RelatedElements()->generalize();
}
IfcEntityList::ptr get_children_of_relation(Ifc4x3_rc1::IfcRelAggregates* t) { IfcEntityList::ptr get_children_of_relation(Ifc4x3_rc1::IfcRelAggregates* t) {
return t->RelatedObjects()->generalize(); return t->RelatedObjects()->generalize();
} }
void set_children_of_relation(Ifc4x3_rc1::IfcRelContainedInSpatialStructure* t, IfcEntityList::ptr& cs) {
t->setRelatedElements(cs->as<Ifc4x3_rc1::IfcProduct>());
}
void set_children_of_relation(Ifc4x3_rc1::IfcRelAggregates* t, IfcEntityList::ptr& cs) {
t->setRelatedObjects(cs->as<Ifc4x3_rc1::IfcObjectDefinition>());
}
#endif
#ifdef HAS_SCHEMA_4x3_rc2
Ifc4x3_rc2::IfcObjectDefinition* get_parent_of_relation(Ifc4x3_rc2::IfcRelContainedInSpatialStructure* t) {
return t->RelatingStructure();
}
IfcEntityList::ptr get_children_of_relation(Ifc4x3_rc2::IfcRelContainedInSpatialStructure* t) {
return t->RelatedElements()->generalize();
}
IfcEntityList::ptr get_children_of_relation(Ifc4x3_rc2::IfcRelAggregates* t) {
return t->RelatedObjects()->generalize();
}
void set_children_of_relation(Ifc4x3_rc2::IfcRelContainedInSpatialStructure* t, IfcEntityList::ptr& cs) {
t->setRelatedElements(cs->as<Ifc4x3_rc2::IfcProduct>());
}
void set_children_of_relation(Ifc4x3_rc2::IfcRelAggregates* t, IfcEntityList::ptr& cs) {
t->setRelatedObjects(cs->as<Ifc4x3_rc2::IfcObjectDefinition>());
}
#endif
IfcUtil::IfcBaseClass* get_parent_of_relation(IfcUtil::IfcBaseClass* t) {
return *t->data().getArgument(
t->declaration().as_entity()->attribute_index("RelatingObject")
);
}
IfcEntityList::ptr get_children_of_relation(IfcUtil::IfcBaseClass* t) {
return *t->data().getArgument(
t->declaration().as_entity()->attribute_index("RelatedElements")
);
}
void set_children_of_relation(IfcUtil::IfcBaseClass* t, IfcEntityList::ptr& cs) { void set_children_of_relation(IfcUtil::IfcBaseClass* t, IfcEntityList::ptr& cs) {
IfcWrite::IfcWriteArgument* attr = new IfcWrite::IfcWriteArgument; IfcWrite::IfcWriteArgument* attr = new IfcWrite::IfcWriteArgument;
attr->set(cs); attr->set(cs);
@@ -125,46 +209,6 @@ namespace {
attr attr
); );
} }
void set_children_of_relation(Ifc2x3::IfcRelContainedInSpatialStructure* t, IfcEntityList::ptr& cs) {
t->setRelatedElements(cs->as<Ifc2x3::IfcProduct>());
}
void set_children_of_relation(Ifc4::IfcRelContainedInSpatialStructure* t, IfcEntityList::ptr& cs) {
t->setRelatedElements(cs->as<Ifc4::IfcProduct>());
}
void set_children_of_relation(Ifc4x1::IfcRelContainedInSpatialStructure* t, IfcEntityList::ptr& cs) {
t->setRelatedElements(cs->as<Ifc4x1::IfcProduct>());
}
void set_children_of_relation(Ifc4x2::IfcRelContainedInSpatialStructure* t, IfcEntityList::ptr& cs) {
t->setRelatedElements(cs->as<Ifc4x2::IfcProduct>());
}
void set_children_of_relation(Ifc4x3_rc1::IfcRelContainedInSpatialStructure* t, IfcEntityList::ptr& cs) {
t->setRelatedElements(cs->as<Ifc4x3_rc1::IfcProduct>());
}
void set_children_of_relation(Ifc2x3::IfcRelAggregates* t, IfcEntityList::ptr& cs) {
t->setRelatedObjects(cs->as<Ifc2x3::IfcObjectDefinition>());
}
void set_children_of_relation(Ifc4::IfcRelAggregates* t, IfcEntityList::ptr& cs) {
t->setRelatedObjects(cs->as<Ifc4::IfcObjectDefinition>());
}
void set_children_of_relation(Ifc4x1::IfcRelAggregates* t, IfcEntityList::ptr& cs) {
t->setRelatedObjects(cs->as<Ifc4x1::IfcObjectDefinition>());
}
void set_children_of_relation(Ifc4x2::IfcRelAggregates* t, IfcEntityList::ptr& cs) {
t->setRelatedObjects(cs->as<Ifc4x2::IfcObjectDefinition>());
}
void set_children_of_relation(Ifc4x3_rc1::IfcRelAggregates* t, IfcEntityList::ptr& cs) {
t->setRelatedObjects(cs->as<Ifc4x3_rc1::IfcObjectDefinition>());
}
} }
template <typename Schema> template <typename Schema>
class IFC_PARSE_API IfcHierarchyHelper : public IfcParse::IfcFile { class IFC_PARSE_API IfcHierarchyHelper : public IfcParse::IfcFile {
+40
View File
@@ -19,12 +19,24 @@
#include "IfcSIPrefix.h" #include "IfcSIPrefix.h"
#ifdef HAS_SCHEMA_2x3
#include "../ifcparse/Ifc2x3.h" #include "../ifcparse/Ifc2x3.h"
#endif
#ifdef HAS_SCHEMA_4
#include "../ifcparse/Ifc4.h" #include "../ifcparse/Ifc4.h"
#endif
#ifdef HAS_SCHEMA_4x1
#include "../ifcparse/Ifc4x1.h" #include "../ifcparse/Ifc4x1.h"
#endif
#ifdef HAS_SCHEMA_4x2
#include "../ifcparse/Ifc4x2.h" #include "../ifcparse/Ifc4x2.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc1
#include "../ifcparse/Ifc4x3_rc1.h" #include "../ifcparse/Ifc4x3_rc1.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc2
#include "../ifcparse/Ifc4x3_rc2.h" #include "../ifcparse/Ifc4x3_rc2.h"
#endif
double IfcParse::IfcSIPrefixToValue(const std::string& v) { double IfcParse::IfcSIPrefixToValue(const std::string& v) {
if ( v == "EXA" ) return 1.e18; if ( v == "EXA" ) return 1.e18;
@@ -75,17 +87,45 @@ double IfcParse::get_SI_equivalent(typename Schema::IfcNamedUnit* named_unit) {
} }
#if defined(_MSC_VER) && _MSC_VER < 1900 #if defined(_MSC_VER) && _MSC_VER < 1900
#ifdef HAS_SCHEMA_2x3
template double IfcParse::get_SI_equivalent<Ifc2x3>(Ifc2x3::IfcNamedUnit* named_unit); template double IfcParse::get_SI_equivalent<Ifc2x3>(Ifc2x3::IfcNamedUnit* named_unit);
#endif
#ifdef HAS_SCHEMA_4
template double IfcParse::get_SI_equivalent<Ifc4>(Ifc4::IfcNamedUnit* named_unit); template double IfcParse::get_SI_equivalent<Ifc4>(Ifc4::IfcNamedUnit* named_unit);
#endif
#ifdef HAS_SCHEMA_4x1
template double IfcParse::get_SI_equivalent<Ifc4x1>(Ifc4x1::IfcNamedUnit* named_unit); template double IfcParse::get_SI_equivalent<Ifc4x1>(Ifc4x1::IfcNamedUnit* named_unit);
#endif
#ifdef HAS_SCHEMA_4x2
template double IfcParse::get_SI_equivalent<Ifc4x2>(Ifc4x2::IfcNamedUnit* named_unit); template double IfcParse::get_SI_equivalent<Ifc4x2>(Ifc4x2::IfcNamedUnit* named_unit);
#endif
#ifdef HAS_SCHEMA_4x3_rc1
template double IfcParse::get_SI_equivalent<Ifc4x3_rc1>(Ifc4x3_rc1::IfcNamedUnit* named_unit); template double IfcParse::get_SI_equivalent<Ifc4x3_rc1>(Ifc4x3_rc1::IfcNamedUnit* named_unit);
#endif
#ifdef HAS_SCHEMA_4x3_rc2
template double IfcParse::get_SI_equivalent<Ifc4x3_rc2>(Ifc4x3_rc2::IfcNamedUnit* named_unit); template double IfcParse::get_SI_equivalent<Ifc4x3_rc2>(Ifc4x3_rc2::IfcNamedUnit* named_unit);
#endif
#else #else
#ifdef HAS_SCHEMA_2x3
template double IfcParse::get_SI_equivalent<Ifc2x3>(typename Ifc2x3::IfcNamedUnit* named_unit); template double IfcParse::get_SI_equivalent<Ifc2x3>(typename Ifc2x3::IfcNamedUnit* named_unit);
#endif
#ifdef HAS_SCHEMA_4
template double IfcParse::get_SI_equivalent<Ifc4>(typename Ifc4::IfcNamedUnit* named_unit); template double IfcParse::get_SI_equivalent<Ifc4>(typename Ifc4::IfcNamedUnit* named_unit);
#endif
#ifdef HAS_SCHEMA_4x1
template double IfcParse::get_SI_equivalent<Ifc4x1>(typename Ifc4x1::IfcNamedUnit* named_unit); template double IfcParse::get_SI_equivalent<Ifc4x1>(typename Ifc4x1::IfcNamedUnit* named_unit);
#endif
#ifdef HAS_SCHEMA_4x2
template double IfcParse::get_SI_equivalent<Ifc4x2>(typename Ifc4x2::IfcNamedUnit* named_unit); template double IfcParse::get_SI_equivalent<Ifc4x2>(typename Ifc4x2::IfcNamedUnit* named_unit);
#endif
#ifdef HAS_SCHEMA_4x3_rc1
template double IfcParse::get_SI_equivalent<Ifc4x3_rc1>(typename Ifc4x3_rc1::IfcNamedUnit* named_unit); template double IfcParse::get_SI_equivalent<Ifc4x3_rc1>(typename Ifc4x3_rc1::IfcNamedUnit* named_unit);
#endif
#ifdef HAS_SCHEMA_4x3_rc2
template double IfcParse::get_SI_equivalent<Ifc4x3_rc2>(typename Ifc4x3_rc2::IfcNamedUnit* named_unit); template double IfcParse::get_SI_equivalent<Ifc4x3_rc2>(typename Ifc4x3_rc2::IfcNamedUnit* named_unit);
#endif #endif
#endif
+24
View File
@@ -76,21 +76,45 @@ void IfcParse::register_schema(schema_definition* s) {
} }
#ifdef HAS_SCHEMA_2x3
#include "../ifcparse/Ifc2x3.h" #include "../ifcparse/Ifc2x3.h"
#endif
#ifdef HAS_SCHEMA_4
#include "../ifcparse/Ifc4.h" #include "../ifcparse/Ifc4.h"
#endif
#ifdef HAS_SCHEMA_4x1
#include "../ifcparse/Ifc4x1.h" #include "../ifcparse/Ifc4x1.h"
#endif
#ifdef HAS_SCHEMA_4x2
#include "../ifcparse/Ifc4x2.h" #include "../ifcparse/Ifc4x2.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc1
#include "../ifcparse/Ifc4x3_rc1.h" #include "../ifcparse/Ifc4x3_rc1.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc2
#include "../ifcparse/Ifc4x3_rc2.h" #include "../ifcparse/Ifc4x3_rc2.h"
#endif
const IfcParse::schema_definition* IfcParse::schema_by_name(const std::string& name) { const IfcParse::schema_definition* IfcParse::schema_by_name(const std::string& name) {
// TODO: initialize automatically somehow // TODO: initialize automatically somehow
#ifdef HAS_SCHEMA_2x3
Ifc2x3::get_schema(); Ifc2x3::get_schema();
#endif
#ifdef HAS_SCHEMA_4
Ifc4::get_schema(); Ifc4::get_schema();
#endif
#ifdef HAS_SCHEMA_4x1
Ifc4x1::get_schema(); Ifc4x1::get_schema();
#endif
#ifdef HAS_SCHEMA_4x2
Ifc4x2::get_schema(); Ifc4x2::get_schema();
#endif
#ifdef HAS_SCHEMA_4x3_rc1
Ifc4x3_rc1::get_schema(); Ifc4x3_rc1::get_schema();
#endif
#ifdef HAS_SCHEMA_4x3_rc2
Ifc4x3_rc2::get_schema(); Ifc4x3_rc2::get_schema();
#endif
std::map<std::string, const IfcParse::schema_definition*>::const_iterator it = schemas.find(boost::to_upper_copy(name)); std::map<std::string, const IfcParse::schema_definition*>::const_iterator it = schemas.find(boost::to_upper_copy(name));
if (it == schemas.end()) { if (it == schemas.end()) {
+30 -12
View File
@@ -472,21 +472,39 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
%inline %{ %inline %{
static boost::variant<IfcGeom::Element<double>*, IfcGeom::Representation::Representation*> create_shape(IfcGeom::IteratorSettings& settings, IfcUtil::IfcBaseClass* instance, IfcUtil::IfcBaseClass* representation = 0) { static boost::variant<IfcGeom::Element<double>*, IfcGeom::Representation::Representation*> create_shape(IfcGeom::IteratorSettings& settings, IfcUtil::IfcBaseClass* instance, IfcUtil::IfcBaseClass* representation = 0) {
const std::string& schema_name = instance->declaration().schema()->name(); const std::string& schema_name = instance->declaration().schema()->name();
#ifdef HAS_SCHEMA_2x3
if (schema_name == "IFC2X3") { if (schema_name == "IFC2X3") {
return helper_fn_create_shape<Ifc2x3>(settings, instance, representation); return helper_fn_create_shape<Ifc2x3>(settings, instance, representation);
} else if (schema_name == "IFC4") {
return helper_fn_create_shape<Ifc4>(settings, instance, representation);
} else if (schema_name == "IFC4X1") {
return helper_fn_create_shape<Ifc4x1>(settings, instance, representation);
} else if (schema_name == "IFC4X2") {
return helper_fn_create_shape<Ifc4x2>(settings, instance, representation);
} else if (schema_name == "IFC4X3_RC1") {
return helper_fn_create_shape<Ifc4x3_rc1>(settings, instance, representation);
} else if (schema_name == "IFC4X3_RC2") {
return helper_fn_create_shape<Ifc4x3_rc2>(settings, instance, representation);
} else {
throw IfcParse::IfcException("No geometry support for " + schema_name);
} }
#endif
#ifdef HAS_SCHEMA_4
if (schema_name == "IFC4") {
return helper_fn_create_shape<Ifc4>(settings, instance, representation);
}
#endif
#ifdef HAS_SCHEMA_4x1
if (schema_name == "IFC4X1") {
return helper_fn_create_shape<Ifc4x1>(settings, instance, representation);
}
#endif
#ifdef HAS_SCHEMA_4x2
if (schema_name == "IFC4X2") {
return helper_fn_create_shape<Ifc4x2>(settings, instance, representation);
}
#endif
#ifdef HAS_SCHEMA_4x3_rc1
if (schema_name == "IFC4X3_RC1") {
return helper_fn_create_shape<Ifc4x3_rc1>(settings, instance, representation);
}
#endif
#ifdef HAS_SCHEMA_4x3_rc2
if (schema_name == "IFC4X3_RC2") {
return helper_fn_create_shape<Ifc4x3_rc2>(settings, instance, representation);
}
#endif
throw IfcParse::IfcException("No geometry support for " + schema_name);
} }
%} %}
+26
View File
@@ -78,12 +78,25 @@
#include "../ifcgeom_schema_agnostic/Serialization.h" #include "../ifcgeom_schema_agnostic/Serialization.h"
#include "../ifcgeom/IfcGeomTree.h" #include "../ifcgeom/IfcGeomTree.h"
#ifdef HAS_SCHEMA_2x3
#include "../ifcparse/Ifc2x3.h" #include "../ifcparse/Ifc2x3.h"
#endif
#ifdef HAS_SCHEMA_4
#include "../ifcparse/Ifc4.h" #include "../ifcparse/Ifc4.h"
#endif
#ifdef HAS_SCHEMA_4x1
#include "../ifcparse/Ifc4x1.h" #include "../ifcparse/Ifc4x1.h"
#endif
#ifdef HAS_SCHEMA_4x2
#include "../ifcparse/Ifc4x2.h" #include "../ifcparse/Ifc4x2.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc1
#include "../ifcparse/Ifc4x3_rc1.h" #include "../ifcparse/Ifc4x3_rc1.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc2
#include "../ifcparse/Ifc4x3_rc2.h" #include "../ifcparse/Ifc4x3_rc2.h"
#endif
#include "../ifcparse/IfcBaseClass.h" #include "../ifcparse/IfcBaseClass.h"
#include "../ifcparse/IfcFile.h" #include "../ifcparse/IfcFile.h"
#include "../ifcparse/IfcSchema.h" #include "../ifcparse/IfcSchema.h"
@@ -106,12 +119,25 @@
#include "../ifcgeom_schema_agnostic/Serialization.h" #include "../ifcgeom_schema_agnostic/Serialization.h"
#include "../ifcgeom/IfcGeomTree.h" #include "../ifcgeom/IfcGeomTree.h"
#ifdef HAS_SCHEMA_2x3
#include "../ifcparse/Ifc2x3.h" #include "../ifcparse/Ifc2x3.h"
#endif
#ifdef HAS_SCHEMA_4
#include "../ifcparse/Ifc4.h" #include "../ifcparse/Ifc4.h"
#endif
#ifdef HAS_SCHEMA_4x1
#include "../ifcparse/Ifc4x1.h" #include "../ifcparse/Ifc4x1.h"
#endif
#ifdef HAS_SCHEMA_4x2
#include "../ifcparse/Ifc4x2.h" #include "../ifcparse/Ifc4x2.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc1
#include "../ifcparse/Ifc4x3_rc1.h" #include "../ifcparse/Ifc4x3_rc1.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc2
#include "../ifcparse/Ifc4x3_rc2.h" #include "../ifcparse/Ifc4x3_rc2.h"
#endif
#include "../ifcparse/IfcBaseClass.h" #include "../ifcparse/IfcBaseClass.h"
#include "../ifcparse/IfcFile.h" #include "../ifcparse/IfcFile.h"
#include "../ifcparse/IfcSchema.h" #include "../ifcparse/IfcSchema.h"
+26
View File
@@ -1,17 +1,43 @@
#include "XmlSerializer.h" #include "XmlSerializer.h"
#ifdef HAS_SCHEMA_2x3
extern void init_XmlSerializerIfc2x3(XmlSerializerFactory::Factory*); extern void init_XmlSerializerIfc2x3(XmlSerializerFactory::Factory*);
#endif
#ifdef HAS_SCHEMA_4
extern void init_XmlSerializerIfc4(XmlSerializerFactory::Factory*); extern void init_XmlSerializerIfc4(XmlSerializerFactory::Factory*);
#endif
#ifdef HAS_SCHEMA_4x1
extern void init_XmlSerializerIfc4x1(XmlSerializerFactory::Factory*); extern void init_XmlSerializerIfc4x1(XmlSerializerFactory::Factory*);
#endif
#ifdef HAS_SCHEMA_4x2
extern void init_XmlSerializerIfc4x2(XmlSerializerFactory::Factory*); extern void init_XmlSerializerIfc4x2(XmlSerializerFactory::Factory*);
#endif
#ifdef HAS_SCHEMA_4x3_rc1
extern void init_XmlSerializerIfc4x3_rc1(XmlSerializerFactory::Factory*); extern void init_XmlSerializerIfc4x3_rc1(XmlSerializerFactory::Factory*);
#endif
#ifdef HAS_SCHEMA_4x3_rc2
extern void init_XmlSerializerIfc4x3_rc2(XmlSerializerFactory::Factory*);
#endif
XmlSerializerFactory::Factory::Factory() { XmlSerializerFactory::Factory::Factory() {
#ifdef HAS_SCHEMA_2x3
init_XmlSerializerIfc2x3(this); init_XmlSerializerIfc2x3(this);
#endif
#ifdef HAS_SCHEMA_4
init_XmlSerializerIfc4(this); init_XmlSerializerIfc4(this);
#endif
#ifdef HAS_SCHEMA_4x1
init_XmlSerializerIfc4x1(this); init_XmlSerializerIfc4x1(this);
#endif
#ifdef HAS_SCHEMA_4x2
init_XmlSerializerIfc4x2(this); init_XmlSerializerIfc4x2(this);
#endif
#ifdef HAS_SCHEMA_4x3_rc1
init_XmlSerializerIfc4x3_rc1(this); init_XmlSerializerIfc4x3_rc1(this);
#endif
#ifdef HAS_SCHEMA_4x3_rc2
init_XmlSerializerIfc4x3_rc2(this);
#endif
} }
void XmlSerializerFactory::Factory::bind(const std::string& schema_name, fn f) { void XmlSerializerFactory::Factory::bind(const std::string& schema_name, fn f) {