diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-03-28 13:57:30 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2015-03-28 13:57:30 +0000 |
| commit | d3117487bcf047050642b80a3f46acd811947105 (patch) | |
| tree | 2e1d204fefe18c4d2e94053f71830a18bc4590e1 /src/ui/tool/path-manipulator.cpp | |
| parent | adding rotation transform (diff) | |
| parent | Fix calculation of miter limit. Implement 'miter-clip' line join. (diff) | |
| download | inkscape-d3117487bcf047050642b80a3f46acd811947105.tar.gz inkscape-d3117487bcf047050642b80a3f46acd811947105.zip | |
update to trunk
(bzr r13708.1.21)
Diffstat (limited to 'src/ui/tool/path-manipulator.cpp')
| -rw-r--r-- | src/ui/tool/path-manipulator.cpp | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index dbcde240a..ccf75dcde 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-bspline.h" #include "live_effects/lpe-fillet-chamfer.h" #include <string> #include <sstream> @@ -43,7 +44,6 @@ #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 { @@ -151,7 +151,7 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, _createControlPointsFromGeometry(); //Define if the path is BSpline on construction - isBSpline(true); + recalculateIsBSpline(); } PathManipulator::~PathManipulator() @@ -1238,19 +1238,24 @@ int PathManipulator::BSplineGetSteps() const { } // determines if the trace has bspline effect -bool PathManipulator::isBSpline(bool recalculate){ - if(recalculate){ - _is_bspline = this->BSplineGetSteps() > 0; +void PathManipulator::recalculateIsBSpline(){ + if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()) { + Inkscape::LivePathEffect::Effect const *thisEffect = _path->getPathEffectOfType(Inkscape::LivePathEffect::BSPLINE); + if(thisEffect){ + _is_bspline = true; + return; + } } - return _is_bspline; + _is_bspline = false; } bool PathManipulator::isBSpline() const { - return BSplineGetSteps() > 0; + return _is_bspline; } // returns the corresponding strength to the position of the handlers -double PathManipulator::BSplineHandlePosition(Handle *h, Handle *h2){ +double PathManipulator::BSplineHandlePosition(Handle *h, Handle *h2) +{ using Geom::X; using Geom::Y; if(h2){ @@ -1275,7 +1280,8 @@ double PathManipulator::BSplineHandlePosition(Handle *h, Handle *h2){ } // give the location for the handler in the corresponding position -Geom::Point PathManipulator::BSplineHandleReposition(Handle *h, Handle *h2){ +Geom::Point PathManipulator::BSplineHandleReposition(Handle *h, Handle *h2) +{ double pos = this->BSplineHandlePosition(h, h2); return BSplineHandleReposition(h,pos); } @@ -1312,7 +1318,7 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE) { Geom::PathBuilder builder; //Refresh if is bspline some times -think on path change selection, this value get lost - isBSpline(true); + recalculateIsBSpline(); for (std::list<SubpathPtr>::iterator spi = _subpaths.begin(); spi != _subpaths.end(); ) { SubpathPtr subpath = *spi; if (subpath->empty()) { @@ -1341,22 +1347,19 @@ 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? - SPLPEItem * path = dynamic_cast<SPLPEItem *>(_path); - if (path){ - if(path->hasPathEffect()){ - Inkscape::LivePathEffect::Effect* thisEffect = path->getPathEffectOfType(Inkscape::LivePathEffect::POWERSTROKE); - if(thisEffect){ - LivePathEffect::LPEPowerStroke *lpe_pwr = dynamic_cast<LivePathEffect::LPEPowerStroke*>(thisEffect->getLPEObj()->get_lpe()); - if (lpe_pwr) { - lpe_pwr->adjustForNewPath(pathv); - } + if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()) { + Inkscape::LivePathEffect::Effect* thisEffect = _path->getPathEffectOfType(Inkscape::LivePathEffect::POWERSTROKE); + if(thisEffect){ + LivePathEffect::LPEPowerStroke *lpe_pwr = dynamic_cast<LivePathEffect::LPEPowerStroke*>(thisEffect->getLPEObj()->get_lpe()); + if (lpe_pwr) { + lpe_pwr->adjustForNewPath(pathv); } - thisEffect = path->getPathEffectOfType(Inkscape::LivePathEffect::FILLET_CHAMFER); - if(thisEffect){ - LivePathEffect::LPEFilletChamfer *lpe_fll = dynamic_cast<LivePathEffect::LPEFilletChamfer*>(thisEffect->getLPEObj()->get_lpe()); - if (lpe_fll) { - lpe_fll->adjustForNewPath(pathv); - } + } + thisEffect = _path->getPathEffectOfType(Inkscape::LivePathEffect::FILLET_CHAMFER); + if(thisEffect){ + LivePathEffect::LPEFilletChamfer *lpe_fll = dynamic_cast<LivePathEffect::LPEFilletChamfer*>(thisEffect->getLPEObj()->get_lpe()); + if (lpe_fll) { + lpe_fll->adjustForNewPath(pathv); } } } |
