Rest of the path chaining has been replaced with the new algorithm.

PolylineCollection.cpp/hpp was removed, use Polylines instead.
Various first_point() / last_point() now return references, not copies.
This commit is contained in:
bubnikv 2019-09-27 18:17:21 +02:00
parent 4b35ebe6e5
commit 331c187b39
29 changed files with 266 additions and 364 deletions

View file

@ -14,13 +14,17 @@
void clear();
ExtrusionEntityCollection* chained_path(bool no_reverse, ExtrusionRole role = erMixed)
%code{%
if (no_reverse)
croak("no_reverse must be false");
RETVAL = new ExtrusionEntityCollection();
THIS->chained_path(RETVAL, no_reverse, role);
*RETVAL = THIS->chained_path_from(THIS->entities.front()->first_point());
%};
ExtrusionEntityCollection* chained_path_from(Point* start_near, bool no_reverse, ExtrusionRole role = erMixed)
%code{%
if (no_reverse)
croak("no_reverse must be false");
RETVAL = new ExtrusionEntityCollection();
THIS->chained_path_from(*start_near, RETVAL, no_reverse, role);
*RETVAL = THIS->chained_path_from(*start_near, role);
%};
Clone<Point> first_point();
Clone<Point> last_point();

View file

@ -3,7 +3,6 @@
%{
#include <xsinit.h>
#include "libslic3r/Fill/Fill.hpp"
#include "libslic3r/PolylineCollection.hpp"
#include "libslic3r/ExtrusionEntity.hpp"
#include "libslic3r/ExtrusionEntityCollection.hpp"
%}

View file

@ -19,8 +19,6 @@
%code%{ RETVAL = &THIS->fill_surfaces; %};
Polygons bridged()
%code%{ RETVAL = THIS->bridged; %};
Ref<PolylineCollection> unsupported_bridge_edges()
%code%{ RETVAL = &THIS->unsupported_bridge_edges; %};
Ref<ExtrusionEntityCollection> perimeters()
%code%{ RETVAL = &THIS->perimeters; %};
Ref<ExtrusionEntityCollection> fills()

View file

@ -2,7 +2,11 @@
%{
#include <xsinit.h>
#include "libslic3r/PolylineCollection.hpp"
#include "libslic3r.h"
#include "Polyline.hpp"
#include "ShortestPath.hpp"
%}
%name{Slic3r::Polyline::Collection} class PolylineCollection {
@ -14,16 +18,15 @@
PolylineCollection* chained_path(bool no_reverse)
%code{%
RETVAL = new PolylineCollection();
THIS->chained_path(RETVAL, no_reverse);
RETVAL->polylines = chain_polylines(THIS->polylines, &THIS->polylines.front().first_point());
%};
PolylineCollection* chained_path_from(Point* start_near, bool no_reverse)
%code{%
RETVAL = new PolylineCollection();
THIS->chained_path_from(*start_near, RETVAL, no_reverse);
RETVAL->polylines = chain_polylines(THIS->polylines, start_near);
%};
int count()
%code{% RETVAL = THIS->polylines.size(); %};
Clone<Point> leftmost_point();
%{
PolylineCollection*