mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-25 14:58:20 -05: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
3.6 KiB
C++
93 lines
3.6 KiB
C++
#ifndef TIMELAPSE_POS_PICKER_HPP
|
|
#define TIMELAPSE_POS_PICKER_HPP
|
|
|
|
#include <optional>
|
|
#include <unordered_map>
|
|
#include <vector>
|
|
#include "libslic3r/Polygon.hpp"
|
|
#include "libslic3r/BoundingBox.hpp"
|
|
#include "libslic3r/Point.hpp"
|
|
#include "libslic3r/ExPolygon.hpp"
|
|
#include "libslic3r/Print.hpp"
|
|
#include "libslic3r/MultiMaterialSegmentation.hpp"
|
|
|
|
namespace Slic3r { enum class PrintSequence; }
|
|
|
|
namespace Slic3r {
|
|
|
|
const Point DefaultTimelapsePos = Point(0, 0);
|
|
const Point DefaultCameraPos = Point(0, 0);
|
|
|
|
class Layer;
|
|
class Print;
|
|
|
|
struct PosPickCtx
|
|
{
|
|
Point curr_pos;
|
|
const Layer* curr_layer;
|
|
int picture_extruder_id; // the extruder id to take picture
|
|
int curr_extruder_id;
|
|
std::optional<std::vector<const PrintObject*>> printed_objects; // printed objects, only have value in by object mode
|
|
// Farthest-point timelapse: plate-relative scaled point; when set, pick_pos_internal
|
|
// biases the picked snapshot position toward this point (nullopt → legacy camera-occlusion loss).
|
|
std::optional<Point> farthest_point;
|
|
};
|
|
|
|
// data are stored without plate offset
|
|
class TimelapsePosPicker
|
|
{
|
|
public:
|
|
TimelapsePosPicker() = default;
|
|
~TimelapsePosPicker() = default;
|
|
|
|
Point pick_pos(const PosPickCtx& ctx);
|
|
// Is the path to X0 clear of other (taller) instances? Drives the
|
|
// `clear_to_x0` timelapse-gcode variable (g39 clamping detection).
|
|
bool get_is_clear_to_x0(const PosPickCtx& ctx);
|
|
void init(const Print* print, const Point& plate_offset);
|
|
void reset();
|
|
private:
|
|
void construct_printable_area_by_printer();
|
|
|
|
Point pick_pos_for_curr_layer(const PosPickCtx& ctx);
|
|
Point pick_pos_for_all_layer(const PosPickCtx& ctx);
|
|
|
|
ExPolygons collect_object_slices_data(const Layer* curr_layer, float height_range, const std::vector<const PrintObject*>& object_list,bool by_object);
|
|
Polygons collect_limit_areas_for_camera(const std::vector<const PrintObject*>& object_list);
|
|
|
|
Polygons collect_limit_areas_for_rod(const std::vector<const PrintObject*>& object_list, const PosPickCtx& ctx);
|
|
|
|
Polygon expand_object_projection(const Polygon &poly, bool by_object, bool higher_than_curr = true);
|
|
BoundingBoxf3 expand_object_bbox(const BoundingBoxf3& bbox, bool by_object);
|
|
|
|
Point pick_nearest_object_center(const Point& curr_pos, const std::vector<const PrintObject*>& object_list);
|
|
Point get_objects_center(const std::vector<const PrintObject*>& object_list);
|
|
|
|
Polygon get_limit_area_for_camera(const PrintObject* obj);
|
|
std::vector<const PrintObject*> get_object_list(const std::optional<std::vector<const PrintObject*>>& printed_objects);
|
|
|
|
double get_raft_height(const PrintObject* obj);
|
|
BoundingBoxf3 get_real_instance_bbox(const PrintInstance& instance);
|
|
Point get_object_center(const PrintObject* obj);
|
|
private:
|
|
const Print* print{ nullptr };
|
|
std::vector<ExPolygons> m_extruder_printable_area; //scaled data
|
|
Polygon m_bed_polygon; //scaled_data
|
|
Point m_plate_offset; // unscaled data
|
|
int m_plate_height; // unscaled data
|
|
int m_plate_width; // unscaled data
|
|
|
|
PrintSequence m_print_seq;
|
|
bool m_based_on_all_layer;
|
|
int m_nozzle_height_to_rod;
|
|
int m_nozzle_clearance_radius;
|
|
std::optional<int> m_liftable_extruder_id;
|
|
std::optional<int> m_extruder_height_gap;
|
|
|
|
std::unordered_map<const PrintInstance*, BoundingBoxf3> bbox_cache;
|
|
|
|
std::optional<Point> m_all_layer_pos;
|
|
};
|
|
}
|
|
|
|
#endif |