Remove _t suffixes from public types

Rename header-scope aliases, enums, and helper types while retaining descriptive names where dropping the suffix would create a collision.

Generated with the assistance of an AI coding tool.
This commit is contained in:
Thomas Krijnen
2026-08-08 14:58:15 +02:00
parent 2859c1ef17
commit 4597929df9
41 changed files with 418 additions and 418 deletions
+11 -11
View File
@@ -2390,17 +2390,17 @@ PREDEFINED = IFC_PARSE_API= \
EXPAND_AS_DEFINED = Kernel_ \ EXPAND_AS_DEFINED = Kernel_ \
cgal_shape \ cgal_shape \
cgal_kernel \ cgal_kernel \
cgal_placement_t \ cgal_placement \
cgal_point_t \ cgal_point \
cgal_direction_t \ cgal_direction \
cgal_vector_t \ cgal_vector \
cgal_plane_t \ cgal_plane \
cgal_curve_t \ cgal_curve \
cgal_wire_t \ cgal_wire \
cgal_face_t \ cgal_face \
cgal_shape_t \ cgal_polyhedron \
cgal_vertex_descriptor_t \ cgal_vertex_descriptor \
cgal_face_descriptor_t \ cgal_face_descriptor \
create_cube \ create_cube \
create_polyhedron create_polyhedron
+4 -4
View File
@@ -247,7 +247,7 @@ struct exclusion_traverse_filter : public geom_filter { exclusion_traverse_filte
size_t read_filters_from_file(const std::string&, inclusion_filter&, inclusion_traverse_filter&, exclusion_filter&, exclusion_traverse_filter&); size_t read_filters_from_file(const std::string&, inclusion_filter&, inclusion_traverse_filter&, exclusion_filter&, exclusion_traverse_filter&);
void parse_filter(geom_filter &, const std::vector<std::string>&); void parse_filter(geom_filter &, const std::vector<std::string>&);
std::vector<ifcopenshell::geom::filter_t> setup_filters(const std::vector<geom_filter>&, const std::string&); std::vector<ifcopenshell::geom::filter_function> setup_filters(const std::vector<geom_filter>&, const std::string&);
bool init_input_file(const std::string& filename, ifcopenshell::file*& ifc_file, bool no_progress, bool mmap, bool bypass_properties=false, ifcopenshell::logger& logger = ifcopenshell::logger::root()); bool init_input_file(const std::string& filename, ifcopenshell::file*& ifc_file, bool no_progress, bool mmap, bool bypass_properties=false, ifcopenshell::logger& logger = ifcopenshell::logger::root());
@@ -694,7 +694,7 @@ int main(int argc, char** argv) {
if (exclude_filter.type != geom_filter::UNUSED) { used_filters.push_back(exclude_filter); } if (exclude_filter.type != geom_filter::UNUSED) { used_filters.push_back(exclude_filter); }
if (exclude_traverse_filter.type != geom_filter::UNUSED) { used_filters.push_back(exclude_traverse_filter); } if (exclude_traverse_filter.type != geom_filter::UNUSED) { used_filters.push_back(exclude_traverse_filter); }
std::vector<ifcopenshell::geom::filter_t> filter_funcs = setup_filters(used_filters, ifcopenshell::path::to_utf8(output_extension)); std::vector<ifcopenshell::geom::filter_function> filter_funcs = setup_filters(used_filters, ifcopenshell::path::to_utf8(output_extension));
if (filter_funcs.empty()) { if (filter_funcs.empty()) {
cerr_ << "[error] Failed to set up geometry filters\n"; cerr_ << "[error] Failed to set up geometry filters\n";
return EXIT_FAILURE; return EXIT_FAILURE;
@@ -1260,9 +1260,9 @@ void validate(boost::any& v, const std::vector<std::string>& values, exclusion_t
/// @todo Clean up this filter initialization code further. /// @todo Clean up this filter initialization code further.
/// @return References to the used filter functors, if none an error occurred. /// @return References to the used filter functors, if none an error occurred.
std::vector<ifcopenshell::geom::filter_t> setup_filters(const std::vector<geom_filter>& filters, const std::string& output_extension) std::vector<ifcopenshell::geom::filter_function> setup_filters(const std::vector<geom_filter>& filters, const std::string& output_extension)
{ {
std::vector<ifcopenshell::geom::filter_t> filter_funcs; std::vector<ifcopenshell::geom::filter_function> filter_funcs;
for(auto& f: filters) { for(auto& f: filters) {
if (f.type == geom_filter::ENTITY_TYPE) { if (f.type == geom_filter::ENTITY_TYPE) {
entity_filter.include = f.include; entity_filter.include = f.include;
+1 -1
View File
@@ -112,7 +112,7 @@ void fix_spaceboundaries(ifcopenshell::file& f, bool no_progress, bool quiet, bo
guid_pairs_visited.insert({ Aguid, Bguid }); guid_pairs_visited.insert({ Aguid, Bguid });
cgal_shape_t x_poly; cgal_polyhedron x_poly;
x.convert_to_polyhedron(x_poly); x.convert_to_polyhedron(x_poly);
{ {
@@ -19,7 +19,7 @@ void fix_storeycontainment(ifcopenshell::file& f, bool no_progress, bool quiet,
settings.get<ifcopenshell::geom::settings::IteratorOutput>().value = ifcopenshell::geom::settings::NATIVE; settings.get<ifcopenshell::geom::settings::IteratorOutput>().value = ifcopenshell::geom::settings::NATIVE;
settings.get<ifcopenshell::geom::settings::DisableOpeningSubtractions>().value = true; settings.get<ifcopenshell::geom::settings::DisableOpeningSubtractions>().value = true;
std::vector<ifcopenshell::geom::filter_t> no_openings_and_spaces = { std::vector<ifcopenshell::geom::filter_function> no_openings_and_spaces = {
ifcopenshell::geom::entity_filter(false, false, {"IfcOpeningElement", "IfcSpace"}) ifcopenshell::geom::entity_filter(false, false, {"IfcOpeningElement", "IfcSpace"})
}; };
@@ -138,12 +138,12 @@ void fix_storeycontainment(ifcopenshell::file& f, bool no_progress, bool quiet,
const auto& m = g.Placement()->ccomponents(); const auto& m = g.Placement()->ccomponents();
const auto& n = geom_object->transformation().data()->ccomponents(); const auto& n = geom_object->transformation().data()->ccomponents();
const cgal_placement_t trsf( const cgal_placement trsf(
m(0, 0), m(0, 1), m(0, 2), m(0, 3), m(0, 0), m(0, 1), m(0, 2), m(0, 3),
m(1, 0), m(1, 1), m(1, 2), m(1, 3), m(1, 0), m(1, 1), m(1, 2), m(1, 3),
m(2, 0), m(2, 1), m(2, 2), m(2, 3)); m(2, 0), m(2, 1), m(2, 2), m(2, 3));
const cgal_placement_t trsf2( const cgal_placement trsf2(
n(0, 0), n(0, 1), n(0, 2), n(0, 3), n(0, 0), n(0, 1), n(0, 2), n(0, 3),
n(1, 0), n(1, 1), n(1, 2), n(1, 3), n(1, 0), n(1, 1), n(1, 2), n(1, 3),
n(2, 0), n(2, 1), n(2, 2), n(2, 3)); n(2, 0), n(2, 1), n(2, 2), n(2, 3));
@@ -90,7 +90,7 @@ void fix_wallconnectivity(ifcopenshell::file& f, bool no_progress, bool quiet, b
} }
std::clock_t poly_begin = std::clock(); std::clock_t poly_begin = std::clock();
cgal_shape_t x_poly; cgal_polyhedron x_poly;
x.convert_to_polyhedron(x_poly); x.convert_to_polyhedron(x_poly);
std::clock_t poly_end = std::clock(); std::clock_t poly_end = std::clock();
conversion_to_poly += (poly_end - poly_begin) / (double)CLOCKS_PER_SEC; conversion_to_poly += (poly_end - poly_begin) / (double)CLOCKS_PER_SEC;
@@ -136,7 +136,7 @@ void fix_wallconnectivity(ifcopenshell::file& f, bool no_progress, bool quiet, b
std::vector<Kernel_::FT> parameters; std::vector<Kernel_::FT> parameters;
std::transform(vertices(x_poly).begin(), vertices(x_poly).end(), std::back_inserter(parameters), [&P0, D](cgal_vertex_descriptor_t& v) { std::transform(vertices(x_poly).begin(), vertices(x_poly).end(), std::back_inserter(parameters), [&P0, D](cgal_vertex_descriptor& v) {
return (v->point() - P0) * D; return (v->point() - P0) * D;
}); });
+2 -2
View File
@@ -2,14 +2,14 @@
#include "validation_utils.h" #include "validation_utils.h"
double facet_area(const cgal_shape_t::Facet_handle& f) { double facet_area(const cgal_polyhedron::Facet_handle& f) {
auto p0 = f->facet_begin()->vertex()->point(); auto p0 = f->facet_begin()->vertex()->point();
auto p1 = f->facet_begin()->next()->vertex()->point(); auto p1 = f->facet_begin()->next()->vertex()->point();
auto p2 = f->facet_begin()->next()->next()->vertex()->point(); auto p2 = f->facet_begin()->next()->next()->vertex()->point();
return std::sqrt(CGAL::to_double(CGAL::cross_product(p0 - p1, p2 - p1).squared_length())); return std::sqrt(CGAL::to_double(CGAL::cross_product(p0 - p1, p2 - p1).squared_length()));
} }
void dump_facet(const cgal_shape_t::Facet_handle& f) { void dump_facet(const cgal_polyhedron::Facet_handle& f) {
auto p0 = f->facet_begin()->vertex()->point(); auto p0 = f->facet_begin()->vertex()->point();
auto p1 = f->facet_begin()->next()->vertex()->point(); auto p1 = f->facet_begin()->next()->vertex()->point();
auto p2 = f->facet_begin()->next()->next()->vertex()->point(); auto p2 = f->facet_begin()->next()->next()->vertex()->point();
+34 -34
View File
@@ -39,7 +39,7 @@ T enlarge(const T& t, double d = 1.e-5) {
template <class HDS> template <class HDS>
struct Build_Offset : public CGAL::Modifier_base<HDS> { struct Build_Offset : public CGAL::Modifier_base<HDS> {
std::list<cgal_shape_t::Facet_handle> input; std::list<cgal_polyhedron::Facet_handle> input;
void operator()(HDS& hds) { void operator()(HDS& hds) {
// Postcondition: hds is a valid polyhedral surface. // Postcondition: hds is a valid polyhedral surface.
@@ -81,12 +81,12 @@ struct Build_Offset : public CGAL::Modifier_base<HDS> {
}; };
template <typename Ts> template <typename Ts>
std::list<cgal_shape_t::Facet_handle> connected_faces(cgal_shape_t::Facet_handle f, const Ts& excluded) { std::list<cgal_polyhedron::Facet_handle> connected_faces(cgal_polyhedron::Facet_handle f, const Ts& excluded) {
std::set<cgal_shape_t::Facet_handle> fs = { f }; std::set<cgal_polyhedron::Facet_handle> fs = { f };
std::function<void(cgal_shape_t::Facet_handle& f)> process; std::function<void(cgal_polyhedron::Facet_handle& f)> process;
process = [&fs, &process, &excluded](cgal_shape_t::Facet_handle& f) { process = [&fs, &process, &excluded](cgal_polyhedron::Facet_handle& f) {
cgal_shape_t::Halfedge_around_facet_circulator circ = f->facet_begin(), end(circ); cgal_polyhedron::Halfedge_around_facet_circulator circ = f->facet_begin(), end(circ);
do { do {
auto ff = circ->opposite()->facet(); auto ff = circ->opposite()->facet();
if (excluded.find(ff) == excluded.end()) { if (excluded.find(ff) == excluded.end()) {
@@ -99,12 +99,12 @@ std::list<cgal_shape_t::Facet_handle> connected_faces(cgal_shape_t::Facet_handle
}; };
process(f); process(f);
return std::list<cgal_shape_t::Facet_handle>(fs.begin(), fs.end()); return std::list<cgal_polyhedron::Facet_handle>(fs.begin(), fs.end());
} }
template <class HDS> template <class HDS>
struct Builder_With_Map : public CGAL::Modifier_base<HDS> { struct Builder_With_Map : public CGAL::Modifier_base<HDS> {
std::list<cgal_shape_t::Facet_handle> input; std::list<cgal_polyhedron::Facet_handle> input;
std::map<Kernel_::Point_3, Kernel_::Point_3> mapping; std::map<Kernel_::Point_3, Kernel_::Point_3> mapping;
void operator()(HDS& hds) { void operator()(HDS& hds) {
@@ -114,7 +114,7 @@ struct Builder_With_Map : public CGAL::Modifier_base<HDS> {
std::set<Kernel_::Point_3> used_points; std::set<Kernel_::Point_3> used_points;
for (auto& f : input) { for (auto& f : input) {
cgal_shape_t::Halfedge_around_facet_circulator circ = f->facet_begin(), end(circ); cgal_polyhedron::Halfedge_around_facet_circulator circ = f->facet_begin(), end(circ);
do { do {
auto P = circ->vertex()->point(); auto P = circ->vertex()->point();
auto it = mapping.find(P); auto it = mapping.find(P);
@@ -135,7 +135,7 @@ struct Builder_With_Map : public CGAL::Modifier_base<HDS> {
for (auto& f : input) { for (auto& f : input) {
B.begin_facet(); B.begin_facet();
cgal_shape_t::Halfedge_around_facet_circulator circ = f->facet_begin(), end(circ); cgal_polyhedron::Halfedge_around_facet_circulator circ = f->facet_begin(), end(circ);
do { do {
auto P = circ->vertex()->point(); auto P = circ->vertex()->point();
auto it = mapping.find(P); auto it = mapping.find(P);
@@ -161,9 +161,9 @@ struct Builder_With_Map : public CGAL::Modifier_base<HDS> {
} }
}; };
double facet_area(const cgal_shape_t::Facet_handle& f); double facet_area(const cgal_polyhedron::Facet_handle& f);
void dump_facet(const cgal_shape_t::Facet_handle& f); void dump_facet(const cgal_polyhedron::Facet_handle& f);
struct remove_thickness { struct remove_thickness {
typedef Kernel_::Point_3 Point; typedef Kernel_::Point_3 Point;
@@ -182,17 +182,17 @@ struct remove_thickness {
typedef CGAL::AABB_tree<AAbbTraits> Tree; typedef CGAL::AABB_tree<AAbbTraits> Tree;
typedef boost::optional<Tree::Intersection_and_primitive_id<Ray>::Type> Ray_intersection; typedef boost::optional<Tree::Intersection_and_primitive_id<Ray>::Type> Ray_intersection;
cgal_shape_t polyhedron, polyhedron2, flattened; cgal_polyhedron polyhedron, polyhedron2, flattened;
remove_thickness(const cgal_shape_t& p) remove_thickness(const cgal_polyhedron& p)
// edge_collapse(p) still does not work :( // edge_collapse(p) still does not work :(
: polyhedron(p) : polyhedron(p)
, polyhedron2(p) { , polyhedron2(p) {
CGAL::Polygon_mesh_processing::triangulate_faces(polyhedron); CGAL::Polygon_mesh_processing::triangulate_faces(polyhedron);
CGAL::Polygon_mesh_processing::triangulate_faces(polyhedron2); CGAL::Polygon_mesh_processing::triangulate_faces(polyhedron2);
std::list<cgal_shape_t::Facet_handle> non_degenerate, degenerate, longitudinal; std::list<cgal_polyhedron::Facet_handle> non_degenerate, degenerate, longitudinal;
std::set<cgal_shape_t::Facet_iterator> thin_sides; std::set<cgal_polyhedron::Facet_iterator> thin_sides;
std::wcout << "ALL FACES:" << std::endl; std::wcout << "ALL FACES:" << std::endl;
@@ -211,8 +211,8 @@ struct remove_thickness {
dump_facet(f); dump_facet(f);
} }
cgal_shape_t enlarged_non_degenerate_triangles; cgal_polyhedron enlarged_non_degenerate_triangles;
Build_Offset<cgal_shape_t::HDS> bo; Build_Offset<cgal_polyhedron::HDS> bo;
bo.input = non_degenerate; bo.input = non_degenerate;
enlarged_non_degenerate_triangles.delegate(bo); enlarged_non_degenerate_triangles.delegate(bo);
@@ -220,8 +220,8 @@ struct remove_thickness {
Tree tree(faces(enlarged_non_degenerate_triangles).first, faces(enlarged_non_degenerate_triangles).second, enlarged_non_degenerate_triangles); Tree tree(faces(enlarged_non_degenerate_triangles).first, faces(enlarged_non_degenerate_triangles).second, enlarged_non_degenerate_triangles);
std::map<cgal_face_descriptor_t, Kernel_::Vector_3> face_normals; std::map<cgal_face_descriptor, Kernel_::Vector_3> face_normals;
boost::associative_property_map<std::map<cgal_face_descriptor_t, Kernel_::Vector_3>> face_normals_map(face_normals); boost::associative_property_map<std::map<cgal_face_descriptor, Kernel_::Vector_3>> face_normals_map(face_normals);
CGAL::Polygon_mesh_processing::compute_face_normals(polyhedron, face_normals_map); CGAL::Polygon_mesh_processing::compute_face_normals(polyhedron, face_normals_map);
for (auto& f : non_degenerate) { for (auto& f : non_degenerate) {
@@ -269,8 +269,8 @@ struct remove_thickness {
std::wcout << "faces " << faces(polyhedron).size() << "long " << longitudinal.size() << "thin " << thin_sides.size() << "non-degen " << non_degenerate.size() << std::endl; std::wcout << "faces " << faces(polyhedron).size() << "long " << longitudinal.size() << "thin " << thin_sides.size() << "non-degen " << non_degenerate.size() << std::endl;
cgal_shape_t enlarged_indiv_triangles; cgal_polyhedron enlarged_indiv_triangles;
Build_Offset<cgal_shape_t::HDS> bo2; Build_Offset<cgal_polyhedron::HDS> bo2;
bo2.input = longitudinal; bo2.input = longitudinal;
enlarged_indiv_triangles.delegate(bo2); enlarged_indiv_triangles.delegate(bo2);
@@ -301,9 +301,9 @@ struct remove_thickness {
Kernel_::Vector_3 norm; Kernel_::Vector_3 norm;
Kernel_::Vector_3 accum; Kernel_::Vector_3 accum;
int count = 0; int count = 0;
CGAL::Face_around_target_circulator<cgal_shape_t> it(v->halfedge(), polyhedron), end(it); CGAL::Face_around_target_circulator<cgal_polyhedron> it(v->halfedge(), polyhedron), end(it);
do { do {
cgal_shape_t::Facet_handle fh = (*it)->halfedge()->facet(); cgal_polyhedron::Facet_handle fh = (*it)->halfedge()->facet();
auto jt = std::find(non_degenerate.begin(), non_degenerate.end(), fh); auto jt = std::find(non_degenerate.begin(), non_degenerate.end(), fh);
std::wcout << "non degen: " << (jt != non_degenerate.end()) << std::endl; std::wcout << "non degen: " << (jt != non_degenerate.end()) << std::endl;
@@ -408,8 +408,8 @@ struct remove_thickness {
if (std::find(connected.begin(), connected.end(), f) == connected.end()) { if (std::find(connected.begin(), connected.end(), f) == connected.end()) {
connected_opposing = connected_faces(f, thin_sides_degenerate); connected_opposing = connected_faces(f, thin_sides_degenerate);
std::set<cgal_shape_t::Facet_handle> longi(longitudinal.begin(), longitudinal.end()); std::set<cgal_polyhedron::Facet_handle> longi(longitudinal.begin(), longitudinal.end());
std::set<cgal_shape_t::Facet_handle> both_sides(connected.begin(), connected.end()); std::set<cgal_polyhedron::Facet_handle> both_sides(connected.begin(), connected.end());
both_sides.insert(connected_opposing.begin(), connected_opposing.end()); both_sides.insert(connected_opposing.begin(), connected_opposing.end());
if (longi == both_sides) { if (longi == both_sides) {
@@ -422,7 +422,7 @@ struct remove_thickness {
} }
} }
Builder_With_Map<cgal_shape_t::HDS> b2; Builder_With_Map<cgal_polyhedron::HDS> b2;
b2.input = connected; b2.input = connected;
b2.mapping = new_points; b2.mapping = new_points;
@@ -432,11 +432,11 @@ struct remove_thickness {
struct intersection_validator { struct intersection_validator {
typedef std::list<std::pair<const ifcopenshell::IfcBaseEntity*, CGAL::Nef_polyhedron_3<Kernel_>> > nefs_t; typedef std::list<std::pair<const ifcopenshell::IfcBaseEntity*, CGAL::Nef_polyhedron_3<Kernel_>> > nef_list;
typedef CGAL::Box_intersection_d::Box_with_handle_d<double, 3, nefs_t::value_type*> Box; typedef CGAL::Box_intersection_d::Box_with_handle_d<double, 3, nef_list::value_type*> Box;
std::vector<Box> boxes; std::vector<Box> boxes;
nefs_t nefs; nef_list nefs;
double total_map_time = 0.; double total_map_time = 0.;
double total_geom_time = 0.; double total_geom_time = 0.;
@@ -456,7 +456,7 @@ struct intersection_validator {
settings.get<ifcopenshell::geom::settings::IteratorOutput>().value = ifcopenshell::geom::settings::NATIVE; settings.get<ifcopenshell::geom::settings::IteratorOutput>().value = ifcopenshell::geom::settings::NATIVE;
settings.get<ifcopenshell::geom::settings::DisableOpeningSubtractions>().value = true; settings.get<ifcopenshell::geom::settings::DisableOpeningSubtractions>().value = true;
std::vector<ifcopenshell::geom::filter_t> spaces_and_walls = { std::vector<ifcopenshell::geom::filter_function> spaces_and_walls = {
ifcopenshell::geom::entity_filter(true, false, entities) ifcopenshell::geom::entity_filter(true, false, entities)
}; };
@@ -491,16 +491,16 @@ struct intersection_validator {
std::wcout << sss.c_str() << std::endl; std::wcout << sss.c_str() << std::endl;
for (auto& g : geom_object->geometry()) { for (auto& g : geom_object->geometry()) {
cgal_shape_t s = *std::static_pointer_cast<ifcopenshell::geom::cgal_shape>(g.Shape()); cgal_polyhedron s = *std::static_pointer_cast<ifcopenshell::geom::cgal_shape>(g.Shape());
const auto& m = g.Placement()->ccomponents(); const auto& m = g.Placement()->ccomponents();
const auto& n = geom_object->transformation().data()->ccomponents(); const auto& n = geom_object->transformation().data()->ccomponents();
const cgal_placement_t trsf( const cgal_placement trsf(
m(0, 0), m(0, 1), m(0, 2), m(0, 3), m(0, 0), m(0, 1), m(0, 2), m(0, 3),
m(1, 0), m(1, 1), m(1, 2), m(1, 3), m(1, 0), m(1, 1), m(1, 2), m(1, 3),
m(2, 0), m(2, 1), m(2, 2), m(2, 3)); m(2, 0), m(2, 1), m(2, 2), m(2, 3));
const cgal_placement_t trsf2( const cgal_placement trsf2(
n(0, 0), n(0, 1), n(0, 2), n(0, 3), n(0, 0), n(0, 1), n(0, 2), n(0, 3),
n(1, 0), n(1, 1), n(1, 2), n(1, 3), n(1, 0), n(1, 1), n(1, 2), n(1, 3),
n(2, 0), n(2, 1), n(2, 2), n(2, 3)); n(2, 0), n(2, 1), n(2, 2), n(2, 3));
+2 -2
View File
@@ -44,7 +44,7 @@ namespace geom {
/// The filter function (free or member function) or function object (use boost::ref() to reference to it) /// The filter function (free or member function) or function object (use boost::ref() to reference to it)
/// should return true if the geometry for the product is wanted to be included in the output. /// should return true if the geometry for the product is wanted to be included in the output.
/// http://www.boost.org/doc/libs/1_62_0/doc/html/function/tutorial.html /// http://www.boost.org/doc/libs/1_62_0/doc/html/function/tutorial.html
typedef boost::function<bool(const express::base&)> filter_t; typedef boost::function<bool(const express::base&)> filter_function;
class IFC_GEOM_API abstract_mapping { class IFC_GEOM_API abstract_mapping {
protected: protected:
@@ -58,7 +58,7 @@ namespace geom {
virtual ~abstract_mapping() {} virtual ~abstract_mapping() {}
virtual ifcopenshell::geom::taxonomy::ptr map(const express::base&) = 0; virtual ifcopenshell::geom::taxonomy::ptr map(const express::base&) = 0;
virtual void get_representations(std::vector<geometry_conversion_task>& tasks, std::vector<filter_t>& filters) = 0; virtual void get_representations(std::vector<geometry_conversion_task>& tasks, std::vector<filter_function>& filters) = 0;
virtual express::base get_decomposing_entity(const express::base& product, bool include_openings = true) = 0; virtual express::base get_decomposing_entity(const express::base& product, bool include_openings = true) = 0;
virtual std::map<std::string, express::base> get_layers(const express::base&) = 0; virtual std::map<std::string, express::base> get_layers(const express::base&) = 0;
virtual std::vector<express::base> find_openings(const express::base&) = 0; virtual std::vector<express::base> find_openings(const express::base&) = 0;
+5 -5
View File
@@ -56,7 +56,7 @@ namespace ifcopenshell::geom {
/// Optional description for the filtering criteria of this filter. /// Optional description for the filtering criteria of this filter.
std::string description; std::string description;
bool match(const express::base& prod, const ifcopenshell::geom::filter_t& pred) const { bool match(const express::base& prod, const ifcopenshell::geom::filter_function& pred) const {
bool is_match = pred(prod); bool is_match = pred(prod);
if (!is_match && traverse) { if (!is_match && traverse) {
is_match = traverse_match(prod, pred); is_match = traverse_match(prod, pred);
@@ -64,7 +64,7 @@ namespace ifcopenshell::geom {
return is_match == include; return is_match == include;
} }
bool traverse_match(const express::base& prod, const ifcopenshell::geom::filter_t& pred) const bool traverse_match(const express::base& prod, const ifcopenshell::geom::filter_function& pred) const
{ {
express::base parent, current = prod; express::base parent, current = prod;
// @todo examine if this can indeed be static. For now usage is only // @todo examine if this can indeed be static. For now usage is only
@@ -171,7 +171,7 @@ namespace ifcopenshell::geom {
}; };
struct layer_filter : public wildcard_filter { struct layer_filter : public wildcard_filter {
typedef std::map<std::string, express::base> layer_map_t; typedef std::map<std::string, express::base> layer_map;
layer_filter() {} layer_filter() {}
layer_filter(bool include, bool traverse, const std::set<std::string>& patterns) layer_filter(bool include, bool traverse, const std::set<std::string>& patterns)
@@ -181,7 +181,7 @@ namespace ifcopenshell::geom {
// @todo // @todo
ifcopenshell::geom::settings s; ifcopenshell::geom::settings s;
static auto mapping = ifcopenshell::geom::impl::mapping_implementations().construct(prod.file(), s); static auto mapping = ifcopenshell::geom::impl::mapping_implementations().construct(prod.file(), s);
layer_map_t layers = mapping->get_layers(prod); layer_map layers = mapping->get_layers(prod);
return std::find_if(layers.begin(), layers.end(), wildcards_match(values)) != layers.end(); return std::find_if(layers.begin(), layers.end(), wildcards_match(values)) != layers.end();
} }
@@ -191,7 +191,7 @@ namespace ifcopenshell::geom {
struct wildcards_match { struct wildcards_match {
wildcards_match(const std::set<boost::regex>& patterns) : patterns(patterns) {} wildcards_match(const std::set<boost::regex>& patterns) : patterns(patterns) {}
bool operator()(const layer_map_t::value_type& layer_map_value) const { bool operator()(const layer_map::value_type& layer_map_value) const {
return wildcard_filter::match_values(patterns, layer_map_value.first); return wildcard_filter::match_values(patterns, layer_map_value.first);
} }
+4 -4
View File
@@ -125,7 +125,7 @@ namespace ifcopenshell::geom {
ifcopenshell::geom::settings settings_; ifcopenshell::geom::settings settings_;
ifcopenshell::file* ifc_file; ifcopenshell::file* ifc_file;
std::vector<ifcopenshell::geom::filter_t> filters_; std::vector<ifcopenshell::geom::filter_function> filters_;
int num_threads_; int num_threads_;
std::string geometry_library_; std::string geometry_library_;
ifcopenshell::logger& logger_; ifcopenshell::logger& logger_;
@@ -183,7 +183,7 @@ namespace ifcopenshell::geom {
ifcopenshell::geom::taxonomy::direction3::ptr remove_offset_(); ifcopenshell::geom::taxonomy::direction3::ptr remove_offset_();
public: public:
iterator(std::unique_ptr<ifcopenshell::geom::kernels::abstract_kernel>&& geometry_library, const ifcopenshell::geom::settings& settings, ifcopenshell::file* file, const std::vector<ifcopenshell::geom::filter_t>& filters, int num_threads, ifcopenshell::logger& logger = ifcopenshell::logger::root()) iterator(std::unique_ptr<ifcopenshell::geom::kernels::abstract_kernel>&& geometry_library, const ifcopenshell::geom::settings& settings, ifcopenshell::file* file, const std::vector<ifcopenshell::geom::filter_function>& filters, int num_threads, ifcopenshell::logger& logger = ifcopenshell::logger::root())
: settings_(settings) : settings_(settings)
, ifc_file(file) , ifc_file(file)
, filters_(filters) , filters_(filters)
@@ -280,8 +280,8 @@ namespace ifcopenshell::geom {
ifcopenshell::file* file() const { return ifc_file; } ifcopenshell::file* file() const { return ifc_file; }
const std::vector<ifcopenshell::geom::filter_t>& filters() const { return filters_; } const std::vector<ifcopenshell::geom::filter_function>& filters() const { return filters_; }
std::vector<ifcopenshell::geom::filter_t>& filters() { return filters_; } std::vector<ifcopenshell::geom::filter_function>& filters() { return filters_; }
const ifcopenshell::geom::taxonomy::point3& bounds_min() const { return bounds_min_; } const ifcopenshell::geom::taxonomy::point3& bounds_min() const { return bounds_min_; }
const ifcopenshell::geom::taxonomy::point3& bounds_max() const { return bounds_max_; } const ifcopenshell::geom::taxonomy::point3& bounds_max() const { return bounds_max_; }
@@ -31,15 +31,15 @@ typedef polyhedron::Facet_const_handle facet_const_handle;
typedef polyhedron::Halfedge_around_facet_const_circulator halfedge_around_facet_circulator; typedef polyhedron::Halfedge_around_facet_const_circulator halfedge_around_facet_circulator;
namespace { namespace {
cgal_placement_t make_transform(const ifcopenshell::geom::taxonomy::matrix4& place) { cgal_placement make_transform(const ifcopenshell::geom::taxonomy::matrix4& place) {
const auto& m = place.ccomponents(); const auto& m = place.ccomponents();
return cgal_placement_t( return cgal_placement(
m(0, 0), m(0, 1), m(0, 2), m(0, 3), m(0, 0), m(0, 1), m(0, 2), m(0, 3),
m(1, 0), m(1, 1), m(1, 2), m(1, 3), m(1, 0), m(1, 1), m(1, 2), m(1, 3),
m(2, 0), m(2, 1), m(2, 2), m(2, 3)); m(2, 0), m(2, 1), m(2, 2), m(2, 3));
} }
opaque_coordinate<3> opaque_point(const cgal_point_t& p) { opaque_coordinate<3> opaque_point(const cgal_point& p) {
return opaque_coordinate<3>( return opaque_coordinate<3>(
NumberType(p.cartesian(0)), NumberType(p.cartesian(0)),
NumberType(p.cartesian(1)), NumberType(p.cartesian(1)),
@@ -54,7 +54,7 @@ namespace {
return ((-*minel) > *maxel) ? (-*minel) : *maxel; return ((-*minel) > *maxel) ? (-*minel) : *maxel;
} }
opaque_coordinate<3> opaque_axis(const cgal_vector_t& v) { opaque_coordinate<3> opaque_axis(const cgal_vector& v) {
auto maxval = max_abs3(v.x(), v.y(), v.z()); auto maxval = max_abs3(v.x(), v.y(), v.z());
if (maxval == 0) { if (maxval == 0) {
throw std::runtime_error("Invalid shape type"); throw std::runtime_error("Invalid shape type");
@@ -66,7 +66,7 @@ namespace {
); );
} }
opaque_coordinate<4> opaque_plane(const cgal_plane_t& p) { opaque_coordinate<4> opaque_plane(const cgal_plane& p) {
auto maxval = max_abs3(p.a(), p.b(), p.c()); auto maxval = max_abs3(p.a(), p.b(), p.c());
if (maxval == 0) { if (maxval == 0) {
throw std::runtime_error("Invalid shape type"); throw std::runtime_error("Invalid shape type");
@@ -79,16 +79,16 @@ namespace {
); );
} }
cgal_plane_t plane_from_opaque(const opaque_coordinate<4>& p) { cgal_plane plane_from_opaque(const opaque_coordinate<4>& p) {
#ifdef IFOPSH_SIMPLE_KERNEL #ifdef IFOPSH_SIMPLE_KERNEL
return cgal_plane_t( return cgal_plane(
p.get(0).to_double(), p.get(0).to_double(),
p.get(1).to_double(), p.get(1).to_double(),
p.get(2).to_double(), p.get(2).to_double(),
p.get(3).to_double() p.get(3).to_double()
); );
#else #else
return cgal_plane_t( return cgal_plane(
p.get(0).value_as<CGAL::Epeck::FT>(), p.get(0).value_as<CGAL::Epeck::FT>(),
p.get(1).value_as<CGAL::Epeck::FT>(), p.get(1).value_as<CGAL::Epeck::FT>(),
p.get(2).value_as<CGAL::Epeck::FT>(), p.get(2).value_as<CGAL::Epeck::FT>(),
@@ -104,7 +104,7 @@ namespace {
}); });
} }
void apply_normalized_plane_map(const plane_map<kernel_>& mp, std::list<cgal_plane_t>& planes) { void apply_normalized_plane_map(const plane_map<kernel_>& mp, std::list<cgal_plane>& planes) {
for (auto& plane : planes) { for (auto& plane : planes) {
auto it = mp.find(normalized_plane_for_map<kernel_>(plane)); auto it = mp.find(normalized_plane_for_map<kernel_>(plane));
if (it != mp.end()) { if (it != mp.end()) {
@@ -113,10 +113,10 @@ namespace {
} }
} }
cgal_vector_t wire_normal(const cgal_wire_t& wire) { cgal_vector wire_normal(const cgal_wire& wire) {
typename kernel_::FT a(0), b(0), c(0); typename kernel_::FT a(0), b(0), c(0);
if (wire.size() < 3) { if (wire.size() < 3) {
return cgal_vector_t(a, b, c); return cgal_vector(a, b, c);
} }
for (std::size_t i = 0; i < wire.size(); ++i) { for (std::size_t i = 0; i < wire.size(); ++i) {
const auto& curr = wire[i]; const auto& curr = wire[i];
@@ -125,10 +125,10 @@ namespace {
b += (curr.z() - next.z()) * (curr.x() + next.x()); b += (curr.z() - next.z()) * (curr.x() + next.x());
c += (curr.x() - next.x()) * (curr.y() + next.y()); c += (curr.x() - next.x()) * (curr.y() + next.y());
} }
return cgal_vector_t(a, b, c); return cgal_vector(a, b, c);
} }
cgal_point_t wire_centroid(const cgal_wire_t& wire) { cgal_point wire_centroid(const cgal_wire& wire) {
if (wire.empty()) { if (wire.empty()) {
throw std::runtime_error("Invalid shape type"); throw std::runtime_error("Invalid shape type");
} }
@@ -139,10 +139,10 @@ namespace {
} }
} }
kernel_::FT n(wire.size()); kernel_::FT n(wire.size());
return cgal_point_t(p[0] / n, p[1] / n, p[2] / n); return cgal_point(p[0] / n, p[1] / n, p[2] / n);
} }
kernel_::FT wire_length(const cgal_wire_t& wire) { kernel_::FT wire_length(const cgal_wire& wire) {
kernel_::FT len(0); kernel_::FT len(0);
if (wire.size() < 2) { if (wire.size() < 2) {
return len; return len;
@@ -156,7 +156,7 @@ namespace {
return len; return len;
} }
kernel_::FT wire_area(const cgal_wire_t& wire) { kernel_::FT wire_area(const cgal_wire& wire) {
kernel_::FT area(0); kernel_::FT area(0);
if (wire.size() < 3) { if (wire.size() < 3) {
return area; return area;
@@ -170,8 +170,8 @@ namespace {
return area; return area;
} }
cgal_wire_t moved_wire(const cgal_wire_t& wire, const cgal_placement_t& trsf) { cgal_wire moved_wire(const cgal_wire& wire, const cgal_placement& trsf) {
cgal_wire_t result; cgal_wire result;
result.reserve(wire.size()); result.reserve(wire.size());
for (const auto& point : wire) { for (const auto& point : wire) {
result.push_back(point.transform(trsf)); result.push_back(point.transform(trsf));
@@ -179,12 +179,12 @@ namespace {
return result; return result;
} }
void write_off_point(std::stringstream& sstream, const cgal_point_t& point) { void write_off_point(std::stringstream& sstream, const cgal_point& point) {
sstream << "OFF\n1 0 0\n"; sstream << "OFF\n1 0 0\n";
sstream << point.x() << " " << point.y() << " " << point.z() << "\n"; sstream << point.x() << " " << point.y() << " " << point.z() << "\n";
} }
void write_off_wire(std::stringstream& sstream, const cgal_wire_t& wire) { void write_off_wire(std::stringstream& sstream, const cgal_wire& wire) {
const bool face = wire.size() >= 3; const bool face = wire.size() >= 3;
sstream << "OFF\n" << wire.size() << " " << (face ? 1 : 0) << " 0\n"; sstream << "OFF\n" << wire.size() << " " << (face ? 1 : 0) << " 0\n";
for (const auto& point : wire) { for (const auto& point : wire) {
@@ -268,12 +268,12 @@ namespace {
} }
} }
ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_shape_t& shape, bool convex, ifcopenshell::logger& logger) { ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_polyhedron& shape, bool convex, ifcopenshell::logger& logger) {
shape_ = shape; shape_ = shape;
convex_tag_ = convex; convex_tag_ = convex;
auto& poly = std::get<cgal_shape_t>(*shape_); auto& poly = std::get<cgal_polyhedron>(*shape_);
std::set<cgal_shape_t::Facet_handle> faces_to_remove; std::set<cgal_polyhedron::Facet_handle> faces_to_remove;
for (const auto& face : CGAL::faces(poly)) { for (const auto& face : CGAL::faces(poly)) {
auto V = newell(*face).to_vector(); auto V = newell(*face).to_vector();
@@ -315,30 +315,30 @@ ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_shape_t& shape, bool conve
} }
} }
ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_point_t& point, bool convex) { ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_point& point, bool convex) {
shape_ = point; shape_ = point;
convex_tag_ = convex; convex_tag_ = convex;
} }
ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_wire_t& wire, bool convex) { ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_wire& wire, bool convex) {
shape_ = wire; shape_ = wire;
convex_tag_ = convex; convex_tag_ = convex;
} }
const cgal_shape_t& ifcopenshell::geom::cgal_shape::poly() const { const cgal_polyhedron& ifcopenshell::geom::cgal_shape::poly() const {
#ifndef IFOPSH_SIMPLE_KERNEL #ifndef IFOPSH_SIMPLE_KERNEL
to_poly(); to_poly();
#endif #endif
if (!shape_ || !std::holds_alternative<cgal_shape_t>(*shape_)) { if (!shape_ || !std::holds_alternative<cgal_polyhedron>(*shape_)) {
throw std::runtime_error("Invalid shape type"); throw std::runtime_error("Invalid shape type");
} }
return std::get<cgal_shape_t>(*shape_); return std::get<cgal_polyhedron>(*shape_);
} }
#ifndef IFOPSH_SIMPLE_KERNEL #ifndef IFOPSH_SIMPLE_KERNEL
void ifcopenshell::geom::cgal_shape::to_poly() const { void ifcopenshell::geom::cgal_shape::to_poly() const {
if (!shape_) { if (!shape_) {
cgal_shape_t poly; cgal_polyhedron poly;
convert_to_polyhedron(*nef_, poly, std::numeric_limits<std::size_t>::max()); convert_to_polyhedron(*nef_, poly, std::numeric_limits<std::size_t>::max());
if (poly.size_of_vertices() > 0) { if (poly.size_of_vertices() > 0) {
// @todo why is this necessary? we have the mark of the volumes? // @todo why is this necessary? we have the mark of the volumes?
@@ -372,15 +372,15 @@ void ifcopenshell::geom::cgal_shape::Triangulate(ifcopenshell::geom::settings se
const bool all_triangles = std::all_of(base_shape.facets_begin(), base_shape.facets_end(), [](auto f) { return f.is_triangle(); }); const bool all_triangles = std::all_of(base_shape.facets_begin(), base_shape.facets_end(), [](auto f) { return f.is_triangle(); });
const bool has_iden_transform = place.is_identity(); const bool has_iden_transform = place.is_identity();
std::unique_ptr<cgal_shape_t> shape_copy_holder; std::unique_ptr<cgal_polyhedron> shape_copy_holder;
cgal_shape_t* shape_to_use; cgal_polyhedron* shape_to_use;
if (!all_triangles || !has_iden_transform) { if (!all_triangles || !has_iden_transform) {
// A copy is made when triangulate_faces() is required or when vertex positions need be transformed // A copy is made when triangulate_faces() is required or when vertex positions need be transformed
shape_copy_holder.reset(new cgal_shape_t(base_shape)); shape_copy_holder.reset(new cgal_polyhedron(base_shape));
shape_to_use = shape_copy_holder.get(); shape_to_use = shape_copy_holder.get();
} else { } else {
shape_to_use = const_cast<cgal_shape_t*>(&base_shape); shape_to_use = const_cast<cgal_polyhedron*>(&base_shape);
} }
const bool setting_use_original_edges = settings.get<ifcopenshell::geom::settings::CgalEmitOriginalEdges>().get(); const bool setting_use_original_edges = settings.get<ifcopenshell::geom::settings::CgalEmitOriginalEdges>().get();
@@ -396,7 +396,7 @@ void ifcopenshell::geom::cgal_shape::Triangulate(ifcopenshell::geom::settings se
const auto& m = place.ccomponents(); const auto& m = place.ccomponents();
// @todo check // @todo check
const cgal_placement_t trsf( const cgal_placement trsf(
m(0, 0), m(0, 1), m(0, 2), m(0, 3), m(0, 0), m(0, 1), m(0, 2), m(0, 3),
m(1, 0), m(1, 1), m(1, 2), m(1, 3), m(1, 0), m(1, 1), m(1, 2), m(1, 3),
m(2, 0), m(2, 1), m(2, 2), m(2, 3)); m(2, 0), m(2, 1), m(2, 2), m(2, 3));
@@ -455,8 +455,8 @@ void ifcopenshell::geom::cgal_shape::Triangulate(ifcopenshell::geom::settings se
} }
} }
// std::map<cgal_vertex_descriptor_t, kernel_::Vector_3> vertex_normals; // std::map<cgal_vertex_descriptor, kernel_::Vector_3> vertex_normals;
// boost::associative_property_map<std::map<cgal_vertex_descriptor_t, kernel_::Vector_3>> vertex_normals_map(vertex_normals); // boost::associative_property_map<std::map<cgal_vertex_descriptor, kernel_::Vector_3>> vertex_normals_map(vertex_normals);
// Triangulate the shape and compute the normals // Triangulate the shape and compute the normals
std::map<facet_const_handle, kernel_::Vector_3> face_normals; std::map<facet_const_handle, kernel_::Vector_3> face_normals;
@@ -601,7 +601,7 @@ void ifcopenshell::geom::cgal_shape::Serialize(const ifcopenshell::geom::taxonom
} }
write_off_wire(sstream, w); write_off_wire(sstream, w);
} else { } else {
cgal_shape_t s = poly(); cgal_polyhedron s = poly();
if (!place.is_identity()) { if (!place.is_identity()) {
const auto trsf = make_transform(place); const auto trsf = make_transform(place);
@@ -794,7 +794,7 @@ opaque_coordinate<3> ifcopenshell::geom::cgal_shape::axis()
auto shp = poly(); auto shp = poly();
if (shp.size_of_facets() == 1) { if (shp.size_of_facets() == 1) {
auto pl = facet_plane_equation()(*shp.facets_begin()); auto pl = facet_plane_equation()(*shp.facets_begin());
return opaque_axis(cgal_vector_t(pl.a(), pl.b(), pl.c())); return opaque_axis(cgal_vector(pl.a(), pl.b(), pl.c()));
} else { } else {
throw std::runtime_error("Invalid shape type"); throw std::runtime_error("Invalid shape type");
} }
@@ -804,7 +804,7 @@ opaque_coordinate<4> ifcopenshell::geom::cgal_shape::plane_equation()
{ {
if (is_wire() && wire().size() >= 3) { if (is_wire() && wire().size() >= 3) {
auto normal = wire_normal(wire()); auto normal = wire_normal(wire());
return opaque_plane(cgal_plane_t(wire().front(), CGAL::Direction_3<kernel_>(normal))); return opaque_plane(cgal_plane(wire().front(), CGAL::Direction_3<kernel_>(normal)));
} }
auto shp = poly(); auto shp = poly();
if (shp.size_of_facets() == 1) { if (shp.size_of_facets() == 1) {
@@ -891,15 +891,15 @@ std::vector<conversion_result_shape*> ifcopenshell::geom::cgal_shape::edges()
if (is_wire()) { if (is_wire()) {
const auto& w = wire(); const auto& w = wire();
for (std::size_t i = 1; i < w.size(); ++i) { for (std::size_t i = 1; i < w.size(); ++i) {
result.push_back(new cgal_shape(cgal_wire_t{ w[i - 1], w[i] })); result.push_back(new cgal_shape(cgal_wire{ w[i - 1], w[i] }));
} }
if (w.size() > 2) { if (w.size() > 2) {
result.push_back(new cgal_shape(cgal_wire_t{ w.back(), w.front() })); result.push_back(new cgal_shape(cgal_wire{ w.back(), w.front() }));
} }
return result; return result;
} }
for (auto ed : poly().edges()) { for (auto ed : poly().edges()) {
result.push_back(new cgal_shape(cgal_wire_t{ ed.vertex()->point(), ed.opposite()->vertex()->point() })); result.push_back(new cgal_shape(cgal_wire{ ed.vertex()->point(), ed.opposite()->vertex()->point() }));
} }
return result; return result;
} }
@@ -917,7 +917,7 @@ std::vector<conversion_result_shape*> ifcopenshell::geom::cgal_shape::facets()
return result; return result;
} }
for (auto face : faces(poly())) { for (auto face : faces(poly())) {
std::vector<cgal_point_t> ps; std::vector<cgal_point> ps;
auto it = face->facet_begin(); auto it = face->facet_begin();
do { do {
@@ -959,7 +959,7 @@ conversion_result_shape* ifcopenshell::geom::cgal_shape::intersect(conversion_re
namespace { namespace {
template <typename polyhedron_type> template <typename polyhedron_type>
void concatenate_polyhedra(polyhedron_type& p1, const polyhedron_type& p2) { void concatenate_polyhedra(polyhedron_type& p1, const polyhedron_type& p2) {
std::vector<cgal_point_t> points1, points2; std::vector<cgal_point> points1, points2;
std::vector<std::vector<std::size_t>> faces1, faces2; std::vector<std::vector<std::size_t>> faces1, faces2;
// Extract soups // Extract soups
@@ -1012,7 +1012,7 @@ conversion_result_shape* ifcopenshell::geom::cgal_shape::moved(ifcopenshell::geo
return new cgal_shape(moved_wire(wire(), trsf), convex_tag_); return new cgal_shape(moved_wire(wire(), trsf), convex_tag_);
} }
cgal_shape_t s = poly(); cgal_polyhedron s = poly();
for (auto &vertex : s.vertex_handles()) { for (auto &vertex : s.vertex_handles()) {
vertex->point() = vertex->point().transform(trsf); vertex->point() = vertex->point().transform(trsf);
} }
@@ -47,17 +47,17 @@
#define kernel_ Simplekernel_ #define kernel_ Simplekernel_
#define cgal_shape SimpleCgalShape #define cgal_shape SimpleCgalShape
#define cgal_placement_t cgal_simple_placement_t #define cgal_placement cgal_simple_placement
#define cgal_point_t cgal_simple_point_t #define cgal_point cgal_simple_point
#define cgal_direction_t cgal_simple_direction_t #define cgal_direction cgal_simple_direction
#define cgal_vector_t cgal_simple_vector_t #define cgal_vector cgal_simple_vector
#define cgal_plane_t cgal_simple_plane_t #define cgal_plane cgal_simple_plane
#define cgal_curve_t cgal_simple_curve_t #define cgal_curve cgal_simple_curve
#define cgal_wire_t cgal_simple_wire_t #define cgal_wire cgal_simple_wire
#define cgal_face_t cgal_simple_face_t #define cgal_face cgal_simple_face
#define cgal_shape_t cgal_simple_shape_t #define cgal_polyhedron cgal_simple_polyhedron
#define cgal_vertex_descriptor_t cgal_simple_vertex_descriptor_t #define cgal_vertex_descriptor cgal_simple_vertex_descriptor
#define cgal_face_descriptor_t cgal_simple_face_descriptor_t #define cgal_face_descriptor cgal_simple_face_descriptor
typedef CGAL::Exact_predicates_inexact_constructions_kernel kernel_; typedef CGAL::Exact_predicates_inexact_constructions_kernel kernel_;
@@ -69,24 +69,24 @@ typedef CGAL::Exact_predicates_exact_constructions_kernel kernel_;
#endif #endif
typedef kernel_::Aff_transformation_3 cgal_placement_t; typedef kernel_::Aff_transformation_3 cgal_placement;
typedef kernel_::Point_3 cgal_point_t; typedef kernel_::Point_3 cgal_point;
typedef kernel_::Vector_3 cgal_direction_t; typedef kernel_::Vector_3 cgal_direction;
typedef kernel_::Vector_3 cgal_vector_t; typedef kernel_::Vector_3 cgal_vector;
typedef kernel_::Plane_3 cgal_plane_t; typedef kernel_::Plane_3 cgal_plane;
typedef std::vector<kernel_::Point_3> cgal_curve_t; typedef std::vector<kernel_::Point_3> cgal_curve;
typedef std::vector<kernel_::Point_3> cgal_wire_t; typedef std::vector<kernel_::Point_3> cgal_wire;
namespace { namespace {
struct cgal_face_t { struct cgal_face {
cgal_wire_t outer; cgal_wire outer;
std::vector<cgal_wire_t> inner; std::vector<cgal_wire> inner;
}; };
} }
typedef CGAL::Polyhedron_3<kernel_> cgal_shape_t; typedef CGAL::Polyhedron_3<kernel_> cgal_polyhedron;
typedef boost::graph_traits<CGAL::Polyhedron_3<kernel_>>::vertex_descriptor cgal_vertex_descriptor_t; typedef boost::graph_traits<CGAL::Polyhedron_3<kernel_>>::vertex_descriptor cgal_vertex_descriptor;
typedef boost::graph_traits<CGAL::Polyhedron_3<kernel_>>::face_descriptor cgal_face_descriptor_t; typedef boost::graph_traits<CGAL::Polyhedron_3<kernel_>>::face_descriptor cgal_face_descriptor;
#include "../../../ifcgeom/conversion_result.h" #include "../../../ifcgeom/conversion_result.h"
@@ -179,18 +179,18 @@ namespace ifcopenshell { namespace geom {
class IFC_GEOMLIBRARY_API cgal_shape : public ifcopenshell::geom::conversion_result_shape { class IFC_GEOMLIBRARY_API cgal_shape : public ifcopenshell::geom::conversion_result_shape {
private: private:
typedef std::variant<cgal_shape_t, cgal_point_t, cgal_wire_t> cgal_shape_storage_t; typedef std::variant<cgal_polyhedron, cgal_point, cgal_wire> cgal_shape_storage;
bool convex_tag_ = false; bool convex_tag_ = false;
mutable std::optional<cgal_shape_storage_t> shape_; mutable std::optional<cgal_shape_storage> shape_;
#ifndef IFOPSH_SIMPLE_KERNEL #ifndef IFOPSH_SIMPLE_KERNEL
mutable std::optional<CGAL::Nef_polyhedron_3<kernel_>> nef_; mutable std::optional<CGAL::Nef_polyhedron_3<kernel_>> nef_;
#endif #endif
public: public:
cgal_shape(const cgal_shape_t& shape, bool convex = false, ifcopenshell::logger& logger = ifcopenshell::logger::root()); cgal_shape(const cgal_polyhedron& shape, bool convex = false, ifcopenshell::logger& logger = ifcopenshell::logger::root());
cgal_shape(const cgal_point_t& point, bool convex = false); cgal_shape(const cgal_point& point, bool convex = false);
cgal_shape(const cgal_wire_t& wire, bool convex = false); cgal_shape(const cgal_wire& wire, bool convex = false);
#ifndef IFOPSH_SIMPLE_KERNEL #ifndef IFOPSH_SIMPLE_KERNEL
cgal_shape(const CGAL::Nef_polyhedron_3<kernel_>& shape, bool convex = false) { cgal_shape(const CGAL::Nef_polyhedron_3<kernel_>& shape, bool convex = false) {
@@ -218,13 +218,13 @@ namespace ifcopenshell { namespace geom {
return "cgal"; return "cgal";
#endif #endif
} }
operator const cgal_shape_t& () const { return poly(); } operator const cgal_polyhedron& () const { return poly(); }
const cgal_shape_t& poly() const; const cgal_polyhedron& poly() const;
bool is_poly() const { return shape_ && std::holds_alternative<cgal_shape_t>(*shape_); } bool is_poly() const { return shape_ && std::holds_alternative<cgal_polyhedron>(*shape_); }
bool is_point() const { return shape_ && std::holds_alternative<cgal_point_t>(*shape_); } bool is_point() const { return shape_ && std::holds_alternative<cgal_point>(*shape_); }
bool is_wire() const { return shape_ && std::holds_alternative<cgal_wire_t>(*shape_); } bool is_wire() const { return shape_ && std::holds_alternative<cgal_wire>(*shape_); }
const cgal_point_t& point() const { return std::get<cgal_point_t>(*shape_); } const cgal_point& point() const { return std::get<cgal_point>(*shape_); }
const cgal_wire_t& wire() const { return std::get<cgal_wire_t>(*shape_); } const cgal_wire& wire() const { return std::get<cgal_wire>(*shape_); }
virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const; virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const;
virtual void Serialize(const ifcopenshell::geom::taxonomy::matrix4& place, std::string&) const; virtual void Serialize(const ifcopenshell::geom::taxonomy::matrix4& place, std::string&) const;
+97 -97
View File
@@ -45,16 +45,16 @@ using ifcopenshell::logger;
namespace { namespace {
struct polyhedron_builder : public CGAL::Modifier_base<CGAL::Polyhedron_3<kernel_>::HalfedgeDS> { struct polyhedron_builder : public CGAL::Modifier_base<CGAL::Polyhedron_3<kernel_>::HalfedgeDS> {
private: private:
std::list<cgal_face_t> *face_list; std::list<cgal_face> *face_list;
logger& logger_; logger& logger_;
public: public:
std::optional<cgal_shape_t> from_soup; std::optional<cgal_polyhedron> from_soup;
polyhedron_builder(std::list<cgal_face_t> *face_list, logger& logger = ifcopenshell::logger::root()); polyhedron_builder(std::list<cgal_face> *face_list, logger& logger = ifcopenshell::logger::root());
void operator()(CGAL::Polyhedron_3<kernel_>::HalfedgeDS &hds); void operator()(CGAL::Polyhedron_3<kernel_>::HalfedgeDS &hds);
}; };
} }
CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_polyhedron(std::list<cgal_face_t> &face_list, bool stitch_borders, logger& logger) { CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_polyhedron(std::list<cgal_face> &face_list, bool stitch_borders, logger& logger) {
// Naive creation // Naive creation
CGAL::Polyhedron_3<kernel_> polyhedron; CGAL::Polyhedron_3<kernel_> polyhedron;
@@ -107,7 +107,7 @@ CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_polyhedron(const C
} }
} }
CGAL::Nef_polyhedron_3<kernel_> ifcopenshell::geom::utils::create_nef_polyhedron(std::list<cgal_face_t> &face_list, logger& logger) { CGAL::Nef_polyhedron_3<kernel_> ifcopenshell::geom::utils::create_nef_polyhedron(std::list<cgal_face> &face_list, logger& logger) {
CGAL::Polyhedron_3<kernel_> polyhedron = create_polyhedron(face_list, true, logger); CGAL::Polyhedron_3<kernel_> polyhedron = create_polyhedron(face_list, true, logger);
if (polyhedron.is_closed()) { if (polyhedron.is_closed()) {
try { try {
@@ -159,7 +159,7 @@ CGAL::Nef_polyhedron_3<kernel_> ifcopenshell::geom::utils::create_nef_polyhedron
} }
#endif #endif
bool cgal_kernel::convert(const taxonomy::shell::ptr l, cgal_shape_t& shape) { bool cgal_kernel::convert(const taxonomy::shell::ptr l, cgal_polyhedron& shape) {
for (auto& f : l->children) { for (auto& f : l->children) {
if (f->basis && f->basis->kind() != taxonomy::PLANE) { if (f->basis && f->basis->kind() != taxonomy::PLANE) {
logger().error("UNS", 3, "CGAL Kernel: Non-planar faces not supported at the moment"); logger().error("UNS", 3, "CGAL Kernel: Non-planar faces not supported at the moment");
@@ -207,7 +207,7 @@ bool cgal_kernel::convert(const taxonomy::shell::ptr l, cgal_shape_t& shape) {
} }
} }
std::list<cgal_face_t> face_list; std::list<cgal_face> face_list;
for (auto& f : l->children) { for (auto& f : l->children) {
bool success = false; bool success = false;
try { try {
@@ -234,7 +234,7 @@ bool cgal_kernel::convert(const taxonomy::shell::ptr l, cgal_shape_t& shape) {
return shape.size_of_facets(); return shape.size_of_facets();
} }
bool cgal_kernel::convert(const taxonomy::face::ptr face, std::list<cgal_face_t>& result) { bool cgal_kernel::convert(const taxonomy::face::ptr face, std::list<cgal_face>& result) {
int num_outer_bounds = 0; int num_outer_bounds = 0;
for (auto& bound : face->children) { for (auto& bound : face->children) {
@@ -246,14 +246,14 @@ bool cgal_kernel::convert(const taxonomy::face::ptr face, std::list<cgal_face_t>
return false; return false;
} }
cgal_face_t mf; cgal_face mf;
for (auto& bound : face->children) { for (auto& bound : face->children) {
const bool is_interior = !(bound->external.value_or(false) || face->children.size() == 1); const bool is_interior = !(bound->external.value_or(false) || face->children.size() == 1);
// single face bound is always external... even if not marked as such // single face bound is always external... even if not marked as such
cgal_wire_t wire; cgal_wire wire;
if (!convert(bound, wire)) { if (!convert(bound, wire)) {
logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 81, "Failed to process face boundary loop", bound->instance); logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 81, "Failed to process face boundary loop", bound->instance);
return false; return false;
@@ -267,7 +267,7 @@ bool cgal_kernel::convert(const taxonomy::face::ptr face, std::list<cgal_face_t>
if (num_outer_bounds > 1) { if (num_outer_bounds > 1) {
result.push_back(mf); result.push_back(mf);
mf = cgal_face_t{}; mf = cgal_face{};
} }
} }
@@ -286,16 +286,16 @@ bool cgal_kernel::convert(const taxonomy::face::ptr face, std::list<cgal_face_t>
namespace { namespace {
// @todo obsolete? // @todo obsolete?
/* /*
bool convert_curve(cgal_kernel* kernel, const taxonomy::ptr curve, cgal_wire_t& builder) { bool convert_curve(cgal_kernel* kernel, const taxonomy::ptr curve, cgal_wire& builder) {
if (auto e = taxonomy::dcast<taxonomy::edge>(curve)) { if (auto e = taxonomy::dcast<taxonomy::edge>(curve)) {
if (true || e->basis == nullptr) { if (true || e->basis == nullptr) {
if (builder.empty()) { if (builder.empty()) {
const auto& p = std::get<taxonomy::point3::ptr>(e->start); const auto& p = std::get<taxonomy::point3::ptr>(e->start);
cgal_point_t pnt(p->ccomponents()(0), p->ccomponents()(1), p->ccomponents()(2)); cgal_point pnt(p->ccomponents()(0), p->ccomponents()(1), p->ccomponents()(2));
builder.push_back(pnt); builder.push_back(pnt);
} }
const auto& p = std::get<taxonomy::point3::ptr>(e->end); const auto& p = std::get<taxonomy::point3::ptr>(e->end);
cgal_point_t pnt(p->ccomponents()(0), p->ccomponents()(1), p->ccomponents()(2)); cgal_point pnt(p->ccomponents()(0), p->ccomponents()(1), p->ccomponents()(2));
builder.push_back(pnt); builder.push_back(pnt);
} else if (e->basis->kind() == taxonomy::CIRCLE) { } else if (e->basis->kind() == taxonomy::CIRCLE) {
// @todo // @todo
@@ -552,7 +552,7 @@ namespace {
typedef CGAL::Box_intersection_d::Box_with_handle_d<double, 3, int*> box; typedef CGAL::Box_intersection_d::Box_with_handle_d<double, 3, int*> box;
namespace { namespace {
void loop_to_segments(const cgal_wire_t& wire, std::vector<kernel_::Segment_3>& segments) { void loop_to_segments(const cgal_wire& wire, std::vector<kernel_::Segment_3>& segments) {
for (int i = 0; i < wire.size(); ++i) { for (int i = 0; i < wire.size(); ++i) {
int j = (i + 1) % wire.size(); int j = (i + 1) % wire.size();
segments.emplace_back(wire[i], wire[j]); segments.emplace_back(wire[i], wire[j]);
@@ -604,7 +604,7 @@ namespace {
} }
namespace { namespace {
cgal_direction_t newell(const std::vector<cgal_point_t> & loop) { cgal_direction newell(const std::vector<cgal_point> & loop) {
kernel_::FT a(0.0), b(0.0), c(0.0); kernel_::FT a(0.0), b(0.0), c(0.0);
for (size_t i = 0; i < loop.size(); ++i) { for (size_t i = 0; i < loop.size(); ++i) {
auto & curr = loop[i]; auto & curr = loop[i];
@@ -613,7 +613,7 @@ namespace {
b += (curr.z() - next.z()) * (curr.x() + next.x()); b += (curr.z() - next.z()) * (curr.x() + next.x());
c += (curr.x() - next.x()) * (curr.y() + next.y()); c += (curr.x() - next.x()) * (curr.y() + next.y());
} }
return cgal_direction_t(a, b, c); return cgal_direction(a, b, c);
} }
} }
@@ -628,7 +628,7 @@ namespace {
return polygon; return polygon;
} }
CGAL::Polygon_2<kernel_> wire_to_polygon_2(const cgal_wire_t& w) { CGAL::Polygon_2<kernel_> wire_to_polygon_2(const cgal_wire& w) {
CGAL::Polygon_2<kernel_> polygon; CGAL::Polygon_2<kernel_> polygon;
for (auto& p : w) { for (auto& p : w) {
CGAL::Point_2<kernel_> pnt(p.cartesian(0), p.cartesian(1)); CGAL::Point_2<kernel_> pnt(p.cartesian(0), p.cartesian(1));
@@ -637,8 +637,8 @@ namespace {
return polygon; return polygon;
} }
cgal_face_t wire_to_face(const cgal_wire_t& w) { cgal_face wire_to_face(const cgal_wire& w) {
cgal_face_t f; cgal_face f;
f.outer = w; f.outer = w;
return f; return f;
} }
@@ -651,10 +651,10 @@ namespace {
polygon_2_to_wire(const CGAL::Aff_transformation_3<kernel_>& t) polygon_2_to_wire(const CGAL::Aff_transformation_3<kernel_>& t)
: t_(t) {} : t_(t) {}
cgal_wire_t operator()(const CGAL::Polygon_2<kernel_>& p) { cgal_wire operator()(const CGAL::Polygon_2<kernel_>& p) {
cgal_wire_t w; cgal_wire w;
for (auto it = p.vertices_begin(); it != p.vertices_end(); ++it) { for (auto it = p.vertices_begin(); it != p.vertices_end(); ++it) {
cgal_point_t P(it->cartesian(0), it->cartesian(1), 0); cgal_point P(it->cartesian(0), it->cartesian(1), 0);
P = t_.transform(P); P = t_.transform(P);
w.push_back(P); w.push_back(P);
} }
@@ -662,7 +662,7 @@ namespace {
} }
}; };
void transform_in_place(cgal_wire_t& w, const CGAL::Aff_transformation_3<kernel_>& t) { void transform_in_place(cgal_wire& w, const CGAL::Aff_transformation_3<kernel_>& t) {
for (auto& p : w) { for (auto& p : w) {
p = p.transform(t); p = p.transform(t);
} }
@@ -670,7 +670,7 @@ namespace {
} }
namespace { namespace {
void face_to_poly_with_holes(const cgal_face_t& face, CGAL::Polygon_with_holes_2<kernel_>& pwh, CGAL::Aff_transformation_3<kernel_>& place) { void face_to_poly_with_holes(const cgal_face& face, CGAL::Polygon_with_holes_2<kernel_>& pwh, CGAL::Aff_transformation_3<kernel_>& place) {
// static // static
kernel_::Vector_3 Z(0, 0, 1); kernel_::Vector_3 Z(0, 0, 1);
// static // static
@@ -714,7 +714,7 @@ namespace {
} }
bool cgal_kernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) { bool cgal_kernel::convert(const taxonomy::loop::ptr loop, cgal_wire& result) {
// @todo only implement polygonal loops // @todo only implement polygonal loops
std::vector<taxonomy::point3> points; std::vector<taxonomy::point3> points;
@@ -748,9 +748,9 @@ bool cgal_kernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) {
} }
// Parse and store the points in a sequence // Parse and store the points in a sequence
cgal_wire_t polygon = std::vector<kernel_::Point_3>(); cgal_wire polygon = std::vector<kernel_::Point_3>();
for (auto& p : points) { for (auto& p : points) {
cgal_point_t pnt(p.ccomponents()(0), p.ccomponents()(1), p.ccomponents()(2)); cgal_point pnt(p.ccomponents()(0), p.ccomponents()(1), p.ccomponents()(2));
polygon.push_back(pnt); polygon.push_back(pnt);
} }
@@ -772,7 +772,7 @@ bool cgal_kernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) {
} }
{ {
std::set<cgal_point_t> visited_points; std::set<cgal_point> visited_points;
for (auto& p : polygon) { for (auto& p : polygon) {
if (visited_points.find(p) != visited_points.end()) { if (visited_points.find(p) != visited_points.end()) {
logger().error("GEO", 85, "Skipping self-intersecting loop", loop->instance); logger().error("GEO", 85, "Skipping self-intersecting loop", loop->instance);
@@ -841,7 +841,7 @@ bool cgal_kernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) {
bool cgal_kernel::convert_impl(const taxonomy::shell::ptr shell, conversion_results& results) { bool cgal_kernel::convert_impl(const taxonomy::shell::ptr shell, conversion_results& results) {
cgal_shape_t shape; cgal_polyhedron shape;
if (!convert(shell, shape)) { if (!convert(shell, shape)) {
return false; return false;
} }
@@ -862,7 +862,7 @@ bool cgal_kernel::convert_impl(const taxonomy::solid::ptr solid, conversion_resu
logger().error("UNS", 5, "Multiple shells in solid not supported at the moment"); logger().error("UNS", 5, "Multiple shells in solid not supported at the moment");
return false; return false;
} }
cgal_shape_t shape; cgal_polyhedron shape;
if (solid->children.empty()) { if (solid->children.empty()) {
return false; return false;
} }
@@ -883,16 +883,16 @@ bool cgal_kernel::convert_impl(const taxonomy::solid::ptr solid, conversion_resu
} }
namespace { namespace {
bool convert_placement(const Eigen::Matrix4d& m, cgal_placement_t& trsf) { bool convert_placement(const Eigen::Matrix4d& m, cgal_placement& trsf) {
// @todo check // @todo check
trsf = cgal_placement_t( trsf = cgal_placement(
m(0, 0), m(0, 1), m(0, 2), m(0, 3), m(0, 0), m(0, 1), m(0, 2), m(0, 3),
m(1, 0), m(1, 1), m(1, 2), m(1, 3), m(1, 0), m(1, 1), m(1, 2), m(1, 3),
m(2, 0), m(2, 1), m(2, 2), m(2, 3)); m(2, 0), m(2, 1), m(2, 2), m(2, 3));
return true; return true;
} }
bool convert_placement(ifcopenshell::geom::taxonomy::matrix4::ptr place, cgal_placement_t& trsf) { bool convert_placement(ifcopenshell::geom::taxonomy::matrix4::ptr place, cgal_placement& trsf) {
return convert_placement(place->ccomponents(), trsf); return convert_placement(place->ccomponents(), trsf);
} }
} }
@@ -905,17 +905,17 @@ bool ifcopenshell::geom::kernels::cgal_kernel::convert_openings(const express::b
CGAL::Nef_nary_union_3<CGAL::Nef_polyhedron_3<kernel_>> second_operand_collector; CGAL::Nef_nary_union_3<CGAL::Nef_polyhedron_3<kernel_>> second_operand_collector;
size_t second_operand_collector_size = 0; size_t second_operand_collector_size = 0;
std::list<std::pair<express::base, std::list<cgal_shape_t>>> operands; std::list<std::pair<express::base, std::list<cgal_polyhedron>>> operands;
std::list<express::base> second_operand_instances; std::list<express::base> second_operand_instances;
std::list<cgal_shape_t> first_operands, second_operands; std::list<cgal_polyhedron> first_operands, second_operands;
std::list<CGAL::Nef_polyhedron_3<kernel_>> first_operands_nef, second_operands_nef; std::list<CGAL::Nef_polyhedron_3<kernel_>> first_operands_nef, second_operands_nef;
for (auto& shp : entity_shapes) { for (auto& shp : entity_shapes) {
cgal_shape_t entity_shape = *std::static_pointer_cast<cgal_shape>(shp.Shape()); cgal_polyhedron entity_shape = *std::static_pointer_cast<cgal_shape>(shp.Shape());
const auto& m = shp.Placement()->ccomponents(); const auto& m = shp.Placement()->ccomponents();
if (!m.isIdentity()) { if (!m.isIdentity()) {
cgal_placement_t trsf; cgal_placement trsf;
convert_placement(m, trsf); convert_placement(m, trsf);
for (auto &vertex : vertices(entity_shape)) { for (auto &vertex : vertices(entity_shape)) {
vertex->point() = vertex->point().transform(trsf); vertex->point() = vertex->point().transform(trsf);
@@ -943,13 +943,13 @@ bool ifcopenshell::geom::kernels::cgal_kernel::convert_openings(const express::b
abstract_kernel::convert(op.first, opening_shapes); abstract_kernel::convert(op.first, opening_shapes);
for (unsigned int i = 0; i < opening_shapes.size(); ++i) { for (unsigned int i = 0; i < opening_shapes.size(); ++i) {
cgal_shape_t entity_shape_unlocated = *std::static_pointer_cast<cgal_shape>(opening_shapes[i].Shape()); cgal_polyhedron entity_shape_unlocated = *std::static_pointer_cast<cgal_shape>(opening_shapes[i].Shape());
cgal_shape_t entity_shape(entity_shape_unlocated); cgal_polyhedron entity_shape(entity_shape_unlocated);
auto gtrsf = opening_shapes[i].Placement(); auto gtrsf = opening_shapes[i].Placement();
// @todo check // @todo check
Eigen::Matrix4d m = opening_trsf.ccomponents() * gtrsf->ccomponents(); Eigen::Matrix4d m = opening_trsf.ccomponents() * gtrsf->ccomponents();
if (!m.isIdentity()) { if (!m.isIdentity()) {
cgal_placement_t trsf; cgal_placement trsf;
convert_placement(m, trsf); convert_placement(m, trsf);
for (auto &vertex : vertices(entity_shape)) { for (auto &vertex : vertices(entity_shape)) {
vertex->point() = vertex->point().transform(trsf); vertex->point() = vertex->point().transform(trsf);
@@ -999,7 +999,7 @@ bool ifcopenshell::geom::kernels::cgal_kernel::convert_openings(const express::b
} }
a -= opening_union; a -= opening_union;
cgal_shape_t a_poly; cgal_polyhedron a_poly;
try { try {
a.convert_to_polyhedron(a_poly); a.convert_to_polyhedron(a_poly);
@@ -1019,7 +1019,7 @@ bool ifcopenshell::geom::kernels::cgal_kernel::convert_openings(const express::b
bool cgal_kernel::convert_impl(const taxonomy::extrusion::ptr extrusion, conversion_results& results) { bool cgal_kernel::convert_impl(const taxonomy::extrusion::ptr extrusion, conversion_results& results) {
cgal_shape_t shape; cgal_polyhedron shape;
if (!convert(extrusion, shape)) { if (!convert(extrusion, shape)) {
return false; return false;
} }
@@ -1032,11 +1032,11 @@ bool cgal_kernel::convert_impl(const taxonomy::extrusion::ptr extrusion, convers
return true; return true;
} }
bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::direction3::ptr direction, double height, cgal_shape_t& shape) { bool cgal_kernel::process_extrusion(const cgal_face& bottom_face, taxonomy::direction3::ptr direction, double height, cgal_polyhedron& shape) {
bool has_inner_bounds = !bottom_face.inner.empty(); bool has_inner_bounds = !bottom_face.inner.empty();
std::list<cgal_wire_t> faces_to_extrude; std::list<cgal_wire> faces_to_extrude;
std::set<std::pair<size_t, size_t>> internal_edges; std::set<std::pair<size_t, size_t>> internal_edges;
// CGAL::Cartesian_converter<CGAL::Epeck, CGAL::Simple_cartesian<double>> C; // CGAL::Cartesian_converter<CGAL::Epeck, CGAL::Simple_cartesian<double>> C;
@@ -1097,10 +1097,10 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di
faces_to_extrude.push_front(bottom_face.outer); faces_to_extrude.push_front(bottom_face.outer);
} }
std::list<cgal_face_t> face_list; std::list<cgal_face> face_list;
auto& fs = direction->ccomponents(); auto& fs = direction->ccomponents();
cgal_direction_t dir(fs(0), fs(1), fs(2)); cgal_direction dir(fs(0), fs(1), fs(2));
int wi = 0; int wi = 0;
for (auto& w : faces_to_extrude) { for (auto& w : faces_to_extrude) {
@@ -1109,13 +1109,13 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di
const bool reverse = fnorm * dir > 0; const bool reverse = fnorm * dir > 0;
if (reverse) { if (reverse) {
cgal_face_t bottom_face; cgal_face bottom_face;
for (auto vertex = w.rbegin(); vertex != w.rend(); ++vertex) { for (auto vertex = w.rbegin(); vertex != w.rend(); ++vertex) {
bottom_face.outer.push_back(*vertex); bottom_face.outer.push_back(*vertex);
} }
face_list.push_back(bottom_face); face_list.push_back(bottom_face);
} else { } else {
face_list.push_back(cgal_face_t{ w }); face_list.push_back(cgal_face{ w });
} }
int si = 0; int si = 0;
@@ -1131,7 +1131,7 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di
next_vertex = w.begin(); next_vertex = w.begin();
} }
cgal_face_t side_face; cgal_face side_face;
if (reverse) { if (reverse) {
side_face.outer.push_back(*current_vertex + height * dir); side_face.outer.push_back(*current_vertex + height * dir);
side_face.outer.push_back(*next_vertex + height * dir); side_face.outer.push_back(*next_vertex + height * dir);
@@ -1146,7 +1146,7 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di
face_list.push_back(side_face); face_list.push_back(side_face);
} }
cgal_face_t top_face; cgal_face top_face;
if (reverse) { if (reverse) {
for (auto vertex = w.begin(); vertex != w.end(); ++vertex) { for (auto vertex = w.begin(); vertex != w.end(); ++vertex) {
top_face.outer.push_back(*vertex + height * dir); top_face.outer.push_back(*vertex + height * dir);
@@ -1173,7 +1173,7 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di
// std::cout << "Inner wire" << std::endl; // std::cout << "Inner wire" << std::endl;
face_list.clear(); face_list.clear();
cgal_face_t hole_bottom_face; cgal_face hole_bottom_face;
hole_bottom_face.outer = inner; hole_bottom_face.outer = inner;
remove_duplicate_points_from_loop(hole_bottom_face.outer); remove_duplicate_points_from_loop(hole_bottom_face.outer);
face_list.push_back(hole_bottom_face); face_list.push_back(hole_bottom_face);
@@ -1185,7 +1185,7 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di
++next_vertex; ++next_vertex;
if (next_vertex == inner.end()) { if (next_vertex == inner.end()) {
next_vertex = inner.begin(); next_vertex = inner.begin();
} cgal_face_t hole_side_face; } cgal_face hole_side_face;
hole_side_face.outer.push_back(*next_vertex); hole_side_face.outer.push_back(*next_vertex);
hole_side_face.outer.push_back(*current_vertex); hole_side_face.outer.push_back(*current_vertex);
hole_side_face.outer.push_back(*current_vertex + height * dir); hole_side_face.outer.push_back(*current_vertex + height * dir);
@@ -1193,7 +1193,7 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di
face_list.push_back(hole_side_face); face_list.push_back(hole_side_face);
} }
cgal_face_t hole_top_face; cgal_face hole_top_face;
for (std::vector<kernel_::Point_3>::const_reverse_iterator vertex = inner.rbegin(); for (std::vector<kernel_::Point_3>::const_reverse_iterator vertex = inner.rbegin();
vertex != inner.rend(); vertex != inner.rend();
++vertex) { ++vertex) {
@@ -1226,14 +1226,14 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di
*/ */
} }
bool cgal_kernel::convert(const taxonomy::extrusion::ptr extrusion, cgal_shape_t &shape) { bool cgal_kernel::convert(const taxonomy::extrusion::ptr extrusion, cgal_polyhedron &shape) {
const double& height = extrusion->depth; const double& height = extrusion->depth;
if (height < settings_.get<settings::Precision>().get()) { if (height < settings_.get<settings::Precision>().get()) {
logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 89, "Non-positive extrusion height encountered for:", extrusion->instance); logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 89, "Non-positive extrusion height encountered for:", extrusion->instance);
return false; return false;
} }
std::list<cgal_face_t> bottom_face; std::list<cgal_face> bottom_face;
if (!convert(taxonomy::cast<taxonomy::face>(taxonomy::cast<taxonomy::face>(extrusion->basis)), bottom_face) || bottom_face.size() != 1) { if (!convert(taxonomy::cast<taxonomy::face>(taxonomy::cast<taxonomy::face>(extrusion->basis)), bottom_face) || bottom_face.size() != 1) {
return false; return false;
} }
@@ -1242,15 +1242,15 @@ bool cgal_kernel::convert(const taxonomy::extrusion::ptr extrusion, cgal_shape_t
} }
CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_cube(double d) { CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_cube(double d) {
cgal_face_t bottom_face; cgal_face bottom_face;
bottom_face.outer.push_back(kernel_::Point_3(-d, -d, -d)); bottom_face.outer.push_back(kernel_::Point_3(-d, -d, -d));
bottom_face.outer.push_back(kernel_::Point_3(+d, -d, -d)); bottom_face.outer.push_back(kernel_::Point_3(+d, -d, -d));
bottom_face.outer.push_back(kernel_::Point_3(+d, +d, -d)); bottom_face.outer.push_back(kernel_::Point_3(+d, +d, -d));
bottom_face.outer.push_back(kernel_::Point_3(-d, +d, -d)); bottom_face.outer.push_back(kernel_::Point_3(-d, +d, -d));
cgal_direction_t dir(0, 0, 2 * d); cgal_direction dir(0, 0, 2 * d);
std::list<cgal_face_t> face_list = { bottom_face }; std::list<cgal_face> face_list = { bottom_face };
for (std::vector<kernel_::Point_3>::const_iterator current_vertex = bottom_face.outer.begin(); for (std::vector<kernel_::Point_3>::const_iterator current_vertex = bottom_face.outer.begin();
current_vertex != bottom_face.outer.end(); current_vertex != bottom_face.outer.end();
@@ -1262,7 +1262,7 @@ CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_cube(double d) {
next_vertex = bottom_face.outer.begin(); next_vertex = bottom_face.outer.begin();
} }
cgal_face_t side_face; cgal_face side_face;
side_face.outer.push_back(*next_vertex); side_face.outer.push_back(*next_vertex);
side_face.outer.push_back(*current_vertex); side_face.outer.push_back(*current_vertex);
@@ -1272,7 +1272,7 @@ CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_cube(double d) {
face_list.push_back(side_face); face_list.push_back(side_face);
} }
cgal_face_t top_face; cgal_face top_face;
for (std::vector<kernel_::Point_3>::const_reverse_iterator vertex = bottom_face.outer.rbegin(); for (std::vector<kernel_::Point_3>::const_reverse_iterator vertex = bottom_face.outer.rbegin();
vertex != bottom_face.outer.rend(); vertex != bottom_face.outer.rend();
@@ -1287,7 +1287,7 @@ CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_cube(double d) {
CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_cube(const kernel_::Point_3& lower, const kernel_::Point_3& upper) { CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_cube(const kernel_::Point_3& lower, const kernel_::Point_3& upper) {
cgal_face_t bottom_face; cgal_face bottom_face;
auto a0 = lower.cartesian(0); auto a0 = lower.cartesian(0);
auto a1 = lower.cartesian(1); auto a1 = lower.cartesian(1);
@@ -1302,9 +1302,9 @@ CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_cube(const kernel_
bottom_face.outer.push_back(kernel_::Point_3(b0, b1, a2)); bottom_face.outer.push_back(kernel_::Point_3(b0, b1, a2));
bottom_face.outer.push_back(kernel_::Point_3(a0, b1, a2)); bottom_face.outer.push_back(kernel_::Point_3(a0, b1, a2));
cgal_direction_t dir(0, 0, b2 - a2); cgal_direction dir(0, 0, b2 - a2);
std::list<cgal_face_t> face_list = { bottom_face }; std::list<cgal_face> face_list = { bottom_face };
for (std::vector<kernel_::Point_3>::const_iterator current_vertex = bottom_face.outer.begin(); for (std::vector<kernel_::Point_3>::const_iterator current_vertex = bottom_face.outer.begin();
current_vertex != bottom_face.outer.end(); current_vertex != bottom_face.outer.end();
@@ -1316,7 +1316,7 @@ CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_cube(const kernel_
next_vertex = bottom_face.outer.begin(); next_vertex = bottom_face.outer.begin();
} }
cgal_face_t side_face; cgal_face side_face;
side_face.outer.push_back(*next_vertex); side_face.outer.push_back(*next_vertex);
side_face.outer.push_back(*current_vertex); side_face.outer.push_back(*current_vertex);
@@ -1326,7 +1326,7 @@ CGAL::Polyhedron_3<kernel_> ifcopenshell::geom::utils::create_cube(const kernel_
face_list.push_back(side_face); face_list.push_back(side_face);
} }
cgal_face_t top_face; cgal_face top_face;
for (std::vector<kernel_::Point_3>::const_reverse_iterator vertex = bottom_face.outer.rbegin(); for (std::vector<kernel_::Point_3>::const_reverse_iterator vertex = bottom_face.outer.rbegin();
vertex != bottom_face.outer.rend(); vertex != bottom_face.outer.rend();
@@ -1361,8 +1361,8 @@ bool cgal_kernel::thin_solid(const CGAL::Nef_polyhedron_3<kernel_>& a, CGAL::Nef
return true; return true;
} }
bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference, const std::list<cgal_shape_t>& first_operands, const std::list<CGAL::Nef_polyhedron_3<kernel_>>& first_operands_nef, const std::list<kernel_::Plane_3>& all_operand_planes, const cgal_shape_t& shape_const, CGAL::Nef_polyhedron_3<kernel_>& result, boolean_operand_preprocess proc) { bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference, const std::list<cgal_polyhedron>& first_operands, const std::list<CGAL::Nef_polyhedron_3<kernel_>>& first_operands_nef, const std::list<kernel_::Plane_3>& all_operand_planes, const cgal_polyhedron& shape_const, CGAL::Nef_polyhedron_3<kernel_>& result, boolean_operand_preprocess proc) {
cgal_shape_t shape = shape_const; cgal_polyhedron shape = shape_const;
if (!shape.is_valid()) { if (!shape.is_valid()) {
logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 90, "Conversion to Nef will fail. Invalid geometry:", log_reference); logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 90, "Conversion to Nef will fail. Invalid geometry:", log_reference);
@@ -1397,7 +1397,7 @@ bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference,
if (proc == PP_SNAP_POINTS_TO_FIRST_OPERAND) { if (proc == PP_SNAP_POINTS_TO_FIRST_OPERAND) {
static int NN = 0; static int NN = 0;
typedef CGAL::AABB_face_graph_triangle_primitive<cgal_shape_t> aabb_face_graph_primitive; typedef CGAL::AABB_face_graph_triangle_primitive<cgal_polyhedron> aabb_face_graph_primitive;
#if CGAL_VERSION_NR >= 1060000000 #if CGAL_VERSION_NR >= 1060000000
typedef CGAL::AABB_traits_3<kernel_, aabb_face_graph_primitive> aabb_face_graph_traits; typedef CGAL::AABB_traits_3<kernel_, aabb_face_graph_primitive> aabb_face_graph_traits;
#else #else
@@ -1506,7 +1506,7 @@ bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference,
int j = 0; int j = 0;
for (auto& a : x->operands_) { for (auto& a : x->operands_) {
auto A = a->evaluate(); auto A = a->evaluate();
cgal_shape_t p; cgal_polyhedron p;
A.convert_to_Polyhedron(p); A.convert_to_Polyhedron(p);
std::string fn = "debug-orig-" + std::to_string(i) + "-" + std::to_string(j++) + ".off"; std::string fn = "debug-orig-" + std::to_string(i) + "-" + std::to_string(j++) + ".off";
std::ofstream(fn.c_str()) << p; std::ofstream(fn.c_str()) << p;
@@ -1519,7 +1519,7 @@ bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference,
int j = 0; int j = 0;
for (auto& a : x->operands_) { for (auto& a : x->operands_) {
auto A = a->evaluate(); auto A = a->evaluate();
cgal_shape_t p; cgal_polyhedron p;
A.convert_to_Polyhedron(p); A.convert_to_Polyhedron(p);
std::string fn = "debug-mapped-" + std::to_string(i) + "-" + std::to_string(j++) + ".off"; std::string fn = "debug-mapped-" + std::to_string(i) + "-" + std::to_string(j++) + ".off";
std::ofstream(fn.c_str()) << p; std::ofstream(fn.c_str()) << p;
@@ -1559,7 +1559,7 @@ bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference,
*/ */
try { try {
cgal_shape_t convert_back; cgal_polyhedron convert_back;
result.convert_to_polyhedron(convert_back); result.convert_to_polyhedron(convert_back);
} catch (CGAL::Failure_exception& e) { } catch (CGAL::Failure_exception& e) {
logger().notice("GEO", 99, e); logger().notice("GEO", 99, e);
@@ -1655,18 +1655,18 @@ bool cgal_kernel::process_as_2d_polygon(const taxonomy::boolean_result::ptr br,
return false; return false;
} }
std::vector<cgal_wire_t> wires; std::vector<cgal_wire> wires;
try { try {
std::transform(extrusions.begin(), extrusions.end(), std::back_inserter(wires), [this](extrusion_pair& p) { std::transform(extrusions.begin(), extrusions.end(), std::back_inserter(wires), [this](extrusion_pair& p) {
auto ex = p.second; auto ex = p.second;
auto ex_basis = taxonomy::cast<taxonomy::face>(ex->basis); auto ex_basis = taxonomy::cast<taxonomy::face>(ex->basis);
if (ex_basis->children.size() == 1 && ex_basis->children[0]->kind() == taxonomy::LOOP) { if (ex_basis->children.size() == 1 && ex_basis->children[0]->kind() == taxonomy::LOOP) {
auto l = (taxonomy::loop::ptr) ex_basis->children[0]; auto l = (taxonomy::loop::ptr) ex_basis->children[0];
cgal_wire_t w; cgal_wire w;
cgal_placement_t trsf; cgal_placement trsf;
convert_placement(ex->matrix, trsf); convert_placement(ex->matrix, trsf);
cgal_placement_t trsf2; cgal_placement trsf2;
if (p.first) { if (p.first) {
convert_placement(*p.first, trsf2); convert_placement(*p.first, trsf2);
} }
@@ -1717,7 +1717,7 @@ bool cgal_kernel::process_as_2d_polygon(const taxonomy::boolean_result::ptr br,
#include <CGAL/Polygon_mesh_processing/measure.h> #include <CGAL/Polygon_mesh_processing/measure.h>
namespace { namespace {
bool orthogonal_edge_length(const cgal_shape_t& shape, const cgal_direction_t& face_normal, std::pair<kernel_::FT, kernel_::FT>& distances) { bool orthogonal_edge_length(const cgal_polyhedron& shape, const cgal_direction& face_normal, std::pair<kernel_::FT, kernel_::FT>& distances) {
static double inf = 1.e9; // std::numeric_limits<double>::infinity(); static double inf = 1.e9; // std::numeric_limits<double>::infinity();
std::vector<double> lengths; std::vector<double> lengths;
@@ -1767,13 +1767,13 @@ namespace {
} }
} }
bool cgal_kernel::process_as_2d_polygon(const std::list<std::list<std::pair<express::base, cgal_shape_t>>>& operands, std::list<CGAL::Polygon_2<kernel_>>& loops, double& z0, double& z1) { bool cgal_kernel::process_as_2d_polygon(const std::list<std::list<std::pair<express::base, cgal_polyhedron>>>& operands, std::list<CGAL::Polygon_2<kernel_>>& loops, double& z0, double& z1) {
if (operands.front().size() != 1) { if (operands.front().size() != 1) {
return false; return false;
} }
auto& first_op = operands.front().front().second; auto& first_op = operands.front().front().second;
cgal_shape_t::Facet_handle largest_face; cgal_polyhedron::Facet_handle largest_face;
kernel_::FT largest_area = 0; kernel_::FT largest_area = 0;
for (auto& f : faces(first_op)) { for (auto& f : faces(first_op)) {
@@ -1785,7 +1785,7 @@ bool cgal_kernel::process_as_2d_polygon(const std::list<std::list<std::pair<expr
} }
// @todo adapt newell() to work on facet circulator as well // @todo adapt newell() to work on facet circulator as well
std::vector<cgal_point_t> f_points; std::vector<cgal_point> f_points;
CGAL::Polyhedron_3<kernel_>::Halfedge_around_facet_const_circulator current_halfedge = largest_face->facet_begin(); CGAL::Polyhedron_3<kernel_>::Halfedge_around_facet_const_circulator current_halfedge = largest_face->facet_begin();
do { do {
f_points.push_back(current_halfedge->vertex()->point()); f_points.push_back(current_halfedge->vertex()->point());
@@ -1831,7 +1831,7 @@ namespace {
void project_onto_plane(const taxonomy::plane& p, It i, It j, Fn fn) { void project_onto_plane(const taxonomy::plane& p, It i, It j, Fn fn) {
auto mi = p.matrix->ccomponents().inverse(); auto mi = p.matrix->ccomponents().inverse();
Eigen::Vector4d v; Eigen::Vector4d v;
std::for_each(i, j, [&mi, &v, &fn](const cgal_shape_t& shp) { std::for_each(i, j, [&mi, &v, &fn](const cgal_polyhedron& shp) {
for (auto& vv : vertices(shp)) { for (auto& vv : vertices(shp)) {
auto& p = vv->point(); auto& p = vv->point();
v = Eigen::Vector4d(CGAL::to_double(p.cartesian(0)), v = Eigen::Vector4d(CGAL::to_double(p.cartesian(0)),
@@ -1911,7 +1911,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio
} }
std::transform(decom_polies.begin(), decom_polies.end(), std::back_inserter(results), [this, &br, &z0, &z1, &first_item_style](const CGAL::Polygon_2<kernel_>& p2) { std::transform(decom_polies.begin(), decom_polies.end(), std::back_inserter(results), [this, &br, &z0, &z1, &first_item_style](const CGAL::Polygon_2<kernel_>& p2) {
cgal_face_t f; cgal_face f;
std::transform( std::transform(
p2.vertices_begin(), p2.vertices_begin(),
p2.vertices_end(), p2.vertices_end(),
@@ -1921,13 +1921,13 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio
} }
); );
cgal_shape_t shp; cgal_polyhedron shp;
auto d = taxonomy::make<taxonomy::direction3>(0, 0, 1); auto d = taxonomy::make<taxonomy::direction3>(0, 0, 1);
process_extrusion(f, d, z1 - z0, shp); process_extrusion(f, d, z1 - z0, shp);
for (auto it = shp.vertices_begin(); it != shp.vertices_end(); ++it) { for (auto it = shp.vertices_begin(); it != shp.vertices_end(); ++it) {
auto p = it->point(); auto p = it->point();
it->point() = cgal_point_t(p.cartesian(0), p.cartesian(1), p.cartesian(2) + z0); it->point() = cgal_point(p.cartesian(0), p.cartesian(1), p.cartesian(2) + z0);
} }
return conversion_result( return conversion_result(
@@ -1956,7 +1956,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio
taxonomy::style::ptr first_item_style = nullptr; taxonomy::style::ptr first_item_style = nullptr;
std::list<std::pair<express::base, std::list<cgal_shape_t>>> operands; std::list<std::pair<express::base, std::list<cgal_polyhedron>>> operands;
for (auto& c : br->children) { for (auto& c : br->children) {
// abstract_kernel::convert(c, results); // abstract_kernel::convert(c, results);
@@ -2005,15 +2005,15 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio
kernel_::Point_3 lower(uvw_min[0] - eps, uvw_min[1] - eps, wmin); kernel_::Point_3 lower(uvw_min[0] - eps, uvw_min[1] - eps, wmin);
kernel_::Point_3 upper(uvw_max[0] + eps, uvw_max[1] + eps, wmax); kernel_::Point_3 upper(uvw_max[0] + eps, uvw_max[1] + eps, wmax);
cgal_shape_t box = utils::create_cube(lower, upper); cgal_polyhedron box = utils::create_cube(lower, upper);
cgal_placement_t pl; cgal_placement pl;
convert_placement(p.matrix, pl); convert_placement(p.matrix, pl);
for (auto& v : vertices(box)) { for (auto& v : vertices(box)) {
v->point() = v->point().transform(pl); v->point() = v->point().transform(pl);
} }
if (!face->children.empty()) { if (!face->children.empty()) {
std::list<cgal_face_t> fs; std::list<cgal_face> fs;
if (!convert(face, fs) || fs.size() != 1) { if (!convert(face, fs) || fs.size() != 1) {
return false; return false;
} }
@@ -2030,7 +2030,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio
// static // static
auto z = taxonomy::make<taxonomy::direction3>(0, 0, 1); auto z = taxonomy::make<taxonomy::direction3>(0, 0, 1);
cgal_shape_t poly; cgal_polyhedron poly;
process_extrusion(fs.front(), z, 200, poly); process_extrusion(fs.front(), z, 200, poly);
for (auto& v : vertices(poly)) { for (auto& v : vertices(poly)) {
v->point() = kernel_::Point_3( v->point() = kernel_::Point_3(
@@ -2039,7 +2039,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio
v->point().cartesian(2) - 100 v->point().cartesian(2) - 100
); );
}; };
cgal_placement_t trsf; cgal_placement trsf;
convert_placement(face->matrix, trsf); convert_placement(face->matrix, trsf);
for (auto& v : vertices(poly)) { for (auto& v : vertices(poly)) {
v->point() = v->point().transform(trsf); v->point() = v->point().transform(trsf);
@@ -2047,7 +2047,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio
CGAL::Nef_polyhedron_3<kernel_> poly_nef(poly); CGAL::Nef_polyhedron_3<kernel_> poly_nef(poly);
CGAL::Nef_polyhedron_3<kernel_> box_nef(box); CGAL::Nef_polyhedron_3<kernel_> box_nef(box);
auto intersection = poly_nef * box_nef; auto intersection = poly_nef * box_nef;
cgal_shape_t intersection_poly; cgal_polyhedron intersection_poly;
intersection.convert_to_polyhedron(intersection_poly); intersection.convert_to_polyhedron(intersection_poly);
operands.back().second.push_back(intersection_poly); operands.back().second.push_back(intersection_poly);
} else { } else {
@@ -2068,10 +2068,10 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio
} }
for (auto it = cr.begin(); it != cr.end(); ++it) { for (auto it = cr.begin(); it != cr.end(); ++it) {
cgal_shape_t entity_shape_unlocated = *std::static_pointer_cast<cgal_shape>(it->Shape()); cgal_polyhedron entity_shape_unlocated = *std::static_pointer_cast<cgal_shape>(it->Shape());
cgal_shape_t entity_shape(entity_shape_unlocated); cgal_polyhedron entity_shape(entity_shape_unlocated);
if (!it->Placement()->is_identity()) { if (!it->Placement()->is_identity()) {
cgal_placement_t trsf; cgal_placement trsf;
convert_placement(it->Placement(), trsf); convert_placement(it->Placement(), trsf);
for (auto &vertex : vertices(entity_shape)) { for (auto &vertex : vertices(entity_shape)) {
vertex->point() = vertex->point().transform(trsf); vertex->point() = vertex->point().transform(trsf);
@@ -2121,7 +2121,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio
first = true; first = true;
std::list<cgal_shape_t> ops; std::list<cgal_polyhedron> ops;
std::list<CGAL::Nef_polyhedron_3<kernel_>> nefops; std::list<CGAL::Nef_polyhedron_3<kernel_>> nefops;
std::list<kernel_::Plane_3> all_operand_planes; std::list<kernel_::Plane_3> all_operand_planes;
@@ -2162,7 +2162,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio
a -= second_operand_collector.get_union(); a -= second_operand_collector.get_union();
} }
cgal_shape_t a_poly; cgal_polyhedron a_poly;
// CGAL::Nef_polyhedron_3<kernel_> b; // CGAL::Nef_polyhedron_3<kernel_> b;
// thin_solid(a, b); // thin_solid(a, b);
@@ -2185,7 +2185,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio
#endif #endif
} }
polyhedron_builder::polyhedron_builder(std::list<cgal_face_t>* face_list, logger& logger) : face_list(face_list), logger_(logger) { polyhedron_builder::polyhedron_builder(std::list<cgal_face>* face_list, logger& logger) : face_list(face_list), logger_(logger) {
} }
#include <CGAL/Polygon_mesh_processing/orient_polygon_soup.h> #include <CGAL/Polygon_mesh_processing/orient_polygon_soup.h>
+10 -10
View File
@@ -60,11 +60,11 @@ namespace ifcopenshell {
namespace utils { namespace utils {
IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<kernel_> create_cube(double d); IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<kernel_> create_cube(double d);
IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<kernel_> create_cube(const kernel_::Point_3& lower, const kernel_::Point_3& upper); IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<kernel_> create_cube(const kernel_::Point_3& lower, const kernel_::Point_3& upper);
IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<kernel_> create_polyhedron(std::list<cgal_face_t> &face_list, bool stitch_borders = false, logger& logger = ifcopenshell::logger::root()); IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<kernel_> create_polyhedron(std::list<cgal_face> &face_list, bool stitch_borders = false, logger& logger = ifcopenshell::logger::root());
#ifndef IFOPSH_SIMPLE_KERNEL #ifndef IFOPSH_SIMPLE_KERNEL
IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<kernel_> create_polyhedron(const CGAL::Nef_polyhedron_3<kernel_> &nef_polyhedron, logger& logger = ifcopenshell::logger::root()); IFC_GEOMLIBRARY_API CGAL::Polyhedron_3<kernel_> create_polyhedron(const CGAL::Nef_polyhedron_3<kernel_> &nef_polyhedron, logger& logger = ifcopenshell::logger::root());
IFC_GEOMLIBRARY_API CGAL::Nef_polyhedron_3<kernel_> create_nef_polyhedron(std::list<cgal_face_t> &face_list, logger& logger = ifcopenshell::logger::root()); IFC_GEOMLIBRARY_API CGAL::Nef_polyhedron_3<kernel_> create_nef_polyhedron(std::list<cgal_face> &face_list, logger& logger = ifcopenshell::logger::root());
IFC_GEOMLIBRARY_API CGAL::Nef_polyhedron_3<kernel_> create_nef_polyhedron(CGAL::Polyhedron_3<kernel_> &polyhedron, logger& logger = ifcopenshell::logger::root()); IFC_GEOMLIBRARY_API CGAL::Nef_polyhedron_3<kernel_> create_nef_polyhedron(CGAL::Polyhedron_3<kernel_> &polyhedron, logger& logger = ifcopenshell::logger::root());
#endif #endif
} }
@@ -82,7 +82,7 @@ namespace ifcopenshell {
PP_NONE PP_NONE
}; };
bool preprocess_boolean_operand(const express::base& log_reference, const std::list<cgal_shape_t>& first_operands, const std::list<CGAL::Nef_polyhedron_3<kernel_>>& first_operands_nef, const std::list<kernel_::Plane_3>& all_operand_planes, const cgal_shape_t& shape_const, CGAL::Nef_polyhedron_3<kernel_>& result, boolean_operand_preprocess proc); bool preprocess_boolean_operand(const express::base& log_reference, const std::list<cgal_polyhedron>& first_operands, const std::list<CGAL::Nef_polyhedron_3<kernel_>>& first_operands_nef, const std::list<kernel_::Plane_3>& all_operand_planes, const cgal_polyhedron& shape_const, CGAL::Nef_polyhedron_3<kernel_>& result, boolean_operand_preprocess proc);
bool thin_solid(const CGAL::Nef_polyhedron_3<kernel_>& a, CGAL::Nef_polyhedron_3<kernel_>& result); bool thin_solid(const CGAL::Nef_polyhedron_3<kernel_>& a, CGAL::Nef_polyhedron_3<kernel_>& result);
@@ -109,15 +109,15 @@ namespace ifcopenshell {
#endif #endif
} }
bool convert(const taxonomy::extrusion::ptr, cgal_shape_t&); bool convert(const taxonomy::extrusion::ptr, cgal_polyhedron&);
bool convert(const taxonomy::face::ptr, std::list<cgal_face_t>&); bool convert(const taxonomy::face::ptr, std::list<cgal_face>&);
bool convert(const taxonomy::loop::ptr, cgal_wire_t&); bool convert(const taxonomy::loop::ptr, cgal_wire&);
// bool convert(const taxonomy::matrix4::ptr, cgal_placement_t&); // bool convert(const taxonomy::matrix4::ptr, cgal_placement&);
bool convert(const taxonomy::shell::ptr, cgal_shape_t&); bool convert(const taxonomy::shell::ptr, cgal_polyhedron&);
bool process_extrusion(const cgal_face_t& bottom_face, taxonomy::direction3::ptr direction, double height, cgal_shape_t& shape); bool process_extrusion(const cgal_face& bottom_face, taxonomy::direction3::ptr direction, double height, cgal_polyhedron& shape);
bool process_as_2d_polygon(const taxonomy::boolean_result::ptr br, std::list<CGAL::Polygon_2<kernel_>>& loops, double& z0, double& z1); bool process_as_2d_polygon(const taxonomy::boolean_result::ptr br, std::list<CGAL::Polygon_2<kernel_>>& loops, double& z0, double& z1);
bool process_as_2d_polygon(const std::list<std::list<std::pair<express::base, cgal_shape_t>>>& operands, std::list<CGAL::Polygon_2<kernel_>>& loops, double& z0, double& z1); bool process_as_2d_polygon(const std::list<std::list<std::pair<express::base, cgal_polyhedron>>>& operands, std::list<CGAL::Polygon_2<kernel_>>& loops, double& z0, double& z1);
virtual bool convert_impl(const taxonomy::shell::ptr, ifcopenshell::geom::conversion_results&); virtual bool convert_impl(const taxonomy::shell::ptr, ifcopenshell::geom::conversion_results&);
virtual bool convert_impl(const taxonomy::extrusion::ptr, ifcopenshell::geom::conversion_results&); virtual bool convert_impl(const taxonomy::extrusion::ptr, ifcopenshell::geom::conversion_results&);
@@ -1470,7 +1470,7 @@ namespace {
return bbox; return bbox;
} }
std::optional<manifold::Manifold> boolean_result_from_operands(const std::vector<manifold::Manifold>& operands, taxonomy::boolean_result::operation_t operation) { std::optional<manifold::Manifold> boolean_result_from_operands(const std::vector<manifold::Manifold>& operands, taxonomy::boolean_result::operation_type operation) {
if (operands.empty()) { if (operands.empty()) {
return std::nullopt; return std::nullopt;
} }
@@ -47,7 +47,7 @@ namespace {
} }
namespace { namespace {
BOPAlgo_Operation op_to_occt(taxonomy::boolean_result::operation_t t) { BOPAlgo_Operation op_to_occt(taxonomy::boolean_result::operation_type t) {
switch (t) { switch (t) {
case taxonomy::boolean_result::UNION: return BOPAlgo_FUSE; case taxonomy::boolean_result::UNION: return BOPAlgo_FUSE;
case taxonomy::boolean_result::INTERSECTION: return BOPAlgo_COMMON; case taxonomy::boolean_result::INTERSECTION: return BOPAlgo_COMMON;
+9 -9
View File
@@ -914,7 +914,7 @@ namespace ifcopenshell::geom {
} }
std::vector<T> select_box(const T& t, bool completely_within = false, double extend=-1.e-5) const { std::vector<T> select_box(const T& t, bool completely_within = false, double extend=-1.e-5) const {
typename map_t::const_iterator it = shapes_.find(t); typename shape_map::const_iterator it = shapes_.find(t);
if (it == shapes_.end()) { if (it == shapes_.end()) {
return std::vector<T>(); return std::vector<T>();
} }
@@ -1410,11 +1410,11 @@ namespace ifcopenshell::geom {
} }
protected: protected:
typedef NCollection_UBTree<T, Bnd_Box> tree_t; typedef NCollection_UBTree<T, Bnd_Box> spatial_tree;
typedef std::map<T, TopoDS_Shape> map_t; typedef std::map<T, TopoDS_Shape> shape_map;
tree_t tree_; spatial_tree tree_;
map_t shapes_; shape_map shapes_;
std::map<T, Bnd_Box> aabbs_; std::map<T, Bnd_Box> aabbs_;
std::map<T, Bnd_OBB> obbs_; std::map<T, Bnd_OBB> obbs_;
std::map<T, double> max_protrusions_; std::map<T, double> max_protrusions_;
@@ -1436,11 +1436,11 @@ namespace ifcopenshell::geom {
bool enable_face_styles_ = false; bool enable_face_styles_ = false;
class selector : public tree_t::Selector class selector : public spatial_tree::Selector
{ {
public: public:
selector(const Bnd_Box& b) selector(const Bnd_Box& b)
: tree_t::Selector() : spatial_tree::Selector()
, bounds_(b) , bounds_(b)
{} {}
@@ -1857,9 +1857,9 @@ namespace ifcopenshell::geom {
} }
protected: protected:
typedef NCollection_DataMap<TopoDS_Shape, int, TopTools_ShapeMapHasher> face_style_map_t; typedef NCollection_DataMap<TopoDS_Shape, int, TopTools_ShapeMapHasher> face_style_map;
face_style_map_t face_styles_; face_style_map face_styles_;
std::vector<ifcopenshell::geom::taxonomy::style::ptr> styles_; std::vector<ifcopenshell::geom::taxonomy::style::ptr> styles_;
}; };
+1 -1
View File
@@ -24,7 +24,7 @@
using namespace ifcopenshell::geom; using namespace ifcopenshell::geom;
namespace { namespace {
taxonomy::boolean_result::operation_t boolean_op_type(IfcSchema::IfcBooleanOperator::Value op) { taxonomy::boolean_result::operation_type boolean_op_type(IfcSchema::IfcBooleanOperator::Value op) {
if (op == IfcSchema::IfcBooleanOperator::IfcBooleanOperator_DIFFERENCE) { if (op == IfcSchema::IfcBooleanOperator::IfcBooleanOperator_DIFFERENCE) {
return taxonomy::boolean_result::SUBTRACTION; return taxonomy::boolean_result::SUBTRACTION;
} else if (op == IfcSchema::IfcBooleanOperator::IfcBooleanOperator_INTERSECTION) { } else if (op == IfcSchema::IfcBooleanOperator::IfcBooleanOperator_INTERSECTION) {
+1 -1
View File
@@ -23,7 +23,7 @@ using namespace ifcopenshell::geom;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve& inst) { taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve& inst) {
auto loop = taxonomy::make<taxonomy::loop>(); auto loop = taxonomy::make<taxonomy::loop>();
taxonomy::piecewise_function::spans_t spans; taxonomy::piecewise_function::span_list spans;
#ifdef SCHEMA_HAS_IfcSegment #ifdef SCHEMA_HAS_IfcSegment
// 4x3 // 4x3
+1 -1
View File
@@ -30,7 +30,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcGradientCurve& inst) {
auto segments = inst.Segments(); auto segments = inst.Segments();
taxonomy::piecewise_function::spans_t spans; taxonomy::piecewise_function::span_list spans;
for (auto& segment : segments) { for (auto& segment : segments) {
if (segment.as<IfcSchema::IfcCurveSegment>()) { if (segment.as<IfcSchema::IfcCurveSegment>()) {
@@ -63,7 +63,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances& inst
double start = basis_curve_fn->start(); double start = basis_curve_fn->start();
double basis_curve_length = basis_curve_fn->length(); double basis_curve_length = basis_curve_fn->length();
taxonomy::piecewise_function::spans_t offset_spans; taxonomy::piecewise_function::span_list offset_spans;
#if defined SCHEMA_HAS_IfcDistanceExpression #if defined SCHEMA_HAS_IfcDistanceExpression
double first_distance = first_offset_value.DistanceAlong(); double first_distance = first_offset_value.DistanceAlong();
@@ -31,7 +31,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSegmentedReferenceCurve& ins
auto segments = inst.Segments(); auto segments = inst.Segments();
taxonomy::piecewise_function::spans_t spans; taxonomy::piecewise_function::span_list spans;
for (auto& segment : segments) { for (auto& segment : segments) {
if (auto cseg = segment.as<IfcSchema::IfcCurveSegment>()) { if (auto cseg = segment.as<IfcSchema::IfcCurveSegment>()) {
// @todo check that we don't get a mixture of implicit and explicit definitions // @todo check that we don't get a mixture of implicit and explicit definitions
+3 -3
View File
@@ -118,10 +118,10 @@ std::vector<IfcSchema::IfcProduct> mapping::products_represented_by(const IfcSch
} }
namespace { namespace {
std::vector<IfcSchema::IfcProduct> filter_products(const std::vector<IfcSchema::IfcProduct>& unfiltered_products, const std::vector<filter_t>& filters) { std::vector<IfcSchema::IfcProduct> filter_products(const std::vector<IfcSchema::IfcProduct>& unfiltered_products, const std::vector<filter_function>& filters) {
std::vector<IfcSchema::IfcProduct> ifcproducts; std::vector<IfcSchema::IfcProduct> ifcproducts;
for (auto& prod : unfiltered_products) { for (auto& prod : unfiltered_products) {
if (boost::all(filters, [prod](const filter_t& f) { return f(prod); })) { if (boost::all(filters, [prod](const filter_function& f) { return f(prod); })) {
ifcproducts.push_back(prod); ifcproducts.push_back(prod);
} }
} }
@@ -228,7 +228,7 @@ std::vector<express::base> mapping::find_openings(const express::base& inst) {
} }
void mapping::get_representations(std::vector<geometry_conversion_task>& tasks, std::vector<filter_t>& filters) { void mapping::get_representations(std::vector<geometry_conversion_task>& tasks, std::vector<filter_function>& filters) {
std::vector<IfcSchema::IfcRepresentation> representations; std::vector<IfcSchema::IfcRepresentation> representations;
const bool has_context_ids = settings_.get<settings::ContextIds>().has(); const bool has_context_ids = settings_.get<settings::ContextIds>().has();
const bool uses_priorities = !has_context_ids && settings_.get<settings::ContextPriorities>().has(); const bool uses_priorities = !has_context_ids && settings_.get<settings::ContextPriorities>().has();
+1 -1
View File
@@ -91,7 +91,7 @@ namespace geom {
initialize_units_(); initialize_units_();
} }
virtual ifcopenshell::geom::taxonomy::ptr map(const express::base&); virtual ifcopenshell::geom::taxonomy::ptr map(const express::base&);
virtual void get_representations(std::vector<geometry_conversion_task>& tasks, std::vector<filter_t>& filters); virtual void get_representations(std::vector<geometry_conversion_task>& tasks, std::vector<filter_function>& filters);
virtual std::map<std::string, express::base> get_layers(const express::base&); virtual std::map<std::string, express::base> get_layers(const express::base&);
virtual void initialize_settings(); virtual void initialize_settings();
virtual double get_length_unit() const { return length_unit_; } virtual double get_length_unit() const { return length_unit_; }
+3 -3
View File
@@ -486,7 +486,7 @@ ifcopenshell::geom::taxonomy::solid::ptr ifcopenshell::geom::create_box(double x
} }
/////////////////// ///////////////////
piecewise_function::piecewise_function(double start, const spans_t& s, const express::base& instance) : function_item(instance), start_(start), spans_(s) { piecewise_function::piecewise_function(double start, const span_list& s, const express::base& instance) : function_item(instance), start_(start), spans_(s) {
} }
piecewise_function::piecewise_function(double start, const std::vector<piecewise_function::ptr>& pwfs, const express::base& instance) : function_item(instance), start_(start) { piecewise_function::piecewise_function(double start, const std::vector<piecewise_function::ptr>& pwfs, const express::base& instance) : function_item(instance), start_(start) {
@@ -495,7 +495,7 @@ piecewise_function::piecewise_function(double start, const std::vector<piecewise
} }
}; };
const piecewise_function::spans_t& piecewise_function::spans() const { return spans_; } const piecewise_function::span_list& piecewise_function::spans() const { return spans_; }
bool piecewise_function::is_empty() const { return spans_.empty(); } bool piecewise_function::is_empty() const { return spans_.empty(); }
double piecewise_function::start() const { return start_; } double piecewise_function::start() const { return start_; }
double piecewise_function::end() const { return start_ + length(); } double piecewise_function::end() const { return start_ + length(); }
@@ -829,7 +829,7 @@ std::optional<function_item::ptr> ifcopenshell::geom::taxonomy::loop_to_function
fi_ = loop_->fi; fi_ = loop_->fi;
} else { } else {
// piecewise_function is a specialization of function_item - callers don't need to know this detail // piecewise_function is a specialization of function_item - callers don't need to know this detail
piecewise_function::spans_t spans; piecewise_function::span_list spans;
spans.reserve(loop_->children.size()); spans.reserve(loop_->children.size());
for (auto& edge_ : loop_->children) { for (auto& edge_ : loop_->children) {
if (edge_->basis && edge_->basis->kind() == CIRCLE) { if (edge_->basis && edge_->basis->kind() == CIRCLE) {
+9 -9
View File
@@ -303,10 +303,10 @@ typedef item const* ptr;
public: public:
DECLARE_PTR(matrix4) DECLARE_PTR(matrix4)
enum tag_t { enum tag_type {
IDENTITY, AFFINE_WO_SCALE, AFFINE_W_UNIFORM_SCALE, AFFINE_W_NONUNIFORM_SCALE, OTHER IDENTITY, AFFINE_WO_SCALE, AFFINE_W_UNIFORM_SCALE, AFFINE_W_NONUNIFORM_SCALE, OTHER
}; };
tag_t tag; tag_type tag;
matrix4() : eigen_base(), tag(IDENTITY) {} matrix4() : eigen_base(), tag(IDENTITY) {}
matrix4(const Eigen::Matrix4d& c) : eigen_base(c), tag(OTHER) {} matrix4(const Eigen::Matrix4d& c) : eigen_base(c), tag(OTHER) {}
@@ -476,15 +476,15 @@ typedef item const* ptr;
struct IFC_GEOM_API piecewise_function : public function_item { struct IFC_GEOM_API piecewise_function : public function_item {
DECLARE_PTR(piecewise_function) DECLARE_PTR(piecewise_function)
using spans_t = std::vector<function_item::const_ptr>; using span_list = std::vector<function_item::const_ptr>;
piecewise_function(double start, const spans_t& s, const express::base& instance = express::base()); piecewise_function(double start, const span_list& s, const express::base& instance = express::base());
piecewise_function(double start, const std::vector<piecewise_function::ptr>& pwfs, const express::base& instance = express::base()); piecewise_function(double start, const std::vector<piecewise_function::ptr>& pwfs, const express::base& instance = express::base());
piecewise_function(piecewise_function&&) = default; piecewise_function(piecewise_function&&) = default;
piecewise_function(const piecewise_function&) = default; piecewise_function(const piecewise_function&) = default;
virtual ~piecewise_function() = default; virtual ~piecewise_function() = default;
const spans_t& spans() const; const span_list& spans() const;
size_t span_count() const {return spans_.size();} size_t span_count() const {return spans_.size();}
function_item::const_ptr span_fn(size_t i) { return spans_[i]; } function_item::const_ptr span_fn(size_t i) { return spans_[i]; }
bool is_empty() const; bool is_empty() const;
@@ -502,7 +502,7 @@ typedef item const* ptr;
private: private:
double start_ = 0.0; // starting value of the pwf double start_ = 0.0; // starting value of the pwf
spans_t spans_; span_list spans_;
}; };
struct IFC_GEOM_API gradient_function : public function_item { struct IFC_GEOM_API gradient_function : public function_item {
@@ -1271,15 +1271,15 @@ typedef item const* ptr;
struct IFC_GEOM_API boolean_result : public collection_base<geom_item> { struct IFC_GEOM_API boolean_result : public collection_base<geom_item> {
DECLARE_PTR(boolean_result) DECLARE_PTR(boolean_result)
enum operation_t { enum operation_type {
UNION, SUBTRACTION, INTERSECTION UNION, SUBTRACTION, INTERSECTION
}; };
virtual boolean_result* clone_() const { return new boolean_result(*this); } virtual boolean_result* clone_() const { return new boolean_result(*this); }
virtual kinds kind() const { return BOOLEAN_RESULT; } virtual kinds kind() const { return BOOLEAN_RESULT; }
operation_t operation; operation_type operation;
static const std::string& operation_str(operation_t op) { static const std::string& operation_str(operation_type op) {
using namespace std::string_literals; using namespace std::string_literals;
static std::string s[] = { "union"s, "subtraction"s, "intersection"s }; static std::string s[] = { "union"s, "subtraction"s, "intersection"s };
return s[(size_t)op]; return s[(size_t)op];
@@ -129,7 +129,7 @@ std::vector<ifcopenshell::geom::geometry_conversion_task> representation_tasks(
ifcopenshell::geom::kernels::construct(&file, "passthrough", settings), &file, settings, log); ifcopenshell::geom::kernels::construct(&file, "passthrough", settings), &file, settings, log);
std::vector<ifcopenshell::geom::geometry_conversion_task> tasks; std::vector<ifcopenshell::geom::geometry_conversion_task> tasks;
std::vector<ifcopenshell::geom::filter_t> filters; std::vector<ifcopenshell::geom::filter_function> filters;
converter.mapping()->get_representations(tasks, filters); converter.mapping()->get_representations(tasks, filters);
return tasks; return tasks;
} }
+10 -10
View File
@@ -18,8 +18,8 @@ public:
int operator()(const double& /*i*/) const { return -1; } int operator()(const double& /*i*/) const { return -1; }
int operator()(const std::string& /*i*/) const { return -1; } int operator()(const std::string& /*i*/) const { return -1; }
int operator()(const boost::dynamic_bitset<>& /*i*/) const { return -1; } int operator()(const boost::dynamic_bitset<>& /*i*/) const { return -1; }
int operator()(const empty_aggregate_t& /*unused*/) const { return 0; } int operator()(const empty_aggregate& /*unused*/) const { return 0; }
int operator()(const empty_aggregate_of_aggregate_t& /*unused*/) const { return 0; } int operator()(const empty_aggregate_of_aggregate& /*unused*/) const { return 0; }
int operator()(const std::vector<int64_t>& i) const { return (int)i.size(); } int operator()(const std::vector<int64_t>& i) const { return (int)i.size(); }
int operator()(const std::vector<double>& i) const { return (int)i.size(); } int operator()(const std::vector<double>& i) const { return (int)i.size(); }
int operator()(const std::vector<std::vector<int64_t>>& i) const { return (int)i.size(); } int operator()(const std::vector<std::vector<int64_t>>& i) const { return (int)i.size(); }
@@ -379,17 +379,17 @@ bool ::impl::serialize(std::string& val, const derived&)
return true; return true;
} }
bool ::impl::serialize(std::string& val, const empty_aggregate_t&) bool ::impl::serialize(std::string& val, const empty_aggregate&)
{ {
val.resize(1); val.resize(1);
val[0] = type_encoder::encode_type<empty_aggregate_t>(); val[0] = type_encoder::encode_type<empty_aggregate>();
return true; return true;
} }
bool ::impl::serialize(std::string& val, const empty_aggregate_of_aggregate_t&) bool ::impl::serialize(std::string& val, const empty_aggregate_of_aggregate&)
{ {
val.resize(1); val.resize(1);
val[0] = type_encoder::encode_type<empty_aggregate_of_aggregate_t>(); val[0] = type_encoder::encode_type<empty_aggregate_of_aggregate>();
return true; return true;
} }
@@ -544,8 +544,8 @@ template IFC_PARSE_API void rocks_db_attribute_storage::set<std::vector<std::vec
// @todo why do these need to be included, but are not in BaseEntity::set()? // @todo why do these need to be included, but are not in BaseEntity::set()?
template IFC_PARSE_API void rocks_db_attribute_storage::set<derived>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index, const derived& value); template IFC_PARSE_API void rocks_db_attribute_storage::set<derived>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index, const derived& value);
template IFC_PARSE_API void rocks_db_attribute_storage::set<empty_aggregate_t>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index, const empty_aggregate_t& value); template IFC_PARSE_API void rocks_db_attribute_storage::set<empty_aggregate>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index, const empty_aggregate& value);
template IFC_PARSE_API void rocks_db_attribute_storage::set<empty_aggregate_of_aggregate_t>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index, const empty_aggregate_of_aggregate_t& value); template IFC_PARSE_API void rocks_db_attribute_storage::set<empty_aggregate_of_aggregate>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index, const empty_aggregate_of_aggregate& value);
template IFC_PARSE_API bool rocks_db_attribute_storage::has<blank>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const; template IFC_PARSE_API bool rocks_db_attribute_storage::has<blank>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const;
template IFC_PARSE_API bool rocks_db_attribute_storage::has<int64_t>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const; template IFC_PARSE_API bool rocks_db_attribute_storage::has<int64_t>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const;
@@ -567,8 +567,8 @@ template IFC_PARSE_API bool rocks_db_attribute_storage::has<std::vector<std::vec
// @todo why do these need to be included, but are not in BaseEntity::set()? // @todo why do these need to be included, but are not in BaseEntity::set()?
template IFC_PARSE_API bool rocks_db_attribute_storage::has<derived>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const; template IFC_PARSE_API bool rocks_db_attribute_storage::has<derived>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const;
template IFC_PARSE_API bool rocks_db_attribute_storage::has<empty_aggregate_t>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const; template IFC_PARSE_API bool rocks_db_attribute_storage::has<empty_aggregate>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const;
template IFC_PARSE_API bool rocks_db_attribute_storage::has<empty_aggregate_of_aggregate_t>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const; template IFC_PARSE_API bool rocks_db_attribute_storage::has<empty_aggregate_of_aggregate>(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const;
template <typename T> template <typename T>
T* instance_data::get_storage_of_type() const { T* instance_data::get_storage_of_type() const {
+15 -15
View File
@@ -138,11 +138,11 @@ private:
return bypassed_instances_; return bypassed_instances_;
} }
const ifcopenshell::impl::in_memory_file_storage::entities_by_ref_t& inverses() const { const ifcopenshell::impl::in_memory_file_storage::entities_by_ref& inverses() const {
return storage_.byref_excl_; return storage_.byref_excl_;
} }
ifcopenshell::impl::in_memory_file_storage::entities_by_ref_t& inverses() { ifcopenshell::impl::in_memory_file_storage::entities_by_ref& inverses() {
return storage_.byref_excl_; return storage_.byref_excl_;
} }
@@ -184,27 +184,27 @@ class uninitialized_tag {};
/// The file takes ownership of instances added to this file and deletes them when the file is deleted. /// The file takes ownership of instances added to this file and deletes them when the file is deleted.
class IFC_PARSE_API file { class IFC_PARSE_API file {
private: private:
typedef std::map<uint32_t, express::base> entity_entity_map_t; typedef std::map<uint32_t, express::base> entity_entity_map;
// @todo determine the constness of things (probably needs to be all const, we don't want to overwrite) // @todo determine the constness of things (probably needs to be all const, we don't want to overwrite)
// @todo we have variant_iterator and MapVariant, we probably need to retain only one? // @todo we have variant_iterator and MapVariant, we probably need to retain only one?
public: public:
using const_iterator = variant_iterator<impl::in_memory_file_storage::iterator, impl::rocks_db_file_storage::const_iterator>; using const_iterator = variant_iterator<impl::in_memory_file_storage::iterator, impl::rocks_db_file_storage::const_iterator>;
using type_iterator = variant_iterator<impl::in_memory_file_storage::type_iterator, impl::rocks_db_file_storage::rocksdb_types_iterator>; using type_iterator = variant_iterator<impl::in_memory_file_storage::type_iterator, impl::rocks_db_file_storage::rocksdb_types_iterator>;
using storage_t = std::variant<std::monostate, impl::in_memory_file_storage, impl::rocks_db_file_storage>; using storage_type = std::variant<std::monostate, impl::in_memory_file_storage, impl::rocks_db_file_storage>;
typedef variant_map<impl::in_memory_file_storage::entity_instance_by_guid_t, impl::rocks_db_file_storage::entity_instance_by_guid_t> entity_instance_by_guid_t; typedef variant_map<impl::in_memory_file_storage::entity_instance_by_guid, impl::rocks_db_file_storage::entity_instance_by_guid> entity_instance_by_guid;
entity_instance_by_guid_t byguid_; entity_instance_by_guid byguid_;
typedef variant_map<impl::in_memory_file_storage::entity_instance_by_name_t, impl::rocks_db_file_storage::entity_instance_by_name_t> entity_by_id_t; typedef variant_map<impl::in_memory_file_storage::entity_instance_by_name, impl::rocks_db_file_storage::entity_instance_by_name> entity_by_id;
entity_by_id_t byid_; entity_by_id byid_;
typedef variant_map<impl::in_memory_file_storage::entities_by_ref_t, impl::rocks_db_file_storage::entities_by_ref_t> entities_by_ref_t; typedef variant_map<impl::in_memory_file_storage::entities_by_ref, impl::rocks_db_file_storage::entities_by_ref> entities_by_ref;
entities_by_ref_t byref_excl_; entities_by_ref byref_excl_;
bool check_existance_before_adding = true; bool check_existance_before_adding = true;
bool calculate_unit_factors = true; bool calculate_unit_factors = true;
// @todo temporarily public for header // @todo temporarily public for header
storage_t storage_; storage_type storage_;
std::set<std::string> types_to_bypass_loading_; std::set<std::string> types_to_bypass_loading_;
@@ -215,7 +215,7 @@ public:
const ifcopenshell::schema_definition* schema_; const ifcopenshell::schema_definition* schema_;
const ifcopenshell::declaration* ifcroot_type_; const ifcopenshell::declaration* ifcroot_type_;
entity_entity_map_t entity_file_map_; entity_entity_map entity_file_map_;
unsigned int max_id_; unsigned int max_id_;
@@ -293,13 +293,13 @@ public:
/// Returns the first entity in the range of instances contained in the model, /// Returns the first entity in the range of instances contained in the model,
/// in arbitrary order /// in arbitrary order
entity_by_id_t::iterator begin() const { entity_by_id::iterator begin() const {
return byid_.begin(); return byid_.begin();
} }
/// Returns the first entity in the range of instances contained in the model, /// Returns the first entity in the range of instances contained in the model,
/// in arbitrary order /// in arbitrary order
entity_by_id_t::iterator end() const { entity_by_id::iterator end() const {
return byid_.end(); return byid_.end();
} }
@@ -411,7 +411,7 @@ public:
void register_inverse(unsigned referenced_id, const ifcopenshell::entity* from_entity, int instance_id, int attribute_index); void register_inverse(unsigned referenced_id, const ifcopenshell::entity* from_entity, int instance_id, int attribute_index);
void unregister_inverse(unsigned referenced_id, const ifcopenshell::entity* from_entity, const express::base& entity, int attribute_index); void unregister_inverse(unsigned referenced_id, const ifcopenshell::entity* from_entity, const express::base& entity, int attribute_index);
entity_instance_by_guid_t internal_guid_map() { return byguid_; }; entity_instance_by_guid internal_guid_map() { return byguid_; };
void add_type_ref(const express::base& new_entity); void add_type_ref(const express::base& new_entity);
void remove_type_ref(const express::base& new_entity); void remove_type_ref(const express::base& new_entity);
+13 -13
View File
@@ -72,8 +72,8 @@ public:
}; };
class IFC_PARSE_API blank {}; class IFC_PARSE_API blank {};
class IFC_PARSE_API derived {}; class IFC_PARSE_API derived {};
class IFC_PARSE_API empty_aggregate_t {}; class IFC_PARSE_API empty_aggregate {};
class IFC_PARSE_API empty_aggregate_of_aggregate_t {}; class IFC_PARSE_API empty_aggregate_of_aggregate {};
} // namespace ifcopenshell } // namespace ifcopenshell
@@ -134,7 +134,7 @@ namespace impl {
}; };
template <> template <>
struct variant_type_name<ifcopenshell::empty_aggregate_t> { struct variant_type_name<ifcopenshell::empty_aggregate> {
static std::string get() { return "aggregate"; } static std::string get() { return "aggregate"; }
}; };
@@ -144,7 +144,7 @@ namespace impl {
}; };
template <> template <>
struct variant_type_name<ifcopenshell::empty_aggregate_of_aggregate_t> { struct variant_type_name<ifcopenshell::empty_aggregate_of_aggregate> {
static std::string get() { return "aggregate of aggregate"; } static std::string get() { return "aggregate of aggregate"; }
}; };
} }
@@ -191,7 +191,7 @@ typedef parameter_pack <
express::base, express::base,
// AGGREGATES: // AGGREGATES:
empty_aggregate_t, empty_aggregate,
// An aggregate of integers, e.g. (1,2,3). Stored as int64_t for the // An aggregate of integers, e.g. (1,2,3). Stored as int64_t for the
// same reason as the scalar int64_t above. // same reason as the scalar int64_t above.
std::vector<int64_t>, std::vector<int64_t>,
@@ -207,7 +207,7 @@ typedef parameter_pack <
std::vector<express::base>, std::vector<express::base>,
// AGGREGATES OF AGGREGATES: // AGGREGATES OF AGGREGATES:
empty_aggregate_of_aggregate_t, empty_aggregate_of_aggregate,
// An aggregate of an aggregate of ints. E.g. ((1, 2), (3)) // An aggregate of an aggregate of ints. E.g. ((1, 2), (3))
std::vector<std::vector<int64_t>>, std::vector<std::vector<int64_t>>,
// An aggregate of an aggregate of floats. E.g. ((1., 2.3), (4.)) // An aggregate of an aggregate of floats. E.g. ((1., 2.3), (4.))
@@ -227,17 +227,17 @@ struct pack_to_variant_array<parameter_pack<Args...>> {
using in_memory_attribute_storage = pack_to_variant_array<type_variant_parameter_pack>::type; using in_memory_attribute_storage = pack_to_variant_array<type_variant_parameter_pack>::type;
template <typename Pack> template <typename Pack>
struct type_encoder_t; struct type_encoder_impl;
template <typename... Types> template <typename... Types>
struct type_encoder_t<parameter_pack<Types...>> { struct type_encoder_impl<parameter_pack<Types...>> {
template <typename U> template <typename U>
static char encode_type() { static char encode_type() {
return 'A' + ::impl::TypeIndex_v<U, Types...>; return 'A' + ::impl::TypeIndex_v<U, Types...>;
} }
}; };
using type_encoder = type_encoder_t<type_variant_parameter_pack>; using type_encoder = type_encoder_impl<type_variant_parameter_pack>;
class IFC_PARSE_API mutable_attribute_value { class IFC_PARSE_API mutable_attribute_value {
public: public:
@@ -299,8 +299,8 @@ namespace impl {
bool serialize(std::string& buffer, const ifcopenshell::blank& value); bool serialize(std::string& buffer, const ifcopenshell::blank& value);
bool serialize(std::string& buffer, const ifcopenshell::derived& value); bool serialize(std::string& buffer, const ifcopenshell::derived& value);
bool serialize(std::string& buffer, const ifcopenshell::empty_aggregate_t& value); bool serialize(std::string& buffer, const ifcopenshell::empty_aggregate& value);
bool serialize(std::string& buffer, const ifcopenshell::empty_aggregate_of_aggregate_t& value); bool serialize(std::string& buffer, const ifcopenshell::empty_aggregate_of_aggregate& value);
bool serialize(std::string& buffer, const boost::logic::tribool& value); bool serialize(std::string& buffer, const boost::logic::tribool& value);
@@ -475,9 +475,9 @@ public:
case ifcopenshell::Argument_AGGREGATE_OF_AGGREGATE_OF_ENTITY_INSTANCE: case ifcopenshell::Argument_AGGREGATE_OF_AGGREGATE_OF_ENTITY_INSTANCE:
return visitor((std::vector<std::vector<express::base>>)*this); return visitor((std::vector<std::vector<express::base>>)*this);
case ifcopenshell::Argument_EMPTY_AGGREGATE: case ifcopenshell::Argument_EMPTY_AGGREGATE:
return visitor(empty_aggregate_t{}); return visitor(empty_aggregate{});
case ifcopenshell::Argument_AGGREGATE_OF_EMPTY_AGGREGATE: case ifcopenshell::Argument_AGGREGATE_OF_EMPTY_AGGREGATE:
return visitor(empty_aggregate_of_aggregate_t{}); return visitor(empty_aggregate_of_aggregate{});
default: default:
return visitor(blank{}); return visitor(blank{});
} }
+2 -2
View File
@@ -35,13 +35,13 @@ public:
static constexpr bool read_only = std::is_void<TransformBack>::value; static constexpr bool read_only = std::is_void<TransformBack>::value;
struct back_storage_fallback {}; struct back_storage_fallback {};
using back_storage_t = typename std::conditional<read_only, back_storage_fallback, TransformBack>::type; using back_storage = typename std::conditional<read_only, back_storage_fallback, TransformBack>::type;
private: private:
BaseMap* base_map_; BaseMap* base_map_;
Transform transform_; Transform transform_;
back_storage_t transform_back_; back_storage transform_back_;
public: public:
// read-only constructor with TransformBack=void // read-only constructor with TransformBack=void
+12 -12
View File
@@ -1330,8 +1330,8 @@ namespace {
} }
data_ << ")"; data_ << ")";
} }
void operator()(const empty_aggregate_t& /*unused*/) const { data_ << "()"; } void operator()(const empty_aggregate& /*unused*/) const { data_ << "()"; }
void operator()(const empty_aggregate_of_aggregate_t& /*unused*/) const { data_ << "()"; } void operator()(const empty_aggregate_of_aggregate& /*unused*/) const { data_ << "()"; }
}; };
template <> template <>
@@ -2469,7 +2469,7 @@ template void ifcopenshell::impl::in_memory_file_storage::read_from_stream(file_
void file::recalculate_id_counter() { void file::recalculate_id_counter() {
/* /*
// @todo // @todo
entity_by_id_t::key_type k = 0; entity_by_id::key_type k = 0;
for (auto& p : byid_) { for (auto& p : byid_) {
if (p.first > k) { if (p.first > k) {
k = p.first; k = p.first;
@@ -2582,7 +2582,7 @@ express::base file::add_entity(const express::base& entity, int id) {
// If this instance has been inserted before, return // If this instance has been inserted before, return
// a reference to the copy that was created from it. // a reference to the copy that was created from it.
entity_entity_map_t::iterator mit = entity_file_map_.find(entity.identity()); entity_entity_map::iterator mit = entity_file_map_.find(entity.identity());
if (mit != entity_file_map_.end()) { if (mit != entity_file_map_.end()) {
return mit->second; return mit->second;
} }
@@ -2593,9 +2593,9 @@ express::base file::add_entity(const express::base& entity, int id) {
auto entity_attributes = traverse(entity, 1); auto entity_attributes = traverse(entity, 1);
for (auto it = entity_attributes.begin() + 1; it != entity_attributes.end(); ++it) { for (auto it = entity_attributes.begin() + 1; it != entity_attributes.end(); ++it) {
if (*it != entity) { if (*it != entity) {
entity_entity_map_t::iterator mit2 = entity_file_map_.find(it->identity()); entity_entity_map::iterator mit2 = entity_file_map_.find(it->identity());
if (mit2 == entity_file_map_.end()) { if (mit2 == entity_file_map_.end()) {
entity_file_map_.insert(entity_entity_map_t::value_type(it->identity(), add_entity(*it))); entity_file_map_.insert(entity_entity_map::value_type(it->identity(), add_entity(*it)));
} }
} }
} }
@@ -2618,8 +2618,8 @@ express::base file::add_entity(const express::base& entity, int id) {
if constexpr (std::is_same_v<u, express::base>) { if constexpr (std::is_same_v<u, express::base>) {
} else if constexpr (std::is_same_v<u, std::vector<express::base>>) { } else if constexpr (std::is_same_v<u, std::vector<express::base>>) {
} else if constexpr (std::is_same_v<u, std::vector<std::vector<express::base>>>) { } else if constexpr (std::is_same_v<u, std::vector<std::vector<express::base>>>) {
} else if constexpr (std::is_same_v<u, empty_aggregate_t>) { } else if constexpr (std::is_same_v<u, empty_aggregate>) {
} else if constexpr (std::is_same_v<u, empty_aggregate_of_aggregate_t>) { } else if constexpr (std::is_same_v<u, empty_aggregate_of_aggregate>) {
} else { } else {
new_entity.set_attribute_value(i, v); new_entity.set_attribute_value(i, v);
} }
@@ -2648,7 +2648,7 @@ express::base file::add_entity(const express::base& entity, int id) {
} }
if (attr_type == ifcopenshell::Argument_ENTITY_INSTANCE) { if (attr_type == ifcopenshell::Argument_ENTITY_INSTANCE) {
entity_entity_map_t::const_iterator eit = entity_file_map_.find(((express::base)(attr)).identity()); entity_entity_map::const_iterator eit = entity_file_map_.find(((express::base)(attr)).identity());
if (eit == entity_file_map_.end()) { if (eit == entity_file_map_.end()) {
throw ifcopenshell::exception("Unable to map instance to file"); throw ifcopenshell::exception("Unable to map instance to file");
} }
@@ -2658,7 +2658,7 @@ express::base file::add_entity(const express::base& entity, int id) {
std::vector<express::base> instances = attr; std::vector<express::base> instances = attr;
std::vector<express::base> new_instances; std::vector<express::base> new_instances;
for (auto& i : instances) { for (auto& i : instances) {
entity_entity_map_t::const_iterator eit = entity_file_map_.find(i.identity()); entity_entity_map::const_iterator eit = entity_file_map_.find(i.identity());
if (eit == entity_file_map_.end()) { if (eit == entity_file_map_.end()) {
throw ifcopenshell::exception("Unable to map instance to file"); throw ifcopenshell::exception("Unable to map instance to file");
} }
@@ -2672,7 +2672,7 @@ express::base file::add_entity(const express::base& entity, int id) {
for (auto& v : instances) { for (auto& v : instances) {
new_instances.emplace_back(); new_instances.emplace_back();
for (auto& i : v) { for (auto& i : v) {
entity_entity_map_t::const_iterator eit = entity_file_map_.find(i.identity()); entity_entity_map::const_iterator eit = entity_file_map_.find(i.identity());
if (eit == entity_file_map_.end()) { if (eit == entity_file_map_.end()) {
throw ifcopenshell::exception("Unable to map instance to file"); throw ifcopenshell::exception("Unable to map instance to file");
} }
@@ -2719,7 +2719,7 @@ express::base file::add_entity(const express::base& entity, int id) {
} }
} }
entity_file_map_.insert(entity_entity_map_t::value_type(entity.identity(), new_entity)); entity_file_map_.insert(entity_entity_map::value_type(entity.identity(), new_entity));
// For subtypes of IfcRoot, the GUID mapping needs to be updated. // For subtypes of IfcRoot, the GUID mapping needs to be updated.
/* /*
+2 -2
View File
@@ -108,8 +108,8 @@ void ifcopenshell::spf_header::assign(const spf_header& other) {
if constexpr (std::is_same_v<u, express::base>) { if constexpr (std::is_same_v<u, express::base>) {
} else if constexpr (std::is_same_v<u, std::vector<express::base>>) { } else if constexpr (std::is_same_v<u, std::vector<express::base>>) {
} else if constexpr (std::is_same_v<u, std::vector<std::vector<express::base>>>) { } else if constexpr (std::is_same_v<u, std::vector<std::vector<express::base>>>) {
} else if constexpr (std::is_same_v<u, empty_aggregate_t>) { } else if constexpr (std::is_same_v<u, empty_aggregate>) {
} else if constexpr (std::is_same_v<u, empty_aggregate_of_aggregate_t>) { } else if constexpr (std::is_same_v<u, empty_aggregate_of_aggregate>) {
} else { } else {
new_entity.set_attribute_value(i, v); new_entity.set_attribute_value(i, v);
} }
+53 -53
View File
@@ -220,19 +220,19 @@ namespace ifcopenshell {
class inverse_index { class inverse_index {
public: public:
typedef std::map<std::tuple<short, short>, std::vector<uint32_t>> legacy_bucket_t; typedef std::map<std::tuple<short, short>, std::vector<uint32_t>> legacy_bucket;
typedef std::unordered_map<int, legacy_bucket_t> legacy_map_t; typedef std::unordered_map<int, legacy_bucket> legacy_map;
typedef legacy_map_t::key_type key_type; typedef legacy_map::key_type key_type;
typedef legacy_map_t::mapped_type mapped_type; typedef legacy_map::mapped_type mapped_type;
typedef legacy_map_t::value_type value_type; typedef legacy_map::value_type value_type;
typedef legacy_map_t::iterator iterator; typedef legacy_map::iterator iterator;
typedef legacy_map_t::const_iterator const_iterator; typedef legacy_map::const_iterator const_iterator;
typedef std::vector<inverse_record>::const_iterator record_iterator; typedef std::vector<inverse_record>::const_iterator record_iterator;
private: private:
mutable std::vector<inverse_record> records_; mutable std::vector<inverse_record> records_;
mutable bool sorted_ = true; mutable bool sorted_ = true;
mutable std::unique_ptr<legacy_map_t> materialized_; mutable std::unique_ptr<legacy_map> materialized_;
static bool record_less(const inverse_record& a, const inverse_record& b) { static bool record_less(const inverse_record& a, const inverse_record& b) {
if (a.referenced_id != b.referenced_id) { if (a.referenced_id != b.referenced_id) {
@@ -259,9 +259,9 @@ namespace ifcopenshell {
materialized_.reset(); materialized_.reset();
} }
legacy_map_t& materialize() const { legacy_map& materialize() const {
if (!materialized_) { if (!materialized_) {
materialized_ = std::make_unique<legacy_map_t>(); materialized_ = std::make_unique<legacy_map>();
materialized_->reserve(records_.size()); materialized_->reserve(records_.size());
for (const auto& record : records_) { for (const auto& record : records_) {
(*materialized_)[(int)record.referenced_id][{(short)record.source_entity, (short)record.attribute_index}].push_back(record.source_id); (*materialized_)[(int)record.referenced_id][{(short)record.source_entity, (short)record.attribute_index}].push_back(record.source_id);
@@ -421,42 +421,42 @@ namespace ifcopenshell {
unresolved_references* references_to_resolve = nullptr; unresolved_references* references_to_resolve = nullptr;
typedef std::map<const ifcopenshell::declaration*, std::vector<express::base>> entities_by_type_t; typedef std::map<const ifcopenshell::declaration*, std::vector<express::base>> entities_by_type;
typedef std::unordered_map<uint32_t, shared_pointer_type> entity_instance_by_name_storage_t; typedef std::unordered_map<uint32_t, shared_pointer_type> entity_instance_by_name_storage;
typedef map_transformer<entity_instance_by_name_storage_t, std::function<express::base(shared_pointer_type)>> entity_instance_by_name_t; typedef map_transformer<entity_instance_by_name_storage, std::function<express::base(shared_pointer_type)>> entity_instance_by_name;
typedef std::unordered_map<uint32_t, shared_pointer_type> type_instance_by_name_t; typedef std::unordered_map<uint32_t, shared_pointer_type> type_instance_by_name;
typedef std::map<std::string, express::base> entity_instance_by_guid_t; typedef std::map<std::string, express::base> entity_instance_by_guid;
typedef inverse_index entities_by_ref_t; typedef inverse_index entities_by_ref;
typedef entity_instance_by_name_t::iterator iterator; typedef entity_instance_by_name::iterator iterator;
in_memory_file_storage(ifcopenshell::file* owner_file = nullptr, ifcopenshell::logger& logger = ifcopenshell::logger::root()) : logger_(logger), file(owner_file), schema(nullptr), byid_read_(&byid_, [this](const shared_pointer_type& data) { return express::base(data); }) {}; in_memory_file_storage(ifcopenshell::file* owner_file = nullptr, ifcopenshell::logger& logger = ifcopenshell::logger::root()) : logger_(logger), file(owner_file), schema(nullptr), byid_read_(&byid_, [this](const shared_pointer_type& data) { return express::base(data); }) {};
in_memory_file_storage(const in_memory_file_storage& other) = delete; in_memory_file_storage(const in_memory_file_storage& other) = delete;
in_memory_file_storage(const in_memory_file_storage&& other) = delete; in_memory_file_storage(const in_memory_file_storage&& other) = delete;
class type_iterator : public entities_by_type_t::const_iterator { class type_iterator : public entities_by_type::const_iterator {
public: public:
using iterator_category = std::forward_iterator_tag; using iterator_category = std::forward_iterator_tag;
using value_type = entities_by_type_t::key_type; using value_type = entities_by_type::key_type;
using difference_type = typename entities_by_type_t::const_iterator::difference_type; using difference_type = typename entities_by_type::const_iterator::difference_type;
using pointer = value_type const*; using pointer = value_type const*;
using reference = value_type const&; using reference = value_type const&;
type_iterator() : entities_by_type_t::const_iterator() {}; type_iterator() : entities_by_type::const_iterator() {};
type_iterator(const entities_by_type_t::const_iterator& iterator) type_iterator(const entities_by_type::const_iterator& iterator)
: entities_by_type_t::const_iterator(iterator) {}; : entities_by_type::const_iterator(iterator) {};
entities_by_type_t::key_type const* operator->() const { entities_by_type::key_type const* operator->() const {
return &entities_by_type_t::const_iterator::operator->()->first; return &entities_by_type::const_iterator::operator->()->first;
} }
entities_by_type_t::key_type const& operator*() const { entities_by_type::key_type const& operator*() const {
return entities_by_type_t::const_iterator::operator*().first; return entities_by_type::const_iterator::operator*().first;
} }
type_iterator& operator++() { type_iterator& operator++() {
entities_by_type_t::const_iterator::operator++(); entities_by_type::const_iterator::operator++();
return *this; return *this;
} }
@@ -467,12 +467,12 @@ namespace ifcopenshell {
} }
}; };
entity_instance_by_name_storage_t byid_; entity_instance_by_name_storage byid_;
type_instance_by_name_t tbyid_; type_instance_by_name tbyid_;
entities_by_type_t bytype_excl_; entities_by_type bytype_excl_;
entities_by_ref_t byref_excl_; entities_by_ref byref_excl_;
entity_instance_by_guid_t byguid_; entity_instance_by_guid byguid_;
entity_instance_by_name_t byid_read_; entity_instance_by_name byid_read_;
template <typename Reader> template <typename Reader>
shared_pointer_type load(ifcopenshell::spf_lexer<Reader>* tokens, std::optional<size_t> entity_instance_name, const ifcopenshell::declaration* declaration, const ifcopenshell::entity* entity, int attribute_index = -1, bool coerce_attribute_count = true); shared_pointer_type load(ifcopenshell::spf_lexer<Reader>* tokens, std::optional<size_t> entity_instance_name, const ifcopenshell::declaration* declaration, const ifcopenshell::entity* entity, int attribute_index = -1, bool coerce_attribute_count = true);
@@ -529,35 +529,35 @@ namespace ifcopenshell {
// to make sure that instance pointer are constant during file lifetime // to make sure that instance pointer are constant during file lifetime
// cache instances because we want stable pointers // cache instances because we want stable pointers
// @todo this is silly, but we cannot have the same type, this should be just a pointer then on the file side? // @todo this is silly, but we cannot have the same type, this should be just a pointer then on the file side?
typedef std::map<uint32_t, shared_pointer_type> entity_by_iden_cache_t; typedef std::map<uint32_t, shared_pointer_type> entity_by_iden_cache;
entity_by_iden_cache_t instance_cache_, type_instance_cache_; entity_by_iden_cache instance_cache_, type_instance_cache_;
std::mutex instance_cache_mutex_; std::mutex instance_cache_mutex_;
// @todo all these size_ts should probably be uint32_t for consistency with in-mem storage // @todo all these size_ts should probably be uint32_t for consistency with in-mem storage
// lookup id->identity // lookup id->identity
// typedef rocksdb_map_adapter<size_t, size_t> identity_by_id_t; // typedef rocksdb_map_adapter<size_t, size_t> identity_by_id;
// identity_by_id_t byid_; // identity_by_id byid_;
typedef rocksdb_set_view<size_t> instance_name_view_t; typedef rocksdb_set_view<size_t> instance_name_view;
instance_name_view_t instance_ids_; instance_name_view instance_ids_;
typedef set_to_map_transformer<instance_name_view_t, std::function<express::base(size_t)>> entity_instance_by_name_t; typedef set_to_map_transformer<instance_name_view, std::function<express::base(size_t)>> entity_instance_by_name;
entity_instance_by_name_t instance_by_name_; entity_instance_by_name instance_by_name_;
// typedef map_transformer<rocksdb_map_adapter<size_t, size_t>, std::function<ifcopenshell::IfcBaseClass*(size_t)>, std::function<size_t(ifcopenshell::IfcBaseClass*)>> entity_by_id_t; // typedef map_transformer<rocksdb_map_adapter<size_t, size_t>, std::function<ifcopenshell::IfcBaseClass*(size_t)>, std::function<size_t(ifcopenshell::IfcBaseClass*)>> entity_by_id;
// storage is now Instance name -> Identity -> Pointer (cached) // storage is now Instance name -> Identity -> Pointer (cached)
// entity_by_id_t byidentity_; // entity_by_id byidentity_;
// index in schema to binary serialized ids // index in schema to binary serialized ids
typedef rocksdb_map_adapter<size_t, std::string> instance_id_str_by_type_t; typedef rocksdb_map_adapter<size_t, std::string> instance_id_str_by_type;
instance_id_str_by_type_t bytype_; instance_id_str_by_type bytype_;
// guid -> id // guid -> id
typedef rocksdb_map_adapter<std::string, size_t> instance_id_by_guid_str_t; typedef rocksdb_map_adapter<std::string, size_t> instance_id_by_guid_str;
instance_id_by_guid_str_t byguid_internal_; instance_id_by_guid_str byguid_internal_;
// guid -> id -> instance // guid -> id -> instance
typedef map_transformer<rocksdb_map_adapter<std::string, size_t>, std::function<express::base(size_t)>, std::function<size_t(const express::base&)>> entity_instance_by_guid_t; typedef map_transformer<rocksdb_map_adapter<std::string, size_t>, std::function<express::base(size_t)>, std::function<size_t(const express::base&)>> entity_instance_by_guid;
entity_instance_by_guid_t byguid_; entity_instance_by_guid byguid_;
typedef std::tuple<int, int, int> inverse_attr_record; typedef std::tuple<int, int, int> inverse_attr_record;
enum INVERSE_ATTR { enum INVERSE_ATTR {
@@ -565,8 +565,8 @@ namespace ifcopenshell {
INSTANCE_TYPE, INSTANCE_TYPE,
ATTRIBUTE_INDEX ATTRIBUTE_INDEX
}; };
typedef rocksdb_map_adapter<inverse_attr_record, std::vector<uint32_t>> entities_by_ref_t; typedef rocksdb_map_adapter<inverse_attr_record, std::vector<uint32_t>> entities_by_ref;
entities_by_ref_t byref_excl_; entities_by_ref byref_excl_;
bool read_only_ = false; bool read_only_ = false;
@@ -675,7 +675,7 @@ namespace ifcopenshell {
}; };
// @todo rocksdb_instance_iterator? // @todo rocksdb_instance_iterator?
using const_iterator = entity_instance_by_name_t::iterator; using const_iterator = entity_instance_by_name::iterator;
void register_inverse(unsigned referenced_id, const ifcopenshell::entity* from_entity, int instance_id, int attribute_index); void register_inverse(unsigned referenced_id, const ifcopenshell::entity* from_entity, int instance_id, int attribute_index);
void unregister_inverse(unsigned referenced_id, const ifcopenshell::entity* from_entity, const express::base& entity, int attribute_index); void unregister_inverse(unsigned referenced_id, const ifcopenshell::entity* from_entity, const express::base& entity, int attribute_index);
+10 -10
View File
@@ -123,7 +123,7 @@ namespace impl {
using type = std::tuple<>; using type = std::tuple<>;
}; };
template <typename... Types> template <typename... Types>
using map_types_t = typename map_types<Types...>::type; using mapped_types = typename map_types<Types...>::type;
// Create aligned_union from paramater pack stored in tuple for storage in variant // Create aligned_union from paramater pack stored in tuple for storage in variant
template <typename T> template <typename T>
@@ -138,7 +138,7 @@ namespace impl {
template<typename... Types> template<typename... Types>
class variant_array { class variant_array {
public: public:
using types_tuple = ::impl::map_types_t<Types...>; using types_tuple = ::impl::mapped_types<Types...>;
variant_array(size_t size) variant_array(size_t size)
: size_and_indices_(size ? new uint8_t[size + 1] : nullptr) : size_and_indices_(size ? new uint8_t[size + 1] : nullptr)
@@ -190,7 +190,7 @@ public:
destroy_at_index(index); destroy_at_index(index);
size_and_indices_[index + 1] = ::impl::TypeIndex_v<u, Types...>; size_and_indices_[index + 1] = ::impl::TypeIndex_v<u, Types...>;
using v = typename std::tuple_element<::impl::TypeIndex_v<u, Types...>, ::impl::map_types_t<Types... >>::type; using v = typename std::tuple_element<::impl::TypeIndex_v<u, Types...>, ::impl::mapped_types<Types... >>::type;
if constexpr (::impl::is_unique_ptr<v>::value) { if constexpr (::impl::is_unique_ptr<v>::value) {
new(&storage_[index]) v(new u(value)); new(&storage_[index]) v(new u(value));
} else { } else {
@@ -221,7 +221,7 @@ public:
if (!has<T>(index)) { if (!has<T>(index)) {
throw std::bad_cast(); throw std::bad_cast();
} }
using v = typename std::tuple_element<::impl::TypeIndex_v<T, Types...>, ::impl::map_types_t<Types... >>::type; using v = typename std::tuple_element<::impl::TypeIndex_v<T, Types...>, ::impl::mapped_types<Types... >>::type;
if constexpr (::impl::is_unique_ptr<v>::value) { if constexpr (::impl::is_unique_ptr<v>::value) {
return **reinterpret_cast<v*>(&storage_[index]); return **reinterpret_cast<v*>(&storage_[index]);
} else { } else {
@@ -249,7 +249,7 @@ public:
::impl::variant_type_name<T>::get(), get_type_name(size_and_indices_[index + 1]) ::impl::variant_type_name<T>::get(), get_type_name(size_and_indices_[index + 1])
); );
} }
using v = typename std::tuple_element<::impl::TypeIndex_v<T, Types...>, ::impl::map_types_t<Types... >>::type; using v = typename std::tuple_element<::impl::TypeIndex_v<T, Types...>, ::impl::mapped_types<Types... >>::type;
if constexpr (::impl::is_unique_ptr<v>::value) { if constexpr (::impl::is_unique_ptr<v>::value) {
return **reinterpret_cast<const v*>(&storage_[index]); return **reinterpret_cast<const v*>(&storage_[index]);
} else { } else {
@@ -272,7 +272,7 @@ public:
} }
private: private:
using storage_type = typename ::impl::make_union_from_tuple<::impl::map_types_t<Types...>>::type; using storage_type = typename ::impl::make_union_from_tuple<::impl::mapped_types<Types...>>::type;
uint8_t* size_and_indices_; uint8_t* size_and_indices_;
storage_type* storage_; storage_type* storage_;
@@ -294,7 +294,7 @@ private:
template<std::size_t Index> template<std::size_t Index>
void destroy_type_at_index(std::size_t index, std::integral_constant<std::size_t, Index>) { void destroy_type_at_index(std::size_t index, std::integral_constant<std::size_t, Index>) {
if (size_and_indices_[index + 1] == Index - 1) { if (size_and_indices_[index + 1] == Index - 1) {
using t = typename std::tuple_element_t<Index - 1, ::impl::map_types_t<Types...>>; using t = typename std::tuple_element_t<Index - 1, ::impl::mapped_types<Types...>>;
if constexpr (!std::is_trivially_destructible<t>::value) { if constexpr (!std::is_trivially_destructible<t>::value) {
reinterpret_cast<t*>(&storage_[index])->~t(); reinterpret_cast<t*>(&storage_[index])->~t();
} }
@@ -311,7 +311,7 @@ private:
template<typename Visitor, std::size_t Index> template<typename Visitor, std::size_t Index>
auto apply_visitor_impl(Visitor&& visitor, std::size_t index, std::integral_constant<std::size_t, Index>) const { auto apply_visitor_impl(Visitor&& visitor, std::size_t index, std::integral_constant<std::size_t, Index>) const {
if (size_and_indices_[index + 1] == Index - 1) { if (size_and_indices_[index + 1] == Index - 1) {
using t = typename std::tuple_element_t<Index - 1, ::impl::map_types_t<Types...>>; using t = typename std::tuple_element_t<Index - 1, ::impl::mapped_types<Types...>>;
if constexpr (::impl::is_unique_ptr<t>::value) { if constexpr (::impl::is_unique_ptr<t>::value) {
return visitor(**reinterpret_cast<t*>(&storage_[index])); return visitor(**reinterpret_cast<t*>(&storage_[index]));
} else { } else {
@@ -326,8 +326,8 @@ private:
static_cast<void>(visitor); static_cast<void>(visitor);
static_cast<void>(index); static_cast<void>(index);
throw std::runtime_error("Invalid variant index"); throw std::runtime_error("Invalid variant index");
if constexpr (!std::is_void_v<decltype(std::declval<Visitor>()(std::declval<typename std::tuple_element_t<0, ::impl::map_types_t<Types...>> &>()))>) { if constexpr (!std::is_void_v<decltype(std::declval<Visitor>()(std::declval<typename std::tuple_element_t<0, ::impl::mapped_types<Types...>> &>()))>) {
return decltype(std::declval<Visitor>()(std::declval<typename std::tuple_element_t<0, ::impl::map_types_t<Types...>> &>())){}; return decltype(std::declval<Visitor>()(std::declval<typename std::tuple_element_t<0, ::impl::mapped_types<Types...>> &>())){};
} }
} }
+1 -1
View File
@@ -512,7 +512,7 @@ void GeometryStreamer::run(const std::string& path, int num_threads) {
auto run_iterator = [&](ifcopenshell::geom::settings& iter_settings) -> bool { auto run_iterator = [&](ifcopenshell::geom::settings& iter_settings) -> bool {
if (remaining.empty()) return true; if (remaining.empty()) return true;
std::vector<ifcopenshell::geom::filter_t> filters; std::vector<ifcopenshell::geom::filter_function> filters;
ifcopenshell::geom::instance_id_filter idf{ ifcopenshell::geom::instance_id_filter idf{
/*include=*/true, /*traverse=*/false, remaining}; /*include=*/true, /*traverse=*/false, remaining};
filters.push_back(idf); filters.push_back(idf);
+3 -3
View File
@@ -1228,7 +1228,7 @@ from .entity_instance import entity_instance_mixin
} else { } else {
return pythonize_vector(v); return pythonize_vector(v);
} }
} else if constexpr (std::is_same_v<u, empty_aggregate_t> || std::is_same_v<u, empty_aggregate_of_aggregate_t> || std::is_same_v<u, blank>) { } else if constexpr (std::is_same_v<u, empty_aggregate> || std::is_same_v<u, empty_aggregate_of_aggregate> || std::is_same_v<u, blank>) {
Py_INCREF(Py_None); Py_INCREF(Py_None);
return static_cast<PyObject*>(Py_None); return static_cast<PyObject*>(Py_None);
} else if constexpr (is_std_vector_v<u>) { } else if constexpr (is_std_vector_v<u>) {
@@ -1298,7 +1298,7 @@ from .entity_instance import entity_instance_mixin
Py_INCREF(Py_None); Py_INCREF(Py_None);
return static_cast<PyObject*>(Py_None); return static_cast<PyObject*>(Py_None);
} }
} else if constexpr (std::is_same_v<u, empty_aggregate_t> || std::is_same_v<u, empty_aggregate_of_aggregate_t> || std::is_same_v<u, blank>) { } else if constexpr (std::is_same_v<u, empty_aggregate> || std::is_same_v<u, empty_aggregate_of_aggregate> || std::is_same_v<u, blank>) {
Py_INCREF(Py_None); Py_INCREF(Py_None);
return static_cast<PyObject*>(Py_None); return static_cast<PyObject*>(Py_None);
} else { } else {
@@ -1394,7 +1394,7 @@ from .entity_instance import entity_instance_mixin
Py_INCREF(Py_None); Py_INCREF(Py_None);
attribute_val_py = static_cast<PyObject*>(Py_None); attribute_val_py = static_cast<PyObject*>(Py_None);
} }
} else if constexpr (std::is_same_v<value_type, empty_aggregate_t> || std::is_same_v<value_type, empty_aggregate_of_aggregate_t> || std::is_same_v<value_type, blank>) { } else if constexpr (std::is_same_v<value_type, empty_aggregate> || std::is_same_v<value_type, empty_aggregate_of_aggregate> || std::is_same_v<value_type, blank>) {
Py_INCREF(Py_None); Py_INCREF(Py_None);
attribute_val_py = static_cast<PyObject*>(Py_None); attribute_val_py = static_cast<PyObject*>(Py_None);
} else { } else {
+1 -1
View File
@@ -45,7 +45,7 @@
Py_INCREF(Py_None); Py_INCREF(Py_None);
return static_cast<PyObject*>(Py_None); return static_cast<PyObject*>(Py_None);
} }
} else if constexpr (std::is_same_v<u, empty_aggregate_t> || std::is_same_v<u, empty_aggregate_of_aggregate_t> || std::is_same_v<u, blank>) { } else if constexpr (std::is_same_v<u, empty_aggregate> || std::is_same_v<u, empty_aggregate_of_aggregate> || std::is_same_v<u, blank>) {
Py_INCREF(Py_None); Py_INCREF(Py_None);
return static_cast<PyObject*>(Py_None); return static_cast<PyObject*>(Py_None);
} else { } else {
@@ -40,7 +40,7 @@ class format_value_visitor : public boost::static_visitor<std::string> {
template <typename T> template <typename T>
json operator()(const T& t) const { json operator()(const T& t) const {
if constexpr (std::is_same_v<std::decay_t<T>, ifcopenshell::derived> || std::is_same_v<std::decay_t<T>, boost::dynamic_bitset<>> || std::is_same_v<std::decay_t<T>, express::base> || std::is_same_v<std::decay_t<T>, std::vector<int>> || std::is_same_v<std::decay_t<T>, std::vector<double>> || std::is_same_v<std::decay_t<T>, std::vector<std::string>> || std::is_same_v<std::decay_t<T>, std::vector<boost::dynamic_bitset<>>> || std::is_same_v<std::decay_t<T>, std::vector<express::base>> || std::is_same_v<std::decay_t<T>, std::vector<std::vector<express::base>>> || std::is_same_v<std::decay_t<T>, std::vector<std::vector<int>>> || std::is_same_v<std::decay_t<T>, std::vector<std::vector<double>>> || std::is_same_v<std::decay_t<T>, ifcopenshell::empty_aggregate_t> || std::is_same_v<std::decay_t<T>, ifcopenshell::empty_aggregate_of_aggregate_t> || std::is_same_v<std::decay_t<T>, ifcopenshell::blank>) { if constexpr (std::is_same_v<std::decay_t<T>, ifcopenshell::derived> || std::is_same_v<std::decay_t<T>, boost::dynamic_bitset<>> || std::is_same_v<std::decay_t<T>, express::base> || std::is_same_v<std::decay_t<T>, std::vector<int>> || std::is_same_v<std::decay_t<T>, std::vector<double>> || std::is_same_v<std::decay_t<T>, std::vector<std::string>> || std::is_same_v<std::decay_t<T>, std::vector<boost::dynamic_bitset<>>> || std::is_same_v<std::decay_t<T>, std::vector<express::base>> || std::is_same_v<std::decay_t<T>, std::vector<std::vector<express::base>>> || std::is_same_v<std::decay_t<T>, std::vector<std::vector<int>>> || std::is_same_v<std::decay_t<T>, std::vector<std::vector<double>>> || std::is_same_v<std::decay_t<T>, ifcopenshell::empty_aggregate> || std::is_same_v<std::decay_t<T>, ifcopenshell::empty_aggregate_of_aggregate> || std::is_same_v<std::decay_t<T>, ifcopenshell::blank>) {
return ""; return "";
} else if constexpr (std::is_same_v<std::decay_t<T>, boost::logic::tribool>) { } else if constexpr (std::is_same_v<std::decay_t<T>, boost::logic::tribool>) {
// @todo handle indeterminate // @todo handle indeterminate
+3 -3
View File
@@ -1627,7 +1627,7 @@ void svg_serializer::write(const geometry_data& data) {
if (storey) { if (storey) {
auto it = storey_hlr.find(storey); auto it = storey_hlr.find(storey);
if (it == storey_hlr.end()) { if (it == storey_hlr.end()) {
it = storey_hlr.insert({ storey, hlr_t(logger(), use_prefiltering_, use_hlr_poly_, segment_projection_, projection_plane) }).first; it = storey_hlr.insert({ storey, hlr_engine(logger(), use_prefiltering_, use_hlr_poly_, segment_projection_, projection_plane) }).first;
} }
it->second.add(*compound_to_hlr, data.product); it->second.add(*compound_to_hlr, data.product);
for (auto& kv : classified_edge_buckets) { for (auto& kv : classified_edge_buckets) {
@@ -2188,7 +2188,7 @@ std::array<std::array<double, 3>, 3> svg_serializer::resize() {
} }
void svg_serializer::draw_hlr(const gp_Pln& pln, const drawing_key& drawing_name) { void svg_serializer::draw_hlr(const gp_Pln& pln, const drawing_key& drawing_name) {
hlr_t& hlr_source = drawing_name.first ? this->storey_hlr.find(drawing_name.first)->second : *hlr; hlr_engine& hlr_source = drawing_name.first ? this->storey_hlr.find(drawing_name.first)->second : *hlr;
auto hlr_items = hlr_source.build(); auto hlr_items = hlr_source.build();
// SVG edge classification (issue #3668): each item's class is already known -- it was // SVG edge classification (issue #3668): each item's class is already known -- it was
@@ -2518,7 +2518,7 @@ void svg_serializer::finalize() {
// @todo do we have always have pln here? // @todo do we have always have pln here?
if (use_hlr && pln) { if (use_hlr && pln) {
hlr = new hlr_t(logger(), use_prefiltering_, use_hlr_poly_, segment_projection_, *pln); hlr = new hlr_engine(logger(), use_prefiltering_, use_hlr_poly_, segment_projection_, *pln);
} }
section_data_ = std::vector<section_data>{ sd }; section_data_ = std::vector<section_data>{ sd };
+3 -3
View File
@@ -552,7 +552,7 @@ namespace {
}; };
} }
typedef prefiltered_hlr hlr_t; typedef prefiltered_hlr hlr_engine;
class SERIALIZERS_API svg_serializer : public ifcopenshell::geom::write_only_geometry_serializer { class SERIALIZERS_API svg_serializer : public ifcopenshell::geom::write_only_geometry_serializer {
public: public:
@@ -602,7 +602,7 @@ protected:
express::base storey_; express::base storey_;
std::multimap<drawing_key, path_object, storey_sorter> paths; std::multimap<drawing_key, path_object, storey_sorter> paths;
std::map<drawing_key, drawing_meta> drawing_metadata; std::map<drawing_key, drawing_meta> drawing_metadata;
std::map<express::base, hlr_t> storey_hlr; std::map<express::base, hlr_engine> storey_hlr;
float_item_list xcoords, ycoords, radii; float_item_list xcoords, ycoords, radii;
size_t xcoords_begin, ycoords_begin, radii_begin; size_t xcoords_begin, ycoords_begin, radii_begin;
@@ -611,7 +611,7 @@ protected:
std::list<geometry_data> element_buffer_; std::list<geometry_data> element_buffer_;
hlr_t* hlr; hlr_engine* hlr;
std::string namespace_prefix_; std::string namespace_prefix_;