mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-05 23:41:44 +00:00
98 lines
4.2 KiB
C++
98 lines
4.2 KiB
C++
/********************************************************************************
|
|
* *
|
|
* 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 <http://www.gnu.org/licenses/>. *
|
|
* *
|
|
********************************************************************************/
|
|
|
|
#ifndef ABSTRACT_MAPPING_H
|
|
#define ABSTRACT_MAPPING_H
|
|
|
|
#include "../ifcparse/IfcBaseClass.h"
|
|
#include "../ifcparse/IfcLogger.h"
|
|
#include "../ifcparse/aggregate_of_instance.h"
|
|
#include "../ifcgeom/taxonomy.h"
|
|
#include "../ifcgeom/ConversionSettings.h"
|
|
|
|
#include <boost/function.hpp>
|
|
|
|
#include <map>
|
|
#include <string>
|
|
#include <tuple>
|
|
|
|
namespace ifcopenshell {
|
|
|
|
namespace geometry {
|
|
|
|
struct IFC_GEOM_API geometry_conversion_task {
|
|
int index;
|
|
IfcUtil::IfcBaseEntity* representation;
|
|
aggregate_of_instance::ptr products;
|
|
};
|
|
|
|
typedef boost::function<bool(IfcUtil::IfcBaseEntity*)> filter_t;
|
|
|
|
class IFC_GEOM_API abstract_mapping {
|
|
protected:
|
|
Settings settings_;
|
|
Logger& logger_;
|
|
|
|
bool use_caching_ = true;
|
|
|
|
public:
|
|
abstract_mapping(Settings& s, Logger& logger = Logger::Root()) : settings_(s), logger_(logger) {}
|
|
virtual ~abstract_mapping() {}
|
|
|
|
virtual ifcopenshell::geometry::taxonomy::ptr map(const IfcUtil::IfcBaseInterface*) = 0;
|
|
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;
|
|
virtual std::map<std::string, IfcUtil::IfcBaseEntity*> get_layers(IfcUtil::IfcBaseEntity*) = 0;
|
|
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;
|
|
virtual const IfcUtil::IfcBaseEntity* get_single_material_association(const IfcUtil::IfcBaseEntity*) = 0;
|
|
virtual double get_length_unit() const = 0;
|
|
virtual const std::string& get_length_unit_name() const = 0;
|
|
virtual IfcUtil::IfcBaseEntity* representation_of(const IfcUtil::IfcBaseEntity* product) = 0;
|
|
|
|
const Settings& settings() const { return settings_; }
|
|
Settings& settings() { return settings_; }
|
|
Logger& logger() const { return logger_; }
|
|
|
|
bool use_caching() const { return use_caching_; }
|
|
bool& use_caching() { return use_caching_; }
|
|
};
|
|
|
|
namespace impl {
|
|
typedef boost::function3<abstract_mapping*, IfcParse::IfcFile*, Settings&, Logger&> mapping_fn;
|
|
|
|
class IFC_GEOM_API MappingFactoryImplementation : public std::map<std::string, mapping_fn> {
|
|
public:
|
|
MappingFactoryImplementation();
|
|
void bind(const std::string& schema_name, mapping_fn);
|
|
abstract_mapping* construct(IfcParse::IfcFile*, Settings&, Logger& logger = Logger::Root());
|
|
};
|
|
|
|
IFC_GEOM_API MappingFactoryImplementation& mapping_implementations();
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|