summaryrefslogtreecommitdiffstats
path: root/src/live_effects/lpe-fill-between-strokes.cpp
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/live_effects/lpe-fill-between-strokes.cpp
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/live_effects/lpe-fill-between-strokes.cpp')
-rw-r--r--src/live_effects/lpe-fill-between-strokes.cpp28
1 files changed, 16 insertions, 12 deletions
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);
}
}