mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
Continue work on plug-in and tests
This commit is contained in:
@@ -18,44 +18,6 @@
|
||||
********************************************************************************/
|
||||
|
||||
#include "si_prefix.h"
|
||||
#include "instance_data.h"
|
||||
|
||||
#ifdef HAS_SCHEMA_2x3
|
||||
#include "schemas/Ifc2x3.h"
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4
|
||||
#include "schemas/Ifc4.h"
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x1
|
||||
#include "schemas/Ifc4x1.h"
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x2
|
||||
#include "schemas/Ifc4x2.h"
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_rc1
|
||||
#include "schemas/Ifc4x3_rc1.h"
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_rc2
|
||||
#include "schemas/Ifc4x3_rc2.h"
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_rc3
|
||||
#include "schemas/Ifc4x3_rc3.h"
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_rc4
|
||||
#include "schemas/Ifc4x3_rc4.h"
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3
|
||||
#include "schemas/Ifc4x3.h"
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_tc1
|
||||
#include "schemas/Ifc4x3_tc1.h"
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_add1
|
||||
#include "schemas/Ifc4x3_add1.h"
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_add2
|
||||
#include "schemas/Ifc4x3_add2.h"
|
||||
#endif
|
||||
|
||||
double ifcopenshell::si_prefix_to_value(const std::string& prefix) {
|
||||
if (prefix == "EXA") {
|
||||
@@ -108,109 +70,3 @@ double ifcopenshell::si_prefix_to_value(const std::string& prefix) {
|
||||
}
|
||||
return 1.;
|
||||
}
|
||||
|
||||
template <typename Schema>
|
||||
double ifcopenshell::get_SI_equivalent(const typename Schema::IfcNamedUnit& named_unit) {
|
||||
double scale = 1.;
|
||||
typename Schema::IfcSIUnit si_unit;
|
||||
|
||||
if (auto conv_unit = named_unit.template as<typename Schema::IfcConversionBasedUnit>()) {
|
||||
auto factor = conv_unit.ConversionFactor();
|
||||
auto component = factor.UnitComponent();
|
||||
if (si_unit = component.concrete().template as<typename Schema::IfcSIUnit>()) {
|
||||
auto value = factor.ValueComponent();
|
||||
scale = value.get_attribute_value(0);
|
||||
}
|
||||
} else {
|
||||
si_unit = named_unit.template as<typename Schema::IfcSIUnit>();
|
||||
}
|
||||
if (si_unit) {
|
||||
if (si_unit.Prefix()) {
|
||||
scale *= si_prefix_to_value(Schema::IfcSIPrefix::ToString(*si_unit.Prefix()));
|
||||
}
|
||||
} else {
|
||||
scale = 0.;
|
||||
}
|
||||
|
||||
return scale;
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
|
||||
#ifdef HAS_SCHEMA_2x3
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc2x3>(const Ifc2x3::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc4>(const Ifc4::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x1
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc4x1>(const Ifc4x1::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x2
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc4x2>(const Ifc4x2::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_rc1
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc4x3_rc1>(const Ifc4x3_rc1::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_rc2
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc4x3_rc2>(const Ifc4x3_rc2::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_rc3
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc4x3_rc3>(const Ifc4x3_rc3::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_rc4
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc4x3_rc4>(const Ifc4x3_rc4::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc4x3>(const Ifc4x3::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_tc1
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc4x3_tc1>(const Ifc4x3_tc1::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_add1
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc4x3_add1>(const Ifc4x3_add1::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_add2
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc4x3_add2>(const Ifc4x3_add2::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifdef HAS_SCHEMA_2x3
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc2x3>(const typename Ifc2x3::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc4>(const typename Ifc4::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x1
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc4x1>(const typename Ifc4x1::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x2
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc4x2>(const typename Ifc4x2::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_rc1
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc4x3_rc1>(const typename Ifc4x3_rc1::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_rc2
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc4x3_rc2>(const typename Ifc4x3_rc2::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_rc3
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc4x3_rc3>(const typename Ifc4x3_rc3::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_rc4
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc4x3_rc4>(const typename Ifc4x3_rc4::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc4x3>(const typename Ifc4x3::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_tc1
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc4x3_tc1>(const typename Ifc4x3_tc1::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_add1
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc4x3_add1>(const typename Ifc4x3_add1::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
#ifdef HAS_SCHEMA_4x3_add2
|
||||
template double IFC_PARSE_API ifcopenshell::get_SI_equivalent<Ifc4x3_add2>(const typename Ifc4x3_add2::IfcNamedUnit& named_unit);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user