From fc78b2d846fce97523409a9c796c711a6985499d Mon Sep 17 00:00:00 2001 From: johanengelen Date: Sat, 26 Jan 2008 16:03:25 +0000 Subject: [PATCH] LPE bend path was badly broken. fixed now. removed the dropdown box since it should not be there (left-over from pattern along path) --- src/live_effects/lpe-pathalongpath.cpp | 76 +------------------------- src/live_effects/lpe-pathalongpath.h | 11 ---- 2 files changed, 3 insertions(+), 84 deletions(-) diff --git a/src/live_effects/lpe-pathalongpath.cpp b/src/live_effects/lpe-pathalongpath.cpp index d41a0d6f6..ba09402b7 100644 --- a/src/live_effects/lpe-pathalongpath.cpp +++ b/src/live_effects/lpe-pathalongpath.cpp @@ -52,32 +52,14 @@ first) but I think we can first forget about them. namespace Inkscape { namespace LivePathEffect { -static const Util::EnumData PAPCopyTypeData[PAPCT_END] = { - {PAPCT_SINGLE, N_("Single"), "single"}, - {PAPCT_SINGLE_STRETCHED, N_("Single, stretched"), "single_stretched"}, - {PAPCT_REPEATED, N_("Repeated"), "repeated"}, - {PAPCT_REPEATED_STRETCHED, N_("Repeated, stretched"), "repeated_stretched"} -}; -static const Util::EnumDataConverter PAPCopyTypeConverter(PAPCopyTypeData, PAPCT_END); - LPEPathAlongPath::LPEPathAlongPath(LivePathEffectObject *lpeobject) : Effect(lpeobject), bend_path(_("Bend path"), _("Path along which to bend the original path"), "bendpath", &wr, this, "M0,0 L1,0"), -/* Delayed until 0.47 - width_path(_("Width path"), _("..."), "widthpath", &wr, this, "M0,0 L1,0"), - width_path_range(_("Width path range"), _("Range of widthpath parameter"), "widthpath_range", &wr, this, 1), -*/ - copytype(_("Path copies"), _("How many copies to place along the skeleton path"), "copytype", PAPCopyTypeConverter, &wr, this, PAPCT_SINGLE_STRETCHED), prop_scale(_("Width"), _("Width of the path"), "prop_scale", &wr, this, 1), scale_y_rel(_("Width in units of length"), _("Scale the width of the path in units of its length"), "scale_y_rel", &wr, this, false), vertical_pattern(_("Original path is vertical"), _("Rotates the original 90 degrees, before bending it along the bend path"), "vertical", &wr, this, false) { registerParameter( dynamic_cast(&bend_path) ); -/* Delayed until 0.47 - registerParameter( dynamic_cast(&width_path) ); - registerParameter( dynamic_cast(&width_path_range) ); -*/ - registerParameter( dynamic_cast(©type) ); registerParameter( dynamic_cast(&prop_scale) ); registerParameter( dynamic_cast(&scale_y_rel) ); registerParameter( dynamic_cast(&vertical_pattern) ); @@ -99,13 +81,8 @@ LPEPathAlongPath::doEffect_pwd2 (Geom::Piecewise > & pwd2 /* Much credit should go to jfb and mgsloan of lib2geom development for the code below! */ - PAPCopyType type = copytype.get_value(); - Piecewise > uskeleton = arc_length_parametrization(Piecewise >(bend_path),2,.1); uskeleton = remove_short_cuts(uskeleton,.01); - Rect uskeletonbounds = bounds_exact(uskeleton); - uskeleton -= uskeletonbounds.midpoint(); - Piecewise > n = rot90(derivative(uskeleton)); n = force_continuity(remove_short_cuts(n,.1)); @@ -117,56 +94,19 @@ LPEPathAlongPath::doEffect_pwd2 (Geom::Piecewise > & pwd2 Interval pattBndsY = bounds_exact(y); y -= pattBndsY.middle(); - int nbCopies = int(uskeleton.cuts.back()/pattBnds.extent()); - double scaling = 1; - - switch(type) { - case PAPCT_REPEATED: - break; - - case PAPCT_SINGLE: - nbCopies = (nbCopies > 0) ? 1 : 0; - break; - - case PAPCT_SINGLE_STRETCHED: - nbCopies = 1; - scaling = uskeleton.cuts.back()/pattBnds.extent(); - break; - - case PAPCT_REPEATED_STRETCHED: - scaling = uskeleton.cuts.back()/(((double)nbCopies)*pattBnds.extent()); - break; - - default: - return pwd2_in; - }; - - double pattWidth = pattBnds.extent() * scaling; + double scaling = uskeleton.cuts.back()/pattBnds.extent(); if (scaling != 1.0) { x*=scaling; } + if ( scale_y_rel.get_value() ) { y*=(scaling*prop_scale); } else { if (prop_scale != 1.0) y *= prop_scale; } -/* Delayed until 0.47 - Piecewise > widthpwd2 = arc_length_parametrization(Piecewise >(width_path),2,.1); - D2 > widthd2pw = make_cuts_independant(widthpwd2); - Piecewise width = (Piecewise(widthd2pw[Y]) - uskeletonbounds[Y].middle()) / width_path_range; -*/ - - double offs = 0; - Piecewise > output; - for (int i=0; i > output = compose(uskeleton,x) + y*compose(n,x); return output; } @@ -194,16 +134,6 @@ LPEPathAlongPath::resetDefaults(SPItem * item) path.start( start ); path.appendNew( end ); bend_path.param_set_and_write_new_value( path.toPwSb() ); - -/* Delayed until 0.47 - Point startw(bndsX.min(), bndsY.max()); - Point endw(bndsX.max(), bndsY.max()); - Geom::Path pathw; - pathw.start( startw ); - pathw.appendNew( endw ); - width_path.param_set_and_write_new_value( pathw.toPwSb() ); - width_path_range.param_set_value(startw[Y]-start[Y]); -*/ } void diff --git a/src/live_effects/lpe-pathalongpath.h b/src/live_effects/lpe-pathalongpath.h index 139955d6b..11d28530a 100644 --- a/src/live_effects/lpe-pathalongpath.h +++ b/src/live_effects/lpe-pathalongpath.h @@ -17,14 +17,6 @@ namespace Inkscape { namespace LivePathEffect { -enum PAPCopyType { - PAPCT_SINGLE = 0, - PAPCT_SINGLE_STRETCHED, - PAPCT_REPEATED, - PAPCT_REPEATED_STRETCHED, - PAPCT_END // This must be last -}; - class LPEPathAlongPath : public Effect { public: LPEPathAlongPath(LivePathEffectObject *lpeobject); @@ -38,9 +30,6 @@ public: private: PathParam bend_path; - //PathParam width_path; - //ScalarParam width_path_range; - EnumParam copytype; ScalarParam prop_scale; BoolParam scale_y_rel; BoolParam vertical_pattern; -- 2.30.2