2017-12-22 17:37:58 +01:00
|
|
|
#include "Serialization.h"
|
|
|
|
|
|
|
|
|
|
#include <boost/algorithm/string/case_conv.hpp>
|
|
|
|
|
|
2022-07-17 21:13:46 +02:00
|
|
|
#include <boost/preprocessor/stringize.hpp>
|
|
|
|
|
#include <boost/preprocessor/seq/for_each.hpp>
|
|
|
|
|
#include <boost/algorithm/string/case_conv.hpp>
|
|
|
|
|
|
2026-01-04 10:40:02 +01:00
|
|
|
#include "../../ifcparse/IfcFile.h"
|
|
|
|
|
|
2022-07-17 21:13:46 +02:00
|
|
|
#define EXTERNAL_DEFS_1(r, data, elem) \
|
2026-01-04 10:40:02 +01:00
|
|
|
express::Base BOOST_PP_CAT(tesselate_Ifc, elem)(IfcParse::IfcFile&, const TopoDS_Shape& shape, double deflection);
|
2022-07-17 21:13:46 +02:00
|
|
|
|
|
|
|
|
#define EXTERNAL_DEFS_2(r, data, elem) \
|
2026-01-04 10:40:02 +01:00
|
|
|
express::Base BOOST_PP_CAT(serialise_Ifc, elem)(IfcParse::IfcFile&, const TopoDS_Shape& shape, bool advanced);
|
2022-07-17 21:13:46 +02:00
|
|
|
|
|
|
|
|
#define CONDITIONAL_CALL(r, data, elem) \
|
|
|
|
|
if (schema_name_lower == BOOST_PP_STRINGIZE(BOOST_PP_CAT(elem,))) { \
|
2026-01-04 10:40:02 +01:00
|
|
|
return BOOST_PP_CAT(METHOD_NAME, elem)(f, shape, arg_2); \
|
2022-07-17 21:13:46 +02:00
|
|
|
}
|
|
|
|
|
|
2023-03-21 20:15:01 +01:00
|
|
|
BOOST_PP_SEQ_FOR_EACH(EXTERNAL_DEFS_1, , SCHEMA_SEQ);
|
|
|
|
|
BOOST_PP_SEQ_FOR_EACH(EXTERNAL_DEFS_2, , SCHEMA_SEQ);
|
2017-12-22 17:37:58 +01:00
|
|
|
|
2022-07-18 10:46:01 +02:00
|
|
|
#define METHOD_NAME tesselate_Ifc
|
2022-07-17 21:13:46 +02:00
|
|
|
|
2026-01-04 10:40:02 +01:00
|
|
|
express::Base IfcGeom::tesselate(IfcParse::IfcFile& f, const TopoDS_Shape& shape, double arg_2) {
|
|
|
|
|
auto schema_name = f.schema()->name();
|
|
|
|
|
|
2020-04-08 15:04:17 +02:00
|
|
|
// @todo an ugly hack to guarantee schemas are initialised.
|
2026-01-04 10:40:02 +01:00
|
|
|
// @todo is this still needed? parsing a file should have initialized the schemas already.
|
2020-04-08 15:04:17 +02:00
|
|
|
try {
|
|
|
|
|
IfcParse::schema_by_name("IFC2X3");
|
|
|
|
|
} catch (IfcParse::IfcException&) {}
|
|
|
|
|
|
2022-07-17 21:13:46 +02:00
|
|
|
const std::string schema_name_lower = boost::to_lower_copy(schema_name.substr(3));
|
2020-04-08 15:04:17 +02:00
|
|
|
|
2022-07-17 21:13:46 +02:00
|
|
|
BOOST_PP_SEQ_FOR_EACH(CONDITIONAL_CALL, , SCHEMA_SEQ);
|
2021-05-11 22:29:16 +02:00
|
|
|
|
|
|
|
|
throw IfcParse::IfcException("No geometry serialization available for " + schema_name);
|
2017-12-22 17:37:58 +01:00
|
|
|
}
|
|
|
|
|
|
2022-07-17 21:13:46 +02:00
|
|
|
#undef METHOD_NAME
|
2022-07-18 10:46:01 +02:00
|
|
|
#define METHOD_NAME serialise_Ifc
|
2017-12-22 17:37:58 +01:00
|
|
|
|
2026-01-04 10:40:02 +01:00
|
|
|
express::Base IfcGeom::serialise(IfcParse::IfcFile& f, const TopoDS_Shape& shape, bool arg_2) {
|
|
|
|
|
auto schema_name = f.schema()->name();
|
|
|
|
|
|
2022-07-17 21:13:46 +02:00
|
|
|
// @todo an ugly hack to guarantee schemas are initialised.
|
|
|
|
|
try {
|
|
|
|
|
IfcParse::schema_by_name("IFC2X3");
|
|
|
|
|
} catch (IfcParse::IfcException&) {}
|
|
|
|
|
|
|
|
|
|
const std::string schema_name_lower = boost::to_lower_copy(schema_name.substr(3));
|
|
|
|
|
|
|
|
|
|
BOOST_PP_SEQ_FOR_EACH(CONDITIONAL_CALL, , SCHEMA_SEQ);
|
|
|
|
|
|
|
|
|
|
throw IfcParse::IfcException("No geometry serialization available for " + schema_name);
|
2017-12-22 17:37:58 +01:00
|
|
|
}
|