Welcome to mirror list, hosted at ThFree Co, Russian Federation.

PolylineCollection.xsp « xsp « xs - github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d5ad4f77fc59607292733f7faafed1f1f88991b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
%module{Slic3r::XS};

%{
#include <myinit.h>
#include "PolylineCollection.hpp"
%}

%name{Slic3r::Polyline::Collection} class PolylineCollection {
    ~PolylineCollection();
    Clone<PolylineCollection> clone()
        %code{% RETVAL = THIS; %};
    void clear()
        %code{% THIS->polylines.clear(); %};
    PolylineCollection* chained_path(bool no_reverse)
        %code{%
            RETVAL = new PolylineCollection();
            THIS->chained_path(RETVAL, no_reverse);
        %};
    PolylineCollection* chained_path_from(Point* start_near, bool no_reverse)
        %code{%
            RETVAL = new PolylineCollection();
            THIS->chained_path_from(*start_near, RETVAL, no_reverse);
        %};
    int count()
        %code{% RETVAL = THIS->polylines.size(); %};
    Clone<Point> leftmost_point();
%{

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++, perl_to_SV_ref(*it));
        }
        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);
        }

%}
};