mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-21 07:41:09 -06:00
Ported ExtrusionPath::Collection
This commit is contained in:
parent
0efea9e442
commit
c030e38908
18 changed files with 181 additions and 60 deletions
|
@ -24,8 +24,9 @@ ExPolygonCollection::new(...)
|
|||
RETVAL->expolygons.resize(items-1);
|
||||
for (unsigned int i = 1; i < items; i++) {
|
||||
// Note: a COPY of the input is stored
|
||||
RETVAL->expolygons[i-1].from_SV_check(ST(i));
|
||||
RETVAL->expolygons[i-1].in_collection = true;
|
||||
RETVAL->expolygons[i-1] = new ExPolygon;
|
||||
RETVAL->expolygons[i-1]->from_SV_check(ST(i));
|
||||
RETVAL->expolygons[i-1]->in_collection = true;
|
||||
}
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
@ -36,9 +37,9 @@ ExPolygonCollection::arrayref()
|
|||
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) {
|
||||
for (ExPolygonsPtr::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) {
|
||||
SV* sv = newSV(0);
|
||||
sv_setref_pv( sv, "Slic3r::ExPolygon", &*it );
|
||||
sv_setref_pv( sv, "Slic3r::ExPolygon", *it );
|
||||
av_store(av, i++, sv);
|
||||
}
|
||||
RETVAL = newRV_noinc((SV*)av);
|
||||
|
@ -51,8 +52,8 @@ ExPolygonCollection::pp()
|
|||
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_pureperl());
|
||||
for (ExPolygonsPtr::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) {
|
||||
av_store(av, i++, (*it)->to_SV_pureperl());
|
||||
}
|
||||
RETVAL = newRV_noinc((SV*)av);
|
||||
OUTPUT:
|
||||
|
@ -62,9 +63,9 @@ void
|
|||
ExPolygonCollection::append(...)
|
||||
CODE:
|
||||
for (unsigned int i = 1; i < items; i++) {
|
||||
ExPolygon expolygon;
|
||||
expolygon.from_SV_check( ST(i) );
|
||||
expolygon.in_collection = true;
|
||||
ExPolygon* expolygon = new ExPolygon;
|
||||
expolygon->from_SV_check( ST(i) );
|
||||
expolygon->in_collection = true;
|
||||
THIS->expolygons.push_back(expolygon);
|
||||
}
|
||||
|
||||
|
|
59
xs/xsp/ExtrusionEntityCollection.xsp
Normal file
59
xs/xsp/ExtrusionEntityCollection.xsp
Normal file
|
@ -0,0 +1,59 @@
|
|||
%module{Slic3r::XS};
|
||||
|
||||
%{
|
||||
#include <myinit.h>
|
||||
#include "ExtrusionEntityCollection.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::ExtrusionPath::Collection} class ExtrusionEntityCollection {
|
||||
ExtrusionEntityCollection();
|
||||
~ExtrusionEntityCollection();
|
||||
void clear()
|
||||
%code{% THIS->entities.clear(); %};
|
||||
%{
|
||||
|
||||
SV*
|
||||
ExtrusionEntityCollection::arrayref()
|
||||
CODE:
|
||||
AV* av = newAV();
|
||||
av_fill(av, THIS->entities.size()-1);
|
||||
int i = 0;
|
||||
for (ExtrusionEntitiesPtr::iterator it = THIS->entities.begin(); it != THIS->entities.end(); ++it) {
|
||||
SV* sv = newSV(0);
|
||||
// return COPIES
|
||||
if (ExtrusionPath* path = dynamic_cast<ExtrusionPath*>(*it)) {
|
||||
sv_setref_pv( sv, "Slic3r::ExtrusionPath", new ExtrusionPath(*(ExtrusionPath*)*it) );
|
||||
} else {
|
||||
sv_setref_pv( sv, "Slic3r::ExtrusionLoop", new ExtrusionLoop(*(ExtrusionLoop*)*it) );
|
||||
}
|
||||
av_store(av, i++, sv);
|
||||
}
|
||||
RETVAL = newRV_noinc((SV*)av);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
ExtrusionEntityCollection::append(...)
|
||||
CODE:
|
||||
for (unsigned int i = 1; i < items; i++) {
|
||||
ExtrusionEntity* entity = (ExtrusionEntity *)SvIV((SV*)SvRV( ST(i) ));
|
||||
// append COPIES
|
||||
if (ExtrusionPath* path = dynamic_cast<ExtrusionPath*>(entity)) {
|
||||
THIS->entities.push_back( new ExtrusionPath(*path) );
|
||||
} else {
|
||||
THIS->entities.push_back( new ExtrusionLoop(*(ExtrusionLoop*)entity) );
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ExtrusionEntityCollection::no_sort(...)
|
||||
CODE:
|
||||
if (items > 1) {
|
||||
THIS->no_sort = SvTRUE(ST(1));
|
||||
}
|
||||
RETVAL = THIS->no_sort;
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
};
|
|
@ -19,8 +19,8 @@ SurfaceCollection::new(...)
|
|||
RETVAL->surfaces.resize(items-1);
|
||||
for (unsigned int i = 1; i < items; i++) {
|
||||
// Note: a COPY of the input is stored
|
||||
RETVAL->surfaces[i-1] = *(Surface *)SvIV((SV*)SvRV( ST(i) ));
|
||||
RETVAL->surfaces[i-1].in_collection = true;
|
||||
RETVAL->surfaces[i-1] = (Surface *)SvIV((SV*)SvRV( ST(i) ));
|
||||
RETVAL->surfaces[i-1]->in_collection = true;
|
||||
}
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
@ -31,9 +31,9 @@ SurfaceCollection::arrayref()
|
|||
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) {
|
||||
for (SurfacesPtr::iterator it = THIS->surfaces.begin(); it != THIS->surfaces.end(); ++it) {
|
||||
SV* sv = newSV(0);
|
||||
sv_setref_pv( sv, "Slic3r::Surface", &*it );
|
||||
sv_setref_pv( sv, "Slic3r::Surface", *it );
|
||||
av_store(av, i++, sv);
|
||||
}
|
||||
RETVAL = newRV_noinc((SV*)av);
|
||||
|
@ -44,8 +44,8 @@ void
|
|||
SurfaceCollection::append(...)
|
||||
CODE:
|
||||
for (unsigned int i = 1; i < items; i++) {
|
||||
THIS->surfaces.push_back(*(Surface *)SvIV((SV*)SvRV( ST(i) )));
|
||||
THIS->surfaces.back().in_collection = true;
|
||||
THIS->surfaces.push_back((Surface *)SvIV((SV*)SvRV( ST(i) )));
|
||||
THIS->surfaces.back()->in_collection = true;
|
||||
}
|
||||
|
||||
%}
|
||||
|
|
|
@ -6,6 +6,7 @@ Polyline* O_OBJECT
|
|||
Polygon* O_OBJECT
|
||||
ExPolygon* O_OBJECT
|
||||
ExPolygonCollection* O_OBJECT
|
||||
ExtrusionEntityCollection* O_OBJECT
|
||||
ExtrusionPath* O_OBJECT
|
||||
ExtrusionLoop* O_OBJECT
|
||||
Surface* O_OBJECT
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
%typemap{ExPolygon*};
|
||||
%typemap{Polyline*};
|
||||
%typemap{Polygon*};
|
||||
%typemap{ExtrusionEntityCollection*};
|
||||
%typemap{ExtrusionPath*};
|
||||
%typemap{ExtrusionLoop*};
|
||||
%typemap{Lines};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue