Files
OrcaSlicer/src/slic3r/GUI/Jobs/RotoptimizeJob.hpp
T
HanifKoh 1a5f91d727 Add Missing Includes Across src/slic3r/GUI (#16048)
* Add Missing Includes Across src/slic3r/GUI

Every GUI source and header now directly includes the headers declaring what it uses, rather than relying on the precompiled header or transitive includes. Generated with clang-tidy misc-include-cleaner, plus one hand edit making CalibrationPanel.hpp self-contained.

* Drop the OS-Specific Includes Added Outside Their Platform Guards

GLib, GTK, D-Bus and POSIX headers are only used inside platform #if blocks, which already include them. Added unconditionally at the top of the file they broke the Windows build.

* Add the clang-tidy Configuration That Generated These Includes

Only misc-include-cleaner's missing-include check, with the headers it must never suggest: per-platform, internal and OS-specific ones that would break other platforms or are not meant to be included directly.

* Match Windows Paths in the clang-tidy Ignore List

Header paths use backslashes on Windows, so every / in a pattern is now [/\\]. The Windows SDK headers are ignored alongside the other OS-specific ones, and the list is one pattern per line. Suggested by @raistlin7447 from a Windows clang-cl run.
2026-10-02 14:56:56 +08:00

85 lines
2.3 KiB
C++

#ifndef ROTOPTIMIZEJOB_HPP
#define ROTOPTIMIZEJOB_HPP
#include "Job.hpp"
#include "libslic3r/SLA/Rotfinder.hpp"
#include "libslic3r/PrintConfig.hpp"
#include "slic3r/GUI/I18N.hpp"
#include <functional>
#include "libslic3r/Point.hpp"
#include <string>
#include <cstddef>
#include <optional>
#include <vector>
#include <exception>
#include <iterator>
namespace Slic3r {
namespace GUI {
class Plater;
class RotoptimizeJob : public Job
{
using FindFn = std::function<Vec2d(const ModelObject & mo,
const sla::RotOptimizeParams &params)>;
struct FindMethod { std::string name; FindFn findfn; std::string descr; };
static inline const FindMethod Methods[]
= {{L("Best surface quality"),
sla::find_best_misalignment_rotation,
L("Optimize object rotation for best surface quality.")},
{L("Reduced overhang slopes"),
sla::find_least_supports_rotation,
L("Optimize object rotation to have minimum amount of overhangs needing support "
"structures.\nNote that this method will try to find the best surface of the object "
"for touching the print bed if no elevation is set.")},
// Just a min area bounding box that is done for all methods anyway.
{L("Lowest Z height"),
sla::find_min_z_height_rotation,
L("Rotate the model to have the lowest z height for faster print time.")}};
size_t m_method_id = 0;
float m_accuracy = 0.75;
DynamicPrintConfig m_default_print_cfg;
struct ObjRot
{
size_t idx;
std::optional<Vec2d> rot;
ObjRot(size_t id): idx{id}, rot{} {}
};
std::vector<ObjRot> m_selected_object_ids;
Plater *m_plater;
public:
void prepare();
void process(Ctl &ctl) override;
RotoptimizeJob();
void finalize(bool canceled, std::exception_ptr &) override;
static constexpr size_t get_methods_count() { return std::size(Methods); }
static std::string get_method_name(size_t i)
{
return _utf8(Methods[i].name);
}
static std::string get_method_description(size_t i)
{
return _utf8(Methods[i].descr);
}
};
}} // namespace Slic3r::GUI
#endif // ROTOPTIMIZEJOB_HPP