From 28b44133e0d9df8054e17ed9724ea645220e1530 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 14 Feb 2013 06:01:26 +0100 Subject: All done except cusp continuous and close bspline (bzr r11950.1.32) --- src/ui/tool/path-manipulator.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 35eb23f42..f1b2e12be 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -9,7 +9,9 @@ * Copyright (C) 2009 Authors * Released under GNU GPL, read the file 'COPYING' for more information */ - +//BSpline +#include "live_effects/lpe-bspline.h" +//BSpline end #include "live_effects/lpe-powerstroke.h" #include #include @@ -1257,9 +1259,26 @@ void PathManipulator::_updateOutline() sp_canvas_item_hide(_outline); return; } - Geom::PathVector pv = _spcurve->get_pathvector(); pv *= (_edit_transform * _i2d_transform); + //BSpline + if (SP_IS_LPE_ITEM(_path) && sp_lpe_item_has_path_effect(SP_LPE_ITEM(_path))) { + PathEffectList effect_list = sp_lpe_item_get_effect_list(SP_LPE_ITEM(_path)); + LivePathEffect::LPEBSpline *lpe_bsp = dynamic_cast( effect_list.front()->lpeobject->get_lpe()); + if (lpe_bsp) { + Geom::PathVector pv2; + for (Geom::PathVector::iterator i = pv.begin(); i != pv.end(); ++i) { + Geom::Path &path = *i; + for (Geom::Path::const_iterator j = path.begin(); j != path.end_default(); ++j) { + Geom::Path pv2j(j->pointAt(0)); + pv2j.appendNew(j->pointAt(1)); + pv2.push_back(pv2j); + } + } + pv = pv2; + } + } + //BSpline End // This SPCurve thing has to be killed with extreme prejudice SPCurve *_hc = new SPCurve(); if (_show_path_direction) { -- cgit v1.2.3 From 4a0858ff965d54fc08f721fbbc2503f9ab3d9d3c Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 18 Feb 2013 11:23:51 +0100 Subject: refactor (bzr r11950.1.35) --- src/ui/tool/path-manipulator.cpp | 102 +++++++++++++++++++++++++++++++-------- 1 file changed, 82 insertions(+), 20 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index f1b2e12be..b650987bc 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1102,7 +1102,6 @@ void PathManipulator::_createControlPointsFromGeometry() Geom::Curve const &cseg = pit->back_closed(); bool fuse_ends = pit->closed() && Geom::are_near(cseg.initialPoint(), cseg.finalPoint()); - for (Geom::Path::const_iterator cit = pit->begin(); cit != pit->end_open(); ++cit) { Geom::Point pos = cit->finalPoint(); Node *current_node; @@ -1169,6 +1168,75 @@ void PathManipulator::_createControlPointsFromGeometry() } } + +bool PathManipulator::isBSpline(){ + LivePathEffect::LPEBSpline *lpe_bsp = NULL; + if (SP_IS_LPE_ITEM(_path) && sp_lpe_item_has_path_effect(SP_LPE_ITEM(_path))) { + PathEffectList effect_list = sp_lpe_item_get_effect_list(SP_LPE_ITEM(_path)); + lpe_bsp = dynamic_cast( effect_list.front()->lpeobject->get_lpe()); + }else{ + lpe_bsp = NULL; + } + if(lpe_bsp){ + return true; + } + return false; +} +double PathManipulator::BSplineMaxPosition(Node *n){ + double nearestPointAt = 0; + Geom::D2< Geom::SBasis > SBasisInsideNodes; + SPCurve *lineInsideNodes = new SPCurve(); + Node * frontNode = n->nodeToward(n->front()); + if(frontNode){ + lineInsideNodes->moveto(n->position()); + lineInsideNodes->lineto(frontNode->position()); + SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); + nearestPointAt = Geom::nearest_point(n->front()->position(),*lineInsideNodes->first_segment()); + } + Node * backNode = n->nodeToward(n->back()); + if(backNode){ + lineInsideNodes->reset(); + lineInsideNodes->moveto(n->position()); + lineInsideNodes->lineto(backNode->position()); + SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); + using std::max; + nearestPointAt = max(nearestPointAt,1-Geom::nearest_point(n->back()->position(),*lineInsideNodes->first_segment())); + } + return nearestPointAt; +} + +Geom::Point PathManipulator::BSplineHandleReposition(Handle *h){ + double nearestPointAt = 0; + Node *n = h->parent(); + Geom::D2< Geom::SBasis > SBasisInsideNodes; + SPCurve *lineInsideNodes = new SPCurve(); + Node * nextNode = n->nodeToward(h); + if(nextNode){ + lineInsideNodes->moveto(n->position()); + lineInsideNodes->lineto(nextNode->position()); + SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); + nearestPointAt = Geom::nearest_point(n->front()->position(),*lineInsideNodes->first_segment()); + } + return SBasisInsideNodes.valueAt(nearestPointAt); +} + +Geom::Point PathManipulator::BSplineHandleRepositionFixed(Handle *h,double pos){ + Node *n = h->parent(); + if(n->back()->position() == h->position()) + pos = 1-pos; + Geom::D2< Geom::SBasis > SBasisInsideNodes; + SPCurve *lineInsideNodes = new SPCurve(); + Node * nextNode = n->nodeToward(h); + if(nextNode){ + lineInsideNodes->moveto(n->position()); + lineInsideNodes->lineto(nextNode->position()); + SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); + }else{ + return n->position(); + } + return SBasisInsideNodes.valueAt(pos); +} + /** Construct the geometric representation of nodes and handles, update the outline * and display * \param alert_LPE if true, first the LPE is warned what the new path is going to be before updating it @@ -1184,14 +1252,25 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) } NodeList::iterator prev = subpath->begin(); builder.moveTo(prev->position()); - for (NodeList::iterator i = ++subpath->begin(); i != subpath->end(); ++i) { + if (this->isBSpline()) { + float pos = BSplineMaxPosition(i.ptr()); + i.ptr()->front()->setPosition(BSplineHandleRepositionFixed(i.ptr()->front(),pos)); + i.ptr()->back()->setPosition(BSplineHandleRepositionFixed(i.ptr()->back(),pos)); + } + //BSplie End build_segment(builder, prev.ptr(), i.ptr()); prev = i; } if (subpath->closed()) { // Here we link the last and first node if the path is closed. // If the last segment is Bezier, we add it. + if (this->isBSpline()) { + float pos = BSplineMaxPosition(prev.ptr()); + subpath->begin().ptr()->front()->setPosition(BSplineHandleRepositionFixed(subpath->begin().ptr()->front(),pos)); + prev.ptr()->back()->setPosition(BSplineHandleRepositionFixed(prev.ptr()->back(),pos)); + + } if (!prev->front()->isDegenerate() || !subpath->begin()->back()->isDegenerate()) { build_segment(builder, prev.ptr(), subpath->begin().ptr()); } @@ -1200,6 +1279,7 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) } ++spi; } + builder.finish(); Geom::PathVector pathv = builder.peek() * (_edit_transform * _i2d_transform).inverse(); _spcurve->set_pathvector(pathv); @@ -1261,24 +1341,6 @@ void PathManipulator::_updateOutline() } Geom::PathVector pv = _spcurve->get_pathvector(); pv *= (_edit_transform * _i2d_transform); - //BSpline - if (SP_IS_LPE_ITEM(_path) && sp_lpe_item_has_path_effect(SP_LPE_ITEM(_path))) { - PathEffectList effect_list = sp_lpe_item_get_effect_list(SP_LPE_ITEM(_path)); - LivePathEffect::LPEBSpline *lpe_bsp = dynamic_cast( effect_list.front()->lpeobject->get_lpe()); - if (lpe_bsp) { - Geom::PathVector pv2; - for (Geom::PathVector::iterator i = pv.begin(); i != pv.end(); ++i) { - Geom::Path &path = *i; - for (Geom::Path::const_iterator j = path.begin(); j != path.end_default(); ++j) { - Geom::Path pv2j(j->pointAt(0)); - pv2j.appendNew(j->pointAt(1)); - pv2.push_back(pv2j); - } - } - pv = pv2; - } - } - //BSpline End // This SPCurve thing has to be killed with extreme prejudice SPCurve *_hc = new SPCurve(); if (_show_path_direction) { -- cgit v1.2.3 From dfe131791aef37e26fd0358c32222dacf813864c Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 19 Feb 2013 12:08:14 +0100 Subject: Mayor refactor (bzr r11950.1.36) --- src/ui/tool/path-manipulator.cpp | 90 ++++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 41 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index b650987bc..c4158931a 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1182,31 +1182,8 @@ bool PathManipulator::isBSpline(){ } return false; } -double PathManipulator::BSplineMaxPosition(Node *n){ - double nearestPointAt = 0; - Geom::D2< Geom::SBasis > SBasisInsideNodes; - SPCurve *lineInsideNodes = new SPCurve(); - Node * frontNode = n->nodeToward(n->front()); - if(frontNode){ - lineInsideNodes->moveto(n->position()); - lineInsideNodes->lineto(frontNode->position()); - SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); - nearestPointAt = Geom::nearest_point(n->front()->position(),*lineInsideNodes->first_segment()); - } - Node * backNode = n->nodeToward(n->back()); - if(backNode){ - lineInsideNodes->reset(); - lineInsideNodes->moveto(n->position()); - lineInsideNodes->lineto(backNode->position()); - SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); - using std::max; - nearestPointAt = max(nearestPointAt,1-Geom::nearest_point(n->back()->position(),*lineInsideNodes->first_segment())); - } - return nearestPointAt; -} - -Geom::Point PathManipulator::BSplineHandleReposition(Handle *h){ - double nearestPointAt = 0; +double PathManipulator::BSplineHandlePosition(Handle *h){ + double pos = 0; Node *n = h->parent(); Geom::D2< Geom::SBasis > SBasisInsideNodes; SPCurve *lineInsideNodes = new SPCurve(); @@ -1215,19 +1192,23 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h){ lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); - nearestPointAt = Geom::nearest_point(n->front()->position(),*lineInsideNodes->first_segment()); + pos = Geom::nearest_point(h->position(),*lineInsideNodes->first_segment()); } - return SBasisInsideNodes.valueAt(nearestPointAt); + return pos; } -Geom::Point PathManipulator::BSplineHandleRepositionFixed(Handle *h,double pos){ +Geom::Point PathManipulator::BSplineHandleReposition(Handle *h){ + double pos = 0; + pos = this->BSplineHandlePosition(h); + return BSplineHandleReposition(h,pos); +} + +Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ Node *n = h->parent(); - if(n->back()->position() == h->position()) - pos = 1-pos; Geom::D2< Geom::SBasis > SBasisInsideNodes; SPCurve *lineInsideNodes = new SPCurve(); Node * nextNode = n->nodeToward(h); - if(nextNode){ + if(nextNode && pos != 0){ lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); @@ -1251,26 +1232,53 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) continue; } NodeList::iterator prev = subpath->begin(); + //BSpline + float pos = NULL; + bool isBSpline = false; + if(this->isBSpline()) + isBSpline = true; + if(isBSpline){ + pos = BSplineHandlePosition(prev.ptr()->front()); + prev.ptr()->front()->setPosition(BSplineHandleReposition(prev.ptr()->front(),pos)); + if(pos == 0){ + prev.ptr()->setPosition(BSplineHandleReposition(i.ptr()->front(),pos)); + } + } + //BSpline End builder.moveTo(prev->position()); for (NodeList::iterator i = ++subpath->begin(); i != subpath->end(); ++i) { - if (this->isBSpline()) { - float pos = BSplineMaxPosition(i.ptr()); - i.ptr()->front()->setPosition(BSplineHandleRepositionFixed(i.ptr()->front(),pos)); - i.ptr()->back()->setPosition(BSplineHandleRepositionFixed(i.ptr()->back(),pos)); + //BSpline + if (isBSpline) { + pos = BSplineHandlePosition(i.ptr()->front()); + if(pos == 0) + pos = BSplineHandlePosition(i.ptr()->back()); + i.ptr()->front()->setPosition(BSplineHandleReposition(i.ptr()->front(),pos)); + i.ptr()->back()->setPosition(BSplineHandleReposition(i.ptr()->back(),pos)); + if(pos == 0){ + i.ptr()->setPosition(BSplineHandleReposition(i.ptr()->front(),pos)); + } } - //BSplie End + + //BSpline End build_segment(builder, prev.ptr(), i.ptr()); prev = i; } if (subpath->closed()) { // Here we link the last and first node if the path is closed. // If the last segment is Bezier, we add it. - if (this->isBSpline()) { - float pos = BSplineMaxPosition(prev.ptr()); - subpath->begin().ptr()->front()->setPosition(BSplineHandleRepositionFixed(subpath->begin().ptr()->front(),pos)); - prev.ptr()->back()->setPosition(BSplineHandleRepositionFixed(prev.ptr()->back(),pos)); - + //BSpline + if (isBSpline) { + pos = BSplineHandlePosition(prev.ptr()->front()); + if(pos == 0) + pos = BSplineHandlePosition(subpath->begin().ptr()->back()); + subpath->begin().ptr()->front()->setPosition(BSplineHandleReposition(subpath->begin().ptr()->front(),pos)); + prev.ptr()->back()->setPosition(BSplineHandleReposition(prev.ptr()->back(),pos)); + if(pos == 0){ + subpath->begin().ptr()->setPosition(BSplineHandleReposition(subpath->begin().ptr()->front(),pos)); + prev.ptr()->setPosition(BSplineHandleReposition(prev.ptr()->back(),pos)); + } } + //BSpline End if (!prev->front()->isDegenerate() || !subpath->begin()->back()->isDegenerate()) { build_segment(builder, prev.ptr(), subpath->begin().ptr()); } -- cgit v1.2.3 From 9af17a6572db964acebd2b7eeea29c8b722c8221 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 23 Feb 2013 23:34:58 +0100 Subject: Saved for next refactor (bzr r11950.1.37) --- src/ui/tool/path-manipulator.cpp | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index c4158931a..ecb8abcf4 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1185,21 +1185,18 @@ bool PathManipulator::isBSpline(){ double PathManipulator::BSplineHandlePosition(Handle *h){ double pos = 0; Node *n = h->parent(); - Geom::D2< Geom::SBasis > SBasisInsideNodes; SPCurve *lineInsideNodes = new SPCurve(); Node * nextNode = n->nodeToward(h); if(nextNode){ lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); - SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); pos = Geom::nearest_point(h->position(),*lineInsideNodes->first_segment()); } return pos; } Geom::Point PathManipulator::BSplineHandleReposition(Handle *h){ - double pos = 0; - pos = this->BSplineHandlePosition(h); + double pos = this->BSplineHandlePosition(h); return BSplineHandleReposition(h,pos); } @@ -1208,7 +1205,7 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ Geom::D2< Geom::SBasis > SBasisInsideNodes; SPCurve *lineInsideNodes = new SPCurve(); Node * nextNode = n->nodeToward(h); - if(nextNode && pos != 0){ + if(nextNode){ lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); @@ -1233,50 +1230,37 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) } NodeList::iterator prev = subpath->begin(); //BSpline - float pos = NULL; + double pos =0; bool isBSpline = false; if(this->isBSpline()) isBSpline = true; if(isBSpline){ pos = BSplineHandlePosition(prev.ptr()->front()); - prev.ptr()->front()->setPosition(BSplineHandleReposition(prev.ptr()->front(),pos)); - if(pos == 0){ - prev.ptr()->setPosition(BSplineHandleReposition(i.ptr()->front(),pos)); - } + prev->front()->setPosition(BSplineHandleReposition(prev->front(),pos)); } //BSpline End builder.moveTo(prev->position()); for (NodeList::iterator i = ++subpath->begin(); i != subpath->end(); ++i) { //BSpline if (isBSpline) { - pos = BSplineHandlePosition(i.ptr()->front()); - if(pos == 0) - pos = BSplineHandlePosition(i.ptr()->back()); - i.ptr()->front()->setPosition(BSplineHandleReposition(i.ptr()->front(),pos)); - i.ptr()->back()->setPosition(BSplineHandleReposition(i.ptr()->back(),pos)); - if(pos == 0){ - i.ptr()->setPosition(BSplineHandleReposition(i.ptr()->front(),pos)); - } + pos = BSplineHandlePosition(i->back()); + i->front()->setPosition(BSplineHandleReposition(i->front(),pos)); + i->back()->setPosition(BSplineHandleReposition(i->back(),pos)); } //BSpline End build_segment(builder, prev.ptr(), i.ptr()); prev = i; } + if (subpath->closed()) { // Here we link the last and first node if the path is closed. // If the last segment is Bezier, we add it. //BSpline if (isBSpline) { - pos = BSplineHandlePosition(prev.ptr()->front()); - if(pos == 0) - pos = BSplineHandlePosition(subpath->begin().ptr()->back()); - subpath->begin().ptr()->front()->setPosition(BSplineHandleReposition(subpath->begin().ptr()->front(),pos)); - prev.ptr()->back()->setPosition(BSplineHandleReposition(prev.ptr()->back(),pos)); - if(pos == 0){ - subpath->begin().ptr()->setPosition(BSplineHandleReposition(subpath->begin().ptr()->front(),pos)); - prev.ptr()->setPosition(BSplineHandleReposition(prev.ptr()->back(),pos)); - } + pos = BSplineHandlePosition(prev.next()->back()); + subpath->begin()->front()->setPosition(BSplineHandleReposition(subpath->begin()->front(),pos)); + prev.next()->back()->setPosition(BSplineHandleReposition(prev.next()->back(),pos)); } //BSpline End if (!prev->front()->isDegenerate() || !subpath->begin()->back()->isDegenerate()) { -- cgit v1.2.3 From ecc57932f1e7d157950ada2901f6ea6f3acc8aad Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 28 Feb 2013 04:43:21 +0100 Subject: Fixed closed pc->ea (bzr r11950.1.40) --- src/ui/tool/path-manipulator.cpp | 45 ++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 30 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index ecb8abcf4..7c23ee153 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1182,15 +1182,20 @@ bool PathManipulator::isBSpline(){ } return false; } + double PathManipulator::BSplineHandlePosition(Handle *h){ + using Geom::X; + using Geom::Y; double pos = 0; Node *n = h->parent(); SPCurve *lineInsideNodes = new SPCurve(); Node * nextNode = n->nodeToward(h); - if(nextNode){ + Geom::Point positionH = h->position(); + positionH = Geom::Point(positionH[X] - 0.0625,positionH[Y] - 0.0625); + if(nextNode && n->position() != h->position()){ lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); - pos = Geom::nearest_point(h->position(),*lineInsideNodes->first_segment()); + pos = Geom::nearest_point(positionH,*lineInsideNodes->first_segment()); } return pos; } @@ -1201,18 +1206,23 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h){ } Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ + using Geom::X; + using Geom::Y; + Geom::Point ret(0,0); Node *n = h->parent(); Geom::D2< Geom::SBasis > SBasisInsideNodes; SPCurve *lineInsideNodes = new SPCurve(); Node * nextNode = n->nodeToward(h); - if(nextNode){ + if(nextNode && pos != 0){ lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); + ret = SBasisInsideNodes.valueAt(pos); + ret = Geom::Point(ret[X] + 0.0625,ret[Y] + 0.0625); }else{ - return n->position(); + ret = n->position(); } - return SBasisInsideNodes.valueAt(pos); + return ret; } /** Construct the geometric representation of nodes and handles, update the outline @@ -1229,26 +1239,8 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) continue; } NodeList::iterator prev = subpath->begin(); - //BSpline - double pos =0; - bool isBSpline = false; - if(this->isBSpline()) - isBSpline = true; - if(isBSpline){ - pos = BSplineHandlePosition(prev.ptr()->front()); - prev->front()->setPosition(BSplineHandleReposition(prev->front(),pos)); - } - //BSpline End builder.moveTo(prev->position()); for (NodeList::iterator i = ++subpath->begin(); i != subpath->end(); ++i) { - //BSpline - if (isBSpline) { - pos = BSplineHandlePosition(i->back()); - i->front()->setPosition(BSplineHandleReposition(i->front(),pos)); - i->back()->setPosition(BSplineHandleReposition(i->back(),pos)); - } - - //BSpline End build_segment(builder, prev.ptr(), i.ptr()); prev = i; } @@ -1256,13 +1248,6 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) if (subpath->closed()) { // Here we link the last and first node if the path is closed. // If the last segment is Bezier, we add it. - //BSpline - if (isBSpline) { - pos = BSplineHandlePosition(prev.next()->back()); - subpath->begin()->front()->setPosition(BSplineHandleReposition(subpath->begin()->front(),pos)); - prev.next()->back()->setPosition(BSplineHandleReposition(prev.next()->back(),pos)); - } - //BSpline End if (!prev->front()->isDegenerate() || !subpath->begin()->back()->isDegenerate()) { build_segment(builder, prev.ptr(), subpath->begin().ptr()); } -- cgit v1.2.3 From caaed5a4603d40a0043bdcb564e213ea9e7d0021 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 6 Mar 2013 04:01:15 +0100 Subject: Permanent show outline in BSpline mode (bzr r11950.1.47) --- src/ui/tool/path-manipulator.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 7c23ee153..0a100ecfb 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -895,6 +895,9 @@ void PathManipulator::showHandles(bool show) /** Set the visibility of outline. */ void PathManipulator::showOutline(bool show) { + //BSpline + if(isBSpline()) show = true; + //BSpline if (show == _show_outline) return; _show_outline = show; _updateOutline(); -- cgit v1.2.3 From a5fc5840c370d58f395b7b256a11fd11ef3a9a54 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 18 Mar 2013 02:53:59 +0100 Subject: working whith widgets (bzr r11950.1.57) --- src/ui/tool/path-manipulator.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 0a100ecfb..b46e85622 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -36,6 +36,7 @@ #include "live_effects/lpeobject-reference.h" #include "live_effects/parameter/path.h" #include "sp-path.h" +#include "sp-lpe-item.h" #include "helper/geom.h" #include "preferences.h" #include "style.h" @@ -1174,9 +1175,8 @@ void PathManipulator::_createControlPointsFromGeometry() bool PathManipulator::isBSpline(){ LivePathEffect::LPEBSpline *lpe_bsp = NULL; - if (SP_IS_LPE_ITEM(_path) && sp_lpe_item_has_path_effect(SP_LPE_ITEM(_path))) { - PathEffectList effect_list = sp_lpe_item_get_effect_list(SP_LPE_ITEM(_path)); - lpe_bsp = dynamic_cast( effect_list.front()->lpeobject->get_lpe()); + if (SP_LPE_ITEM(_path) && sp_lpe_item_has_path_effect(SP_LPE_ITEM(_path))){ + lpe_bsp = dynamic_cast(sp_lpe_item_has_path_effect_of_type(SP_LPE_ITEM(_path),Inkscape::LivePathEffect::BSPLINE)->getLPEObj()->get_lpe()); }else{ lpe_bsp = NULL; } @@ -1186,6 +1186,16 @@ bool PathManipulator::isBSpline(){ return false; } +int PathManipulator::getControlBsplineSteps(){ + LivePathEffect::LPEBSpline *lpe_bsp = NULL; + if (SP_LPE_ITEM(_path) && sp_lpe_item_has_path_effect(SP_LPE_ITEM(_path))){ + lpe_bsp = dynamic_cast(sp_lpe_item_has_path_effect_of_type(SP_LPE_ITEM(_path),Inkscape::LivePathEffect::BSPLINE)->getLPEObj()->get_lpe()); + if(lpe_bsp){ + return lpe_bsp->steps; + } + } + return 2; +} double PathManipulator::BSplineHandlePosition(Handle *h){ using Geom::X; using Geom::Y; -- cgit v1.2.3 From 4e41340374ba833e748ffbbc610a28c7c3559557 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 19 Mar 2013 04:35:35 +0100 Subject: Working width widgets (bzr r11950.1.58) --- src/ui/tool/path-manipulator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index b46e85622..853d9336a 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1191,7 +1191,7 @@ int PathManipulator::getControlBsplineSteps(){ if (SP_LPE_ITEM(_path) && sp_lpe_item_has_path_effect(SP_LPE_ITEM(_path))){ lpe_bsp = dynamic_cast(sp_lpe_item_has_path_effect_of_type(SP_LPE_ITEM(_path),Inkscape::LivePathEffect::BSPLINE)->getLPEObj()->get_lpe()); if(lpe_bsp){ - return lpe_bsp->steps; + return lpe_bsp->steps+1; } } return 2; -- cgit v1.2.3 From b887e821e03cae71b2116d58e64efb62eb9be0be Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 20 Mar 2013 01:47:49 +0100 Subject: For testing, widget added, regression fixed (bzr r11950.1.62) --- src/ui/tool/path-manipulator.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 853d9336a..c3ab19a4e 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1176,7 +1176,12 @@ void PathManipulator::_createControlPointsFromGeometry() bool PathManipulator::isBSpline(){ LivePathEffect::LPEBSpline *lpe_bsp = NULL; if (SP_LPE_ITEM(_path) && sp_lpe_item_has_path_effect(SP_LPE_ITEM(_path))){ - lpe_bsp = dynamic_cast(sp_lpe_item_has_path_effect_of_type(SP_LPE_ITEM(_path),Inkscape::LivePathEffect::BSPLINE)->getLPEObj()->get_lpe()); + Inkscape::LivePathEffect::Effect* thisEffect = sp_lpe_item_has_path_effect_of_type(SP_LPE_ITEM(_path),Inkscape::LivePathEffect::BSPLINE); + if(thisEffect){ + lpe_bsp = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); + }else{ + lpe_bsp = NULL; + } }else{ lpe_bsp = NULL; } -- cgit v1.2.3 From f99e35afe4c7d572a5e3a98b12571e577c1b3d14 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 21 Mar 2013 02:39:16 +0100 Subject: Fixed redraw handles at node delete (bzr r11950.1.64) --- src/ui/tool/path-manipulator.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index fc4439711..431cc2d96 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -664,12 +664,6 @@ unsigned PathManipulator::_deleteStretch(NodeList::iterator start, NodeList::ite start.prev()->front()->setPosition(result[1]); end->back()->setPosition(result[2]); - //BSpline - if(isBSpline){ - start.prev()->front()->setPosition(BSplineHandleReposition(start.prev()->front())); - end->back()->setPosition(BSplineHandleReposition(end->back())); - } - //BSpline End } // We can't use nl->erase(start, end), because it would break when the stretch @@ -680,6 +674,12 @@ unsigned PathManipulator::_deleteStretch(NodeList::iterator start, NodeList::ite nl.erase(start); start = next; } + //BSpline + if(isBSpline){ + start.prev()->front()->setPosition(BSplineHandleReposition(start.prev()->front())); + end->back()->setPosition(BSplineHandleReposition(end->back())); + } + //BSpline End return del_len; } -- cgit v1.2.3 From a60fc5880c9bab8bf471c2ef808499182201b621 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 21 Mar 2013 10:53:39 +0100 Subject: Fixing errors at delete extrewmiuns nodes (bzr r11950.1.65) --- src/ui/tool/path-manipulator.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 431cc2d96..571e6dd7a 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1197,13 +1197,19 @@ double PathManipulator::BSplineHandlePosition(Handle *h){ double pos = 0; Node *n = h->parent(); SPCurve *lineInsideNodes = new SPCurve(); - Node * nextNode = n->nodeToward(h); - Geom::Point positionH = h->position(); - positionH = Geom::Point(positionH[X] - 0.0625,positionH[Y] - 0.0625); - if(nextNode && n->position() != h->position()){ - lineInsideNodes->moveto(n->position()); - lineInsideNodes->lineto(nextNode->position()); - pos = Geom::nearest_point(positionH,*lineInsideNodes->first_segment()); + Node * nextNode = NULL; + try{ + nextNode = n->nodeToward(h); + }catch( char * str ) { + } + if(nextNode){ + Geom::Point positionH = h->position(); + positionH = Geom::Point(positionH[X] - 0.0625,positionH[Y] - 0.0625); + if(nextNode && n->position() != h->position()){ + lineInsideNodes->moveto(n->position()); + lineInsideNodes->lineto(nextNode->position()); + pos = Geom::nearest_point(positionH,*lineInsideNodes->first_segment()); + } } return pos; } @@ -1220,7 +1226,11 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ Node *n = h->parent(); Geom::D2< Geom::SBasis > SBasisInsideNodes; SPCurve *lineInsideNodes = new SPCurve(); - Node * nextNode = n->nodeToward(h); + Node * nextNode = NULL; + try{ + nextNode = n->nodeToward(h); + }catch( char * str ) { + } if(nextNode && pos != 0){ lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); -- cgit v1.2.3 From d142ebe8740c40922c1a6aa423ca4e0e7d2335d6 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 22 Mar 2013 01:50:18 +0100 Subject: Fixed end extremium node delete fault, ready for testing (bzr r11950.1.66) --- src/ui/tool/path-manipulator.cpp | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 571e6dd7a..8f6651dee 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -9,9 +9,7 @@ * Copyright (C) 2009 Authors * Released under GNU GPL, read the file 'COPYING' for more information */ -//BSpline -#include "live_effects/lpe-bspline.h" -//BSpline end + #include "live_effects/lpe-powerstroke.h" #include #include @@ -46,6 +44,9 @@ #include "ui/tool/multi-path-manipulator.h" #include "xml/node.h" #include "xml/node-observer.h" +//BSpline +#include "live_effects/lpe-bspline.h" +//BSpline end namespace Inkscape { namespace UI { @@ -149,8 +150,8 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, sigc::hide( sigc::mem_fun(*this, &PathManipulator::_updateOutlineOnZoomChange))); _createControlPointsFromGeometry(); - - LivePathEffect::LPEBSpline *lpe_bsp = NULL; + //BSpline + lpe_bsp = NULL; if (SP_LPE_ITEM(_path) && sp_lpe_item_has_path_effect(SP_LPE_ITEM(_path))){ Inkscape::LivePathEffect::Effect* thisEffect = sp_lpe_item_has_path_effect_of_type(SP_LPE_ITEM(_path),Inkscape::LivePathEffect::BSPLINE); if(thisEffect){ @@ -162,6 +163,7 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, isBSpline = true; controlBSplineSteps = lpe_bsp->steps+1; } + //BSpline End } PathManipulator::~PathManipulator() @@ -676,8 +678,15 @@ unsigned PathManipulator::_deleteStretch(NodeList::iterator start, NodeList::ite } //BSpline if(isBSpline){ - start.prev()->front()->setPosition(BSplineHandleReposition(start.prev()->front())); - end->back()->setPosition(BSplineHandleReposition(end->back())); + double pos = 0; + if(start.prev()){ + pos = BSplineHandlePosition(start.prev()->back()); + start.prev()->front()->setPosition(BSplineHandleReposition(start.prev()->front(),pos)); + } + if(end){ + pos = BSplineHandlePosition(end->front()); + end->back()->setPosition(BSplineHandleReposition(end->back(),pos)); + } } //BSpline End @@ -1192,16 +1201,19 @@ void PathManipulator::_createControlPointsFromGeometry() } double PathManipulator::BSplineHandlePosition(Handle *h){ + //BSpline + if(lpe_bsp){ + controlBSplineSteps = lpe_bsp->steps+1; + } + //BSpline End using Geom::X; using Geom::Y; double pos = 0; Node *n = h->parent(); SPCurve *lineInsideNodes = new SPCurve(); Node * nextNode = NULL; - try{ + if(!n->isEndNode()) nextNode = n->nodeToward(h); - }catch( char * str ) { - } if(nextNode){ Geom::Point positionH = h->position(); positionH = Geom::Point(positionH[X] - 0.0625,positionH[Y] - 0.0625); @@ -1227,10 +1239,8 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ Geom::D2< Geom::SBasis > SBasisInsideNodes; SPCurve *lineInsideNodes = new SPCurve(); Node * nextNode = NULL; - try{ + if(!n->isEndNode()) nextNode = n->nodeToward(h); - }catch( char * str ) { - } if(nextNode && pos != 0){ lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); -- cgit v1.2.3 From c34969161a38e67408b654a8b308b45ca638811f Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 23 Mar 2013 15:57:26 +0100 Subject: Remove extra code (bzr r11950.1.69) --- src/ui/tool/path-manipulator.cpp | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 84e300306..f8c5deea2 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -841,11 +841,6 @@ void PathManipulator::scaleHandle(Node *n, int which, int dir, bool pixel) relpos *= ((rellen + length_change) / rellen); } h->setRelativePos(relpos); - - if(isBSpline){ - double pos = BSplineHandlePosition(h); - h->setPosition(BSplineHandleReposition(h,pos)); - } update(); gchar const *key = which < 0 ? "handle:scale:left" : "handle:scale:right"; _commit(_("Scale handle"), key); @@ -870,12 +865,6 @@ void PathManipulator::rotateHandle(Node *n, int which, int dir, bool pixel) } h->setRelativePos(h->relativePos() * Geom::Rotate(angle)); - - if(isBSpline){ - double pos = BSplineHandlePosition(h); - h->setPosition(BSplineHandleReposition(h,pos)); - } - update(); gchar const *key = which < 0 ? "handle:rotate:left" : "handle:rotate:right"; -- cgit v1.2.3 From a7ced41f3fa6933d0da0151ef42e82e0862581fb Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 1 Apr 2013 01:09:52 +0200 Subject: Fix scale and rotate some nodes (bzr r11950.1.78) --- src/ui/tool/path-manipulator.cpp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 1607585c5..be5514e1f 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -862,7 +862,6 @@ void PathManipulator::rotateHandle(Node *n, int which, int dir, bool pixel) int snaps = prefs->getIntLimited("/options/rotationsnapsperpi/value", 12, 1, 1000); angle = M_PI * dir / snaps; } - h->setRelativePos(h->relativePos() * Geom::Rotate(angle)); update(); @@ -1211,14 +1210,12 @@ double PathManipulator::BSplineHandlePosition(Handle *h){ Node * nextNode = NULL; if(!n->isEndNode()) nextNode = n->nodeToward(h); - if(nextNode){ - Geom::Point positionH = h->position(); - positionH = Geom::Point(positionH[X] - 0.0625,positionH[Y] - 0.0625); - if(nextNode && n->position() != h->position()){ - lineInsideNodes->moveto(n->position()); - lineInsideNodes->lineto(nextNode->position()); - pos = Geom::nearest_point(positionH,*lineInsideNodes->first_segment()); - } + Geom::Point positionH = h->position(); + positionH = Geom::Point(positionH[X] - 0.0625,positionH[Y] - 0.0625); + if(nextNode && n->position() != h->position()){ + lineInsideNodes->moveto(n->position()); + lineInsideNodes->lineto(nextNode->position()); + pos = Geom::nearest_point(positionH,*lineInsideNodes->first_segment()); } return pos; } @@ -1250,6 +1247,11 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ return ret; } +void PathManipulator::BSplineNodeHandlesReposition(Node *n){ + n->front()->setPosition(BSplineHandleReposition(n->front(),n->bsplineWeight)); + n->back()->setPosition(BSplineHandleReposition(n->back(),n->bsplineWeight)); +} + /** Construct the geometric representation of nodes and handles, update the outline * and display * \param alert_LPE if true, first the LPE is warned what the new path is going to be before updating it @@ -1264,8 +1266,14 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) continue; } NodeList::iterator prev = subpath->begin(); + if(isBSpline){ + BSplineNodeHandlesReposition(prev.ptr()); + } builder.moveTo(prev->position()); for (NodeList::iterator i = ++subpath->begin(); i != subpath->end(); ++i) { + if(isBSpline){ + BSplineNodeHandlesReposition(i.ptr()); + } build_segment(builder, prev.ptr(), i.ptr()); prev = i; } -- cgit v1.2.3 From 30858428c74d1fa0f119f40b99fa5e51836d8599 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 8 Apr 2013 00:50:31 +0200 Subject: Change width only for selected nodes by widget (bzr r11950.1.83) --- src/ui/tool/path-manipulator.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index be5514e1f..6cad60fee 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1248,8 +1248,22 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ } void PathManipulator::BSplineNodeHandlesReposition(Node *n){ - n->front()->setPosition(BSplineHandleReposition(n->front(),n->bsplineWeight)); - n->back()->setPosition(BSplineHandleReposition(n->back(),n->bsplineWeight)); + if(n->selected()){ + Node * nextNode = n->nodeToward(n->front()); + Node * prevNode = n->nodeToward(n->back()); + double prevPos = 0; + double nextPos = 0; + if(prevNode) + prevPos = BSplineHandlePosition(prevNode->front()); + if(nextNode) + nextPos = BSplineHandlePosition(nextNode->back()); + n->front()->setPosition(BSplineHandleReposition(n->front(),n->bsplineWeight)); + n->back()->setPosition(BSplineHandleReposition(n->back(),n->bsplineWeight)); + if(prevNode) + prevNode->front()->setPosition(BSplineHandleReposition(prevNode->front(),prevPos)); + if(nextNode) + nextNode->back()->setPosition(BSplineHandleReposition(nextNode->back(),nextPos)); + } } /** Construct the geometric representation of nodes and handles, update the outline -- cgit v1.2.3 From 458ca2842297a5eae7e4f6fc394b227d61881c8d Mon Sep 17 00:00:00 2001 From: root Date: Wed, 17 Apr 2013 23:03:51 +0200 Subject: Update color lines overlay, with halo of 1 px matched by Gez. Fix some crash snapping. Added new button widget to make cusp node (bzr r11950.1.96) --- src/ui/tool/path-manipulator.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 6cad60fee..9da27e807 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1204,14 +1204,14 @@ int PathManipulator::getSteps(){ double PathManipulator::BSplineHandlePosition(Handle *h){ using Geom::X; using Geom::Y; - double pos = 0; + double pos = 0.0000; Node *n = h->parent(); SPCurve *lineInsideNodes = new SPCurve(); Node * nextNode = NULL; if(!n->isEndNode()) nextNode = n->nodeToward(h); Geom::Point positionH = h->position(); - positionH = Geom::Point(positionH[X] - 0.0625,positionH[Y] - 0.0625); + positionH = Geom::Point(positionH[X] + 0.0001,positionH[Y] + 0.0001); if(nextNode && n->position() != h->position()){ lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); @@ -1235,12 +1235,12 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ Node * nextNode = NULL; if(!n->isEndNode()) nextNode = n->nodeToward(h); - if(nextNode && pos != 0){ + if(nextNode && pos != 0.0000){ lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); ret = SBasisInsideNodes.valueAt(pos); - ret = Geom::Point(ret[X] + 0.0625,ret[Y] + 0.0625); + ret = Geom::Point(ret[X] + 0.0001,ret[Y] + 0.0001); }else{ ret = n->position(); } @@ -1251,8 +1251,8 @@ void PathManipulator::BSplineNodeHandlesReposition(Node *n){ if(n->selected()){ Node * nextNode = n->nodeToward(n->front()); Node * prevNode = n->nodeToward(n->back()); - double prevPos = 0; - double nextPos = 0; + double prevPos = 0.0000; + double nextPos = 0.0000; if(prevNode) prevPos = BSplineHandlePosition(prevNode->front()); if(nextNode) -- cgit v1.2.3 From be4b46000a9a9f29d79b2e939c0669f6ddf0c59f Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 27 Apr 2013 02:01:11 +0200 Subject: Fixed important selection bug when changing to cusp nodes (bzr r11950.1.109) --- src/ui/tool/path-manipulator.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 9da27e807..cad794860 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1239,9 +1239,11 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); + n->bsplineWeight = pos; ret = SBasisInsideNodes.valueAt(pos); ret = Geom::Point(ret[X] + 0.0001,ret[Y] + 0.0001); }else{ + n->bsplineWeight = 0.0000; ret = n->position(); } return ret; @@ -1257,8 +1259,8 @@ void PathManipulator::BSplineNodeHandlesReposition(Node *n){ prevPos = BSplineHandlePosition(prevNode->front()); if(nextNode) nextPos = BSplineHandlePosition(nextNode->back()); - n->front()->setPosition(BSplineHandleReposition(n->front(),n->bsplineWeight)); - n->back()->setPosition(BSplineHandleReposition(n->back(),n->bsplineWeight)); + n->front()->setPosition(BSplineHandleReposition(n->front())); + n->back()->setPosition(BSplineHandleReposition(n->back())); if(prevNode) prevNode->front()->setPosition(BSplineHandleReposition(prevNode->front(),prevPos)); if(nextNode) -- cgit v1.2.3 From e17c04bd7386e2e346b7f4f760f6e6ba3c24b886 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 17 May 2013 00:53:42 +0200 Subject: Fix error with try-catch (bzr r11950.1.115) --- src/ui/tool/path-manipulator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index cad794860..7785dd685 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -110,6 +110,7 @@ void build_segment(Geom::PathBuilder &, Node *, Node *); PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, Geom::Affine const &et, guint32 outline_color, Glib::ustring lpe_key) : PointManipulator(mpm._path_data.node_data.desktop, *mpm._path_data.node_data.selection) + , isBSpline(true) , _subpaths(*this) , _multi_path_manipulator(mpm) , _path(path) @@ -157,7 +158,6 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, lpe_bsp = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); } } - isBSpline = false; if(lpe_bsp){ isBSpline = true; } -- cgit v1.2.3 From 9291d4e3a3ad22bef4669b74568ee6d43ba74547 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 18 May 2013 10:38:35 +0200 Subject: Fix error with envelope lpe (bzr r11950.1.117) --- src/ui/tool/path-manipulator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 7785dd685..eb60abe2a 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -152,7 +152,7 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, _createControlPointsFromGeometry(); //BSpline lpe_bsp = NULL; - if (SP_LPE_ITEM(_path) && sp_lpe_item_has_path_effect(SP_LPE_ITEM(_path))){ + if (SP_IS_LPE_ITEM(_path) && sp_lpe_item_has_path_effect(SP_LPE_ITEM(_path))){ Inkscape::LivePathEffect::Effect* thisEffect = sp_lpe_item_has_path_effect_of_type(SP_LPE_ITEM(_path),Inkscape::LivePathEffect::BSPLINE); if(thisEffect){ lpe_bsp = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); -- cgit v1.2.3 From d67294affd2f6b0f71c67b75cf521bfe308500f9 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 29 May 2013 01:33:43 +0200 Subject: Fixed a error that handles all kinds of pathas as bsplines (bzr r11950.1.119) --- src/ui/tool/path-manipulator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index eb60abe2a..ea007dfee 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -110,7 +110,7 @@ void build_segment(Geom::PathBuilder &, Node *, Node *); PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, Geom::Affine const &et, guint32 outline_color, Glib::ustring lpe_key) : PointManipulator(mpm._path_data.node_data.desktop, *mpm._path_data.node_data.selection) - , isBSpline(true) + , isBSpline(false) , _subpaths(*this) , _multi_path_manipulator(mpm) , _path(path) -- cgit v1.2.3 From 987dd0e7eae4dded4049771af56b72889d05c461 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 26 Sep 2013 18:28:28 +0200 Subject: Compiling problem solved thaks to ~suv (bzr r11950.1.149) --- src/ui/tool/path-manipulator.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index e08a36e2e..dac67295a 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -152,12 +152,14 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, _createControlPointsFromGeometry(); //BSpline lpe_bsp = NULL; - if (SP_IS_LPE_ITEM(_path) && sp_lpe_item_has_path_effect(SP_LPE_ITEM(_path))){ - Inkscape::LivePathEffect::Effect* thisEffect = sp_lpe_item_has_path_effect_of_type(SP_LPE_ITEM(_path),Inkscape::LivePathEffect::BSPLINE); + + if (_path->hasPathEffect()){ + Inkscape::LivePathEffect::Effect* thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); if(thisEffect){ lpe_bsp = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); } } + if(lpe_bsp){ isBSpline = true; } -- cgit v1.2.3 From debe6f792f37d4ca3acb297eea230503cc3522a4 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 27 Sep 2013 12:21:37 +0200 Subject: Fix editing paths in live effect (bzr r11950.1.154) --- src/ui/tool/path-manipulator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 1add4d176..3690efdad 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -153,7 +153,7 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, //BSpline lpe_bsp = NULL; - if (_path->hasPathEffect()){ + if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()){ Inkscape::LivePathEffect::Effect* thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); if(thisEffect){ lpe_bsp = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); -- cgit v1.2.3 From 514675a4b3eeb5835ad2466b692b3d00c6333c4a Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 30 Sep 2013 17:58:15 +0200 Subject: Fixed a bug editing paths in others LPE -envelope- (bzr r11950.1.157) --- src/ui/tool/path-manipulator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 3690efdad..910f75258 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1312,7 +1312,7 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) Geom::PathVector pathv = builder.peek() * (_edit_transform * _i2d_transform).inverse(); _spcurve->set_pathvector(pathv); if (alert_LPE) { - if (_path->hasPathEffect()) { + if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()) { PathEffectList effect_list = sp_lpe_item_get_effect_list(_path); LivePathEffect::LPEPowerStroke *lpe_pwr = dynamic_cast( effect_list.front()->lpeobject->get_lpe() ); if (lpe_pwr) { -- cgit v1.2.3 From 5ef4eb74cfdec7aad437518db0ab99414bd3eae6 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 5 Oct 2013 23:20:25 +0200 Subject: Fix moving handles (bzr r11950.1.160) --- src/ui/tool/path-manipulator.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index f72313315..18ad45f72 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1268,10 +1268,12 @@ void PathManipulator::BSplineNodeHandlesReposition(Node *n){ nextPos = BSplineHandlePosition(nextNode->back()); n->front()->setPosition(BSplineHandleReposition(n->front())); n->back()->setPosition(BSplineHandleReposition(n->back())); - if(prevNode) + if(prevNode && !prevNode->isEndNode()) prevNode->front()->setPosition(BSplineHandleReposition(prevNode->front(),prevPos)); - if(nextNode) + prevNode->back()->setPosition(BSplineHandleReposition(prevNode->back(),prevPos)); + if(nextNode && !nextNode->isEndNode()) nextNode->back()->setPosition(BSplineHandleReposition(nextNode->back(),nextPos)); + nextNode->front()->setPosition(BSplineHandleReposition(nextNode->front(),prevPos)); } } -- cgit v1.2.3 From bc37c9b9c4663786b04a65ba6a27d55b2395eeb9 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 5 Oct 2013 23:56:02 +0200 Subject: fix whith bspline handles (bzr r11950.1.162) --- src/ui/tool/path-manipulator.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 18ad45f72..fd286873b 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1268,12 +1268,14 @@ void PathManipulator::BSplineNodeHandlesReposition(Node *n){ nextPos = BSplineHandlePosition(nextNode->back()); n->front()->setPosition(BSplineHandleReposition(n->front())); n->back()->setPosition(BSplineHandleReposition(n->back())); - if(prevNode && !prevNode->isEndNode()) + if(prevNode && !prevNode->isEndNode()){ prevNode->front()->setPosition(BSplineHandleReposition(prevNode->front(),prevPos)); prevNode->back()->setPosition(BSplineHandleReposition(prevNode->back(),prevPos)); - if(nextNode && !nextNode->isEndNode()) + } + if(nextNode && !nextNode->isEndNode()){ nextNode->back()->setPosition(BSplineHandleReposition(nextNode->back(),nextPos)); nextNode->front()->setPosition(BSplineHandleReposition(nextNode->front(),prevPos)); + } } } -- cgit v1.2.3 From cdc3d492add4c4bd63d96dcb53c406f9ef631ec9 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 6 Oct 2013 09:27:04 +0200 Subject: Fix in BSpline (bzr r11950.1.163) --- src/ui/tool/path-manipulator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index fd286873b..e9372aef3 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1274,7 +1274,7 @@ void PathManipulator::BSplineNodeHandlesReposition(Node *n){ } if(nextNode && !nextNode->isEndNode()){ nextNode->back()->setPosition(BSplineHandleReposition(nextNode->back(),nextPos)); - nextNode->front()->setPosition(BSplineHandleReposition(nextNode->front(),prevPos)); + nextNode->front()->setPosition(BSplineHandleReposition(nextNode->front(),nextPos)); } } } -- cgit v1.2.3 From 3111608afecf747627810a6222cb7ca1eded6962 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 6 Oct 2013 12:18:59 +0200 Subject: UX improvements (bzr r11950.1.166) --- src/ui/tool/path-manipulator.cpp | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index e9372aef3..809d2628f 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -683,7 +683,7 @@ unsigned PathManipulator::_deleteStretch(NodeList::iterator start, NodeList::ite } //BSpline if(isBSpline){ - double pos = 0; + double pos = 0.0000; if(start.prev()){ pos = BSplineHandlePosition(start.prev()->back()); start.prev()->front()->setPosition(BSplineHandleReposition(start.prev()->front(),pos)); @@ -1215,8 +1215,7 @@ double PathManipulator::BSplineHandlePosition(Handle *h){ Node *n = h->parent(); SPCurve *lineInsideNodes = new SPCurve(); Node * nextNode = NULL; - if(!n->isEndNode()) - nextNode = n->nodeToward(h); + nextNode = n->nodeToward(h); Geom::Point positionH = h->position(); positionH = Geom::Point(positionH[X] + 0.0001,positionH[Y] + 0.0001); if(nextNode && n->position() != h->position()){ @@ -1235,13 +1234,12 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h){ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ using Geom::X; using Geom::Y; - Geom::Point ret(0,0); + Geom::Point ret = h->position(); Node *n = h->parent(); Geom::D2< Geom::SBasis > SBasisInsideNodes; SPCurve *lineInsideNodes = new SPCurve(); Node * nextNode = NULL; - if(!n->isEndNode()) - nextNode = n->nodeToward(h); + nextNode = n->nodeToward(h); if(nextNode && pos != 0.0000){ lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); @@ -1250,8 +1248,10 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ ret = SBasisInsideNodes.valueAt(pos); ret = Geom::Point(ret[X] + 0.0001,ret[Y] + 0.0001); }else{ - n->bsplineWeight = 0.0000; - ret = n->position(); + if(pos == 0.0000){ + n->bsplineWeight = 0.0000; + ret = n->position(); + } } return ret; } @@ -1262,19 +1262,23 @@ void PathManipulator::BSplineNodeHandlesReposition(Node *n){ Node * prevNode = n->nodeToward(n->back()); double prevPos = 0.0000; double nextPos = 0.0000; - if(prevNode) + if(prevNode){ prevPos = BSplineHandlePosition(prevNode->front()); - if(nextNode) + n->back()->setPosition(BSplineHandleReposition(n->back())); + } + if(nextNode){ nextPos = BSplineHandlePosition(nextNode->back()); - n->front()->setPosition(BSplineHandleReposition(n->front())); - n->back()->setPosition(BSplineHandleReposition(n->back())); - if(prevNode && !prevNode->isEndNode()){ + n->front()->setPosition(BSplineHandleReposition(n->front())); + } + if(prevNode){ + if(!prevNode->isEndNode()) + prevNode->back()->setPosition(BSplineHandleReposition(prevNode->back(),prevPos)); prevNode->front()->setPosition(BSplineHandleReposition(prevNode->front(),prevPos)); - prevNode->back()->setPosition(BSplineHandleReposition(prevNode->back(),prevPos)); } - if(nextNode && !nextNode->isEndNode()){ + if(nextNode){ + if(!nextNode->isEndNode()) + nextNode->front()->setPosition(BSplineHandleReposition(nextNode->front(),nextPos)); nextNode->back()->setPosition(BSplineHandleReposition(nextNode->back(),nextPos)); - nextNode->front()->setPosition(BSplineHandleReposition(nextNode->front(),nextPos)); } } } -- cgit v1.2.3 From f26927f8891498ca9466ea865f17a790b73ccff6 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 7 Oct 2013 01:39:48 +0200 Subject: Fix scaling handles (bzr r11950.1.170) --- src/ui/tool/path-manipulator.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 809d2628f..620c52e34 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1213,12 +1213,12 @@ double PathManipulator::BSplineHandlePosition(Handle *h){ using Geom::Y; double pos = 0.0000; Node *n = h->parent(); - SPCurve *lineInsideNodes = new SPCurve(); Node * nextNode = NULL; nextNode = n->nodeToward(h); Geom::Point positionH = h->position(); positionH = Geom::Point(positionH[X] + 0.0001,positionH[Y] + 0.0001); if(nextNode && n->position() != h->position()){ + SPCurve *lineInsideNodes = new SPCurve(); lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); pos = Geom::nearest_point(positionH,*lineInsideNodes->first_segment()); @@ -1263,11 +1263,11 @@ void PathManipulator::BSplineNodeHandlesReposition(Node *n){ double prevPos = 0.0000; double nextPos = 0.0000; if(prevNode){ - prevPos = BSplineHandlePosition(prevNode->front()); + prevPos = BSplineHandlePosition(prevNode->front(),prevNode->bsplineWeight); n->back()->setPosition(BSplineHandleReposition(n->back())); } if(nextNode){ - nextPos = BSplineHandlePosition(nextNode->back()); + nextPos = BSplineHandlePosition(nextNode->back(),nextNode->bsplineWeight); n->front()->setPosition(BSplineHandleReposition(n->front())); } if(prevNode){ -- cgit v1.2.3 From c2d73f1a14e1d461553465892bc9a3767313878a Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 7 Oct 2013 01:54:04 +0200 Subject: Fix scaling handles (bzr r11950.1.171) --- src/ui/tool/path-manipulator.cpp | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 620c52e34..27def4cb1 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1257,29 +1257,19 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ } void PathManipulator::BSplineNodeHandlesReposition(Node *n){ - if(n->selected()){ - Node * nextNode = n->nodeToward(n->front()); - Node * prevNode = n->nodeToward(n->back()); - double prevPos = 0.0000; - double nextPos = 0.0000; - if(prevNode){ - prevPos = BSplineHandlePosition(prevNode->front(),prevNode->bsplineWeight); - n->back()->setPosition(BSplineHandleReposition(n->back())); - } - if(nextNode){ - nextPos = BSplineHandlePosition(nextNode->back(),nextNode->bsplineWeight); - n->front()->setPosition(BSplineHandleReposition(n->front())); - } - if(prevNode){ - if(!prevNode->isEndNode()) - prevNode->back()->setPosition(BSplineHandleReposition(prevNode->back(),prevPos)); - prevNode->front()->setPosition(BSplineHandleReposition(prevNode->front(),prevPos)); - } - if(nextNode){ - if(!nextNode->isEndNode()) - nextNode->front()->setPosition(BSplineHandleReposition(nextNode->front(),nextPos)); - nextNode->back()->setPosition(BSplineHandleReposition(nextNode->back(),nextPos)); - } + Node * nextNode = n->nodeToward(n->front()); + Node * prevNode = n->nodeToward(n->back()); + if(prevNode){ + n->back()->setPosition(BSplineHandleReposition(n->back())); + if(!prevNode->isEndNode()) + prevNode->back()->setPosition(BSplineHandleReposition(prevNode->back(),prevNode->bsplineWeight)); + prevNode->front()->setPosition(BSplineHandleReposition(prevNode->front(),prevNode->bsplineWeight)); + } + if(nextNode){ + n->front()->setPosition(BSplineHandleReposition(n->front())); + if(!nextNode->isEndNode()) + nextNode->front()->setPosition(BSplineHandleReposition(nextNode->front(),nextNode->bsplineWeight)); + nextNode->back()->setPosition(BSplineHandleReposition(nextNode->back(),nextNode->bsplineWeight)); } } -- cgit v1.2.3 From f238a7004752e4e56b7e6d602f675c97c0ce4733 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 7 Oct 2013 17:09:32 +0200 Subject: Fixing BSplines (bzr r11950.1.174) --- src/ui/tool/path-manipulator.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 27def4cb1..b90fa4ac7 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1261,12 +1261,16 @@ void PathManipulator::BSplineNodeHandlesReposition(Node *n){ Node * prevNode = n->nodeToward(n->back()); if(prevNode){ n->back()->setPosition(BSplineHandleReposition(n->back())); + if(prevNode->front()->position() == prevNode->position()) + prevNode->bsplineWeight = 0.000; if(!prevNode->isEndNode()) prevNode->back()->setPosition(BSplineHandleReposition(prevNode->back(),prevNode->bsplineWeight)); prevNode->front()->setPosition(BSplineHandleReposition(prevNode->front(),prevNode->bsplineWeight)); } if(nextNode){ n->front()->setPosition(BSplineHandleReposition(n->front())); + if(nextNode->front()->position() == nextNode->position()) + nextNode->bsplineWeight = 0.000; if(!nextNode->isEndNode()) nextNode->front()->setPosition(BSplineHandleReposition(nextNode->front(),nextNode->bsplineWeight)); nextNode->back()->setPosition(BSplineHandleReposition(nextNode->back(),nextNode->bsplineWeight)); @@ -1287,14 +1291,14 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) continue; } NodeList::iterator prev = subpath->begin(); - if(isBSpline){ - BSplineNodeHandlesReposition(prev.ptr()); - } + //if(isBSpline){ + // BSplineNodeHandlesReposition(prev.ptr()); + //} builder.moveTo(prev->position()); for (NodeList::iterator i = ++subpath->begin(); i != subpath->end(); ++i) { - if(isBSpline){ - BSplineNodeHandlesReposition(i.ptr()); - } + //if(isBSpline){ + // BSplineNodeHandlesReposition(i.ptr()); + //} build_segment(builder, prev.ptr(), i.ptr()); prev = i; } -- cgit v1.2.3 From ebc5ac2b758155192114ea1bec8b3d32820a18d3 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 3 Dec 2013 16:55:14 +0100 Subject: Fix a bug delete BSpline LPE from a path retain some BSpline properties (bzr r11950.1.206) --- src/ui/tool/path-manipulator.cpp | 52 ++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 21 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index e66c6a899..fd421e587 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -43,9 +43,9 @@ #include "ui/tool/multi-path-manipulator.h" #include "xml/node.h" #include "xml/node-observer.h" -//BSpline + #include "live_effects/lpe-bspline.h" -//BSpline end + namespace Inkscape { namespace UI { @@ -150,20 +150,7 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, sigc::hide( sigc::mem_fun(*this, &PathManipulator::_updateOutlineOnZoomChange))); _createControlPointsFromGeometry(); - //BSpline - lpe_bsp = NULL; - - if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()){ - Inkscape::LivePathEffect::Effect* thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); - if(thisEffect){ - lpe_bsp = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); - } - } - - if(lpe_bsp){ - isBSpline = true; - } - //BSpline End + BSpline(); } PathManipulator::~PathManipulator() @@ -681,7 +668,7 @@ unsigned PathManipulator::_deleteStretch(NodeList::iterator start, NodeList::ite nl.erase(start); start = next; } - //BSpline + if(isBSpline){ double pos = 0.0000; if(start.prev()){ @@ -693,7 +680,7 @@ unsigned PathManipulator::_deleteStretch(NodeList::iterator start, NodeList::ite end->back()->setPosition(BSplineHandleReposition(end->back(),pos)); } } - //BSpline End + return del_len; } @@ -928,9 +915,9 @@ void PathManipulator::showHandles(bool show) /** Set the visibility of outline. */ void PathManipulator::showOutline(bool show) { - //BSpline + if(isBSpline) show = true; - //BSpline + if (show == _show_outline) return; _show_outline = show; _updateOutline(); @@ -1204,10 +1191,33 @@ void PathManipulator::_createControlPointsFromGeometry() } } -int PathManipulator::getSteps(){ +int PathManipulator::BSplineGetSteps(){ + LivePathEffect::LPEBSpline *lpe_bsp = NULL; + + if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()){ + Inkscape::LivePathEffect::Effect* thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); + if(thisEffect){ + lpe_bsp = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); + } + } return lpe_bsp->steps+1; } +void PathManipulator::BSpline(){ + LivePathEffect::LPEBSpline *lpe_bsp = NULL; + + if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()){ + Inkscape::LivePathEffect::Effect* thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); + if(thisEffect){ + lpe_bsp = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); + } + } + isBSpline = false; + if(lpe_bsp){ + isBSpline = true; + } +} + double PathManipulator::BSplineHandlePosition(Handle *h){ using Geom::X; using Geom::Y; -- cgit v1.2.3 From 57865cd8a96b1b5c72f44c9b97d1a828caf09f95 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 30 Dec 2013 19:45:52 +0100 Subject: Refactorizing (bzr r11950.1.211) --- src/ui/tool/path-manipulator.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index fd421e587..4aec42100 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1294,6 +1294,7 @@ void PathManipulator::BSplineNodeHandlesReposition(Node *n){ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) { Geom::PathBuilder builder; + BSpline(); for (std::list::iterator spi = _subpaths.begin(); spi != _subpaths.end(); ) { SubpathPtr subpath = *spi; if (subpath->empty()) { @@ -1301,14 +1302,8 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) continue; } NodeList::iterator prev = subpath->begin(); - //if(isBSpline){ - // BSplineNodeHandlesReposition(prev.ptr()); - //} builder.moveTo(prev->position()); for (NodeList::iterator i = ++subpath->begin(); i != subpath->end(); ++i) { - //if(isBSpline){ - // BSplineNodeHandlesReposition(i.ptr()); - //} build_segment(builder, prev.ptr(), i.ptr()); prev = i; } -- cgit v1.2.3 From 4c6918c72721a35e0347e9e087396238e72eb62e Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 30 Dec 2013 20:41:32 +0100 Subject: Refactorizing (bzr r11950.1.212) --- src/ui/tool/path-manipulator.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 4aec42100..4cb6ce296 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -43,10 +43,8 @@ #include "ui/tool/multi-path-manipulator.h" #include "xml/node.h" #include "xml/node-observer.h" - #include "live_effects/lpe-bspline.h" - namespace Inkscape { namespace UI { @@ -668,7 +666,6 @@ unsigned PathManipulator::_deleteStretch(NodeList::iterator start, NodeList::ite nl.erase(start); start = next; } - if(isBSpline){ double pos = 0.0000; if(start.prev()){ @@ -680,7 +677,6 @@ unsigned PathManipulator::_deleteStretch(NodeList::iterator start, NodeList::ite end->back()->setPosition(BSplineHandleReposition(end->back(),pos)); } } - return del_len; } @@ -856,9 +852,9 @@ void PathManipulator::rotateHandle(Node *n, int which, int dir, bool pixel) int snaps = prefs->getIntLimited("/options/rotationsnapsperpi/value", 12, 1, 1000); angle = M_PI * dir / snaps; } + h->setRelativePos(h->relativePos() * Geom::Rotate(angle)); update(); - gchar const *key = which < 0 ? "handle:rotate:left" : "handle:rotate:right"; _commit(_("Rotate handle"), key); } @@ -915,9 +911,7 @@ void PathManipulator::showHandles(bool show) /** Set the visibility of outline. */ void PathManipulator::showOutline(bool show) { - if(isBSpline) show = true; - if (show == _show_outline) return; _show_outline = show; _updateOutline(); @@ -1307,7 +1301,6 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) build_segment(builder, prev.ptr(), i.ptr()); prev = i; } - if (subpath->closed()) { // Here we link the last and first node if the path is closed. // If the last segment is Bezier, we add it. @@ -1319,7 +1312,6 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) } ++spi; } - builder.finish(); Geom::PathVector pathv = builder.peek() * (_edit_transform * _i2d_transform).inverse(); _spcurve->set_pathvector(pathv); @@ -1380,6 +1372,7 @@ void PathManipulator::_updateOutline() sp_canvas_item_hide(_outline); return; } + Geom::PathVector pv = _spcurve->get_pathvector(); pv *= (_edit_transform * _i2d_transform); // This SPCurve thing has to be killed with extreme prejudice -- cgit v1.2.3 From bfc330ddc8564d132f885378f428fab10692edbb Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 31 Dec 2013 00:21:57 +0100 Subject: Spanish comment of path-manipulator-cpp (bzr r11950.1.223) --- src/ui/tool/path-manipulator.cpp | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 4cb6ce296..47f736fcb 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -33,7 +33,6 @@ #include "live_effects/lpeobject-reference.h" #include "live_effects/parameter/path.h" #include "sp-path.h" -#include "sp-lpe-item.h" #include "helper/geom.h" #include "preferences.h" #include "style.h" @@ -43,6 +42,7 @@ #include "ui/tool/multi-path-manipulator.h" #include "xml/node.h" #include "xml/node-observer.h" +#include "sp-lpe-item.h" #include "live_effects/lpe-bspline.h" namespace Inkscape { @@ -104,7 +104,7 @@ private: }; void build_segment(Geom::PathBuilder &, Node *, Node *); - +//spanish: una propiedad isBSpline, por defecto falsa y una función al final de la función (BSpline()) que la define realmente PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, Geom::Affine const &et, guint32 outline_color, Glib::ustring lpe_key) : PointManipulator(mpm._path_data.node_data.desktop, *mpm._path_data.node_data.selection) @@ -666,6 +666,7 @@ unsigned PathManipulator::_deleteStretch(NodeList::iterator start, NodeList::ite nl.erase(start); start = next; } + //spanish: si se borra, reajustamos los tiradores if(isBSpline){ double pos = 0.0000; if(start.prev()){ @@ -1185,7 +1186,9 @@ void PathManipulator::_createControlPointsFromGeometry() } } +//spanish: determina si el trazado tiene efecto bspline y el numero de pasos que realiza int PathManipulator::BSplineGetSteps(){ + LivePathEffect::LPEBSpline *lpe_bsp = NULL; if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()){ @@ -1194,24 +1197,22 @@ int PathManipulator::BSplineGetSteps(){ lpe_bsp = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); } } - return lpe_bsp->steps+1; + int steps = 0; + if(lpe_bsp){ + steps = lpe_bsp->steps+1; + } + return steps; } +//spanish: determina si el trazado tiene efecto bspline void PathManipulator::BSpline(){ - LivePathEffect::LPEBSpline *lpe_bsp = NULL; - - if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()){ - Inkscape::LivePathEffect::Effect* thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); - if(thisEffect){ - lpe_bsp = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); - } - } isBSpline = false; - if(lpe_bsp){ + if(this->BSplineGetSteps()>0){ isBSpline = true; } } +//spanish: devuelve la fuerza que le corresponderia a la posicón de un tirador double PathManipulator::BSplineHandlePosition(Handle *h){ using Geom::X; using Geom::Y; @@ -1230,11 +1231,13 @@ double PathManipulator::BSplineHandlePosition(Handle *h){ return pos; } +//spanish: mueve el tirador a la posición que le corresponda Geom::Point PathManipulator::BSplineHandleReposition(Handle *h){ double pos = this->BSplineHandlePosition(h); return BSplineHandleReposition(h,pos); } +//spanish: mueve el tirador a una posición específica Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ using Geom::X; using Geom::Y; @@ -1260,11 +1263,12 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ return ret; } +//spanish: mueve los tiradores del nodo y sus tiradores opuestos a la potencia de sus nodos void PathManipulator::BSplineNodeHandlesReposition(Node *n){ Node * nextNode = n->nodeToward(n->front()); Node * prevNode = n->nodeToward(n->back()); if(prevNode){ - n->back()->setPosition(BSplineHandleReposition(n->back())); + n->back()->setPosition(BSplineHandleReposition(n->back(),n->bsplineWeight)); if(prevNode->front()->position() == prevNode->position()) prevNode->bsplineWeight = 0.000; if(!prevNode->isEndNode()) @@ -1272,7 +1276,7 @@ void PathManipulator::BSplineNodeHandlesReposition(Node *n){ prevNode->front()->setPosition(BSplineHandleReposition(prevNode->front(),prevNode->bsplineWeight)); } if(nextNode){ - n->front()->setPosition(BSplineHandleReposition(n->front())); + n->front()->setPosition(BSplineHandleReposition(n->front(),n->bsplineWeight)); if(nextNode->front()->position() == nextNode->position()) nextNode->bsplineWeight = 0.000; if(!nextNode->isEndNode()) -- cgit v1.2.3 From c288aa062e611031f54f6ad8e5e3ee2f581cc783 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 31 Dec 2013 00:29:07 +0100 Subject: Spanish comment of freehand-base.cpp (bzr r11950.1.224) --- src/ui/tool/path-manipulator.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 47f736fcb..e70717728 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -42,7 +42,6 @@ #include "ui/tool/multi-path-manipulator.h" #include "xml/node.h" #include "xml/node-observer.h" -#include "sp-lpe-item.h" #include "live_effects/lpe-bspline.h" namespace Inkscape { -- cgit v1.2.3 From c08c28e9a22f0fe5f06e9dc34430c3acb16f3c13 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 2 Jan 2014 16:15:27 +0100 Subject: Fixed a boring bug sometimes curves be converted to lines, increasing a bit the distance from the handle to the line (bzr r11950.1.230) --- src/ui/tool/path-manipulator.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index e70717728..cda8374c5 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1219,13 +1219,11 @@ double PathManipulator::BSplineHandlePosition(Handle *h){ Node *n = h->parent(); Node * nextNode = NULL; nextNode = n->nodeToward(h); - Geom::Point positionH = h->position(); - positionH = Geom::Point(positionH[X] + 0.0001,positionH[Y] + 0.0001); if(nextNode && n->position() != h->position()){ SPCurve *lineInsideNodes = new SPCurve(); lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); - pos = Geom::nearest_point(positionH,*lineInsideNodes->first_segment()); + pos = Geom::nearest_point(h->position(),*lineInsideNodes->first_segment()); } return pos; } @@ -1252,7 +1250,7 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); n->bsplineWeight = pos; ret = SBasisInsideNodes.valueAt(pos); - ret = Geom::Point(ret[X] + 0.0001,ret[Y] + 0.0001); + ret = Geom::Point(ret[X] + 0.005,ret[Y] + 0.005); }else{ if(pos == 0.0000){ n->bsplineWeight = 0.0000; -- cgit v1.2.3 From 0b15b05d641661e6b1d5cb73520c7cdead1cfc89 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 9 Jan 2014 17:46:40 +0100 Subject: Fix a bug whith oposite handles on node move,and a little cleanup (bzr r11950.1.232) --- src/ui/tool/path-manipulator.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index cda8374c5..8a0568fbd 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1225,6 +1225,7 @@ double PathManipulator::BSplineHandlePosition(Handle *h){ lineInsideNodes->lineto(nextNode->position()); pos = Geom::nearest_point(h->position(),*lineInsideNodes->first_segment()); } + n->bsplineWeight = pos; return pos; } @@ -1265,17 +1266,11 @@ void PathManipulator::BSplineNodeHandlesReposition(Node *n){ Node * nextNode = n->nodeToward(n->front()); Node * prevNode = n->nodeToward(n->back()); if(prevNode){ - n->back()->setPosition(BSplineHandleReposition(n->back(),n->bsplineWeight)); - if(prevNode->front()->position() == prevNode->position()) - prevNode->bsplineWeight = 0.000; if(!prevNode->isEndNode()) prevNode->back()->setPosition(BSplineHandleReposition(prevNode->back(),prevNode->bsplineWeight)); prevNode->front()->setPosition(BSplineHandleReposition(prevNode->front(),prevNode->bsplineWeight)); } if(nextNode){ - n->front()->setPosition(BSplineHandleReposition(n->front(),n->bsplineWeight)); - if(nextNode->front()->position() == nextNode->position()) - nextNode->bsplineWeight = 0.000; if(!nextNode->isEndNode()) nextNode->front()->setPosition(BSplineHandleReposition(nextNode->front(),nextNode->bsplineWeight)); nextNode->back()->setPosition(BSplineHandleReposition(nextNode->back(),nextNode->bsplineWeight)); -- cgit v1.2.3 From 7af8d4e83411f23c762da6bfbd2130e76923df7f Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 30 Jan 2014 19:34:23 +0100 Subject: show outline like normal paths, by good su_v suggestion (bzr r11950.1.239) --- src/ui/tool/path-manipulator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 7bbe39f8d..654e1fa5d 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -911,8 +911,8 @@ void PathManipulator::showHandles(bool show) /** Set the visibility of outline. */ void PathManipulator::showOutline(bool show) { - if(isBSpline) show = true; - if (show == _show_outline) return; + //if(isBSpline) show = true; + //if (show == _show_outline) return; _show_outline = show; _updateOutline(); } -- cgit v1.2.3 From 2563a8cae7411cfee682cbd306f43d5721908c42 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 30 Jan 2014 19:45:02 +0100 Subject: show outline by default in bspline, tnx to su_v suggestion (bzr r11950.1.241) --- src/ui/tool/path-manipulator.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 654e1fa5d..da364926a 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -148,6 +148,9 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, _createControlPointsFromGeometry(); BSpline(); + if(isBSpline){ + _show_outline(true); + } } PathManipulator::~PathManipulator() -- cgit v1.2.3 From e582ac68a9ebeca19cc10c47fb6b57a514937278 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 30 Jan 2014 19:52:10 +0100 Subject: fix bug compiling (bzr r11950.1.242) --- src/ui/tool/path-manipulator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index da364926a..83af89732 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -149,7 +149,7 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, _createControlPointsFromGeometry(); BSpline(); if(isBSpline){ - _show_outline(true); + _show_outline = true; } } -- cgit v1.2.3 From 2cb207295847d68e22aab2e8adb967819ff8feaa Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 30 Jan 2014 22:16:10 +0100 Subject: Hack to can show/hide bspline lines (bzr r11950.1.243) --- src/ui/tool/path-manipulator.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 83af89732..9cda94097 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -150,6 +150,8 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, BSpline(); if(isBSpline){ _show_outline = true; + _updateOutline(); + _show_outline = false; } } @@ -914,8 +916,7 @@ void PathManipulator::showHandles(bool show) /** Set the visibility of outline. */ void PathManipulator::showOutline(bool show) { - //if(isBSpline) show = true; - //if (show == _show_outline) return; + if (show == _show_outline) return; _show_outline = show; _updateOutline(); } -- cgit v1.2.3 From 210d60046203fad93e65f049c5c6a7516d967f07 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 30 Jan 2014 23:40:40 +0100 Subject: add comment to bspline red outline hack (bzr r11950.1.244) --- src/ui/tool/path-manipulator.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 9cda94097..4092cd22b 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -148,6 +148,8 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, _createControlPointsFromGeometry(); BSpline(); + //Small Hack to default show red path in bspline on select, independent of the state of toogle button + //it become some inconsistent behaviour in the show_path toogle button if(isBSpline){ _show_outline = true; _updateOutline(); -- cgit v1.2.3 From 215e1988378008820be9bfb7d948d8b6e33eb0a1 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 8 Feb 2014 22:16:43 +0100 Subject: Removing hack for force show red lines in bspline mode (bzr r11950.1.251) --- src/ui/tool/path-manipulator.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 4092cd22b..bad07daee 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -148,13 +148,6 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, _createControlPointsFromGeometry(); BSpline(); - //Small Hack to default show red path in bspline on select, independent of the state of toogle button - //it become some inconsistent behaviour in the show_path toogle button - if(isBSpline){ - _show_outline = true; - _updateOutline(); - _show_outline = false; - } } PathManipulator::~PathManipulator() -- cgit v1.2.3 From 616ae6e54d98f03dc1ff3ce7d3c528521fd7e233 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 1 Mar 2014 16:28:13 +0100 Subject: Substitute isBSpline property by a cached function isBSpline(bool) (bzr r11950.1.261) --- src/ui/tool/path-manipulator.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index bad07daee..a6689d93d 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -103,11 +103,9 @@ private: }; void build_segment(Geom::PathBuilder &, Node *, Node *); -//spanish: una propiedad isBSpline, por defecto falsa y una función al final de la función (BSpline()) que la define realmente PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, Geom::Affine const &et, guint32 outline_color, Glib::ustring lpe_key) : PointManipulator(mpm._path_data.node_data.desktop, *mpm._path_data.node_data.selection) - , isBSpline(false) , _subpaths(*this) , _multi_path_manipulator(mpm) , _path(path) @@ -147,7 +145,7 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, sigc::hide( sigc::mem_fun(*this, &PathManipulator::_updateOutlineOnZoomChange))); _createControlPointsFromGeometry(); - BSpline(); + isBSpline(true); } PathManipulator::~PathManipulator() @@ -666,7 +664,7 @@ unsigned PathManipulator::_deleteStretch(NodeList::iterator start, NodeList::ite start = next; } //spanish: si se borra, reajustamos los tiradores - if(isBSpline){ + if(isBSpline(false)){ double pos = 0.0000; if(start.prev()){ pos = BSplineHandlePosition(start.prev()->back()); @@ -1203,11 +1201,16 @@ int PathManipulator::BSplineGetSteps(){ } //spanish: determina si el trazado tiene efecto bspline -void PathManipulator::BSpline(){ - isBSpline = false; - if(this->BSplineGetSteps()>0){ +bool PathManipulator::isBSpline(bool recalculate){ + static int BSplineSteps = this->BSplineGetSteps(); + if(recalculate){ + BSplineSteps = this->BSplineGetSteps(); + } + bool isBSpline = false; + if(BSplineSteps>0){ isBSpline = true; } + return isBSpline; } //spanish: devuelve la fuerza que le corresponderia a la posicón de un tirador @@ -1283,7 +1286,7 @@ void PathManipulator::BSplineNodeHandlesReposition(Node *n){ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) { Geom::PathBuilder builder; - BSpline(); + isBSpline(true); for (std::list::iterator spi = _subpaths.begin(); spi != _subpaths.end(); ) { SubpathPtr subpath = *spi; if (subpath->empty()) { -- cgit v1.2.3 From 9ae7e81723f4ea4e2640ed01d55d94e73874804f Mon Sep 17 00:00:00 2001 From: Guiu Rocafort Date: Wed, 5 Mar 2014 12:37:27 +0100 Subject: translations from spanish to english done, it might need a little review, but everything seems ok (bzr r11950.5.1) --- src/ui/tool/path-manipulator.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index a6689d93d..1cc075603 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -663,7 +663,7 @@ unsigned PathManipulator::_deleteStretch(NodeList::iterator start, NodeList::ite nl.erase(start); start = next; } - //spanish: si se borra, reajustamos los tiradores + // if we are removing, we readjust the handlers if(isBSpline(false)){ double pos = 0.0000; if(start.prev()){ @@ -1182,7 +1182,7 @@ void PathManipulator::_createControlPointsFromGeometry() } } -//spanish: determina si el trazado tiene efecto bspline y el numero de pasos que realiza +//determines if the trace has a bspline effect and the number of steps that it takes int PathManipulator::BSplineGetSteps(){ LivePathEffect::LPEBSpline *lpe_bsp = NULL; @@ -1200,7 +1200,7 @@ int PathManipulator::BSplineGetSteps(){ return steps; } -//spanish: determina si el trazado tiene efecto bspline +// determines if the trace has bspline effect bool PathManipulator::isBSpline(bool recalculate){ static int BSplineSteps = this->BSplineGetSteps(); if(recalculate){ @@ -1213,7 +1213,7 @@ bool PathManipulator::isBSpline(bool recalculate){ return isBSpline; } -//spanish: devuelve la fuerza que le corresponderia a la posicón de un tirador +// returns the corresponding strength to the position of a handler double PathManipulator::BSplineHandlePosition(Handle *h){ using Geom::X; using Geom::Y; @@ -1231,13 +1231,13 @@ double PathManipulator::BSplineHandlePosition(Handle *h){ return pos; } -//spanish: mueve el tirador a la posición que le corresponda +// moves the handler to the corresponding position Geom::Point PathManipulator::BSplineHandleReposition(Handle *h){ double pos = this->BSplineHandlePosition(h); return BSplineHandleReposition(h,pos); } -//spanish: mueve el tirador a una posición específica +// moves the handler to the specified position Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ using Geom::X; using Geom::Y; @@ -1263,7 +1263,7 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ return ret; } -//spanish: mueve los tiradores del nodo y sus tiradores opuestos a la potencia de sus nodos +//moves the node handlers and its oposite handlers to the strength of its nodes void PathManipulator::BSplineNodeHandlesReposition(Node *n){ Node * nextNode = n->nodeToward(n->front()); Node * prevNode = n->nodeToward(n->back()); -- cgit v1.2.3 From a9eea1cea2a13f129bcb30f175cea82ffcbcee29 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 5 Mar 2014 20:03:46 +0100 Subject: Translations (bzr r11950.1.279) --- src/ui/tool/path-manipulator.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 1cc075603..a6689d93d 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -663,7 +663,7 @@ unsigned PathManipulator::_deleteStretch(NodeList::iterator start, NodeList::ite nl.erase(start); start = next; } - // if we are removing, we readjust the handlers + //spanish: si se borra, reajustamos los tiradores if(isBSpline(false)){ double pos = 0.0000; if(start.prev()){ @@ -1182,7 +1182,7 @@ void PathManipulator::_createControlPointsFromGeometry() } } -//determines if the trace has a bspline effect and the number of steps that it takes +//spanish: determina si el trazado tiene efecto bspline y el numero de pasos que realiza int PathManipulator::BSplineGetSteps(){ LivePathEffect::LPEBSpline *lpe_bsp = NULL; @@ -1200,7 +1200,7 @@ int PathManipulator::BSplineGetSteps(){ return steps; } -// determines if the trace has bspline effect +//spanish: determina si el trazado tiene efecto bspline bool PathManipulator::isBSpline(bool recalculate){ static int BSplineSteps = this->BSplineGetSteps(); if(recalculate){ @@ -1213,7 +1213,7 @@ bool PathManipulator::isBSpline(bool recalculate){ return isBSpline; } -// returns the corresponding strength to the position of a handler +//spanish: devuelve la fuerza que le corresponderia a la posicón de un tirador double PathManipulator::BSplineHandlePosition(Handle *h){ using Geom::X; using Geom::Y; @@ -1231,13 +1231,13 @@ double PathManipulator::BSplineHandlePosition(Handle *h){ return pos; } -// moves the handler to the corresponding position +//spanish: mueve el tirador a la posición que le corresponda Geom::Point PathManipulator::BSplineHandleReposition(Handle *h){ double pos = this->BSplineHandlePosition(h); return BSplineHandleReposition(h,pos); } -// moves the handler to the specified position +//spanish: mueve el tirador a una posición específica Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ using Geom::X; using Geom::Y; @@ -1263,7 +1263,7 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ return ret; } -//moves the node handlers and its oposite handlers to the strength of its nodes +//spanish: mueve los tiradores del nodo y sus tiradores opuestos a la potencia de sus nodos void PathManipulator::BSplineNodeHandlesReposition(Node *n){ Node * nextNode = n->nodeToward(n->front()); Node * prevNode = n->nodeToward(n->back()); -- cgit v1.2.3 From c15e77cc2670408ab725ba60c064743a9b61a375 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 5 Mar 2014 20:18:54 +0100 Subject: Fixing branch problems (bzr r11950.1.281) --- src/ui/tool/path-manipulator.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index a6689d93d..1cc075603 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -663,7 +663,7 @@ unsigned PathManipulator::_deleteStretch(NodeList::iterator start, NodeList::ite nl.erase(start); start = next; } - //spanish: si se borra, reajustamos los tiradores + // if we are removing, we readjust the handlers if(isBSpline(false)){ double pos = 0.0000; if(start.prev()){ @@ -1182,7 +1182,7 @@ void PathManipulator::_createControlPointsFromGeometry() } } -//spanish: determina si el trazado tiene efecto bspline y el numero de pasos que realiza +//determines if the trace has a bspline effect and the number of steps that it takes int PathManipulator::BSplineGetSteps(){ LivePathEffect::LPEBSpline *lpe_bsp = NULL; @@ -1200,7 +1200,7 @@ int PathManipulator::BSplineGetSteps(){ return steps; } -//spanish: determina si el trazado tiene efecto bspline +// determines if the trace has bspline effect bool PathManipulator::isBSpline(bool recalculate){ static int BSplineSteps = this->BSplineGetSteps(); if(recalculate){ @@ -1213,7 +1213,7 @@ bool PathManipulator::isBSpline(bool recalculate){ return isBSpline; } -//spanish: devuelve la fuerza que le corresponderia a la posicón de un tirador +// returns the corresponding strength to the position of a handler double PathManipulator::BSplineHandlePosition(Handle *h){ using Geom::X; using Geom::Y; @@ -1231,13 +1231,13 @@ double PathManipulator::BSplineHandlePosition(Handle *h){ return pos; } -//spanish: mueve el tirador a la posición que le corresponda +// moves the handler to the corresponding position Geom::Point PathManipulator::BSplineHandleReposition(Handle *h){ double pos = this->BSplineHandlePosition(h); return BSplineHandleReposition(h,pos); } -//spanish: mueve el tirador a una posición específica +// moves the handler to the specified position Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ using Geom::X; using Geom::Y; @@ -1263,7 +1263,7 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ return ret; } -//spanish: mueve los tiradores del nodo y sus tiradores opuestos a la potencia de sus nodos +//moves the node handlers and its oposite handlers to the strength of its nodes void PathManipulator::BSplineNodeHandlesReposition(Node *n){ Node * nextNode = n->nodeToward(n->front()); Node * prevNode = n->nodeToward(n->back()); -- cgit v1.2.3 From 232d5c9f3cda7f24f4c3019c3c312f81f8797011 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20dos=20Santos=20Oliveira?= Date: Fri, 14 Mar 2014 01:20:33 -0300 Subject: Small code simplification (bzr r11950.7.1) --- src/ui/tool/path-manipulator.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 1cc075603..f8cc58e3b 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1206,11 +1206,7 @@ bool PathManipulator::isBSpline(bool recalculate){ if(recalculate){ BSplineSteps = this->BSplineGetSteps(); } - bool isBSpline = false; - if(BSplineSteps>0){ - isBSpline = true; - } - return isBSpline; + return BSplineSteps > 0; } // returns the corresponding strength to the position of a handler -- cgit v1.2.3 From f9d1d1a8a33eee7fd7977361d2d559697f0fb56d Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 14 Mar 2014 18:35:31 +0100 Subject: =?UTF-8?q?disabling=20cache=20approach=20for=20isBSpline=20functi?= =?UTF-8?q?on,=20pointed=20by=20Vin=C3=ADcius?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (bzr r11950.1.296) --- src/ui/tool/path-manipulator.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index f8cc58e3b..adc70bc38 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -145,7 +145,7 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, sigc::hide( sigc::mem_fun(*this, &PathManipulator::_updateOutlineOnZoomChange))); _createControlPointsFromGeometry(); - isBSpline(true); + isBSpline(/*true*/); } PathManipulator::~PathManipulator() @@ -1201,11 +1201,12 @@ int PathManipulator::BSplineGetSteps(){ } // determines if the trace has bspline effect -bool PathManipulator::isBSpline(bool recalculate){ - static int BSplineSteps = this->BSplineGetSteps(); - if(recalculate){ - BSplineSteps = this->BSplineGetSteps(); - } +bool PathManipulator::isBSpline(/*bool recalculate*/){ + /*static*/ int BSplineSteps = this->BSplineGetSteps(); + // Taking out the static dont need this part + //if(recalculate){ + // BSplineSteps = this->BSplineGetSteps(); + //} return BSplineSteps > 0; } @@ -1282,7 +1283,7 @@ void PathManipulator::BSplineNodeHandlesReposition(Node *n){ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) { Geom::PathBuilder builder; - isBSpline(true); + isBSpline(/*true*/); for (std::list::iterator spi = _subpaths.begin(); spi != _subpaths.end(); ) { SubpathPtr subpath = *spi; if (subpath->empty()) { -- cgit v1.2.3 From eb3102790b3c0eb1ce7131d2c4edceab5978ce88 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 14 Mar 2014 18:38:27 +0100 Subject: simplify the code in isBSpline (bzr r11950.1.297) --- src/ui/tool/path-manipulator.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index adc70bc38..3e54acddf 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1202,12 +1202,13 @@ int PathManipulator::BSplineGetSteps(){ // determines if the trace has bspline effect bool PathManipulator::isBSpline(/*bool recalculate*/){ - /*static*/ int BSplineSteps = this->BSplineGetSteps(); // Taking out the static dont need this part + // static int BSplineSteps = this->BSplineGetSteps(); //if(recalculate){ // BSplineSteps = this->BSplineGetSteps(); //} - return BSplineSteps > 0; + //return BSplineSteps > 0; + return this->BSplineGetSteps() > 0; } // returns the corresponding strength to the position of a handler -- cgit v1.2.3 From acc3de4356672491bcdd795fbac6b80ee2faf27d Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 17 Mar 2014 00:57:12 +0100 Subject: Fix to solve static var in isBSpline function (bzr r11950.1.298) --- src/ui/tool/path-manipulator.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 3e54acddf..841ab659a 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -145,7 +145,8 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, sigc::hide( sigc::mem_fun(*this, &PathManipulator::_updateOutlineOnZoomChange))); _createControlPointsFromGeometry(); - isBSpline(/*true*/); + //Define if the path is BSpline on construction + isBSpline(true); } PathManipulator::~PathManipulator() @@ -664,7 +665,7 @@ unsigned PathManipulator::_deleteStretch(NodeList::iterator start, NodeList::ite start = next; } // if we are removing, we readjust the handlers - if(isBSpline(false)){ + if(isBSpline()){ double pos = 0.0000; if(start.prev()){ pos = BSplineHandlePosition(start.prev()->back()); @@ -1201,14 +1202,11 @@ int PathManipulator::BSplineGetSteps(){ } // determines if the trace has bspline effect -bool PathManipulator::isBSpline(/*bool recalculate*/){ - // Taking out the static dont need this part - // static int BSplineSteps = this->BSplineGetSteps(); - //if(recalculate){ - // BSplineSteps = this->BSplineGetSteps(); - //} - //return BSplineSteps > 0; - return this->BSplineGetSteps() > 0; +bool PathManipulator::isBSpline(bool recalculate){ + if(recalculate){ + _is_bspline = this->BSplineGetSteps() > 0; + } + return _is_bspline; } // returns the corresponding strength to the position of a handler @@ -1284,7 +1282,8 @@ void PathManipulator::BSplineNodeHandlesReposition(Node *n){ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) { Geom::PathBuilder builder; - isBSpline(/*true*/); + //Refresh if is bspline some times -think on path change selection, this value get lost + isBSpline(true); for (std::list::iterator spi = _subpaths.begin(); spi != _subpaths.end(); ) { SubpathPtr subpath = *spi; if (subpath->empty()) { -- cgit v1.2.3 From 2b19c5f6508b7a59766d89f315f9f4fbc364f288 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 1 Apr 2014 00:48:28 +0200 Subject: Some node.cpp/h work moved to path_manipulator. Header variable bsplineWeight removed from all. Simplification of code with less functions in path_manipulator. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To fix: tips stop working because is handled by two static functions and couldent call to path_manipulator from here. Vinícius, any work arround? lines 480,481,1426,1427,1462 of node.cpp. gez: ¿Puedes probar si notas algun bug o problema? principalmente con la herramienta nodo, gracias. (bzr r11950.1.322) --- src/ui/tool/path-manipulator.cpp | 46 +++++++++++++--------------------------- 1 file changed, 15 insertions(+), 31 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 841ab659a..905df61f4 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -666,14 +666,11 @@ unsigned PathManipulator::_deleteStretch(NodeList::iterator start, NodeList::ite } // if we are removing, we readjust the handlers if(isBSpline()){ - double pos = 0.0000; if(start.prev()){ - pos = BSplineHandlePosition(start.prev()->back()); - start.prev()->front()->setPosition(BSplineHandleReposition(start.prev()->front(),pos)); + start.prev()->front()->setPosition(BSplineHandleReposition(start.prev()->front(),true)); } if(end){ - pos = BSplineHandlePosition(end->front()); - end->back()->setPosition(BSplineHandleReposition(end->back(),pos)); + end->back()->setPosition(BSplineHandleReposition(end->back(),true)); } } @@ -1209,31 +1206,36 @@ bool PathManipulator::isBSpline(bool recalculate){ return _is_bspline; } -// returns the corresponding strength to the position of a handler -double PathManipulator::BSplineHandlePosition(Handle *h){ +// returns the corresponding strength to the position of the handlers +double PathManipulator::BSplineHandlePosition(Handle *h, bool other){ using Geom::X; using Geom::Y; double pos = 0.0000; Node *n = h->parent(); Node * nextNode = NULL; + if(other){ + h = h->other(); + } nextNode = n->nodeToward(h); - if(nextNode && n->position() != h->position()){ + if(nextNode && !Geom::are_near(n->position(), h->position())){ SPCurve *lineInsideNodes = new SPCurve(); lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); pos = Geom::nearest_point(h->position(),*lineInsideNodes->first_segment()); } - n->bsplineWeight = pos; + if ((pos == 0.0000 || pos == 1.0000) && other == false){ + return BSplineHandlePosition(h, true); + } return pos; } -// moves the handler to the corresponding position -Geom::Point PathManipulator::BSplineHandleReposition(Handle *h){ - double pos = this->BSplineHandlePosition(h); +// give the location for the handler in the corresponding position +Geom::Point PathManipulator::BSplineHandleReposition(Handle *h, bool other){ + double pos = this->BSplineHandlePosition(h, other); return BSplineHandleReposition(h,pos); } -// moves the handler to the specified position +// give the location for the handler to the specified position Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ using Geom::X; using Geom::Y; @@ -1247,34 +1249,16 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); - n->bsplineWeight = pos; ret = SBasisInsideNodes.valueAt(pos); ret = Geom::Point(ret[X] + 0.005,ret[Y] + 0.005); }else{ if(pos == 0.0000){ - n->bsplineWeight = 0.0000; ret = n->position(); } } return ret; } -//moves the node handlers and its oposite handlers to the strength of its nodes -void PathManipulator::BSplineNodeHandlesReposition(Node *n){ - Node * nextNode = n->nodeToward(n->front()); - Node * prevNode = n->nodeToward(n->back()); - if(prevNode){ - if(!prevNode->isEndNode()) - prevNode->back()->setPosition(BSplineHandleReposition(prevNode->back(),prevNode->bsplineWeight)); - prevNode->front()->setPosition(BSplineHandleReposition(prevNode->front(),prevNode->bsplineWeight)); - } - if(nextNode){ - if(!nextNode->isEndNode()) - nextNode->front()->setPosition(BSplineHandleReposition(nextNode->front(),nextNode->bsplineWeight)); - nextNode->back()->setPosition(BSplineHandleReposition(nextNode->back(),nextNode->bsplineWeight)); - } -} - /** Construct the geometric representation of nodes and handles, update the outline * and display * \param alert_LPE if true, first the LPE is warned what the new path is going to be before updating it -- cgit v1.2.3 From 0f78c1425e814758c0a0d7f0c2578eae88fe3ab6 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 1 Apr 2014 14:02:22 +0200 Subject: =?UTF-8?q?A=20refactor=20for=20fixing=20some=20issues.=20Pending?= =?UTF-8?q?=20how=20to=20handle=20static=20functions=20Vin=C3=ADcius=20for?= =?UTF-8?q?=20handle=20tips=20in=20his=20static=20functions=20i=20know=20t?= =?UTF-8?q?wo=20ways:=20A:=20A=20bool=20property=20in=20node=20class=20of?= =?UTF-8?q?=20node.h=20to=20handle=20if=20curve=20is=20bspline=20B:=20Call?= =?UTF-8?q?=20another=20non=20static=20function=20from=20the=20static=20ti?= =?UTF-8?q?ps=20one=20-not=20tested-?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (bzr r11950.1.323) --- src/ui/tool/path-manipulator.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 905df61f4..487c31b10 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -667,10 +667,10 @@ unsigned PathManipulator::_deleteStretch(NodeList::iterator start, NodeList::ite // if we are removing, we readjust the handlers if(isBSpline()){ if(start.prev()){ - start.prev()->front()->setPosition(BSplineHandleReposition(start.prev()->front(),true)); + start.prev()->front()->setPosition(BSplineHandleReposition(start.prev()->front(),start.prev()->back())); } if(end){ - end->back()->setPosition(BSplineHandleReposition(end->back(),true)); + end->back()->setPosition(BSplineHandleReposition(end->back(),end->front())); } } @@ -1207,31 +1207,31 @@ bool PathManipulator::isBSpline(bool recalculate){ } // returns the corresponding strength to the position of the handlers -double PathManipulator::BSplineHandlePosition(Handle *h, bool other){ +double PathManipulator::BSplineHandlePosition(Handle *h, Handle *h2){ using Geom::X; using Geom::Y; + if(h2){ + h = h2; + } double pos = 0.0000; Node *n = h->parent(); Node * nextNode = NULL; - if(other){ - h = h->other(); - } nextNode = n->nodeToward(h); - if(nextNode && !Geom::are_near(n->position(), h->position())){ + if(nextNode){ SPCurve *lineInsideNodes = new SPCurve(); lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); pos = Geom::nearest_point(h->position(),*lineInsideNodes->first_segment()); } - if ((pos == 0.0000 || pos == 1.0000) && other == false){ - return BSplineHandlePosition(h, true); + if (pos == 0.0000 && !h2){ + return BSplineHandlePosition(h, h->other()); } return pos; } // give the location for the handler in the corresponding position -Geom::Point PathManipulator::BSplineHandleReposition(Handle *h, bool other){ - double pos = this->BSplineHandlePosition(h, other); +Geom::Point PathManipulator::BSplineHandleReposition(Handle *h, Handle *h2){ + double pos = this->BSplineHandlePosition(h, h2); return BSplineHandleReposition(h,pos); } -- cgit v1.2.3 From 5a8b00f027b9eb3d4abb290d2ddf26d36d71cf80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20dos=20Santos=20Oliveira?= Date: Mon, 5 May 2014 04:13:35 -0300 Subject: Enabling path manipulator to comunicate if paths are bspline when accessing const objects. This change was required to correctly show on the GUI whether or not a node was a bspline. (bzr r11950.8.1) --- src/ui/tool/path-manipulator.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 487c31b10..3beeed049 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1181,14 +1181,14 @@ void PathManipulator::_createControlPointsFromGeometry() } //determines if the trace has a bspline effect and the number of steps that it takes -int PathManipulator::BSplineGetSteps(){ +int PathManipulator::BSplineGetSteps() const { - LivePathEffect::LPEBSpline *lpe_bsp = NULL; + LivePathEffect::LPEBSpline const *lpe_bsp = NULL; if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()){ - Inkscape::LivePathEffect::Effect* thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); + Inkscape::LivePathEffect::Effect const *thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); if(thisEffect){ - lpe_bsp = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); + lpe_bsp = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); } } int steps = 0; @@ -1206,6 +1206,10 @@ bool PathManipulator::isBSpline(bool recalculate){ return _is_bspline; } +bool PathManipulator::isBSpline() const { + return BSplineGetSteps() > 0; +} + // returns the corresponding strength to the position of the handlers double PathManipulator::BSplineHandlePosition(Handle *h, Handle *h2){ using Geom::X; -- cgit v1.2.3 From 371f45365a6b6ea42d17c8ea33cc0072f318967e Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 2 Jul 2014 13:14:35 +0200 Subject: Add LPE fillet-chamfer (bzr r13341.1.74) --- src/ui/tool/path-manipulator.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 3beeed049..01cff5ad7 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -11,6 +11,7 @@ */ #include "live_effects/lpe-powerstroke.h" +#include "live_effects/lpe-fillet-chamfer.h" #include #include #include @@ -1300,11 +1301,20 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) _spcurve->set_pathvector(pathv); if (alert_LPE) { /// \todo note that _path can be an Inkscape::LivePathEffect::Effect* too, kind of confusing, rework member naming? - if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()) { - PathEffectList effect_list = _path->getEffectList(); - LivePathEffect::LPEPowerStroke *lpe_pwr = dynamic_cast( effect_list.front()->lpeobject->get_lpe() ); - if (lpe_pwr) { - lpe_pwr->adjustForNewPath(pathv); + if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()){ + Inkscape::LivePathEffect::Effect* thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::POWERSTROKE); + if(thisEffect){ + LivePathEffect::LPEPowerStroke *lpe_pwr = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); + if (lpe_pwr) { + lpe_pwr->adjustForNewPath(pathv); + } + } + thisEffect = SP_LPE_ITEM(_path)->getPathEffectOfType(Inkscape::LivePathEffect::FILLET_CHAMFER); + if(thisEffect){ + LivePathEffect::LPEFilletChamfer *lpe_fll = dynamic_cast(thisEffect->getLPEObj()->get_lpe()); + if (lpe_fll) { + lpe_fll->adjustForNewPath(pathv); + } } } } -- cgit v1.2.3 From b2842360758b2333a651ef9932c1e438e90628e3 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 4 Aug 2014 11:21:54 +0200 Subject: Fixed some redraw problems moving nodes in bspline mode (bzr r13341.1.115) --- src/ui/tool/path-manipulator.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 01cff5ad7..9839be437 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1219,6 +1219,7 @@ double PathManipulator::BSplineHandlePosition(Handle *h, Handle *h2){ h = h2; } double pos = 0.0000; + const double handleCubicGap = 0.01; Node *n = h->parent(); Node * nextNode = NULL; nextNode = n->nodeToward(h); @@ -1226,7 +1227,7 @@ double PathManipulator::BSplineHandlePosition(Handle *h, Handle *h2){ SPCurve *lineInsideNodes = new SPCurve(); lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); - pos = Geom::nearest_point(h->position(),*lineInsideNodes->first_segment()); + pos = Geom::nearest_point(Geom::Point(h->position()[X] - handleCubicGap,h->position()[Y] - handleCubicGap),*lineInsideNodes->first_segment()); } if (pos == 0.0000 && !h2){ return BSplineHandlePosition(h, h->other()); @@ -1244,6 +1245,7 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h, Handle *h2){ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ using Geom::X; using Geom::Y; + const double handleCubicGap = 0.01; Geom::Point ret = h->position(); Node *n = h->parent(); Geom::D2< Geom::SBasis > SBasisInsideNodes; @@ -1255,7 +1257,7 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ lineInsideNodes->lineto(nextNode->position()); SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); ret = SBasisInsideNodes.valueAt(pos); - ret = Geom::Point(ret[X] + 0.005,ret[Y] + 0.005); + ret = Geom::Point(ret[X] + handleCubicGap,ret[Y] + handleCubicGap); }else{ if(pos == 0.0000){ ret = n->position(); -- cgit v1.2.3 From e9f9ba07739cdb52c649e8e10dca9de76c71114d Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Fri, 8 Aug 2014 16:20:44 -0400 Subject: Massive performance improvment for basic node operations with thousands of nodes (bzr r13341.1.124) --- src/ui/tool/path-manipulator.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 9839be437..5f20aece7 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -140,8 +140,8 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, _selection.signal_update.connect( sigc::bind(sigc::mem_fun(*this, &PathManipulator::update), false)); - _selection.signal_point_changed.connect( - sigc::mem_fun(*this, &PathManipulator::_selectionChanged)); + _selection.signal_selection_changed.connect( + sigc::mem_fun(*this, &PathManipulator::_selectionChangedM)); _desktop->signal_zoom_changed.connect( sigc::hide( sigc::mem_fun(*this, &PathManipulator::_updateOutlineOnZoomChange))); @@ -1524,6 +1524,12 @@ bool PathManipulator::_handleClicked(Handle *h, GdkEventButton *event) return false; } +void PathManipulator::_selectionChangedM(std::vector pvec, bool selected) { + for (size_t n = 0, e = pvec.size(); n < e; ++n) { + _selectionChanged(pvec[n], selected); + } +} + void PathManipulator::_selectionChanged(SelectableControlPoint *p, bool selected) { if (selected) ++_num_selected; -- cgit v1.2.3 From 0403ae2f0f76e56b31e369160648968671324d13 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 16 Sep 2014 01:07:32 +0200 Subject: fixing cusp node bug on bspline -problems moving nodes because tiny handles (bzr r13341.1.209) --- src/ui/tool/path-manipulator.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 5f20aece7..f30ecb1d1 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1227,7 +1227,9 @@ double PathManipulator::BSplineHandlePosition(Handle *h, Handle *h2){ SPCurve *lineInsideNodes = new SPCurve(); lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); - pos = Geom::nearest_point(Geom::Point(h->position()[X] - handleCubicGap,h->position()[Y] - handleCubicGap),*lineInsideNodes->first_segment()); + if(!are_near(h->position(), n->position())){ + pos = Geom::nearest_point(Geom::Point(h->position()[X] ,h->position()[Y] - handleCubicGap),*lineInsideNodes->first_segment()); + } } if (pos == 0.0000 && !h2){ return BSplineHandlePosition(h, h->other()); -- cgit v1.2.3 From 7ec3afaf68ebfedabd4c4addd74812ff8f055955 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 16 Sep 2014 17:09:19 +0200 Subject: Fix bug moving nodes in bspline mode (bzr r13341.1.210) --- src/ui/tool/path-manipulator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index f30ecb1d1..edb74cb40 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -1228,7 +1228,7 @@ double PathManipulator::BSplineHandlePosition(Handle *h, Handle *h2){ lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); if(!are_near(h->position(), n->position())){ - pos = Geom::nearest_point(Geom::Point(h->position()[X] ,h->position()[Y] - handleCubicGap),*lineInsideNodes->first_segment()); + pos = Geom::nearest_point(Geom::Point(h->position()[X] - handleCubicGap, h->position()[Y] - handleCubicGap), *lineInsideNodes->first_segment()); } } if (pos == 0.0000 && !h2){ -- cgit v1.2.3 From 4c9804125c8b62e195313ac9ec97e92bd542cbdd Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 23 Sep 2014 17:42:51 +0200 Subject: fix bug -bad power- inserting nodes near cusp nodes in bspline (bzr r13341.1.218) --- src/ui/tool/path-manipulator.cpp | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index edb74cb40..48b19ef7a 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -991,9 +991,37 @@ NodeList::iterator PathManipulator::subdivideSegment(NodeList::iterator first, d // set new handle positions Node *n = new Node(_multi_path_manipulator._path_data.node_data, seg2[0]); - n->back()->setPosition(seg1[2]); - n->front()->setPosition(seg2[1]); - n->setType(NODE_SMOOTH, false); + if(!isBSpline()){ + n->back()->setPosition(seg1[2]); + n->front()->setPosition(seg2[1]); + n->setType(NODE_SMOOTH, false); + } else { + const double handleCubicGap = 0.01; + Geom::D2< Geom::SBasis > SBasisInsideNodes; + SPCurve *lineInsideNodes = new SPCurve(); + if(second->back()->isDegenerate()){ + lineInsideNodes->moveto(n->position()); + lineInsideNodes->lineto(second->position()); + SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); + Geom::Point next = SBasisInsideNodes.valueAt(0.3334); + next = Geom::Point(next[Geom::X] + handleCubicGap,next[Geom::Y] + handleCubicGap); + lineInsideNodes->reset(); + n->front()->setPosition(next); + }else{ + n->front()->setPosition(seg2[1]); + } + if(first->front()->isDegenerate()){ + lineInsideNodes->moveto(n->position()); + lineInsideNodes->lineto(first->position()); + SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); + Geom::Point previous = SBasisInsideNodes.valueAt(0.3334); + previous = Geom::Point(previous[Geom::X] + handleCubicGap,previous[Geom::Y] + handleCubicGap); + n->back()->setPosition(previous); + }else{ + n->back()->setPosition(seg1[2]); + } + n->setType(NODE_CUSP, false); + } inserted = list.insert(insert_at, n); first->front()->move(seg1[1]); -- cgit v1.2.3 From 86cf2d0a97e0412629102ae51df0a4797f9179db Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 23 Sep 2014 23:43:31 +0200 Subject: remove magic numbers from bspline (bzr r13341.1.219) --- src/ui/tool/path-manipulator.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 48b19ef7a..52ff5d42c 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -56,6 +56,10 @@ enum PathChange { }; } // anonymous namespace +const double handleCubicGap = 0.01; +const double noPower = 0.0; +const double defaultStartPower = 0.3334; +const double defaultEndPower = 0.6667; /** * Notifies the path manipulator when something changes the path being edited @@ -1003,7 +1007,7 @@ NodeList::iterator PathManipulator::subdivideSegment(NodeList::iterator first, d lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(second->position()); SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); - Geom::Point next = SBasisInsideNodes.valueAt(0.3334); + Geom::Point next = SBasisInsideNodes.valueAt(defaultStartPower); next = Geom::Point(next[Geom::X] + handleCubicGap,next[Geom::Y] + handleCubicGap); lineInsideNodes->reset(); n->front()->setPosition(next); @@ -1014,7 +1018,7 @@ NodeList::iterator PathManipulator::subdivideSegment(NodeList::iterator first, d lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(first->position()); SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); - Geom::Point previous = SBasisInsideNodes.valueAt(0.3334); + Geom::Point previous = SBasisInsideNodes.valueAt(defaultStartPower); previous = Geom::Point(previous[Geom::X] + handleCubicGap,previous[Geom::Y] + handleCubicGap); n->back()->setPosition(previous); }else{ @@ -1246,7 +1250,7 @@ double PathManipulator::BSplineHandlePosition(Handle *h, Handle *h2){ if(h2){ h = h2; } - double pos = 0.0000; + double pos = noPower; const double handleCubicGap = 0.01; Node *n = h->parent(); Node * nextNode = NULL; @@ -1259,7 +1263,7 @@ double PathManipulator::BSplineHandlePosition(Handle *h, Handle *h2){ pos = Geom::nearest_point(Geom::Point(h->position()[X] - handleCubicGap, h->position()[Y] - handleCubicGap), *lineInsideNodes->first_segment()); } } - if (pos == 0.0000 && !h2){ + if (pos == noPower && !h2){ return BSplineHandlePosition(h, h->other()); } return pos; @@ -1282,14 +1286,14 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ SPCurve *lineInsideNodes = new SPCurve(); Node * nextNode = NULL; nextNode = n->nodeToward(h); - if(nextNode && pos != 0.0000){ + if(nextNode && pos != noPower){ lineInsideNodes->moveto(n->position()); lineInsideNodes->lineto(nextNode->position()); SBasisInsideNodes = lineInsideNodes->first_segment()->toSBasis(); ret = SBasisInsideNodes.valueAt(pos); ret = Geom::Point(ret[X] + handleCubicGap,ret[Y] + handleCubicGap); }else{ - if(pos == 0.0000){ + if(pos == noPower){ ret = n->position(); } } -- cgit v1.2.3 From 72cca0fc9e6e25af69ebaa8c82f2ad282eaabf53 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Tue, 4 Nov 2014 00:10:33 +0100 Subject: Remove unused variable and put well a constant (bzr r13669) --- src/ui/tool/path-manipulator.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/ui/tool/path-manipulator.cpp') diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 52ff5d42c..8b99c33b8 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -59,7 +59,7 @@ enum PathChange { const double handleCubicGap = 0.01; const double noPower = 0.0; const double defaultStartPower = 0.3334; -const double defaultEndPower = 0.6667; + /** * Notifies the path manipulator when something changes the path being edited @@ -1000,7 +1000,6 @@ NodeList::iterator PathManipulator::subdivideSegment(NodeList::iterator first, d n->front()->setPosition(seg2[1]); n->setType(NODE_SMOOTH, false); } else { - const double handleCubicGap = 0.01; Geom::D2< Geom::SBasis > SBasisInsideNodes; SPCurve *lineInsideNodes = new SPCurve(); if(second->back()->isDegenerate()){ @@ -1251,7 +1250,6 @@ double PathManipulator::BSplineHandlePosition(Handle *h, Handle *h2){ h = h2; } double pos = noPower; - const double handleCubicGap = 0.01; Node *n = h->parent(); Node * nextNode = NULL; nextNode = n->nodeToward(h); @@ -1279,7 +1277,6 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h, Handle *h2){ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){ using Geom::X; using Geom::Y; - const double handleCubicGap = 0.01; Geom::Point ret = h->position(); Node *n = h->parent(); Geom::D2< Geom::SBasis > SBasisInsideNodes; -- cgit v1.2.3