diff --git a/src/ifcgeom/kernels/cgal/CgalKernel.h b/src/ifcgeom/kernels/cgal/CgalKernel.h index d3b2703606..541c07e465 100644 --- a/src/ifcgeom/kernels/cgal/CgalKernel.h +++ b/src/ifcgeom/kernels/cgal/CgalKernel.h @@ -44,9 +44,6 @@ if ( it != cache.T.end() ) { e = it->second; return true; } #include "../../../ifcgeom/schema_agnostic/IfcGeomElement.h" #include "../../../ifcgeom/kernels/cgal/CgalConversionResult.h" -// @todo create separate shapetype enum? -#include "../../../ifcgeom/kernels/opencascade/IfcGeomShapeType.h" - struct PolyhedronBuilder : public CGAL::Modifier_base::HalfedgeDS> { private: std::list *face_list; diff --git a/src/ifcgeom/kernels/opencascade/IfcGeomShapeType.h b/src/ifcgeom/kernels/opencascade/IfcGeomShapeType.h deleted file mode 100644 index 3d2c11233a..0000000000 --- a/src/ifcgeom/kernels/opencascade/IfcGeomShapeType.h +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************** -* * -* This file is part of IfcOpenShell. * -* * -* IfcOpenShell is free software: you can redistribute it and/or modify * -* it under the terms of the Lesser GNU General Public License as published by * -* the Free Software Foundation, either version 3.0 of the License, or * -* (at your option) any later version. * -* * -* IfcOpenShell is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* Lesser GNU General Public License for more details. * -* * -* You should have received a copy of the Lesser GNU General Public License * -* along with this program. If not, see . * -* * -********************************************************************************/ - -#ifndef IFCGEOMSHAPETYPE_H -#define IFCGEOMSHAPETYPE_H - -namespace IfcGeom { - - enum ShapeType { - ST_SHAPELIST, - ST_SHAPE, - ST_FACE, - ST_WIRE, - ST_CURVE, - ST_EDGE, - ST_VERTEX, - ST_OTHER - }; - -} - -#endif \ No newline at end of file diff --git a/src/ifcgeom/kernels/opencascade/IfcRegister.cpp_ b/src/ifcgeom/kernels/opencascade/IfcRegister.cpp_ deleted file mode 100644 index 35b6baedcf..0000000000 --- a/src/ifcgeom/kernels/opencascade/IfcRegister.cpp_ +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************** -* * -* This file is part of IfcOpenShell. * -* * -* IfcOpenShell is free software: you can redistribute it and/or modify * -* it under the terms of the Lesser GNU General Public License as published by * -* the Free Software Foundation, either version 3.0 of the License, or * -* (at your option) any later version. * -* * -* IfcOpenShell is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* Lesser GNU General Public License for more details. * -* * -* You should have received a copy of the Lesser GNU General Public License * -* along with this program. If not, see . * -* * -********************************************************************************/ - -#include "IfcGeom.h" -#include "IfcGeomShapeType.h" - -#define Kernel POSTFIX_SCHEMA(Kernel) - -using namespace IfcUtil; - -bool IfcGeom::Kernel::convert_shapes(const IfcBaseClass* l, ConversionResults& r) { - if (shape_type(l) != ST_SHAPELIST) { - TopoDS_Shape shp; - if (convert_shape(l, shp)) { - r.push_back(IfcGeom::ConversionResult(l->data().id(), new OpenCascadeShape(shp), get_style(l->as()))); - return true; - } - return false; - } - -#include "IfcRegisterConvertShapes.h" - Logger::Message(Logger::LOG_ERROR,"No operation defined for:",l); - return false; -} - -IfcGeom::ShapeType IfcGeom::Kernel::shape_type(const IfcBaseClass* l) { -#include "IfcRegisterShapeType.h" - return ST_OTHER; -} - -bool IfcGeom::Kernel::convert_shape(const IfcBaseClass* l, TopoDS_Shape& r) { - const unsigned int id = l->data().id(); - bool success = false; - bool processed = false; - bool ignored = false; - -#ifndef NO_CACHE - std::map::const_iterator it = cache.Shape.find(id); - if ( it != cache.Shape.end() ) { r = it->second; return true; } -#endif - const bool include_curves = getValue(GV_DIMENSIONALITY) != +1; - const bool include_solids_and_surfaces = getValue(GV_DIMENSIONALITY) != -1; - - IfcGeom::ShapeType st = shape_type(l); - ignored = (!include_solids_and_surfaces && (st == ST_SHAPE || st == ST_FACE)) || (!include_curves && (st == ST_WIRE || st == ST_CURVE)); - if (st == ST_SHAPELIST) { - processed = true; - ConversionResults items; - success = convert_shapes(l, items) && flatten_shape_list(items, r, false); - } else if (st == ST_SHAPE && include_solids_and_surfaces) { -#include "IfcRegisterConvertShape.h" - } else if (st == ST_FACE && include_solids_and_surfaces) { - processed = true; - success = convert_face(l, r); - } else if (st == ST_WIRE && include_curves) { - processed = true; - TopoDS_Wire w; - success = convert_wire(l, w); - if (success) { - r = w; - } - } else if (st == ST_CURVE && include_curves) { - processed = true; - Handle(Geom_Curve) crv; - TopoDS_Wire w; - success = convert_curve(l, crv) && convert_curve_to_wire(crv, w); - if (success) { - r = w; - } - } - - if ( processed && success ) { - const double precision = getValue(GV_PRECISION); - apply_tolerance(r, precision); -#ifndef NO_CACHE - cache.Shape[id] = r; -#endif - } else if (!ignored) { - const char* const msg = processed - ? "Failed to convert:" - : "No operation defined for:"; - Logger::Message(Logger::LOG_ERROR, msg, l); - } - return success; -} - -bool IfcGeom::Kernel::convert_wire(const IfcBaseClass* l, TopoDS_Wire& r) { -#include "IfcRegisterConvertWire.h" - Handle(Geom_Curve) curve; - if (IfcGeom::Kernel::convert_curve(l, curve)) { - return IfcGeom::Kernel::convert_curve_to_wire(curve, r); - } - Logger::Message(Logger::LOG_ERROR,"No operation defined for:",l); - return false; -} - -bool IfcGeom::Kernel::convert_face(const IfcBaseClass* l, TopoDS_Shape& r) { -#include "IfcRegisterConvertFace.h" - Logger::Message(Logger::LOG_ERROR,"No operation defined for:",l); - return false; -} - -bool IfcGeom::Kernel::convert_curve(const IfcBaseClass* l, Handle(Geom_Curve)& r) { -#include "IfcRegisterConvertCurve.h" - Logger::Message(Logger::LOG_ERROR,"No operation defined for:",l); - return false; -} \ No newline at end of file diff --git a/src/ifcgeom/kernels/opencascade/IfcRegister.h b/src/ifcgeom/kernels/opencascade/IfcRegister.h deleted file mode 100644 index 7993242f50..0000000000 --- a/src/ifcgeom/kernels/opencascade/IfcRegister.h +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************** -* * -* This file is part of IfcOpenShell. * -* * -* IfcOpenShell is free software: you can redistribute it and/or modify * -* it under the terms of the Lesser GNU General Public License as published by * -* the Free Software Foundation, either version 3.0 of the License, or * -* (at your option) any later version. * -* * -* IfcOpenShell is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* Lesser GNU General Public License for more details. * -* * -* You should have received a copy of the Lesser GNU General Public License * -* along with this program. If not, see . * -* * -********************************************************************************/ - -/******************************************************************************** - * * - * This file registers function prototypes for all supported IFC geometrical * - * entities. For entities of type CLASS an std::map is also created to cache * - * the output of the conversion functions * - * * - ********************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../../../ifcparse/IfcBaseClass.h" -#include "../../../ifcparse/IfcParse.h" - -SHAPES(IfcShellBasedSurfaceModel); -SHAPES(IfcFaceBasedSurfaceModel); -SHAPES(IfcRepresentation); -SHAPES(IfcMappedItem); -// IfcFacetedBrep included -// IfcAdvancedBrep included -// IfcFacetedBrepWithVoids included -// IfcAdvancedBrepWithVoids included -SHAPES(IfcManifoldSolidBrep); -SHAPES(IfcGeometricSet); - -#ifdef SCHEMA_HAS_IfcCylindricalSurface -SHAPE(IfcCylindricalSurface); -#endif -#ifdef SCHEMA_HAS_IfcAdvancedBrep -SHAPE(IfcAdvancedBrep); -#endif -// FIXME: Surfaces should have a shape type of their own -#ifdef SCHEMA_HAS_IfcBSplineSurfaceWithKnots -SHAPE(IfcBSplineSurfaceWithKnots); -#endif -#ifdef SCHEMA_HAS_IfcTriangulatedFaceSet -SHAPE(IfcTriangulatedFaceSet); -#endif -#ifdef SCHEMA_HAS_IfcExtrudedAreaSolidTapered -SHAPE(IfcExtrudedAreaSolidTapered); -#endif -SHAPE(IfcPlane); -SHAPE(IfcExtrudedAreaSolid); -SHAPE(IfcRevolvedAreaSolid); -SHAPE(IfcConnectedFaceSet); -SHAPE(IfcBooleanResult); -SHAPE(IfcPolygonalBoundedHalfSpace); -SHAPE(IfcHalfSpaceSolid); -// FIXME: Surfaces should have a shape type of their own -SHAPE(IfcSurfaceOfLinearExtrusion); -SHAPE(IfcSurfaceOfRevolution); -SHAPE(IfcBlock); -SHAPE(IfcRectangularPyramid); -SHAPE(IfcRightCircularCylinder); -SHAPE(IfcRightCircularCone); -SHAPE(IfcSphere); -SHAPE(IfcCsgSolid); -SHAPE(IfcCurveBoundedPlane); -SHAPE(IfcRectangularTrimmedSurface); -SHAPE(IfcSurfaceCurveSweptAreaSolid); -SHAPE(IfcSweptDiskSolid); - -FACE(IfcArbitraryProfileDefWithVoids); -FACE(IfcArbitraryClosedProfileDef); -FACE(IfcRoundedRectangleProfileDef); -FACE(IfcRectangleHollowProfileDef); -FACE(IfcRectangleProfileDef); -FACE(IfcTrapeziumProfileDef) -FACE(IfcCShapeProfileDef); -// IfcAsymmetricIShapeProfileDef included -FACE(IfcIShapeProfileDef); -FACE(IfcLShapeProfileDef); -FACE(IfcTShapeProfileDef); -FACE(IfcUShapeProfileDef); -FACE(IfcZShapeProfileDef); -FACE(IfcCircleHollowProfileDef); -FACE(IfcCircleProfileDef); -FACE(IfcEllipseProfileDef); -FACE(IfcCenterLineProfileDef); -FACE(IfcCompositeProfileDef); -FACE(IfcDerivedProfileDef); -// IfcFaceSurface included -// IfcAdvancedFace included in case of IFC4 -FACE(IfcFace); - -WIRE(IfcEdgeCurve); -WIRE(IfcSubedge); -WIRE(IfcOrientedEdge); -WIRE(IfcEdge); -WIRE(IfcEdgeLoop); -WIRE(IfcPolyline); -WIRE(IfcPolyLoop); -WIRE(IfcCompositeCurve); -WIRE(IfcTrimmedCurve); -WIRE(IfcArbitraryOpenProfileDef); -#ifdef SCHEMA_HAS_IfcIndexedPolyCurve -WIRE(IfcIndexedPolyCurve) -#endif - -CURVE(IfcCircle); -CURVE(IfcEllipse); -CURVE(IfcLine); -#ifdef SCHEMA_HAS_IfcBSplineCurveWithKnots -// IfcRationalBSplineCurveWithKnots included -CURVE(IfcBSplineCurveWithKnots); -#endif - -CLASS(IfcCartesianPoint,gp_Pnt); -CLASS(IfcDirection,gp_Dir); -CLASS(IfcAxis2Placement2D,gp_Trsf2d); -CLASS(IfcAxis2Placement3D,gp_Trsf); -CLASS(IfcAxis1Placement,gp_Ax1); -CLASS(IfcCartesianTransformationOperator2DnonUniform,gp_GTrsf2d); -CLASS(IfcCartesianTransformationOperator3DnonUniform,gp_GTrsf); -CLASS(IfcCartesianTransformationOperator2D,gp_Trsf2d); -CLASS(IfcCartesianTransformationOperator3D,gp_Trsf); -CLASS(IfcObjectPlacement,gp_Trsf); -CLASS(IfcVector,gp_Vec); -CLASS(IfcPlane,gp_Pln); \ No newline at end of file diff --git a/src/ifcgeom/kernels/opencascade/IfcRegisterConvertCurve.h b/src/ifcgeom/kernels/opencascade/IfcRegisterConvertCurve.h deleted file mode 100644 index 4b32b4dcbf..0000000000 --- a/src/ifcgeom/kernels/opencascade/IfcRegisterConvertCurve.h +++ /dev/null @@ -1,6 +0,0 @@ -#include "IfcRegisterUndef.h" -#define CURVE(T) \ - if ( l->declaration().is(IfcSchema::T::Class()) ) return convert((IfcSchema::T*)l,r); -#include "IfcRegisterDef.h" - -#include "IfcRegister.h" \ No newline at end of file diff --git a/src/ifcgeom/kernels/opencascade/IfcRegisterConvertFace.h b/src/ifcgeom/kernels/opencascade/IfcRegisterConvertFace.h deleted file mode 100644 index 90b631667e..0000000000 --- a/src/ifcgeom/kernels/opencascade/IfcRegisterConvertFace.h +++ /dev/null @@ -1,6 +0,0 @@ -#include "IfcRegisterUndef.h" -#define FACE(T) \ - if ( l->declaration().is(IfcSchema::T::Class()) ) return convert((IfcSchema::T*)l,r); -#include "IfcRegisterDef.h" - -#include "IfcRegister.h" \ No newline at end of file diff --git a/src/ifcgeom/kernels/opencascade/IfcRegisterConvertShape.h b/src/ifcgeom/kernels/opencascade/IfcRegisterConvertShape.h deleted file mode 100644 index 36e573eeb9..0000000000 --- a/src/ifcgeom/kernels/opencascade/IfcRegisterConvertShape.h +++ /dev/null @@ -1,26 +0,0 @@ -#include "IfcRegisterUndef.h" -#define SHAPE(T) \ - if ( !processed && l->declaration().is(IfcSchema::T::Class()) ) { \ - processed = true; \ - try { \ - if ( convert((IfcSchema::T*)l,r) ) { \ - success = true; \ - } \ - } catch (const std::exception& e) { \ - Logger::Message(Logger::LOG_ERROR, std::string(e.what()) + "\nFailed to convert:", l); \ - return false; \ - } catch (const Standard_Failure& f) { \ - if (f.GetMessageString() && strlen(f.GetMessageString())) \ - Logger::Message(Logger::LOG_ERROR, std::string("Error in: ") + f.GetMessageString() + "\nFailed to convert:", l); \ - else \ - Logger::Message(Logger::LOG_ERROR, "Failed to convert:", l); \ - return false; \ - } \ - if (!success) { \ - Logger::Message(Logger::LOG_ERROR,"Failed to convert:",l); \ - return false; \ - } \ - } -#include "IfcRegisterDef.h" - -#include "IfcRegister.h" \ No newline at end of file diff --git a/src/ifcgeom/kernels/opencascade/IfcRegisterConvertShapes.h b/src/ifcgeom/kernels/opencascade/IfcRegisterConvertShapes.h deleted file mode 100644 index 1613b1f1fb..0000000000 --- a/src/ifcgeom/kernels/opencascade/IfcRegisterConvertShapes.h +++ /dev/null @@ -1,18 +0,0 @@ -#include "IfcRegisterUndef.h" -#define SHAPES(T) \ - if ( l->declaration().is(IfcSchema::T::Class()) ) { \ - try { \ - return convert((IfcSchema::T*)l,r); \ - } catch (const std::exception& e) { \ - Logger::Message(Logger::LOG_ERROR, std::string(e.what()) + "\nFailed to convert:", l); \ - } catch (const Standard_Failure& f) { \ - if (f.GetMessageString()) \ - Logger::Message(Logger::LOG_ERROR, std::string("Error in: ") + f.GetMessageString() + "\nFailed to convert:", l); \ - else \ - Logger::Message(Logger::LOG_ERROR, "Failed to convert:", l); \ - } \ - return false; \ - } -#include "IfcRegisterDef.h" - -#include "IfcRegister.h" \ No newline at end of file diff --git a/src/ifcgeom/kernels/opencascade/IfcRegisterConvertWire.h b/src/ifcgeom/kernels/opencascade/IfcRegisterConvertWire.h deleted file mode 100644 index fab25fac84..0000000000 --- a/src/ifcgeom/kernels/opencascade/IfcRegisterConvertWire.h +++ /dev/null @@ -1,6 +0,0 @@ -#include "IfcRegisterUndef.h" -#define WIRE(T) \ - if ( l->declaration().is(IfcSchema::T::Class()) ) return convert((IfcSchema::T*)l,r); -#include "IfcRegisterDef.h" - -#include "IfcRegister.h" \ No newline at end of file diff --git a/src/ifcgeom/kernels/opencascade/IfcRegisterCreateCache.h b/src/ifcgeom/kernels/opencascade/IfcRegisterCreateCache.h deleted file mode 100644 index c1425d071f..0000000000 --- a/src/ifcgeom/kernels/opencascade/IfcRegisterCreateCache.h +++ /dev/null @@ -1,6 +0,0 @@ -#include "IfcRegisterUndef.h" -#define CLASS(T,V) \ - std::map T; -#include "IfcRegisterDef.h" - -#include "IfcRegister.h" \ No newline at end of file diff --git a/src/ifcgeom/kernels/opencascade/IfcRegisterDef.h b/src/ifcgeom/kernels/opencascade/IfcRegisterDef.h deleted file mode 100644 index 65f8704a81..0000000000 --- a/src/ifcgeom/kernels/opencascade/IfcRegisterDef.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef SHAPES -#define SHAPES(T) -#endif -#ifndef SHAPE -#define SHAPE(T) -#endif -#ifndef WIRE -#define WIRE(T) -#endif -#ifndef FACE -#define FACE(T) -#endif -#ifndef CURVE -#define CURVE(T) -#endif -#ifndef CLASS -#define CLASS(T,V) -#endif \ No newline at end of file diff --git a/src/ifcgeom/kernels/opencascade/IfcRegisterGeomHeader.h b/src/ifcgeom/kernels/opencascade/IfcRegisterGeomHeader.h deleted file mode 100644 index 51286f3693..0000000000 --- a/src/ifcgeom/kernels/opencascade/IfcRegisterGeomHeader.h +++ /dev/null @@ -1,10 +0,0 @@ -#include "IfcRegisterUndef.h" -#define CLASS(T,V) bool convert(const IfcSchema::T* L, V& r); -#define SHAPES(T) CLASS(T,ConversionResults) -#define SHAPE(T) CLASS(T,TopoDS_Shape) -#define WIRE(T) CLASS(T,TopoDS_Wire) -#define FACE(T) CLASS(T,TopoDS_Shape) -#define CURVE(T) CLASS(T,Handle(Geom_Curve)) -#include "IfcRegisterDef.h" - -#include "IfcRegister.h" \ No newline at end of file diff --git a/src/ifcgeom/kernels/opencascade/IfcRegisterPurgeCache.h b/src/ifcgeom/kernels/opencascade/IfcRegisterPurgeCache.h deleted file mode 100644 index 1afa070943..0000000000 --- a/src/ifcgeom/kernels/opencascade/IfcRegisterPurgeCache.h +++ /dev/null @@ -1,6 +0,0 @@ -#include "IfcRegisterUndef.h" -#define CLASS(T,V) \ - T.clear(); -#include "IfcRegisterDef.h" - -#include "IfcRegister.h" \ No newline at end of file diff --git a/src/ifcgeom/kernels/opencascade/IfcRegisterShapeType.h b/src/ifcgeom/kernels/opencascade/IfcRegisterShapeType.h deleted file mode 100644 index a0185a0279..0000000000 --- a/src/ifcgeom/kernels/opencascade/IfcRegisterShapeType.h +++ /dev/null @@ -1,14 +0,0 @@ -#include "IfcRegisterUndef.h" -#define SHAPES(T) \ - if ( l->declaration().is(IfcSchema::T::Class()) ) return ST_SHAPELIST; -#define SHAPE(T) \ - if ( l->declaration().is(IfcSchema::T::Class()) ) return ST_SHAPE; -#define WIRE(T) \ - if ( l->declaration().is(IfcSchema::T::Class()) ) return ST_WIRE; -#define FACE(T) \ - if ( l->declaration().is(IfcSchema::T::Class()) ) return ST_FACE; -#define CURVE(T) \ - if ( l->declaration().is(IfcSchema::T::Class()) ) return ST_CURVE; -#include "IfcRegisterDef.h" - -#include "IfcRegister.h" \ No newline at end of file diff --git a/src/ifcgeom/kernels/opencascade/IfcRegisterUndef.h b/src/ifcgeom/kernels/opencascade/IfcRegisterUndef.h deleted file mode 100644 index d2d537a073..0000000000 --- a/src/ifcgeom/kernels/opencascade/IfcRegisterUndef.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifdef SHAPES -#undef SHAPES -#endif -#ifdef SHAPE -#undef SHAPE -#endif -#ifdef WIRE -#undef WIRE -#endif -#ifdef FACE -#undef FACE -#endif -#ifdef CURVE -#undef CURVE -#endif -#ifdef CLASS -#undef CLASS -#endif \ No newline at end of file diff --git a/src/ifcgeom/kernels/opencascade/OpenCascadeKernel.h b/src/ifcgeom/kernels/opencascade/OpenCascadeKernel.h index e4872fbfd0..9120036799 100644 --- a/src/ifcgeom/kernels/opencascade/OpenCascadeKernel.h +++ b/src/ifcgeom/kernels/opencascade/OpenCascadeKernel.h @@ -46,7 +46,6 @@ #include "../../../ifcgeom/schema_agnostic/IfcGeomElement.h" #include "../../../ifcgeom/schema_agnostic/IfcGeomRepresentation.h" #include "../../../ifcgeom/schema_agnostic/ConversionResult.h" -#include "../../../ifcgeom/kernels/opencascade/IfcGeomShapeType.h" #include "../../../ifcgeom/kernels/opencascade/OpenCascadeConversionResult.h"