Code

From trunk
[inkscape.git] / src / live_effects / lpe-vonkoch.h
1 #ifndef INKSCAPE_LPE_VONKOCH_H
2 #define INKSCAPE_LPE_VONKOCH_H
4 /*
5  * Inkscape::LPEVonKoch
6  *
7  * Copyright (C) JF Barraud 2007 <jf.barraud@gmail.com>
8  *
9  * Released under GNU GPL, read the file 'COPYING' for more information
10  */
12 #include "live_effects/effect.h"
13 #include "live_effects/lpegroupbbox.h"
14 #include "live_effects/parameter/path.h"
15 #include "live_effects/parameter/point.h"
16 #include "live_effects/parameter/bool.h"
18 namespace Inkscape {
19 namespace LivePathEffect {
21 class VonKochPathParam : public PathParam{
22 public:
23     VonKochPathParam ( const Glib::ustring& label,
24                        const Glib::ustring& tip,
25                        const Glib::ustring& key,
26                        Inkscape::UI::Widget::Registry* wr,
27                        Effect* effect,
28                        const gchar * default_value = "M0,0 L1,1"):PathParam(label,tip,key,wr,effect,default_value){}
29     virtual ~VonKochPathParam(){}
30     virtual void param_setup_nodepath(Inkscape::NodePath::Path *np);  
31   };
33   //FIXME: a path is used here instead of 2 points to work around path/point param incompatibility bug.
34 class VonKochRefPathParam : public PathParam{
35 public:
36     VonKochRefPathParam ( const Glib::ustring& label,
37                        const Glib::ustring& tip,
38                        const Glib::ustring& key,
39                        Inkscape::UI::Widget::Registry* wr,
40                        Effect* effect,
41                        const gchar * default_value = "M0,0 L1,1"):PathParam(label,tip,key,wr,effect,default_value){}
42     virtual ~VonKochRefPathParam(){}
43     virtual void param_setup_nodepath(Inkscape::NodePath::Path *np);  
44     virtual bool param_readSVGValue(const gchar * strvalue);  
45   };
46  
47 class LPEVonKoch : public Effect, GroupBBoxEffect {
48 public:
49     LPEVonKoch(LivePathEffectObject *lpeobject);
50     virtual ~LPEVonKoch();
52     virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
54     virtual void resetDefaults(SPItem * item);
56     virtual void doBeforeEffect(SPLPEItem * item);
58     //Usefull??
59     //    protected: 
60     //virtual void addCanvasIndicators(SPLPEItem *lpeitem, std::vector<Geom::PathVector> &hp_vec); 
62 private:
63     ScalarParam  nbgenerations;
64     VonKochPathParam    generator;
65     BoolParam    similar_only;
66     BoolParam    drawall;
67     //BoolParam    draw_boxes;
68     //FIXME: a path is used here instead of 2 points to work around path/point param incompatibility bug.
69     VonKochRefPathParam    ref_path;
70     //    PointParam   refA;
71     //    PointParam   refB;
72     ScalarParam  maxComplexity;
74     LPEVonKoch(const LPEVonKoch&);
75     LPEVonKoch& operator=(const LPEVonKoch&);
76 };
78 }; //namespace LivePathEffect
79 }; //namespace Inkscape
81 #endif