Code

change doEffect functions to use const& parameters
authorjohanengelen <johanengelen@users.sourceforge.net>
Wed, 9 Apr 2008 21:12:17 +0000 (21:12 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Wed, 9 Apr 2008 21:12:17 +0000 (21:12 +0000)
24 files changed:
src/live_effects/effect.cpp
src/live_effects/effect.h
src/live_effects/lpe-bendpath.cpp
src/live_effects/lpe-bendpath.h
src/live_effects/lpe-circle_with_radius.cpp
src/live_effects/lpe-circle_with_radius.h
src/live_effects/lpe-curvestitch.cpp
src/live_effects/lpe-curvestitch.h
src/live_effects/lpe-gears.cpp
src/live_effects/lpe-gears.h
src/live_effects/lpe-knot.cpp
src/live_effects/lpe-knot.h
src/live_effects/lpe-patternalongpath.cpp
src/live_effects/lpe-patternalongpath.h
src/live_effects/lpe-perspective_path.cpp
src/live_effects/lpe-perspective_path.h
src/live_effects/lpe-skeleton.cpp
src/live_effects/lpe-skeleton.h
src/live_effects/lpe-sketch.cpp
src/live_effects/lpe-sketch.h
src/live_effects/lpe-test-doEffect-stack.cpp
src/live_effects/lpe-test-doEffect-stack.h
src/live_effects/lpe-vonkoch.cpp
src/live_effects/lpe-vonkoch.h

index 3c8ad8d507697e8936d747424132eb74229aaa26..fdeda8a62e15690a650db97fd6a5fd9d18307902 100644 (file)
@@ -196,7 +196,7 @@ Effect::doEffect_nartbpath (NArtBpath * path_in)
 }
 
 std::vector<Geom::Path>
-Effect::doEffect_path (std::vector<Geom::Path> & path_in)
+Effect::doEffect_path (std::vector<Geom::Path> const & path_in)
 {
     std::vector<Geom::Path> path_out;
 
@@ -225,7 +225,7 @@ Effect::doEffect_path (std::vector<Geom::Path> & path_in)
 }
 
 Geom::Piecewise<Geom::D2<Geom::SBasis> >
-Effect::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in)
+Effect::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in)
 {
     g_warning("Effect has no doEffect implementation");
     return pwd2_in;
index 1726613c5f942904650429746b219ecb28563e8f..7988ed22a6bf81810c5c789604278bcfd5ae999f 100644 (file)
@@ -112,9 +112,9 @@ protected:
     virtual NArtBpath *
             doEffect_nartbpath (NArtBpath * path_in);
     virtual std::vector<Geom::Path>
-            doEffect_path (std::vector<Geom::Path> & path_in);
+            doEffect_path (std::vector<Geom::Path> const & path_in);
     virtual Geom::Piecewise<Geom::D2<Geom::SBasis> >
-            doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in);
+            doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
 
     void registerParameter(Parameter * param);
     Parameter * getNextOncanvasEditableParam();
index d5bd532479f7b4c4749063d65f559ccd1262d4d4..b9f414df0d62cf21246fcd623cdfe9d11907f138 100644 (file)
@@ -104,7 +104,7 @@ LPEBendPath::doBeforeEffect (SPLPEItem *lpeitem)
 }
 
 Geom::Piecewise<Geom::D2<Geom::SBasis> >
-LPEBendPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in)
+LPEBendPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in)
 {
     using namespace Geom;
 
index 53e580c3a2ca0e30f79ad0d23ada7f961ce28019..47a26ac831a11f66c7161d31eaf6493195c95d0b 100644 (file)
@@ -35,7 +35,7 @@ public:
 
     virtual void doBeforeEffect (SPLPEItem *lpeitem);
 
-    virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in);
+    virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
 
     virtual void resetDefaults(SPItem * item);
 
index ec9d4f74d822a0d2c0199eb99fff7909c4fc6054..c5dfebfad80e84bafe2df4fb3e8e5be5c1766485 100644 (file)
@@ -65,7 +65,7 @@ void _circle(Geom::Point center, double radius, std::vector<Geom::Path> &path_ou
 }
 
 std::vector<Geom::Path>
-LPECircleWithRadius::doEffect_path (std::vector<Geom::Path> &path_in)
+LPECircleWithRadius::doEffect_path (std::vector<Geom::Path> const & path_in)
 {
     std::vector<Geom::Path> path_out = std::vector<Geom::Path>();
 
index e783e0aab499afb0494cb7f4b1b42ae2c8c0bd50..19330eb3346fe9d0c842610aa76e3e33524dd844 100644 (file)
@@ -28,7 +28,7 @@ public:
     virtual ~LPECircleWithRadius();
 
 //  Choose to implement one of the doEffect functions. You can delete or comment out the others.
-    virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> & path_in);
+    virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
 
 private:
     // add the parameters for your effect here:
index dc9cfe63587d906b2c9c192fb84d7ad7a6d19af1..18647cf48f4aaf70b27afa86df1e1483cf893401 100644 (file)
@@ -72,7 +72,7 @@ LPECurveStitch::~LPECurveStitch()
 }
 
 std::vector<Geom::Path>
-LPECurveStitch::doEffect_path (std::vector<Geom::Path> & path_in)
+LPECurveStitch::doEffect_path (std::vector<Geom::Path> const & path_in)
 {
     if (path_in.size() >= 2) {
         startpoint_edge_variation.resetRandomizer();
index a0050760ceb750c3a3677b8b163d0deb5016e82b..8a8e43f2c74a5f624485205c575c1d2436981ab7 100644 (file)
@@ -28,7 +28,7 @@ public:
     LPECurveStitch(LivePathEffectObject *lpeobject);
     virtual ~LPECurveStitch();
 
-    virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> & path_in);
+    virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
 
     virtual void resetDefaults(SPItem * item);
 
index 699f2c83bb96c7b5dd43b4bb7d1a23482c67f410..7dcd32fcce710b6d6703e1c8eb511fa7fbb97f5e 100644 (file)
@@ -231,7 +231,7 @@ LPEGears::~LPEGears()
 }
 
 std::vector<Geom::Path>
-LPEGears::doEffect_path (std::vector<Geom::Path> & path_in)
+LPEGears::doEffect_path (std::vector<Geom::Path> const & path_in)
 {
     std::vector<Geom::Path> path_out;
     Geom::Path gearpath = path_in[0];
index d046c3640df9d7ab2d9b0cb99e58a02f51c4ce91..4c3a9938bd4385f52111a9f36f17838801f3d24d 100644 (file)
@@ -22,7 +22,7 @@ public:
     LPEGears(LivePathEffectObject *lpeobject);
     virtual ~LPEGears();
 
-    virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> & path_in);
+    virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
 
     virtual void setup_nodepath(Inkscape::NodePath::Path *np);
 
index bd9c0ca68b1c12a038bd78c6391ec1fc4164cdce..245b6df0f8577e9c2f76f43d259513c2c6a83225 100644 (file)
@@ -101,13 +101,13 @@ findShadowedTime(Geom::Path &patha,
 
 //Just a try; this should be moved to 2geom if ever it works.
 std::vector<Geom::Path>
-split_loopy_bezier (std::vector<Geom::Path> & path_in){
+split_loopy_bezier (std::vector<Geom::Path> const & path_in){
 
     std::vector<Geom::Path> ret; 
-    std::vector<Geom::Path>::iterator pi=path_in.begin();
+    std::vector<Geom::Path>::const_iterator pi=path_in.begin();
     for(; pi != path_in.end(); pi++) {
         ret.push_back(Geom::Path());
-        for (Geom::Path::iterator curve(pi->begin()),end(pi->end()); curve != end; ++curve){
+        for (Geom::Path::const_iterator curve(pi->begin()),end(pi->end()); curve != end; ++curve){
 
             //is the current curve a cubic bezier?
             if(Geom::CubicBezier const *cubic_bezier = dynamic_cast<Geom::CubicBezier const *>(&(*curve))){
@@ -149,13 +149,13 @@ split_loopy_bezier (std::vector<Geom::Path> & path_in){
 
 
 std::vector<Geom::Path>
-LPEKnot::doEffect_path (std::vector<Geom::Path> & path_in)
+LPEKnot::doEffect_path (std::vector<Geom::Path> const & input_path)
 {
     using namespace Geom;
     std::vector<Geom::Path> path_out;
     double width = interruption_width;
-    
-    path_in = split_loopy_bezier(path_in);
+
+    std::vector<Geom::Path> path_in = split_loopy_bezier(input_path);
 
     CrossingSet crossingTable = crossings_among(path_in);
     for (unsigned i = 0; i < crossingTable.size(); i++){
index a030f756763304e2ea15ef50d7673dee36b3f02c..521c2d7c96e7e4dcedd676c8bb33dda43044a774 100644 (file)
@@ -28,7 +28,7 @@ public:
 //  Choose to implement one of the doEffect functions. You can delete or comment out the others.
 //    virtual void doEffect (SPCurve * curve);
 //    virtual NArtBpath * doEffect_nartbpath (NArtBpath * path_in);
-    virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> & path_in);
+    virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & input_path);
 //    virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in);
 
 private:
index 9b28192192a4edf4bd9ecc08f3acd163e7c34989..7d11a5172e7b53099dc9d155166ee7f692a4c5c5 100644 (file)
@@ -92,7 +92,7 @@ LPEPatternAlongPath::~LPEPatternAlongPath()
 //TODO: does this already exist in 2Geom? if not, move this there...
 static
 std::vector<Geom::Piecewise<Geom::D2<Geom::SBasis> > > 
-split_at_discontinuities (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwsbin, double tol = .0001)
+split_at_discontinuities (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwsbin, double tol = .0001)
 {
     using namespace Geom;
     std::vector<Piecewise<D2<SBasis> > > ret;
@@ -114,7 +114,7 @@ split_at_discontinuities (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwsbin, dou
 
 
 Geom::Piecewise<Geom::D2<Geom::SBasis> >
-LPEPatternAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in)
+LPEPatternAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in)
 {
     using namespace Geom;
 
index 2909ab078e66140d694f4bb98870b9d1f77d3ad5..8a3e78aa5a975d5c86f5c31e7498dd599eb9574a 100644 (file)
@@ -30,7 +30,7 @@ public:
     LPEPatternAlongPath(LivePathEffectObject *lpeobject);
     virtual ~LPEPatternAlongPath();
 
-    virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in);
+    virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
 
     virtual void transform_multiply(Geom::Matrix const& postmul, bool set);
 
index 923a4baa48a584c0d37b5e1c50efe4d047850841..1418f1892c71ae30b99e6fbd455293edc38a017b 100644 (file)
@@ -66,7 +66,7 @@ LPEPerspectivePath::~LPEPerspectivePath()
 }
 
 Geom::Piecewise<Geom::D2<Geom::SBasis> >
-LPEPerspectivePath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in)
+LPEPerspectivePath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in)
 {
     using namespace Geom;
 
index f02df30f0782de336b6a1e4895fc0508165e185a..dc4a9969ec08b2119220cab92a837dab65e830a6 100644 (file)
@@ -29,7 +29,7 @@ public:
     LPEPerspectivePath(LivePathEffectObject *lpeobject);
     virtual ~LPEPerspectivePath();
 
-    virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in);
+    virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
 
 private:
     // add the parameters for your effect here:
index a2c4cf1fbbf362fd45689bcbbbf57d97b60acc47..571503d8e0df77172950aac550ee69af9a67500b 100644 (file)
@@ -83,7 +83,7 @@ LPESkeleton::doEffect_path (std::vector<Geom::Path> & path_in)
 */
 
 Geom::Piecewise<Geom::D2<Geom::SBasis> >
-LPESkeleton::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in)
+LPESkeleton::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in)
 {
     Geom::Piecewise<Geom::D2<Geom::SBasis> > output;
 
index 9ebb55e7d855fd5e7fd2d406d1c12f2c0895e56e..290b8a724a7854a22d9eddeefaed27ac3e1fd24c 100644 (file)
@@ -30,7 +30,7 @@ public:
 //    virtual void doEffect (SPCurve * curve);
 //    virtual NArtBpath * doEffect_nartbpath (NArtBpath * path_in);
 //    virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> & path_in);
-    virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in);
+    virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
 
 private:
     // add the parameters for your effect here:
index 79f4d67f93f99a1fa85bec20a7bd2a501a7cee2a..e4e7cddcc7a036a9aa39845fadd1b26c2c99c336 100644 (file)
@@ -136,7 +136,7 @@ addLinearEnds (Geom::Piecewise<Geom::D2<Geom::SBasis> > & m){
 
 //TODO: does this already exist in 2Geom? if not, move this there...
 std::vector<Geom::Piecewise<Geom::D2<Geom::SBasis> > > 
-split_at_discontinuities (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwsbin, double tol = .0001)
+split_at_discontinuities (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwsbin, double tol = .0001)
 {
     using namespace Geom;
     std::vector<Piecewise<D2<SBasis> > > ret;
@@ -193,7 +193,7 @@ LPESketch::computePerturbation (double s0, double s1){
 
 // Main effect body...
 Geom::Piecewise<Geom::D2<Geom::SBasis> >
-LPESketch::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in)
+LPESketch::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in)
 {
     using namespace Geom;
     //If the input path is empty, do nothing.
index 95d9ea94f0fa1ac7955cadf1d14106671c8710f7..051240665f7fef731bacfa0d3759d618b28c060e 100644 (file)
@@ -31,7 +31,7 @@ public:
 //    virtual void doEffect (SPCurve * curve);
 //    virtual NArtBpath * doEffect_nartbpath (NArtBpath * path_in);
 //    virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> & path_in);
-    virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in);
+    virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
 
 private:
     // add the parameters for your effect here:
index 93e1add0a0f498558e323073a1b15a2283487c01..cafe693b74210dc0882c9f81733c0c7f31196aee 100644 (file)
@@ -65,7 +65,7 @@ LPEdoEffectStackTest::doEffect_nartbpath (NArtBpath * path_in)
 }
 
 std::vector<Geom::Path>
-LPEdoEffectStackTest::doEffect_path (std::vector<Geom::Path> & path_in)
+LPEdoEffectStackTest::doEffect_path (std::vector<Geom::Path> const & path_in)
 {
     if (step >= 3) {
         return Effect::doEffect_path(path_in);
@@ -77,7 +77,7 @@ LPEdoEffectStackTest::doEffect_path (std::vector<Geom::Path> & path_in)
 }
 
 Geom::Piecewise<Geom::D2<Geom::SBasis> > 
-LPEdoEffectStackTest::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in)
+LPEdoEffectStackTest::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in)
 {
     Geom::Piecewise<Geom::D2<Geom::SBasis> > output = pwd2_in;
 
index 1417512d1e13fae6f2571005def85dc6e766f858..a4886539903bf6a2e95ab637057817be8453f2b7 100644 (file)
@@ -27,8 +27,8 @@ public:
 
     virtual void                                     doEffect (SPCurve * curve);
     virtual NArtBpath *                              doEffect_nartbpath (NArtBpath * path_in);
-    virtual std::vector<Geom::Path>                  doEffect_path (std::vector<Geom::Path> & path_in);
-    virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in);
+    virtual std::vector<Geom::Path>                  doEffect_path (std::vector<Geom::Path> const & path_in);
+    virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
 
 private:
     ScalarParam step;
index 760295ed7867b724409346d8cb70db2520380a2f..a4b3062d92dabf5a715c4dff545b1a5055103b16 100644 (file)
@@ -76,7 +76,7 @@ LPEVonKoch::~LPEVonKoch()
 }
 
 std::vector<Geom::Path>
-LPEVonKoch::doEffect_path (std::vector<Geom::Path> & path_in)
+LPEVonKoch::doEffect_path (std::vector<Geom::Path> const & path_in)
 {
     using namespace Geom;
     std::vector<Geom::Path> generating_path = path_from_piecewise(generator.get_pwd2(),.01);//TODO what should that tolerance be?
index 46f118536d1e2d5869653a42566468c85cab4257..45e97295c2429635cf8517f6406a4bb1aa8a5558 100644 (file)
@@ -52,7 +52,7 @@ public:
     LPEVonKoch(LivePathEffectObject *lpeobject);
     virtual ~LPEVonKoch();
 
-    virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> & path_in);
+    virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
 
     virtual void resetDefaults(SPItem * item);