2013-07-14 12:56:43 +00:00
|
|
|
%module{Slic3r::XS};
|
|
|
|
|
|
|
|
%{
|
|
|
|
#include <myinit.h>
|
|
|
|
#include "SurfaceCollection.hpp"
|
|
|
|
%}
|
|
|
|
|
|
|
|
%name{Slic3r::Surface::Collection} class SurfaceCollection {
|
|
|
|
~SurfaceCollection();
|
|
|
|
void clear()
|
|
|
|
%code{% THIS->surfaces.clear(); %};
|
|
|
|
%{
|
|
|
|
|
|
|
|
SurfaceCollection*
|
|
|
|
SurfaceCollection::new(...)
|
|
|
|
CODE:
|
|
|
|
RETVAL = new SurfaceCollection ();
|
|
|
|
// ST(0) is class name, others are surfaces
|
|
|
|
RETVAL->surfaces.resize(items-1);
|
|
|
|
for (unsigned int i = 1; i < items; i++) {
|
2013-07-15 20:57:22 +00:00
|
|
|
// Note: a COPY of the input is stored
|
2013-07-14 12:56:43 +00:00
|
|
|
RETVAL->surfaces[i-1] = *(Surface *)SvIV((SV*)SvRV( ST(i) ));
|
2013-07-15 11:50:53 +00:00
|
|
|
RETVAL->surfaces[i-1].in_collection = true;
|
2013-07-14 12:56:43 +00:00
|
|
|
}
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
SV*
|
|
|
|
SurfaceCollection::arrayref()
|
|
|
|
CODE:
|
|
|
|
AV* av = newAV();
|
|
|
|
av_fill(av, THIS->surfaces.size()-1);
|
|
|
|
int i = 0;
|
|
|
|
for (Surfaces::iterator it = THIS->surfaces.begin(); it != THIS->surfaces.end(); ++it) {
|
|
|
|
SV* sv = newSV(0);
|
2013-07-15 11:50:53 +00:00
|
|
|
sv_setref_pv( sv, "Slic3r::Surface", &*it );
|
2013-07-14 12:56:43 +00:00
|
|
|
av_store(av, i++, sv);
|
|
|
|
}
|
|
|
|
RETVAL = newRV_noinc((SV*)av);
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
void
|
|
|
|
SurfaceCollection::append(...)
|
|
|
|
CODE:
|
|
|
|
for (unsigned int i = 1; i < items; i++) {
|
|
|
|
THIS->surfaces.push_back(*(Surface *)SvIV((SV*)SvRV( ST(i) )));
|
2013-07-15 11:50:53 +00:00
|
|
|
THIS->surfaces.back().in_collection = true;
|
2013-07-14 12:56:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
%}
|
|
|
|
};
|