mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-30 08:33:10 +00:00
Expose geometry types in snake case
Generated with the assistance of an AI coding tool.
This commit is contained in:
@@ -17,7 +17,7 @@ ifcopenshell::geom::converter::~converter() {
|
||||
delete mapping_;
|
||||
}
|
||||
|
||||
ifcopenshell::geom::brep_element* ifcopenshell::geom::converter::create_brep_for_representation_and_product(taxonomy::ptr representation_node, const express::base product_, const taxonomy::matrix4::ptr& place_) {
|
||||
ifcopenshell::geom::native_element* ifcopenshell::geom::converter::create_brep_for_representation_and_product(taxonomy::ptr representation_node, const express::base product_, const taxonomy::matrix4::ptr& place_) {
|
||||
auto product = product_.as<express::entity>();
|
||||
|
||||
std::stringstream representation_id_builder;
|
||||
@@ -26,7 +26,7 @@ ifcopenshell::geom::brep_element* ifcopenshell::geom::converter::create_brep_for
|
||||
|
||||
representation_id_builder << representation_node->instance.id();
|
||||
|
||||
ifcopenshell::geom::brep* shape;
|
||||
ifcopenshell::geom::native* shape;
|
||||
std::vector<ifcopenshell::geom::conversion_result> shapes;
|
||||
|
||||
if (!kernel_->convert(representation_node, shapes)) {
|
||||
@@ -237,7 +237,7 @@ ifcopenshell::geom::brep_element* ifcopenshell::geom::converter::create_brep_for
|
||||
}
|
||||
}
|
||||
|
||||
shape = new ifcopenshell::geom::brep(settings_, product_type, representation_id_builder.str(), shapes);
|
||||
shape = new ifcopenshell::geom::native(settings_, product_type, representation_id_builder.str(), shapes);
|
||||
|
||||
std::string context_string = "";
|
||||
|
||||
@@ -255,7 +255,7 @@ ifcopenshell::geom::brep_element* ifcopenshell::geom::converter::create_brep_for
|
||||
}
|
||||
}
|
||||
|
||||
auto elem = new ifcopenshell::geom::brep_element(
|
||||
auto elem = new ifcopenshell::geom::native_element(
|
||||
product.id(),
|
||||
parent_id,
|
||||
name,
|
||||
@@ -263,7 +263,7 @@ ifcopenshell::geom::brep_element* ifcopenshell::geom::converter::create_brep_for
|
||||
guid,
|
||||
context_string,
|
||||
place,
|
||||
std::shared_ptr<ifcopenshell::geom::brep>(shape),
|
||||
std::shared_ptr<ifcopenshell::geom::native>(shape),
|
||||
product
|
||||
);
|
||||
|
||||
@@ -342,7 +342,7 @@ ifcopenshell::geom::brep_element* ifcopenshell::geom::converter::create_brep_for
|
||||
return elem;
|
||||
}
|
||||
|
||||
ifcopenshell::geom::brep_element* ifcopenshell::geom::converter::create_brep_for_processed_representation(const express::base product_, const taxonomy::matrix4::ptr& place, ifcopenshell::geom::brep_element* brep) {
|
||||
ifcopenshell::geom::native_element* ifcopenshell::geom::converter::create_brep_for_processed_representation(const express::base product_, const taxonomy::matrix4::ptr& place, ifcopenshell::geom::native_element* brep) {
|
||||
auto product = product_.as<express::entity>();
|
||||
|
||||
int parent_id = -1;
|
||||
@@ -360,7 +360,7 @@ ifcopenshell::geom::brep_element* ifcopenshell::geom::converter::create_brep_for
|
||||
const std::string product_type = product.declaration().name();
|
||||
const std::string context_string = brep->context();
|
||||
|
||||
return new ifcopenshell::geom::brep_element(
|
||||
return new ifcopenshell::geom::native_element(
|
||||
product.id(),
|
||||
parent_id,
|
||||
name,
|
||||
@@ -373,7 +373,7 @@ ifcopenshell::geom::brep_element* ifcopenshell::geom::converter::create_brep_for
|
||||
);
|
||||
}
|
||||
|
||||
ifcopenshell::geom::brep_element* ifcopenshell::geom::converter::create_brep_for_representation_and_product(const express::base representation, const express::base product) {
|
||||
ifcopenshell::geom::native_element* ifcopenshell::geom::converter::create_brep_for_representation_and_product(const express::base representation, const express::base product) {
|
||||
auto interpreted_representation = mapping_->map(representation);
|
||||
if (!interpreted_representation) {
|
||||
interpreted_representation = taxonomy::make<taxonomy::collection>();
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace ifcopenshell { namespace geom {
|
||||
|
||||
class IFC_GEOM_API converter {
|
||||
public:
|
||||
typedef std::shared_ptr<ifcopenshell::geom::brep> brep_ptr;
|
||||
typedef std::shared_ptr<ifcopenshell::geom::native> brep_ptr;
|
||||
private:
|
||||
ifcopenshell::geom::abstract_mapping* mapping_;
|
||||
std::unique_ptr<ifcopenshell::geom::kernels::abstract_kernel> kernel_;
|
||||
@@ -47,11 +47,11 @@ namespace ifcopenshell { namespace geom {
|
||||
|
||||
std::vector<ifcopenshell::geom::conversion_result> convert(express::base item);
|
||||
|
||||
ifcopenshell::geom::brep_element* create_brep_for_representation_and_product(const express::base representation, const express::base product);
|
||||
// ifcopenshell::geom::brep_element* create_brep_for_processed_representation(const express::base representation, const express::base product, ifcopenshell::geom::brep_element* brep);
|
||||
ifcopenshell::geom::native_element* create_brep_for_representation_and_product(const express::base representation, const express::base product);
|
||||
// ifcopenshell::geom::native_element* create_brep_for_processed_representation(const express::base representation, const express::base product, ifcopenshell::geom::native_element* brep);
|
||||
|
||||
ifcopenshell::geom::brep_element* create_brep_for_representation_and_product(ifcopenshell::geom::taxonomy::ptr, const express::base product, const ifcopenshell::geom::taxonomy::matrix4::ptr& place);
|
||||
ifcopenshell::geom::brep_element* create_brep_for_processed_representation(const express::base product, const ifcopenshell::geom::taxonomy::matrix4::ptr& place, ifcopenshell::geom::brep_element*);
|
||||
ifcopenshell::geom::native_element* create_brep_for_representation_and_product(ifcopenshell::geom::taxonomy::ptr, const express::base product, const ifcopenshell::geom::taxonomy::matrix4::ptr& place);
|
||||
ifcopenshell::geom::native_element* create_brep_for_processed_representation(const express::base product, const ifcopenshell::geom::taxonomy::matrix4::ptr& place, ifcopenshell::geom::native_element*);
|
||||
|
||||
const ifcopenshell::geom::settings& settings() { return settings_; }
|
||||
};
|
||||
|
||||
+11
-11
@@ -158,14 +158,14 @@ namespace ifcopenshell::geom {
|
||||
virtual ~element() {}
|
||||
};
|
||||
|
||||
class brep_element : public element {
|
||||
class native_element : public element {
|
||||
private:
|
||||
std::shared_ptr<ifcopenshell::geom::brep> _geometry;
|
||||
std::shared_ptr<ifcopenshell::geom::native> _geometry;
|
||||
public:
|
||||
const std::shared_ptr<ifcopenshell::geom::brep>& geometry_pointer() const { return _geometry; }
|
||||
const ifcopenshell::geom::brep& geometry() const { return *_geometry; }
|
||||
brep_element(int id, int parent_id, const std::string& name, const std::string& type, const std::string& guid,
|
||||
const std::string& context, const ifcopenshell::geom::taxonomy::matrix4::ptr& trsf, const std::shared_ptr<ifcopenshell::geom::brep>& geometry,
|
||||
const std::shared_ptr<ifcopenshell::geom::native>& geometry_pointer() const { return _geometry; }
|
||||
const ifcopenshell::geom::native& geometry() const { return *_geometry; }
|
||||
native_element(int id, int parent_id, const std::string& name, const std::string& type, const std::string& guid,
|
||||
const std::string& context, const ifcopenshell::geom::taxonomy::matrix4::ptr& trsf, const std::shared_ptr<ifcopenshell::geom::native>& geometry,
|
||||
const express::entity& product)
|
||||
: element(geometry->settings(), id, parent_id, name, type, guid, context, trsf, product)
|
||||
, _geometry(geometry)
|
||||
@@ -174,10 +174,10 @@ namespace ifcopenshell::geom {
|
||||
bool calculate_projected_surface_area(double& along_x, double& along_y, double& along_z) const {
|
||||
return geometry().calculate_projected_surface_area(this->transformation().data(), along_x, along_y, along_z);
|
||||
}
|
||||
brep_element(const brep_element& other) = default;
|
||||
native_element(const native_element& other) = default;
|
||||
private:
|
||||
brep_element& operator=(const brep_element& other);
|
||||
std::unique_ptr<element> clone() const override { return std::make_unique<brep_element>(*this); }
|
||||
native_element& operator=(const native_element& other);
|
||||
std::unique_ptr<element> clone() const override { return std::make_unique<native_element>(*this); }
|
||||
};
|
||||
|
||||
class triangulation_element : public element {
|
||||
@@ -186,7 +186,7 @@ namespace ifcopenshell::geom {
|
||||
public:
|
||||
const ifcopenshell::geom::triangulation& geometry() const { return *_geometry; }
|
||||
const std::shared_ptr< ifcopenshell::geom::triangulation>& geometry_pointer() const { return _geometry; }
|
||||
triangulation_element(const ifcopenshell::geom::brep_element& shape_model)
|
||||
triangulation_element(const ifcopenshell::geom::native_element& shape_model)
|
||||
: element(shape_model)
|
||||
, _geometry(std::make_shared<ifcopenshell::geom::triangulation>(shape_model.geometry()))
|
||||
{}
|
||||
@@ -205,7 +205,7 @@ namespace ifcopenshell::geom {
|
||||
std::shared_ptr<ifcopenshell::geom::serialization> _geometry;
|
||||
public:
|
||||
const ifcopenshell::geom::serialization& geometry() const { return *_geometry; }
|
||||
serialized_element(const brep_element& shape_model)
|
||||
serialized_element(const native_element& shape_model)
|
||||
: element(shape_model)
|
||||
, _geometry(std::make_shared<ifcopenshell::geom::serialization>(shape_model.geometry()))
|
||||
{}
|
||||
|
||||
@@ -21,7 +21,7 @@ inline taxonomy::function_item::ptr convert_loop_to_function_item(taxonomy::loop
|
||||
|
||||
/// @brief Abstract class for evaluating a function_item. This class is specialized for each of the function_item types.
|
||||
struct IFC_GEOM_API fn_evaluator {
|
||||
fn_evaluator(const ifcopenshell::geom::settings& settings, logger& logger = ifcopenshell::logger::root()) : settings_(settings), logger_(logger) {
|
||||
fn_evaluator(const ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger = ifcopenshell::logger::root()) : settings_(settings), logger_(logger) {
|
||||
}
|
||||
fn_evaluator(const fn_evaluator& other) = default;
|
||||
virtual ~fn_evaluator() = default;
|
||||
@@ -36,13 +36,13 @@ struct IFC_GEOM_API fn_evaluator {
|
||||
ifcopenshell::geom::settings settings_;
|
||||
|
||||
protected:
|
||||
logger& logger_;
|
||||
ifcopenshell::logger& logger_;
|
||||
};
|
||||
|
||||
/// @brief utility class to evaluate function_item objects.
|
||||
class IFC_GEOM_API function_item_evaluator {
|
||||
public:
|
||||
function_item_evaluator(const ifcopenshell::geom::settings& settings, taxonomy::function_item::const_ptr fn, logger& logger = ifcopenshell::logger::root());
|
||||
function_item_evaluator(const ifcopenshell::geom::settings& settings, taxonomy::function_item::const_ptr fn, ifcopenshell::logger& logger = ifcopenshell::logger::root());
|
||||
function_item_evaluator(const function_item_evaluator& other);
|
||||
~function_item_evaluator();
|
||||
|
||||
@@ -78,7 +78,7 @@ class IFC_GEOM_API function_item_evaluator {
|
||||
fn_evaluator* fn_evaluator_ = nullptr;
|
||||
|
||||
mutable std::optional<std::vector<double>> eval_points_; // cache evaluation points
|
||||
logger& logger_;
|
||||
ifcopenshell::logger& logger_;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
|
||||
virtual bool isTesselated() const = 0;
|
||||
virtual void write(const ifcopenshell::geom::triangulation_element* o) = 0;
|
||||
virtual void write(const ifcopenshell::geom::brep_element* o) = 0;
|
||||
virtual void write(const ifcopenshell::geom::native_element* o) = 0;
|
||||
virtual void setUnitNameAndMagnitude(const std::string& name, float magnitude) = 0;
|
||||
virtual ifcopenshell::geom::element* read(ifcopenshell::file& f, const std::string& guid, const std::string& representation_id, read_type rt = READ_BREP) = 0;
|
||||
|
||||
|
||||
@@ -382,7 +382,7 @@ void ifcopenshell::geom::iterator::create_element_(ifcopenshell::geom::converter
|
||||
|
||||
kernel_logger.set_product(product);
|
||||
|
||||
ifcopenshell::geom::brep_element* brep = static_cast<ifcopenshell::geom::brep_element*>(create_processed_element_([kernel, settings, product, place, rep]() {
|
||||
ifcopenshell::geom::native_element* brep = static_cast<ifcopenshell::geom::native_element*>(create_processed_element_([kernel, settings, product, place, rep]() {
|
||||
return kernel->create_brep_for_representation_and_product(rep->item, product, place);
|
||||
}));
|
||||
|
||||
@@ -407,7 +407,7 @@ void ifcopenshell::geom::iterator::create_element_(ifcopenshell::geom::converter
|
||||
|
||||
kernel_logger.set_product(product2);
|
||||
|
||||
ifcopenshell::geom::brep_element* brep2 = static_cast<ifcopenshell::geom::brep_element*>(create_processed_element_([kernel, settings, product2, place2, brep]() {
|
||||
ifcopenshell::geom::native_element* brep2 = static_cast<ifcopenshell::geom::native_element*>(create_processed_element_([kernel, settings, product2, place2, brep]() {
|
||||
return kernel->create_brep_for_processed_representation(product2, place2, brep);
|
||||
}));
|
||||
if (brep2) {
|
||||
@@ -422,7 +422,7 @@ void ifcopenshell::geom::iterator::create_element_(ifcopenshell::geom::converter
|
||||
kernel_logger.set_product(std::optional<express::base>{});
|
||||
}
|
||||
|
||||
ifcopenshell::geom::element* ifcopenshell::geom::iterator::process_based_on_settings(ifcopenshell::geom::settings settings, ifcopenshell::geom::brep_element* elem, ifcopenshell::logger& logger, ifcopenshell::geom::triangulation_element* previous)
|
||||
ifcopenshell::geom::element* ifcopenshell::geom::iterator::process_based_on_settings(ifcopenshell::geom::settings settings, ifcopenshell::geom::native_element* elem, ifcopenshell::logger& logger, ifcopenshell::geom::triangulation_element* previous)
|
||||
{
|
||||
if (settings.get<ifcopenshell::geom::settings::IteratorOutput>().get() == ifcopenshell::geom::settings::SERIALIZED) {
|
||||
try {
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace ifcopenshell::geom {
|
||||
express::base representation;
|
||||
std::vector<express::base> products_2;
|
||||
|
||||
std::vector<ifcopenshell::geom::brep_element*> breps;
|
||||
std::vector<ifcopenshell::geom::native_element*> breps;
|
||||
std::vector<ifcopenshell::geom::element*> elements;
|
||||
|
||||
bool is_parallel() const {
|
||||
@@ -113,10 +113,10 @@ namespace ifcopenshell::geom {
|
||||
std::vector<geometry_conversion_result>::iterator task_iterator_;
|
||||
|
||||
std::list<ifcopenshell::geom::element*> all_processed_elements_;
|
||||
std::list<ifcopenshell::geom::brep_element*> all_processed_native_elements_;
|
||||
std::list<ifcopenshell::geom::native_element*> all_processed_native_elements_;
|
||||
|
||||
std::list<ifcopenshell::geom::element*>::const_iterator task_result_iterator_;
|
||||
std::list<ifcopenshell::geom::brep_element*>::const_iterator native_task_result_iterator_;
|
||||
std::list<ifcopenshell::geom::native_element*>::const_iterator native_task_result_iterator_;
|
||||
|
||||
std::mutex element_ready_mutex_;
|
||||
bool task_result_ptr_initialized = false;
|
||||
@@ -139,7 +139,7 @@ namespace ifcopenshell::geom {
|
||||
|
||||
// The object is fetched beforehand to be sure that get() returns a valid element
|
||||
triangulation_element* current_triangulation;
|
||||
brep_element* current_shape_model;
|
||||
native_element* current_shape_model;
|
||||
serialized_element* current_serialization;
|
||||
|
||||
double lowest_precision_encountered;
|
||||
@@ -169,7 +169,7 @@ namespace ifcopenshell::geom {
|
||||
|
||||
ifcopenshell::geom::element* process_based_on_settings(
|
||||
ifcopenshell::geom::settings settings,
|
||||
ifcopenshell::geom::brep_element* elem,
|
||||
ifcopenshell::geom::native_element* elem,
|
||||
ifcopenshell::logger& logger,
|
||||
ifcopenshell::geom::triangulation_element* previous = nullptr);
|
||||
|
||||
@@ -294,10 +294,10 @@ namespace ifcopenshell::geom {
|
||||
std::unique_ptr<element> get();
|
||||
|
||||
/// Gets the native (Open Cascade or CGAL) representation of the current geometrical entity.
|
||||
std::unique_ptr<brep_element> get_native()
|
||||
std::unique_ptr<native_element> get_native()
|
||||
{
|
||||
validate_iterator_state();
|
||||
return std::make_unique<brep_element>(**native_task_result_iterator_);
|
||||
return std::make_unique<native_element>(**native_task_result_iterator_);
|
||||
}
|
||||
|
||||
std::unique_ptr<element> get_object(int id);
|
||||
|
||||
@@ -367,14 +367,14 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
|
||||
// return single_material;
|
||||
// }
|
||||
//
|
||||
// ifcopenshell::geom::brep_element* ifcopenshell::geom::Kernel::create_brep_for_representation_and_product(
|
||||
// ifcopenshell::geom::native_element* ifcopenshell::geom::Kernel::create_brep_for_representation_and_product(
|
||||
// const IteratorSettings& settings, IfcSchema::IfcRepresentation* representation, IfcSchema::IfcProduct* product)
|
||||
// {
|
||||
// std::stringstream representation_id_builder;
|
||||
//
|
||||
// representation_id_builder << representation->data().id();
|
||||
//
|
||||
// ifcopenshell::geom::brep* shape;
|
||||
// ifcopenshell::geom::native* shape;
|
||||
// std::vector<ifcopenshell::geom::conversion_result> shapes, shapes2;
|
||||
//
|
||||
// if (!convert_shapes(representation, shapes)) {
|
||||
@@ -524,16 +524,16 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
|
||||
// trsf = gp_Trsf();
|
||||
// representation_id_builder << "-world-coords";
|
||||
// }
|
||||
// shape = new ifcopenshell::geom::brep(element_settings, representation_id_builder.str(), opened_shapes);
|
||||
// shape = new ifcopenshell::geom::native(element_settings, representation_id_builder.str(), opened_shapes);
|
||||
// } else if (settings.get(IteratorSettings::USE_WORLD_COORDS)) {
|
||||
// for (std::vector<ifcopenshell::geom::conversion_result>::iterator it = shapes.begin(); it != shapes.end(); ++it) {
|
||||
// it->prepend(trsf);
|
||||
// }
|
||||
// trsf = gp_Trsf();
|
||||
// representation_id_builder << "-world-coords";
|
||||
// shape = new ifcopenshell::geom::brep(element_settings, representation_id_builder.str(), shapes);
|
||||
// shape = new ifcopenshell::geom::native(element_settings, representation_id_builder.str(), shapes);
|
||||
// } else {
|
||||
// shape = new ifcopenshell::geom::brep(element_settings, representation_id_builder.str(), shapes);
|
||||
// shape = new ifcopenshell::geom::native(element_settings, representation_id_builder.str(), shapes);
|
||||
// }
|
||||
//
|
||||
// std::string context_string = "";
|
||||
@@ -543,7 +543,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
|
||||
// context_string = *representation->ContextOfItems()->ContextType();
|
||||
// }
|
||||
//
|
||||
// auto elem = new brep_element(
|
||||
// auto elem = new native_element(
|
||||
// product->data().id(),
|
||||
// parent_id,
|
||||
// name,
|
||||
@@ -551,7 +551,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
|
||||
// guid,
|
||||
// context_string,
|
||||
// trsf,
|
||||
// std::shared_ptr<ifcopenshell::geom::brep>(shape),
|
||||
// std::shared_ptr<ifcopenshell::geom::native>(shape),
|
||||
// product
|
||||
// );
|
||||
//
|
||||
@@ -710,9 +710,9 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
|
||||
// return products;
|
||||
// }
|
||||
//
|
||||
// ifcopenshell::geom::brep_element* ifcopenshell::geom::Kernel::create_brep_for_processed_representation(
|
||||
// ifcopenshell::geom::native_element* ifcopenshell::geom::Kernel::create_brep_for_processed_representation(
|
||||
// const IteratorSettings& /*settings*/, IfcSchema::IfcRepresentation* representation, IfcSchema::IfcProduct* product,
|
||||
// ifcopenshell::geom::brep_element* brep)
|
||||
// ifcopenshell::geom::native_element* brep)
|
||||
// {
|
||||
// int parent_id = -1;
|
||||
// try {
|
||||
@@ -747,7 +747,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
|
||||
//
|
||||
// const std::string product_type = product->declaration().name();
|
||||
//
|
||||
// return new brep_element(
|
||||
// return new native_element(
|
||||
// product->data().id(),
|
||||
// parent_id,
|
||||
// name,
|
||||
|
||||
@@ -1349,7 +1349,7 @@ namespace ifcopenshell::geom {
|
||||
return ts_filtered;
|
||||
}
|
||||
|
||||
std::vector<T> select(const ifcopenshell::geom::brep_element* elem, bool completely_within = false, double extend = -1.e-5) const {
|
||||
std::vector<T> select(const ifcopenshell::geom::native_element* elem, bool completely_within = false, double extend = -1.e-5) const {
|
||||
auto shp = (ifcopenshell::geom::open_cascade_shape*)elem->geometry().as_compound();
|
||||
TopoDS_Shape compound(std::move(((ifcopenshell::geom::open_cascade_shape*)shp)->shape()));
|
||||
delete shp;
|
||||
@@ -1497,7 +1497,7 @@ namespace ifcopenshell::geom {
|
||||
if (it.initialize()) {
|
||||
do {
|
||||
auto element = it.get();
|
||||
add_element(dynamic_cast<ifcopenshell::geom::brep_element*>(element.get()));
|
||||
add_element(dynamic_cast<ifcopenshell::geom::native_element*>(element.get()));
|
||||
} while (it.next());
|
||||
}
|
||||
}
|
||||
@@ -1745,7 +1745,7 @@ namespace ifcopenshell::geom {
|
||||
max_protrusions_[t] = std::min(std::min(obb.XHSize(), obb.YHSize()), obb.ZHSize()) * 2;
|
||||
}
|
||||
|
||||
void add_element(ifcopenshell::geom::brep_element* elem) {
|
||||
void add_element(ifcopenshell::geom::native_element* elem) {
|
||||
if (!elem) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace ifcopenshell {
|
||||
}
|
||||
|
||||
void add_element(ifcopenshell::geom::element* element) override {
|
||||
auto* brep = dynamic_cast<ifcopenshell::geom::brep_element*>(element);
|
||||
auto* brep = dynamic_cast<ifcopenshell::geom::native_element*>(element);
|
||||
if (!brep) {
|
||||
throw ifcopenshell::exception("Tree backend 'opencascade.brep' requires native brep elements");
|
||||
}
|
||||
@@ -87,7 +87,7 @@ namespace ifcopenshell {
|
||||
}
|
||||
|
||||
std::vector<express::entity> select(const ifcopenshell::geom::element* element, bool completely_within, double extend) const override {
|
||||
auto* brep = dynamic_cast<const ifcopenshell::geom::brep_element*>(element);
|
||||
auto* brep = dynamic_cast<const ifcopenshell::geom::native_element*>(element);
|
||||
if (!brep) {
|
||||
throw ifcopenshell::exception("Tree backend 'opencascade.brep' requires brep elements for select()");
|
||||
}
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
|
||||
#include "representation.h"
|
||||
|
||||
ifcopenshell::geom::serialization::serialization(const brep& brep)
|
||||
: representation(brep.settings(), brep.entity(), brep.id())
|
||||
ifcopenshell::geom::serialization::serialization(const native& native_geometry)
|
||||
: representation(native_geometry.settings(), native_geometry.entity(), native_geometry.id())
|
||||
{
|
||||
for (auto it = brep.begin(); it != brep.end(); ++it) {
|
||||
for (auto it = native_geometry.begin(); it != native_geometry.end(); ++it) {
|
||||
int sid = -1;
|
||||
|
||||
if (it->hasStyle()) {
|
||||
@@ -48,12 +48,12 @@ ifcopenshell::geom::serialization::serialization(const brep& brep)
|
||||
}
|
||||
|
||||
ifcopenshell::geom::taxonomy::matrix4 identity;
|
||||
auto* comp = brep.as_compound();
|
||||
auto* comp = native_geometry.as_compound();
|
||||
comp->serialize(identity, brep_data_);
|
||||
delete comp;
|
||||
}
|
||||
|
||||
ifcopenshell::geom::conversion_result_shape* ifcopenshell::geom::brep::as_compound(bool force_meters) const {
|
||||
ifcopenshell::geom::conversion_result_shape* ifcopenshell::geom::native::as_compound(bool force_meters) const {
|
||||
conversion_result_shape* accum = nullptr;
|
||||
|
||||
for (auto it = begin(); it != end(); ++it) {
|
||||
@@ -75,7 +75,7 @@ ifcopenshell::geom::conversion_result_shape* ifcopenshell::geom::brep::as_compou
|
||||
return accum;
|
||||
}
|
||||
|
||||
bool ifcopenshell::geom::brep::calculate_surface_area(double& area) const {
|
||||
bool ifcopenshell::geom::native::calculate_surface_area(double& area) const {
|
||||
std::unique_ptr<conversion_result_shape> s(as_compound());
|
||||
if (!s) {
|
||||
area = 0.;
|
||||
@@ -85,7 +85,7 @@ bool ifcopenshell::geom::brep::calculate_surface_area(double& area) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ifcopenshell::geom::brep::calculate_volume(double& volume) const {
|
||||
bool ifcopenshell::geom::native::calculate_volume(double& volume) const {
|
||||
std::unique_ptr<conversion_result_shape> s(as_compound());
|
||||
if (!s) {
|
||||
volume = 0.;
|
||||
@@ -95,7 +95,7 @@ bool ifcopenshell::geom::brep::calculate_volume(double& volume) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ifcopenshell::geom::brep::calculate_projected_surface_area(const ifcopenshell::geom::taxonomy::matrix4::ptr& place, double& along_x, double& along_y, double& along_z) const {
|
||||
bool ifcopenshell::geom::native::calculate_projected_surface_area(const ifcopenshell::geom::taxonomy::matrix4::ptr& place, double& along_x, double& along_y, double& along_z) const {
|
||||
along_x = along_y = along_z = 0.;
|
||||
|
||||
for (std::vector<ifcopenshell::geom::conversion_result>::const_iterator it = begin(); it != end(); ++it) {
|
||||
@@ -116,7 +116,7 @@ bool ifcopenshell::geom::brep::calculate_projected_surface_area(const ifcopenshe
|
||||
return true;
|
||||
}
|
||||
|
||||
ifcopenshell::geom::triangulation::triangulation(const brep& shape_model)
|
||||
ifcopenshell::geom::triangulation::triangulation(const native& shape_model)
|
||||
: representation(shape_model.settings(), shape_model.entity(), shape_model.id())
|
||||
, weld_offset_(0)
|
||||
{
|
||||
@@ -210,7 +210,7 @@ void ifcopenshell::geom::triangulation::registerEdgeCount(int n1, int n2, std::m
|
||||
edgecount[e] ++;
|
||||
}
|
||||
|
||||
const ifcopenshell::geom::conversion_result_shape* ifcopenshell::geom::brep::item(int i) const {
|
||||
const ifcopenshell::geom::conversion_result_shape* ifcopenshell::geom::native::item(int i) const {
|
||||
if (i >= 0 && static_cast<std::size_t>(i) < shapes_.size()) {
|
||||
return shapes_[i].shape()->moved(shapes_[i].placement());
|
||||
} else {
|
||||
@@ -218,7 +218,7 @@ const ifcopenshell::geom::conversion_result_shape* ifcopenshell::geom::brep::ite
|
||||
}
|
||||
}
|
||||
|
||||
int ifcopenshell::geom::brep::item_id(int i) const {
|
||||
int ifcopenshell::geom::native::item_id(int i) const {
|
||||
if (i >= 0 && static_cast<std::size_t>(i) < shapes_.size()) {
|
||||
return shapes_[i].ItemId();
|
||||
} else {
|
||||
|
||||
@@ -52,17 +52,17 @@ namespace ifcopenshell::geom {
|
||||
virtual ~representation() {}
|
||||
};
|
||||
|
||||
class IFC_GEOM_API brep : public representation {
|
||||
class IFC_GEOM_API native : public representation {
|
||||
private:
|
||||
const std::vector<ifcopenshell::geom::conversion_result> shapes_;
|
||||
brep(const brep& other);
|
||||
brep& operator=(const brep& other);
|
||||
native(const native& other);
|
||||
native& operator=(const native& other);
|
||||
public:
|
||||
brep(const ifcopenshell::geom::settings& settings, const std::string& entity, const std::string& id, const std::vector<ifcopenshell::geom::conversion_result>& shapes)
|
||||
native(const ifcopenshell::geom::settings& settings, const std::string& entity, const std::string& id, const std::vector<ifcopenshell::geom::conversion_result>& shapes)
|
||||
: representation(settings, entity, id)
|
||||
, shapes_(shapes)
|
||||
{}
|
||||
virtual ~brep() {}
|
||||
virtual ~native() {}
|
||||
std::vector<ifcopenshell::geom::conversion_result>::const_iterator begin() const { return shapes_.begin(); }
|
||||
std::vector<ifcopenshell::geom::conversion_result>::const_iterator end() const { return shapes_.end(); }
|
||||
const std::vector<ifcopenshell::geom::conversion_result>& shapes() const { return shapes_; }
|
||||
@@ -86,7 +86,7 @@ namespace ifcopenshell::geom {
|
||||
const std::string& brep_data() const { return brep_data_; }
|
||||
const std::vector<double>& surface_styles() const { return surface_styles_; }
|
||||
const std::vector<int>& surface_style_ids() const { return surface_style_ids_; }
|
||||
serialization(const brep& brep);
|
||||
serialization(const native& native_geometry);
|
||||
virtual ~serialization() {}
|
||||
private:
|
||||
serialization();
|
||||
@@ -138,7 +138,7 @@ namespace ifcopenshell::geom {
|
||||
const std::vector<int>& item_ids() const { return item_ids_; }
|
||||
const std::vector<int>& edges_item_ids() const { return edges_item_ids_; }
|
||||
|
||||
triangulation(const brep& shape_model);
|
||||
triangulation(const native& shape_model);
|
||||
|
||||
triangulation(
|
||||
const ifcopenshell::geom::settings& settings,
|
||||
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
}
|
||||
|
||||
ifcopenshell::geom::trees::abstract_tree& backend_for_element(ifcopenshell::geom::element* element) const {
|
||||
if (dynamic_cast<ifcopenshell::geom::brep_element*>(element)) {
|
||||
if (dynamic_cast<ifcopenshell::geom::native_element*>(element)) {
|
||||
return backend(default_selection_backend_id);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user