From 6b94d25cc267271678cf5550fadc50e59bfb1801 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Thu, 5 Oct 2023 22:55:23 +0200 Subject: [PATCH] Improved const-correctness, removed extra includes --- src/libslic3r/GCode/ConflictChecker.cpp | 9 ++++----- src/libslic3r/GCode/ConflictChecker.hpp | 7 ++----- src/libslic3r/Print.cpp | 4 ++-- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/libslic3r/GCode/ConflictChecker.cpp b/src/libslic3r/GCode/ConflictChecker.cpp index 21a4e2dc08..dc27d7e140 100644 --- a/src/libslic3r/GCode/ConflictChecker.cpp +++ b/src/libslic3r/GCode/ConflictChecker.cpp @@ -3,7 +3,6 @@ ///|/ ///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher ///|/ -#include "libslic3r.h" #include "ConflictChecker.hpp" #include @@ -255,14 +254,14 @@ ExtrusionPaths getExtrusionPathsFromLayer(LayerRegionPtrs layerRegionPtrs) return paths; } -ExtrusionPaths getExtrusionPathsFromSupportLayer(SupportLayer *supportLayer) +ExtrusionPaths getExtrusionPathsFromSupportLayer(const SupportLayer *supportLayer) { ExtrusionPaths paths; getExtrusionPathsFromEntity(&supportLayer->support_fills, paths); return paths; } -std::pair, std::vector> getAllLayersExtrusionPathsFromObject(PrintObject *obj) +std::pair, std::vector> getAllLayersExtrusionPathsFromObject(const PrintObject *obj) { std::vector objPaths, supportPaths; @@ -293,7 +292,7 @@ ConflictComputeOpt ConflictChecker::find_inter_of_lines(const LineWithIDs &lines return {}; } -ConflictResultOpt ConflictChecker::find_inter_of_lines_in_diff_objs(PrintObjectPtrs objs, +ConflictResultOpt ConflictChecker::find_inter_of_lines_in_diff_objs(SpanOfConstPtrs objs, const WipeTowerData& wipe_tower_data) // find the first intersection point of lines in different objects { if (objs.empty() || (objs.size() == 1 && objs.front()->instances().size() == 1)) { return {}; } @@ -309,7 +308,7 @@ ConflictResultOpt ConflictChecker::find_inter_of_lines_in_diff_objs(PrintObjectP std::vector wtpaths = getFakeExtrusionPathsFromWipeTower(wipe_tower_data); conflictQueue.emplace_back_bucket(std::move(wtpaths), &wtptr, Points{Point(plate_origin)}); } - for (PrintObject *obj : objs) { + for (const PrintObject *obj : objs) { std::pair, std::vector> layers = getAllLayersExtrusionPathsFromObject(obj); Points instances_shifts; diff --git a/src/libslic3r/GCode/ConflictChecker.hpp b/src/libslic3r/GCode/ConflictChecker.hpp index 2d4e830dfb..2e76b3f4e9 100644 --- a/src/libslic3r/GCode/ConflictChecker.hpp +++ b/src/libslic3r/GCode/ConflictChecker.hpp @@ -6,10 +6,7 @@ #ifndef slic3r_ConflictChecker_hpp_ #define slic3r_ConflictChecker_hpp_ -#include "../Utils.hpp" -#include "../Model.hpp" -#include "../Print.hpp" -#include "../Layer.hpp" +#include "libslic3r/Print.hpp" #include #include @@ -124,7 +121,7 @@ using ConflictObjName = std::optional>; struct ConflictChecker { - static ConflictResultOpt find_inter_of_lines_in_diff_objs(PrintObjectPtrs objs, const WipeTowerData& wtd); + static ConflictResultOpt find_inter_of_lines_in_diff_objs(SpanOfConstPtrs objs, const WipeTowerData& wtd); static ConflictComputeOpt find_inter_of_lines(const LineWithIDs &lines); static ConflictComputeOpt line_intersect(const LineWithID &l1, const LineWithID &l2); }; diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 2264de546f..4f1c00b3ba 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -1013,11 +1013,11 @@ void Print::process() if (this->has_wipe_tower()) { // These values have to be updated here, not during wipe tower generation. - // When the wipe tower is moved, it is not regenerated. + // When the wipe tower is moved/rotated, it is not regenerated. m_wipe_tower_data.position = { m_config.wipe_tower_x, m_config.wipe_tower_y }; m_wipe_tower_data.rotation_angle = m_config.wipe_tower_rotation_angle; } - auto conflictRes = ConflictChecker::find_inter_of_lines_in_diff_objs(m_objects, m_wipe_tower_data); + auto conflictRes = ConflictChecker::find_inter_of_lines_in_diff_objs(objects(), m_wipe_tower_data); m_conflict_result = conflictRes; if (conflictRes.has_value())