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

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/xs
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2014-11-23 22:03:16 +0300
committerAlessandro Ranellucci <aar@cpan.org>2014-11-23 22:03:16 +0300
commit5deadc8f123e1a67886de8efffd52f177465bd11 (patch)
tree59b87d3317bcbff60356cf0d1f37cc391d7d0f6e /xs
parent4925b056c25b4cb4b2e6f85d41ee2c00928f2660 (diff)
Refactoring: removed _islands members in Slic3r::GCode
Diffstat (limited to 'xs')
-rw-r--r--xs/src/libslic3r/ExPolygonCollection.cpp18
-rw-r--r--xs/src/libslic3r/ExPolygonCollection.hpp4
-rw-r--r--xs/xsp/ExPolygonCollection.xsp4
-rw-r--r--xs/xsp/Layer.xsp10
4 files changed, 35 insertions, 1 deletions
diff --git a/xs/src/libslic3r/ExPolygonCollection.cpp b/xs/src/libslic3r/ExPolygonCollection.cpp
index 3de86e7c6..181288c95 100644
--- a/xs/src/libslic3r/ExPolygonCollection.cpp
+++ b/xs/src/libslic3r/ExPolygonCollection.cpp
@@ -64,6 +64,24 @@ ExPolygonCollection::contains_point(const Point &point) const
return false;
}
+bool
+ExPolygonCollection::contains_line(const Line &line) const
+{
+ for (ExPolygons::const_iterator it = this->expolygons.begin(); it != this->expolygons.end(); ++it) {
+ if (it->contains_line(line)) return true;
+ }
+ return false;
+}
+
+bool
+ExPolygonCollection::contains_polyline(const Polyline &polyline) const
+{
+ for (ExPolygons::const_iterator it = this->expolygons.begin(); it != this->expolygons.end(); ++it) {
+ if (it->contains_polyline(polyline)) return true;
+ }
+ return false;
+}
+
void
ExPolygonCollection::simplify(double tolerance)
{
diff --git a/xs/src/libslic3r/ExPolygonCollection.hpp b/xs/src/libslic3r/ExPolygonCollection.hpp
index f6a27284f..07532ccf4 100644
--- a/xs/src/libslic3r/ExPolygonCollection.hpp
+++ b/xs/src/libslic3r/ExPolygonCollection.hpp
@@ -3,6 +3,8 @@
#include <myinit.h>
#include "ExPolygon.hpp"
+#include "Line.hpp"
+#include "Polyline.hpp"
namespace Slic3r {
@@ -23,6 +25,8 @@ class ExPolygonCollection
void translate(double x, double y);
void rotate(double angle, const Point &center);
bool contains_point(const Point &point) const;
+ bool contains_line(const Line &line) const;
+ bool contains_polyline(const Polyline &polyline) const;
void simplify(double tolerance);
void convex_hull(Polygon* hull) const;
};
diff --git a/xs/xsp/ExPolygonCollection.xsp b/xs/xsp/ExPolygonCollection.xsp
index a93b27dda..902494b34 100644
--- a/xs/xsp/ExPolygonCollection.xsp
+++ b/xs/xsp/ExPolygonCollection.xsp
@@ -19,6 +19,10 @@
%code{% RETVAL = THIS->expolygons.size(); %};
bool contains_point(Point* point)
%code{% RETVAL = THIS->contains_point(*point); %};
+ bool contains_line(Line* line)
+ %code{% RETVAL = THIS->contains_line(*line); %};
+ bool contains_polyline(Polyline* polyline)
+ %code{% RETVAL = THIS->contains_polyline(*polyline); %};
void simplify(double tolerance);
Polygons polygons()
%code{% RETVAL = *THIS; %};
diff --git a/xs/xsp/Layer.xsp b/xs/xsp/Layer.xsp
index 2d6ec99e2..e0f7e8a17 100644
--- a/xs/xsp/Layer.xsp
+++ b/xs/xsp/Layer.xsp
@@ -53,7 +53,11 @@
%code%{ THIS->upper_layer = layer; %};
void set_lower_layer(Layer *layer)
%code%{ THIS->lower_layer = layer; %};
-
+ bool has_upper_layer()
+ %code%{ RETVAL = (THIS->upper_layer != NULL); %};
+ bool has_lower_layer()
+ %code%{ RETVAL = (THIS->lower_layer != NULL); %};
+
size_t region_count();
Ref<LayerRegion> get_region(int idx);
Ref<LayerRegion> add_region(PrintRegion* print_region);
@@ -99,6 +103,10 @@
%code%{ THIS->upper_layer = layer; %};
void set_lower_layer(SupportLayer *layer)
%code%{ THIS->lower_layer = layer; %};
+ bool has_upper_layer()
+ %code%{ RETVAL = (THIS->upper_layer != NULL); %};
+ bool has_lower_layer()
+ %code%{ RETVAL = (THIS->lower_layer != NULL); %};
size_t region_count();
Ref<LayerRegion> get_region(int idx);