2013-08-29 22:06:10 +00:00
|
|
|
#ifndef slic3r_PolylineCollection_hpp_
|
|
|
|
#define slic3r_PolylineCollection_hpp_
|
|
|
|
|
2015-12-07 23:39:54 +00:00
|
|
|
#include "libslic3r.h"
|
2013-08-29 22:06:10 +00:00
|
|
|
#include "Polyline.hpp"
|
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
|
|
|
|
class PolylineCollection
|
|
|
|
{
|
2016-11-02 20:31:03 +00:00
|
|
|
static Polylines _chained_path_from(
|
|
|
|
const Polylines &src,
|
|
|
|
Point start_near,
|
2017-07-27 08:39:43 +00:00
|
|
|
bool no_reverse,
|
|
|
|
bool move_from_src);
|
2016-11-02 20:31:03 +00:00
|
|
|
|
2016-04-10 17:32:39 +00:00
|
|
|
public:
|
2013-08-29 22:06:10 +00:00
|
|
|
Polylines polylines;
|
2016-04-10 17:32:39 +00:00
|
|
|
void chained_path(PolylineCollection* retval, bool no_reverse = false) const
|
|
|
|
{ retval->polylines = chained_path(this->polylines, no_reverse); }
|
2016-11-02 20:31:03 +00:00
|
|
|
void chained_path_from(Point start_near, PolylineCollection* retval, bool no_reverse = false) const
|
2016-04-10 17:32:39 +00:00
|
|
|
{ retval->polylines = chained_path_from(this->polylines, start_near, no_reverse); }
|
|
|
|
Point leftmost_point() const
|
|
|
|
{ return leftmost_point(polylines); }
|
2017-07-27 08:39:43 +00:00
|
|
|
void append(const Polylines &polylines)
|
|
|
|
{ this->polylines.insert(this->polylines.end(), polylines.begin(), polylines.end()); }
|
2016-04-10 17:32:39 +00:00
|
|
|
|
|
|
|
static Point leftmost_point(const Polylines &polylines);
|
2017-07-27 08:39:43 +00:00
|
|
|
static Polylines chained_path(Polylines &&src, bool no_reverse = false) {
|
|
|
|
return (src.empty() || src.front().points.empty()) ?
|
|
|
|
Polylines() :
|
|
|
|
_chained_path_from(src, src.front().first_point(), no_reverse, true);
|
|
|
|
}
|
|
|
|
static Polylines chained_path_from(Polylines &&src, Point start_near, bool no_reverse = false)
|
|
|
|
{ return _chained_path_from(src, start_near, no_reverse, true); }
|
|
|
|
static Polylines chained_path(const Polylines &src, bool no_reverse = false) {
|
|
|
|
return (src.empty() || src.front().points.empty()) ?
|
|
|
|
Polylines() :
|
|
|
|
_chained_path_from(src, src.front().first_point(), no_reverse, false);
|
|
|
|
}
|
|
|
|
static Polylines chained_path_from(const Polylines &src, Point start_near, bool no_reverse = false)
|
|
|
|
{ return _chained_path_from(src, start_near, no_reverse, false); }
|
2013-08-29 22:06:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|