2017-12-20 16:38:55 +01:00
|
|
|
#ifndef ITERATOR_KERNEL_H
|
|
|
|
|
#define ITERATOR_KERNEL_H
|
|
|
|
|
|
2017-12-22 13:51:11 +01:00
|
|
|
#include "../ifcparse/IfcFile.h"
|
|
|
|
|
#include "../ifcgeom/IfcGeomIteratorSettings.h"
|
|
|
|
|
#include "../ifcgeom/IfcRepresentationShapeItem.h"
|
|
|
|
|
|
2018-03-04 10:44:09 +01:00
|
|
|
#include "../ifcparse/Ifc2x3.h"
|
|
|
|
|
#include "../ifcparse/Ifc4.h"
|
|
|
|
|
|
2017-12-22 13:51:11 +01:00
|
|
|
#include <boost/function.hpp>
|
|
|
|
|
|
|
|
|
|
#include <TopExp_Explorer.hxx>
|
|
|
|
|
|
2018-03-16 13:49:11 +01:00
|
|
|
namespace IfcGeom {
|
2018-03-04 10:44:09 +01:00
|
|
|
|
2018-07-07 21:14:27 +02:00
|
|
|
template <typename P, typename PP>
|
2017-12-22 13:51:11 +01:00
|
|
|
class BRepElement;
|
|
|
|
|
|
2017-12-20 16:38:55 +01:00
|
|
|
class Kernel {
|
2017-12-22 13:51:11 +01:00
|
|
|
private:
|
|
|
|
|
Kernel* implementation_;
|
|
|
|
|
|
2017-12-20 16:38:55 +01:00
|
|
|
public:
|
|
|
|
|
// Tolerances and settings for various geometrical operations:
|
|
|
|
|
enum GeomValue {
|
|
|
|
|
// Specifies the deflection of the mesher
|
|
|
|
|
// Default: 0.001m / 1mm
|
|
|
|
|
GV_DEFLECTION_TOLERANCE,
|
|
|
|
|
// Specifies the minimal area of a face to be included in an IfcConnectedFaceset
|
|
|
|
|
// Read-only
|
|
|
|
|
GV_MINIMAL_FACE_AREA,
|
2018-09-07 14:42:15 +02:00
|
|
|
// Specifies the threshold distance under which cartesian points are deemed equal
|
2019-05-24 14:29:21 +02:00
|
|
|
// Read-only
|
2017-12-20 16:38:55 +01:00
|
|
|
GV_POINT_EQUALITY_TOLERANCE,
|
2019-05-24 14:29:21 +02:00
|
|
|
// Specifies maximum number of faces for a shell to be reoriented.
|
|
|
|
|
// Default: -1
|
|
|
|
|
GV_MAX_FACES_TO_ORIENT,
|
2017-12-20 16:38:55 +01:00
|
|
|
// The length unit used the creation of TopoDS_Shapes, primarily affects the
|
|
|
|
|
// interpretation of IfcCartesianPoints and IfcVector magnitudes
|
|
|
|
|
// DefaultL 1.0
|
|
|
|
|
GV_LENGTH_UNIT,
|
|
|
|
|
// The plane angle unit used for the creation of TopoDS_Shapes, primarily affects
|
|
|
|
|
// the interpretation of IfcParamaterValues of IfcTrimmedCurves
|
|
|
|
|
// Default: -1.0 (= not set, fist try degrees, then radians)
|
|
|
|
|
GV_PLANEANGLE_UNIT,
|
|
|
|
|
// The precision used in boolean operations, setting this value too low results
|
|
|
|
|
// in artefacts and potentially modelling failures
|
|
|
|
|
// Default: 0.00001 (obtained from IfcGeometricRepresentationContext if available)
|
|
|
|
|
GV_PRECISION,
|
|
|
|
|
// Whether to process shapes of type Face or higher (1) Wire or lower (-1) or all (0)
|
2020-06-07 20:23:00 +02:00
|
|
|
GV_DIMENSIONALITY,
|
|
|
|
|
GV_LAYERSET_FIRST
|
2017-12-20 16:38:55 +01:00
|
|
|
};
|
2017-12-22 13:51:11 +01:00
|
|
|
|
|
|
|
|
Kernel(IfcParse::IfcFile* file_ = 0);
|
2017-12-20 16:38:55 +01:00
|
|
|
|
|
|
|
|
virtual ~Kernel() {}
|
2017-12-22 13:51:11 +01:00
|
|
|
|
|
|
|
|
virtual void setValue(GeomValue var, double value) {
|
|
|
|
|
implementation_->setValue(var, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual double getValue(GeomValue var) const {
|
|
|
|
|
return implementation_->getValue(var);
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-07 21:14:27 +02:00
|
|
|
virtual BRepElement<double, double>* convert(
|
2017-12-22 13:51:11 +01:00
|
|
|
const IteratorSettings& settings, IfcUtil::IfcBaseClass* representation,
|
|
|
|
|
IfcUtil::IfcBaseClass* product)
|
|
|
|
|
{
|
|
|
|
|
return implementation_->convert(settings, representation, product);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual IfcRepresentationShapeItems convert(IfcUtil::IfcBaseClass* item) {
|
|
|
|
|
return implementation_->convert(item);
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-19 14:05:19 +02:00
|
|
|
virtual bool convert_placement(IfcUtil::IfcBaseClass* item, gp_Trsf& trsf) {
|
|
|
|
|
return implementation_->convert_placement(item, trsf);
|
2018-03-04 10:44:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-12-10 11:33:54 +01:00
|
|
|
static int count(const TopoDS_Shape&, TopAbs_ShapeEnum, bool unique=false);
|
2018-12-12 12:33:09 +01:00
|
|
|
static int surface_genus(const TopoDS_Shape&);
|
2018-03-04 10:44:09 +01:00
|
|
|
|
2018-11-02 16:10:06 +01:00
|
|
|
static bool is_manifold(const TopoDS_Shape& a);
|
2019-03-24 14:26:14 +01:00
|
|
|
static IfcUtil::IfcBaseEntity* get_decomposing_entity(IfcUtil::IfcBaseEntity*, bool include_openings=true);
|
2018-09-07 14:08:56 +02:00
|
|
|
static std::map<std::string, IfcUtil::IfcBaseEntity*> get_layers(IfcUtil::IfcBaseEntity*);
|
2017-12-20 16:38:55 +01:00
|
|
|
};
|
2017-12-22 13:51:11 +01:00
|
|
|
|
|
|
|
|
namespace impl {
|
|
|
|
|
typedef boost::function1<Kernel*, IfcParse::IfcFile*> kernel_fn;
|
|
|
|
|
|
|
|
|
|
class KernelFactoryImplementation : public std::map<std::string, kernel_fn> {
|
|
|
|
|
public:
|
|
|
|
|
KernelFactoryImplementation();
|
|
|
|
|
void bind(const std::string& schema_name, kernel_fn);
|
|
|
|
|
Kernel* construct(const std::string& schema_name, IfcParse::IfcFile*);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
KernelFactoryImplementation& kernel_implementations();
|
|
|
|
|
}
|
2017-12-20 16:38:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|