2013-08-29 22:06:10 +00:00
|
|
|
%module{Slic3r::XS};
|
|
|
|
|
|
|
|
%{
|
2015-12-07 23:39:54 +00:00
|
|
|
#include <xsinit.h>
|
2014-08-03 17:42:29 +00:00
|
|
|
#include "libslic3r/PolylineCollection.hpp"
|
2013-08-29 22:06:10 +00:00
|
|
|
%}
|
|
|
|
|
|
|
|
%name{Slic3r::Polyline::Collection} class PolylineCollection {
|
|
|
|
~PolylineCollection();
|
2014-04-27 17:18:53 +00:00
|
|
|
Clone<PolylineCollection> clone()
|
|
|
|
%code{% RETVAL = THIS; %};
|
2013-08-29 22:06:10 +00:00
|
|
|
void clear()
|
|
|
|
%code{% THIS->polylines.clear(); %};
|
|
|
|
PolylineCollection* chained_path(bool no_reverse)
|
2014-04-24 14:40:10 +00:00
|
|
|
%code{%
|
|
|
|
RETVAL = new PolylineCollection();
|
|
|
|
THIS->chained_path(RETVAL, no_reverse);
|
|
|
|
%};
|
2013-08-29 22:06:10 +00:00
|
|
|
PolylineCollection* chained_path_from(Point* start_near, bool no_reverse)
|
2014-04-24 14:40:10 +00:00
|
|
|
%code{%
|
|
|
|
RETVAL = new PolylineCollection();
|
|
|
|
THIS->chained_path_from(*start_near, RETVAL, no_reverse);
|
|
|
|
%};
|
2013-09-17 21:38:23 +00:00
|
|
|
int count()
|
|
|
|
%code{% RETVAL = THIS->polylines.size(); %};
|
2014-04-27 17:18:53 +00:00
|
|
|
Clone<Point> leftmost_point();
|
2013-08-29 22:06:10 +00:00
|
|
|
%{
|
|
|
|
|
|
|
|
PolylineCollection*
|
|
|
|
PolylineCollection::new(...)
|
|
|
|
CODE:
|
|
|
|
RETVAL = new PolylineCollection ();
|
|
|
|
// ST(0) is class name, others are Polylines
|
|
|
|
RETVAL->polylines.resize(items-1);
|
|
|
|
for (unsigned int i = 1; i < items; i++) {
|
|
|
|
// Note: a COPY of the input is stored
|
2015-12-07 23:39:54 +00:00
|
|
|
from_SV_check(ST(i), &RETVAL->polylines[i-1]);
|
2013-08-29 22:06:10 +00:00
|
|
|
}
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
SV*
|
|
|
|
PolylineCollection::arrayref()
|
|
|
|
CODE:
|
|
|
|
AV* av = newAV();
|
|
|
|
av_fill(av, THIS->polylines.size()-1);
|
|
|
|
int i = 0;
|
|
|
|
for (Polylines::iterator it = THIS->polylines.begin(); it != THIS->polylines.end(); ++it) {
|
2014-05-08 12:52:48 +00:00
|
|
|
av_store(av, i++, perl_to_SV_ref(*it));
|
2013-08-29 22:06:10 +00:00
|
|
|
}
|
|
|
|
RETVAL = newRV_noinc((SV*)av);
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
SV*
|
|
|
|
PolylineCollection::pp()
|
|
|
|
CODE:
|
|
|
|
AV* av = newAV();
|
|
|
|
av_fill(av, THIS->polylines.size()-1);
|
|
|
|
int i = 0;
|
|
|
|
for (Polylines::iterator it = THIS->polylines.begin(); it != THIS->polylines.end(); ++it) {
|
2015-12-07 23:39:54 +00:00
|
|
|
av_store(av, i++, to_SV_pureperl(&*it));
|
2013-08-29 22:06:10 +00:00
|
|
|
}
|
|
|
|
RETVAL = newRV_noinc((SV*)av);
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
void
|
|
|
|
PolylineCollection::append(...)
|
|
|
|
CODE:
|
|
|
|
for (unsigned int i = 1; i < items; i++) {
|
|
|
|
Polyline polyline;
|
2015-12-07 23:39:54 +00:00
|
|
|
from_SV_check(ST(i), &polyline);
|
2013-08-29 22:06:10 +00:00
|
|
|
THIS->polylines.push_back(polyline);
|
|
|
|
}
|
|
|
|
|
|
|
|
%}
|
|
|
|
};
|