diff --git a/src/examples/IfcAdvancedHouse.cpp b/src/examples/IfcAdvancedHouse.cpp index 20aae0fc7c..2eef11fb4e 100644 --- a/src/examples/IfcAdvancedHouse.cpp +++ b/src/examples/IfcAdvancedHouse.cpp @@ -76,12 +76,12 @@ int main() { // By adding a building, a hierarchy has been automatically created that consists of the following // structure: IfcProject > IfcSite > IfcBuilding - // Lateron changing the name of the IfcProject can be done by obtaining a reference to the + // Lateron changing the name of the IfcProject can be done by obtaining a reference to the // project, which has been created automatically. file.getSingle().setName("IfcAdvancedHouse"s); // To demonstrate the ability to serialize arbitrary opencascade solids a building envelope is - // constructed by applying boolean operations. Naturally, in IFC, building elements should be + // constructed by applying boolean operations. Naturally, in IFC, building elements should be // modeled separately, with rich parametric and relational semantics. Creating geometry in this // way does not preserve any history and is merely a demonstration of technical capabilities. TopoDS_Shape outer = BRepPrimAPI_MakeBox(gp_Pnt(-5000., -180., -2000.), gp_Pnt(5000., 5180., 3000.)).Shape(); @@ -102,7 +102,7 @@ int main() { // to the IFC4 model and with `advanced` set to `true` which introduces IfcAdvancedFace. It would // return `0` otherwise. auto building_shape = ifcopenshell::geom::serialise(file, building_shell, false).as(); - + file.add_entity(building_shape); auto building_representations = building_shape.Representations(); building_representations.front().setContextOfItems(file.getRepresentationContext("model")); @@ -122,7 +122,7 @@ int main() { ground_representation = ifcopenshell::geom::tesselate(file, shape, 100.); } file.getSingle().setRepresentation(ground_representation.as()); - + auto ground_reps = file.getSingle().Representation().Representations(); for (auto& rep : ground_reps) { rep.setContextOfItems(file.getRepresentationContext("Model")); @@ -175,10 +175,10 @@ void createGroundShape(TopoDS_Shape& shape) { cv.SetValue(4, 4, gp_Pnt( 10000, 10000, -8130)); TColStd_Array1OfReal knots(0, 1); knots(0) = 0; - knots(1) = 1; + knots(1) = 1; TColStd_Array1OfInteger mult(0, 1); mult(0) = 5; - mult(1) = 5; + mult(1) = 5; Handle(Geom_BSplineSurface) surf = new Geom_BSplineSurface(cv, knots, knots, mult, mult, 4, 4); #if OCC_VERSION_HEX < 0x60502 shape = BRepBuilderAPI_MakeFace(surf); diff --git a/src/examples/IfcAlignment.cpp b/src/examples/IfcAlignment.cpp index a8b91607a0..f2c705dd56 100644 --- a/src/examples/IfcAlignment.cpp +++ b/src/examples/IfcAlignment.cpp @@ -70,7 +70,7 @@ Schema::IfcProject setup_project(hierarchy_helper& file) { dimensions.setThermodynamicTemperatureExponent(0); dimensions.setAmountOfSubstanceExponent(0); dimensions.setLuminousIntensityExponent(0); - + auto conversion_factor = file.create(); auto length = file.create(); length.set_attribute_value(0, 304.80); @@ -82,7 +82,7 @@ Schema::IfcProject setup_project(hierarchy_helper& file) { conversion_based_unit.setUnitType(Schema::IfcUnitEnum::IfcUnit_LENGTHUNIT); conversion_based_unit.setName("FEET"); conversion_based_unit.setConversionFactor(conversion_factor); - + units.erase(std::remove(units.begin(), units.end(), unit)); // remove the millimeter unit units.push_back(conversion_based_unit); // add the feet unit units_in_context.setUnits(units); // update the UnitsInContext @@ -386,7 +386,7 @@ int main() { nests_horizontal_segments.setName("Nests horizontal alignment segments with horizontal alignment"); nests_horizontal_segments.setRelatingObject(horizontal_alignment); nests_horizontal_segments.setRelatedObjects(horizontal_segments); - + // // Create plan view footprint model representation for the horizontal alignment // @@ -403,7 +403,7 @@ int main() { footprint_shape_representation.setRepresentationType("Curve2D"); // the composite curve is a representation item footprint_shape_representation.setItems({composite_curve}); - + // // Define vertical profile segments // @@ -539,7 +539,7 @@ int main() { nests_alignment_layouts.setName("Nest horizontal and vertical alignment layouts with the alignment"); nests_alignment_layouts.setRelatingObject(alignment); nests_alignment_layouts.setRelatedObjects({horizontal_alignment, vertical_profile}); - + // Define the relationship with the project // IFC 4.1.4.1.1 "Every IfcAlignment must be related to IfcProject using the IfcRelAggregates relationship" @@ -550,7 +550,7 @@ int main() { aggregate_alignments_with_project.setName("Alignments in project"); aggregate_alignments_with_project.setRelatingObject(project); aggregate_alignments_with_project.setRelatedObjects({alignment}); - + // Define the spatial structure of the alignment with respect to the site // IFC 4.1.5.1 alignment is referenced in spatial structure of an IfcSpatialElement. In this case IfcSite is the highest level IfcSpatialElement diff --git a/src/examples/IfcOpenHouse.cpp b/src/examples/IfcOpenHouse.cpp index 358fb9abef..89d437d5de 100644 --- a/src/examples/IfcOpenHouse.cpp +++ b/src/examples/IfcOpenHouse.cpp @@ -55,7 +55,7 @@ using namespace std::string_literals; -// Some convenience typedefs and definitions. +// Some convenience typedefs and definitions. typedef ifcopenshell::global_id guid; typedef std::pair XY; #ifdef SCHEMA_HAS_IfcPresentationStyleAssignment @@ -295,9 +295,9 @@ int main() { west_void.setOwnerHistory(file.getSingle()); west_void.setRelatingBuildingElement(west_wall); west_void.setRelatedOpeningElement(west_opening_copy); - - // Up until now we have only used simple extrusions for the creation of the geometry. For the - // ground mesh of the IfcSite we will use a Nurbs surface created in Open Cascade. The surface + + // Up until now we have only used simple extrusions for the creation of the geometry. For the + // ground mesh of the IfcSite we will use a Nurbs surface created in Open Cascade. The surface // will be tessellated using the deflection specified. TopoDS_Shape shape; createGroundShape(shape); @@ -325,7 +325,7 @@ int main() { site_prop.setOwnerHistory(file.getSingle()); site_prop.setRelatedObjects({file.getSingle()}); site_prop.setRelatingPropertyDefinition(pset); - + auto ground_reps = file.getSingle().Representation().Representations(); for (auto& rep : ground_reps) { rep.setContextOfItems(file.getRepresentationContext("Model")); @@ -334,11 +334,11 @@ int main() { setSurfaceColour(file,ground_representation, 0.15, 0.25, 0.05); // According to the Ifc2x3 schema an IfcWallStandardCase needs to have an IfcMaterialLayerSet - // assigned. Note that this material definition is independent of the surface styles we have - // been assigning to the walls already. The surface styles determine the colour in the + // assigned. Note that this material definition is independent of the surface styles we have + // been assigning to the walls already. The surface styles determine the colour in the // '3D viewport' of most applications. // Some BIM authoring applications, such as Autodesk Revit, ignore the geometrical representation - // by and large and construct native walls using the layer thickness and reference line offset + // by and large and construct native walls using the layer thickness and reference line offset // provided here. auto material = file.create(); material.setName("Brick"); @@ -422,7 +422,7 @@ int main() { #endif door.setRepresentation(file.addBox(80, 80, 2120, IfcSchema::IfcAxis2Placement2D{}, file.addPlacement3d(460, 0, 0))); - + auto door_representations = door.Representation().Representations(); IfcSchema::IfcShapeRepresentation door_body; for (auto& rep : door_representations) { @@ -465,9 +465,9 @@ int main() { #endif // Surface styles are assigned to representation items, hence there is no real limitation to - // assign different colours within the same representation. However, some viewers have - // difficulties rendering products with representation items with different surface styles. - // Therefore we will construct the window as a decomposition of beams and a plate, in which + // assign different colours within the same representation. However, some viewers have + // difficulties rendering products with representation items with different surface styles. + // Therefore we will construct the window as a decomposition of beams and a plate, in which // only the plate will have a transparent material assigned. // The window frame will consists of four separate beams. @@ -476,7 +476,7 @@ int main() { // match the bounding box of the representation. Furthermore, the window placement needs // to align with the lowerleft corner of the constituent parts. std::vector frame_representations; - + auto horizontal_bar = file.addEmptyRepresentation(); auto vertical_bar = file.addEmptyRepresentation(); file.addBox(horizontal_bar, 1860, 90, 90); @@ -498,7 +498,7 @@ int main() { // Because of the duplication the iterator is incremented twice } - // This window will be placed at five locations within the building. A list of placements is + // This window will be placed at five locations within the building. A list of placements is // created and is iterated over to create all window instances. std::vector window_placements; window_placements.push_back(file.addLocalPlacement(storey_placement, 2*-1770-430-930, -45, 400)); @@ -506,7 +506,7 @@ int main() { window_placements.push_back(file.addLocalPlacement(storey_placement, -430-930, -45, 400)); window_placements.push_back(file.addLocalPlacement(storey_placement, 3000-930, -45, 400)); window_placements.push_back(file.addLocalPlacement(storey_placement, -4855+45, 885-930, 400, 0, 0, 1, 0, 1, 0)); - + for (auto& place : window_placements) { // Create the window at the current location @@ -520,7 +520,7 @@ int main() { window.setPredefinedType(IfcSchema::IfcWindowTypeEnum::IfcWindowType_WINDOW); window.setPartitioningType(IfcSchema::IfcWindowTypePartitioningEnum::IfcWindowTypePartitioning_SINGLE_PANEL); #endif - file.addBuildingProduct(window); + file.addBuildingProduct(window); // Initialize a list of parts for the window to be composed of std::vector window_parts; @@ -532,7 +532,7 @@ int main() { frame_placements.push_back(file.addLocalPlacement(storey_placement, 930, 45, 1510)); frame_placements.push_back(file.addLocalPlacement(storey_placement, -885+930, 45, 90)); frame_placements.push_back(file.addLocalPlacement(storey_placement, 885+930, 45, 90)); - + // Now iterate over the placements and representations of the beam and add them to list of parts std::vector::const_iterator frame_placement; std::vector::const_iterator frame_representation; @@ -565,7 +565,7 @@ int main() { window_parts.push_back(glass_part); file.relatePlacements(window, glass_part); setSurfaceColour(file, glass_part.Representation(), 0.6, 0.7, 0.75, 0.1); - + // Now create a decomposition relation between the window and the parts. Most viewers and authoring // tools will consider the window a single entity that can be selected as a whole. { @@ -612,10 +612,10 @@ void createGroundShape(TopoDS_Shape& shape) { cv.SetValue(4, 4, gp_Pnt( 10000, 10000, -8130)); TColStd_Array1OfReal knots(0, 1); knots(0) = 0; - knots(1) = 1; + knots(1) = 1; TColStd_Array1OfInteger mult(0, 1); mult(0) = 5; - mult(1) = 5; + mult(1) = 5; Handle(Geom_BSplineSurface) surf = new Geom_BSplineSurface(cv, knots, knots, mult, mult, 4, 4); #if OCC_VERSION_HEX < 0x60502 shape = BRepBuilderAPI_MakeFace(surf); diff --git a/src/examples/IfcParseExamples.cpp b/src/examples/IfcParseExamples.cpp index 197b48e5e3..c02d51e511 100644 --- a/src/examples/IfcParseExamples.cpp +++ b/src/examples/IfcParseExamples.cpp @@ -30,7 +30,7 @@ #include INCLUDE_SCHEMA(ifcparse/schemas, IfcSchema) #include INCLUDE_SCHEMA_DEFINITIONS(ifcparse/schemas, IfcSchema) -#ifdef _MSC_VER +#ifdef _MSC_VER #define strcasecmp _stricmp #endif @@ -151,7 +151,7 @@ void process_pset(element_properties& props, const T& inst) { template void get_psets_s(element_properties& props, const typename Schema::IfcObjectDefinition& inst) { - // Extracts the property definitions for an IFC instance. + // Extracts the property definitions for an IFC instance. if (auto tyob = inst.template as()) { if (tyob.HasPropertySets()) { auto defs = *tyob.HasPropertySets(); diff --git a/src/ifcconvert/IfcConvert.cpp b/src/ifcconvert/IfcConvert.cpp index 6155bc4c43..4cf0f9e8b3 100644 --- a/src/ifcconvert/IfcConvert.cpp +++ b/src/ifcconvert/IfcConvert.cpp @@ -336,7 +336,7 @@ int main(int argc, char** argv) { std::string exterior_only_algo; ifcopenshell::geom::settings settings; - + po::options_description geom_options("Geometry options"); geom_options.add_options() ("kernel", po::value(&geometry_kernel)->default_value(default_kernel), @@ -389,7 +389,7 @@ int main(int argc, char** argv) { ("model", "Specifies whether to include surfaces and solids in the output result. " "Typically these are representations of type Body or Facetation. ") ; - + settings.define_options(geom_options); std::string bounds; @@ -466,7 +466,7 @@ int main(int argc, char** argv) { num_threads = std::thread::hardware_concurrency(); logger.notice("SYS", 7, "Using " + std::to_string(num_threads) + " threads"); } - + if (vmap.count("log-format") == 1) { boost::to_lower(log_format); if (log_format == "plain") { @@ -479,7 +479,7 @@ int main(int argc, char** argv) { return EXIT_FAILURE; } } - + if (!filter_filename.empty()) { size_t num_filters = read_filters_from_file(ifcopenshell::path::to_utf8(filter_filename), include_filter, include_traverse_filter, exclude_filter, exclude_traverse_filter); if (num_filters) { @@ -524,10 +524,10 @@ int main(int argc, char** argv) { // If no output filename is specified a Wavefront OBJ file will be output // to maintain backwards compatibility with the obsolete IfcObj executable. - const path_t output_filename = vmap.count("output-file") == 1 + const path_t output_filename = vmap.count("output-file") == 1 ? vmap["output-file"].as() : change_extension(input_filename, ifcopenshell::path::from_utf8(DEFAULT_EXTENSION)); - + if (output_filename.size() < 5) { cerr_ << "[error] Invalid or unsupported output file '" << output_filename << "' given" << std::endl; print_usage(); @@ -572,13 +572,13 @@ int main(int argc, char** argv) { } path_t output_temp_filename = output_filename + ifcopenshell::path::from_utf8(TEMP_FILE_EXTENSION); - + std::vector tokens; split(tokens, output_filename, boost::is_any_of(".")); std::vector::iterator tok_iter; path_t ext = *(tokens.end() - 1); path_t dot; - dot = '.'; + dot = '.'; path_t output_extension = dot + ext; boost::to_lower(output_extension); @@ -785,7 +785,7 @@ int main(int argc, char** argv) { time_t start,end; time(&start); - + // @nb last argument true -> bypass_properties which are not read by any of the geometry serializers // Document serializers and IFC are already special-cased above // SVG requires properties for IfcAnnotation/DRAWING properties @@ -839,12 +839,12 @@ int main(int argc, char** argv) { settings.get().value = offset; } - + if (is_tesselated && (center_model || center_model_geometry)) { std::vector offset(3); ifcopenshell::geom::iterator tmp_context_iterator(ifcopenshell::geom::kernels::construct(ifc_file, geometry_kernel, settings, logger), settings, ifc_file, filter_funcs, num_threads, logger); - + time_t bounds_start, bounds_end; time(&bounds_start); if (!quiet) logger.status("Computing bounds..."); @@ -860,7 +860,7 @@ int main(int argc, char** argv) { return EXIT_FAILURE; } } - + tmp_context_iterator.compute_bounds(center_model_geometry); time(&bounds_end); @@ -919,19 +919,19 @@ int main(int argc, char** argv) { } // The functions ifcopenshell::geom::iterator::get() and ifcopenshell::geom::iterator::next() - // wrap an iterator of all geometrical products in the Ifc file. + // wrap an iterator of all geometrical products in the Ifc file. // ifcopenshell::geom::iterator::get() returns an ifcopenshell::geom::triangulation_element or // -native_element pointer, based on current settings. (see iterator.h // for definition) ifcopenshell::geom::iterator::next() is used to poll whether more - // geometrical entities are available. None of these functions throw - // exceptions, neither for parsing errors or geometrical errors. Upon - // calling next() the entity to be returned has already been processed, a - // non-null return value guarantees that a successfully processed product is - // available. + // geometrical entities are available. None of these functions throw + // exceptions, neither for parsing errors or geometrical errors. Upon + // calling next() the entity to be returned has already been processed, a + // non-null return value guarantees that a successfully processed product is + // available. size_t num_created = 0; while (true) { - + auto geom_object = context_iterator->get(); if (is_tesselated) @@ -967,7 +967,7 @@ int main(int argc, char** argv) { if (!context_iterator->next()) { break; } - } + } if (!no_progress && quiet) { for (; old_progress < 100; ++old_progress) { cout_ << "."; @@ -1086,7 +1086,7 @@ bool init_input_file(const std::string& filename, ifcopenshell::file*& ifc_file, ifc_file->bypass_type("IfcProfileProperties"); ifc_file->bypass_type("IfcPhysicalQuantity"); } - + #ifdef USE_MMAP if (mmap) { ifc_file->initialize(filename, mmap); @@ -1382,20 +1382,20 @@ void fix_quantities(ifcopenshell::file& f, bool no_progress, bool quiet, bool st auto person = latebound_access::create(f, "IfcPerson"); latebound_access::set(person, "FamilyName", std::string("IfcOpenShell")); latebound_access::set(person, "GivenName", std::string("IfcOpenShell")); - + auto org = latebound_access::create(f, "IfcOrganization"); latebound_access::set(org, "Name", std::string("IfcOpenShell")); - + auto pando = latebound_access::create(f, "IfcPersonAndOrganization"); latebound_access::set(pando, "ThePerson", person); latebound_access::set(pando, "TheOrganization", org); - + auto application = latebound_access::create(f, "IfcApplication"); latebound_access::set(application, "ApplicationDeveloper", org); latebound_access::set(application, "Version", std::string(IFCOPENSHELL_VERSION)); latebound_access::set(application, "ApplicationFullName", std::string("IfcConvert")); latebound_access::set(application, "ApplicationIdentifier", std::string("IfcConvert") + IFCOPENSHELL_VERSION); - + auto ownerhist = latebound_access::create(f, "IfcOwnerHistory"); latebound_access::set(ownerhist, "OwningUser", pando); latebound_access::set(ownerhist, "OwningApplication", application); @@ -1440,7 +1440,7 @@ void fix_quantities(ifcopenshell::file& f, bool no_progress, bool quiet, bool st latebound_access::set(quantity_area, "AreaValue", a); quantities.push_back(quantity_area); } - + if (geom_object->geometry().calculate_volume(a)) { auto quantity_volume = latebound_access::create(f, "IfcQuantityVolume"); latebound_access::set(quantity_volume, "Name", std::string("Volume")); @@ -1461,13 +1461,13 @@ void fix_quantities(ifcopenshell::file& f, bool no_progress, bool quiet, bool st std::vector quantities_2; - for (auto& part : geom_object->geometry()) { + for (auto& part : geom_object->geometry()) { auto quantity_count = latebound_access::create(f, "IfcQuantityCount"); latebound_access::set(quantity_count, "Name", std::string("Surface Genus")); latebound_access::set(quantity_count, "Description", '#' + boost::lexical_cast(part.ItemId())); latebound_access::set(quantity_count, "CountValue", (int64_t) part.shape()->surface_genus()); - quantities_2.push_back(quantity_count); + quantities_2.push_back(quantity_count); } latebound_access::set(quantity_complex, "HasQuantities", quantities_2); diff --git a/src/ifcconvert/validate_storey_containment.cpp b/src/ifcconvert/validate_storey_containment.cpp index f4bf0781c1..7efacc59ef 100644 --- a/src/ifcconvert/validate_storey_containment.cpp +++ b/src/ifcconvert/validate_storey_containment.cpp @@ -41,7 +41,7 @@ void fix_storeycontainment(ifcopenshell::file& f, bool no_progress, bool quiet, elem_to_storey[*it] = storey; } } - }); + }); auto storeys = f.instances_by_type("IfcBuildingStorey"); std::vector storeys_sorted(storeys->begin(), storeys->end()); @@ -98,7 +98,7 @@ void fix_storeycontainment(ifcopenshell::file& f, bool no_progress, bool quiet, std::wcout << "---" << std::endl; } */ - + if (!context_iterator.initialize()) { return; } diff --git a/src/ifcconvert/validate_wall_connectivity.cpp b/src/ifcconvert/validate_wall_connectivity.cpp index 8777349934..1a31f1da89 100644 --- a/src/ifcconvert/validate_wall_connectivity.cpp +++ b/src/ifcconvert/validate_wall_connectivity.cpp @@ -22,7 +22,7 @@ void fix_wallconnectivity(ifcopenshell::file& f, bool no_progress, bool quiet, b settings.get().value = true; settings.get().value = ifcopenshell::geom::settings::CURVES; - + ifcopenshell::geom::converter c(ifcopenshell::geom::kernels::construct(&f, "cgal", settings, logger), &f, settings, logger); auto rels = f.instances_by_type("IfcRelConnectsPathElements"); @@ -54,7 +54,7 @@ void fix_wallconnectivity(ifcopenshell::file& f, bool no_progress, bool quiet, b if (!a_is_relating) { std::swap(a_type, b_type); } - } + } #if 0 auto a_poly = ifcopenshell::geom::utils::create_polyhedron(a.handle()->second); @@ -123,7 +123,7 @@ void fix_wallconnectivity(ifcopenshell::file& f, bool no_progress, bool quiet, b } else { auto p0 = boost::get(first_vertex); auto p1 = boost::get(last_vertex); - + auto v0 = taxonomy::cast(item)->matrix->ccomponents() * p0->ccomponents().homogeneous(); auto v1 = taxonomy::cast(item)->matrix->ccomponents() * p1->ccomponents().homogeneous(); @@ -142,7 +142,7 @@ void fix_wallconnectivity(ifcopenshell::file& f, bool no_progress, bool quiet, b auto pit = std::minmax_element(parameters.begin(), parameters.end()); return std::make_pair(len, std::make_pair(CGAL::to_double(*pit.first), CGAL::to_double(*pit.second))); - } + } } const auto& nan = std::numeric_limits::quiet_NaN(); return std::make_pair(nan, std::make_pair(nan, nan)); diff --git a/src/ifcgeom/abstract_kernel.h b/src/ifcgeom/abstract_kernel.h index db6c88122a..7aad6d425a 100644 --- a/src/ifcgeom/abstract_kernel.h +++ b/src/ifcgeom/abstract_kernel.h @@ -37,7 +37,7 @@ inline static bool ALMOST_THE_SAME(const T& a, const T& b, double tolerance = AL return fabs(a - b) < tolerance; } -namespace ifcopenshell { +namespace ifcopenshell { #if defined(_MSC_VER) #pragma warning(push) @@ -70,7 +70,7 @@ namespace ifcopenshell { public: bool propagate_exceptions = false; bool partial_success_is_success = true; - + abstract_kernel(const std::string& geometry_library, const ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger = ifcopenshell::logger::root()) : geometry_library_(geometry_library) , settings_(settings) diff --git a/src/ifcgeom/abstract_mapping.h b/src/ifcgeom/abstract_mapping.h index 69b13dff8d..f3f0cc0975 100644 --- a/src/ifcgeom/abstract_mapping.h +++ b/src/ifcgeom/abstract_mapping.h @@ -44,7 +44,7 @@ namespace geom { /// 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 typedef std::function filter_function; - + class IFC_GEOM_API abstract_mapping { protected: ifcopenshell::geom::settings settings_; @@ -106,7 +106,7 @@ namespace geom { IFC_GEOM_API mapping_factory_implementation& mapping_implementations(); } - + } } diff --git a/src/ifcgeom/conversion_result.h b/src/ifcgeom/conversion_result.h index 0c995eb796..a6eb7c1e61 100644 --- a/src/ifcgeom/conversion_result.h +++ b/src/ifcgeom/conversion_result.h @@ -510,20 +510,20 @@ namespace ifcopenshell::geom { virtual void triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const = 0; ifcopenshell::geom::triangulation* triangulate(const ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const; virtual void serialize(const ifcopenshell::geom::taxonomy::matrix4& place, std::string&) const = 0; - + virtual int surface_genus() const = 0; virtual bool is_manifold() const = 0; - + virtual int num_vertices() const = 0; virtual int num_edges() const = 0; virtual int num_faces() const = 0; - + // @todo choose one prototype virtual double bounding_box(void*&) const = 0; // @todo this must be something with a virtual dtor so that we can delete it. virtual std::pair, opaque_coordinate<3>> bounding_box() const = 0; virtual void set_box(void* b) = 0; - + virtual opaque_number length() = 0; virtual opaque_number area() = 0; virtual opaque_number volume() = 0; @@ -550,11 +550,11 @@ namespace ifcopenshell::geom { virtual std::size_t map(opaque_coordinate<4>& from, opaque_coordinate<4>& to) = 0; virtual std::size_t map(const std::vector>& from, const std::vector>& to) = 0; virtual conversion_result_shape* moved(ifcopenshell::geom::taxonomy::matrix4::ptr) const = 0; - + virtual bool surface_area_along_direction(double tol, const ifcopenshell::geom::taxonomy::matrix4::ptr&, double& along_x, double& along_y, double& along_z) const = 0; virtual ~conversion_result_shape() {} - + }; class IFC_GEOM_API conversion_result { diff --git a/src/ifcgeom/conversion_settings.h b/src/ifcgeom/conversion_settings.h index 834e796f81..e416c5528f 100644 --- a/src/ifcgeom/conversion_settings.h +++ b/src/ifcgeom/conversion_settings.h @@ -498,7 +498,7 @@ namespace ifcopenshell { static constexpr const char* const description = "Slight variation of --model-offset where large offsets are applied by negating existing large offsets to retain maximum precision. Requires --no-parallel-mapping."; }; } - + namespace impl { template struct readable_name { diff --git a/src/ifcgeom/converter.cpp b/src/ifcgeom/converter.cpp index ad2ec5e2ca..eaa26a5596 100644 --- a/src/ifcgeom/converter.cpp +++ b/src/ifcgeom/converter.cpp @@ -19,7 +19,7 @@ ifcopenshell::geom::converter::~converter() { ifcopenshell::geom::native_element* ifcopenshell::geom::converter::create_brep_for_representation_and_product(taxonomy::ptr representation_node, const express::base product_, const taxonomy::matrix4::ptr& place_) { auto product = product_.as(); - + std::stringstream representation_id_builder; auto place = place_; @@ -32,7 +32,7 @@ ifcopenshell::geom::native_element* ifcopenshell::geom::converter::create_brep_f if (!kernel_->convert(representation_node, shapes)) { return 0; } - + if (settings_.get().get()) { ifcopenshell::geom::layerset_information layerinfo; std::vector neighbours; @@ -55,7 +55,7 @@ ifcopenshell::geom::native_element* ifcopenshell::geom::converter::create_brep_f /* if (util::flatten_shape_list(shapes, merge, false, getValue(GV_PRECISION))) { if (util::count(merge, TopAbs_FACE) > 0) { - + if (convert_layerset(product, layers, styles, thickness)) { IfcSchema::IfcRelAssociates::list::ptr associations = product->HasAssociations(); diff --git a/src/ifcgeom/converter.h b/src/ifcgeom/converter.h index 73d184f8a6..2540bb611b 100644 --- a/src/ifcgeom/converter.h +++ b/src/ifcgeom/converter.h @@ -27,7 +27,7 @@ namespace ifcopenshell { namespace geom { ifcopenshell::geom::kernels::abstract_kernel* kernel() { return &*kernel_; } converter(std::unique_ptr&& geometry_library, ifcopenshell::file* file, ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger = ifcopenshell::logger::root()); - + ~converter(); ifcopenshell::geom::abstract_mapping* mapping() const { return mapping_; } diff --git a/src/ifcgeom/element.h b/src/ifcgeom/element.h index 5fef276d99..fe69886e1c 100644 --- a/src/ifcgeom/element.h +++ b/src/ifcgeom/element.h @@ -53,7 +53,7 @@ namespace ifcopenshell::geom { } } const ifcopenshell::geom::taxonomy::matrix4::ptr& data() const { - if (matrix_orig_units_) { + if (matrix_orig_units_) { return matrix_orig_units_; } if (matrix_) { @@ -131,7 +131,7 @@ namespace ifcopenshell::geom { const std::string& guid, const std::string& context, const ifcopenshell::geom::taxonomy::matrix4::ptr& trsf, const express::entity& product) : _id(id), _parent_id(parent_id), _name(name), _type(type), _guid(guid), _context(context), _transformation(settings, trsf) , product_(product) - { + { std::ostringstream oss; if (type == "IfcProject") { diff --git a/src/ifcgeom/empty.h b/src/ifcgeom/empty.h index 85b3761c34..3a18136326 100644 --- a/src/ifcgeom/empty.h +++ b/src/ifcgeom/empty.h @@ -1,2 +1,2 @@ // A purposely empty file so that the unrolled loop -// can overflow into an existing empty include file. \ No newline at end of file +// can overflow into an existing empty include file. diff --git a/src/ifcgeom/function_item_evaluator.cpp b/src/ifcgeom/function_item_evaluator.cpp index 9d4dc4935a..6bb93f219f 100644 --- a/src/ifcgeom/function_item_evaluator.cpp +++ b/src/ifcgeom/function_item_evaluator.cpp @@ -135,7 +135,7 @@ struct cant_fn_evaluator : public fn_evaluator { auto g = gradient_evaluator_.evaluate(u); auto c = cant_evaluator_.evaluate(u); - + // curvature is stored in row 3 - capture it and remove it from the xy and uz matrices // so the matrix operations (ie multiplication) works correctly auto gradient_curvature = g.row(3); diff --git a/src/ifcgeom/function_item_evaluator.h b/src/ifcgeom/function_item_evaluator.h index 902539e105..c468f2ec54 100644 --- a/src/ifcgeom/function_item_evaluator.h +++ b/src/ifcgeom/function_item_evaluator.h @@ -13,8 +13,8 @@ IFC_GEOM_API std::vector helmert_curve_point(double A0, double A1, doubl /// This is intended to be used from python side. Polylines are mapped to a loop, but when /// representing an alignment they need to be a function_item so the can be evaluated by function_item_evaluator. /// On the C++ side, the dcast operator take care of this, but dcast is not accessible on the python side. -/// @param loop -/// @return +/// @param loop +/// @return inline taxonomy::function_item::ptr convert_loop_to_function_item(taxonomy::loop::ptr loop) { return ifcopenshell::geom::taxonomy::dcast(loop); } diff --git a/src/ifcgeom/infra_sweep_helper.cpp b/src/ifcgeom/infra_sweep_helper.cpp index babdd89dff..3c65dd3d60 100644 --- a/src/ifcgeom/infra_sweep_helper.cpp +++ b/src/ifcgeom/infra_sweep_helper.cpp @@ -78,7 +78,7 @@ taxonomy::loft::ptr ifcopenshell::geom::make_loft(const ifcopenshell::geom::sett while (dist_along > *(profile_index + 1)) { profile_index++; if (profile_index == longitudes.end()) { - // @todo handle this? + // @todo handle this? } } @@ -158,7 +158,7 @@ taxonomy::loft::ptr ifcopenshell::geom::make_loft(const ifcopenshell::geom::sett } interpolated->matrix->components() = lerp(m4a, m4b, relative_dist_along); } - + auto interpolated_offset = lerp(offset_a, offset_b, relative_dist_along); if (rotation_a == rotation_b && rotation_a) { // @todo we don't support an overridden rotation on only one of the placements @@ -215,7 +215,7 @@ taxonomy::loft::ptr ifcopenshell::geom::make_loft(const ifcopenshell::geom::sett std::vector points; std::vector> tags; std::vector::const_iterator tag_it; - + if (!loop->closed.value_or(false)) { points = {std::get(loop->children[0]->start)}; if (input_tags) { @@ -352,7 +352,7 @@ taxonomy::loft::ptr ifcopenshell::geom::make_loft(const ifcopenshell::geom::sett for (auto& x : tags_for_this_point_on_subsequent_profile) { points.push_back(taxonomy::make(p3)); common_tags_vec.push_back(x); - } + } } } else { for (auto tmp__ : boost::combine(w1_points, w2_points)) { diff --git a/src/ifcgeom/infra_sweep_helper.h b/src/ifcgeom/infra_sweep_helper.h index 0bdecd54b3..cb0c06ac39 100644 --- a/src/ifcgeom/infra_sweep_helper.h +++ b/src/ifcgeom/infra_sweep_helper.h @@ -9,7 +9,7 @@ namespace ifcopenshell { namespace geom { - + struct IFC_GEOM_API cross_section { double dist_along; taxonomy::geom_item::ptr section_geometry; diff --git a/src/ifcgeom/iterator.cpp b/src/ifcgeom/iterator.cpp index 882d30db52..0f12329d35 100644 --- a/src/ifcgeom/iterator.cpp +++ b/src/ifcgeom/iterator.cpp @@ -624,7 +624,7 @@ std::unique_ptr ifcopenshell::geom::iterator::get() hasParent = false; } } - + // Add the previously found parent to the vector hasParent = hasParent && parent_object->parent_id() != -1; } @@ -688,13 +688,13 @@ express::base ifcopenshell::geom::iterator::create() { } ifcopenshell::geom::taxonomy::direction3::ptr ifcopenshell::geom::iterator::remove_offset_() { - + using namespace ifcopenshell::geom::taxonomy; - + if (!settings_.get().has()) { return nullptr; } - + if (!settings_.get().get()) { throw std::runtime_error("remove_offset() can only be called with defer-processing-first-element and no-parallel-mapping settings"); } diff --git a/src/ifcgeom/iterator.h b/src/ifcgeom/iterator.h index 0dd99f5ec0..a9dec29ce9 100644 --- a/src/ifcgeom/iterator.h +++ b/src/ifcgeom/iterator.h @@ -128,7 +128,7 @@ namespace ifcopenshell::geom { bool task_result_ptr_initialized = false; bool task_result_ptr_exhausted = false; size_t async_elements_returned_ = 0; - + ifcopenshell::geom::settings settings_; ifcopenshell::file* ifc_file; std::vector filters_; @@ -138,7 +138,7 @@ namespace ifcopenshell::geom { // When single-threaded ifcopenshell::geom::converter* converter_; - + // When multi-threaded std::vector kernel_pool; std::vector> worker_loggers_; diff --git a/src/ifcgeom/kernels/cgal/cgal_conversion_result.cpp b/src/ifcgeom/kernels/cgal/cgal_conversion_result.cpp index a239f497e0..7f6411b945 100644 --- a/src/ifcgeom/kernels/cgal/cgal_conversion_result.cpp +++ b/src/ifcgeom/kernels/cgal/cgal_conversion_result.cpp @@ -296,7 +296,7 @@ ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_polyhedron& shape, bool co }; std::vector> ps; - + for (auto& he1 : CGAL::halfedges_around_face(face->halfedge(), poly)) { const auto& source = he1->vertex()->point(); ps.push_back(transform_point(source)); @@ -345,7 +345,7 @@ void ifcopenshell::geom::cgal_shape::to_poly() const { CGAL::Polygon_mesh_processing::orient_to_bound_a_volume(poly); } shape_ = poly; - + // nef_->convert_to_polyhedron(*shape_); } } @@ -384,7 +384,7 @@ void ifcopenshell::geom::cgal_shape::triangulate(ifcopenshell::geom::settings se } const bool setting_use_original_edges = settings.get().get(); - + std::set> original_edges; if (setting_use_original_edges) { for (auto it = shape_to_use->edges_begin(); it != shape_to_use->edges_end(); ++it) { @@ -457,7 +457,7 @@ void ifcopenshell::geom::cgal_shape::triangulate(ifcopenshell::geom::settings se // std::map vertex_normals; // boost::associative_property_map> vertex_normals_map(vertex_normals); - + // triangulate the shape and compute the normals std::map face_normals; boost::associative_property_map> face_normals_map(face_normals); @@ -556,7 +556,7 @@ void ifcopenshell::geom::cgal_shape::triangulate(ifcopenshell::geom::settings se is_face_boundary[i] = setting_use_original_edges ? original_edges.find({ current_halfedge->vertex()->point(), current_halfedge->prev()->vertex()->point() }) != original_edges.end() : facet_to_component[face] != facet_to_component[current_halfedge->opposite()->face()]; - + ++i; ++num_vertices; ++current_halfedge; @@ -764,7 +764,7 @@ opaque_coordinate<3> ifcopenshell::geom::cgal_shape::position() for (auto it = shp.points_begin(); it != shp.points_end(); ++it) { for (int i = 0; i < 3; ++i) { p[i] += it->cartesian(i); - } + } } kernel_::FT N(static_cast(std::distance(shp.points_begin(), shp.points_end()))); for (int i = 0; i < 3; ++i) { diff --git a/src/ifcgeom/kernels/cgal/cgal_kernel.cpp b/src/ifcgeom/kernels/cgal/cgal_kernel.cpp index 2b2f2acaa7..b6e1a92df8 100644 --- a/src/ifcgeom/kernels/cgal/cgal_kernel.cpp +++ b/src/ifcgeom/kernels/cgal/cgal_kernel.cpp @@ -84,7 +84,7 @@ CGAL::Polyhedron_3 ifcopenshell::geom::utils::create_polyhedron(std::li // fresult.close(); return CGAL::Polyhedron_3(); } - + // std::cout << "After: " << polyhedron.size_of_vertices() << " vertices and " << polyhedron.size_of_facets() << " facets" << std::endl; return polyhedron; @@ -223,7 +223,7 @@ bool cgal_kernel::convert(const taxonomy::shell::ptr l, cgal_polyhedron& shape) } else { logger().message(ifcopenshell::logger::LOG_ERROR, "Failed to convert face:", f->instance); return false; - } + } } // std::cout << "Face in ConnectedFaceSet: " << std::endl; @@ -673,9 +673,9 @@ namespace { namespace { void face_to_poly_with_holes(const cgal_face& face, CGAL::Polygon_with_holes_2& pwh, CGAL::Aff_transformation_3& place) { - // static + // static kernel_::Vector_3 Z(0, 0, 1); - // static + // static kernel_::Vector_3 X(1, 0, 0); auto refz = newell(face.outer); @@ -912,7 +912,7 @@ bool ifcopenshell::geom::kernels::cgal_kernel::convert_openings(const express::b #else CGAL::Nef_nary_union_3> second_operand_collector; size_t second_operand_collector_size = 0; - + std::list>> operands; std::list second_operand_instances; @@ -1483,7 +1483,7 @@ bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference, for (auto& nef : first_operands_nef) { // @todo eliminate this copy (= to remove const) auto nef_copy = nef; - auto tree = build_halfspace_tree_decomposed(nef_copy, planes_fixed); + auto tree = build_halfspace_tree_decomposed(nef_copy, planes_fixed); } { // @nb we snap internally as well... @@ -1551,7 +1551,7 @@ bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference, } } - + /* { @@ -2026,7 +2026,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, std::vect if (!convert(face, fs) || fs.size() != 1) { return false; } - + auto& w = fs.front().outer; CGAL::Polygon_2 ps; for (auto& wire_point : w) { @@ -2037,7 +2037,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, std::vect continue; } - // static + // static auto z = taxonomy::make(0, 0, 1); cgal_polyhedron poly; process_extrusion(fs.front(), z, 200, poly); diff --git a/src/ifcgeom/kernels/cgal/cgal_kernel.h b/src/ifcgeom/kernels/cgal/cgal_kernel.h index 8eb15f23af..952c4923cc 100644 --- a/src/ifcgeom/kernels/cgal/cgal_kernel.h +++ b/src/ifcgeom/kernels/cgal/cgal_kernel.h @@ -74,7 +74,7 @@ namespace ifcopenshell { class IFC_GEOMLIBRARY_API cgal_kernel : public abstract_kernel { private: #ifndef IFOPSH_SIMPLE_KERNEL - enum boolean_operand_preprocess { + enum boolean_operand_preprocess { PP_MINKOWSKY_DILATE, PP_SNAP_POINTS_TO_FIRST_OPERAND, PP_SNAP_PLANES_TO_FIRST_OPERAND, diff --git a/src/ifcgeom/kernels/cgal/nef_to_halfspace_tree.h b/src/ifcgeom/kernels/cgal/nef_to_halfspace_tree.h index 70860c0f88..748d1f7abe 100644 --- a/src/ifcgeom/kernels/cgal/nef_to_halfspace_tree.h +++ b/src/ifcgeom/kernels/cgal/nef_to_halfspace_tree.h @@ -95,7 +95,7 @@ std::string dump_facet(typename CGAL::Nef_polyhedron_3::Halffacet_const_ const auto& p = h->plane(); oss << "Facet plane=" << p << std::endl; - + auto fc = h->facet_cycles_begin(); auto se = shalfedge_const_handle(fc); CGAL_assertion(se != 0); @@ -187,7 +187,7 @@ plane_map snap_halfspaces(const std::list>& planes fuzzy_sphere fs(query, search_radius, 0.); // std::cout << "q " << query << std::endl; - + std::list results_pos, results_neg; kdtree.search(std::back_inserter(results_pos), fs); @@ -801,7 +801,7 @@ void bfs(graph& g, size_t start_vertex, Fn& fn) { for (boost::tie(ei, ei_end) = boost::out_edges(cur, g); ei != ei_end; ++ei) { auto s = boost::source(*ei, g); auto t = boost::target(*ei, g); - + // @todo is this necessary? if (cur == t) { std::swap(s, t); @@ -863,10 +863,10 @@ std::unique_ptr> build_halfspace_tree(graph& int largest_component_idx = -1; int num_components = 0; - + // @nb we don't just randomly start from an arbitrary seed, but we sort planes by d / | abc | // for (size_t i = 0; i < boost::num_vertices(sub_graph_0); ++i) { - + std::vector sorted_verts; for (size_t i = 0; i < boost::num_vertices(sub_graph_0); ++i) { sorted_verts.push_back(i); @@ -1232,7 +1232,7 @@ std::unique_ptr> build_halfspace_tree_decomposed(cons // directly, so for now we need to isolate the individual volumes. CGAL::Polyhedron_3 P; poly.convert_inner_shell_to_polyhedron(ci->shells_begin(), P); - CGAL::Nef_polyhedron_3 Pnef(P); + CGAL::Nef_polyhedron_3 Pnef(P); for (auto it = Pnef.halffacets_begin(); it != Pnef.halffacets_end(); ++it) { if (it->incident_volume()->mark()) { @@ -1315,7 +1315,7 @@ size_t edge_contract(graph& G) { bool exists = boost::edge(srcid, tt, G).second; if (!exists) { boost::add_edge(srcid, tt, G); - } + } } } ++n; diff --git a/src/ifcgeom/kernels/manifold/manifold_conversion_result.h b/src/ifcgeom/kernels/manifold/manifold_conversion_result.h index d2b774422b..3764b33f26 100644 --- a/src/ifcgeom/kernels/manifold/manifold_conversion_result.h +++ b/src/ifcgeom/kernels/manifold/manifold_conversion_result.h @@ -19,7 +19,7 @@ struct IFC_GEOMLIBRARY_API manifold_part { auto copy = s; copy.CalculateNormals(3); mesh = copy.GetMeshGL64(); - solid = s; + solid = s; } manifold_part(const manifold::MeshGL64& s) : mesh(s) {} diff --git a/src/ifcgeom/kernels/manifold/manifold_kernel.cpp b/src/ifcgeom/kernels/manifold/manifold_kernel.cpp index a102597280..b022909dd8 100644 --- a/src/ifcgeom/kernels/manifold/manifold_kernel.cpp +++ b/src/ifcgeom/kernels/manifold/manifold_kernel.cpp @@ -114,10 +114,10 @@ namespace { mesh_type build() const { mesh_type mesh; mesh.numProp = 3; - + std::vector vertex_use_count(vertices.size(), 0); std::vector vertex_normals(vertices.size(), Eigen::Vector3d::Zero()); - + for (size_t i = 0; i < tri_verts.size(); i += 3) { for (size_t j = 0; j < 3; ++j) { vertex_use_count[tri_verts[i + j]]++; @@ -1242,13 +1242,13 @@ namespace { } std::optional part_from_halfspace_solid(halfspace_build_state& state, const taxonomy::solid::ptr& solid, const taxonomy::face::ptr& face,const manifold::Box& reference_box, double precision, double dilation) { - + auto plane = taxonomy::cast(face->basis); // @todo verify order const auto transform = matrix_or_identity(solid->matrix) * matrix_or_identity(plane->matrix); const auto extrusion_dir = matrix_or_identity(solid->matrix).col(2).head<3>().eval(); - + Eigen::Vector3d x = transform.col(0).head<3>(); Eigen::Vector3d y = transform.col(1).head<3>(); Eigen::Vector3d normal = transform.col(2).head<3>(); @@ -1281,7 +1281,7 @@ namespace { const auto delta = corner - origin; const auto u = delta.dot(x); const auto v = delta.dot(y); - + u_min = std::min(u_min, u); u_max = std::max(u_max, u); v_min = std::min(v_min, v); diff --git a/src/ifcgeom/kernels/opencascade/boolean_utils.cpp b/src/ifcgeom/kernels/opencascade/boolean_utils.cpp index 035ef9b99c..30332ae50a 100644 --- a/src/ifcgeom/kernels/opencascade/boolean_utils.cpp +++ b/src/ifcgeom/kernels/opencascade/boolean_utils.cpp @@ -58,7 +58,7 @@ double ifcopenshell::geom::util::min_edge_length(const TopoDS_Shape & a) { TopExp_Explorer exp(a, TopAbs_EDGE); for (; exp.More(); exp.Next()) { const TopoDS_Edge& e = TopoDS::Edge(exp.Current()); - + TopoDS_Vertex v0, v1; TopExp::Vertices(e, v0, v1); if (!v0.IsNull() && !v1.IsNull() && v0.IsSame(v1)) { diff --git a/src/ifcgeom/kernels/opencascade/clash_utils.cpp b/src/ifcgeom/kernels/opencascade/clash_utils.cpp index 8be0a4a6ae..d047e7d60a 100644 --- a/src/ifcgeom/kernels/opencascade/clash_utils.cpp +++ b/src/ifcgeom/kernels/opencascade/clash_utils.cpp @@ -43,8 +43,8 @@ bool is_intersect_ray_box(const struct ray *ray, const struct box *box) { // https://github.com/NVIDIA-Omniverse/PhysX/blob/main/physx/source/geomutils/src/intersection/GuIntersectionRayTriangle.h // With minor modifications to use gp_Vec type. // More reading: https://en.wikipedia.org/wiki/M%C3%B6ller%E2%80%93Trumbore_intersection_algorithm -bool intersectRayTriangle( const gp_Vec& orig, const gp_Vec& dir, - const gp_Vec& vert0, const gp_Vec& vert1, const gp_Vec& vert2, +bool intersectRayTriangle( const gp_Vec& orig, const gp_Vec& dir, + const gp_Vec& vert0, const gp_Vec& vert1, const gp_Vec& vert2, double& at, double& au, double& av, bool cull, float enlarge) { // Find vectors for two edges sharing vert0 @@ -147,7 +147,7 @@ void edgeEdgeDist(gp_Vec& x, gp_Vec& y, // closest points const double Denom = ADotA*BDotB - ADotB*ADotB; double t; // We will clamp result so t is on the segment (p, a) - if(Denom!=0.0) + if(Denom!=0.0) t = ios_clamp((ADotT*BDotB - BDotT*ADotB) / Denom, 0.0, 1.0); else t = 0.0; @@ -268,7 +268,7 @@ double distanceTriangleTriangleSquared(gp_Vec& cp, gp_Vec& cq, const std::array< if(Tp[2]>Tp[index]) index = 2; } - if(index >= 0) + if(index >= 0) { shown_disjoint = true; @@ -297,7 +297,7 @@ double distanceTriangleTriangleSquared(gp_Vec& cp, gp_Vec& cq, const std::array< gp_Vec Tn = Tv[0].Crossed(Tv[1]); double Tnl = Tn.Dot(Tn); - + if(Tnl>1e-15f) { const std::array Sp = {(q[0] - p[0]).Dot(Tn), @@ -317,7 +317,7 @@ double distanceTriangleTriangleSquared(gp_Vec& cp, gp_Vec& cq, const std::array< } if(index >= 0) - { + { shown_disjoint = true; const gp_Vec& pIndex = p[index]; @@ -525,11 +525,11 @@ bool trianglesIntersectCoplanar(const gp_Vec& p1_n, const gp_Vec& a1, const gp_V const double third = (1.0 / 3.0); - //A bit of the computations done inside the following functions could be shared but it's kept simple since the + //A bit of the computations done inside the following functions could be shared but it's kept simple since the //difference is not very big and the coplanar case is not expected to be the most common case if (linesIntersect(a1, b1, a2, b2, x, y) || linesIntersect(a1, b1, b2, c2, x, y) || linesIntersect(a1, b1, c2, a2, x, y) || linesIntersect(b1, c1, a2, b2, x, y) || linesIntersect(b1, c1, b2, c2, x, y) || linesIntersect(b1, c1, c2, a2, x, y) || - linesIntersect(c1, a1, a2, b2, x, y) || linesIntersect(c1, a1, b2, c2, x, y) || linesIntersect(c1, a1, c2, a2, x, y) || + linesIntersect(c1, a1, a2, b2, x, y) || linesIntersect(c1, a1, b2, c2, x, y) || linesIntersect(c1, a1, c2, a2, x, y) || pointInTriangle(a1, b1, c1, third * (a2 + b2 + c2), x, y) || pointInTriangle(a2, b2, c2, third * (a1 + b1 + c1), x, y)) return true; @@ -557,7 +557,7 @@ bool trianglesIntersect(const gp_Vec& a1, const gp_Vec& b1, const gp_Vec& c1, co if ((p1ToA > 0) == (p1ToB > 0) && (p1ToA > 0) == (p1ToC > 0)) return false; //All points of triangle 2 on same side of triangle 1 -> no intersection - + gp_Dir p2_n((b2 - a2).Crossed(c2 - a2).Normalized()); double p2_d = -a2.Dot(p2_n); // const PxPlane p2(a2, b2, c2); @@ -566,7 +566,7 @@ bool trianglesIntersect(const gp_Vec& a1, const gp_Vec& b1, const gp_Vec& c1, co const double p2ToC = c1.Dot(p2_n) + p2_d; if ((p2ToA > 0) == (p2ToB > 0) && (p2ToA > 0) == (p2ToC > 0)) - return false; //All points of triangle 1 on same side of triangle 2 -> no intersection + return false; //All points of triangle 1 on same side of triangle 2 -> no intersection gp_Vec intersectionDirection = p1_n.Crossed(p2_n); const double l2 = intersectionDirection.SquareMagnitude(); diff --git a/src/ifcgeom/kernels/opencascade/clash_utils.h b/src/ifcgeom/kernels/opencascade/clash_utils.h index 25e021bab3..faae83bfed 100644 --- a/src/ifcgeom/kernels/opencascade/clash_utils.h +++ b/src/ifcgeom/kernels/opencascade/clash_utils.h @@ -20,7 +20,7 @@ struct IFC_GEOMLIBRARY_API box { IFC_GEOMLIBRARY_API bool is_intersect_ray_box(const struct ray *ray, const struct box *box); IFC_GEOMLIBRARY_API bool intersectRayTriangle( const gp_Vec& orig, const gp_Vec& dir, - const gp_Vec& vert0, const gp_Vec& vert1, const gp_Vec& vert2, + const gp_Vec& vert0, const gp_Vec& vert1, const gp_Vec& vert2, double& at, double& au, double& av, bool cull, float enlarge=0.0f); diff --git a/src/ifcgeom/kernels/opencascade/extrusion.cpp b/src/ifcgeom/kernels/opencascade/extrusion.cpp index 416a147b7e..2b9534fb94 100644 --- a/src/ifcgeom/kernels/opencascade/extrusion.cpp +++ b/src/ifcgeom/kernels/opencascade/extrusion.cpp @@ -35,7 +35,7 @@ bool open_cascade_kernel::convert(const taxonomy::extrusion::ptr extrusion, Topo if (face.ShapeType() == TopAbs_COMPOUND) { - // For compounds (most likely the result of a IfcCompositeProfileDef) + // For compounds (most likely the result of a IfcCompositeProfileDef) // create a compound solid shape. TopExp_Explorer exp(face, TopAbs_FACE); diff --git a/src/ifcgeom/kernels/opencascade/face.cpp b/src/ifcgeom/kernels/opencascade/face.cpp index 7c9a0de256..c92fa3347c 100644 --- a/src/ifcgeom/kernels/opencascade/face.cpp +++ b/src/ifcgeom/kernels/opencascade/face.cpp @@ -247,7 +247,7 @@ namespace { auto crv = get_curve(e->basis); result = Handle(Geom_Surface)(new Geom_SurfaceOfRevolution( - crv, ax + crv, ax )); result->Transform(tr); diff --git a/src/ifcgeom/kernels/opencascade/face_definition.h b/src/ifcgeom/kernels/opencascade/face_definition.h index 8e4b4b0d8b..5eb8544aa2 100644 --- a/src/ifcgeom/kernels/opencascade/face_definition.h +++ b/src/ifcgeom/kernels/opencascade/face_definition.h @@ -70,7 +70,7 @@ namespace ifcopenshell::geom { std::pair inner_wires() const { return { wires_.begin() + 1, wires_.end() }; } - }; + }; } } diff --git a/src/ifcgeom/kernels/opencascade/loft.cpp b/src/ifcgeom/kernels/opencascade/loft.cpp index e3d612debe..fba41cffeb 100644 --- a/src/ifcgeom/kernels/opencascade/loft.cpp +++ b/src/ifcgeom/kernels/opencascade/loft.cpp @@ -163,7 +163,7 @@ bool open_cascade_kernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& return false; } } - + NCollection_List faces; TopoDS_Compound comp; BRep_Builder BB; @@ -330,7 +330,7 @@ bool open_cascade_kernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& std::array>>::const_iterator, 2> tag_pairs = { all_tags.begin() + std::distance(shps.begin(), it), all_tags.begin() + std::distance(shps.begin(), jt)}; - + for (size_t i = 0; i < 2; ++i) { NCollection_IndexedDataMap, TopTools_ShapeMapHasher> ancestors; const auto& wire = wp[i]; @@ -357,7 +357,7 @@ bool open_cascade_kernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& for (NCollection_List::Iterator edge_it(incidentEdges); edge_it.More(); edge_it.Next()) { const TopoDS_Edge& e = TopoDS::Edge(edge_it.Value()); - + TopoDS_Vertex ev0, ev1; TopExp::Vertices(e, ev0, ev1); @@ -405,11 +405,11 @@ bool open_cascade_kernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& ++d; } else { throw std::runtime_error("Unable to construct surface"); - } + } } continue; - } + } for (auto& wp : ws) { BRepTools_WireExplorer a(wp[0]); diff --git a/src/ifcgeom/kernels/opencascade/loop.cpp b/src/ifcgeom/kernels/opencascade/loop.cpp index e43d1ae939..411e336f16 100644 --- a/src/ifcgeom/kernels/opencascade/loop.cpp +++ b/src/ifcgeom/kernels/opencascade/loop.cpp @@ -204,7 +204,7 @@ namespace { BRep_Tool::Pnt(v1).DumpJson(oss); auto osss = oss.str(); std::wcout << osss.c_str() << std::endl; -#endif +#endif BRep_Builder B; TopoDS_Wire W; diff --git a/src/ifcgeom/kernels/opencascade/opencascade_conversion_result.cpp b/src/ifcgeom/kernels/opencascade/opencascade_conversion_result.cpp index da27586dd6..b467dcb4d1 100644 --- a/src/ifcgeom/kernels/opencascade/opencascade_conversion_result.cpp +++ b/src/ifcgeom/kernels/opencascade/opencascade_conversion_result.cpp @@ -75,7 +75,7 @@ void ifcopenshell::geom::open_cascade_shape::triangulate(ifcopenshell::geom::set // A 3x3 matrix to rotate the vertex normals std::optional rotation_matrix; - + if (place.components_) { const auto& m = *place.components_; rotation_matrix.emplace( @@ -84,7 +84,7 @@ void ifcopenshell::geom::open_cascade_shape::triangulate(ifcopenshell::geom::set m(2, 0), m(2, 1), m(2, 2) ); } - + // When welding vertices, vertex coords will be shared among faces so we need to per-shape set // to keep track of which edges were already emitted. std::set> emitted_edges; @@ -119,9 +119,9 @@ void ifcopenshell::geom::open_cascade_shape::triangulate(ifcopenshell::geom::set for (exp.Init(shape_, TopAbs_FACE); exp.More(); exp.Next(), ++num_faces) { TopoDS_Face face = TopoDS::Face(exp.Current()); - size_t num_bounds = 0; + size_t num_bounds = 0; for (TopoDS_Iterator it(face); it.More(); it.Next(), ++num_bounds) {} - + const bool is_planar = BRep_Tool::Surface(face) && BRep_Tool::Surface(face)->DynamicType() == STANDARD_TYPE(Geom_Plane); const bool has_inner_bounds = num_bounds > 1; @@ -314,7 +314,7 @@ void ifcopenshell::geom::open_cascade_shape::triangulate(ifcopenshell::geom::set } else { p = tessellater.Value(i).XYZ(); } - + auto p_local = p; taxonomy_transform(place.components_, p); @@ -582,7 +582,7 @@ conversion_result_shape* ifcopenshell::geom::open_cascade_shape::concat(conversi { TopoDS_Compound compound; BRep_Builder builder; - + auto& left = shape_; auto& right = ((ifcopenshell::geom::open_cascade_shape*)other)->shape_; @@ -594,7 +594,7 @@ conversion_result_shape* ifcopenshell::geom::open_cascade_shape::concat(conversi builder.MakeCompound(compound); builder.Add(compound, left); } - + builder.Add(compound, right); return new open_cascade_shape(std::move(compound)); diff --git a/src/ifcgeom/kernels/opencascade/opencascade_kernel.cpp b/src/ifcgeom/kernels/opencascade/opencascade_kernel.cpp index c6e7437ab8..4e3efbb75b 100644 --- a/src/ifcgeom/kernels/opencascade/opencascade_kernel.cpp +++ b/src/ifcgeom/kernels/opencascade/opencascade_kernel.cpp @@ -84,7 +84,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_openings(const express::ba // opening_trsf = relative; std::vector opening_shapes; - + // @todo abstract_kernel::convert(op.first, opening_shapes); @@ -309,13 +309,13 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // IfcSchema::IfcRelVoidsElement::list::ptr ifcopenshell::geom::Kernel::find_openings(IfcSchema::IfcProduct* product) { // std::vector rs; -// +// // if (product->declaration().is(IfcSchema::IfcElement::Class()) && !product->declaration().is(IfcSchema::IfcOpeningElement::Class())) { // IfcSchema::IfcElement* element = (IfcSchema::IfcElement*)product; // auto rels = element->HasOpenings(); // rs.insert(rs.end(), rels->begin(), rels->end()); // } -// +// // // Is the IfcElement a decomposition of an IfcElement with any IfcOpeningElements? // IfcSchema::IfcObjectDefinition* obdef = product->as(); // for (;;) { @@ -327,10 +327,10 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // auto rels = element->HasOpenings(); // rs.insert(rs.end(), rels->begin(), rels->end()); // } -// +// // obdef = rel_obdef; // } -// +// // // Filter openings in Reference view, solely marked as Reference. // IfcSchema::IfcRelVoidsElement::list::ptr openings(new IfcSchema::IfcRelVoidsElement::list); // std::for_each(rs.begin(), rs.end(), [&openings](IfcSchema::IfcRelVoidsElement* rel) { @@ -341,17 +341,17 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } // } // }); -// +// // return openings; // } -// +// // const IfcSchema::IfcMaterial* ifcopenshell::geom::Kernel::get_single_material_association(const IfcSchema::IfcProduct* product) { // IfcSchema::IfcMaterial* single_material = 0; // IfcSchema::IfcRelAssociatesMaterial::list::ptr associated_materials = product->HasAssociations()->as(); // if (associated_materials->size() == 1) { // IfcSchema::IfcMaterialSelect* associated_material = (*associated_materials->begin())->RelatingMaterial(); // single_material = associated_material->as(); -// +// // // NB: IfcMaterialLayerSets are also considered, regardless of --enable-layerset-slicing. Picking // // the first material (in accordance with other viewers) when layerset-slicing is disabled. // if (!single_material && associated_material->as()) { @@ -366,21 +366,21 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } // return single_material; // } -// +// // ifcopenshell::geom::native_element* ifcopenshell::geom::Kernel::create_brep_for_representation_and_product( // const IteratorSettings& settings, IfcSchema::IfcRepresentation* representation, IfcSchema::IfcProduct* product) // { // std::stringstream representation_id_builder; -// +// // representation_id_builder << representation->data().id(); -// +// // ifcopenshell::geom::native* shape; // std::vector shapes, shapes2; -// +// // if (!convert_shapes(representation, shapes)) { // return 0; // } -// +// // if (settings.get(IteratorSettings::APPLY_LAYERSETS)) { // TopoDS_Shape merge; // if (util::flatten_shape_list(shapes, merge, false, getValue(GV_PRECISION))) { @@ -390,7 +390,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // std::vector< std::vector > folded_layers; // std::vector> styles; // if (convert_layerset(product, layers, styles, thickness)) { -// +// // IfcSchema::IfcRelAssociates::list::ptr associations = product->HasAssociations(); // for (IfcSchema::IfcRelAssociates::list::it it = associations->begin(); it != associations->end(); ++it) { // IfcSchema::IfcRelAssociatesMaterial* associates_material = (**it).as(); @@ -400,7 +400,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // break; // } // } -// +// // if (styles.size() > 1) { // // If there's only a single layer there is no need to manipulate geometries. // bool success = true; @@ -415,7 +415,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // success = true; // } // } -// +// // if (!success) { // ifcopenshell::logger::root().error("Failed processing layerset"); // } @@ -424,9 +424,9 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } // } // } -// +// // bool material_style_applied = false; -// +// // const IfcSchema::IfcMaterial* single_material = get_single_material_association(product); // if (single_material) { // auto s = get_style(single_material); @@ -448,11 +448,11 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // ifcopenshell::logger::root().warning("No material and surface styles for:", product); // } // } -// +// // if (material_style_applied) { // representation_id_builder << "-material-" << single_material->data().id(); // } -// +// // if (settings.force_space_transparency() >= 0. && product->declaration().is("IfcSpace")) { // for (auto& s : shapes) { // if (s.hasStyle()) { @@ -464,7 +464,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } // } // } -// +// // int parent_id = -1; // try { // express::entity* parent_object = get_decomposing_entity(product); @@ -474,10 +474,10 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } catch (const std::exception& e) { // ifcopenshell::logger::root().error(e); // } -// +// // const std::string name = product->Name().value_or(""); // const std::string guid = product->GlobalId(); -// +// // gp_Trsf trsf; // try { // if (product->ObjectPlacement()) { @@ -488,20 +488,20 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } catch (...) { // ifcopenshell::logger::root().error("Failed to construct placement"); // } -// +// // // Does the IfcElement have any IfcOpenings? // // Note that openings for IfcOpeningElements are not processed // IfcSchema::IfcRelVoidsElement::list::ptr openings = find_openings(product); -// +// // const std::string product_type = product->declaration().name(); // ElementSettings element_settings(settings, getValue(GV_LENGTH_UNIT), product_type); -// +// // if (!settings.get(ifcopenshell::geom::IteratorSettings::DISABLE_OPENING_SUBTRACTIONS) && openings && openings->size()) { // representation_id_builder << "-openings"; // for (IfcSchema::IfcRelVoidsElement::list::it it = openings->begin(); it != openings->end(); ++it) { // representation_id_builder << "-" << (*it)->data().id(); // } -// +// // std::vector opened_shapes; // bool caught_error = false; // try { @@ -512,11 +512,11 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } catch (...) { // ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "error processing openings for:", product); // } -// +// // if (caught_error && opened_shapes.size() < shapes.size()) { // opened_shapes = shapes; // } -// +// // if (settings.get(IteratorSettings::USE_WORLD_COORDS)) { // for (std::vector::iterator it = opened_shapes.begin(); it != opened_shapes.end(); ++it) { // it->prepend(trsf); @@ -535,14 +535,14 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } else { // shape = new ifcopenshell::geom::native(element_settings, representation_id_builder.str(), shapes); // } -// +// // std::string context_string = ""; // if (representation->RepresentationIdentifier()) { // context_string = *representation->RepresentationIdentifier(); // } else if (representation->ContextOfItems()->ContextType()) { // context_string = *representation->ContextOfItems()->ContextType(); // } -// +// // auto elem = new native_element( // product->data().id(), // parent_id, @@ -554,7 +554,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // std::shared_ptr(shape), // product // ); -// +// // if (settings.get(IteratorSettings::VALIDATE_QUANTITIES)) { // auto rels = product->IsDefinedBy(); // for (auto& rel : *rels) { @@ -623,10 +623,10 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } // } // } -// +// // return elem; // } -// +// // IfcSchema::IfcRepresentation* ifcopenshell::geom::Kernel::representation_mapped_to(const IfcSchema::IfcRepresentation* representation) { // IfcSchema::IfcRepresentation* representation_mapped_to = 0; // try { @@ -651,36 +651,36 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } // return representation_mapped_to; // } -// +// // IfcSchema::IfcProduct::list::ptr ifcopenshell::geom::Kernel::products_represented_by(const IfcSchema::IfcRepresentation* representation) { // IfcSchema::IfcProduct::list::ptr products(new IfcSchema::IfcProduct::list); -// +// // IfcSchema::IfcProductRepresentation::list::ptr prodreps = representation->OfProductRepresentation(); -// +// // for (IfcSchema::IfcProductRepresentation::list::it it = prodreps->begin(); it != prodreps->end(); ++it) { // // http://buildingsmart-tech.org/ifc/IFC2x3/TC1/html/ifcrepresentationresource/lexical/ifcproductrepresentation.htm // // IFC2x Edition 3 NOTE Users should not instantiate the entity IfcProductRepresentation from IFC2x Edition 3 onwards. // // It will be changed into an ABSTRACT supertype in future releases of IFC. -// +// // // IfcProductRepresentation also lacks the INVERSE relation to IfcProduct // // Let's find the IfcProducts that reference the IfcProductRepresentation anyway // products->push((*it)->data().get_inverse((&IfcSchema::IfcProduct::Class()), -1)->as()); // } -// +// // IfcSchema::IfcRepresentationMap::list::ptr maps = representation->RepresentationMap(); -// +// // if (products->size() && maps->size()) { // ifcopenshell::logger::root().warning("Representation used by IfcRepresentationMap and IfcProductDefinitionShape", representation); // } -// +// // if (prodreps->size() > 1) { // ifcopenshell::logger::root().warning("Multiple IfcProductDefinitionShapes for representation", representation); // } -// +// // if (maps->size() > 1) { // ifcopenshell::logger::root().warning("Multiple IfcRepresentationMaps for representation", representation); // } -// +// // if (maps->size() == 1) { // IfcSchema::IfcRepresentationMap* map = *maps->begin(); // if (is_identity_transform(map->MappingOrigin())) { @@ -688,11 +688,11 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // for (IfcSchema::IfcMappedItem::list::it it = items->begin(); it != items->end(); ++it) { // IfcSchema::IfcMappedptr item = *it; // if (item->StyledByItem()->size() != 0) continue; -// +// // if (!is_identity_transform(item->MappingTarget())) { // continue; // } -// +// // IfcSchema::IfcRepresentation::list::ptr reps = item->data().get_inverse((&IfcSchema::IfcRepresentation::Class()), -1)->as(); // for (IfcSchema::IfcRepresentation::list::it jt = reps->begin(); jt != reps->end(); ++jt) { // IfcSchema::IfcRepresentation* rep = *jt; @@ -706,10 +706,10 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } // } // } -// +// // return products; // } -// +// // ifcopenshell::geom::native_element* ifcopenshell::geom::Kernel::create_brep_for_processed_representation( // const IteratorSettings& /*settings*/, IfcSchema::IfcRepresentation* representation, IfcSchema::IfcProduct* product, // ifcopenshell::geom::native_element* brep) @@ -723,10 +723,10 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } catch (const std::exception& e) { // ifcopenshell::logger::root().error(e); // } -// +// // const std::string name = product->Name().value_or(""); // const std::string guid = product->GlobalId(); -// +// // gp_Trsf trsf; // try { // if (product->ObjectPlacement()) { @@ -737,16 +737,16 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } catch (...) { // ifcopenshell::logger::root().error("Failed to construct placement"); // } -// +// // std::string context_string = ""; // if (representation->RepresentationIdentifier()) { // context_string = *representation->RepresentationIdentifier(); // } else if (representation->ContextOfItems()->ContextType()) { // context_string = *representation->ContextOfItems()->ContextType(); // } -// +// // const std::string product_type = product->declaration().name(); -// +// // return new native_element( // product->data().id(), // parent_id, @@ -759,24 +759,24 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // product // ); // } -// +// // bool ifcopenshell::geom::Kernel::convert_layerset(const IfcSchema::IfcProduct* product, std::vector& surfaces, std::vector>& styles, std::vector& thicknesses) { -// +// // } -// +// // bool ifcopenshell::geom::Kernel::find_wall_end_points(const IfcSchema::IfcWall* wall, gp_Pnt& start, gp_Pnt& end) { // IfcSchema::IfcRepresentation* axis_representation = find_representation(wall, "Axis"); // if (!axis_representation) { // return false; // } -// +// // std::vector items; // { // Kernel temp = *this; // temp.setValue(GV_DIMENSIONALITY, -1.); // temp.convert_shapes(axis_representation, items); // } -// +// // TopoDS_Vertex a, b; // for (std::vector::const_iterator it = items.begin(); it != items.end(); ++it) { // TopExp_Explorer exp(it->shape(), TopAbs_VERTEX); @@ -787,36 +787,36 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } // } // } -// +// // if (a.IsNull() || b.IsNull()) { // return false; // } -// +// // start = BRep_Tool::Pnt(a); // end = BRep_Tool::Pnt(b); -// +// // return true; // } -// +// // bool ifcopenshell::geom::Kernel::fold_layers(const IfcSchema::IfcWall* wall, const std::vector& items, const std::vector& surfaces, const std::vector& thicknesses, std::vector< std::vector >& result) { // /* // * @todo isn't it easier to do this based on the non-folded surfaces of // * the connected walls and fold both pairs of layersets simultaneously? // */ -// +// // bool folds_made = false; -// +// // IfcSchema::IfcRelConnectsPathElements::list::ptr connections(new IfcSchema::IfcRelConnectsPathElements::list); // connections->push(wall->ConnectedFrom()->as()); // connections->push(wall->ConnectedTo()->as()); -// +// // typedef std::vector surfaces_t; // typedef std::pair curve_on_surface; // typedef std::vector curves_on_surfaces_t; // typedef std::vector< std::pair< std::pair, const IfcSchema::IfcProduct*> > endpoint_connections_t; // typedef std::vector< std::vector > result_t; // endpoint_connections_t endpoint_connections; -// +// // // Find the semantic connections to other wall elements when they are not connected 'AT_PATH' because // // in that latter case no folds need to be made. // for (IfcSchema::IfcRelConnectsPathElements::list::it it = connections->begin(); it != connections->end(); ++it) { @@ -838,18 +838,18 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } // } // } -// +// // if (endpoint_connections.size() == 0) { // return false; // } -// +// // // Count how many connections are made AT_START and AT_END respectively // int connection_type_count[2] = { 0,0 }; // for (endpoint_connections_t::const_iterator it = endpoint_connections.begin(); it != endpoint_connections.end(); ++it) { // const int idx = it->first.first == IfcSchema::IfcConnectionTypeEnum::IfcConnectionType_ATSTART; // connection_type_count[idx] ++; // } -// +// // gp_Trsf local; // if (wall->ObjectPlacement()) { // if (!convert(wall->ObjectPlacement(), local)) { @@ -857,7 +857,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } // } // local.Invert(); -// +// // { // // Copy the unfolded surfaces // result.resize(surfaces.size()); @@ -867,25 +867,25 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // result_it->push_back(*input_it); // } // } -// +// // const double total_thickness = std::accumulate(thicknesses.begin(), thicknesses.end(), 0.); -// +// // gp_Pnt own_axis_start, own_axis_end; // find_wall_end_points(wall, own_axis_start, own_axis_end); -// +// // // Sometimes duplicate IfcRelConnectsPathElements exist. These are detected // // and the counts of connections are decremented accordingly. // for (int idx = 0; idx < 2; ++idx) { // if (connection_type_count[idx] <= 1) { // continue; // } -// +// // /* // IfcSchema::IfcConnectionTypeEnum::Value connection_type = idx == 1 // ? IfcSchema::IfcConnectionTypeEnum::IfcConnectionType_ATSTART // : IfcSchema::IfcConnectionTypeEnum::IfcConnectionType_ATEND; // */ -// +// // std::set others; // endpoint_connections_t::iterator it = endpoint_connections.begin(); // while (it != endpoint_connections.end()) { @@ -899,38 +899,38 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } // } // } -// +// // // Check whether the end points are of the wall are really ~1 LayerThickness away from each other // /* // for (endpoint_connections_t::const_iterator it = endpoint_connections.begin(); it != endpoint_connections.end(); ++it) { // IfcSchema::IfcConnectionTypeEnum::Value own_type = it->first.first; // IfcSchema::IfcConnectionTypeEnum::Value other_type = it->first.second; -// +// // gp_Pnt other_axis_start, other_axis_end; // find_wall_end_points(it->second->as(), other_axis_start, other_axis_end); -// +// // gp_Trsf other; // if (!convert(it->second->ObjectPlacement(), other)) { // continue; // } -// +// // other.Transforms(other_axis_start.ChangeCoord()); // local.Transforms(other_axis_start.ChangeCoord()); // other.Transforms(other_axis_end.ChangeCoord()); // local.Transforms(other_axis_end.ChangeCoord()); -// +// // const gp_Pnt& a = own_type == IfcSchema::IfcConnectionTypeEnum::IfcConnectionType_ATSTART // ? own_axis_start // : own_axis_end; -// +// // const gp_Pnt& b = other_type == IfcSchema::IfcConnectionTypeEnum::IfcConnectionType_ATSTART // ? other_axis_start // : other_axis_end; -// +// // const double d = a.Distance(b); // } // */ -// +// // const double length_required = endpoint_connections.size() * total_thickness; // // @todo this is not precisely the distance in case of curved walls. Also, it's safer // // to first reproject the body onto the axis to get the precise curve parametrization @@ -940,20 +940,20 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // ifcopenshell::logger::root().warning("The wall axis is not long enough to accommodate the fold points"); // return false; // } -// +// // for (endpoint_connections_t::const_iterator it = endpoint_connections.begin(); it != endpoint_connections.end(); ++it) { // IfcSchema::IfcConnectionTypeEnum::Value connection_type = it->first.first; -// +// // // If more than one wall connects to this start/end -point assume layers do not need to be folded // const int idx = connection_type == IfcSchema::IfcConnectionTypeEnum::IfcConnectionType_ATSTART; // if (connection_type_count[idx] > 1) continue; -// +// // // Pick the corresponding point from the axis // const gp_Pnt& own_end_point = connection_type == IfcSchema::IfcConnectionTypeEnum::IfcConnectionType_ATEND // ? own_axis_end // : own_axis_start; // const IfcSchema::IfcProduct* other_wall = it->second; -// +// // gp_Trsf other; // if (other_wall->ObjectPlacement()) { // if (!convert(other_wall->ObjectPlacement(), other)) { @@ -961,32 +961,32 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // continue; // } // } -// +// // IfcSchema::IfcRepresentation* axis_representation = find_representation(other_wall, "Axis"); -// +// // if (!axis_representation) { // ifcopenshell::logger::root().warning("Joined wall has no axis representation", other_wall); // continue; // } -// +// // std::vector axis_items; // { // Kernel temp = *this; // temp.setValue(GV_DIMENSIONALITY, -1.); // temp.convert_shapes(axis_representation, axis_items); // } -// +// // TopoDS_Shape axis_shape; // util::flatten_shape_list(axis_items, axis_shape, false, getValue(GV_PRECISION)); -// +// // // local and other are IfcLocalPlacements and therefore have a unit // // scale factor that can be applied by means of TopoDS_Shape::Move() // axis_shape.Move(other); // axis_shape.Move(local); -// +// // TopoDS_Shape body_shape; // util::flatten_shape_list(items, body_shape, false, getValue(GV_PRECISION)); -// +// // // Create a single paremetric range over a single curve // // that represents the entire 1d domain of the other wall // // Sometimes there are multiple edges in the Axis shape @@ -998,19 +998,19 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // if (!exp.More()) { // return false; // } -// +// // TopoDS_Edge axis_edge = TopoDS::Edge(exp.Current()); // other_axis_curve = BRep_Tool::Curve(axis_edge, axis_u1, axis_u2); -// +// // gp_Pnt other_a_1, other_a_2; // other_axis_curve->D0(axis_u1, other_a_1); // other_axis_curve->D0(axis_u2, other_a_2); -// +// // if (axis_u2 < axis_u1) { // std::swap(axis_u1, axis_u2); // } // exp.Next(); -// +// // for (; exp.More(); exp.Next()) { // TopoDS_Edge axis_edge2 = TopoDS::Edge(exp.Current()); // TopExp_Explorer exp2(axis_edge2, TopAbs_VERTEX); @@ -1025,22 +1025,22 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } // } // } -// +// // double layer_offset = 0; -// +// // std::vector::const_iterator thickness = thicknesses.begin(); // result_t::iterator result_vector = result.begin() + 1; -// +// // // nb The first layer is never folded, because it corresponds // // to one of the longitudinal faces of the wall. Hence the +1 // for (surfaces_t::const_iterator jt = surfaces.begin() + 1; jt != surfaces.end() - 1; ++jt, ++result_vector) { // layer_offset += *thickness++; -// +// // bool found_intersection = false, parallel = false; // std::optional point_outside_param_range; -// +// // const Handle_Geom_Surface& surface = *jt; -// +// // // Find the intersection point between the layerset surface // // and the other axis curve. If it's within the parametric // // range of the other wall it means the walls are connected @@ -1048,16 +1048,16 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // GeomAPI_IntCS intersections(other_axis_curve, surface); // if (intersections.IsDone() && intersections.NbPoints() == 1) { // const gp_Pnt& p = intersections.Point(1); -// +// // double u, v, w; // intersections.Parameters(1, u, v, w); -// +// // gp_Pnt Pc, Ps; // gp_Vec Vc, Vs1, Vs2; // other_axis_curve->D1(w, Pc, Vc); // surface->D1(u, v, Ps, Vs1, Vs2); // Vs1.Cross(Vs2); -// +// // if (Vs1.IsNormal(Vc, 1.e-5)) { // ifcopenshell::logger::root().warning("Connected walls are parallel"); // parallel = true; @@ -1069,9 +1069,9 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // break; // } // } -// +// // if (!parallel && !found_intersection && point_outside_param_range) { -// +// // /* // Is there a bug in Open Cascade related to the intersection // of offset surfaces constructed from linear extrusions? @@ -1083,13 +1083,13 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // Handle_Geom_Surface yz2 = new Geom_OffsetSurface(yz, 1.); // intersect(xy, yz2); // */ -// +// // Handle_Geom_Surface plane = new Geom_Plane(*point_outside_param_range, gp::DZ()); -// +// // // vertical edges at wall end point face. // curves_on_surfaces_t layer_ends; // util::intersect(surface, body_shape, layer_ends); -// +// // Handle_Geom_Curve layer_body_intersection; // Handle_Geom_Surface body_surface; // double mind = std::numeric_limits::infinity(); @@ -1111,9 +1111,9 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // if (d < total_thickness * 3 && d < mind) { // GeomAdaptor_Curve GAC(other_axis_curve); // GeomAdaptor_Surface GAS(kt->first); -// +// // Extrema_ExtCS x(GAC, GAS, getValue(GV_PRECISION), getValue(GV_PRECISION)); -// +// // if (x.IsParallel()) { // body_surface = kt->first; // layer_body_intersection = kt->second; @@ -1122,16 +1122,16 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } // } // } -// +// // if (body_surface.IsNull()) { // continue; // } -// +// // // Intersect vertical edge with ground plane for point. // GeomAPI_IntCS intersection2(layer_body_intersection, plane); // if (intersection2.IsDone() && intersection2.NbPoints() == 1) { // const gp_Pnt& layer_end_point = intersection2.Point(1); -// +// // // Intersect layerset surface with ground plane // GeomAPI_IntSS intersection3(surface, plane, 1.e-7); // if (intersection3.IsDone() && intersection3.NbLines() == 1) { @@ -1140,14 +1140,14 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // ShapeAnalysis_Curve sac; // gp_Pnt layer_end_point_projected; double layer_end_point_param; // sac.Project(layer_line, layer_end_point, 1e-3, layer_end_point_projected, layer_end_point_param, false); -// +// // // Move point inwards by distance from other layerset // GCPnts_AbscissaPoint dst(layer_line_adaptor, layer_offset, layer_end_point_param); // if (dst.IsDone()) { // // Convert parameter to point // gp_Pnt layer_fold_point; // layer_line->D0(dst.Parameter(), layer_fold_point); -// +// // GeomAPI_IntSS intersection4(body_surface, plane, 1.e-7); // if (intersection4.IsDone() && intersection4.NbLines() == 1) { // Handle_Geom_Curve body_trim_curve = intersection4.Line(1); @@ -1155,7 +1155,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // gp_Pnt layer_fold_point_projected; double layer_fold_point_param; // sac2.Project(body_trim_curve, layer_fold_point, 1.e-7, layer_fold_point_projected, layer_fold_point_param, false); // Handle_Geom_Curve fold_curve = new Geom_OffsetCurve(body_trim_curve->Reversed(), layer_fold_point_projected.Distance(layer_fold_point), gp::DZ()); -// +// // Handle_Geom_Surface fold_surface = new Geom_SurfaceOfLinearExtrusion(fold_curve, gp::DZ()); // result_vector->push_back(fold_surface); // folds_made = true; @@ -1163,15 +1163,15 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } // } // } -// +// // } -// +// // } // } -// +// // return folds_made; // } -// +// // IfcSchema::IfcRepresentation* ifcopenshell::geom::Kernel::find_representation(const IfcSchema::IfcProduct* product, const std::string& identifier) { // if (!product->Representation()) return 0; // IfcSchema::IfcProductRepresentation* prod_rep = product->Representation(); @@ -1183,12 +1183,12 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } // return 0; // } -// +// // const IfcSchema::IfcRepresentationptr ifcopenshell::geom::Kernel::find_item_carrying_style(const IfcSchema::IfcRepresentationptr item) { // if (item->StyledByItem()->size()) { // return item; // } -// +// // while (item->declaration().is(IfcSchema::IfcBooleanResult::Class())) { // // All instantiations of IfcBooleanOperand (type of FirstOperand) are subtypes of // // IfcGeometricRepresentationItem @@ -1197,24 +1197,24 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // return item; // } // } -// +// // // TODO: Ideally this would be done for other entities (such as IfcCsgSolid) as well. // // But neither are these very prevalent, nor does the current IfcOpenShell style // // mechanism enable to conveniently style subshapes, which would be necessary for // // distinctly styled union operands. -// +// // return item; // } -// +// // bool ifcopenshell::geom::Kernel::is_identity_transform(ifcopenshell::IfcBaseInterface* l) { // IfcSchema::IfcAxis2Placement2D* ax2d; // IfcSchema::IfcAxis2Placement3D* ax3d; -// +// // IfcSchema::IfcCartesianTransformationOperator2D* op2d; // IfcSchema::IfcCartesianTransformationOperator3D* op3d; // IfcSchema::IfcCartesianTransformationOperator2DnonUniform* op2dnonu; // IfcSchema::IfcCartesianTransformationOperator3DnonUniform* op3dnonu; -// +// // if ((op2dnonu = l->as()) != 0) { // gp_GTrsf2d gtrsf2d; // convert(op2dnonu, gtrsf2d); @@ -1243,18 +1243,18 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // throw ifcopenshell::exception("Invalid valuation for IfcAxis2Placement / IfcCartesianTransformationOperator"); // } // } -// +// // void ifcopenshell::geom::Kernel::set_conversion_placement_rel_to_type(const ifcopenshell::declaration* type) { // placement_rel_to_type_ = type; // } -// +// // void ifcopenshell::geom::Kernel::set_conversion_placement_rel_to_instance(const express::entity* instance) { // placement_rel_to_instance_ = instance; // } -// -// +// +// // namespace { -// +// // bool process_colour(IfcSchema::IfcColourRgb* colour, double* rgb) { // if (colour != 0) { // rgb[0] = colour->Red(); @@ -1263,7 +1263,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } // return colour != 0; // } -// +// // bool process_colour(IfcSchema::IfcNormalisedRatioMeasure* factor, double* rgb) { // if (factor != 0) { // const double f = *factor; @@ -1271,7 +1271,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } // return factor != 0; // } -// +// // bool process_colour(IfcSchema::IfcColourOrFactor* colour_or_factor, double* rgb) { // if (colour_or_factor == 0) { // return false; @@ -1283,11 +1283,11 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // return false; // } // } -// +// // } -// +// // #define Kernel POSTFIX_SCHEMA(Kernel) -// +// // std::shared_ptr ifcopenshell::geom::Kernel::internalize_surface_style(const std::pair& shading_styles) { // if (shading_styles.second == 0) { // return 0; @@ -1297,22 +1297,22 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // if (it != style_cache.end()) { // return it->second; // } -// -// +// +// // IfcSchema::IfcSurfaceStyle* style = shading_styles.first->as(); // IfcSchema::IfcSurfaceStyleShading* shading = shading_styles.second->as(); -// +// // std::shared_ptr surface_style_ptr; -// +// // if (style->Name()) { // surface_style_ptr.reset(new SurfaceStyle(surface_style_id, *style->Name())); // } else { // surface_style_ptr.reset(new SurfaceStyle(surface_style_id)); // } -// +// // std::shared_ptr surface_style_ptr_const = std::const_pointer_cast(surface_style_ptr); // SurfaceStyle& surface_style = *surface_style_ptr; -// +// // double rgb[3]; // if (process_colour(shading->SurfaceColour(), rgb)) { // surface_style.Diffuse().reset(SurfaceStyle::ColorComponent(rgb[0], rgb[1], rgb[2])); @@ -1353,11 +1353,11 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // } // return style_cache[surface_style_id] = surface_style_ptr_const; // } -// +// // std::shared_ptr ifcopenshell::geom::Kernel::get_style(const IfcSchema::IfcRepresentationptr item) { // return internalize_surface_style(get_surface_style(item)); // } -// +// // std::shared_ptr ifcopenshell::geom::Kernel::get_style(const IfcSchema::IfcMaterial* material) { // IfcSchema::IfcMaterialDefinitionRepresentation::list::ptr defs = material->HasRepresentation(); // for (IfcSchema::IfcMaterialDefinitionRepresentation::list::it jt = defs->begin(); jt != defs->end(); ++jt) { @@ -1376,14 +1376,14 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // auto material_style = std::make_shared(material->data().id(), material->Name()); // return style_cache[material->data().id()] = material_style; // } -// +// // void ifcopenshell::geom::Kernel::apply_layerset(std::vector& r, const ifcopenshell::geom::layerset_information& info) { // convert(info.layers); -// +// // if (info.layers.empty()) { // return; // } -// +// // if (axis_curve->DynamicType() == STANDARD_TYPE(Geom_Line)) { // Handle_Geom_Line axis_line = Handle_Geom_Line::DownCast(axis_curve); // // @todo note that this creates an offset into the wrong order, the cross product arguments should be @@ -1397,7 +1397,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol // ifcopenshell::logger::root().message(ifcopenshell::logger::LOG_ERROR, "Unsupported underlying curve of Axis representation:", product); // return false; // } -// +// // std::vector r2; // if (ifcopenshell::geom::util::apply_layerset(r, const std::vector&, std::vector& r2, double tol)) { // std::swap(r, r2) diff --git a/src/ifcgeom/kernels/opencascade/opencascade_kernel.h b/src/ifcgeom/kernels/opencascade/opencascade_kernel.h index 623246c243..858c9830ce 100644 --- a/src/ifcgeom/kernels/opencascade/opencascade_kernel.h +++ b/src/ifcgeom/kernels/opencascade/opencascade_kernel.h @@ -90,7 +90,7 @@ private: std::map, TopoDS_Edge> edges_; double eps_; bool non_manifold_; - + void loop_(const ifcopenshell::geom::taxonomy::loop::ptr ps, const std::function& callback); public: faceset_helper(open_cascade_kernel* kernel, const ifcopenshell::geom::taxonomy::shell::ptr l); @@ -99,7 +99,7 @@ private: bool non_manifold() const { return non_manifold_; } bool& non_manifold() { return non_manifold_; } double epsilon() const { return eps_; } - + bool edge(int A, int B, TopoDS_Edge& e); bool wire(const ifcopenshell::geom::taxonomy::loop::ptr loop, TopoDS_Wire& wire); diff --git a/src/ifcgeom/kernels/opencascade/solid.cpp b/src/ifcgeom/kernels/opencascade/solid.cpp index ff93693c63..712aa5ecd1 100644 --- a/src/ifcgeom/kernels/opencascade/solid.cpp +++ b/src/ifcgeom/kernels/opencascade/solid.cpp @@ -64,8 +64,8 @@ bool open_cascade_kernel::convert(const taxonomy::solid::ptr solid, TopoDS_Shape result = halfspace; return true; - } else if (solid->children.size() == 1 - && solid->children[0]->children.size() == 1 + } else if (solid->children.size() == 1 + && solid->children[0]->children.size() == 1 && solid->children[0]->children[0]->basis && solid->children[0]->children[0]->basis->kind() == taxonomy::SPHERE) { diff --git a/src/ifcgeom/kernels/opencascade/sweep_along_curve.cpp b/src/ifcgeom/kernels/opencascade/sweep_along_curve.cpp index 730823955a..af0e6e0163 100644 --- a/src/ifcgeom/kernels/opencascade/sweep_along_curve.cpp +++ b/src/ifcgeom/kernels/opencascade/sweep_along_curve.cpp @@ -126,7 +126,7 @@ bool open_cascade_kernel::convert(const taxonomy::sweep_along_curve::ptr scs, To } } } - + // Build the wire from curve, which is the directrix offset toward the origin // when applied_temporary_offset is set. Using scs->curve here left the wire // far from the origin yet still translated the result back by +mean, which @@ -155,11 +155,11 @@ bool open_cascade_kernel::convert(const taxonomy::sweep_along_curve::ptr scs, To } else { return false; } - + Handle(Geom_Surface) surface; if (scs->surface) { surface = convert_surface(scs->surface); - } + } gp_Trsf directrix; TopoDS_Wire wire = std::get(w); diff --git a/src/ifcgeom/kernels/opencascade/tree.h b/src/ifcgeom/kernels/opencascade/tree.h index 63d57c3d02..1835df93a2 100644 --- a/src/ifcgeom/kernels/opencascade/tree.h +++ b/src/ifcgeom/kernels/opencascade/tree.h @@ -201,12 +201,12 @@ namespace ifcopenshell::geom { box.corners[1][1] = static_cast(max_point[1] + 1e-5); box.corners[1][2] = static_cast(max_point[2] + 1e-5); /* - std::cout << "Ray " + std::cout << "Ray " << v_ray.origin[0] << " " << v_ray.origin[1] << " " << v_ray.origin[2] << " " << std::endl; - std::cout << "Box " + std::cout << "Box " << min_point[0] << " " << min_point[1] << " " << min_point[2] << " " @@ -864,7 +864,7 @@ namespace ifcopenshell::geom { if (dss.Value() <= extend) { distances_.push_back(dss.Value()); protrusion_distances_.push_back(max_distance_inside(B, A)); - } + } return dss.Value() <= extend; } } else { @@ -925,8 +925,8 @@ namespace ifcopenshell::geom { // Gap is assumed to be positive throughout the codebase, // but at least for IsOut() in the selector a negative // Gap should work as well. - b.SetGap(b.GetGap() + extend); - + b.SetGap(b.GetGap() + extend); + return select_box(b, completely_within); } @@ -956,7 +956,7 @@ namespace ifcopenshell::geom { double gap = B.GetGap(); gp_Pnt p1(x1 - gap, y1 - gap, z1 - gap); gp_Pnt p2(x2 + gap, y2 + gap, z2 + gap); - + if (!b.IsOut(p1) && !b.IsOut(p2)) { ts_filtered.push_back(*it); } @@ -1389,7 +1389,7 @@ namespace ifcopenshell::geom { if (extend > 0.0) { BRepExtrema_DistShapeShape dss(v, B); if (dss.Perform() && dss.NbSolution() >= 1 && dss.Value() <= extend) { - distances_.push_back(dss.Value()); + distances_.push_back(dss.Value()); protrusion_distances_.push_back(max_distance_inside(B, v)); ts_filtered.push_back(*it); @@ -1416,9 +1416,9 @@ namespace ifcopenshell::geom { spatial_tree tree_; shape_map shapes_; std::map aabbs_; - std::map obbs_; - std::map max_protrusions_; - std::map>> bvhs_; + std::map obbs_; + std::map max_protrusions_; + std::map>> bvhs_; std::unordered_map is_manifold_; std::unordered_map>> tris_; std::unordered_map> verts_; @@ -1433,7 +1433,7 @@ namespace ifcopenshell::geom { std::map> local_faces_; std::map> local_materials_; std::map> local_material_ids_; - + bool enable_face_styles_ = false; class selector : public spatial_tree::Selector @@ -1480,7 +1480,7 @@ namespace ifcopenshell::geom { opencascade_tree(ifcopenshell::geom::iterator& it) { add_file(it); - } + } void add_file(ifcopenshell::file& f, ifcopenshell::geom::settings settings) { ifcopenshell::geom::settings settings_ = settings; @@ -1509,7 +1509,7 @@ namespace ifcopenshell::geom { result.reserve(flat_list.size()); for (size_t i = 0; i < flat_list.size(); i += 3) { - vin << + vin << flat_list[i], flat_list[i + 1], flat_list[i + 2]; @@ -1576,7 +1576,7 @@ namespace ifcopenshell::geom { vs_transformed.push_back(p.Transformed(tr)); aabb.Add(vs_transformed.back()); } - + std::unordered_map, std::vector, boost::hash>> quantized_normal_counts; std::vector tri_areas; @@ -1631,7 +1631,7 @@ namespace ifcopenshell::geom { gp_Ax3 ax3; gp_Trsf trsf2; - + for (size_t attempt = 0; attempt < 2; ++attempt) { if (candidates.empty() || attempt == 1) { @@ -1673,7 +1673,7 @@ namespace ifcopenshell::geom { obb.SetZComponent(ax3.Direction(), halfsize.Z()); obb.SetCenter(cent.Transformed(trsf2.Inverted())); } - + const auto& t = elem->product(); const auto& matrix = elem->transformation().data(); const std::vector& elem_verts_local = elem->geometry().verts(); @@ -1744,7 +1744,7 @@ namespace ifcopenshell::geom { obbs_[t] = obb; max_protrusions_[t] = std::min(std::min(obb.XHSize(), obb.YHSize()), obb.ZHSize()) * 2; } - + void add_element(ifcopenshell::geom::native_element* elem) { if (!elem) { return; @@ -1753,7 +1753,7 @@ namespace ifcopenshell::geom { auto compound_generic = (ifcopenshell::geom::open_cascade_shape*)elem->geometry().as_compound(); TopoDS_Shape compound(std::move(compound_generic->shape())); delete compound_generic; - + const auto& m = elem->transformation().data()->ccomponents(); gp_Trsf tr; tr.SetValues( diff --git a/src/ifcgeom/kernels/opencascade/wire_utils.cpp b/src/ifcgeom/kernels/opencascade/wire_utils.cpp index 99ce27401a..4ee78a0006 100644 --- a/src/ifcgeom/kernels/opencascade/wire_utils.cpp +++ b/src/ifcgeom/kernels/opencascade/wire_utils.cpp @@ -381,7 +381,7 @@ namespace { bool ifcopenshell::geom::util::wire_intersections(const TopoDS_Wire& wire, NCollection_List& wires, const wire_tolerance_settings& settings) { double eps = get_wire_intersection_tolerance(settings, wire); double eps_real = settings.precision; - + if (!wire.Closed()) { wires.Append(wire); return false; @@ -576,7 +576,7 @@ void ifcopenshell::geom::util::select_largest(const NCollection_List(map(inst.Axis())); axis = *v->components_; } - + // @todo not sure what to do with ref, we're probably never reading it, // because we just created an Axis1 again from it in the kernel, but // to this constructor we need to supply something valid. diff --git a/src/ifcgeom/mapping/IfcBSplineCurveWithKnots.cpp b/src/ifcgeom/mapping/IfcBSplineCurveWithKnots.cpp index 751ad2b975..36fde6c9ce 100644 --- a/src/ifcgeom/mapping/IfcBSplineCurveWithKnots.cpp +++ b/src/ifcgeom/mapping/IfcBSplineCurveWithKnots.cpp @@ -27,12 +27,12 @@ using namespace ifcopenshell::geom; #ifdef SCHEMA_HAS_IfcBSplineCurveWithKnots taxonomy::ptr mapping::map_impl(const IfcSchema::IfcBSplineCurveWithKnots& inst) { auto bc = taxonomy::make(); - + const std::vector cps = inst.ControlPointsList(); std::vector points; std::transform(cps.begin(), cps.end(), std::back_inserter(points), [this](const IfcSchema::IfcCartesianPoint& cp) { return taxonomy::cast(map(cp)); }); bc->control_points = points; - + auto knot_multiplicities = inst.KnotMultiplicities(); bc->multiplicities.assign(knot_multiplicities.begin(), knot_multiplicities.end()); bc->knots = inst.Knots(); diff --git a/src/ifcgeom/mapping/IfcCenterLineProfileDef.cpp b/src/ifcgeom/mapping/IfcCenterLineProfileDef.cpp index fbb3ba34b6..cd332805fa 100644 --- a/src/ifcgeom/mapping/IfcCenterLineProfileDef.cpp +++ b/src/ifcgeom/mapping/IfcCenterLineProfileDef.cpp @@ -73,7 +73,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCenterLineProfileDef&) { mw.Add(BRepBuilderAPI_MakeEdge(c1a, c2a)); mw.Add(BRepBuilderAPI_MakeEdge(c2)); mw.Add(BRepBuilderAPI_MakeEdge(c2b, c1b)); - + face = BRepBuilderAPI_MakeFace(mw.Wire()); } else { BRepOffsetAPI_MakeOffset offset(BRepBuilderAPI_MakeFace(gp_Pln(gp::Origin(), gp::DZ()))); diff --git a/src/ifcgeom/mapping/IfcCircle.cpp b/src/ifcgeom/mapping/IfcCircle.cpp index c895669ef6..e639b0d129 100644 --- a/src/ifcgeom/mapping/IfcCircle.cpp +++ b/src/ifcgeom/mapping/IfcCircle.cpp @@ -23,7 +23,7 @@ using namespace ifcopenshell::geom; taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCircle& inst) { const double r = inst.Radius() * length_unit_; - if (r < settings_.get().get()) { + if (r < settings_.get().get()) { logger_.message(ifcopenshell::logger::LOG_ERROR, "GEO", 237, "Radius not greater than zero for:", inst); return nullptr; } diff --git a/src/ifcgeom/mapping/IfcCompositeCurve.cpp b/src/ifcgeom/mapping/IfcCompositeCurve.cpp index fcc0cd086f..dba438e6d6 100644 --- a/src/ifcgeom/mapping/IfcCompositeCurve.cpp +++ b/src/ifcgeom/mapping/IfcCompositeCurve.cpp @@ -31,7 +31,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve& inst) { #else std::vector segments = inst.Segments(); #endif - + for (auto& segment : segments) { if (segment.as() && segment.as().ParentCurve().as()) { logger_.notice("GEO", 238, "Infinite IfcLine used as ParentCurve of segment, treating as a segment", segment); diff --git a/src/ifcgeom/mapping/IfcCurveBoundedPlane.cpp b/src/ifcgeom/mapping/IfcCurveBoundedPlane.cpp index 4b2a7c2d84..97b6af9f43 100644 --- a/src/ifcgeom/mapping/IfcCurveBoundedPlane.cpp +++ b/src/ifcgeom/mapping/IfcCurveBoundedPlane.cpp @@ -25,7 +25,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCurveBoundedPlane& inst) { taxonomy::plane::ptr pl = taxonomy::cast(map(inst.BasisSurface())); auto f = taxonomy::make(); f->children.push_back(taxonomy::cast(map(inst.OuterBoundary()))); - + std::vector boundaries = inst.InnerBoundaries(); for (auto& b : boundaries) { diff --git a/src/ifcgeom/mapping/IfcCurveSegment.cpp b/src/ifcgeom/mapping/IfcCurveSegment.cpp index 849e0a0888..b9a0137d8d 100644 --- a/src/ifcgeom/mapping/IfcCurveSegment.cpp +++ b/src/ifcgeom/mapping/IfcCurveSegment.cpp @@ -133,7 +133,7 @@ struct spiral_parent_curve : public parent_curve_function { // this is the piecewise curve segment function for horizontal and vertical struct curve_segment_function { - curve_segment_function(const Eigen::Matrix4d& curve_segment_placement, const Eigen::Matrix4d& parent_curve_normalization, std::shared_ptr parent_curve_fn) : + curve_segment_function(const Eigen::Matrix4d& curve_segment_placement, const Eigen::Matrix4d& parent_curve_normalization, std::shared_ptr parent_curve_fn) : curve_segment_placement_(curve_segment_placement), parent_curve_normalization_(parent_curve_normalization), parent_curve_fn_(parent_curve_fn) { @@ -153,7 +153,7 @@ struct curve_segment_function { // this is the piecewise curve segment function for cant struct cant_curve_segment_function { - cant_curve_segment_function(const Eigen::Matrix4d& curve_segment_placement, const Eigen::Matrix4d& parent_curve_start_point, std::shared_ptr parent_curve_fn) : + cant_curve_segment_function(const Eigen::Matrix4d& curve_segment_placement, const Eigen::Matrix4d& parent_curve_start_point, std::shared_ptr parent_curve_fn) : curve_segment_placement_(curve_segment_placement), parent_curve_start_point_(parent_curve_start_point), parent_curve_fn_(parent_curve_fn) { @@ -354,7 +354,7 @@ class curve_segment_evaluator { } else { // The parent curve function returns the 4x4 matrix for the parent curve. // Normalize the parent curve so that the trim start point and tangent direction at the start point - // are aligned with the origin. This is accomplished with a normalization matrix that subtracts the + // are aligned with the origin. This is accomplished with a normalization matrix that subtracts the // incremental parent curve start point and applies a rotation. Apply the incremental // translation and rotation to the curve_segment_placement to get the curve_segment_point @@ -623,7 +623,7 @@ class curve_segment_evaluator { } else if (segment_type_ == ST_CANT) { std::optional> super, slope; std::tie(super, slope) = get_superelevation_functions(); - + auto cant = [constant_term, cosine_term, L](double t) -> double { auto a0 = constant_term.has_value() ? 1 / constant_term.value() : 0.0; auto a1 = (1 / cosine_term) * cos(PI * t / L); @@ -690,7 +690,7 @@ class curve_segment_evaluator { } else if (segment_type_ == ST_CANT) { std::optional> super, slope; std::tie(super, slope) = get_superelevation_functions(); - + auto cant = [constant_term, linear_term, sine_term, L](double t) -> double { auto a0 = constant_term.has_value() ? 1 / constant_term.value() : 0.0; auto a1 = linear_term.has_value() ? (linear_term.value()/fabs(linear_term.value())) * pow(1 / linear_term.value(), 2.0) * t : 0.0; @@ -825,7 +825,7 @@ class curve_segment_evaluator { #else A3 = c.QubicTerm(); #endif - + if (segment_type_ == ST_CANT) { polynomial_cant_spiral(A0, A1, A2, A3, A4, A5, A6, A7); } else { @@ -983,7 +983,7 @@ class curve_segment_evaluator { [](double /*u*/) -> Eigen::Matrix4d { return Eigen::Matrix4d::Identity(); }); } } - + void operator()(const IfcSchema::IfcLine& l) { projected_length_ = length_; @@ -995,8 +995,8 @@ class curve_segment_evaluator { // 8.9.3.30 IfcDirection https://standards.buildingsmart.org/IFC/RELEASE/IFC4_3/HTML/lexical/IfcDirection.htm // "The IfcDirection does not imply a vector length, and the direction ratios does not have to be normalized." // - // Therefore, the direction ratios need to be normalized to compute points on the line. - // + // Therefore, the direction ratios need to be normalized to compute points on the line. + // // Magnitude is not used because it relates to the parameterization of the line, which isn't currently done for IfcCurveSegment // @todo - parameterization was recently added so Magnitude needs to be taking into consideration auto dr = l.Dir().Orientation().DirectionRatios(); @@ -1030,7 +1030,7 @@ class curve_segment_evaluator { auto pcDZy = curve_segment_placement_ ? (*curve_segment_placement_)(1, 2) : 0.; auto pcDZz = curve_segment_placement_ ? (*curve_segment_placement_)(2, 2) : 1.; - + parent_curve_fn_ = std::make_shared( [segment_type = segment_type_,pcX, pcY, pcDXx, pcDXy, pcDZy, pcDZz, convert_u](double u)->Eigen::Matrix4d { u = convert_u(u); diff --git a/src/ifcgeom/mapping/IfcExtrudedAreaSolidTapered.cpp b/src/ifcgeom/mapping/IfcExtrudedAreaSolidTapered.cpp index e734da4ecb..7d4f152dc1 100644 --- a/src/ifcgeom/mapping/IfcExtrudedAreaSolidTapered.cpp +++ b/src/ifcgeom/mapping/IfcExtrudedAreaSolidTapered.cpp @@ -56,7 +56,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcExtrudedAreaSolidTapered& in if (has_position) { matrix = taxonomy::cast(map(inst.Position())); } - + loft->matrix = matrix; return loft; diff --git a/src/ifcgeom/mapping/IfcIndexedPolyCurve.cpp b/src/ifcgeom/mapping/IfcIndexedPolyCurve.cpp index 710c15dcaa..07728f3a1d 100644 --- a/src/ifcgeom/mapping/IfcIndexedPolyCurve.cpp +++ b/src/ifcgeom/mapping/IfcIndexedPolyCurve.cpp @@ -24,7 +24,7 @@ using namespace ifcopenshell::geom; #ifdef SCHEMA_HAS_IfcIndexedPolyCurve taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIndexedPolyCurve& inst) { - + auto point_list = inst.Points(); std::vector< std::vector > coordinates; if (point_list.as()) { @@ -100,7 +100,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcIndexedPolyCurve& inst) { previous = current; } } - + return loop; } diff --git a/src/ifcgeom/mapping/IfcLShapeProfileDef.cpp b/src/ifcgeom/mapping/IfcLShapeProfileDef.cpp index d0047fa2ce..2e3cec0a12 100644 --- a/src/ifcgeom/mapping/IfcLShapeProfileDef.cpp +++ b/src/ifcgeom/mapping/IfcLShapeProfileDef.cpp @@ -32,7 +32,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcLShapeProfileDef& inst) { const double x = inst.Width().value_or(inst.Depth()) / 2.0f * length_unit_; const double d = inst.Thickness() * length_unit_; const double slope = inst.LegSlope().value_or(0.) * angle_unit_; - + double f1 = 0.0f; double f2 = 0.0f; if (doFillet) { diff --git a/src/ifcgeom/mapping/IfcOffsetCurveByDistance.cpp b/src/ifcgeom/mapping/IfcOffsetCurveByDistance.cpp index 134dd1d396..340dedd1be 100644 --- a/src/ifcgeom/mapping/IfcOffsetCurveByDistance.cpp +++ b/src/ifcgeom/mapping/IfcOffsetCurveByDistance.cpp @@ -84,11 +84,11 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances& inst double pz = first_offset_value.OffsetVertical().value_or(0.0); py *= length_unit_; pz *= length_unit_; - - auto fn = [py, pz](double /*u*/) -> Eigen::Matrix4d { - Eigen::Matrix4d m = Eigen::Matrix4d::Identity(); - m.col(3)(1) = py; - m.col(3)(2) = pz; + + auto fn = [py, pz](double /*u*/) -> Eigen::Matrix4d { + Eigen::Matrix4d m = Eigen::Matrix4d::Identity(); + m.col(3)(1) = py; + m.col(3)(2) = pz; return m; }; offset_spans.emplace_back(taxonomy::make(first_distance, fn)); } @@ -146,7 +146,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances& inst zn = zn_at_end; } - + auto fn = [yp, yn, zp, zn, l](double u) -> Eigen::Matrix4d { Eigen::Matrix4d m = Eigen::Matrix4d::Identity(); m.col(3)(1) = (l == 0.0 ? yp : (yp + (yn - yp) * u / l)); @@ -171,10 +171,10 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances& inst py *= length_unit_; pz *= length_unit_; double l = basis_curve_length - last_distance; - auto fn = [py, pz](double /*u*/) -> Eigen::Matrix4d { - Eigen::Matrix4d m = Eigen::Matrix4d::Identity(); - m.col(3)(1) = py; - m.col(3)(2) = pz; + auto fn = [py, pz](double /*u*/) -> Eigen::Matrix4d { + Eigen::Matrix4d m = Eigen::Matrix4d::Identity(); + m.col(3)(1) = py; + m.col(3)(2) = pz; return m; }; offset_spans.emplace_back(taxonomy::make(l, fn)); diff --git a/src/ifcgeom/mapping/IfcOpenCrossProfileDef.cpp b/src/ifcgeom/mapping/IfcOpenCrossProfileDef.cpp index b81227d190..1ff3763903 100644 --- a/src/ifcgeom/mapping/IfcOpenCrossProfileDef.cpp +++ b/src/ifcgeom/mapping/IfcOpenCrossProfileDef.cpp @@ -87,7 +87,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOpenCrossProfileDef& inst) { auto r = taxonomy::loop::ptr((taxonomy::loop*)mapped->clone_()); r->closed = false; return r; - }*/ + }*/ mapped->closed = false; mapped->tags = tags; diff --git a/src/ifcgeom/mapping/IfcPlane.cpp b/src/ifcgeom/mapping/IfcPlane.cpp index 7d31bbc4c1..90518419bc 100644 --- a/src/ifcgeom/mapping/IfcPlane.cpp +++ b/src/ifcgeom/mapping/IfcPlane.cpp @@ -24,5 +24,5 @@ using namespace ifcopenshell::geom; taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPlane& inst) { auto p = taxonomy::make(); p->matrix = taxonomy::cast(map(inst.Position())); - return p; + return p; } diff --git a/src/ifcgeom/mapping/IfcPointByDistanceExpression.cpp b/src/ifcgeom/mapping/IfcPointByDistanceExpression.cpp index 29bbfd20c3..699604453e 100644 --- a/src/ifcgeom/mapping/IfcPointByDistanceExpression.cpp +++ b/src/ifcgeom/mapping/IfcPointByDistanceExpression.cpp @@ -45,7 +45,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPointByDistanceExpression& i if (inst.OffsetLateral().has_value()) { auto offset_lateral = inst.OffsetLateral().value() * length_unit_; - auto y = Eigen::Vector3d(m.col(1)(0), m.col(1)(1), m.col(1)(2)); + auto y = Eigen::Vector3d(m.col(1)(0), m.col(1)(1), m.col(1)(2)); o += offset_lateral * y; } diff --git a/src/ifcgeom/mapping/IfcPolyLoop.cpp b/src/ifcgeom/mapping/IfcPolyLoop.cpp index ca203d77f6..2230cc3a72 100644 --- a/src/ifcgeom/mapping/IfcPolyLoop.cpp +++ b/src/ifcgeom/mapping/IfcPolyLoop.cpp @@ -50,7 +50,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPolyLoop& inst) { int count = polygon.size(); if (original_count - count != 0) { - std::stringstream ss; ss << (original_count - count) << " edges removed for:"; + std::stringstream ss; ss << (original_count - count) << " edges removed for:"; logger_.message(ifcopenshell::logger::LOG_WARNING, "GEO", 280, ss.str(), inst); } diff --git a/src/ifcgeom/mapping/IfcPolygonalFaceSet.cpp b/src/ifcgeom/mapping/IfcPolygonalFaceSet.cpp index c56caeeae8..50b3406693 100644 --- a/src/ifcgeom/mapping/IfcPolygonalFaceSet.cpp +++ b/src/ifcgeom/mapping/IfcPolygonalFaceSet.cpp @@ -61,7 +61,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcPolygonalFaceSet& inst) { for (auto& f : polygonal_faces) { auto fa = taxonomy::make(); shell->children.push_back(fa); - + { auto loop = taxonomy::make(); fa->children = { loop }; diff --git a/src/ifcgeom/mapping/IfcProduct.cpp b/src/ifcgeom/mapping/IfcProduct.cpp index 8321bde2a0..c3e16bf718 100644 --- a/src/ifcgeom/mapping/IfcProduct.cpp +++ b/src/ifcgeom/mapping/IfcProduct.cpp @@ -44,7 +44,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcProduct& inst) { } if (openings->size() && !settings_.get(IteratorSettings::DISABLE_OPENING_SUBTRACTIONS) && use_body) { - + Eigen::Matrix4d ci; if (c->matrix.components_) { ci = c->matrix.components_->inverse(); @@ -69,7 +69,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcProduct& inst) { c->children = { child }; } else { delete c; - return nullptr; + return nullptr; } } diff --git a/src/ifcgeom/mapping/IfcRectangleHollowProfileDef.cpp b/src/ifcgeom/mapping/IfcRectangleHollowProfileDef.cpp index cc9d485aed..3c52f459a0 100644 --- a/src/ifcgeom/mapping/IfcRectangleHollowProfileDef.cpp +++ b/src/ifcgeom/mapping/IfcRectangleHollowProfileDef.cpp @@ -33,7 +33,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRectangleHollowProfileDef& i const double r1 = fr1 ? (*inst.OuterFilletRadius()) * length_unit_ : 0.; const double r2 = fr2 ? (*inst.InnerFilletRadius()) * length_unit_ : 0.; - + const double tol = settings_.get().get(); if (x < tol || y < tol) { diff --git a/src/ifcgeom/mapping/IfcRectangleProfileDef.cpp b/src/ifcgeom/mapping/IfcRectangleProfileDef.cpp index 324a19a55b..24f3a6ee1a 100644 --- a/src/ifcgeom/mapping/IfcRectangleProfileDef.cpp +++ b/src/ifcgeom/mapping/IfcRectangleProfileDef.cpp @@ -42,7 +42,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRectangleProfileDef& inst) { if (has_position) { m4 = taxonomy::cast(map(inst.Position())); } - + return profile_helper(m4, { {{-x,-y}}, {{x,-y}}, diff --git a/src/ifcgeom/mapping/IfcRevolvedAreaSolid.cpp b/src/ifcgeom/mapping/IfcRevolvedAreaSolid.cpp index e4dfdc92fd..6afeae7ad6 100644 --- a/src/ifcgeom/mapping/IfcRevolvedAreaSolid.cpp +++ b/src/ifcgeom/mapping/IfcRevolvedAreaSolid.cpp @@ -27,7 +27,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRevolvedAreaSolid& inst) { const double ang = inst.Angle() * angle_unit_; taxonomy::cast(map(inst.SweptArea())); - + std::optional angle; taxonomy::matrix4::ptr matrix; diff --git a/src/ifcgeom/mapping/IfcRightCircularCylinder.cpp b/src/ifcgeom/mapping/IfcRightCircularCylinder.cpp index aed54cd978..b783f30856 100644 --- a/src/ifcgeom/mapping/IfcRightCircularCylinder.cpp +++ b/src/ifcgeom/mapping/IfcRightCircularCylinder.cpp @@ -32,7 +32,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRightCircularCylinder&) { BRepPrimAPI_MakeCylinder builder(r, h); gp_Trsf trsf; ifcopenshell::geom::Kernel::convert(inst.Position(),trsf); - + // IfcCsgPrimitive3D.Position has unit scale factor shape = builder.Solid().Moved(trsf); diff --git a/src/ifcgeom/mapping/IfcSectionedSolidHorizontal.cpp b/src/ifcgeom/mapping/IfcSectionedSolidHorizontal.cpp index c775b44c09..eba582a951 100644 --- a/src/ifcgeom/mapping/IfcSectionedSolidHorizontal.cpp +++ b/src/ifcgeom/mapping/IfcSectionedSolidHorizontal.cpp @@ -38,7 +38,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSolidHorizontal& in return nullptr; } - { + { auto css = inst.CrossSections(); auto csps = inst.CrossSectionPositions(); std::vector faces; @@ -47,7 +47,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSolidHorizontal& in // reference frame along a certain curve location (b) the longitude. // The longitudes determine the range of the sweep and the offsets are interpolated in between - // sweep segments. + // sweep segments. std::vector profile_offsets; std::vector> profile_rotations; std::vector longitudes; diff --git a/src/ifcgeom/mapping/IfcSectionedSurface.cpp b/src/ifcgeom/mapping/IfcSectionedSurface.cpp index 4947663377..34eab74760 100644 --- a/src/ifcgeom/mapping/IfcSectionedSurface.cpp +++ b/src/ifcgeom/mapping/IfcSectionedSurface.cpp @@ -39,7 +39,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSurface& inst) { } - { + { auto css = inst.CrossSections(); auto csps = inst.CrossSectionPositions(); std::vector faces; @@ -48,7 +48,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSectionedSurface& inst) { // reference frame along a certain curve location (b) the longitude. // The longitudes determine the range of the sweep and the offsets are interpolated in between - // sweep segments. + // sweep segments. std::vector profile_offsets; std::vector> profile_rotations; std::vector longitudes; diff --git a/src/ifcgeom/mapping/IfcSegmentedReferenceCurve.cpp b/src/ifcgeom/mapping/IfcSegmentedReferenceCurve.cpp index 0c1de6e35a..1abc9afdf5 100644 --- a/src/ifcgeom/mapping/IfcSegmentedReferenceCurve.cpp +++ b/src/ifcgeom/mapping/IfcSegmentedReferenceCurve.cpp @@ -28,7 +28,7 @@ using namespace ifcopenshell::geom; taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSegmentedReferenceCurve& inst) { if (!inst.BaseCurve().as()) logger_.warning("GEO", 291, "Expected IfcSegmentedReferenceCurve.BaseCurve to be IfcGradient", inst); // CT 4.1.7.1.1.3 - + auto segments = inst.Segments(); taxonomy::piecewise_function::span_list spans; diff --git a/src/ifcgeom/mapping/IfcSweptDiskSolid.cpp b/src/ifcgeom/mapping/IfcSweptDiskSolid.cpp index b8e764df69..26ee73048f 100644 --- a/src/ifcgeom/mapping/IfcSweptDiskSolid.cpp +++ b/src/ifcgeom/mapping/IfcSweptDiskSolid.cpp @@ -97,9 +97,9 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) { return taxonomy::make(taxonomy::make(), f, nullptr, loop); - + /* - + TopoDS_Wire wire, section1, section2; bool hasInnerRadius = !!inst.InnerRadius(); @@ -107,7 +107,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) { if (!convert_wire(inst.Directrix(), wire)) { return false; } - + if (util::count(wire, TopAbs_EDGE) == 1 && sp && ep) { @@ -119,7 +119,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) { double a, b; auto crv = BRep_Tool::Curve(e, a, b); if ((crv->DynamicType() == STANDARD_TYPE(Geom_Circle)) || - (crv->DynamicType() == STANDARD_TYPE(Geom_Ellipse))) + (crv->DynamicType() == STANDARD_TYPE(Geom_Ellipse))) { BRepBuilderAPI_MakeEdge me(crv, *sp, *ep); if (me.IsDone()) { @@ -227,7 +227,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) { j += 1; } else { ifcopenshell::logger::root().error("Unexpected amount of fillet edges generated"); - } + } } else { ifcopenshell::logger::root().error("Unable to build fillet, probably edge too short"); } @@ -258,7 +258,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSweptDiskSolid& inst) { // NB: Note that StartParam and EndParam param are ignored and the assumption is // made that the parametric range over which to be swept matches the IfcCurve in // its entirety. - + util::process_sweep(wire, inst.Radius() * length_unit_, shape); if (shape.IsNull()) { diff --git a/src/ifcgeom/mapping/IfcTShapeProfileDef.cpp b/src/ifcgeom/mapping/IfcTShapeProfileDef.cpp index a3058016b8..7680f86f5b 100644 --- a/src/ifcgeom/mapping/IfcTShapeProfileDef.cpp +++ b/src/ifcgeom/mapping/IfcTShapeProfileDef.cpp @@ -43,7 +43,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTShapeProfileDef& inst) { logger_.message(ifcopenshell::logger::LOG_NOTICE, "GEO", 296, "Skipping zero sized profile:", inst); return nullptr; } - + double dy1 = 0.0f; double dy2 = 0.0f; double dx1 = 0.0f; diff --git a/src/ifcgeom/mapping/IfcTrimmedCurve.cpp b/src/ifcgeom/mapping/IfcTrimmedCurve.cpp index a2bcdb84f2..23913a0427 100644 --- a/src/ifcgeom/mapping/IfcTrimmedCurve.cpp +++ b/src/ifcgeom/mapping/IfcTrimmedCurve.cpp @@ -29,21 +29,21 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcTrimmedCurve& inst) { auto basis_curve = inst.BasisCurve(); bool isConic = basis_curve.declaration().is(IfcSchema::IfcConic::Class()); double parameterFactor = isConic ? angle_unit_ : length_unit_; - + auto tc = taxonomy::make(); tc->basis = map(inst.BasisCurve()); - + bool trim_cartesian = inst.MasterRepresentation() != IfcSchema::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER; auto trims1 = inst.Trim1(); auto trims2 = inst.Trim2(); - + // reversed orientation handling happens in geometry kernel unsigned sense_agreement = 0; double flts[2]; taxonomy::point3::ptr pnts[2]; bool has_flts[2] = {false,false}; bool has_pnts[2] = {false,false}; - + tc->curve_sense = inst.SenseAgreement(); for (auto it = trims1.begin(); it != trims1.end(); it ++) { diff --git a/src/ifcgeom/mapping/IfcUShapeProfileDef.cpp b/src/ifcgeom/mapping/IfcUShapeProfileDef.cpp index 7fbae0105c..223fae3cb9 100644 --- a/src/ifcgeom/mapping/IfcUShapeProfileDef.cpp +++ b/src/ifcgeom/mapping/IfcUShapeProfileDef.cpp @@ -33,7 +33,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcUShapeProfileDef& inst) { const double d1 = inst.WebThickness() * length_unit_; const double d2 = inst.FlangeThickness() * length_unit_; const double slope = inst.FlangeSlope().value_or(0.) * angle_unit_; - + double dy1 = 0.0f; double dy2 = 0.0f; double f1 = 0.0f; diff --git a/src/ifcgeom/mapping/IfcZShapeProfileDef.cpp b/src/ifcgeom/mapping/IfcZShapeProfileDef.cpp index 298870a379..8b97b073ab 100644 --- a/src/ifcgeom/mapping/IfcZShapeProfileDef.cpp +++ b/src/ifcgeom/mapping/IfcZShapeProfileDef.cpp @@ -31,7 +31,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcZShapeProfileDef& inst) { bool doFillet = !!inst.FilletRadius(); bool doEdgeFillet = !!inst.EdgeRadius(); - + double f1 = 0.; double f2 = 0.; diff --git a/src/ifcgeom/mapping/mapping.cpp b/src/ifcgeom/mapping/mapping.cpp index b5c8f19696..1cfa680123 100644 --- a/src/ifcgeom/mapping/mapping.cpp +++ b/src/ifcgeom/mapping/mapping.cpp @@ -69,7 +69,7 @@ std::vector mapping::products_represented_by(const IfcSch auto invs = prodrep.file()->get_inverse(prodrep.id(), &IfcSchema::IfcProduct::Class(), -1); for (auto& inv : invs) { products.push_back(inv.as()); - } + } } if (only_direct) { @@ -169,7 +169,7 @@ bool mapping::reuse_ok_(const std::vector& products) { std::vector mapping::find_openings(const express::base& inst) { std::vector openings; - + if (auto rep = inst.as()) { // @todo this is essentially only for hybrid kernel trying to guess // when not to use a simple kernel. @@ -246,11 +246,11 @@ void mapping::get_representations(std::vector& tasks, int task_index = 0; std::set products_seen; - + for (auto representation : representations) { IfcSchema::IfcRepresentationMap rmap; std::vector ifcproducts = filter_products(products_represented_by(representation, rmap, false), filters); - + if (ifcproducts.empty()) { continue; } @@ -838,7 +838,7 @@ express::base mapping::get_decomposing_entity(const express::base& inst, bool in for (auto it = parents.begin(); it != parents.end(); ++it) { IfcSchema::IfcRelDecomposes decompose = (*it).as(); express::base ifc_objectdef; - + ifc_objectdef = get_RelatingObject(decompose); if (!ifc_objectdef || product == ifc_objectdef) continue; @@ -871,7 +871,7 @@ void mapping::initialize_units_() { length_unit_ = 1.; angle_unit_ = -1.; length_unit_name_ = "METER"; - + #ifdef SCHEMA_HAS_IfcContext auto projects = file_->instances_by_type(); #else @@ -1133,7 +1133,7 @@ bool mapping::get_layerset_information(const express::base& p, layerset_informat std::vector extrusions; for (auto& r : resources) { if (auto ex = r.as()) { - extrusions.push_back(ex); + extrusions.push_back(ex); } } @@ -1209,7 +1209,7 @@ bool mapping::get_layerset_information(const express::base& p, layerset_informat } - + return true; } diff --git a/src/ifcgeom/mapping/mapping.h b/src/ifcgeom/mapping/mapping.h index 16bfbe4cf4..735384e94e 100644 --- a/src/ifcgeom/mapping/mapping.h +++ b/src/ifcgeom/mapping/mapping.h @@ -16,7 +16,7 @@ namespace ifcopenshell { namespace geom { - + class POSTFIX_SCHEMA(mapping) : public abstract_mapping { private: ifcopenshell::file* file_; @@ -30,7 +30,7 @@ namespace geom { const express::base placement_rel_to_instance_; Eigen::Matrix4d offset_and_rotation_ = Eigen::Matrix4d::Identity(); - + void initialize_units_(); void addRepresentationsFromContextIds(std::vector&); void addRepresentationsFromPriorities(std::vector&); @@ -136,7 +136,7 @@ namespace geom { template <> struct element_type { typedef taxonomy::shell type; - }; + }; template typename U::ptr map_to_collection(POSTFIX_SCHEMA(mapping)* m, const T& ts) { diff --git a/src/ifcgeom/mapping/mapping.i b/src/ifcgeom/mapping/mapping.i index 8766238dc3..c2c3226b8f 100644 --- a/src/ifcgeom/mapping/mapping.i +++ b/src/ifcgeom/mapping/mapping.i @@ -182,4 +182,4 @@ BIND(IfcSurfaceStyle); // -> style #ifdef SCHEMA_HAS_IfcCurveSegment BIND(IfcCurveSegment); -#endif \ No newline at end of file +#endif diff --git a/src/ifcgeom/profile_helper.cpp b/src/ifcgeom/profile_helper.cpp index bbb450849e..d6e53732d3 100644 --- a/src/ifcgeom/profile_helper.cpp +++ b/src/ifcgeom/profile_helper.cpp @@ -7,8 +7,8 @@ taxonomy::loop::ptr ifcopenshell::geom::fillet_loop(taxonomy::loop::ptr loop, do const auto child_count = static_cast(loop->children.size()); for (int b = 0; b < child_count; ++b) { int c = (b + child_count - 1) % child_count; - pps[b] = { - std::get(loop->children[c]->start)->ccomponents(), + pps[b] = { + std::get(loop->children[c]->start)->ccomponents(), radius, loop->children[c], loop->children[b] }; } @@ -227,7 +227,7 @@ std::pair, std::vector> if (equal) { // do not remove the first or last point to // maintain connectivity with other wires - + /* // Only removing direct equality so does not impact connectivity if ((closed && j == 0) || (!closed && j == (n - 1))) { diff --git a/src/ifcgeom/representation.cpp b/src/ifcgeom/representation.cpp index 54de50688f..80ce1d174f 100644 --- a/src/ifcgeom/representation.cpp +++ b/src/ifcgeom/representation.cpp @@ -121,7 +121,7 @@ ifcopenshell::geom::triangulation::triangulation(const native& shape_model) , weld_offset_(0) { for (std::vector::const_iterator iit = shape_model.begin(); iit != shape_model.end(); ++iit) { - + // Don't weld vertices that belong to different items to prevent non-manifold situations. resetWelds(); diff --git a/src/ifcgeom/representation.h b/src/ifcgeom/representation.h index 434164b476..6b94020e28 100644 --- a/src/ifcgeom/representation.h +++ b/src/ifcgeom/representation.h @@ -108,7 +108,7 @@ namespace ifcopenshell::geom { std::vector faces_; std::vector> polyhedral_faces_without_holes_; std::vector>> polyhedral_faces_with_holes_; - + std::vector edges_; std::vector normals_; std::vector uvs_; diff --git a/src/ifcgeom/serialization/schema/serialization.cpp b/src/ifcgeom/serialization/schema/serialization.cpp index b4b657c869..5139182837 100644 --- a/src/ifcgeom/serialization/schema/serialization.cpp +++ b/src/ifcgeom/serialization/schema/serialization.cpp @@ -162,7 +162,7 @@ int convert_to_ifc(ifcopenshell::file& f, const opencascade::handle& el.setSemiAxis1(ellipse->MajorRadius()); el.setSemiAxis2(ellipse->MinorRadius()); curve = el; - + return 1; } #ifdef SCHEMA_HAS_IfcRationalBSplineSurfaceWithKnots @@ -461,11 +461,11 @@ int convert_to_ifc(ifcopenshell::file& f, const TopoDS_Edge& e, IfcSchema::IfcEd IfcSchema::IfcEdge edge2 = f.create(); edge2.setEdgeStart(vertex1); edge2.setEdgeEnd(vertex2); - + auto ori = f.create(); ori.setEdgeElement(edge2); ori.setOrientation(true); - + edge = ori; return 1; } else { diff --git a/src/ifcgeom/taxonomy.h b/src/ifcgeom/taxonomy.h index d2a224b584..960e3641a4 100644 --- a/src/ifcgeom/taxonomy.h +++ b/src/ifcgeom/taxonomy.h @@ -620,7 +620,7 @@ typedef item const* ptr; struct equal_functor { bool operator()(taxonomy::item::ptr const& a, - taxonomy::item::ptr const& b) const + taxonomy::item::ptr const& b) const { if (a == b) { return true; diff --git a/src/ifcgeomserver/IfcGeomServer.cpp b/src/ifcgeomserver/IfcGeomServer.cpp index 53528d569c..8bf47c6042 100644 --- a/src/ifcgeomserver/IfcGeomServer.cpp +++ b/src/ifcgeomserver/IfcGeomServer.cpp @@ -106,7 +106,7 @@ std::string format_json(const double& d) { template <> std::string format_json(const gp_Dir& d) { std::stringstream ss; - ss << std::setprecision(std::numeric_limits::digits10) + ss << std::setprecision(std::numeric_limits::digits10) << "[" << d.X() << "," << d.Y() << "," << d.Z() << "]"; return ss.str(); } @@ -311,7 +311,7 @@ protected: m(3,0), m(3,1), m(3,2), m(3,3) }; swrite(s, std::string((char*)matrix_array, 16 * sizeof(double))); - + // The first bit of the string is always the instance name of the representation. const std::string& representation_id = geom->geometry().id(); const int integer_representation_id = atoi(representation_id.c_str()); @@ -326,13 +326,13 @@ protected: indices.reserve(faces.size()); for (std::vector::const_iterator it = faces.begin(); it != faces.end(); ++it) { indices.push_back(*it); - } + } swrite_array(s, indices); if (append_line_data) { std::vector lines; std::set faces_set (indices.begin(), indices.end()); - + const std::vector& edges = geom->geometry().edges(); for ( std::vector::const_iterator it = edges.begin(); it != edges.end(); ) { const int32_t i1 = *(it++); @@ -349,7 +349,7 @@ protected: swrite_array(s, lines); } } - { + { // We remove the blanks here from the material array. I.e. materials without a diffuse color std::vector > > diffuse_color_array; for (auto it = geom->geometry().materials().begin(); it != geom->geometry().materials().end(); ++it) { @@ -369,7 +369,7 @@ protected: std::map orig_to_condensed_index_map; std::vector diffuse_color_array_condensed; - + int new_index = 0; for (size_t orig = 0; orig < diffuse_color_array.size(); ++orig) { auto& material = diffuse_color_array[orig]; @@ -470,13 +470,13 @@ private: const ifcopenshell::geom::native_element* elem_; public: QuantityWriter_v0(const ifcopenshell::geom::native_element* elem) : - elem_(elem) + elem_(elem) { put_json(TOTAL_SURFACE_AREA, 0.); put_json(TOTAL_SHAPE_VOLUME, 0.); if (elem_->type() == "IfcSpace") { put_json(WALKABLE_SURFACE_AREA, 0.); - } + } } }; @@ -548,7 +548,7 @@ public: }; int main () { - // Redirect stdout to this stream, so that involuntary + // Redirect stdout to this stream, so that involuntary // writes to stdout do not interfere with our protocol. std::ostringstream oss; stdout_redir = oss.rdbuf(); @@ -672,7 +672,7 @@ int main () { } } default: - exit_code = 1; + exit_code = 1; break; } break; diff --git a/src/ifcmax/IfcMax.cpp b/src/ifcmax/IfcMax.cpp index 80a48ffad2..ba541df190 100644 --- a/src/ifcmax/IfcMax.cpp +++ b/src/ifcmax/IfcMax.cpp @@ -276,7 +276,7 @@ int IFCImp::DoImport(const TCHAR *name, ImpInterface *impitfc, Interface *itfc, const int v1 = o->geometry().faces()[3*i+0]; const int v2 = o->geometry().faces()[3*i+1]; const int v3 = o->geometry().faces()[3*i+2]; - + const edge_t e1((std::min)(v1, v2), (std::max)(v1, v2)); const edge_t e2((std::min)(v2, v3), (std::max)(v2, v3)); const edge_t e3((std::min)(v3, v1), (std::max)(v3, v1)); @@ -294,7 +294,7 @@ int IFCImp::DoImport(const TCHAR *name, ImpInterface *impitfc, Interface *itfc, } tri->mesh.faces[i].setMatID(mtlid); } - + tri->mesh.buildNormals(); // Either use this or undefine the FACESETS_AS_COMPOUND option in IfcGeom.h to have // properly oriented normals. Using only the line below will result in a consistent @@ -322,6 +322,6 @@ int IFCImp::DoImport(const TCHAR *name, ImpInterface *impitfc, Interface *itfc, } while (iterator.next()); itfc->ProgressEnd(); - + return true; } diff --git a/src/ifcmax/IfcMax.h b/src/ifcmax/IfcMax.h index 19a89d9da0..7ec3f66cb2 100644 --- a/src/ifcmax/IfcMax.h +++ b/src/ifcmax/IfcMax.h @@ -24,7 +24,7 @@ extern ClassDesc* GetIFCImpDesc(); -class IFCImp : public SceneImport +class IFCImp : public SceneImport { public: int ExtCount(); // = 1 diff --git a/src/ifcparse/alignment_helper.cpp b/src/ifcparse/alignment_helper.cpp index 814bb6788f..7711d6e001 100644 --- a/src/ifcparse/alignment_helper.cpp +++ b/src/ifcparse/alignment_helper.cpp @@ -193,11 +193,11 @@ std::tuple, std::vector(); alignment_segment.setGlobalId(ifcopenshell::global_id()); alignment_segment.setDesignParameters(design_parameters); - + horizontal_segments.push_back(alignment_segment); if (include_geometry) { auto segment = mapAlignmentHorizontalSegment(file, design_parameters).first; @@ -238,7 +238,7 @@ Ifc4x3_add2::IfcAlignment addHorizontalAlignment(hierarchy_helper& // Ifc4x3_add2::IfcLocalPlacement placement; Ifc4x3_add2::IfcProductDefinitionShape product_definition_shape; - if (include_geometry) { + if (include_geometry) { // create the footprint representation auto axis_model_representation_subcontext = file.getRepresentationSubContext("Axis", "Model"); auto footprint_shape_representation = file.create(); @@ -246,7 +246,7 @@ Ifc4x3_add2::IfcAlignment addHorizontalAlignment(hierarchy_helper& footprint_shape_representation.setRepresentationIdentifier("FootPrint"); footprint_shape_representation.setRepresentationType("Curve2D"); footprint_shape_representation.setItems(std::vector{composite_curve}); - + placement = file.addLocalPlacement(); // the alignment has a plan view footprint representation // create the alignment product definition @@ -263,7 +263,7 @@ Ifc4x3_add2::IfcAlignment addHorizontalAlignment(hierarchy_helper& alignment.setGlobalId(ifcopenshell::global_id()); alignment.setName(alignment_name); alignment.setObjectPlacement(placement); - alignment.setRepresentation(product_definition_shape); + alignment.setRepresentation(product_definition_shape); return alignment; } @@ -429,13 +429,13 @@ Ifc4x3_add2::IfcAlignment addAlignment(hierarchy_helper& file, cons auto vertical_profile = file.create(); vertical_profile.setGlobalId(ifcopenshell::global_id()); vertical_profile.setName(alignment_name + "- Vertical"); - + auto nests_vertical_segments = file.create(); nests_vertical_segments.setGlobalId(ifcopenshell::global_id()); nests_vertical_segments.setName("Nests vertical alignment segments with vertical alignment"); nests_vertical_segments.setRelatingObject(vertical_profile); nests_vertical_segments.setRelatedObjects(vertical_segments); - + Ifc4x3_add2::IfcLocalPlacement placement; Ifc4x3_add2::IfcProductDefinitionShape product_definition_shape; if (include_geometry) { @@ -475,7 +475,7 @@ Ifc4x3_add2::IfcAlignment addAlignment(hierarchy_helper& file, cons alignment.setName(alignment_name); alignment.setObjectPlacement(placement); alignment.setRepresentation(product_definition_shape); - + // Nest the IfcAlignmentHorizontal and IfcAlignmentVertical with the IfcAlignment to complete the business logic // 4.1.4.4.1 Alignments nest horizontal and vertical layouts // https://standards.buildingsmart.org/IFC/RELEASE/IFC4_3/HTML/concepts/Object_Composition/Nesting/Alignment_Layouts/content.html @@ -856,7 +856,7 @@ std::pair mapAlignme } else { logger.error(std::string("unexpected AlignmentVerticalSegmentType encountered")); } - + return result; } diff --git a/src/ifcparse/entity_instance_data.cpp b/src/ifcparse/entity_instance_data.cpp index e42b504f1b..b5d38d4280 100644 --- a/src/ifcparse/entity_instance_data.cpp +++ b/src/ifcparse/entity_instance_data.cpp @@ -64,7 +64,7 @@ namespace { !std::is_same_v, express::base>) { std::string str; - array_.db_ptr->db->Get(rocksdb::ReadOptions{}, + array_.db_ptr->db->Get(rocksdb::ReadOptions{}, (is_header ? "h|" : (entity_or_type->as_entity() ? "i|" : "t|")) + (is_header ? entity_or_type->name() : std::to_string(instance_name_)) + "|" + std::to_string(index_), &str); @@ -132,7 +132,7 @@ namespace { } return (size_t) str[0] - 'A'; } -#endif +#endif throw std::logic_error("RocksDB storage is unavailable"); } } @@ -347,7 +347,7 @@ bool ::impl::serialize(std::string& val, const std::vector>>()); - + auto write_size = [&oss](size_t sz) { std::string size_str; size_str.resize(sizeof(size_t)); @@ -477,7 +477,7 @@ bool ::impl::deserialize(ifcopenshell::impl::rocks_db_file_storage* storage, con size_t inner_size; memcpy(&inner_size, ptr, sizeof(size_t)); ptr += sizeof(size_t); - + if (ptr + inner_size * (sizeof(size_t) + 1) > val.data() + val.size()) { return false; } @@ -533,7 +533,7 @@ void rocks_db_attribute_storage::set(void* storage, const ifcopenshell::declarat rdb_storage->db->Put( rdb_storage->wopts, (is_header ? "h|" : (decl->as_entity() ? "i|" : "t|")) + - (is_header ? decl->name() : std::to_string(identity)) + "|" + + (is_header ? decl->name() : std::to_string(identity)) + "|" + std::to_string(index), v); } diff --git a/src/ifcparse/express.h b/src/ifcparse/express.h index 409bb3cab0..c41e5a59aa 100644 --- a/src/ifcparse/express.h +++ b/src/ifcparse/express.h @@ -119,7 +119,7 @@ class IFC_PARSE_API base { void set_attribute_value(size_t attribute_index, const express::base& value); void set_attribute_value(const std::string& attribute_name, const express::base& value); - + void unset_attribute_value(size_t attribute_index); ifcopenshell::attribute_value get_attribute_value(size_t attribute_index) const; @@ -152,7 +152,7 @@ class IFC_PARSE_API base { } else { return T{}; } - } + } } ifcopenshell::file* file() const; diff --git a/src/ifcparse/file.cpp b/src/ifcparse/file.cpp index 354117fd4c..dc6a313880 100644 --- a/src/ifcparse/file.cpp +++ b/src/ifcparse/file.cpp @@ -51,7 +51,7 @@ express::base ifcopenshell::impl::rocks_db_file_storage::assert_existance(size_t return express::base(it->second); } } - + std::string v; rocksdb::Status s = db->Get(rocksdb::ReadOptions{}, (r == entityinstance_ref ? "i|" : "t|") + std::to_string(number) + "|_", &v); @@ -377,7 +377,7 @@ express::base ifcopenshell::impl::in_memory_file_storage::create(const ifcopensh } else { tbyid_.insert({data->identity(), data}); } - + express::base inst(data); add_type_ref(inst); @@ -414,4 +414,3 @@ express::base ifcopenshell::file::create(const ifcopenshell::declaration* decl, } }, storage_); } - diff --git a/src/ifcparse/file.h b/src/ifcparse/file.h index b63f755d0f..bca196f98a 100644 --- a/src/ifcparse/file.h +++ b/src/ifcparse/file.h @@ -428,7 +428,7 @@ public: express::base create(const ifcopenshell::declaration* declaration, int instance_id = -1); void batch() { - batch_mode_ = true; + batch_mode_ = true; } void unbatch(); diff --git a/src/ifcparse/hierarchy_helper.h b/src/ifcparse/hierarchy_helper.h index 6205a3c1d9..bd408508e2 100644 --- a/src/ifcparse/hierarchy_helper.h +++ b/src/ifcparse/hierarchy_helper.h @@ -103,7 +103,7 @@ class IFC_SCHEMA_API hierarchy_helper : public ifcopenshell::file { auto t = create(); t.set_attribute_value(0, std::vector{x, y}); return t; - } + } template T addValue(U value) { diff --git a/src/ifcparse/hierarchy_helper.i b/src/ifcparse/hierarchy_helper.i index 245033ec5b..aaa8f16bed 100644 --- a/src/ifcparse/hierarchy_helper.i +++ b/src/ifcparse/hierarchy_helper.i @@ -114,7 +114,7 @@ typename Schema::IfcOwnerHistory hierarchy_helper::addOwnerHistory() { owner_hist.setLastModifyingUser(person_and_org); owner_hist.setLastModifyingApplication(application); owner_hist.setCreationDate(timestamp); - + return owner_hist; } @@ -151,7 +151,7 @@ typename Schema::IfcProject hierarchy_helper::addProject(typename Schema unit2.setUnitType(Schema::IfcUnitEnum::IfcUnit_PLANEANGLEUNIT); unit2.setName("Degrees"); unit2.setConversionFactor(unit2b); - + std::vector units = {unit1, unit2}; auto unit_assignment = create(); unit_assignment.setUnits(units); @@ -317,7 +317,7 @@ void hierarchy_helper::addExtrudedPolyline(typename Schema::IfcShapeRepr solid.setPosition(place2 ? place2 : addPlacement3d()); solid.setExtrudedDirection(dir ? dir : addTriplet(0, 0, 1)); solid.setDepth(h); - + std::vector items; try { auto existing_items = rep.Items(); @@ -372,7 +372,7 @@ template void hierarchy_helper::addAxis( typename Schema::IfcShapeRepresentation rep, double l, - typename Schema::IfcRepresentationContext /*context*/) + typename Schema::IfcRepresentationContext /*context*/) { auto p1 = addDoublet(-l / 2., 0.); auto p2 = addDoublet(+l / 2., 0.); @@ -402,7 +402,7 @@ typename Schema::IfcProductDefinitionShape hierarchy_helper::addBox(doub auto shape = create(); shape.setRepresentations(std::vector{rep}); - + addBox(rep, w, d, h, place, place2, dir, context); return shape; } diff --git a/src/ifcparse/instance_data.h b/src/ifcparse/instance_data.h index 029da0f5ed..7d4061d567 100644 --- a/src/ifcparse/instance_data.h +++ b/src/ifcparse/instance_data.h @@ -301,7 +301,7 @@ namespace impl { bool serialize(std::string& buffer, const boost::logic::tribool& value); bool serialize(std::string& buffer, const boost::dynamic_bitset<>& value); - + bool serialize(std::string& buffer, const express::base& value); bool serialize(std::string& buffer, const ifcopenshell::enumeration_reference& value); diff --git a/src/ifcparse/parse.cpp b/src/ifcparse/parse.cpp index 18053da370..f76f783150 100644 --- a/src/ifcparse/parse.cpp +++ b/src/ifcparse/parse.cpp @@ -1085,7 +1085,7 @@ void ifcopenshell::impl::rocks_db_file_storage::register_inverse(unsigned id_fro uint32_t v = id_from; s.resize(sizeof(uint32_t)); memcpy(s.data(), &v, sizeof(uint32_t)); - + auto key = "v|" + to_string_fixed_width(inst_id, 10) + "|" + to_string_fixed_width(from_entity->index_in_schema(), 4) + "|" + to_string_fixed_width(attribute_index, 2); db->Merge(wopts, key, s); @@ -1143,7 +1143,7 @@ void ifcopenshell::impl::rocks_db_file_storage::add_type_ref(const express::base // no merges yet, because the python client doesn't support them db->Merge(wopts, "t|" + std::to_string(new_entity.declaration().index_in_schema()), s); - + /*{ std::string current; // @todo this uses the same key-namespace as typedecl instances, not a direct conflict, but also not very clear @@ -1151,7 +1151,7 @@ void ifcopenshell::impl::rocks_db_file_storage::add_type_ref(const express::base db->Get(rocksdb::ReadOptions{}, key, ¤t); auto new_val = current + s; db->Put(wopts, key, new_val); - }*/ + }*/ } // not only mapping also register type @@ -1639,7 +1639,7 @@ express::base::set_attribute_value(size_t i, const T& t) { register_inverse_visitor visitor(*file(), *this); apply_individual_instance_visitor(new_attribute, (int)i).apply(visitor); } - + // Register new attribute guid in guid map if (i == 0 && (file()->ifcroot_type() != nullptr) && this->declaration().is(*file()->ifcroot_type())) { try { @@ -1800,7 +1800,7 @@ file::file(void* data, int length, ifcopenshell::logger& log) , max_id_(0) { file_reader s(std::string((char*)data, length), caller_fed_tag{}); - + storage_.emplace<1>(this, logger_.get()); header_.reset(new spf_header(this, &logger_.get())); std::get(storage_).read_from_stream(&s, schema_, max_id_, types_to_bypass_loading_); @@ -2372,7 +2372,7 @@ void ifcopenshell::impl::in_memory_file_storage::read_from_stream(Reader* s, con } else { auto storage = owner; auto attr_index = p.first.index_; - + if (storage->template has_attribute_value(attr_index)) { express::base inst = storage->get_attribute_value(attr_index); if (inst && !inst.declaration().as_entity()) { @@ -2416,7 +2416,7 @@ void ifcopenshell::impl::in_memory_file_storage::read_from_stream(Reader* s, con auto storage = owner; auto attr_index = p.first.index_; - + if (storage->template has_attribute_value(attr_index)) { express::base inst = storage->get_attribute_value(attr_index); if (inst && !inst.declaration().as_entity()) { @@ -2458,7 +2458,7 @@ void ifcopenshell::impl::in_memory_file_storage::read_from_stream(Reader* s, con auto storage = owner; auto attr_index = p.first.index_; - + if (storage->template has_attribute_value(attr_index)) { express::base inst = storage->get_attribute_value(attr_index); if (inst && !inst.declaration().as_entity()) { @@ -2648,7 +2648,7 @@ express::base file::add_entity(const express::base& entity, int id) { } }); } - + // In case an entity is added that contains geometry, the unit // information needs to be accounted for for IfcLengthMeasures. double conversion_factor = calculate_unit_factors ? std::numeric_limits::quiet_NaN() : 1.0; @@ -2702,7 +2702,7 @@ express::base file::add_entity(const express::base& entity, int id) { new_instances.back().push_back(eit->second); } } - + new_entity.set_attribute_value(i, new_instances); } else if ((potentially_length_measure_decl != nullptr) && potentially_length_measure_decl->is(*schema()->declaration_by_name("IfcLengthMeasure"))) { if (boost::math::isnan(conversion_factor)) { @@ -3172,7 +3172,7 @@ std::vector file::get_inverse_indices_by_id(int instance_id) { std::vector file::get_inverse(int instance_id, const ifcopenshell::declaration* type, int attribute_index) { std::vector return_value; - + if (type == nullptr && attribute_index == -1) { // @todo this is silly. auto r = instances_by_reference(instance_id); @@ -3181,7 +3181,7 @@ std::vector file::get_inverse(int instance_id, const ifcopenshe } return return_value; } - + std::visit([&return_value, this, attribute_index, instance_id, type](auto& x) { if constexpr (std::is_same_v, std::monostate>) { } else if constexpr (std::is_same_v, impl::in_memory_file_storage>) { @@ -3431,7 +3431,7 @@ ifcopenshell::file* express::base::file() const { instance_data::instance_data(const instance_data& data) : storage_(data.size()) { - + } */ @@ -3470,7 +3470,7 @@ bool ifcopenshell::impl::rocks_db_file_storage::read_schema(const ifcopenshell:: return true; } #endif - return false; + return false; } /* diff --git a/src/ifcparse/parse.h b/src/ifcparse/parse.h index 1289f98a39..8456cfbd57 100644 --- a/src/ifcparse/parse.h +++ b/src/ifcparse/parse.h @@ -20,7 +20,7 @@ /******************************************************************************** * * * This file provides functions for loading an IFC file into memory and access * - * its entities either by ID, by an IfcSchema::Type or by reference * + * its entities either by ID, by an IfcSchema::Type or by reference * * * ********************************************************************************/ @@ -53,7 +53,7 @@ class IFC_PARSE_API spf_lexer { private: character_decoder* decoder_; ifcopenshell::logger& logger_; - + size_t skip_whitespace() const; size_t skip_comment() const; @@ -61,7 +61,7 @@ class IFC_PARSE_API spf_lexer { mutable size_t pool_index = 0; public: - + spf_lexer(const spf_lexer&) = delete; spf_lexer& operator=(const spf_lexer&) = delete; diff --git a/src/ifcparse/storage.h b/src/ifcparse/storage.h index ae55b34f9c..975cef540a 100644 --- a/src/ifcparse/storage.h +++ b/src/ifcparse/storage.h @@ -180,7 +180,7 @@ namespace ifcopenshell { token(size_t start_position, char operator_character) : start_pos(start_position), type(Token_OPERATOR), value_char(operator_character) {} - + token(size_t start_position, token_type token_kind, char character_value) : start_pos(start_position), type(token_kind), value_char(character_value) {} diff --git a/src/ifcwrap/IfcGeomWrapper.i b/src/ifcwrap/IfcGeomWrapper.i index 04235b6093..67a86fc3d5 100644 --- a/src/ifcwrap/IfcGeomWrapper.i +++ b/src/ifcwrap/IfcGeomWrapper.i @@ -184,7 +184,7 @@ std::string taxonomy_item_repr(ifcopenshell::geom::taxonomy::item::ptr i) { if (!result.empty() && result.back() == '\n') { result.pop_back(); } - return result; + return result; } %} @@ -849,7 +849,7 @@ struct shape_rtti : public boost::static_visitor polyhedral_faces_without_holes = property(polyhedral_faces_without_holes) polyhedral_faces_with_holes = property(polyhedral_faces_with_holes) def get_faces(self): - if self.faces_tri: + if self.faces_tri: return self.faces_tri elif self.polyhedral_faces_without_holes: return self.polyhedral_faces_without_holes @@ -1310,7 +1310,7 @@ ifcopenshell::geom::taxonomy::item::ptr try_upcast(PyObject* obj0, swig_type_inf auto cgs = dynamic_cast($self); if (cgs) { write_to_obj(cgs->nef(), result, std::numeric_limits::max()); - } + } return result.str(); } @@ -1318,7 +1318,7 @@ ifcopenshell::geom::taxonomy::item::ptr try_upcast(PyObject* obj0, swig_type_inf auto cgs = dynamic_cast($self); if (cgs) { cgs->convex_tag() = b; - } + } } std::string serialize() { @@ -1368,7 +1368,7 @@ ifcopenshell::geom::taxonomy::item::ptr try_upcast(PyObject* obj0, swig_type_inf return r; } else { throw std::runtime_error("Failed to read SVG"); - } + } } std::vector arrange_polygons(svgfill::arrange_polygon_settings settings, const std::vector& polygons, ifcopenshell::logger* logger = nullptr) { diff --git a/src/ifcwrap/IfcParseWrapper.i b/src/ifcwrap/IfcParseWrapper.i index 01686bbfd0..42c22bd07f 100644 --- a/src/ifcwrap/IfcParseWrapper.i +++ b/src/ifcwrap/IfcParseWrapper.i @@ -443,7 +443,7 @@ private: if (!$self->declaration().as_entity()) { return name == "wrappedValue" ? 1 : 0; } - + { const std::vector attrs = $self->declaration().as_entity()->all_attributes(); std::vector::const_iterator it = attrs.begin(); @@ -496,12 +496,12 @@ private: if (!$self->declaration().as_entity()) { return std::vector(1, "wrappedValue"); } - + const std::vector attrs = $self->declaration().as_entity()->all_attributes(); - + std::vector attr_names; - attr_names.reserve(attrs.size()); - + attr_names.reserve(attrs.size()); + std::vector::const_iterator it = attrs.begin(); for (; it != attrs.end(); ++it) { attr_names.push_back((*it)->name()); @@ -516,10 +516,10 @@ private: } const std::vector attrs = $self->declaration().as_entity()->all_inverse_attributes(); - + std::vector attr_names; - attr_names.reserve(attrs.size()); - + attr_names.reserve(attrs.size()); + std::vector::const_iterator it = attrs.begin(); for (; it != attrs.end(); ++it) { attr_names.push_back((*it)->name()); @@ -527,7 +527,7 @@ private: return attr_names; } - + bool is_a(const std::string& s) { return self->declaration().is(s); } @@ -901,7 +901,7 @@ private: bits.push_back(boost::dynamic_bitset<>(v)); } else { throw ifcopenshell::exception("String not a valid binary representation"); - } + } } self->set_attribute_value(i, bits); return; @@ -1181,7 +1181,7 @@ from .entity_instance import entity_instance_mixin %{ PyObject* get_info_cpp(const express::base& v, bool recursive, bool include_identifier); - // @todo refactor this to remove duplication with the typemap. + // @todo refactor this to remove duplication with the typemap. // except this is calls the above function in case of instances. PyObject* convert_cpp_attribute_to_python(const express::base& instance, size_t attribute_index, bool recursive, bool include_identifier) { return instance.get_attribute_value(attribute_index).apply_visitor([recursive, include_identifier](const auto& v){ @@ -1193,7 +1193,7 @@ from .entity_instance import entity_instance_mixin return SWIG_NewPointerObj(new attribute_value_derived, SWIGTYPE_p_attribute_value_derived, SWIG_POINTER_OWN); } else { Py_INCREF(Py_None); - return static_cast(Py_None); + return static_cast(Py_None); } } else if constexpr (std::is_same_v) { if (recursive) { @@ -1230,7 +1230,7 @@ from .entity_instance import entity_instance_mixin } } else if constexpr (std::is_same_v || std::is_same_v || std::is_same_v) { Py_INCREF(Py_None); - return static_cast(Py_None); + return static_cast(Py_None); } else if constexpr (is_std_vector_v) { // only for non-entity-instance vectors return pythonize_vector(v); @@ -1418,7 +1418,7 @@ from .entity_instance import entity_instance_mixin std::visit([&](const auto& v) -> void { PyObject* attribute_val_py = nullptr; using t = std::decay_t; - + if constexpr (std::is_same_v) { if (auto* inst = std::get_if(&v)) { // So this never happens? diff --git a/src/ifcwrap/IfcPython.i b/src/ifcwrap/IfcPython.i index e87a0ebfc8..4d3adf8cc2 100644 --- a/src/ifcwrap/IfcPython.i +++ b/src/ifcwrap/IfcPython.i @@ -293,7 +293,7 @@ #include "../ifcparse/file.h" #include "../ifcparse/schema.h" #include "../ifcparse/utils.h" - + #include "../ifcgeom/conversion_settings.h" #include "../ifcgeom/conversion_result.h" diff --git a/src/ifcwrap/utils/type_conversion.i b/src/ifcwrap/utils/type_conversion.i index c3b6760ae2..1fc5df9010 100644 --- a/src/ifcwrap/utils/type_conversion.i +++ b/src/ifcwrap/utils/type_conversion.i @@ -82,7 +82,7 @@ return false; } } - return true; + return true; } bool check_aggregate_of_aggregate_of_type(PyObject* aggregate, void* type_obj) { @@ -273,8 +273,8 @@ // PyObject* pythonize(const ifcopenshell::geom::conversion_result_shape* t) { return SWIG_NewPointerObj(SWIG_as_voidptr(t), SWIGTYPE_p_ifcopenshell__geom__conversion_result_shape, 0); } // NB: This cannot be temporary as a Python object is constructed from a pointer to the address of this object // PyObject* pythonize(const ifcopenshell::geom::Material& t) { return SWIG_NewPointerObj(SWIG_as_voidptr(&t), SWIGTYPE_p_ifcopenshell__geom__Material, 0); } - - PyObject* pythonize(const boost::dynamic_bitset<>& t) { + + PyObject* pythonize(const boost::dynamic_bitset<>& t) { std::string bitstring; boost::to_string(t, bitstring); return pythonize(bitstring); diff --git a/src/ifcwrap/utils/typemaps_in.i b/src/ifcwrap/utils/typemaps_in.i index 06105e0ddc..634525d0c7 100644 --- a/src/ifcwrap/utils/typemaps_in.i +++ b/src/ifcwrap/utils/typemaps_in.i @@ -235,7 +235,7 @@ CREATE_VECTOR_TYPEMAP_IN(express::base, ENTITY INSTANCE, entity instance) if (ascii) { $1 = strcmp(PyBytes_AS_STRING(ascii), "UNKNOWN") == 0; Py_DECREF(ascii); - } + } } } @@ -274,20 +274,20 @@ CREATE_OPTIONAL_TYPEMAP_IN(std::string, string, str) if (!PySequence_Check(aggregate)) return false; for(Py_ssize_t i = 0; i < PySequence_Size(aggregate); ++i) { PyObject* element = PySequence_GetItem(aggregate, i); - + bool b = true; void* argp1 = nullptr; auto res1 = SWIG_ConvertPtr(element, &argp1, type_obj, 0); if (!SWIG_IsOK(res1)) { b = false; } - + Py_DECREF(element); if (!b) { return false; } } - return true; + return true; } template diff --git a/src/ifcwrap/utils/typemaps_out.i b/src/ifcwrap/utils/typemaps_out.i index 875ebeea52..3e41e6f08a 100644 --- a/src/ifcwrap/utils/typemaps_out.i +++ b/src/ifcwrap/utils/typemaps_out.i @@ -43,11 +43,11 @@ return SWIG_NewPointerObj(new attribute_value_derived, SWIGTYPE_p_attribute_value_derived, SWIG_POINTER_OWN); } else { Py_INCREF(Py_None); - return static_cast(Py_None); + return static_cast(Py_None); } } else if constexpr (std::is_same_v || std::is_same_v || std::is_same_v) { Py_INCREF(Py_None); - return static_cast(Py_None); + return static_cast(Py_None); } else { return pythonize(v); } diff --git a/src/serializers/collada_serializer.cpp b/src/serializers/collada_serializer.cpp index 5223fa35bb..6c693288ac 100644 --- a/src/serializers/collada_serializer.cpp +++ b/src/serializers/collada_serializer.cpp @@ -70,12 +70,12 @@ void collada_serializer::collada_exporter::collada_geometries::write( const std::vector& uvs, const std::vector& material_references) { openMesh(mesh_id); - + // The normals vector can be empty for example when the WELD_VERTICES setting is used. // IfcOpenShell does not provide them with multiple face normals collapsed into a single vertex. const bool has_normals = !normals.empty(); const bool has_uvs = !uvs.empty(); - + addFloatSource(mesh_id, COLLADASW::LibraryGeometries::POSITIONS_SOURCE_ID_SUFFIX, positions); if (has_normals) { addFloatSource(mesh_id, COLLADASW::LibraryGeometries::NORMALS_SOURCE_ID_SUFFIX, normals); @@ -88,7 +88,7 @@ void collada_serializer::collada_exporter::collada_geometries::write( vertices.setId(mesh_id + COLLADASW::LibraryGeometries::VERTICES_ID_SUFFIX ); vertices.getInputList().push_back(COLLADASW::Input(COLLADASW::InputSemantic::POSITION, "#" + mesh_id + COLLADASW::LibraryGeometries::POSITIONS_SOURCE_ID_SUFFIX)); vertices.add(); - + std::vector::const_iterator index_range_start = faces.begin(); std::vector::const_iterator material_it = material_ids.begin(); int previous_material_id = -1; @@ -185,7 +185,7 @@ void collada_serializer::collada_exporter::collada_scene::add( openVisualScene(scene_id); scene_opened = true; } - + COLLADASW::Node node(mSW); node.setNodeId(node_id); node.setNodeName(node_name); @@ -195,7 +195,7 @@ void collada_serializer::collada_exporter::collada_scene::add( // Note that this placement is absolute, ie it is multiplied with all parent placements. auto transformation_towrite = transformation.data()->ccomponents(); - + // If this is not the first parent, get the relative placement if (parentNodes.size() > 0) { @@ -294,9 +294,9 @@ void collada_serializer::collada_exporter::collada_scene::write() { if (scene_opened) { closeVisualScene(); closeLibrary(); - + COLLADASW::Scene scene (mSW, COLLADASW::URI ("#" + scene_id)); - scene.add(); + scene.add(); } } @@ -442,11 +442,11 @@ void collada_serializer::collada_exporter::endDocument() { // only at this point all objects are written to the stream. materials.write(); bool use_hierarchy = serializer->settings().get().get(); - + std::set geometries_written; //if the setting USE_ELEMENT_HIERARCHY is in use, we sort the deferreds objects by their parents. - + if (use_hierarchy) { std::sort(deferreds.begin(), deferreds.end(), [](const auto& first, const auto& second) { const auto& first_parents = first->parents(); @@ -461,7 +461,7 @@ void collada_serializer::collada_exporter::endDocument() { : *first_parents[index] < *second_parents[index]; }); } - + for (const auto& object_pointer : deferreds) { const auto& object = *object_pointer; std::string representation_id = "representation-" + object.geometry().id(); @@ -527,7 +527,7 @@ void collada_serializer::collada_exporter::endDocument() { } } } - + /// @todo redundant information using ID as both ID and Name, maybe omit Name or allow specifying what would be used as the name scene.add(object_name, object_name, representation_id, material_references, object.transformation()); } diff --git a/src/serializers/gltf_serializer.cpp b/src/serializers/gltf_serializer.cpp index 4e2f524c3d..796f04f095 100644 --- a/src/serializers/gltf_serializer.cpp +++ b/src/serializers/gltf_serializer.cpp @@ -93,7 +93,7 @@ int gltf_serializer::writeMaterial(const ifcopenshell::geom::taxonomy::style::pt if (it != materials_.end()) { return it->second; } - + int idx = json_["materials"].size(); materials_[style->name] = idx; @@ -116,7 +116,7 @@ int gltf_serializer::writeMaterial(const ifcopenshell::geom::taxonomy::style::pt json_["materials"].push_back({ {"name", style->name}, {"doubleSided", true}, {"pbrMetallicRoughness", {{"baseColorFactor", base}, {"metallicFactor", 0}, {"roughnessFactor", roughness}}}}); } else json_["materials"].push_back({ {"name", style->name}, {"doubleSided", true}, {"pbrMetallicRoughness", {{"baseColorFactor", base}, {"metallicFactor", 0}}}}); - + if (style->transparency == style->transparency && style->transparency > 1.e-9) { json_["materials"].back()["alphaMode"] = "BLEND"; } @@ -212,7 +212,7 @@ void gltf_serializer::write(const ifcopenshell::geom::triangulation_element* o) break; } - + auto mm = (*it)->transformation().data()->ccomponents(); if (!is_root) { mm = (*jt)->transformation().data()->ccomponents().inverse() * mm; @@ -238,9 +238,9 @@ void gltf_serializer::write(const ifcopenshell::geom::triangulation_element* o) mm(0,3), mm(2,3), -mm(1,3), mm(3,3) }; } - + static const std::array identity_matrix = {1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1}; - + if (matrix_flat != identity_matrix) { // glTF validator complains about identity matrices parent_node["matrix"] = matrix_flat; @@ -260,7 +260,7 @@ void gltf_serializer::write(const ifcopenshell::geom::triangulation_element* o) } } } - + json node; { std::array matrix_flat; @@ -281,16 +281,16 @@ void gltf_serializer::write(const ifcopenshell::geom::triangulation_element* o) m(0,3), m(2,3), -m(1,3), m(3,3) }; } - + static const std::array identity_matrix = {1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1}; - + if (matrix_flat != identity_matrix) { // glTF validator complains about identity matrices node["matrix"] = matrix_flat; } } node["name"] = object_id(o); - + int current_mesh_index; // See if this mesh has already been processed @@ -316,7 +316,7 @@ void gltf_serializer::write(const ifcopenshell::geom::triangulation_element* o) json mesh; mesh["name"] = o->geometry().id(); - + while (true) { // In glTF we need to decompose a mesh into several primitives // with a constant material. In the triangulations coming from @@ -342,7 +342,7 @@ void gltf_serializer::write(const ifcopenshell::geom::triangulation_element* o) }); json primitive = json::object(); - + primitive["indices"] = write_accessor<1U>(json_, tmp_fstream1_, idx_transformed.begin(), idx_transformed.end(), bufferViewId++); auto vbegin = o->geometry().verts().begin(); @@ -354,12 +354,12 @@ void gltf_serializer::write(const ifcopenshell::geom::triangulation_element* o) std::vector nf(nbegin + idx_begin * 3, nbegin + idx_end * 3); primitive["attributes"]["NORMAL"] = write_accessor<3U>(json_, tmp_fstream2_, nf.begin(), nf.end(), bufferViewId++); } - + if (*mid0 >= 0) { primitive["material"] = writeMaterial(o->geometry().materials()[*mid0]); } primitive["mode"] = primitive_type; - + mesh["primitives"].push_back(primitive); if (mid1 == o->geometry().material_ids().end()) { @@ -471,7 +471,7 @@ void gltf_serializer::finalize() { json_["scenes"].push_back(scene_0); //The generated glb file will contain the indices buffer followed by the vertices buffer. - //Therefore once we know the size of the indices buffer, we update our vertices buffer + //Therefore once we know the size of the indices buffer, we update our vertices buffer //to have an offset equal to the size of the indices buffer. for (auto &n : json_["bufferViews"]) { if (n.contains("byteStride")) { @@ -488,7 +488,7 @@ void gltf_serializer::finalize() { const int GLB_JSON_HEADER = 8; const int GLB_BINARY_CHUNK_HEADER = 8; - uint32_t header[] = { GLTF, 2U, GLB_FILE_HEADER + GLB_JSON_HEADER + json_length + padding_for(json_length) + + uint32_t header[] = { GLTF, 2U, GLB_FILE_HEADER + GLB_JSON_HEADER + json_length + padding_for(json_length) + GLB_BINARY_CHUNK_HEADER + binary_length + padding_for(binary_length) }; fstream_.write((const char*)header, sizeof(header)); @@ -551,7 +551,7 @@ void gltf_serializer::setFile(ifcopenshell::file& f) { express::base target_crs = coordop.as().get("TargetCRS"); auto name_attr = target_crs.as().get("Name"); if (coordop.declaration().is("IfcMapConversion")) { - + if (!name_attr.isNull()) { std::string epsg_code = name_attr; crs_epsg = epsg_code; diff --git a/src/serializers/open_cascade_based_serializer.cpp b/src/serializers/open_cascade_based_serializer.cpp index d2c6d6af9a..535204dd50 100644 --- a/src/serializers/open_cascade_based_serializer.cpp +++ b/src/serializers/open_cascade_based_serializer.cpp @@ -66,4 +66,3 @@ const char* open_cascade_based_serializer::getSymbolForUnitMagnitude(float mag) } #endif - diff --git a/src/serializers/schema_dependent/json_serializer.cpp b/src/serializers/schema_dependent/json_serializer.cpp index 2f5ed70ff2..d96472533a 100644 --- a/src/serializers/schema_dependent/json_serializer.cpp +++ b/src/serializers/schema_dependent/json_serializer.cpp @@ -345,7 +345,7 @@ void POSTFIX_SCHEMA(json_serializer)::finalize() { jprop["unit"] = std::distance(units.begin(), std::find(units.begin(), units.end(), unit)); } } - + return jprop; }; @@ -358,7 +358,7 @@ void POSTFIX_SCHEMA(json_serializer)::finalize() { "value": 12.5, "valueType": "ElementQuantity", "unit": 3 - } + } */ if (auto qto = qto_.as()) { jprop["name"] = qto.Name(); diff --git a/src/serializers/schema_dependent/xml_serializer.cpp b/src/serializers/schema_dependent/xml_serializer.cpp index 06a1cc106d..7862e48cc5 100644 --- a/src/serializers/schema_dependent/xml_serializer.cpp +++ b/src/serializers/schema_dependent/xml_serializer.cpp @@ -37,11 +37,11 @@ namespace { // TODO: Make this a member of xml_serializer? std::map POSTFIX_SCHEMA(argument_name_map); -// Format an IFC attribute and maybe returns as string. Only literal scalar +// Format an IFC attribute and maybe returns as string. Only literal scalar // values are converted. Things like entity instances and lists are omitted. std::optional format_attribute(ifcopenshell::geom::abstract_mapping* mapping, ifcopenshell::attribute_value argument, ifcopenshell::argument_type argument_type, const std::string& argument_name) { std::optional value; - + // Hard-code lat-lon as it represents an array // of integers best emitted as a single decimal if (argument_name == "IfcSite.RefLatitude" || @@ -109,7 +109,7 @@ std::optional format_attribute(ifcopenshell::geom::abstract_mapping } else if (auto placement = e.as()) { auto item = mapping->map(e); auto matrix = ifcopenshell::geom::taxonomy::cast< ifcopenshell::geom::taxonomy::matrix4>(item); - + std::stringstream stream; for (int i = 0; i < 4; ++i) { for (int j = 0; j < 4; ++j) { @@ -139,7 +139,7 @@ ptree* format_entity_instance(ifcopenshell::logger& log, ifcopenshell::geom::abs } catch (const std::exception&) { log.error("SER", 9, "Expected " + boost::lexical_cast(n) + " attributes for:", instance); break; - } + } auto argument = instance.get_attribute_value(i); if (argument.isNull()) continue; @@ -185,7 +185,7 @@ std::string qualify_unrooted_instance(const express::base& inst) { return inst.declaration().name() + "_" + std::to_string(inst.id()); } -// A function to be called recursively. Template specialization is used +// A function to be called recursively. Template specialization is used // to descend into decomposition, containment and property relationships. template ptree* descend(ifcopenshell::logger& log, ifcopenshell::geom::abstract_mapping* mapping, A instance, ptree& tree, express::base parent = express::base()) { @@ -212,14 +212,14 @@ auto get_related(ifcopenshell::logger& log, T t, F f, G g) { } else if constexpr (std::is_base_of_v) { if (auto vv = vs.concrete().template as()) { acc.push_back(vv); - } + } } else { for (auto& v : vs) { if (auto vv = v.template as()) { acc.push_back(vv); } } - } + } } catch (ifcopenshell::exception& e) { log.error(e); } @@ -249,12 +249,12 @@ ptree* descend(ifcopenshell::logger& log, ifcopenshell::geom::abstract_mapping* descend(log, mapping, f, child, product); } } - + if (auto structure = product.as()) { auto elements = get_related (log, structure, &IfcSchema::IfcSpatialStructureElement::ContainsElements, &IfcSchema::IfcRelContainedInSpatialStructure::RelatedElements); - + for (auto& el : elements) { descend(log, mapping, el, child, product); } @@ -342,7 +342,7 @@ ptree* descend(ifcopenshell::logger& log, ifcopenshell::geom::abstract_mapping* node.put(".xlink:href", "#" + p.first); format_entity_instance(log, mapping, p.second, node, child, true); } - + auto associations = product.HasAssociations(); for (auto& rel : associations) { if (auto relmat = rel.as()) { @@ -652,7 +652,7 @@ void POSTFIX_SCHEMA(xml_serializer)::finalize() { auto pschedules = file->instances_by_type(); for (auto& schedule : pschedules) { ptree* nschedule = format_entity_instance(log, mapping_, schedule, pwork_schedules); - + if(nschedule) { auto controls = schedule.Controls(); for(auto& control : controls) { @@ -691,13 +691,13 @@ void POSTFIX_SCHEMA(xml_serializer)::finalize() { } } work.add_child("plans", pwork_plans); - + // Write all work calendars and values as XML nodes. #ifdef SCHEMA_HAS_IfcWorkCalendar auto pcalendars = file->instances_by_type(); for (auto& calendar : pcalendars) { ptree* ncalendar = format_entity_instance(log, mapping_, calendar, calendars); - + if (ncalendar) { auto working_times = calendar.WorkingTimes().value_or(std::vector{}); for (auto& working_time : working_times) @@ -707,7 +707,7 @@ void POSTFIX_SCHEMA(xml_serializer)::finalize() { } } #endif - + auto pconnections = file->instances_by_type(); for (auto& connection : pconnections) { ptree* nconnection = format_entity_instance(log, mapping_, connection, connections); @@ -717,7 +717,7 @@ void POSTFIX_SCHEMA(xml_serializer)::finalize() { format_entity_instance(log, mapping_, connection.RelatedElement(), nrelatedElement, true); format_entity_instance(log, mapping_, connection.RelatingElement(), nrelatingElement, true); - + nconnection->add_child("RelatedElement", nrelatedElement); nconnection->add_child("RelatingElement", nrelatingElement); } @@ -726,7 +726,7 @@ void POSTFIX_SCHEMA(xml_serializer)::finalize() { auto type_objects = file->instances_by_type(); for (auto& type_object : type_objects) { ptree* node = descend(log, mapping_, type_object, types); - + if (node && type_object.HasPropertySets()) { auto property_sets = *type_object.HasPropertySets(); for (auto& pset : property_sets) { @@ -774,11 +774,11 @@ void POSTFIX_SCHEMA(xml_serializer)::finalize() { ptree node; node.put(".id", qualify_unrooted_instance(mat)); // @todo this does not handle IfcMaterialProfileSetUsage and IfcMaterialConstituentSet - if (mat.concrete().as() || mat.concrete().as()) { + if (mat.concrete().as() || mat.concrete().as()) { IfcSchema::IfcMaterialLayerSet layerset = mat.concrete().as(); if (!layerset) { layerset = mat.concrete().as().ForLayerSet(); - } + } if (layerset.LayerSetName()) { node.put(".LayerSetName", *layerset.LayerSetName()); } @@ -821,7 +821,7 @@ void POSTFIX_SCHEMA(xml_serializer)::finalize() { #else boost::property_tree::xml_writer_settings settings('\t', 1); #endif - + std::ofstream f(ifcopenshell::path::from_utf8(xml_filename).c_str()); boost::property_tree::write_xml(f, root, settings); } diff --git a/src/serializers/step_serializer.h b/src/serializers/step_serializer.h index 11edd4703b..2a747e2a8b 100644 --- a/src/serializers/step_serializer.h +++ b/src/serializers/step_serializer.h @@ -32,7 +32,7 @@ class step_serializer : public open_cascade_based_serializer { private: - STEPControl_Writer writer; + STEPControl_Writer writer; public: explicit step_serializer(const std::string& out_filename, const ifcopenshell::geom::settings& settings, ifcopenshell::logger* logger = nullptr) : open_cascade_based_serializer(out_filename, settings, logger) diff --git a/src/serializers/svg_serializer.cpp b/src/serializers/svg_serializer.cpp index 92971291b0..4027df83aa 100644 --- a/src/serializers/svg_serializer.cpp +++ b/src/serializers/svg_serializer.cpp @@ -392,7 +392,7 @@ void svg_serializer::write(path_object& p, const TopoDS_Shape& comp_or_wire, std std::swap(p1, p2); } - + if (first) { if (first_wire) { @@ -599,7 +599,7 @@ namespace { /* // in v0.8 apparently we don't get a solid/shell anymore because // we no longer use PrimAPI, but rather resolve the box to an - // explicit shell with 6 faces in the mapping, which - depending + // explicit shell with 6 faces in the mapping, which - depending // on settings - may remain solely a compound of 6. TopExp_Explorer exp(compound, TopAbs_SHELL); @@ -736,9 +736,9 @@ void svg_serializer::write(const ifcopenshell::geom::native_element* brep_obj) { if (file) { auto item = this->file->instance_by_id(x.ItemId()); curve_style_name = get_curve_style_name(item); - } - - if (curve_style_name && + } + + if (curve_style_name && (boost::starts_with(*curve_style_name, "LINE_") || boost::starts_with(*curve_style_name, "DASH_"))) { @@ -775,7 +775,7 @@ void svg_serializer::write(const ifcopenshell::geom::native_element* brep_obj) { } else if (elevation_ref_guid_) { is_elevation = *elevation_ref_guid_ == brep_obj->guid(); } - + BRepBuilderAPI_Transform make_transform_global(compound_local, trsf, true); make_transform_global.Build(); // (When determinant < 0, copy is implied and the input is not mutated.) @@ -1153,7 +1153,7 @@ void svg_serializer::write(const geometry_data& data) { #endif // SVG has a coordinate system with the origin in the *upper*-left corner - // therefore we mirror the shape along the XZ-plane. + // therefore we mirror the shape along the XZ-plane. gp_Trsf trsf_mirror; if (!mirror_y_) { trsf_mirror.SetMirror(gp_Ax2(gp::Origin(), gp::DY())); @@ -1253,17 +1253,17 @@ void svg_serializer::write(const geometry_data& data) { B.Add(annotation, BRepBuilderAPI_MakeEdge(p2, center).Edge()); } } - } + } } bool emitted = false; - + for (auto sit = section_heights_used->begin(); sit != section_heights_used->end(); ++sit) { const auto& variant = *sit; - + // Elev + offset double cut_z = std::numeric_limits::infinity(); - + // Elev .. Elev(next) std::pair range; @@ -1331,7 +1331,7 @@ void svg_serializer::write(const geometry_data& data) { // Exclude annotations, spaces and grids from HLR if (any_in_front && !data.product.declaration().is("IfcAnnotation") && !data.product.declaration().is("IfcSpace") && !data.product.declaration().is("IfcGrid")) { - + TopoDS_Shape* compound_to_hlr = &compound_to_use; TopoDS_Shape subtracted_shape; @@ -1350,7 +1350,7 @@ void svg_serializer::write(const geometry_data& data) { bool should_cut = false; TopExp_Explorer exp(compound_to_use, TopAbs_FACE); for (; exp.More(); exp.Next()) { - + const TopoDS_Face& face = TopoDS::Face(exp.Current()); BRepGProp_Face prop(face); gp_Pnt _; @@ -1424,7 +1424,7 @@ void svg_serializer::write(const geometry_data& data) { } try { - + BRepBuilderAPI_MakeFace mf(new Geom_Plane(projection_plane), min_u - 1., max_u + 1., min_v - 1., max_v + 1., Precision::Confusion()); auto f = mf.Face(); gp_Pnt ref = projection_plane.Position().Location().XYZ() + projection_plane.Position().Direction().XYZ(); @@ -1466,12 +1466,12 @@ void svg_serializer::write(const geometry_data& data) { TopExp::Vertices(edge, v0, v1); auto pnt0 = BRep_Tool::Pnt(v0); auto pnt1 = BRep_Tool::Pnt(v1); - + // Exclude edges that have both vertices behind plane; if (infront_or_behind(projection_plane, pnt0) != -1 && infront_or_behind(projection_plane, pnt1) != -1) { continue; } - + double u0, u1; auto crv = BRep_Tool::Curve(edge, u0, u1); gp_Pnt _; @@ -1487,7 +1487,7 @@ void svg_serializer::write(const geometry_data& data) { } auto faces = map.FindFromIndex(i); - + // Add non-manifold edges bool add = faces.Extent() != 2; @@ -1524,12 +1524,12 @@ void svg_serializer::write(const geometry_data& data) { // Profile edges are adges where the sign of the // dot product Vdir . Fnormal flips sign. add = std::signbit(dot0) != std::signbit(dot1); - } + } } if (add) { BB.Add(profile_edges, edge); - } + } } } } @@ -1657,7 +1657,7 @@ void svg_serializer::write(const geometry_data& data) { } auto svg_name = data.svg_name; - + path_object* po_ = nullptr; auto po = [this, &po_, &pln, &storey, &drawing_name, &svg_name]() { if (po_ == nullptr) { @@ -1812,7 +1812,7 @@ void svg_serializer::write(const geometry_data& data) { path.add(""); po()->second.push_back(path); } - + } else if (object_type == "Symbol") { TopExp_Explorer exp(subshape_to_use, TopAbs_WIRE, TopAbs_FACE); @@ -1820,7 +1820,7 @@ void svg_serializer::write(const geometry_data& data) { const auto& W = TopoDS::Wire(exp.Current()); write(*po(), W, *dash_it); } - + } // We're finished processing IfcAnnotation instances @@ -1882,7 +1882,7 @@ void svg_serializer::write(const geometry_data& data) { BB.MakeCompound(wires_compound); for (int i = 1; i <= wires->Length(); ++i) { - + // @nb not const, because in case of storey annotations we might // generate a new wire with fixed length @@ -1905,19 +1905,19 @@ void svg_serializer::write(const geometry_data& data) { } } - + if (file && data.product.declaration().is("IfcBuildingStorey") && storey_height_display_ != SH_NONE && wires->Length() == 1 && ifcopenshell::geom::util::count(wire, TopAbs_EDGE) == 1) { - + std::string elev_str; const double lu = file->get_unit("LENGTHUNIT").second; auto a = data.product.as().get("Elevation"); if (!a.isNull()) { double elev = a; - + // @nb we don't actually factor in the length unit. // elev *= lu; - + if (almost(1.) == lu) { // m elev_str = boost::str(boost::format("%.3f") % elev); @@ -2027,7 +2027,7 @@ void svg_serializer::write(const geometry_data& data) { ); if (d > furthest_points_distance) { - + // Sample some points on the line and assure it's inside. bool all_inside = true; for (int n = 5; n < 95; ++n) { @@ -2132,7 +2132,7 @@ std::array, 3> svg_serializer::resize() { double sc, cx, cy; if (offset_2d_ && scale_) { - // offset_2d is the offset in plane u,v coordinates as we want to keep the + // offset_2d is the offset in plane u,v coordinates as we want to keep the // plane coordinates used for HLR close to the model origin. sc = (*scale_) * 1000; cx = offset_2d_->first; @@ -2351,7 +2351,7 @@ void svg_serializer::addTextAnnotations(const drawing_key& k) { po = &start_path(meta.pln_3d, k.first, svg_name); } else { po = &start_path(meta.pln_3d, k.second, svg_name); - } + } std::optional font_size; std::vector tokens; @@ -2366,7 +2366,7 @@ void svg_serializer::addTextAnnotations(const drawing_key& k) { // @todo column or row? double z_rotation = gp::DX().Transformed(trsf).AngleWithRef( meta.pln_3d.Position().XDirection(), - meta.pln_3d.Position().Direction() + meta.pln_3d.Position().Direction() ); z_rotation *= 180. / M_PI; @@ -2496,7 +2496,7 @@ void svg_serializer::finalize() { } resetScale(); - + if (deferred_section_data_ && deferred_section_data_->size() && element_buffer_.size()) { // Draw door arcs only on floor plans. @@ -2526,7 +2526,7 @@ void svg_serializer::finalize() { if (use_hlr) { const auto& section = boost::get(sd); const auto& ax = section.plane.Position(); - + draw_hlr(ax, { express::base{}, drawing_name }); } @@ -2622,7 +2622,7 @@ void svg_serializer::finalize() { } svg_file.stream << " \n"; } - + if (previous) { svg_file.stream << " \n"; } @@ -2640,12 +2640,12 @@ void svg_serializer::doWriteHeader() { svg_file.stream << " xmlns:ifc=\"http://www.ifcopenshell.org/ns\""; } if (scale_ && size_) { - svg_file.stream << + svg_file.stream << " width=\"" << size_->first << "mm\"" " height=\"" << size_->second << "mm\"" << " viewBox=\"0 0 " << size_->first << " " << size_->second << "\""; } - + svg_file.stream << ">\n" " \n" " \n" @@ -2883,7 +2883,7 @@ namespace { template std::string array_to_string(const T& v) { return "[" + std::accumulate( - v.begin() + 1, v.end(), + v.begin() + 1, v.end(), array_to_string(v.front()), [](const std::string& accum, decltype(*v.cbegin())& item) { return accum + "," + array_to_string(item); diff --git a/src/serializers/svg_serializer.h b/src/serializers/svg_serializer.h index f7540b51ec..fdd12de1a6 100644 --- a/src/serializers/svg_serializer.h +++ b/src/serializers/svg_serializer.h @@ -328,7 +328,7 @@ namespace { if (!fclass) { fclass = new BRepTopAdaptor_FClass2d(face, 1.e-5); } - // @todo unify with the 2d boolean algo + // @todo unify with the 2d boolean algo gp_Pnt2d bottomright(topright.X(), bottomleft.Y()); gp_Pnt2d topleft(bottomleft.X(), topright.Y()); std::array loop{ { @@ -450,7 +450,7 @@ namespace { return false; } - + void add(const TopoDS_Shape& s, express::base product) { if (!use_prefiltering_) { items_.insert(items_.end(), {product, s}); @@ -499,7 +499,7 @@ namespace { for (; exp.More(); exp.Next()) { const auto& face = TopoDS::Face(exp.Current()); if (BRep_Tool::Surface(face)->DynamicType() == STANDARD_TYPE(Geom_Plane)) { - + // find large faces orthogonal to view dir BRepGProp_Face prop(face); prop.Normal(0., 0., P, V); @@ -541,7 +541,7 @@ namespace { if (use_prefiltering_) { logger_.notice("SER", 35, "Included " + std::to_string(n_included) + " elements out of " + std::to_string(items_.size()) + " after prefiltering"); } - + hlr_calc vis(projector_); if (segment_projection_) { vis.set_product_shape(&items_); @@ -571,10 +571,10 @@ protected: std::optional> size_, offset_2d_; std::optional space_name_transform_; -#if OCC_VERSION_HEX >= 0x70300 +#if OCC_VERSION_HEX >= 0x70300 std::optional view_box_3d_; #endif - + bool with_section_heights_from_storey_, print_space_names_, print_space_areas_; storey_height_display_types storey_height_display_; @@ -608,7 +608,7 @@ protected: size_t xcoords_begin, ycoords_begin, radii_begin; std::optional section_ref_, elevation_ref_, elevation_ref_guid_; - + std::list element_buffer_; hlr_engine* hlr; @@ -699,12 +699,12 @@ public: std::array, 3> resize(); void resetScale(); - void setSectionRef(const std::optional& s) { - section_ref_ = s; + void setSectionRef(const std::optional& s) { + section_ref_ = s; } void setElevationRef(const std::optional& s) { - elevation_ref_ = s; + elevation_ref_ = s; elevation_ref_guid_ = std::nullopt; } diff --git a/src/serializers/ttl_wkt_serializer.cpp b/src/serializers/ttl_wkt_serializer.cpp index 2b5460c6d6..e0ac08d755 100644 --- a/src/serializers/ttl_wkt_serializer.cpp +++ b/src/serializers/ttl_wkt_serializer.cpp @@ -96,7 +96,7 @@ namespace { } void emit_line_component( - std::ostream& os, + std::ostream& os, const std::vector& vertices, const std::vector& component, bool force_2d = false, diff --git a/src/serializers/usd_serializer.cpp b/src/serializers/usd_serializer.cpp index b49c7bcfaa..f7023fffa4 100644 --- a/src/serializers/usd_serializer.cpp +++ b/src/serializers/usd_serializer.cpp @@ -114,7 +114,7 @@ std::vector usd_serializer::createMaterials(const std::ve } void usd_serializer::writeHeader() { - stage_->GetRootLayer()->SetComment("File generated by IfcOpenShell " + std::string(IFCOPENSHELL_VERSION)); + stage_->GetRootLayer()->SetComment("File generated by IfcOpenShell " + std::string(IFCOPENSHELL_VERSION)); } std::string usd_serializer::object_id_unique(const ifcopenshell::geom::element* o) { @@ -147,10 +147,10 @@ T usd_serializer::writeNode(const ifcopenshell::geom::element* o, const ifcopens written_.insert(o->id()); auto m = o->transformation().data()->ccomponents(); - + // store absolute matrix for calculating relative child matrices later on. placements_[o->id()] = o->transformation().data(); - + bool is_root = false; std::string prefix = "/"; if (settings_.get().get() && p == nullptr && o->parents().empty()) { @@ -168,7 +168,7 @@ T usd_serializer::writeNode(const ifcopenshell::geom::element* o, const ifcopens std::ostringstream oss; std::copy(names.begin(), names.end(), std::ostream_iterator(oss, "/")); prefix += oss.str(); - + // std::ostringstream pss; // pss << "MATT" << std::endl << std::endl; // pss << m << std::endl << std::endl << o->parents().back()->transformation().data()->ccomponents() << std::endl << std::endl; @@ -180,12 +180,12 @@ T usd_serializer::writeNode(const ifcopenshell::geom::element* o, const ifcopens } auto el_path = prefix + object_id_unique(o); paths_[o->id()] = el_path; - + T t = T::Define(stage_, pxr::SdfPath(el_path)); if (is_root) { stage_->SetDefaultPrim(t.GetPrim()); } - + t.AddTransformOp().Set(pxr::GfMatrix4d( m.data()[0], m.data()[1], m.data()[2], m.data()[3], m.data()[4], m.data()[5], m.data()[6], m.data()[7], @@ -207,7 +207,7 @@ void usd_serializer::write(const ifcopenshell::geom::triangulation_element* o) { const auto verts = mesh.verts(); const auto faces = mesh.faces(); const auto material_ids = mesh.material_ids(); - + pxr::VtVec3fArray points; for(std::size_t i = 0; i < verts.size(); i+=3) { diff --git a/src/serializers/usd_serializer.h b/src/serializers/usd_serializer.h index 603f727f83..b96a1baadb 100644 --- a/src/serializers/usd_serializer.h +++ b/src/serializers/usd_serializer.h @@ -63,7 +63,7 @@ namespace usd_utils { for (std::size_t i = 0; i < vec.size(); ++i) array[i] = vec[i]; return array; - } + } } class SERIALIZERS_API usd_serializer : public ifcopenshell::geom::write_only_geometry_serializer { diff --git a/src/serializers/wavefront_obj_serializer.cpp b/src/serializers/wavefront_obj_serializer.cpp index 1c11c7a04b..cc221cf810 100644 --- a/src/serializers/wavefront_obj_serializer.cpp +++ b/src/serializers/wavefront_obj_serializer.cpp @@ -101,7 +101,7 @@ void wavefront_obj_serializer::write(const ifcopenshell::geom::triangulation_ele const double x = *(it++); const double y = *(it++); const double z = *(it++); - + if (isyup) { obj_stream.stream << "v " << x << " " << z << " " << -y << "\n"; } else { @@ -128,7 +128,7 @@ void wavefront_obj_serializer::write(const ifcopenshell::geom::triangulation_ele const bool has_uvs = !mesh.uvs().empty(); const bool has_normals = !mesh.normals().empty(); for ( std::vector::const_iterator it = mesh.faces().begin(); it != mesh.faces().end(); ) { - + const int material_id = *(material_it++); if (material_id != previous_material_id) { const ifcopenshell::geom::taxonomy::style::ptr material = mesh.materials()[material_id]; diff --git a/src/svgfill/src/arrange_polygons.cpp b/src/svgfill/src/arrange_polygons.cpp index ce205f6eb4..6e76af9cca 100644 --- a/src/svgfill/src/arrange_polygons.cpp +++ b/src/svgfill/src/arrange_polygons.cpp @@ -389,7 +389,7 @@ class DebugWriter { } DebugWriter& operator=(const DebugWriter&) = delete; - + DebugWriter& operator=(DebugWriter&& other) noexcept { if (this == &other) { return *this; @@ -504,7 +504,7 @@ class DebugWriter { std::ofstream svg; bool enabled_; std::string last_segment_name_; - + void write_polygon_to_svg_(std::ostream& ofs, const Polygon_2& polygon, const std::string& class_name = "") { auto class_name_ = class_name; if (!polygon.is_simple()) { @@ -710,7 +710,7 @@ class SegmentLookup { typedef std::vector::const_iterator PolygonIt; SegmentLookup(const std::vector& polygons) - : polygons_ref_(polygons) + : polygons_ref_(polygons) { // Unfortunately CGAL does not seem to have a ready to use aabb primitive for segments in 2D, // so we have to use 3D segments and aabb tree for 2D polygons. @@ -890,7 +890,7 @@ Polygon_with_holes_2 subdivide_polygon_on_same_input(SegmentLookup& segment_look }; std::tuple< - std::map>, + std::map>, std::map>, std::map, std::vector*>> > @@ -2039,7 +2039,7 @@ void edge_slide(Graph2D& G) { } std::list> extend_end_vertices_based_on_input( - const Graph2D& G, + const Graph2D& G, const std::map>& midpoint_to_segment, const std::map, std::vector*>>& segment_to_input_facet, const Polygon_list& outer_perimiter, @@ -2113,8 +2113,8 @@ std::list> extend_end_vertices_based_on_input( closest_intersection_point = *xp; sq_distance_along_ray = dist; } else { - - } + + } } } } @@ -2164,7 +2164,7 @@ std::list> extend_end_vertices_based_on_input( } #endif } else { - + // Loop over boundary segments, and project point onto it, take the closest K::FT closest_distance = std::numeric_limits::infinity(); std::optional> closest_point; @@ -3343,7 +3343,7 @@ class timer { std::ostringstream message; message << "Timing for " << start_it.value()->first << ": " << duration << " ms"; logger_->message(ifcopenshell::logger::LOG_PERF, "ARR", 11, message.str()); - } + } } private: @@ -3395,7 +3395,7 @@ void arrange_cgal_polygons( static const double OVERLAP_RESOLUTION_DISTANCE = 1.e-1; // even larger amount of inset so that outer perimeter is safely within all input polygons even when overlap resolution is applied // no, `1.e-2 + 1.e-5` creates issues with the outer perimeter, are there other tolerances in play? - static const double OUTER_PERIMITER_ADDITIONAL_INSET_AMOUNT = 1.e-5; + static const double OUTER_PERIMITER_ADDITIONAL_INSET_AMOUNT = 1.e-5; DebugWriter debug_output; if (settings.debug_output) { @@ -3418,7 +3418,7 @@ void arrange_cgal_polygons( if (polygon_offset_distance < 0.) { polygon_offset_distance = estimate_polygon_offset_distance(input_polygons_); - } + } // Create copy to make mutable for cleaning auto input_polygons = input_polygons_; @@ -3454,10 +3454,10 @@ void arrange_cgal_polygons( // that touch in the corner. // Now that overlaps/touches at corners are handled more locally only a small indent is produced // which would be undone by means of an inset+offset. - // + // // [NB Nov 10] this is actually still necessary though, but we apply a much smaller distance now // to keep the overlap eliminations in tact - // + // // Inset-offset to remove tiny details that may cause enourmous spikes in offsets for (auto& r : input_polygons) { smooth_polygon(polygon_offset_distance / 1000., r); @@ -3666,11 +3666,11 @@ void arrange_cgal_polygons( std::list> segments, segments1, segments2; bool fallback_to_line_cleaning_algo_1 = false; - + if (settings.line_cleaning_algo == 0) { segments1 = extend_end_vertices_based_on_input_simple(debug_output, G, outer_perimiter, subdivision_length * 16, 0, logger); segments2 = extend_end_vertices_based_on_input_simple(debug_output, G_orig, outer_perimiter, subdivision_length * 16, 1, logger); - + Arrangement_2 arr_clean; G.to_arrangement(arr_clean); for (auto& pq : segments1) { @@ -3731,7 +3731,7 @@ void arrange_cgal_polygons( if (settings.line_cleaning_algo != 0 || fallback_to_line_cleaning_algo_1) { segments = extend_end_vertices_based_on_input(G, midpoint_to_segment, segment_to_input_facet, outer_perimiter, segment_lookup, subdivision_length * 4); - } + } // Now plot the edges on an arrangement in order to find planar cycles // and merge the corridor-halves with their neighbouring input polygon diff --git a/src/svgfill/src/graph_2d.h b/src/svgfill/src/graph_2d.h index e5601f6dea..b9e4fdd2ad 100644 --- a/src/svgfill/src/graph_2d.h +++ b/src/svgfill/src/graph_2d.h @@ -345,7 +345,7 @@ public: void to_arrangement(T& arr) { if (is_valid() && arr.is_empty()) { std::vector> edges; - + for (auto it = edges_begin(); it != edges_end(); ++it) { edges.emplace_back(it->first, it->second); } @@ -357,7 +357,7 @@ public: } CGAL::insert(arr, CGAL::Segment_2(it->first, it->second)); } - } + } } template diff --git a/src/svgfill/src/main.cpp b/src/svgfill/src/main.cpp index 3806209ca0..4c60f553ca 100644 --- a/src/svgfill/src/main.cpp +++ b/src/svgfill/src/main.cpp @@ -36,7 +36,7 @@ int main(int argc, char** argv) { bool random_color = false; double eps = 1.e-5; std::optional class_name; - + std::vector flags; std::vector args; svgfill::solver s = svgfill::FILTERED_CARTESIAN_QUOTIENT; diff --git a/src/svgfill/src/progress.h b/src/svgfill/src/progress.h index daf54a3e59..70405fb89c 100644 --- a/src/svgfill/src/progress.h +++ b/src/svgfill/src/progress.h @@ -105,7 +105,7 @@ public: { total_ = std::accumulate(estimates_.begin(), estimates_.end(), 0.f); (*this)(0.); - } + } void finished() { ++phase_; @@ -119,4 +119,4 @@ public: }; -#endif \ No newline at end of file +#endif diff --git a/src/svgfill/src/svgfill.cpp b/src/svgfill/src/svgfill.cpp index d8d1f6d015..30f27a5b51 100644 --- a/src/svgfill/src/svgfill.cpp +++ b/src/svgfill/src/svgfill.cpp @@ -144,7 +144,7 @@ boost::mpl::set< >::type processed_elements_t; // This cryptic code just merges predefined sequences traits::shapes_attributes_by_element -// and traits::viewport_attributes with tag::attribute::transform and tag::attribute::xlink::href +// and traits::viewport_attributes with tag::attribute::transform and tag::attribute::xlink::href // attributes into single MPL sequence typedef boost::mpl::fold< @@ -475,7 +475,7 @@ public: emitted = true; } } - + if (!emitted) { ps.push_back(-1); ps.push_back(-1); @@ -513,7 +513,7 @@ public: } } } - + for (auto& h : to_remove) { /* auto v0 = h->source()->point();