Replace Boost shared pointers

Generated with the assistance of an AI coding tool.
This commit is contained in:
Thomas Krijnen
2026-08-08 15:37:53 +02:00
parent 4e49b640a7
commit 8c003110fe
34 changed files with 110 additions and 105 deletions
+2 -2
View File
@@ -685,7 +685,7 @@ void convertIfcToDatabase(SessionState& session, QWidget& host) {
throw ifcopenshell::exception("RDB serializer does not support streaming from an input filename");
}
boost::shared_ptr<ifcopenshell::geom::serializer> serializer = registry.create("rdb", context);
std::shared_ptr<ifcopenshell::geom::serializer> serializer = registry.create("rdb", context);
serializer->finalize();
} catch (const std::exception& e) {
*error_message = QString::fromUtf8(e.what());
@@ -791,7 +791,7 @@ void exportGeometryDatabase(SessionState& session, QWidget& host) {
throw ifcopenshell::exception("RDB serializer does not support streaming from an input filename");
}
boost::shared_ptr<ifcopenshell::geom::serializer> serializer = registry.create("rdb", context);
std::shared_ptr<ifcopenshell::geom::serializer> serializer = registry.create("rdb", context);
serializer->finalize();
serializer.reset();
+4 -4
View File
@@ -41,7 +41,7 @@
#include "../ifcparse/utils.h"
#include <boost/program_options.hpp>
#include <boost/make_shared.hpp>
#include <memory>
#include <boost/optional/optional_io.hpp>
#include <algorithm>
@@ -616,7 +616,7 @@ int main(int argc, char** argv) {
context.schema_name = ifc_file ? ifc_file->schema()->name() : document_serializer_info->schema_name;
context.stream = use_input_filename;
boost::shared_ptr<ifcopenshell::geom::serializer> serializer = document_serializer_registry.create(output_extension_utf8, context);
std::shared_ptr<ifcopenshell::geom::serializer> serializer = document_serializer_registry.create(output_extension_utf8, context);
if (serializer->is_streaming() != use_input_filename) {
throw ifcopenshell::exception("Selected document serializer streaming mode does not match its registry metadata");
}
@@ -750,7 +750,7 @@ int main(int argc, char** argv) {
settings
};
boost::shared_ptr<ifcopenshell::geom::geometry_serializer> serializer; /**< @todo use std::unique_ptr when possible */
std::shared_ptr<ifcopenshell::geom::geometry_serializer> serializer; /**< @todo use std::unique_ptr when possible */
try {
geometry_serializer_registry.configure(output_extension_utf8, serializer_context);
serializer = geometry_serializer_registry.create(output_extension_utf8, serializer_context);
@@ -1405,7 +1405,7 @@ void fix_quantities(ifcopenshell::file& f, bool no_progress, bool quiet, bool st
express::base quantity;
std::vector<express::base> objects;
boost::shared_ptr<ifcopenshell::geom::Representation::brep> previous_geometry_pointer;
std::shared_ptr<ifcopenshell::geom::Representation::brep> previous_geometry_pointer;
for (;; ++num_created) {
bool has_more = true;
+1 -1
View File
@@ -280,7 +280,7 @@ ifcopenshell::geom::brep_element* ifcopenshell::geom::converter::create_brep_for
guid,
context_string,
place,
boost::shared_ptr<ifcopenshell::geom::Representation::brep>(shape),
std::shared_ptr<ifcopenshell::geom::Representation::brep>(shape),
product
);
+2 -1
View File
@@ -10,12 +10,13 @@
#include "../ifcgeom/element.h"
#include <boost/function.hpp>
#include <memory>
namespace ifcopenshell { namespace geom {
class IFC_GEOM_API converter {
public:
typedef boost::shared_ptr<ifcopenshell::geom::Representation::brep> brep_ptr;
typedef std::shared_ptr<ifcopenshell::geom::Representation::brep> brep_ptr;
private:
ifcopenshell::geom::abstract_mapping* mapping_;
std::unique_ptr<ifcopenshell::geom::kernels::abstract_kernel> kernel_;
+9 -9
View File
@@ -160,12 +160,12 @@ namespace ifcopenshell::geom {
class brep_element : public element {
private:
boost::shared_ptr<ifcopenshell::geom::Representation::brep> _geometry;
std::shared_ptr<ifcopenshell::geom::Representation::brep> _geometry;
public:
const boost::shared_ptr<ifcopenshell::geom::Representation::brep>& geometry_pointer() const { return _geometry; }
const std::shared_ptr<ifcopenshell::geom::Representation::brep>& geometry_pointer() const { return _geometry; }
const ifcopenshell::geom::Representation::brep& geometry() const { return *_geometry; }
brep_element(int id, int parent_id, const std::string& name, const std::string& type, const std::string& guid,
const std::string& context, const ifcopenshell::geom::taxonomy::matrix4::ptr& trsf, const boost::shared_ptr<ifcopenshell::geom::Representation::brep>& geometry,
const std::string& context, const ifcopenshell::geom::taxonomy::matrix4::ptr& trsf, const std::shared_ptr<ifcopenshell::geom::Representation::brep>& geometry,
const express::entity& product)
: element(geometry->settings(), id, parent_id, name, type, guid, context, trsf, product)
, _geometry(geometry)
@@ -182,15 +182,15 @@ namespace ifcopenshell::geom {
class triangulation_element : public element {
private:
boost::shared_ptr< ifcopenshell::geom::Representation::triangulation > _geometry;
std::shared_ptr< ifcopenshell::geom::Representation::triangulation > _geometry;
public:
const ifcopenshell::geom::Representation::triangulation& geometry() const { return *_geometry; }
const boost::shared_ptr< ifcopenshell::geom::Representation::triangulation>& geometry_pointer() const { return _geometry; }
const std::shared_ptr< ifcopenshell::geom::Representation::triangulation>& geometry_pointer() const { return _geometry; }
triangulation_element(const ifcopenshell::geom::brep_element& shape_model)
: element(shape_model)
, _geometry(boost::shared_ptr<ifcopenshell::geom::Representation::triangulation>(new ifcopenshell::geom::Representation::triangulation(shape_model.geometry())))
, _geometry(std::make_shared<ifcopenshell::geom::Representation::triangulation>(shape_model.geometry()))
{}
triangulation_element(const ifcopenshell::geom::element& source, const boost::shared_ptr<ifcopenshell::geom::Representation::triangulation>& geometry)
triangulation_element(const ifcopenshell::geom::element& source, const std::shared_ptr<ifcopenshell::geom::Representation::triangulation>& geometry)
: element(source)
, _geometry(geometry)
{}
@@ -202,12 +202,12 @@ namespace ifcopenshell::geom {
class serialized_element : public element {
private:
boost::shared_ptr<ifcopenshell::geom::Representation::serialization> _geometry;
std::shared_ptr<ifcopenshell::geom::Representation::serialization> _geometry;
public:
const ifcopenshell::geom::Representation::serialization& geometry() const { return *_geometry; }
serialized_element(const brep_element& shape_model)
: element(shape_model)
, _geometry(boost::shared_ptr<ifcopenshell::geom::Representation::serialization>(new ifcopenshell::geom::Representation::serialization(shape_model.geometry())))
, _geometry(std::make_shared<ifcopenshell::geom::Representation::serialization>(shape_model.geometry()))
{}
serialized_element(const serialized_element& other) = default;
private:
@@ -551,7 +551,7 @@ bool ifcopenshell::geom::open_cascade_kernel::convert_impl(const taxonomy::revol
// guid,
// context_string,
// trsf,
// boost::shared_ptr<ifcopenshell::geom::Representation::brep>(shape),
// std::shared_ptr<ifcopenshell::geom::Representation::brep>(shape),
// product
// );
//
+1 -1
View File
@@ -25,7 +25,7 @@
#include <boost/dynamic_bitset.hpp>
#include <boost/logic/tribool.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <string>
#include <vector>
+1 -1
View File
@@ -26,7 +26,7 @@
#include "utils.h"
#include <atomic>
#include <boost/shared_ptr.hpp>
#include <memory>
class aggregate_of_instance;
+1 -1
View File
@@ -390,7 +390,7 @@ public:
///
/// Attention when running remove_entity inside a loop over a list of entities to be removed.
/// This invalidates the iterator. A workaround is to reverse the loop:
/// boost::shared_ptr<aggregate_of_instance> entities = ...;
/// std::shared_ptr<aggregate_of_instance> entities = ...;
/// for (auto it = entities->end() - 1; it >= entities->begin(); --it) {
/// ifcopenshell::IfcBaseClass *const inst = *it;
/// model->remove_entity(inst);
+1 -1
View File
@@ -41,7 +41,7 @@
#include <cstring>
#include <boost/optional.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/logic/tribool.hpp>
#include <boost/dynamic_bitset.hpp>
+1 -1
View File
@@ -2750,7 +2750,7 @@ void file::remove_entity(const express::base& entity) {
// Attention when running remove_entity inside a loop over a list of entities to be removed.
// This invalidates the iterator. A workaround is to reverse the loop:
// boost::shared_ptr<aggregate_of_instance> entities = ...;
// std::shared_ptr<aggregate_of_instance> entities = ...;
// for (auto it = entities->end() - 1; it >= entities->begin(); --it) {
// express::base *const inst = *it;
// model->remove_entity(inst);
+1 -1
View File
@@ -36,7 +36,7 @@
#include "storage.h"
#include <boost/dynamic_bitset.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <cstring>
#include <iostream>
#include <string>
+1 -1
View File
@@ -442,7 +442,7 @@ public:
}
private:
boost::shared_ptr<geometry_serializer> serializer_;
std::shared_ptr<geometry_serializer> serializer_;
};
%}
+3 -3
View File
@@ -23,15 +23,15 @@
#ifdef IFOPSH_WITH_ROCKSDB
#include <boost/dll/alias.hpp>
#include <boost/make_shared.hpp>
#include <memory>
namespace {
boost::shared_ptr<ifcopenshell::geom::serializer> create_serializer(const ifcopenshell::serializers::document_serializer_context& context) {
std::shared_ptr<ifcopenshell::geom::serializer> create_serializer(const ifcopenshell::serializers::document_serializer_context& context) {
if (context.input_filename.empty()) {
throw ifcopenshell::exception("RocksDB document serializer requires an input filename");
}
return boost::make_shared<RocksDbSerializer>(context.input_filename, context.output_filename, context.skip_supertypes);
return std::make_shared<RocksDbSerializer>(context.input_filename, context.output_filename, context.skip_supertypes);
}
}
@@ -125,7 +125,7 @@ const ifcopenshell::serializers::document_serializer_info* ifcopenshell::seriali
return entry ? &entry->info_ : nullptr;
}
boost::shared_ptr<ifcopenshell::geom::serializer> ifcopenshell::serializers::document_serializer_registry::create(const std::string& format, const document_serializer_context& context) const {
std::shared_ptr<ifcopenshell::geom::serializer> ifcopenshell::serializers::document_serializer_registry::create(const std::string& format, const document_serializer_context& context) const {
const auto schema_name = !context.schema_name.empty() ? context.schema_name :
(context.file ? context.file->schema()->name() : std::string());
auto* registry = const_cast<document_serializer_registry*>(this);
+3 -3
View File
@@ -26,7 +26,7 @@
#include "../plugin/plugin.h"
#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <filesystem>
#include <map>
@@ -64,11 +64,11 @@ struct SERIALIZERS_API document_serializer_context {
class SERIALIZERS_API document_serializer_registry {
public:
typedef boost::function<boost::shared_ptr<serializer>(const document_serializer_context&)> create_fn;
typedef boost::function<std::shared_ptr<serializer>(const document_serializer_context&)> create_fn;
void bind(const document_serializer_info& info, create_fn create, const ifcopenshell::plugin::module& module = ifcopenshell::plugin::module());
const document_serializer_info* find(const std::string& format, const std::string& schema_name = std::string()) const;
boost::shared_ptr<serializer> create(const std::string& format, const document_serializer_context& context) const;
std::shared_ptr<serializer> create(const std::string& format, const document_serializer_context& context) const;
std::vector<document_serializer_info> serializers() const;
private:
+3 -3
View File
@@ -23,7 +23,7 @@
#include "geometry_serializer_plugin.h"
#include <boost/dll/alias.hpp>
#include <boost/make_shared.hpp>
#include <memory>
namespace ifcopenshell {
namespace serializers {
@@ -37,8 +37,8 @@ plugin::metadata plugin_metadata() {
return geometry_serializer_plugin_metadata("dae");
}
boost::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
return boost::make_shared<collada_serializer>(context.output_temp_filename, context.settings);
std::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
return std::make_shared<collada_serializer>(context.output_temp_filename, context.settings);
}
void register_plugin(geometry_serializer_registry& registry, const plugin::module& module) {
+3 -3
View File
@@ -23,7 +23,7 @@
#include "gltf_serializer.h"
#include <boost/dll/alias.hpp>
#include <boost/make_shared.hpp>
#include <memory>
namespace ifcopenshell {
namespace serializers {
@@ -37,8 +37,8 @@ plugin::metadata plugin_metadata() {
return geometry_serializer_plugin_metadata("glb");
}
boost::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
return boost::make_shared<gltf_serializer>(context.output_temp_filename, context.settings);
std::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
return std::make_shared<gltf_serializer>(context.output_temp_filename, context.settings);
}
void register_plugin(geometry_serializer_registry& registry, const plugin::module& module) {
+3 -3
View File
@@ -23,7 +23,7 @@
#include "iges_serializer.h"
#include <boost/dll/alias.hpp>
#include <boost/make_shared.hpp>
#include <memory>
#include <Standard_Version.hxx>
@@ -43,11 +43,11 @@ plugin::metadata plugin_metadata() {
return geometry_serializer_plugin_metadata("igs");
}
boost::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
std::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
#if OCC_VERSION_HEX < 0x60900
IGESControl_Controller::Init();
#endif
return boost::make_shared<iges_serializer>(context.output_temp_filename, context.settings);
return std::make_shared<iges_serializer>(context.output_temp_filename, context.settings);
}
void configure_serializer(geometry_serializer_context& context) {
+4 -4
View File
@@ -23,7 +23,7 @@
#include "../ifcparse/utils.h"
#include <boost/dll/alias.hpp>
#include <boost/make_shared.hpp>
#include <memory>
#include <filesystem>
@@ -49,7 +49,7 @@ plugin::metadata plugin_metadata() {
return geometry_serializer_plugin_metadata("obj");
}
boost::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
std::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
if (context.output_temp_stream || context.output_stream) {
stream_or_filename obj_filename = context.output_temp_stream
? *context.output_temp_stream
@@ -57,10 +57,10 @@ boost::shared_ptr<geometry_serializer> create_serializer(const geometry_serializ
stream_or_filename mtl_filename = context.output_stream
? *context.output_stream
: stream_or_filename(obj_mtl_filename(context.output_filename));
return boost::make_shared<wavefront_obj_serializer>(
return std::make_shared<wavefront_obj_serializer>(
obj_filename, mtl_filename, context.settings);
}
return boost::make_shared<wavefront_obj_serializer>(context.output_temp_filename, obj_mtl_filename(context.output_filename), context.settings);
return std::make_shared<wavefront_obj_serializer>(context.output_temp_filename, obj_mtl_filename(context.output_filename), context.settings);
}
void configure_serializer(geometry_serializer_context& context) {
@@ -130,7 +130,7 @@ void ifcopenshell::serializers::geometry_serializer_registry::configure(const st
}
}
boost::shared_ptr<ifcopenshell::geom::geometry_serializer> ifcopenshell::serializers::geometry_serializer_registry::create(const std::string& extension, const geometry_serializer_context& context) const {
std::shared_ptr<ifcopenshell::geom::geometry_serializer> ifcopenshell::serializers::geometry_serializer_registry::create(const std::string& extension, const geometry_serializer_context& context) const {
const auto key = geometry_serializer_key(extension);
if (entries_.find(key) == entries_.end()) {
load_geometry_serializer_plugin(const_cast<geometry_serializer_registry&>(*this), extension);
+3 -3
View File
@@ -25,7 +25,7 @@
#include "../plugin/plugin.h"
#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <filesystem>
#include <map>
@@ -61,14 +61,14 @@ struct SERIALIZERS_API geometry_serializer_context {
class SERIALIZERS_API geometry_serializer_registry {
public:
typedef boost::function<boost::shared_ptr<geometry_serializer>(const geometry_serializer_context&)> create_fn;
typedef boost::function<std::shared_ptr<geometry_serializer>(const geometry_serializer_context&)> create_fn;
typedef boost::function<void(geometry_serializer_context&)> configure_fn;
void bind(const geometry_serializer_info& info, create_fn create, configure_fn configure = configure_fn(), const ifcopenshell::plugin::module& module = ifcopenshell::plugin::module());
bool has(const std::string& extension) const;
const geometry_serializer_info* find(const std::string& extension) const;
void configure(const std::string& extension, geometry_serializer_context& context) const;
boost::shared_ptr<geometry_serializer> create(const std::string& extension, const geometry_serializer_context& context) const;
std::shared_ptr<geometry_serializer> create(const std::string& extension, const geometry_serializer_context& context) const;
std::vector<geometry_serializer_info> serializers() const;
private:
+3 -3
View File
@@ -23,7 +23,7 @@
#include "step_serializer.h"
#include <boost/dll/alias.hpp>
#include <boost/make_shared.hpp>
#include <memory>
namespace ifcopenshell {
namespace serializers {
@@ -37,8 +37,8 @@ plugin::metadata plugin_metadata() {
return geometry_serializer_plugin_metadata("stp");
}
boost::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
return boost::make_shared<step_serializer>(context.output_temp_filename, context.settings);
std::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
return std::make_shared<step_serializer>(context.output_temp_filename, context.settings);
}
void configure_serializer(geometry_serializer_context& context) {
+4 -4
View File
@@ -23,7 +23,7 @@
#include "svg_serializer.h"
#include <boost/dll/alias.hpp>
#include <boost/make_shared.hpp>
#include <memory>
namespace ifcopenshell {
namespace serializers {
@@ -37,12 +37,12 @@ plugin::metadata plugin_metadata() {
return geometry_serializer_plugin_metadata("svg");
}
boost::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
std::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
if (context.output_temp_stream) {
return boost::make_shared<svg_serializer>(
return std::make_shared<svg_serializer>(
*context.output_temp_stream, context.settings);
}
return boost::make_shared<svg_serializer>(context.output_temp_filename, context.settings);
return std::make_shared<svg_serializer>(context.output_temp_filename, context.settings);
}
void configure_serializer(geometry_serializer_context& context) {
+4 -4
View File
@@ -21,7 +21,7 @@
#include "ttl_wkt_serializer.h"
#include <boost/dll/alias.hpp>
#include <boost/make_shared.hpp>
#include <memory>
namespace ifcopenshell {
namespace serializers {
@@ -35,12 +35,12 @@ plugin::metadata plugin_metadata() {
return geometry_serializer_plugin_metadata("ttl");
}
boost::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
std::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
if (context.output_temp_stream) {
return boost::make_shared<ttl_wkt_serializer>(
return std::make_shared<ttl_wkt_serializer>(
*context.output_temp_stream, context.settings);
}
return boost::make_shared<ttl_wkt_serializer>(context.output_temp_filename, context.settings);
return std::make_shared<ttl_wkt_serializer>(context.output_temp_filename, context.settings);
}
void configure_serializer(geometry_serializer_context& context) {
+3 -3
View File
@@ -23,7 +23,7 @@
#include "usd_serializer.h"
#include <boost/dll/alias.hpp>
#include <boost/make_shared.hpp>
#include <memory>
namespace ifcopenshell {
namespace serializers {
@@ -37,8 +37,8 @@ plugin::metadata plugin_metadata() {
return geometry_serializer_plugin_metadata("usd");
}
boost::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
return boost::make_shared<usd_serializer>(context.output_filename, context.settings);
std::shared_ptr<geometry_serializer> create_serializer(const geometry_serializer_context& context) {
return std::make_shared<usd_serializer>(context.output_filename, context.settings);
}
void register_plugin(geometry_serializer_registry& registry, const plugin::module& module) {
+2 -2
View File
@@ -9,7 +9,7 @@
#include "../serializers/serializers_api.h"
#include "../serializers/document_serializer_plugin.h"
#include <boost/shared_ptr.hpp>
#include <memory>
class json_serializer : public ifcopenshell::geom::serializer {
public:
@@ -17,7 +17,7 @@ class json_serializer : public ifcopenshell::geom::serializer {
JSON_DIALECT_CREOOX
};
private:
boost::shared_ptr<ifcopenshell::geom::serializer> implementation_;
std::shared_ptr<ifcopenshell::geom::serializer> implementation_;
protected:
std::string json_filename;
@@ -25,12 +25,12 @@
#include "../../ifcparse/macros.h"
#include <boost/dll/alias.hpp>
#include <boost/make_shared.hpp>
#include <memory>
namespace {
boost::shared_ptr<ifcopenshell::geom::serializer> create_serializer(const ifcopenshell::serializers::document_serializer_context& context) {
return boost::make_shared<POSTFIX_SCHEMA(json_serializer)>(
std::shared_ptr<ifcopenshell::geom::serializer> create_serializer(const ifcopenshell::serializers::document_serializer_context& context) {
return std::make_shared<POSTFIX_SCHEMA(json_serializer)>(
context.file,
context.output_filename,
static_cast<json_serializer::Dialect>(context.dialect));
@@ -23,12 +23,12 @@
#include "../../ifcparse/macros.h"
#include <boost/dll/alias.hpp>
#include <boost/make_shared.hpp>
#include <memory>
namespace {
boost::shared_ptr<ifcopenshell::geom::serializer> create_serializer(const ifcopenshell::serializers::document_serializer_context& context) {
return boost::make_shared<POSTFIX_SCHEMA(xml_serializer)>(context.file, context.output_filename);
std::shared_ptr<ifcopenshell::geom::serializer> create_serializer(const ifcopenshell::serializers::document_serializer_context& context) {
return std::make_shared<POSTFIX_SCHEMA(xml_serializer)>(context.file, context.output_filename);
}
}
+4 -4
View File
@@ -557,7 +557,7 @@ typedef prefiltered_hlr hlr_engine;
class SERIALIZERS_API svg_serializer : public ifcopenshell::geom::write_only_geometry_serializer {
public:
typedef std::pair<std::string, std::vector<util::string_buffer> > path_object;
typedef std::vector< boost::shared_ptr<util::string_buffer::float_item> > float_item_list;
typedef std::vector< std::shared_ptr<util::string_buffer::float_item> > float_item_list;
enum storey_height_display_types {
SH_NONE, SH_FULL, SH_LEFT
};
@@ -668,9 +668,9 @@ public:
{
apply_settings();
}
void addXCoordinate(const boost::shared_ptr<util::string_buffer::float_item>& fi) { xcoords.push_back(fi); }
void addYCoordinate(const boost::shared_ptr<util::string_buffer::float_item>& fi) { ycoords.push_back(fi); }
void addSizeComponent(const boost::shared_ptr<util::string_buffer::float_item>& fi) { radii.push_back(fi); }
void addXCoordinate(const std::shared_ptr<util::string_buffer::float_item>& fi) { xcoords.push_back(fi); }
void addYCoordinate(const std::shared_ptr<util::string_buffer::float_item>& fi) { ycoords.push_back(fi); }
void addSizeComponent(const std::shared_ptr<util::string_buffer::float_item>& fi) { radii.push_back(fi); }
void growBoundingBox(double x, double y) { if (x < xmin) xmin = x; if (x > xmax) xmax = x; if (y < ymin) ymin = y; if (y > ymax) ymax = y; }
void writeHeader();
void doWriteHeader();
+5 -5
View File
@@ -24,19 +24,19 @@
using namespace util;
boost::shared_ptr<string_buffer::string_item> string_buffer::add(const std::string& s) {
boost::shared_ptr<string_item> i = boost::shared_ptr<string_item>(new string_item(s));
std::shared_ptr<string_buffer::string_item> string_buffer::add(const std::string& s) {
auto i = std::make_shared<string_item>(s);
items.push_back(i);
return i;
}
boost::shared_ptr<string_buffer::float_item> string_buffer::add(const double& d) {
boost::shared_ptr<float_item> i = boost::shared_ptr<float_item>(new float_item(d));
std::shared_ptr<string_buffer::float_item> string_buffer::add(const double& d) {
auto i = std::make_shared<float_item>(d);
items.push_back(i);
return i;
}
std::string string_buffer::str() const {
std::stringstream ss;
for (std::vector< boost::shared_ptr<item> >::const_iterator it = items.begin(); it != items.end(); ++it) {
for (std::vector< std::shared_ptr<item> >::const_iterator it = items.begin(); it != items.end(); ++it) {
ss << (**it).str();
}
return ss.str();
+5 -5
View File
@@ -25,7 +25,7 @@
#include <iomanip>
#include <limits>
#include <boost/shared_ptr.hpp>
#include <memory>
namespace util {
class string_buffer {
@@ -56,12 +56,12 @@ namespace util {
virtual ~float_item() {};
};
private:
std::vector< boost::shared_ptr<item> > items;
std::vector< std::shared_ptr<item> > items;
void clear();
void assign(const std::vector< boost::shared_ptr<item> >& other);
void assign(const std::vector< std::shared_ptr<item> >& other);
public:
boost::shared_ptr<string_item> add(const std::string& s);
boost::shared_ptr<float_item> add(const double& d);
std::shared_ptr<string_item> add(const std::string& s);
std::shared_ptr<float_item> add(const double& d);
bool empty() const { return items.empty(); }
std::string str() const;
};
+2 -2
View File
@@ -9,11 +9,11 @@
#include "../plugin/plugin.h"
#include "../serializers/document_serializer_plugin.h"
#include <boost/shared_ptr.hpp>
#include <memory>
class xml_serializer : public ifcopenshell::geom::serializer {
private:
boost::shared_ptr<ifcopenshell::geom::serializer> implementation_;
std::shared_ptr<ifcopenshell::geom::serializer> implementation_;
protected:
std::string xml_filename;
+22 -18
View File
@@ -31,10 +31,8 @@
#if CGAL_VERSION_NR >= 1060000000
#define variant_get std::get_if
#define my_shared_ptr std::shared_ptr
#else
#define variant_get boost::get
#define my_shared_ptr boost::shared_ptr
#endif
typedef CGAL::Exact_predicates_exact_constructions_kernel K;
@@ -102,25 +100,31 @@ std::vector<Polygon_2> create_and_convert_offset_polygon(double offset_distance,
remove_close_points(polygon);
// Create the offset polygons using Epick kernel
// create_exterior_skeleton_and_offset_polygons_2()
std::vector<my_shared_ptr<CGAL::Polygon_2<CGAL::Epick>>> offset_polygons;
// Copy each generated offset polygon out of CGAL's version-dependent
// pointer type, then convert it back to the Epeck kernel.
std::vector<Polygon_2> exact_offset_polygons;
const auto append_polygons = [&exact_offset_polygons](const auto& offset_polygons, bool exterior) {
auto begin = offset_polygons.begin();
if (exterior) {
// The first polygon is the outer frame.
++begin;
}
for (auto it = begin; it != offset_polygons.end(); ++it) {
auto inexact_poly = **it;
if (exterior && it == begin) {
inexact_poly.reverse_orientation();
}
remove_close_points(inexact_poly);
exact_offset_polygons.push_back(convert_polygon(inexact_poly));
}
};
if (offset_distance >= 0.) {
offset_polygons = CGAL::create_exterior_skeleton_and_offset_polygons_2(offset_distance, polygon);
// erase the first outer frame
offset_polygons.erase(offset_polygons.begin());
offset_polygons.front()->reverse_orientation();
const auto offset_polygons = CGAL::create_exterior_skeleton_and_offset_polygons_2(offset_distance, polygon);
append_polygons(offset_polygons, true);
} else {
offset_polygons = CGAL::create_interior_skeleton_and_offset_polygons_2(-offset_distance, polygon);
}
// Convert each offset polygon back to the Epeck kernel
std::vector<Polygon_2> exact_offset_polygons;
for (auto& inexact_poly_ptr : offset_polygons) {
remove_close_points(*inexact_poly_ptr);
Polygon_2 exact_poly = convert_polygon(*inexact_poly_ptr);
exact_offset_polygons.push_back(exact_poly);
const auto offset_polygons = CGAL::create_interior_skeleton_and_offset_polygons_2(-offset_distance, polygon);
append_polygons(offset_polygons, false);
}
return exact_offset_polygons;