summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabiertxof <jtx@jtx>2017-02-04 22:37:20 +0000
committerJabiertxof <jtx@jtx>2017-02-04 22:37:20 +0000
commit4914ec755a1f9ccb1159e7e62a538af79334aac2 (patch)
tree5839197c5caa7997c25918594da8b3a14b9bd1bb /src
parentFix for bug #1655156 Object -> Clip -> Apply distorts objects properties. (diff)
downloadinkscape-4914ec755a1f9ccb1159e7e62a538af79334aac2.tar.gz
inkscape-4914ec755a1f9ccb1159e7e62a538af79334aac2.zip
Fixes bug:1654808 along a option to fuse when paths points are coincidant
Fixed bugs: - https://launchpad.net/bugs/1654808 (bzr r15474)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/lpe-fill-between-many.cpp10
-rw-r--r--src/live_effects/lpe-fill-between-many.h1
-rw-r--r--src/live_effects/lpe-fill-between-strokes.cpp28
-rw-r--r--src/live_effects/lpe-fill-between-strokes.h2
4 files changed, 27 insertions, 14 deletions
diff --git a/src/live_effects/lpe-fill-between-many.cpp b/src/live_effects/lpe-fill-between-many.cpp
index 1e2eadfdb..2690ce160 100644
--- a/src/live_effects/lpe-fill-between-many.cpp
+++ b/src/live_effects/lpe-fill-between-many.cpp
@@ -19,9 +19,11 @@ namespace LivePathEffect {
LPEFillBetweenMany::LPEFillBetweenMany(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
- linked_paths(_("Linked path:"), _("Paths from which to take the original path data"), "linkedpaths", &wr, this)
+ linked_paths(_("Linked path:"), _("Paths from which to take the original path data"), "linkedpaths", &wr, this),
+ fuse(_("Fuse coincident points"), _("Fuse coincident points"), "fuse", &wr, this)
{
registerParameter( dynamic_cast<Parameter *>(&linked_paths) );
+ registerParameter( dynamic_cast<Parameter *>(&fuse) );
//perceived_path = true;
}
@@ -46,7 +48,11 @@ void LPEFillBetweenMany::doEffect (SPCurve * curve)
if (!res_pathv.empty()) {
linked_path = linked_path * SP_ITEM(obj)->getRelativeTransform(firstObj);
- res_pathv.front().appendNew<Geom::LineSegment>(linked_path.initialPoint());
+ if (!are_near(res_pathv.front().finalPoint(), linked_path.initialPoint(), 0.01) || !fuse) {
+ res_pathv.front().appendNew<Geom::LineSegment>(linked_path.initialPoint());
+ } else {
+ linked_path.setInitial(res_pathv.front().finalPoint());
+ }
res_pathv.front().append(linked_path);
} else {
firstObj = SP_ITEM(obj);
diff --git a/src/live_effects/lpe-fill-between-many.h b/src/live_effects/lpe-fill-between-many.h
index 99ee8b15f..552c8037d 100644
--- a/src/live_effects/lpe-fill-between-many.h
+++ b/src/live_effects/lpe-fill-between-many.h
@@ -24,6 +24,7 @@ public:
private:
OriginalPathArrayParam linked_paths;
+ BoolParam fuse;
private:
LPEFillBetweenMany(const LPEFillBetweenMany&);
diff --git a/src/live_effects/lpe-fill-between-strokes.cpp b/src/live_effects/lpe-fill-between-strokes.cpp
index 0dbebdf26..8dc55357f 100644
--- a/src/live_effects/lpe-fill-between-strokes.cpp
+++ b/src/live_effects/lpe-fill-between-strokes.cpp
@@ -18,11 +18,15 @@ LPEFillBetweenStrokes::LPEFillBetweenStrokes(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
linked_path(_("Linked path:"), _("Path from which to take the original path data"), "linkedpath", &wr, this),
second_path(_("Second path:"), _("Second path from which to take the original path data"), "secondpath", &wr, this),
- reverse_second(_("Reverse Second"), _("Reverses the second path order"), "reversesecond", &wr, this)
+ reverse_second(_("Reverse Second"), _("Reverses the second path order"), "reversesecond", &wr, this),
+ close(_("Close path"), _("Close path"), "close", &wr, this),
+ fuse(_("Fuse coincident points"), _("Fuse coincident points"), "fuse", &wr, this)
{
registerParameter( dynamic_cast<Parameter *>(&linked_path) );
registerParameter( dynamic_cast<Parameter *>(&second_path) );
registerParameter( dynamic_cast<Parameter *>(&reverse_second) );
+ registerParameter( dynamic_cast<Parameter *>(&close) );
+ registerParameter( dynamic_cast<Parameter *>(&fuse) );
//perceived_path = true;
}
@@ -51,22 +55,22 @@ void LPEFillBetweenStrokes::doEffect (SPCurve * curve)
}
if ( !result_linked_pathv.empty() && !result_second_pathv.empty() && !result_linked_pathv.front().closed() ) {
- if (reverse_second.get_value())
- {
- result_linked_pathv.front().appendNew<Geom::LineSegment>(result_second_pathv.front().finalPoint());
- result_linked_pathv.front().append(result_second_pathv.front().reversed());
+ if (reverse_second.get_value()) {
+ result_second_pathv.front() = result_second_pathv.front().reversed();
}
- else
- {
+ if (!are_near(result_linked_pathv.front().finalPoint(), result_second_pathv.front().initialPoint(),0.01) || !fuse) {
result_linked_pathv.front().appendNew<Geom::LineSegment>(result_second_pathv.front().initialPoint());
- result_linked_pathv.front().append(result_second_pathv.front());
+ } else {
+ result_second_pathv.front().setInitial(result_linked_pathv.front().finalPoint());
+ }
+ result_linked_pathv.front().append(result_second_pathv.front());
+ if (close) {
+ result_linked_pathv.front().close();
}
curve->set_pathvector(result_linked_pathv);
- }
- else if ( !result_linked_pathv.empty() ) {
+ } else if ( !result_linked_pathv.empty() ) {
curve->set_pathvector(result_linked_pathv);
- }
- else if ( !result_second_pathv.empty() ) {
+ } else if ( !result_second_pathv.empty() ) {
curve->set_pathvector(result_second_pathv);
}
}
diff --git a/src/live_effects/lpe-fill-between-strokes.h b/src/live_effects/lpe-fill-between-strokes.h
index ec57b1852..14eb9167c 100644
--- a/src/live_effects/lpe-fill-between-strokes.h
+++ b/src/live_effects/lpe-fill-between-strokes.h
@@ -26,6 +26,8 @@ private:
OriginalPathParam linked_path;
OriginalPathParam second_path;
BoolParam reverse_second;
+ BoolParam close;
+ BoolParam fuse;
private:
LPEFillBetweenStrokes(const LPEFillBetweenStrokes&);