mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 10:06:47 +00:00
Fixes for 4.3 compilation
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
// Disable warnings coming from IfcOpenShell
|
||||
#pragma warning(disable : 4018 4267 4250 4984 4985)
|
||||
|
||||
#include "../ifcparse/Ifc4x3_add2.h"
|
||||
#include "../ifcparse/schemas/Ifc4x3_add2.h"
|
||||
#include "../ifcparse/hierarchy_helper.h"
|
||||
|
||||
#include <boost/math/constants/constants.hpp>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
// Disable warnings coming from IfcOpenShell
|
||||
#pragma warning(disable : 4018 4267 4250 4984 4985)
|
||||
|
||||
#include "../ifcparse/Ifc4x3_add2.h"
|
||||
#include "../ifcparse/schemas/Ifc4x3_add2.h"
|
||||
#include "../ifcparse/alignment_helper.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
@@ -258,12 +258,12 @@ class curve_segment_evaluator {
|
||||
}
|
||||
if (s == inst) {
|
||||
emit_next = true;
|
||||
} else {
|
||||
logger_.warning("GEO", 242, "IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the next segment.");
|
||||
}
|
||||
} else {
|
||||
mapping_->logger().warning("GEO", 242, "IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the next segment.");
|
||||
}
|
||||
} else {
|
||||
::logger::root().warning("IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the next segment.");
|
||||
logger_.warning("IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the next segment.");
|
||||
}
|
||||
|
||||
bool is_horizontal = false;
|
||||
@@ -283,7 +283,7 @@ class curve_segment_evaluator {
|
||||
if ((is_horizontal + is_vertical + is_cant) != 1) {
|
||||
// We have to choose the correct functor based on usage. We can't
|
||||
// support multiple, because we don't know the caller at this point.
|
||||
mapping_->logger().error("UNS", 10, std::runtime_error("multiple uses of IfcSegmentCurve not supported"), inst_);
|
||||
logger_.error("UNS", 10, std::runtime_error("multiple uses of IfcSegmentCurve not supported"), inst_);
|
||||
}
|
||||
|
||||
segment_type_ = is_horizontal ? ST_HORIZONTAL : is_vertical ? ST_VERTICAL : is_cant ? ST_CANT : ST_HORIZONTAL;
|
||||
@@ -321,7 +321,7 @@ class curve_segment_evaluator {
|
||||
end_point = segmented_reference_curve.EndPoint();
|
||||
}
|
||||
} else {
|
||||
mapping_->logger().warning("GEO", 243, "IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the end point.");
|
||||
logger_.warning("GEO", 243, "IfcCurveSegment belongs to multiple IfcCompositeCurve instances. Cannot determine the end point.");
|
||||
}
|
||||
if (end_point) {
|
||||
next_segment_placement_ = taxonomy::cast<taxonomy::matrix4>(mapping_->map(end_point))->ccomponents();
|
||||
@@ -343,7 +343,7 @@ class curve_segment_evaluator {
|
||||
|
||||
taxonomy::ptr get_segment_curve_function() {
|
||||
if (!parent_curve_fn_ || !parent_curve_start_point_) {
|
||||
mapping_->logger().error("UNS", 11, std::runtime_error(inst_->ParentCurve()->declaration().name() + " not implemented"), inst_);
|
||||
mapping_->logger().error("UNS", 11, std::runtime_error(inst_.ParentCurve().declaration().name() + " not implemented"), inst_);
|
||||
}
|
||||
|
||||
auto length = fabs(this->length());
|
||||
@@ -860,8 +860,6 @@ class curve_segment_evaluator {
|
||||
|
||||
auto sign_l = sign(length_);
|
||||
|
||||
auto sign_l = sign(length_);
|
||||
|
||||
// center point of the parent curve
|
||||
auto pcCenterX = parent_curve_position(0, 3);
|
||||
auto pcCenterY = parent_curve_position(1, 3);
|
||||
|
||||
@@ -3,19 +3,34 @@
|
||||
add_executable(test_ifcopenshell_geometry
|
||||
test_ifcopenshell_geometry.cpp
|
||||
)
|
||||
if(NOT TARGET parse_schema_ifc2x3)
|
||||
message(FATAL_ERROR "test_ifcopenshell_geometry requires SCHEMA_VERSIONS to include 2x3.")
|
||||
list(GET SCHEMA_VERSIONS -1 IFCGEOM_TEST_SCHEMA_VERSION)
|
||||
set(IFCGEOM_TEST_SCHEMA_TARGET parse_schema_ifc${IFCGEOM_TEST_SCHEMA_VERSION})
|
||||
set(IFCGEOM_TEST_MAPPING_TARGET geometry_mapping_ifc${IFCGEOM_TEST_SCHEMA_VERSION})
|
||||
if(NOT TARGET ${IFCGEOM_TEST_SCHEMA_TARGET})
|
||||
message(FATAL_ERROR "test_ifcopenshell_geometry requires ${IFCGEOM_TEST_SCHEMA_TARGET}.")
|
||||
endif()
|
||||
if(NOT TARGET ${IFCGEOM_TEST_MAPPING_TARGET})
|
||||
message(FATAL_ERROR "test_ifcopenshell_geometry requires ${IFCGEOM_TEST_MAPPING_TARGET}.")
|
||||
endif()
|
||||
target_include_directories(test_ifcopenshell_geometry PRIVATE "${CMAKE_SOURCE_DIR}/../src")
|
||||
target_link_libraries(test_ifcopenshell_geometry PRIVATE Catch2::Catch2WithMain IfcGeom IfcParse parse_schema_ifc2x3)
|
||||
add_dependencies(test_ifcopenshell_geometry geometry_mapping_ifc2x3 geometry_kernel_passthrough)
|
||||
target_compile_definitions(test_ifcopenshell_geometry PRIVATE
|
||||
IfcSchema=Ifc${IFCGEOM_TEST_SCHEMA_VERSION}
|
||||
"IFCGEOM_TEST_SCHEMA_HEADER=\"ifcparse/schemas/Ifc${IFCGEOM_TEST_SCHEMA_VERSION}.h\""
|
||||
)
|
||||
target_link_libraries(test_ifcopenshell_geometry PRIVATE
|
||||
Catch2::Catch2WithMain
|
||||
IfcGeom
|
||||
IfcParse
|
||||
${IFCGEOM_TEST_SCHEMA_TARGET}
|
||||
)
|
||||
add_dependencies(test_ifcopenshell_geometry ${IFCGEOM_TEST_MAPPING_TARGET} geometry_kernel_passthrough)
|
||||
catch_discover_tests(test_ifcopenshell_geometry
|
||||
DL_PATHS
|
||||
$<TARGET_FILE_DIR:Catch2::Catch2>
|
||||
$<TARGET_FILE_DIR:Catch2::Catch2WithMain>
|
||||
$<TARGET_FILE_DIR:IfcGeom>
|
||||
$<TARGET_FILE_DIR:IfcParse>
|
||||
$<TARGET_FILE_DIR:parse_schema_ifc2x3>
|
||||
$<TARGET_FILE_DIR:${IFCGEOM_TEST_SCHEMA_TARGET}>
|
||||
$<TARGET_FILE_DIR:plugin>
|
||||
# Catch2 discovery uses DL_PATHS in order; CTest PATH prepends reverse it.
|
||||
$<TARGET_FILE_DIR:IfcGeom>
|
||||
|
||||
@@ -6,10 +6,9 @@
|
||||
|
||||
#include "ifcgeom/Converter.h"
|
||||
#include "ifcgeom/kernel_registry.h"
|
||||
#define IfcSchema Ifc2x3
|
||||
#include "ifcparse/hierarchy_helper.h"
|
||||
#include "ifcparse/macros.h"
|
||||
#include "ifcparse/schemas/Ifc2x3.h"
|
||||
#include IFCGEOM_TEST_SCHEMA_HEADER
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
@@ -488,7 +488,7 @@ Ifc4x3_add2::IfcAlignment addAlignment(hierarchy_helper<Ifc4x3_add2>& file, cons
|
||||
return alignment;
|
||||
}
|
||||
|
||||
std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignmentSegment(hierarchy_helper<Ifc4x3_add2>& file, const Ifc4x3_add2::IfcAlignmentSegment& segment) {
|
||||
std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignmentSegment(hierarchy_helper<Ifc4x3_add2>& file, const Ifc4x3_add2::IfcAlignmentSegment& segment, logger& logger) {
|
||||
std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> result;
|
||||
auto design_parameters = segment.DesignParameters();
|
||||
auto horizontal = design_parameters.as<Ifc4x3_add2::IfcAlignmentHorizontalSegment>();
|
||||
@@ -501,7 +501,7 @@ std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignme
|
||||
} else if (cant) {
|
||||
result = mapAlignmentCantSegment(file, cant);
|
||||
} else {
|
||||
::logger::root().error(std::string("Unexpected IfcAlignmentSegment subtype encountered"));
|
||||
logger.error(std::string("Unexpected IfcAlignmentSegment subtype encountered"));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -514,7 +514,7 @@ Ifc4x3_add2::IfcLengthMeasure create_length(hierarchy_helper<Ifc4x3_add2>& file,
|
||||
}
|
||||
}
|
||||
|
||||
std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignmentHorizontalSegment(hierarchy_helper<Ifc4x3_add2>& file, const Ifc4x3_add2::IfcAlignmentHorizontalSegment& segment) {
|
||||
std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignmentHorizontalSegment(hierarchy_helper<Ifc4x3_add2>& file, const Ifc4x3_add2::IfcAlignmentHorizontalSegment& segment, logger& logger) {
|
||||
std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> result;
|
||||
auto start_point = segment.StartPoint();
|
||||
auto start_direction = segment.StartDirection();
|
||||
@@ -762,15 +762,15 @@ std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignme
|
||||
|
||||
result.first = curve_segment;
|
||||
} else if (type == Ifc4x3_add2::IfcAlignmentHorizontalSegmentTypeEnum::IfcAlignmentHorizontalSegmentType_VIENNESEBEND) {
|
||||
::logger::root().warning(std::string("mapping of AlignmentHorizontalSegmentType VIENNESEBEND not supported"));
|
||||
logger.warning(std::string("mapping of AlignmentHorizontalSegmentType VIENNESEBEND not supported"));
|
||||
} else {
|
||||
::logger::root().error(std::string("unexpected AlignmentHorizontalSegmentType encountered"));
|
||||
logger.error(std::string("unexpected AlignmentHorizontalSegmentType encountered"));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignmentVerticalSegment(hierarchy_helper<Ifc4x3_add2>& file, const Ifc4x3_add2::IfcAlignmentVerticalSegment& segment) {
|
||||
std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignmentVerticalSegment(hierarchy_helper<Ifc4x3_add2>& file, const Ifc4x3_add2::IfcAlignmentVerticalSegment& segment, logger& logger) {
|
||||
std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> result;
|
||||
auto start_distance_along = segment.StartDistAlong();
|
||||
auto horizontal_length = segment.HorizontalLength();
|
||||
@@ -830,7 +830,7 @@ std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignme
|
||||
|
||||
result.first = curve_segment;
|
||||
} else if (type == Ifc4x3_add2::IfcAlignmentVerticalSegmentTypeEnum::IfcAlignmentVerticalSegmentType_CLOTHOID) {
|
||||
::logger::root().warning(std::string("mapping of AlignmentVerticalSegmentType CLOTHOID not supported"));
|
||||
logger.warning(std::string("mapping of AlignmentVerticalSegmentType CLOTHOID not supported"));
|
||||
} else if (type == Ifc4x3_add2::IfcAlignmentVerticalSegmentTypeEnum::IfcAlignmentVerticalSegmentType_CIRCULARARC) {
|
||||
auto start_angle = atan(start_gradient);
|
||||
auto end_angle = atan(end_gradient);
|
||||
@@ -856,31 +856,31 @@ std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignme
|
||||
|
||||
result.first = curve_segment;
|
||||
} else {
|
||||
::logger::root().error(std::string("unexpected AlignmentVerticalSegmentType encountered"));
|
||||
logger.error(std::string("unexpected AlignmentVerticalSegmentType encountered"));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignmentCantSegment(hierarchy_helper<Ifc4x3_add2>& file, const Ifc4x3_add2::IfcAlignmentCantSegment& segment) {
|
||||
std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> mapAlignmentCantSegment(hierarchy_helper<Ifc4x3_add2>& file, const Ifc4x3_add2::IfcAlignmentCantSegment& segment, logger& logger) {
|
||||
std::pair<Ifc4x3_add2::IfcCurveSegment, Ifc4x3_add2::IfcCurveSegment> result;
|
||||
auto type = segment.PredefinedType();
|
||||
if (type == Ifc4x3_add2::IfcAlignmentCantSegmentTypeEnum::IfcAlignmentCantSegmentType_BLOSSCURVE) {
|
||||
::logger::root().warning(std::string("mapping of AlignmentCantSegmentType BLOSSCURVE not supported"));
|
||||
logger.warning(std::string("mapping of AlignmentCantSegmentType BLOSSCURVE not supported"));
|
||||
} else if (type == Ifc4x3_add2::IfcAlignmentCantSegmentTypeEnum::IfcAlignmentCantSegmentType_CONSTANTCANT) {
|
||||
::logger::root().warning(std::string("mapping of AlignmentCantSegmentType CONSTANTCANT not supported"));
|
||||
logger.warning(std::string("mapping of AlignmentCantSegmentType CONSTANTCANT not supported"));
|
||||
} else if (type == Ifc4x3_add2::IfcAlignmentCantSegmentTypeEnum::IfcAlignmentCantSegmentType_COSINECURVE) {
|
||||
::logger::root().warning(std::string("mapping of AlignmentCantSegmentType COSINECURVE not supported"));
|
||||
logger.warning(std::string("mapping of AlignmentCantSegmentType COSINECURVE not supported"));
|
||||
} else if (type == Ifc4x3_add2::IfcAlignmentCantSegmentTypeEnum::IfcAlignmentCantSegmentType_HELMERTCURVE) {
|
||||
::logger::root().warning(std::string("mapping of AlignmentCantSegmentType HELMERTCURVE not supported"));
|
||||
logger.warning(std::string("mapping of AlignmentCantSegmentType HELMERTCURVE not supported"));
|
||||
} else if (type == Ifc4x3_add2::IfcAlignmentCantSegmentTypeEnum::IfcAlignmentCantSegmentType_LINEARTRANSITION) {
|
||||
::logger::root().warning(std::string("mapping of AlignmentCantSegmentType LINEARTRANSTION not supported"));
|
||||
logger.warning(std::string("mapping of AlignmentCantSegmentType LINEARTRANSTION not supported"));
|
||||
} else if (type == Ifc4x3_add2::IfcAlignmentCantSegmentTypeEnum::IfcAlignmentCantSegmentType_SINECURVE) {
|
||||
::logger::root().warning(std::string("mapping of AlignmentCantSegmentType SINECURVE not supported"));
|
||||
logger.warning(std::string("mapping of AlignmentCantSegmentType SINECURVE not supported"));
|
||||
} else if (type == Ifc4x3_add2::IfcAlignmentCantSegmentTypeEnum::IfcAlignmentCantSegmentType_VIENNESEBEND) {
|
||||
::logger::root().warning(std::string("mapping of AlignmentCantSegmentType VIENNESEBEND not supported"));
|
||||
logger.warning(std::string("mapping of AlignmentCantSegmentType VIENNESEBEND not supported"));
|
||||
} else {
|
||||
::logger::root().error(std::string("unexpected AlignmentCantSegmentType encountered"));
|
||||
logger.error(std::string("unexpected AlignmentCantSegmentType encountered"));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user