X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Flive_effects%2Flpe-bendpath.cpp;h=6b9fbbb97eaedb8712735680e297f884ffdb487c;hb=71146abe8aba032d73788a625fee5769a581bd3c;hp=d5bd532479f7b4c4749063d65f559ccd1262d4d4;hpb=46c4893a7458eda6edcd064121bc000634af7a09;p=inkscape.git diff --git a/src/live_effects/lpe-bendpath.cpp b/src/live_effects/lpe-bendpath.cpp index d5bd53247..6b9fbbb97 100644 --- a/src/live_effects/lpe-bendpath.cpp +++ b/src/live_effects/lpe-bendpath.cpp @@ -12,10 +12,8 @@ #include "sp-item.h" #include "sp-path.h" #include "sp-item-group.h" -#include "display/curve.h" -#include -#include -#include "live_effects/n-art-bpath-2geom.h" +//#include +#include "libnr/n-art-bpath-2geom.h" #include "svg/svg.h" #include "ui/widget/scalar.h" @@ -86,25 +84,12 @@ LPEBendPath::doBeforeEffect (SPLPEItem *lpeitem) { groupSpecialBehavior = true; - using namespace Geom; - Piecewise > pwd2; - std::vector temppath; - - recursive_original_bbox(SP_GROUP(lpeitem), pwd2, temppath); - - for (unsigned int i=0; i < temppath.size(); i++) { - pwd2.concat( temppath[i].toPwSb() ); - } - - D2 > d2pw = make_cuts_independant(pwd2); - boundingbox_X = bounds_exact(d2pw[0]); - boundingbox_Y = bounds_exact(d2pw[1]); - } - + original_bbox(lpeitem); + } } Geom::Piecewise > -LPEBendPath::doEffect_pwd2 (Geom::Piecewise > & pwd2_in) +LPEBendPath::doEffect_pwd2 (Geom::Piecewise > const & pwd2_in) { using namespace Geom; @@ -119,14 +104,14 @@ LPEBendPath::doEffect_pwd2 (Geom::Piecewise > & pwd2_in) Piecewise x = vertical_pattern.get_value() ? Piecewise(patternd2[1]) : Piecewise(patternd2[0]); Piecewise y = vertical_pattern.get_value() ? Piecewise(patternd2[0]) : Piecewise(patternd2[1]); -//We use the group bounding box size or the path bbox size to translate well x and y +//We use the group bounding box size or the path bbox size to translate well x and y if(groupSpecialBehavior == false) { boundingbox_X = bounds_exact(x); boundingbox_Y = bounds_exact(y); } - x-= boundingbox_X.min(); - y-= boundingbox_Y.middle(); + x-= vertical_pattern.get_value() ? boundingbox_Y.min() : boundingbox_X.min(); + y-= vertical_pattern.get_value() ? boundingbox_X.middle() : boundingbox_Y.middle(); double scaling = uskeleton.cuts.back()/boundingbox_X.extent(); @@ -148,45 +133,19 @@ LPEBendPath::doEffect_pwd2 (Geom::Piecewise > & pwd2_in) void LPEBendPath::resetDefaults(SPItem * item) { - if (SP_IS_PATH(item) || SP_IS_GROUP(item)) - { - // set the bend path to run horizontally in the middle of the bounding box of the original path - using namespace Geom; - Piecewise > pwd2; - std::vector temppath; - - if (SP_IS_PATH(item)) - { - //TODO : this won't work well with LPE stacking - temppath = SVGD_to_2GeomPath( SP_OBJECT_REPR(item)->attribute("inkscape:original-d")); - } - else if (SP_IS_GROUP(item)) - { - recursive_original_bbox(SP_GROUP(item), pwd2, temppath); - } + original_bbox(SP_LPE_ITEM(item)); - for (unsigned int i=0; i < temppath.size(); i++) { - pwd2.concat( temppath[i].toPwSb() ); - } - - D2 > d2pw = make_cuts_independant(pwd2); - boundingbox_X = bounds_exact(d2pw[0]); - boundingbox_Y = bounds_exact(d2pw[1]); - - - Point start(boundingbox_X.min(), (boundingbox_Y.max()+boundingbox_Y.min())/2); - Point end(boundingbox_X.max(), (boundingbox_Y.max()+boundingbox_Y.min())/2); + Geom::Point start(boundingbox_X.min(), (boundingbox_Y.max()+boundingbox_Y.min())/2); + Geom::Point end(boundingbox_X.max(), (boundingbox_Y.max()+boundingbox_Y.min())/2); if ( Geom::are_near(start,end) ) { - end += Point(1.,0.); - } + end += Geom::Point(1.,0.); + } + Geom::Path path; path.start( start ); path.appendNew( end ); bend_path.param_set_and_write_new_value( path.toPwSb() ); - - - } } void