mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 02:47:48 +00:00
Schema dependent serializers
This commit is contained in:
@@ -430,6 +430,10 @@ ElSE()
|
||||
endif()
|
||||
ENDIF()
|
||||
|
||||
if (IFCCONVERT_DOUBLE_PRECISION)
|
||||
SET(CONVERT_PRECISION "-DIFCCONVERT_DOUBLE_PRECISION")
|
||||
endif()
|
||||
|
||||
INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} ${OCC_INCLUDE_DIR} ${OPENCOLLADA_INCLUDE_DIRS}
|
||||
${ICU_INCLUDE_DIR} ${Boost_INCLUDE_DIRS}
|
||||
)
|
||||
@@ -554,7 +558,7 @@ if(NOT MSVC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(IFCOPENSHELL_LIBRARIES IfcParse IfcGeom_ifc2x3 IfcGeom_ifc4 IfcGeom IfcGeom_ifc2x3 IfcGeom_ifc4 IfcGeom Serializers_ifc2x3 Serializers_ifc4 IfcGeom Serializers_ifc2x3 Serializers_ifc4 IfcGeom)
|
||||
set(IFCOPENSHELL_LIBRARIES IfcParse IfcGeom_ifc2x3 IfcGeom_ifc4 IfcGeom IfcGeom_ifc2x3 IfcGeom_ifc4 IfcGeom Serializers_ifc2x3 Serializers_ifc4 Serializers Serializers_ifc2x3 Serializers_ifc4 Serializers)
|
||||
|
||||
# IfcParse
|
||||
file(GLOB IFCPARSE_H_FILES ../src/ifcparse/*.h)
|
||||
@@ -603,15 +607,15 @@ set(SERIALIZERS_S_FILES ${SERIALIZERS_S_H_FILES} ${SERIALIZERS_S_CPP_FILES})
|
||||
add_library(Serializers_ifc2x3 ${SERIALIZERS_S_FILES})
|
||||
add_library(Serializers_ifc4 ${SERIALIZERS_S_FILES})
|
||||
|
||||
set_target_properties(Serializers_ifc2x3 PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS -DIfcSchema=Ifc2x3")
|
||||
set_target_properties(Serializers_ifc2x3 PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS -DIfcSchema=Ifc2x3 ${CONVERT_PRECISION}")
|
||||
# TODO: Detect based on IfcSchema
|
||||
set_target_properties(Serializers_ifc4 PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS -DIfcSchema=Ifc4 -DUSE_IFC4")
|
||||
set_target_properties(Serializers_ifc4 PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS -DIfcSchema=Ifc4 -DUSE_IFC4 ${CONVERT_PRECISION}")
|
||||
|
||||
TARGET_LINK_LIBRARIES(Serializers_ifc2x3 IfcGeom ${OPENCASCADE_LIBRARIES})
|
||||
TARGET_LINK_LIBRARIES(Serializers_ifc4 IfcGeom ${OPENCASCADE_LIBRARIES})
|
||||
|
||||
add_library(Serializers ${SERIALIZERS_FILES})
|
||||
set_target_properties(Serializers PROPERTIES COMPILE_FLAGS -DIFC_GEOM_EXPORTS)
|
||||
set_target_properties(Serializers PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS ${CONVERT_PRECISION}")
|
||||
|
||||
TARGET_LINK_LIBRARIES(Serializers Serializers_ifc2x3 Serializers_ifc4)
|
||||
|
||||
@@ -621,9 +625,7 @@ if(BUILD_CONVERT)
|
||||
file(GLOB IFCCONVERT_H_FILES ../src/ifcconvert/*.h)
|
||||
set(IFCCONVERT_FILES ${IFCCONVERT_CPP_FILES} ${IFCCONVERT_H_FILES})
|
||||
ADD_EXECUTABLE(IfcConvert ${IFCCONVERT_FILES})
|
||||
if (IFCCONVERT_DOUBLE_PRECISION)
|
||||
set_target_properties(IfcConvert PROPERTIES COMPILE_FLAGS -DIFCCONVERT_DOUBLE_PRECISION)
|
||||
endif()
|
||||
set_target_properties(IfcConvert PROPERTIES COMPILE_FLAGS "${CONVERT_PRECISION}")
|
||||
|
||||
TARGET_LINK_LIBRARIES(IfcConvert ${IFCOPENSHELL_LIBRARIES} ${OPENCASCADE_LIBRARIES} ${Boost_LIBRARIES} ${OPENCOLLADA_LIBRARIES} ${ICU_LIBRARIES})
|
||||
if ((NOT WIN32) AND BUILD_SHARED_LIBS)
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
* *
|
||||
********************************************************************************/
|
||||
|
||||
#include "../ifcconvert/ColladaSerializer.h"
|
||||
#include "../ifcconvert/IgesSerializer.h"
|
||||
#include "../ifcconvert/StepSerializer.h"
|
||||
#include "../ifcconvert/WavefrontObjSerializer.h"
|
||||
#include "../ifcconvert/SvgSerializer.h"
|
||||
#include "../serializers/ColladaSerializer.h"
|
||||
#include "../serializers/IgesSerializer.h"
|
||||
#include "../serializers/StepSerializer.h"
|
||||
#include "../serializers/WavefrontObjSerializer.h"
|
||||
#include "../serializers/SvgSerializer.h"
|
||||
|
||||
#include "../ifcgeom_schema_agnostic/IfcGeomIterator.h"
|
||||
|
||||
|
||||
@@ -12,17 +12,17 @@
|
||||
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
namespace IfcGeom {
|
||||
|
||||
namespace impl {
|
||||
// LayerAssignments renamed from plural to singular, LayerAssignment, so work around that
|
||||
IfcEntityList::ptr getLayerAssignments(Ifc2x3::IfcRepresentationItem* item) {
|
||||
return item->LayerAssignments()->generalize();
|
||||
}
|
||||
IfcEntityList::ptr getLayerAssignments(Ifc4::IfcRepresentationItem* item) {
|
||||
return item->LayerAssignment()->generalize();
|
||||
}
|
||||
namespace {
|
||||
// LayerAssignments renamed from plural to singular, LayerAssignment, so work around that
|
||||
IfcEntityList::ptr getLayerAssignments(Ifc2x3::IfcRepresentationItem* item) {
|
||||
return item->LayerAssignments()->generalize();
|
||||
}
|
||||
IfcEntityList::ptr getLayerAssignments(Ifc4::IfcRepresentationItem* item) {
|
||||
return item->LayerAssignment()->generalize();
|
||||
}
|
||||
}
|
||||
|
||||
namespace IfcGeom {
|
||||
|
||||
template <typename T>
|
||||
class BRepElement;
|
||||
@@ -110,7 +110,7 @@ namespace IfcGeom {
|
||||
|
||||
Schema::IfcRepresentationItem::list::ptr items = r->as<Schema::IfcRepresentationItem>();
|
||||
for (Schema::IfcRepresentationItem::list::it it = items->begin(); it != items->end(); ++it) {
|
||||
Schema::IfcPresentationLayerAssignment::list::ptr a = impl::getLayerAssignments(*it)->as<Schema::IfcPresentationLayerAssignment>();
|
||||
Schema::IfcPresentationLayerAssignment::list::ptr a = getLayerAssignments(*it)->as<Schema::IfcPresentationLayerAssignment>();
|
||||
for (Schema::IfcPresentationLayerAssignment::list::it jt = a->begin(); jt != a->end(); ++jt) {
|
||||
layers[(*jt)->Name()] = *jt;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
#include "../ifcgeom_schema_agnostic/IfcGeomIterator.h"
|
||||
|
||||
#include "../ifcconvert/GeometrySerializer.h"
|
||||
#include "../serializers/GeometrySerializer.h"
|
||||
|
||||
#include <boost/numeric/ublas/matrix.hpp>
|
||||
#include <boost/numeric/ublas/io.hpp>
|
||||
@@ -86,7 +86,7 @@ private:
|
||||
const std::string scene_id;
|
||||
bool scene_opened;
|
||||
std::stack<COLLADASW::Node*> parentNodes;
|
||||
std::stack<IfcGeom::Transformation<double> > matrixStack;
|
||||
std::stack<IfcGeom::Transformation<real_t> > matrixStack;
|
||||
public:
|
||||
ColladaScene(const std::string& scene_id, COLLADASW::StreamWriter& stream, ColladaSerializer *_serializer)
|
||||
: COLLADASW::LibraryVisualScenes(&stream)
|
||||
|
||||
@@ -26,7 +26,7 @@ typedef double real_t;
|
||||
typedef float real_t;
|
||||
#endif
|
||||
|
||||
#include "../ifcconvert/Serializer.h"
|
||||
#include "../serializers/Serializer.h"
|
||||
#include "../ifcgeom_schema_agnostic/IfcGeomIterator.h"
|
||||
#include "../ifcgeom/IfcGeomElement.h"
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "../ifcgeom_schema_agnostic/IfcGeomIterator.h"
|
||||
|
||||
#include "../ifcconvert/GeometrySerializer.h"
|
||||
#include "../serializers/GeometrySerializer.h"
|
||||
|
||||
class OpenCascadeBasedSerializer : public GeometrySerializer {
|
||||
OpenCascadeBasedSerializer(const OpenCascadeBasedSerializer&); //N/A
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include "../ifcgeom_schema_agnostic/IfcGeomIterator.h"
|
||||
|
||||
#include "../ifcconvert/OpenCascadeBasedSerializer.h"
|
||||
#include "../serializers/OpenCascadeBasedSerializer.h"
|
||||
|
||||
class StepSerializer : public OpenCascadeBasedSerializer
|
||||
{
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
#ifndef SVGSERIALIZER_H
|
||||
#define SVGSERIALIZER_H
|
||||
|
||||
#include "../ifcconvert/GeometrySerializer.h"
|
||||
#include "../ifcconvert/util.h"
|
||||
#include "../serializers/GeometrySerializer.h"
|
||||
#include "../serializers/util.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
|
||||
#include "../ifcconvert/GeometrySerializer.h"
|
||||
#include "../serializers/GeometrySerializer.h"
|
||||
|
||||
// http://people.sc.fsu.edu/~jburkardt/txt/obj_format.txt
|
||||
class WaveFrontOBJSerializer : public GeometrySerializer {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <set>
|
||||
#include <iostream>
|
||||
|
||||
#include "../ifcconvert/util.h"
|
||||
#include "../serializers/util.h"
|
||||
|
||||
using namespace util;
|
||||
|
||||
Reference in New Issue
Block a user