mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 22:11:36 +00:00
Work towards v1.0 data model with encapsulated weak_ptr as basis for instances
This commit is contained in:
@@ -29,35 +29,35 @@ namespace geometry {
|
||||
std::mutex cache_guard_; // provides mutually exclusive access to cache_
|
||||
|
||||
const IfcParse::declaration* placement_rel_to_type_;
|
||||
const IfcUtil::IfcBaseEntity* placement_rel_to_instance_;
|
||||
const express::Base placement_rel_to_instance_;
|
||||
|
||||
Eigen::Matrix4d offset_and_rotation_ = Eigen::Matrix4d::Identity();
|
||||
|
||||
void initialize_units_();
|
||||
void addRepresentationsFromContextIds(IfcSchema::IfcRepresentation::list::ptr&);
|
||||
void addRepresentationsFromDefaultContexts(IfcSchema::IfcRepresentation::list::ptr&);
|
||||
void addRepresentationsFromContextIds(std::vector<IfcSchema::IfcRepresentation>&);
|
||||
void addRepresentationsFromDefaultContexts(std::vector<IfcSchema::IfcRepresentation>&);
|
||||
|
||||
// Set of instances to mark failures that are intended, such as representations not
|
||||
// resulting in any items due to dimensionality filters.
|
||||
std::set<const IfcUtil::IfcBaseInterface*> failed_on_purpose_;
|
||||
std::set<const IfcSchema::IfcRepresentationMap*> not_reusable_maps_;
|
||||
std::set<express::Base> failed_on_purpose_;
|
||||
std::set<IfcSchema::IfcRepresentationMap> not_reusable_maps_;
|
||||
|
||||
template <typename T>
|
||||
void process_mapping(bool& matched, taxonomy::ptr& item, IfcUtil::IfcBaseInterface const * inst) {
|
||||
if (!item && inst->as<T>()) {
|
||||
void process_mapping(bool& matched, taxonomy::ptr& item, const express::Base& inst) {
|
||||
if (!item && inst.as<T>()) {
|
||||
matched = true;
|
||||
try {
|
||||
item = map_impl(inst->as<T>());
|
||||
item = map_impl(inst.as<T>());
|
||||
if (item != nullptr) {
|
||||
if (item->instance == nullptr) {
|
||||
if (!item->instance) {
|
||||
item->instance = inst;
|
||||
}
|
||||
try {
|
||||
if (inst->as<IfcSchema::IfcRepresentationItem>() && !inst->as<IfcSchema::IfcStyledItem>() &&
|
||||
if (inst.as<IfcSchema::IfcRepresentationItem>() && !inst.as<IfcSchema::IfcStyledItem>() &&
|
||||
/* @todo */
|
||||
(item->kind() == taxonomy::SOLID || item->kind() == taxonomy::SHELL || item->kind() == taxonomy::COLLECTION || item->kind() == taxonomy::EXTRUSION || item->kind() == taxonomy::LOFT || item->kind() == taxonomy::BOOLEAN_RESULT || item->kind() == taxonomy::REVOLVE || item->kind() == taxonomy::SWEEP_ALONG_CURVE || item->kind() == taxonomy::FACE)
|
||||
) {
|
||||
auto style = find_style(inst->as<IfcSchema::IfcRepresentationItem>());
|
||||
auto style = find_style(inst.as<IfcSchema::IfcRepresentationItem>());
|
||||
if (style) {
|
||||
auto mstyle = map(style);
|
||||
if (mstyle) {
|
||||
@@ -76,30 +76,30 @@ namespace geometry {
|
||||
}
|
||||
}
|
||||
}
|
||||
const IfcSchema::IfcStyledItem* find_style(const IfcSchema::IfcRepresentationItem*);
|
||||
IfcSchema::IfcStyledItem find_style(const IfcSchema::IfcRepresentationItem&);
|
||||
public:
|
||||
POSTFIX_SCHEMA(mapping)(IfcParse::IfcFile* file, Settings& settings) : abstract_mapping(settings), file_(file), placement_rel_to_type_(0), placement_rel_to_instance_(0) {
|
||||
POSTFIX_SCHEMA(mapping)(IfcParse::IfcFile* file, Settings& settings) : abstract_mapping(settings), file_(file), placement_rel_to_type_(nullptr) {
|
||||
initialize_units_();
|
||||
}
|
||||
virtual ifcopenshell::geometry::taxonomy::ptr map(const IfcUtil::IfcBaseInterface*);
|
||||
virtual ifcopenshell::geometry::taxonomy::ptr map(const express::Base&);
|
||||
virtual void get_representations(std::vector<geometry_conversion_task>& tasks, std::vector<filter_t>& filters);
|
||||
virtual std::map<std::string, IfcUtil::IfcBaseEntity*> get_layers(IfcUtil::IfcBaseEntity*);
|
||||
virtual std::map<std::string, express::Base> get_layers(const express::Base&);
|
||||
virtual void initialize_settings();
|
||||
virtual double get_length_unit() const { return length_unit_; }
|
||||
virtual const std::string& get_length_unit_name() const { return length_unit_name_; }
|
||||
virtual aggregate_of_instance::ptr find_openings(const IfcUtil::IfcBaseEntity*);
|
||||
virtual IfcUtil::IfcBaseEntity* representation_of(const IfcUtil::IfcBaseEntity* product);
|
||||
virtual std::vector<express::Base> find_openings(const express::Base&);
|
||||
virtual express::Base representation_of(const express::Base& product);
|
||||
|
||||
virtual const IfcUtil::IfcBaseEntity* get_product_type(const IfcUtil::IfcBaseEntity* product_);
|
||||
virtual const IfcUtil::IfcBaseEntity* get_single_material_association(const IfcUtil::IfcBaseEntity* product);
|
||||
IfcSchema::IfcRepresentation* representation_mapped_to(const IfcSchema::IfcRepresentation* representation);
|
||||
IfcSchema::IfcProduct::list::ptr products_represented_by(const IfcSchema::IfcRepresentation* representation, IfcSchema::IfcRepresentationMap*& rmap, bool only_direct=false);
|
||||
bool reuse_ok_(const IfcSchema::IfcProduct::list::ptr& products);
|
||||
IfcUtil::IfcBaseEntity* get_decomposing_entity(const IfcUtil::IfcBaseEntity* product, bool include_openings);
|
||||
virtual const express::Base get_product_type(const express::Base& product_);
|
||||
virtual const express::Base get_single_material_association(const express::Base& product);
|
||||
IfcSchema::IfcRepresentation representation_mapped_to(const IfcSchema::IfcRepresentation& representation);
|
||||
std::vector<IfcSchema::IfcProduct> products_represented_by(const IfcSchema::IfcRepresentation& representation, IfcSchema::IfcRepresentationMap& rmap, bool only_direct = false);
|
||||
bool reuse_ok_(const std::vector<IfcSchema::IfcProduct>& products);
|
||||
express::Base get_decomposing_entity(const express::Base& product, bool include_openings);
|
||||
|
||||
bool get_layerset_information(const IfcUtil::IfcBaseInterface*, layerset_information&, int&);
|
||||
bool get_wall_neighbours(const IfcUtil::IfcBaseInterface*, std::vector<endpoint_connection>&);
|
||||
IfcSchema::IfcRepresentation* find_representation(const IfcSchema::IfcProduct*, const std::string&);
|
||||
bool get_layerset_information(const express::Base&, layerset_information&, int&);
|
||||
bool get_wall_neighbours(const express::Base&, std::vector<endpoint_connection>&);
|
||||
IfcSchema::IfcRepresentation find_representation(const IfcSchema::IfcProduct&, const std::string&);
|
||||
|
||||
#include "bind_convert_decl.i"
|
||||
};
|
||||
@@ -132,9 +132,9 @@ namespace geometry {
|
||||
template <typename U = taxonomy::collection, typename T>
|
||||
typename U::ptr map_to_collection(POSTFIX_SCHEMA(mapping)* m, const T& ts) {
|
||||
auto c = taxonomy::make<U>();
|
||||
if (ts->size()) {
|
||||
for (auto it = ts->begin(); it != ts->end(); ++it) {
|
||||
if (auto r = m->map(*it)) {
|
||||
if (ts.size()) {
|
||||
for (auto& t : ts) {
|
||||
if (auto r = m->map(t)) {
|
||||
c->children.push_back(taxonomy::cast<typename element_type<U>::type>(r));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user