From 4914ec755a1f9ccb1159e7e62a538af79334aac2 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Sat, 4 Feb 2017 23:37:20 +0100 Subject: Fixes bug:1654808 along a option to fuse when paths points are coincidant Fixed bugs: - https://launchpad.net/bugs/1654808 (bzr r15474) --- src/live_effects/lpe-fill-between-strokes.cpp | 28 +++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'src/live_effects/lpe-fill-between-strokes.cpp') 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(&linked_path) ); registerParameter( dynamic_cast(&second_path) ); registerParameter( dynamic_cast(&reverse_second) ); + registerParameter( dynamic_cast(&close) ); + registerParameter( dynamic_cast(&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(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(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); } } -- cgit v1.2.3