2017-12-19 20:24:00 +01:00
|
|
|
#ifndef ITERATOR_IMPLEMENTATION_H
|
|
|
|
|
#define ITERATOR_IMPLEMENTATION_H
|
|
|
|
|
|
2018-09-07 14:08:56 +02:00
|
|
|
#include "../ifcgeom_schema_agnostic/IfcGeomFilter.h"
|
2017-12-19 20:24:00 +01:00
|
|
|
#include "../ifcparse/IfcFile.h"
|
|
|
|
|
#include "../ifcgeom/IfcGeomIteratorSettings.h"
|
|
|
|
|
|
2018-09-07 14:08:56 +02:00
|
|
|
#include <gp_XYZ.hxx>
|
|
|
|
|
|
2017-12-19 20:24:00 +01:00
|
|
|
#include <boost/function.hpp>
|
|
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
|
#include <string>
|
|
|
|
|
|
2017-12-20 11:10:27 +01:00
|
|
|
namespace IfcGeom {
|
2018-07-07 21:14:27 +02:00
|
|
|
template <typename P, typename PP>
|
2017-12-20 11:10:27 +01:00
|
|
|
class IteratorImplementation;
|
|
|
|
|
|
2018-07-07 21:14:27 +02:00
|
|
|
template <typename P, typename PP>
|
2017-12-20 11:10:27 +01:00
|
|
|
class Element;
|
|
|
|
|
|
2018-07-07 21:14:27 +02:00
|
|
|
template <typename P, typename PP>
|
2017-12-20 11:10:27 +01:00
|
|
|
class BRepElement;
|
|
|
|
|
}
|
2017-12-19 20:24:00 +01:00
|
|
|
|
2019-07-19 15:55:22 +02:00
|
|
|
typedef boost::function4<IfcGeom::IteratorImplementation<float, float>*, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*, const std::vector<IfcGeom::filter_t>&, int> iterator_float_float_fn;
|
|
|
|
|
typedef boost::function4<IfcGeom::IteratorImplementation<float, double>*, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*, const std::vector<IfcGeom::filter_t>&, int> iterator_float_double_fn;
|
|
|
|
|
typedef boost::function4<IfcGeom::IteratorImplementation<double, double>*, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*, const std::vector<IfcGeom::filter_t>&, int> iterator_double_double_fn;
|
2017-12-19 20:24:00 +01:00
|
|
|
|
2018-07-07 21:14:27 +02:00
|
|
|
template <typename P, typename PP>
|
2017-12-19 20:24:00 +01:00
|
|
|
struct get_factory_type {};
|
|
|
|
|
|
|
|
|
|
template <>
|
2018-07-07 21:14:27 +02:00
|
|
|
struct get_factory_type<float, float> {
|
|
|
|
|
typedef iterator_float_float_fn type;
|
2017-12-19 20:24:00 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <>
|
2018-07-07 21:14:27 +02:00
|
|
|
struct get_factory_type<float, double> {
|
|
|
|
|
typedef iterator_float_double_fn type;
|
2017-12-19 20:24:00 +01:00
|
|
|
};
|
|
|
|
|
|
2018-07-07 21:14:27 +02:00
|
|
|
template <>
|
|
|
|
|
struct get_factory_type<double, double> {
|
|
|
|
|
typedef iterator_double_double_fn type;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <typename P, typename PP>
|
|
|
|
|
class IteratorFactoryImplementation : public std::map<std::string, typename get_factory_type<P, PP>::type> {
|
2017-12-19 20:24:00 +01:00
|
|
|
public:
|
|
|
|
|
IteratorFactoryImplementation();
|
2018-07-07 21:14:27 +02:00
|
|
|
void bind(const std::string& schema_name, typename get_factory_type<P, PP>::type fn);
|
2019-07-19 15:55:22 +02:00
|
|
|
IfcGeom::IteratorImplementation<P, PP>* construct(const std::string& schema_name, const IfcGeom::IteratorSettings&, IfcParse::IfcFile*, const std::vector<IfcGeom::filter_t>&, int);
|
2017-12-19 20:24:00 +01:00
|
|
|
};
|
|
|
|
|
|
2018-07-07 21:14:27 +02:00
|
|
|
template <typename P, typename PP>
|
|
|
|
|
IteratorFactoryImplementation<P, PP>& iterator_implementations();
|
2017-12-19 20:24:00 +01:00
|
|
|
|
2017-12-20 11:10:27 +01:00
|
|
|
namespace IfcGeom {
|
2017-12-19 20:24:00 +01:00
|
|
|
|
2018-07-07 21:14:27 +02:00
|
|
|
template <typename P, typename PP>
|
2017-12-20 11:10:27 +01:00
|
|
|
class IteratorImplementation {
|
|
|
|
|
public:
|
|
|
|
|
virtual bool initialize() = 0;
|
2020-02-12 11:38:08 +01:00
|
|
|
virtual void compute_bounds(bool with_geometry) = 0;
|
2018-09-07 14:08:56 +02:00
|
|
|
virtual const gp_XYZ& bounds_min() const = 0;
|
|
|
|
|
virtual const gp_XYZ& bounds_max() const = 0;
|
2017-12-20 11:10:27 +01:00
|
|
|
virtual int progress() const = 0;
|
|
|
|
|
virtual const std::string& getUnitName() const = 0;
|
|
|
|
|
virtual double getUnitMagnitude() const = 0;
|
|
|
|
|
virtual IfcParse::IfcFile* file() const = 0;
|
|
|
|
|
virtual IfcUtil::IfcBaseClass* next() = 0;
|
2018-07-07 21:14:27 +02:00
|
|
|
virtual Element<P, PP>* get() = 0;
|
|
|
|
|
virtual BRepElement<P, PP>* get_native() = 0;
|
|
|
|
|
virtual const Element<P, PP>* get_object(int id) = 0;
|
2017-12-20 11:10:27 +01:00
|
|
|
virtual IfcUtil::IfcBaseClass* create() = 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
2017-12-19 20:24:00 +01:00
|
|
|
|
|
|
|
|
#endif
|