Files
IfcOpenShell/src/ifcgeom/abstract_mapping.h
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

74 lines
2.5 KiB
C++
Raw Normal View History

2019-08-16 17:40:13 +02:00
#ifndef ABSTRACT_MAPPING_H
#define ABSTRACT_MAPPING_H
2019-08-04 09:36:31 +02:00
#include "../ifcparse/IfcBaseClass.h"
2023-03-21 20:15:01 +01:00
#include "../ifcparse/aggregate_of_instance.h"
2019-08-04 09:36:31 +02:00
#include "../ifcgeom/taxonomy.h"
2023-03-21 20:15:01 +01:00
#include "../ifcgeom/IteratorSettings.h"
#include "../ifcgeom/ConversionSettings.h"
2019-08-16 17:40:13 +02:00
#include <boost/function.hpp>
#include <map>
#include <string>
2023-03-21 20:15:01 +01:00
#include <tuple>
2019-08-04 09:36:31 +02:00
namespace ifcopenshell {
namespace geometry {
2019-08-16 17:40:13 +02:00
struct geometry_conversion_task {
int index;
IfcUtil::IfcBaseEntity* representation;
2023-03-21 20:15:01 +01:00
aggregate_of_instance::ptr products;
2019-08-16 17:40:13 +02:00
};
typedef boost::function<bool(IfcUtil::IfcBaseEntity*)> filter_t;
2019-08-04 09:36:31 +02:00
class abstract_mapping {
2019-10-06 19:03:31 +02:00
protected:
2023-11-15 10:32:20 +01:00
Settings settings_;
bool use_caching_ = true;
2019-08-04 09:36:31 +02:00
public:
2023-11-15 10:32:20 +01:00
abstract_mapping(Settings& s) : settings_(s) {}
2019-10-06 19:03:31 +02:00
virtual ifcopenshell::geometry::taxonomy::ptr map(const IfcUtil::IfcBaseInterface*) = 0;
2023-03-21 20:15:01 +01:00
virtual void get_representations(std::vector<geometry_conversion_task>& tasks, std::vector<filter_t>& filters) = 0;
virtual IfcUtil::IfcBaseEntity* get_decomposing_entity(const IfcUtil::IfcBaseEntity* product, bool include_openings = true) = 0;
2019-08-18 14:31:22 +02:00
virtual std::map<std::string, IfcUtil::IfcBaseEntity*> get_layers(IfcUtil::IfcBaseEntity*) = 0;
2023-03-21 20:15:01 +01:00
virtual aggregate_of_instance::ptr find_openings(const IfcUtil::IfcBaseEntity*) = 0;
virtual void initialize_settings() = 0;
virtual bool get_layerset_information(const IfcUtil::IfcBaseInterface*, layerset_information&, int&) = 0;
virtual bool get_wall_neighbours(const IfcUtil::IfcBaseInterface*, std::vector<endpoint_connection>&) = 0;
virtual const IfcUtil::IfcBaseEntity* get_product_type(const IfcUtil::IfcBaseEntity*) = 0;
2023-03-21 20:15:01 +01:00
virtual const IfcUtil::IfcBaseEntity* get_single_material_association(const IfcUtil::IfcBaseEntity*) = 0;
virtual double get_length_unit() const = 0;
virtual IfcUtil::IfcBaseEntity* representation_of(const IfcUtil::IfcBaseEntity* product) = 0;
2023-11-15 10:32:20 +01:00
const Settings& settings() const { return settings_; }
2024-04-29 21:03:33 +02:00
Settings& settings() { return settings_; }
bool use_caching() const { return use_caching_; }
bool& use_caching() { return use_caching_; }
2019-08-04 09:36:31 +02:00
};
2019-08-16 17:40:13 +02:00
namespace impl {
2023-11-15 10:32:20 +01:00
typedef boost::function2<abstract_mapping*, IfcParse::IfcFile*, Settings&> mapping_fn;
2019-08-16 17:40:13 +02:00
class MappingFactoryImplementation : public std::map<std::string, mapping_fn> {
public:
MappingFactoryImplementation();
void bind(const std::string& schema_name, mapping_fn);
2023-11-15 10:32:20 +01:00
abstract_mapping* construct(IfcParse::IfcFile*, Settings&);
2019-08-16 17:40:13 +02:00
};
MappingFactoryImplementation& mapping_implementations();
}
2019-08-04 09:36:31 +02:00
}
2019-08-16 17:40:13 +02:00
}
#endif