From b21958f914e82435e935bb732b64cdf3f685c3f1 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 28 Mar 2015 14:57:06 +0100 Subject: adding rotation transform (bzr r13708.1.20) --- src/live_effects/lpe-copy_rotate.cpp | 18 ++++++++++++++++++ src/live_effects/lpe-copy_rotate.h | 2 ++ 2 files changed, 20 insertions(+) (limited to 'src') diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp index 63d6b8bfa..5474bfb70 100644 --- a/src/live_effects/lpe-copy_rotate.cpp +++ b/src/live_effects/lpe-copy_rotate.cpp @@ -89,6 +89,24 @@ LPECopyRotate::doOnApply(SPLPEItem const* lpeitem) dir = unit_vector(B - A); } +void +LPECopyRotate::transform_multiply(Geom::Affine const& postmul, bool set) +{ + if(postmul->isRotation()){ + Geom::Point rot = (Geom::Rotate)postmul::vector(); + coord angle = rad_to_deg(atan2(rot)); + starting_angle.param_setValue(starting_angle + angle); + starting_angle.param_update_default(starting_angle + angle); + rotation_angle.param_setValue(rotation_angle + angle); + rotation_angle.param_update_default(rotation_angle + angle); + } + // cycle through all parameters. Most parameters will not need transformation, but path and point params do. + + for (std::vector::iterator it = param_vector.begin(); it != param_vector.end(); ++it) { + Parameter * param = *it; + param->param_transform_multiply(postmul, set); + } +} void LPECopyRotate::doBeforeEffect (SPLPEItem const* lpeitem) diff --git a/src/live_effects/lpe-copy_rotate.h b/src/live_effects/lpe-copy_rotate.h index bdbc61d07..d0a5b004b 100644 --- a/src/live_effects/lpe-copy_rotate.h +++ b/src/live_effects/lpe-copy_rotate.h @@ -48,6 +48,8 @@ public: virtual void resetDefaults(SPItem const* item); + virtual void transform_multiply(Geom::Affine const& postmul, bool set); + /* the knotholder entity classes must be declared friends */ friend class CR::KnotHolderEntityStartingAngle; friend class CR::KnotHolderEntityRotationAngle; -- cgit v1.2.3