2013-07-13 22:38:01 +00:00
|
|
|
%module{Slic3r::XS};
|
|
|
|
|
|
|
|
%{
|
|
|
|
#include <myinit.h>
|
|
|
|
#include "ExPolygonCollection.hpp"
|
|
|
|
%}
|
|
|
|
|
|
|
|
%name{Slic3r::ExPolygon::Collection} class ExPolygonCollection {
|
|
|
|
~ExPolygonCollection();
|
2013-07-14 11:11:01 +00:00
|
|
|
ExPolygonCollection* clone()
|
|
|
|
%code{% const char* CLASS = "Slic3r::ExPolygon::Collection"; RETVAL = new ExPolygonCollection(*THIS); %};
|
2013-07-14 13:06:49 +00:00
|
|
|
void clear()
|
|
|
|
%code{% THIS->expolygons.clear(); %};
|
2013-07-13 22:38:01 +00:00
|
|
|
void scale(double factor);
|
|
|
|
void translate(double x, double y);
|
|
|
|
void rotate(double angle, Point* center);
|
|
|
|
%{
|
|
|
|
|
|
|
|
ExPolygonCollection*
|
|
|
|
ExPolygonCollection::new(...)
|
|
|
|
CODE:
|
|
|
|
RETVAL = new ExPolygonCollection ();
|
|
|
|
// ST(0) is class name, others are expolygons
|
|
|
|
RETVAL->expolygons.resize(items-1);
|
|
|
|
for (unsigned int i = 1; i < items; i++) {
|
2013-07-15 18:31:43 +00:00
|
|
|
perl2expolygon_check(ST(i), RETVAL->expolygons[i-1]);
|
|
|
|
RETVAL->expolygons[i-1].in_collection = true;
|
2013-07-13 22:38:01 +00:00
|
|
|
}
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
SV*
|
|
|
|
ExPolygonCollection::arrayref()
|
|
|
|
CODE:
|
|
|
|
AV* av = newAV();
|
|
|
|
av_fill(av, THIS->expolygons.size()-1);
|
|
|
|
int i = 0;
|
|
|
|
for (ExPolygons::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) {
|
2013-07-15 18:31:43 +00:00
|
|
|
av_store(av, i++, (*it).to_SV(false, false));
|
|
|
|
}
|
|
|
|
RETVAL = newRV_noinc((SV*)av);
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
SV*
|
|
|
|
ExPolygonCollection::arrayref_pp()
|
|
|
|
CODE:
|
|
|
|
AV* av = newAV();
|
|
|
|
av_fill(av, THIS->expolygons.size()-1);
|
|
|
|
int i = 0;
|
|
|
|
for (ExPolygons::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) {
|
|
|
|
av_store(av, i++, (*it).to_SV(true, true));
|
2013-07-13 22:38:01 +00:00
|
|
|
}
|
|
|
|
RETVAL = newRV_noinc((SV*)av);
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
2013-07-14 13:06:49 +00:00
|
|
|
void
|
|
|
|
ExPolygonCollection::append(...)
|
|
|
|
CODE:
|
|
|
|
for (unsigned int i = 1; i < items; i++) {
|
|
|
|
THIS->expolygons.push_back(*(ExPolygon *)SvIV((SV*)SvRV( ST(i) )));
|
2013-07-15 18:31:43 +00:00
|
|
|
THIS->expolygons.back().in_collection = true;
|
2013-07-14 13:06:49 +00:00
|
|
|
}
|
|
|
|
|
2013-07-13 22:38:01 +00:00
|
|
|
%}
|
|
|
|
};
|