summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTanja Bast <tanja.s.bast@gmail.com>2018-10-19 18:42:30 +0000
committerPatrick Storz <eduard.braun2@gmx.de>2018-10-24 20:55:51 +0000
commit31e80ece9acadf2afd475fea358208cd10bcc466 (patch)
treeac4742820e94115fd824eb60447f5980ca03a040
parentShapeEditor: Always keep KnotHolders in set_item() (diff)
downloadinkscape-31e80ece9acadf2afd475fea358208cd10bcc466.tar.gz
inkscape-31e80ece9acadf2afd475fea358208cd10bcc466.zip
Apply clang format
-rw-r--r--src/live_effects/lpe-interpolate.cpp50
-rw-r--r--src/live_effects/lpe-interpolate.h25
2 files changed, 39 insertions, 36 deletions
diff --git a/src/live_effects/lpe-interpolate.cpp b/src/live_effects/lpe-interpolate.cpp
index dabad013f..e8dc338f3 100644
--- a/src/live_effects/lpe-interpolate.cpp
+++ b/src/live_effects/lpe-interpolate.cpp
@@ -24,11 +24,15 @@
namespace Inkscape {
namespace LivePathEffect {
-LPEInterpolate::LPEInterpolate(LivePathEffectObject *lpeobject) :
- Effect(lpeobject),
- trajectory_path(_("Trajectory:"), _("Path along which intermediate steps are created."), "trajectory", &wr, this, "M0,0 L0,0"),
- number_of_steps(_("Steps_:"), _("Determines the number of steps from start to end path."), "steps", &wr, this, 5),
- equidistant_spacing(_("E_quidistant spacing"), _("If true, the spacing between intermediates is constant along the length of the path. If false, the distance depends on the location of the nodes of the trajectory path."), "equidistant_spacing", &wr, this, true)
+LPEInterpolate::LPEInterpolate(LivePathEffectObject *lpeobject)
+ : Effect(lpeobject)
+ , trajectory_path(_("Trajectory:"), _("Path along which intermediate steps are created."), "trajectory", &wr, this,
+ "M0,0 L0,0")
+ , number_of_steps(_("Steps_:"), _("Determines the number of steps from start to end path."), "steps", &wr, this, 5)
+ , equidistant_spacing(_("E_quidistant spacing"),
+ _("If true, the spacing between intermediates is constant along the length of the path. If "
+ "false, the distance depends on the location of the nodes of the trajectory path."),
+ "equidistant_spacing", &wr, this, true)
{
show_orig_path = true;
@@ -40,20 +44,18 @@ LPEInterpolate::LPEInterpolate(LivePathEffectObject *lpeobject) :
number_of_steps.param_set_range(2, Geom::infinity());
}
-LPEInterpolate::~LPEInterpolate()
-= default;
+LPEInterpolate::~LPEInterpolate() = default;
/*
* interpolate path_in[0] to path_in[1]
*/
-Geom::PathVector
-LPEInterpolate::doEffect_path (Geom::PathVector const & path_in)
+Geom::PathVector LPEInterpolate::doEffect_path(Geom::PathVector const &path_in)
{
- if ( (path_in.size() < 2) || (number_of_steps < 2)) {
+ if ((path_in.size() < 2) || (number_of_steps < 2)) {
return path_in;
}
// Don't allow empty path parameter:
- if ( trajectory_path.get_pathvector().empty() ) {
+ if (trajectory_path.get_pathvector().empty()) {
return path_in;
}
@@ -82,20 +84,19 @@ LPEInterpolate::doEffect_path (Geom::PathVector const & path_in)
Geom::Interval trajectory_domain = trajectory.domain();
for (int i = 0; i < number_of_steps; ++i) {
- double fraction = i / (number_of_steps-1);
+ double fraction = i / (number_of_steps - 1);
- Geom::Piecewise<Geom::D2<Geom::SBasis> > pResult = pA*(1-fraction) + pB*fraction;
- pResult += trajectory.valueAt(trajectory_domain.min() + fraction*trajectory_domain.extent());
+ Geom::Piecewise<Geom::D2<Geom::SBasis> > pResult = pA * (1 - fraction) + pB * fraction;
+ pResult += trajectory.valueAt(trajectory_domain.min() + fraction * trajectory_domain.extent());
Geom::PathVector pathv = Geom::path_from_piecewise(pResult, LPE_CONVERSION_TOLERANCE);
- path_out.push_back( pathv[0] );
+ path_out.push_back(pathv[0]);
}
return path_out;
}
-void
-LPEInterpolate::resetDefaults(SPItem const* item)
+void LPEInterpolate::resetDefaults(SPItem const *item)
{
Effect::resetDefaults(item);
@@ -104,7 +105,7 @@ LPEInterpolate::resetDefaults(SPItem const* item)
SPCurve const *crv = SP_PATH(item)->getCurveForEdit(true);
Geom::PathVector const &pathv = crv->get_pathvector();
- if ( (pathv.size() < 2) )
+ if ((pathv.size() < 2))
return;
Geom::OptRect bounds_A = pathv[0].boundsExact();
@@ -112,16 +113,17 @@ LPEInterpolate::resetDefaults(SPItem const* item)
if (bounds_A && bounds_B) {
Geom::PathVector traj_pathv;
- traj_pathv.push_back( Geom::Path() );
- traj_pathv[0].start( bounds_A->midpoint() );
- traj_pathv[0].appendNew<Geom::LineSegment>( bounds_B->midpoint() );
- trajectory_path.set_new_value( traj_pathv, true );
- } else {
+ traj_pathv.push_back(Geom::Path());
+ traj_pathv[0].start(bounds_A->midpoint());
+ traj_pathv[0].appendNew<Geom::LineSegment>(bounds_B->midpoint());
+ trajectory_path.set_new_value(traj_pathv, true);
+ }
+ else {
trajectory_path.param_set_and_write_default();
}
}
-} //namespace LivePathEffect
+} // namespace LivePathEffect
} /* namespace Inkscape */
/*
diff --git a/src/live_effects/lpe-interpolate.h b/src/live_effects/lpe-interpolate.h
index 4da384fff..84551786e 100644
--- a/src/live_effects/lpe-interpolate.h
+++ b/src/live_effects/lpe-interpolate.h
@@ -15,34 +15,35 @@
*/
#include "live_effects/effect.h"
+#include "live_effects/parameter/bool.h"
#include "live_effects/parameter/parameter.h"
#include "live_effects/parameter/path.h"
-#include "live_effects/parameter/bool.h"
namespace Inkscape {
namespace LivePathEffect {
class LPEInterpolate : public Effect {
-public:
+ public:
LPEInterpolate(LivePathEffectObject *lpeobject);
~LPEInterpolate() override;
- Geom::PathVector doEffect_path (Geom::PathVector const & path_in) override;
+ Geom::PathVector doEffect_path(Geom::PathVector const &path_in) override;
+
+ void resetDefaults(SPItem const *item) override;
- void resetDefaults(SPItem const* item) override;
-private:
- PathParam trajectory_path;
+ private:
+ PathParam trajectory_path;
ScalarParam number_of_steps;
- BoolParam equidistant_spacing;
+ BoolParam equidistant_spacing;
- LPEInterpolate(const LPEInterpolate&) = delete;
- LPEInterpolate& operator=(const LPEInterpolate&) = delete;
+ LPEInterpolate(const LPEInterpolate &) = delete;
+ LPEInterpolate &operator=(const LPEInterpolate &) = delete;
};
-} //namespace LivePathEffect
-} //namespace Inkscape
+} // namespace LivePathEffect
+} // namespace Inkscape
-#endif // INKSCAPE_LPE_INTERPOLATE_H
+#endif // INKSCAPE_LPE_INTERPOLATE_H
/*
Local Variables: