Ported scaled_points_to_pixel, made Polygon and Polylines versions.

This commit is contained in:
Joseph Lenox 2018-04-30 22:17:42 -05:00
parent 456212918f
commit aef1bf7f37
2 changed files with 12 additions and 1 deletions

View File

@ -157,6 +157,16 @@ void Plate2D::update_bed_size() {
assert(this->scaling_factor != 0);
std::vector<wxPoint> Plate2D::scaled_points_to_pixel(const Slic3r::Polygon& poly, bool unscale) {
return this->scaled_points_to_pixel(Polyline(poly), unscale);
}
std::vector<wxPoint> Plate2D::scaled_points_to_pixel(const Slic3r::Polyline& poly, bool unscale) {
std::vector<wxPoint> result;
for (const auto& pt : poly.points) {
const auto tmp {wxPoint(pt.x, pt.y)};
result.push_back( (unscale ? unscaled_point_to_pixel(tmp) : tmp) );
}
return result;
}
} } // Namespace Slic3r::GUI

View File

@ -66,7 +66,8 @@ private:
void set_colors();
/// Convert a scale point array to a pixel polygon suitable for DrawPolygon
std::vector<wxPoint> scaled_points_to_pixel(std::vector<wxPoint> points, bool unscale);
std::vector<wxPoint> scaled_points_to_pixel(const Slic3r::Polygon& poly, bool unscale);
std::vector<wxPoint> scaled_points_to_pixel(const Slic3r::Polyline& poly, bool unscale);
// For a specific point, unscaled it
wxPoint unscaled_point_to_pixel(const wxPoint& in) {