summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cf37d48)
raw | patch | inline | side by side (parent: cf37d48)
author | cilix42 <cilix42@users.sourceforge.net> | |
Wed, 30 Jul 2008 12:06:20 +0000 (12:06 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Wed, 30 Jul 2008 12:06:20 +0000 (12:06 +0000) |
src/live_effects/Makefile_insert | patch | blob | history | |
src/live_effects/effect.cpp | patch | blob | history | |
src/live_effects/effect.h | patch | blob | history | |
src/live_effects/lpe-path_length.cpp | [new file with mode: 0644] | patch | blob |
src/live_effects/lpe-path_length.h | [new file with mode: 0644] | patch | blob |
index ea432e4c37a442714bfb4182e167c25c19830009..85f58d06dc3181fbdbd353cec8991f7a06374e32 100644 (file)
live_effects/lpe-ruler.cpp \
live_effects/lpe-ruler.h \
live_effects/lpe-text_label.cpp \
- live_effects/lpe-text_label.h
-
+ live_effects/lpe-text_label.h \
+ live_effects/lpe-path_length.cpp \
+ live_effects/lpe-path_length.h
index 701b46d36e63433a9ef4aefa79822c280623f14c..b0cebab8dacf7d05392f60d00025725002f5b97b 100644 (file)
#include "live_effects/lpe-boolops.h"
#include "live_effects/lpe-interpolate.h"
#include "live_effects/lpe-text_label.h"
+#include "live_effects/lpe-path_length.h"
// end of includes
namespace Inkscape {
{MIRROR_SYMMETRY, N_("Mirror symmetry"), "mirror_symmetry"},
{OFFSET, N_("Offset"), "offset"},
{PARALLEL, N_("Parallel"), "parallel"},
+ {PATH_LENGTH, N_("Path length"), "path_length"},
{PATTERN_ALONG_PATH, N_("Pattern Along Path"), "skeletal"}, // for historic reasons, this effect is called skeletal(strokes) in Inkscape:SVG
{PERP_BISECTOR, N_("Perpendicular bisector"), "perp_bisector"},
{PERSPECTIVE_PATH, N_("Perspective path"), "perspective_path"},
case TEXT_LABEL:
neweffect = static_cast<Effect*> ( new LPETextLabel(lpeobj) );
break;
+ case PATH_LENGTH:
+ neweffect = static_cast<Effect*> ( new LPEPathLength(lpeobj) );
+ break;
default:
g_warning("LivePathEffect::Effect::New called with invalid patheffect type (%d)", lpenr);
neweffect = NULL;
index 859c0ff7bccf474a47a71ff0d7d86515a76d4aa3..1235087513598cd49b586fdd8c414920c5328e68 100644 (file)
BOOLOPS,
INTERPOLATE,
TEXT_LABEL,
+ PATH_LENGTH,
INVALID_LPE // This must be last
};
diff --git a/src/live_effects/lpe-path_length.cpp b/src/live_effects/lpe-path_length.cpp
--- /dev/null
@@ -0,0 +1,72 @@
+#define INKSCAPE_LPE_PATH_LENGTH_CPP
+/** \file
+ * LPE <path_length> implementation.
+ */
+/*
+ * Authors:
+ * Maximilian Albert <maximilian.albert@gmail.com>
+ * Johan Engelen
+ *
+ * Copyright (C) 2007-2008 Authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "live_effects/lpe-path_length.h"
+
+#include "2geom/sbasis-geometric.h"
+
+namespace Inkscape {
+namespace LivePathEffect {
+
+LPEPathLength::LPEPathLength(LivePathEffectObject *lpeobject) :
+ Effect(lpeobject),
+ info_text(_("Info text"), _("Parameter for text creation"), "info_text", &wr, this, "")
+{
+ /* uncomment the next line if you want the original path to be
+ permanently displayed as a helperpath while the item is selected */
+ //show_orig_path = true;
+
+ registerParameter(dynamic_cast<Parameter *>(&info_text));
+}
+
+LPEPathLength::~LPEPathLength()
+{
+
+}
+
+Geom::Piecewise<Geom::D2<Geom::SBasis> >
+LPEPathLength::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in)
+{
+ using namespace Geom;
+
+ gchar *arc_length = g_strdup_printf("%.2f", Geom::length(pwd2_in));
+ info_text.param_setValue(arc_length);
+ g_free(arc_length);
+
+ info_text.setPosAndAnchor(pwd2_in, 0.5, 20);
+
+ Piecewise<D2<SBasis> > A = integral(pwd2_in);
+ Point c;
+ double area;
+ if (centroid(pwd2_in, c, area)) {
+ g_print ("Area is zero\n");
+ }
+ //g_print ("Area: %f\n", area);
+
+ return pwd2_in;
+}
+
+} //namespace LivePathEffect
+} /* namespace Inkscape */
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
diff --git a/src/live_effects/lpe-path_length.h b/src/live_effects/lpe-path_length.h
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef INKSCAPE_LPE_PATH_LENGTH_H
+#define INKSCAPE_LPE_PATH_LENGTH_H
+
+/** \file
+ * LPE <path_length> implementation.
+ */
+
+/*
+ * Authors:
+ * Maximilian Albert <maximilian.albert@gmail.com>
+ * Johan Engelen
+ *
+ * Copyright (C) 2007-2008 Authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "live_effects/effect.h"
+#include "live_effects/parameter/text.h"
+
+namespace Inkscape {
+namespace LivePathEffect {
+
+class LPEPathLength : public Effect {
+public:
+ LPEPathLength(LivePathEffectObject *lpeobject);
+ virtual ~LPEPathLength();
+
+ virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
+
+private:
+ LPEPathLength(const LPEPathLength&);
+ LPEPathLength& operator=(const LPEPathLength&);
+ TextParam info_text;
+};
+
+} //namespace LivePathEffect
+} //namespace Inkscape
+
+#endif
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :