mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-07 15:51:08 +00:00
* Remove Unused Project Includes and Forward-Declare Where a Type Is Only Referenced Generated with include-what-you-use and applied conservatively. Only OrcaSlicer's own headers, the ones under src/ and tests/, are removed or forward-declared; standard-library and third-party includes are left alone. An include is removed only when both the Release and the Debug configuration leave it unused, never from inside a conditional block, and never from a file with platform-specific blocks, which only gain includes. Files whose only use of a header sits behind a feature or debug macro (libvgcode's OpenGL ES and marker code, the ARACHNE/TESTS_EXPORT_SVGS debug output) keep their includes. clonable_ptr.hpp gains #pragma once; it had no include guard and was only safe while Config.hpp was its sole includer. * Remove Unused Project Includes From Files With Platform-Specific Code A Linux include-what-you-use run cannot see the code inside _WIN32, __APPLE__ or __linux__ blocks, so its verdict is only taken where nothing the removed header declares, directly or through what it includes, is named inside those blocks. Removals also have to hold in both the Release and Debug configuration and never touch a line inside a conditional block. * Restore the libslic3r Precompiled Header and Direct Includes Lost in the Platform Pass The platform-file pass treated pchheader.hpp as an ordinary header and emptied it, and left GUI_Preview.hpp and 14 other files relying on headers they no longer reached directly. * Restore MainFrame.hpp in ParamsDialog.cpp for the Windows-Only Reparent Call * Include Headers That Files Reached Through Ones the Cleanup Removed * Drop Includes Duplicated by the Cleanup or by Main's Own Additions * Leave PreciseSeam.cpp as Main Has It After the Precise Seam Rework
93 lines
4.3 KiB
C++
93 lines
4.3 KiB
C++
#ifndef slic3r_SurfaceCollection_hpp_
|
|
#define slic3r_SurfaceCollection_hpp_
|
|
|
|
#include "Polygon.hpp"
|
|
#include "ExPolygon.hpp"
|
|
#include "Surface.hpp"
|
|
#include <cstddef>
|
|
#include <initializer_list>
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
namespace Slic3r {
|
|
|
|
class SurfaceCollection
|
|
{
|
|
public:
|
|
Surfaces surfaces;
|
|
|
|
SurfaceCollection() = default;
|
|
SurfaceCollection(const Surfaces& surfaces) : surfaces(surfaces) {};
|
|
SurfaceCollection(Surfaces &&surfaces) : surfaces(std::move(surfaces)) {};
|
|
|
|
void simplify(double tolerance);
|
|
void group(std::vector<SurfacesPtr> *retval);
|
|
template <class T> bool any_internal_contains(const T &item) const {
|
|
for (const Surface &surface : this->surfaces) if (surface.is_internal() && surface.expolygon.contains(item)) return true;
|
|
return false;
|
|
}
|
|
template <class T> bool any_bottom_contains(const T &item) const {
|
|
for (const Surface &surface : this->surfaces) if (surface.is_bottom() && surface.expolygon.contains(item)) return true;
|
|
return false;
|
|
}
|
|
SurfacesPtr filter_by_type(const SurfaceType type) const;
|
|
SurfacesPtr filter_by_types(std::initializer_list<SurfaceType> types) const;
|
|
void keep_type(const SurfaceType type);
|
|
void keep_types(std::initializer_list<SurfaceType> types);
|
|
void remove_type(const SurfaceType type);
|
|
void remove_types(std::initializer_list<SurfaceType> types);
|
|
void filter_by_type(SurfaceType type, Polygons* polygons) const;
|
|
void remove_type(const SurfaceType type, ExPolygons *polygons);
|
|
void set_type(SurfaceType type) {
|
|
for (Surface &surface : this->surfaces)
|
|
surface.surface_type = type;
|
|
}
|
|
//BBS
|
|
void change_to_new_type(SurfaceType old_type, SurfaceType new_type) {
|
|
for (Surface& surface : this->surfaces)
|
|
if (surface.surface_type == old_type)
|
|
surface.surface_type = new_type;
|
|
}
|
|
|
|
void clear() { surfaces.clear(); }
|
|
bool empty() const { return surfaces.empty(); }
|
|
size_t size() const { return surfaces.size(); }
|
|
bool has(SurfaceType type) const {
|
|
for (const Surface &surface : this->surfaces)
|
|
if (surface.surface_type == type) return true;
|
|
return false;
|
|
}
|
|
|
|
Surfaces::const_iterator cbegin() const { return this->surfaces.cbegin(); }
|
|
Surfaces::const_iterator cend() const { return this->surfaces.cend(); }
|
|
Surfaces::const_iterator begin() const { return this->surfaces.cbegin(); }
|
|
Surfaces::const_iterator end() const { return this->surfaces.cend(); }
|
|
Surfaces::iterator begin() { return this->surfaces.begin(); }
|
|
Surfaces::iterator end() { return this->surfaces.end(); }
|
|
|
|
void set(const SurfaceCollection &coll) { surfaces = coll.surfaces; }
|
|
void set(SurfaceCollection &&coll) { surfaces = std::move(coll.surfaces); }
|
|
void set(const ExPolygons &src, SurfaceType surfaceType) { clear(); this->append(src, surfaceType); }
|
|
void set(const ExPolygons &src, const Surface &surfaceTempl) { clear(); this->append(src, surfaceTempl); }
|
|
void set(const Surfaces &src) { clear(); this->append(src); }
|
|
void set(ExPolygons &&src, SurfaceType surfaceType) { clear(); this->append(std::move(src), surfaceType); }
|
|
void set(ExPolygons &&src, const Surface &surfaceTempl) { clear(); this->append(std::move(src), surfaceTempl); }
|
|
void set(Surfaces &&src) { clear(); this->append(std::move(src)); }
|
|
|
|
void append(const SurfaceCollection &coll) { this->append(coll.surfaces); }
|
|
void append(SurfaceCollection &&coll) { this->append(std::move(coll.surfaces)); }
|
|
void append(const ExPolygons &src, SurfaceType surfaceType) { surfaces_append(this->surfaces, src, surfaceType); }
|
|
void append(const ExPolygons &src, const Surface &surfaceTempl) { surfaces_append(this->surfaces, src, surfaceTempl); }
|
|
void append(const Surfaces &src) { surfaces_append(this->surfaces, src); }
|
|
void append(ExPolygons &&src, SurfaceType surfaceType) { surfaces_append(this->surfaces, std::move(src), surfaceType); }
|
|
void append(ExPolygons &&src, const Surface &surfaceTempl) { surfaces_append(this->surfaces, std::move(src), surfaceTempl); }
|
|
void append(Surfaces &&src) { surfaces_append(this->surfaces, std::move(src)); }
|
|
|
|
// For debugging purposes:
|
|
void export_to_svg(const char *path, bool show_labels);
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|