index d5bd532479f7b4c4749063d65f559ccd1262d4d4..6b9fbbb97eaedb8712735680e297f884ffdb487c 100644 (file)
#include "sp-item.h"
#include "sp-path.h"
#include "sp-item-group.h"
-#include "display/curve.h"
-#include <libnr/n-art-bpath.h>
-#include <libnr/nr-matrix-fns.h>
-#include "live_effects/n-art-bpath-2geom.h"
+//#include <libnr/n-art-bpath.h>
+#include "libnr/n-art-bpath-2geom.h"
#include "svg/svg.h"
#include "ui/widget/scalar.h"
{
groupSpecialBehavior = true;
- using namespace Geom;
- Piecewise<D2<SBasis> > pwd2;
- std::vector<Geom::Path> temppath;
-
- recursive_original_bbox(SP_GROUP(lpeitem), pwd2, temppath);
-
- for (unsigned int i=0; i < temppath.size(); i++) {
- pwd2.concat( temppath[i].toPwSb() );
- }
-
- D2<Piecewise<SBasis> > d2pw = make_cuts_independant(pwd2);
- boundingbox_X = bounds_exact(d2pw[0]);
- boundingbox_Y = bounds_exact(d2pw[1]);
- }
-
+ original_bbox(lpeitem);
+ }
}
Geom::Piecewise<Geom::D2<Geom::SBasis> >
-LPEBendPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in)
+LPEBendPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in)
{
using namespace Geom;
@@ -119,14 +104,14 @@ LPEBendPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in)
Piecewise<SBasis> x = vertical_pattern.get_value() ? Piecewise<SBasis>(patternd2[1]) : Piecewise<SBasis>(patternd2[0]);
Piecewise<SBasis> y = vertical_pattern.get_value() ? Piecewise<SBasis>(patternd2[0]) : Piecewise<SBasis>(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<Geom::D2<Geom::SBasis> > & 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<D2<SBasis> > pwd2;
- std::vector<Geom::Path> 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<Piecewise<SBasis> > 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<Geom::LineSegment>( end );
bend_path.param_set_and_write_new_value( path.toPwSb() );
-
-
- }
}
void