mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-20 23:31:13 -06:00
Ported Slic3r::Polyline::Collection
This commit is contained in:
parent
fb82de9aaf
commit
1cfdf7e955
12 changed files with 194 additions and 46 deletions
69
xs/xsp/PolylineCollection.xsp
Normal file
69
xs/xsp/PolylineCollection.xsp
Normal file
|
@ -0,0 +1,69 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <myinit.h>
|
||||
#include "PolylineCollection.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::Polyline::Collection} class PolylineCollection {
|
||||
~PolylineCollection();
|
||||
PolylineCollection* clone()
|
||||
%code{% const char* CLASS = "Slic3r::Polyline::Collection"; RETVAL = new PolylineCollection(*THIS); %};
|
||||
void clear()
|
||||
%code{% THIS->polylines.clear(); %};
|
||||
PolylineCollection* chained_path(bool no_reverse)
|
||||
%code{% const char* CLASS = "Slic3r::Polyline::Collection"; RETVAL = THIS->chained_path(no_reverse); %};
|
||||
PolylineCollection* chained_path_from(Point* start_near, bool no_reverse)
|
||||
%code{% const char* CLASS = "Slic3r::Polyline::Collection"; RETVAL = THIS->chained_path_from(start_near, no_reverse); %};
|
||||
%{
|
||||
|
||||
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
|
||||
RETVAL->polylines[i-1].from_SV_check(ST(i));
|
||||
}
|
||||
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) {
|
||||
av_store(av, i++, (*it).to_SV_ref());
|
||||
}
|
||||
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) {
|
||||
av_store(av, i++, (*it).to_SV_pureperl());
|
||||
}
|
||||
RETVAL = newRV_noinc((SV*)av);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
PolylineCollection::append(...)
|
||||
CODE:
|
||||
for (unsigned int i = 1; i < items; i++) {
|
||||
Polyline polyline;
|
||||
polyline.from_SV_check( ST(i) );
|
||||
THIS->polylines.push_back(polyline);
|
||||
}
|
||||
|
||||
%}
|
||||
};
|
|
@ -3,6 +3,7 @@ TriangleMesh* O_OBJECT
|
|||
Point* O_OBJECT
|
||||
Line* O_OBJECT
|
||||
Polyline* O_OBJECT
|
||||
PolylineCollection* O_OBJECT
|
||||
Polygon* O_OBJECT
|
||||
ExPolygon* O_OBJECT
|
||||
ExPolygonCollection* O_OBJECT
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue