mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 16:25:53 +08:00
Use boost::variant instead of std variant
This commit is contained in:
parent
bc34b60ac3
commit
0d9b079e4b
@ -2284,7 +2284,7 @@ namespace GCode {
|
|||||||
|
|
||||||
std::pair<GCode::SmoothPath, std::size_t> split_with_seam(
|
std::pair<GCode::SmoothPath, std::size_t> split_with_seam(
|
||||||
const ExtrusionLoop &loop,
|
const ExtrusionLoop &loop,
|
||||||
const std::variant<Point, Seams::Scarf::Scarf> &seam,
|
const boost::variant<Point, Seams::Scarf::Scarf> &seam,
|
||||||
const bool flipped,
|
const bool flipped,
|
||||||
const GCode::SmoothPathCache &smooth_path_cache,
|
const GCode::SmoothPathCache &smooth_path_cache,
|
||||||
const double scaled_resolution,
|
const double scaled_resolution,
|
||||||
@ -2293,21 +2293,18 @@ std::pair<GCode::SmoothPath, std::size_t> split_with_seam(
|
|||||||
if (loop.paths.empty() || loop.paths.front().empty()) {
|
if (loop.paths.empty() || loop.paths.front().empty()) {
|
||||||
return {SmoothPath{}, 0};
|
return {SmoothPath{}, 0};
|
||||||
}
|
}
|
||||||
if (std::holds_alternative<Point>(seam)) {
|
if (const auto seam_point{boost::get<Point>(&seam)}; seam_point != nullptr) {
|
||||||
const auto seam_point = std::get<Point>(seam);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
smooth_path_cache.resolve_or_fit_split_with_seam(
|
smooth_path_cache.resolve_or_fit_split_with_seam(
|
||||||
loop, flipped, scaled_resolution, seam_point, seam_point_merge_distance_threshold
|
loop, flipped, scaled_resolution, *seam_point, seam_point_merge_distance_threshold
|
||||||
),
|
),
|
||||||
0};
|
0};
|
||||||
} else if (std::holds_alternative<Seams::Scarf::Scarf>(seam)) {
|
} else if (const auto scarf{boost::get<Seams::Scarf::Scarf>(&seam)}; scarf != nullptr) {
|
||||||
const auto scarf{std::get<Seams::Scarf::Scarf>(seam)};
|
|
||||||
ExtrusionPaths paths{loop.paths};
|
ExtrusionPaths paths{loop.paths};
|
||||||
const auto apply_smoothing{[&](tcb::span<const ExtrusionPath> paths){
|
const auto apply_smoothing{[&](tcb::span<const ExtrusionPath> paths){
|
||||||
return smooth_path_cache.resolve_or_fit(paths, false, scaled<double>(0.0015));
|
return smooth_path_cache.resolve_or_fit(paths, false, scaled<double>(0.0015));
|
||||||
}};
|
}};
|
||||||
return Seams::Scarf::add_scarf_seam(std::move(paths), scarf, apply_smoothing, flipped);
|
return Seams::Scarf::add_scarf_seam(std::move(paths), *scarf, apply_smoothing, flipped);
|
||||||
} else {
|
} else {
|
||||||
throw std::runtime_error{"Unknown seam type!"};
|
throw std::runtime_error{"Unknown seam type!"};
|
||||||
}
|
}
|
||||||
@ -2347,7 +2344,7 @@ struct SmoothPathGenerator
|
|||||||
previous_position ? previous_position->local_point : Point::Zero()};
|
previous_position ? previous_position->local_point : Point::Zero()};
|
||||||
|
|
||||||
if (!config.spiral_vase && loop->role().is_perimeter() && layer != nullptr && region != nullptr) {
|
if (!config.spiral_vase && loop->role().is_perimeter() && layer != nullptr && region != nullptr) {
|
||||||
std::variant<Point, Seams::Scarf::Scarf> seam{
|
boost::variant<Point, Seams::Scarf::Scarf> seam{
|
||||||
this->seam_placer
|
this->seam_placer
|
||||||
.place_seam(layer, region, *loop, extrusion_reference.flipped(), previous_point)};
|
.place_seam(layer, region, *loop, extrusion_reference.flipped(), previous_point)};
|
||||||
std::tie(result, wipe_offset) = split_with_seam(
|
std::tie(result, wipe_offset) = split_with_seam(
|
||||||
|
@ -235,7 +235,7 @@ SeamChoice to_seam_choice(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::variant<Point, Scarf::Scarf> finalize_seam_position(
|
boost::variant<Point, Scarf::Scarf> finalize_seam_position(
|
||||||
const ExtrusionLoop &loop,
|
const ExtrusionLoop &loop,
|
||||||
const PrintRegion *region,
|
const PrintRegion *region,
|
||||||
SeamChoice seam_choice,
|
SeamChoice seam_choice,
|
||||||
@ -403,7 +403,7 @@ int get_perimeter_count(const Layer *layer){
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::variant<Point, Scarf::Scarf> Placer::place_seam(
|
boost::variant<Point, Scarf::Scarf> Placer::place_seam(
|
||||||
const Layer *layer, const PrintRegion *region, const ExtrusionLoop &loop, const bool flipped, const Point &last_pos
|
const Layer *layer, const PrintRegion *region, const ExtrusionLoop &loop, const bool flipped, const Point &last_pos
|
||||||
) const {
|
) const {
|
||||||
const PrintObject *po = layer->object();
|
const PrintObject *po = layer->object();
|
||||||
|
@ -54,7 +54,7 @@ public:
|
|||||||
const std::function<void(void)> &throw_if_canceled
|
const std::function<void(void)> &throw_if_canceled
|
||||||
);
|
);
|
||||||
|
|
||||||
std::variant<Point, Scarf::Scarf> place_seam(
|
boost::variant<Point, Scarf::Scarf> place_seam(
|
||||||
const Layer *layer, const PrintRegion *region, const ExtrusionLoop &loop, const bool flipped, const Point &last_pos
|
const Layer *layer, const PrintRegion *region, const ExtrusionLoop &loop, const bool flipped, const Point &last_pos
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user