summaryrefslogtreecommitdiffstats
path: root/src/live_effects
diff options
context:
space:
mode:
Diffstat (limited to 'src/live_effects')
-rw-r--r--src/live_effects/CMakeLists.txt2
-rw-r--r--src/live_effects/Makefile_insert2
-rw-r--r--src/live_effects/effect.cpp97
-rw-r--r--src/live_effects/effect.h9
-rw-r--r--src/live_effects/lpe-angle_bisector.cpp10
-rw-r--r--src/live_effects/lpe-angle_bisector.h2
-rw-r--r--src/live_effects/lpe-attach-path.cpp16
-rw-r--r--src/live_effects/lpe-boolops.cpp79
-rw-r--r--src/live_effects/lpe-boolops.h53
-rw-r--r--src/live_effects/lpe-bounding-box.cpp2
-rw-r--r--src/live_effects/lpe-bspline.cpp335
-rw-r--r--src/live_effects/lpe-bspline.h7
-rw-r--r--src/live_effects/lpe-circle_3pts.cpp11
-rw-r--r--src/live_effects/lpe-circle_3pts.h2
-rw-r--r--src/live_effects/lpe-circle_with_radius.cpp16
-rw-r--r--src/live_effects/lpe-circle_with_radius.h2
-rw-r--r--src/live_effects/lpe-clone-original.cpp2
-rw-r--r--src/live_effects/lpe-constructgrid.cpp6
-rw-r--r--src/live_effects/lpe-constructgrid.h2
-rw-r--r--src/live_effects/lpe-curvestitch.cpp10
-rw-r--r--src/live_effects/lpe-curvestitch.h2
-rw-r--r--src/live_effects/lpe-ellipse_5pts.cpp8
-rw-r--r--src/live_effects/lpe-ellipse_5pts.h2
-rw-r--r--src/live_effects/lpe-fill-between-many.cpp4
-rw-r--r--src/live_effects/lpe-fill-between-strokes.cpp26
-rw-r--r--src/live_effects/lpe-fillet-chamfer.cpp39
-rw-r--r--src/live_effects/lpe-fillet-chamfer.h17
-rw-r--r--src/live_effects/lpe-gears.cpp8
-rw-r--r--src/live_effects/lpe-gears.h2
-rw-r--r--src/live_effects/lpe-interpolate.cpp2
-rw-r--r--src/live_effects/lpe-interpolate.h2
-rw-r--r--src/live_effects/lpe-interpolate_points.h2
-rw-r--r--src/live_effects/lpe-jointype.cpp5
-rw-r--r--src/live_effects/lpe-jointype.h2
-rw-r--r--src/live_effects/lpe-knot.cpp26
-rw-r--r--src/live_effects/lpe-knot.h10
-rw-r--r--src/live_effects/lpe-lattice2.cpp566
-rw-r--r--src/live_effects/lpe-lattice2.h69
-rw-r--r--src/live_effects/lpe-line_segment.cpp16
-rw-r--r--src/live_effects/lpe-line_segment.h2
-rw-r--r--src/live_effects/lpe-mirror_symmetry.cpp10
-rw-r--r--src/live_effects/lpe-mirror_symmetry.h2
-rw-r--r--src/live_effects/lpe-offset.cpp6
-rw-r--r--src/live_effects/lpe-parallel.cpp2
-rw-r--r--src/live_effects/lpe-perp_bisector.cpp4
-rw-r--r--src/live_effects/lpe-perspective-envelope.cpp337
-rw-r--r--src/live_effects/lpe-perspective-envelope.h24
-rw-r--r--src/live_effects/lpe-powerstroke.cpp122
-rw-r--r--src/live_effects/lpe-powerstroke.h4
-rw-r--r--src/live_effects/lpe-rough-hatches.cpp3
-rw-r--r--src/live_effects/lpe-roughen.cpp218
-rw-r--r--src/live_effects/lpe-roughen.h16
-rw-r--r--src/live_effects/lpe-ruler.cpp2
-rw-r--r--src/live_effects/lpe-show_handles.cpp93
-rw-r--r--src/live_effects/lpe-show_handles.h16
-rw-r--r--src/live_effects/lpe-simplify.cpp15
-rw-r--r--src/live_effects/lpe-skeleton.cpp6
-rw-r--r--src/live_effects/lpe-skeleton.h4
-rw-r--r--src/live_effects/lpe-sketch.cpp2
-rw-r--r--src/live_effects/lpe-spiro.cpp3
-rw-r--r--src/live_effects/lpe-tangent_to_curve.cpp8
-rw-r--r--src/live_effects/lpe-taperstroke.cpp20
-rw-r--r--src/live_effects/lpe-test-doEffect-stack.cpp6
-rw-r--r--src/live_effects/lpe-test-doEffect-stack.h2
-rw-r--r--src/live_effects/lpe-vonkoch.cpp22
-rw-r--r--src/live_effects/lpe-vonkoch.h2
-rw-r--r--src/live_effects/lpeobject-reference.cpp9
-rw-r--r--src/live_effects/parameter/filletchamferpointarray.cpp52
-rw-r--r--src/live_effects/parameter/filletchamferpointarray.h10
-rw-r--r--src/live_effects/parameter/originalpath.cpp4
-rw-r--r--src/live_effects/parameter/originalpatharray.cpp4
-rw-r--r--src/live_effects/parameter/originalpatharray.h2
-rw-r--r--src/live_effects/parameter/parameter.cpp7
-rw-r--r--src/live_effects/parameter/parameter.h7
-rw-r--r--src/live_effects/parameter/path-reference.cpp2
-rw-r--r--src/live_effects/parameter/path.cpp14
-rw-r--r--src/live_effects/parameter/path.h6
-rw-r--r--src/live_effects/parameter/powerstrokepointarray.cpp4
-rw-r--r--src/live_effects/spiro-converters.cpp6
-rw-r--r--src/live_effects/spiro-converters.h6
-rw-r--r--src/live_effects/spiro.h6
81 files changed, 1188 insertions, 1375 deletions
diff --git a/src/live_effects/CMakeLists.txt b/src/live_effects/CMakeLists.txt
index c4b92e579..8a097590a 100644
--- a/src/live_effects/CMakeLists.txt
+++ b/src/live_effects/CMakeLists.txt
@@ -3,7 +3,6 @@ set(live_effects_SRC
lpe-angle_bisector.cpp
lpe-attach-path.cpp
lpe-bendpath.cpp
- lpe-boolops.cpp
lpe-bounding-box.cpp
lpe-bspline.cpp
lpe-circle_3pts.cpp
@@ -81,7 +80,6 @@ set(live_effects_SRC
lpe-angle_bisector.h
lpe-attach-path.h
lpe-bendpath.h
- lpe-boolops.h
lpe-bounding-box.h
lpe-bspline.h
lpe-circle_3pts.h
diff --git a/src/live_effects/Makefile_insert b/src/live_effects/Makefile_insert
index dace45739..c2c2ce93c 100644
--- a/src/live_effects/Makefile_insert
+++ b/src/live_effects/Makefile_insert
@@ -14,8 +14,6 @@ ink_common_sources += \
live_effects/lpe-patternalongpath.h \
live_effects/lpe-bendpath.cpp \
live_effects/lpe-bendpath.h \
- live_effects/lpe-boolops.cpp \
- live_effects/lpe-boolops.h \
live_effects/lpe-dynastroke.cpp \
live_effects/lpe-dynastroke.h \
live_effects/lpe-extrude.cpp \
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp
index 1da364580..332d81777 100644
--- a/src/live_effects/effect.cpp
+++ b/src/live_effects/effect.cpp
@@ -14,54 +14,53 @@
// include effects:
#include "live_effects/lpe-patternalongpath.h"
#include "live_effects/effect.h"
+#include "live_effects/lpe-angle_bisector.h"
+#include "live_effects/lpe-attach-path.h"
#include "live_effects/lpe-bendpath.h"
-#include "live_effects/lpe-sketch.h"
-#include "live_effects/lpe-vonkoch.h"
-#include "live_effects/lpe-knot.h"
-#include "live_effects/lpe-rough-hatches.h"
-#include "live_effects/lpe-dynastroke.h"
-#include "live_effects/lpe-test-doEffect-stack.h"
-#include "live_effects/lpe-gears.h"
-#include "live_effects/lpe-curvestitch.h"
+#include "live_effects/lpe-bounding-box.h"
+#include "live_effects/lpe-bspline.h"
+#include "live_effects/lpe-circle_3pts.h"
#include "live_effects/lpe-circle_with_radius.h"
-#include "live_effects/lpe-perspective_path.h"
-#include "live_effects/lpe-perspective-envelope.h"
-#include "live_effects/lpe-spiro.h"
-#include "live_effects/lpe-lattice.h"
-#include "live_effects/lpe-lattice2.h"
-#include "live_effects/lpe-roughen.h"
-#include "live_effects/lpe-show_handles.h"
-#include "live_effects/lpe-simplify.h"
-#include "live_effects/lpe-envelope.h"
+#include "live_effects/lpe-clone-original.h"
#include "live_effects/lpe-constructgrid.h"
-#include "live_effects/lpe-perp_bisector.h"
-#include "live_effects/lpe-tangent_to_curve.h"
-#include "live_effects/lpe-mirror_symmetry.h"
-#include "live_effects/lpe-circle_3pts.h"
-#include "live_effects/lpe-angle_bisector.h"
-#include "live_effects/lpe-parallel.h"
#include "live_effects/lpe-copy_rotate.h"
-#include "live_effects/lpe-offset.h"
-#include "live_effects/lpe-ruler.h"
-#include "live_effects/lpe-boolops.h"
+#include "live_effects/lpe-curvestitch.h"
+#include "live_effects/lpe-dynastroke.h"
+#include "live_effects/lpe-ellipse_5pts.h"
+#include "live_effects/lpe-envelope.h"
+#include "live_effects/lpe-extrude.h"
+#include "live_effects/lpe-fill-between-many.h"
+#include "live_effects/lpe-fill-between-strokes.h"
+#include "live_effects/lpe-fillet-chamfer.h"
+#include "live_effects/lpe-gears.h"
#include "live_effects/lpe-interpolate.h"
#include "live_effects/lpe-interpolate_points.h"
-#include "live_effects/lpe-text_label.h"
-#include "live_effects/lpe-path_length.h"
+#include "live_effects/lpe-jointype.h"
+#include "live_effects/lpe-knot.h"
+#include "live_effects/lpe-lattice2.h"
+#include "live_effects/lpe-lattice.h"
#include "live_effects/lpe-line_segment.h"
-#include "live_effects/lpe-recursiveskeleton.h"
-#include "live_effects/lpe-extrude.h"
+#include "live_effects/lpe-mirror_symmetry.h"
+#include "live_effects/lpe-offset.h"
+#include "live_effects/lpe-parallel.h"
+#include "live_effects/lpe-path_length.h"
+#include "live_effects/lpe-perp_bisector.h"
+#include "live_effects/lpe-perspective-envelope.h"
+#include "live_effects/lpe-perspective_path.h"
#include "live_effects/lpe-powerstroke.h"
-#include "live_effects/lpe-clone-original.h"
-#include "live_effects/lpe-bspline.h"
-#include "live_effects/lpe-attach-path.h"
-#include "live_effects/lpe-fill-between-strokes.h"
-#include "live_effects/lpe-fill-between-many.h"
-#include "live_effects/lpe-ellipse_5pts.h"
-#include "live_effects/lpe-bounding-box.h"
-#include "live_effects/lpe-jointype.h"
+#include "live_effects/lpe-recursiveskeleton.h"
+#include "live_effects/lpe-roughen.h"
+#include "live_effects/lpe-rough-hatches.h"
+#include "live_effects/lpe-ruler.h"
+#include "live_effects/lpe-show_handles.h"
+#include "live_effects/lpe-simplify.h"
+#include "live_effects/lpe-sketch.h"
+#include "live_effects/lpe-spiro.h"
+#include "live_effects/lpe-tangent_to_curve.h"
#include "live_effects/lpe-taperstroke.h"
-#include "live_effects/lpe-fillet-chamfer.h"
+#include "live_effects/lpe-test-doEffect-stack.h"
+#include "live_effects/lpe-text_label.h"
+#include "live_effects/lpe-vonkoch.h"
#include "xml/node-event-vector.h"
#include "sp-object.h"
@@ -98,8 +97,6 @@ const Util::EnumData<EffectType> LPETypeData[] = {
#ifdef LPE_ENABLE_TEST_EFFECTS
{DOEFFECTSTACK_TEST, N_("doEffect stack test"), "doeffectstacktest"},
{ANGLE_BISECTOR, N_("Angle bisector"), "angle_bisector"},
- // TRANSLATORS: boolean operations
- {BOOLOPS, N_("Boolops"), "boolops"},
{CIRCLE_WITH_RADIUS, N_("Circle (by center and radius)"), "circle_with_radius"},
{CIRCLE_3PTS, N_("Circle by 3 points"), "circle_3pts"},
{DYNASTROKE, N_("Dynamic stroke"), "dynastroke"},
@@ -243,9 +240,6 @@ Effect::New(EffectType lpenr, LivePathEffectObject *lpeobj)
case RULER:
neweffect = static_cast<Effect*> ( new LPERuler(lpeobj) );
break;
- case BOOLOPS:
- neweffect = static_cast<Effect*> ( new LPEBoolops(lpeobj) );
- break;
case INTERPOLATE:
neweffect = static_cast<Effect*> ( new LPEInterpolate(lpeobj) );
break;
@@ -364,7 +358,6 @@ Effect::Effect(LivePathEffectObject *lpeobject)
lpeobj(lpeobject),
concatenate_before_pwd2(false),
sp_lpe_item(NULL),
- defaultUnit("px"),
current_zoom(1),
sp_curve(NULL),
provides_own_flash_paths(true), // is automatically set to false if providesOwnFlashPaths() is not overridden
@@ -454,7 +447,6 @@ void Effect::doOnRemove (SPLPEItem const* /*lpeitem*/)
void Effect::doOnApply_impl(SPLPEItem const* lpeitem)
{
sp_lpe_item = const_cast<SPLPEItem *>(lpeitem);
- defaultUnit = sp_lpe_item->document->getDisplayUnit()->abbr;
/*sp_curve = SP_SHAPE(sp_lpe_item)->getCurve();
pathvector_before_effect = sp_curve->get_pathvector();*/
doOnApply(lpeitem);
@@ -463,7 +455,6 @@ void Effect::doOnApply_impl(SPLPEItem const* lpeitem)
void Effect::doBeforeEffect_impl(SPLPEItem const* lpeitem)
{
sp_lpe_item = const_cast<SPLPEItem *>(lpeitem);
- defaultUnit = sp_lpe_item->document->getDisplayUnit()->abbr;
//printf("(SPLPEITEM*) %p\n", sp_lpe_item);
SPShape * shape = dynamic_cast<SPShape *>(sp_lpe_item);
if(shape){
@@ -523,24 +514,24 @@ Effect::acceptParamPath (SPPath const*/*param_path*/) {
void
Effect::doEffect (SPCurve * curve)
{
- std::vector<Geom::Path> orig_pathv = curve->get_pathvector();
+ Geom::PathVector orig_pathv = curve->get_pathvector();
- std::vector<Geom::Path> result_pathv = doEffect_path(orig_pathv);
+ Geom::PathVector result_pathv = doEffect_path(orig_pathv);
curve->set_pathvector(result_pathv);
}
-std::vector<Geom::Path>
-Effect::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector
+Effect::doEffect_path (Geom::PathVector const & path_in)
{
- std::vector<Geom::Path> path_out;
+ Geom::PathVector path_out;
if ( !concatenate_before_pwd2 ) {
// default behavior
for (unsigned int i=0; i < path_in.size(); i++) {
Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2_in = path_in[i].toPwSb();
Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2_out = doEffect_pwd2(pwd2_in);
- std::vector<Geom::Path> path = Geom::path_from_piecewise( pwd2_out, LPE_CONVERSION_TOLERANCE);
+ Geom::PathVector path = Geom::path_from_piecewise( pwd2_out, LPE_CONVERSION_TOLERANCE);
// add the output path vector to the already accumulated vector:
for (unsigned int j=0; j < path.size(); j++) {
path_out.push_back(path[j]);
diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h
index ac1f0b8dc..ea57ff243 100644
--- a/src/live_effects/effect.h
+++ b/src/live_effects/effect.h
@@ -129,9 +129,9 @@ protected:
// of what kind of input/output parameters he desires.
// the order in which they appear is the order in which they are
// called by this base class. (i.e. doEffect(SPCurve * curve) defaults to calling
- // doEffect(std::vector<Geom::Path> )
- virtual std::vector<Geom::Path>
- doEffect_path (std::vector<Geom::Path> const & path_in);
+ // doEffect(Geom::PathVector )
+ virtual Geom::PathVector
+ doEffect_path (Geom::PathVector const & path_in);
virtual Geom::Piecewise<Geom::D2<Geom::SBasis> >
doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
@@ -159,11 +159,10 @@ protected:
bool concatenate_before_pwd2;
SPLPEItem * sp_lpe_item; // these get stored in doBeforeEffect_impl, and derived classes may do as they please with them.
- Glib::ustring defaultUnit; // these get stored in doBeforeEffect_impl, and derived classes may do as they please with them.
double current_zoom;
std::vector<Geom::Point> selectedNodesPoints;
SPCurve * sp_curve;
- std::vector<Geom::Path> pathvector_before_effect;
+ Geom::PathVector pathvector_before_effect;
private:
bool provides_own_flash_paths; // if true, the standard flash path is suppressed
diff --git a/src/live_effects/lpe-angle_bisector.cpp b/src/live_effects/lpe-angle_bisector.cpp
index 1acf9605f..95a81c763 100644
--- a/src/live_effects/lpe-angle_bisector.cpp
+++ b/src/live_effects/lpe-angle_bisector.cpp
@@ -56,8 +56,8 @@ LPEAngleBisector::~LPEAngleBisector()
{
}
-std::vector<Geom::Path>
-LPEAngleBisector::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector
+LPEAngleBisector::doEffect_path (Geom::PathVector const & path_in)
{
using namespace Geom;
@@ -73,7 +73,7 @@ LPEAngleBisector::doEffect_path (std::vector<Geom::Path> const & path_in)
Geom::Point D = ptA - dir * length_left;
Geom::Point E = ptA + dir * length_right;
- Piecewise<D2<SBasis> > output = Piecewise<D2<SBasis> >(D2<SBasis>(Linear(D[X], E[X]), Linear(D[Y], E[Y])));
+ Piecewise<D2<SBasis> > output = Piecewise<D2<SBasis> >(D2<SBasis>(SBasis(D[X], E[X]), SBasis(D[Y], E[Y])));
return path_from_piecewise(output, LPE_CONVERSION_TOLERANCE);
}
@@ -103,7 +103,7 @@ KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*ori
Geom::Point const s = snap_knot_position(p, state);
- double lambda = Geom::nearest_point(s, lpe->ptA, lpe->dir);
+ double lambda = Geom::nearest_time(s, lpe->ptA, lpe->dir);
lpe->length_left.param_set_value(-lambda);
sp_lpe_item_update_patheffect (SP_LPE_ITEM(item), false, true);
@@ -116,7 +116,7 @@ KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*or
Geom::Point const s = snap_knot_position(p, state);
- double lambda = Geom::nearest_point(s, lpe->ptA, lpe->dir);
+ double lambda = Geom::nearest_time(s, lpe->ptA, lpe->dir);
lpe->length_right.param_set_value(lambda);
sp_lpe_item_update_patheffect (SP_LPE_ITEM(item), false, true);
diff --git a/src/live_effects/lpe-angle_bisector.h b/src/live_effects/lpe-angle_bisector.h
index 95048751e..400cbf6b6 100644
--- a/src/live_effects/lpe-angle_bisector.h
+++ b/src/live_effects/lpe-angle_bisector.h
@@ -28,7 +28,7 @@ public:
LPEAngleBisector(LivePathEffectObject *lpeobject);
virtual ~LPEAngleBisector();
- virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
+ virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in);
friend class AB::KnotHolderEntityLeftEnd;
friend class AB::KnotHolderEntityRightEnd;
diff --git a/src/live_effects/lpe-attach-path.cpp b/src/live_effects/lpe-attach-path.cpp
index 768c66ee2..21459f322 100644
--- a/src/live_effects/lpe-attach-path.cpp
+++ b/src/live_effects/lpe-attach-path.cpp
@@ -64,7 +64,7 @@ void LPEAttachPath::resetDefaults(SPItem const * /*item*/)
void LPEAttachPath::doEffect (SPCurve * curve)
{
- std::vector<Geom::Path> this_pathv = curve->get_pathvector();
+ Geom::PathVector this_pathv = curve->get_pathvector();
if (sp_lpe_item && !this_pathv.empty()) {
Geom::Path p = Geom::Path(this_pathv.front().initialPoint());
@@ -73,7 +73,7 @@ void LPEAttachPath::doEffect (SPCurve * curve)
if (start_path.linksToPath()) {
- std::vector<Geom::Path> linked_pathv = start_path.get_pathvector();
+ Geom::PathVector linked_pathv = start_path.get_pathvector();
Geom::Affine linkedtransform = start_path.getObject()->getRelativeTransform(sp_lpe_item);
if ( !linked_pathv.empty() )
@@ -87,7 +87,7 @@ void LPEAttachPath::doEffect (SPCurve * curve)
Geom::Coord length = derivs[deriv_n].length();
if ( ! Geom::are_near(length, 0) ) {
if (set_start_end) {
- start_path_position.param_set_value(transformedpath.nearestPoint(start_path_curve_end.getOrigin()));
+ start_path_position.param_set_value(transformedpath.nearestTime(start_path_curve_end.getOrigin()).asFlatTime());
}
if (start_path_position > transformedpath.size()) {
@@ -95,7 +95,8 @@ void LPEAttachPath::doEffect (SPCurve * curve)
} else if (start_path_position < 0) {
start_path_position.param_set_value(0);
}
- const Geom::Curve *c = start_path_position >= transformedpath.size() ? &transformedpath.back() : &transformedpath.at_index((int)start_path_position);
+ Geom::Curve const *c = start_path_position >= transformedpath.size() ?
+ &transformedpath.back() : &transformedpath.at((int)start_path_position);
std::vector<Geom::Point> derivs_2 = c->pointAndDerivatives(start_path_position >= transformedpath.size() ? 1 : (start_path_position - (int)start_path_position), 3);
for (unsigned deriv_n_2 = 1; deriv_n_2 < derivs_2.size(); deriv_n_2++) {
@@ -126,7 +127,7 @@ void LPEAttachPath::doEffect (SPCurve * curve)
if (end_path.linksToPath()) {
- std::vector<Geom::Path> linked_pathv = end_path.get_pathvector();
+ Geom::PathVector linked_pathv = end_path.get_pathvector();
Geom::Affine linkedtransform = end_path.getObject()->getRelativeTransform(sp_lpe_item);
if ( !linked_pathv.empty() )
@@ -141,7 +142,7 @@ void LPEAttachPath::doEffect (SPCurve * curve)
Geom::Coord length = derivs[deriv_n].length();
if ( ! Geom::are_near(length, 0) ) {
if (set_end_end) {
- end_path_position.param_set_value(transformedpath.nearestPoint(end_path_curve_end.getOrigin()));
+ end_path_position.param_set_value(transformedpath.nearestTime(end_path_curve_end.getOrigin()).asFlatTime());
}
if (end_path_position > transformedpath.size()) {
@@ -149,7 +150,8 @@ void LPEAttachPath::doEffect (SPCurve * curve)
} else if (end_path_position < 0) {
end_path_position.param_set_value(0);
}
- const Geom::Curve *c = end_path_position >= transformedpath.size() ? &transformedpath.back() : &transformedpath.at_index((int)end_path_position);
+ const Geom::Curve *c = end_path_position >= transformedpath.size() ?
+ &transformedpath.back() : &transformedpath.at((int)end_path_position);
std::vector<Geom::Point> derivs_2 = c->pointAndDerivatives(end_path_position >= transformedpath.size() ? 1 : (end_path_position - (int)end_path_position), 3);
for (unsigned deriv_n_2 = 1; deriv_n_2 < derivs_2.size(); deriv_n_2++) {
diff --git a/src/live_effects/lpe-boolops.cpp b/src/live_effects/lpe-boolops.cpp
deleted file mode 100644
index 641cf5d50..000000000
--- a/src/live_effects/lpe-boolops.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/** \file
- * LPE boolops implementation
- */
-/*
- * Authors:
- * Johan Engelen
- *
- * Copyright (C) Johan Engelen 2007-2008 <j.b.c.engelen@utwente.nl>
- *
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#include "live_effects/lpe-boolops.h"
-
-#include <2geom/path.h>
-#include <2geom/shape.h>
-
-namespace Inkscape {
-namespace LivePathEffect {
-
-static const Util::EnumData<unsigned> BoolopTypeData[] = {
- {Geom::BOOLOP_NULL , N_("Null"), "null"},
- {Geom::BOOLOP_INTERSECT , N_("Intersect"), "intersect"},
- {Geom::BOOLOP_SUBTRACT_A_B , N_("Subtract A-B"), "subtract_a_b"},
- {Geom::BOOLOP_IDENTITY_A , N_("Identity A"), "identity_a"},
- {Geom::BOOLOP_SUBTRACT_B_A , N_("Subtract B-A"), "subtract_b_a"},
- {Geom::BOOLOP_IDENTITY_B , N_("Identity B"), "identity_b"},
- {Geom::BOOLOP_EXCLUSION , N_("Exclusion"), "Exclusion"},
- {Geom::BOOLOP_UNION , N_("Union"), "Union"}
-};
-static const Util::EnumDataConverter<unsigned> BoolopTypeConverter(BoolopTypeData, sizeof(BoolopTypeData)/sizeof(*BoolopTypeData));
-
-LPEBoolops::LPEBoolops(LivePathEffectObject *lpeobject) :
- Effect(lpeobject),
- bool_path(_("2nd path:"), _("Path to which the original path will be boolop'ed."), "path_2nd", &wr, this, "M0,0 L1,0"),
- boolop_type(_("Boolop type:"), _("Determines which kind of boolop will be performed."), "boolop_type", BoolopTypeConverter, &wr, this, Geom::BOOLOP_UNION)
-{
- show_orig_path = true;
-
- registerParameter( dynamic_cast<Parameter *>(&boolop_type) );
- registerParameter( dynamic_cast<Parameter *>(&bool_path) );
-}
-
-LPEBoolops::~LPEBoolops()
-{
-
-}
-
-
-Geom::PathVector
-LPEBoolops::doEffect_path (Geom::PathVector const & path_in)
-{
- std::vector<Geom::Path> path_out;
-
- Geom::Shape shape_in = Geom::sanitize(path_in);
-
- Geom::Shape shape_param = Geom::sanitize(bool_path.get_pathvector());
-
- Geom::Shape shape_out = Geom::boolop(shape_in, shape_param, boolop_type.get_value());
-
- path_out = Geom::desanitize(shape_out);
-
- return path_out;
-}
-
-
-} //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-boolops.h b/src/live_effects/lpe-boolops.h
deleted file mode 100644
index 3c8dc85c4..000000000
--- a/src/live_effects/lpe-boolops.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef INKSCAPE_LPE_BOOLOPS_H
-#define INKSCAPE_LPE_BOOLOPS_H
-
-/** \file
- * LPE boolops implementation, see lpe-boolops.cpp.
- */
-
-/*
- * Authors:
- * Johan Engelen
- *
- * Copyright (C) Johan Engelen 2007-2008 <j.b.c.engelen@utwente.nl>
- *
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#include "live_effects/parameter/enum.h"
-#include "live_effects/effect.h"
-#include "live_effects/parameter/path.h"
-
-namespace Inkscape {
-namespace LivePathEffect {
-
-class LPEBoolops : public Effect {
-public:
- LPEBoolops(LivePathEffectObject *lpeobject);
- virtual ~LPEBoolops();
-
- virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
-
-private:
- PathParam bool_path;
- EnumParam<unsigned> boolop_type;
-
- LPEBoolops(const LPEBoolops&);
- LPEBoolops& operator=(const LPEBoolops&);
-};
-
-} //namespace LivePathEffect
-} //namespace Inkscape
-
-#endif // INKSCAPE_LPE_BOOLOPS_H
-
-/*
- 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-bounding-box.cpp b/src/live_effects/lpe-bounding-box.cpp
index bafd5e70e..43a60d482 100644
--- a/src/live_effects/lpe-bounding-box.cpp
+++ b/src/live_effects/lpe-bounding-box.cpp
@@ -45,7 +45,7 @@ void LPEBoundingBox::doEffect (SPCurve * curve)
p.appendNew<Geom::LineSegment>(Geom::Point(bbox->right(), bbox->bottom()));
p.appendNew<Geom::LineSegment>(Geom::Point(bbox->left(), bbox->bottom()));
p.appendNew<Geom::LineSegment>(Geom::Point(bbox->left(), bbox->top()));
- std::vector<Geom::Path> out;
+ Geom::PathVector out;
out.push_back(p);
curve->set_pathvector(out);
}
diff --git a/src/live_effects/lpe-bspline.cpp b/src/live_effects/lpe-bspline.cpp
index 5d5a6e616..c2a2d080e 100644
--- a/src/live_effects/lpe-bspline.cpp
+++ b/src/live_effects/lpe-bspline.cpp
@@ -9,32 +9,33 @@
#include "sp-path.h"
#include "svg/svg.h"
#include "xml/repr.h"
+#include "preferences.h"
// TODO due to internal breakage in glibmm headers, this must be last:
#include <glibmm/i18n.h>
namespace Inkscape {
namespace LivePathEffect {
-const double handleCubicGap = 0.01;
-const double noPower = 0.0;
-const double defaultStartPower = 0.3334;
-const double defaultEndPower = 0.6667;
+const double HANDLE_CUBIC_GAP = 0.01;
+const double NO_POWER = 0.0;
+const double DEFAULT_START_POWER = 0.3334;
+const double DEFAULT_END_POWER = 0.6667;
LPEBSpline::LPEBSpline(LivePathEffectObject *lpeobject)
: Effect(lpeobject),
steps(_("Steps with CTRL:"), _("Change number of steps with CTRL pressed"), "steps", &wr, this, 2),
helper_size(_("Helper size:"), _("Helper size"), "helper_size", &wr, this, 0),
- ignoreCusp(_("Ignore cusp nodes"), _("Change ignoring cusp nodes"), "ignoreCusp", &wr, this, true),
- onlySelected(_("Change only selected nodes"), _("Change only selected nodes"), "onlySelected", &wr, this, false),
- weight(_("Change weight:"), _("Change weight of the effect"), "weight", &wr, this, defaultStartPower)
+ ignore_cusp(_("Ignore cusp nodes"), _("Change ignoring cusp nodes"), "ignore_cusp", &wr, this, true),
+ only_selected(_("Change only selected nodes"), _("Change only selected nodes"), "only_selected", &wr, this, false),
+ weight(_("Change weight:"), _("Change weight of the effect"), "weight", &wr, this, DEFAULT_START_POWER)
{
registerParameter(&weight);
registerParameter(&steps);
registerParameter(&helper_size);
- registerParameter(&ignoreCusp);
- registerParameter(&onlySelected);
+ registerParameter(&ignore_cusp);
+ registerParameter(&only_selected);
- weight.param_set_range(noPower, 1);
+ weight.param_set_range(NO_POWER, 1);
weight.param_set_increments(0.1, 0.1);
weight.param_set_digits(4);
@@ -43,7 +44,7 @@ LPEBSpline::LPEBSpline(LivePathEffectObject *lpeobject)
steps.param_set_digits(0);
helper_size.param_set_range(0.0, 999.0);
- helper_size.param_set_increments(5, 5);
+ helper_size.param_set_increments(1, 1);
helper_size.param_set_digits(2);
}
@@ -51,7 +52,7 @@ LPEBSpline::~LPEBSpline() {}
void LPEBSpline::doBeforeEffect (SPLPEItem const* /*lpeitem*/)
{
- if(!hp.empty()){
+ if(!hp.empty()) {
hp.clear();
}
}
@@ -69,32 +70,34 @@ void LPEBSpline::doOnApply(SPLPEItem const* lpeitem)
void LPEBSpline::doEffect(SPCurve *curve)
{
- if (curve->get_segment_count() < 1){
+ if (curve->get_segment_count() < 1) {
return;
}
// Make copy of old path as it is changed during processing
Geom::PathVector const original_pathv = curve->get_pathvector();
curve->reset();
-
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
for (Geom::PathVector::const_iterator path_it = original_pathv.begin();
path_it != original_pathv.end(); ++path_it) {
- if (path_it->empty()){
+ if (path_it->empty()) {
continue;
}
- hp.push_back(*path_it);
+ if (!prefs->getBool("/tools/nodes/show_outline", true)){
+ hp.push_back(*path_it);
+ }
Geom::Path::const_iterator curve_it1 = path_it->begin();
Geom::Path::const_iterator curve_it2 = ++(path_it->begin());
Geom::Path::const_iterator curve_endit = path_it->end_default();
- SPCurve *nCurve = new SPCurve();
+ SPCurve *curve_n = new SPCurve();
Geom::Point previousNode(0, 0);
Geom::Point node(0, 0);
- Geom::Point pointAt1(0, 0);
- Geom::Point pointAt2(0, 0);
- Geom::Point nextPointAt1(0, 0);
- Geom::D2<Geom::SBasis> SBasisIn;
- Geom::D2<Geom::SBasis> SBasisOut;
- Geom::D2<Geom::SBasis> SBasisHelper;
+ Geom::Point point_at1(0, 0);
+ Geom::Point point_at2(0, 0);
+ Geom::Point next_point_at1(0, 0);
+ Geom::D2<Geom::SBasis> sbasis_in;
+ Geom::D2<Geom::SBasis> sbasis_out;
+ Geom::D2<Geom::SBasis> sbasis_helper;
Geom::CubicBezier const *cubic = NULL;
if (path_it->closed()) {
// if the path is closed, maybe we have to stop a bit earlier because the
@@ -110,27 +113,27 @@ void LPEBSpline::doEffect(SPCurve *curve)
curve_endit = path_it->end_open();
}
}
- nCurve->moveto(curve_it1->initialPoint());
+ curve_n->moveto(curve_it1->initialPoint());
while (curve_it1 != curve_endit) {
SPCurve *in = new SPCurve();
in->moveto(curve_it1->initialPoint());
in->lineto(curve_it1->finalPoint());
cubic = dynamic_cast<Geom::CubicBezier const *>(&*curve_it1);
if (cubic) {
- SBasisIn = in->first_segment()->toSBasis();
+ sbasis_in = in->first_segment()->toSBasis();
if(are_near((*cubic)[1],(*cubic)[0]) && !are_near((*cubic)[2],(*cubic)[3])) {
- pointAt1 = SBasisIn.valueAt(defaultStartPower);
+ point_at1 = sbasis_in.valueAt(DEFAULT_START_POWER);
} else {
- pointAt1 = SBasisIn.valueAt(Geom::nearest_point((*cubic)[1], *in->first_segment()));
+ point_at1 = sbasis_in.valueAt(Geom::nearest_time((*cubic)[1], *in->first_segment()));
}
if(are_near((*cubic)[2],(*cubic)[3]) && !are_near((*cubic)[1],(*cubic)[0])) {
- pointAt2 = SBasisIn.valueAt(defaultEndPower);
+ point_at2 = sbasis_in.valueAt(DEFAULT_END_POWER);
} else {
- pointAt2 = SBasisIn.valueAt(Geom::nearest_point((*cubic)[2], *in->first_segment()));
+ point_at2 = sbasis_in.valueAt(Geom::nearest_time((*cubic)[2], *in->first_segment()));
}
} else {
- pointAt1 = in->first_segment()->initialPoint();
- pointAt2 = in->first_segment()->finalPoint();
+ point_at1 = in->first_segment()->initialPoint();
+ point_at2 = in->first_segment()->finalPoint();
}
in->reset();
delete in;
@@ -140,14 +143,14 @@ void LPEBSpline::doEffect(SPCurve *curve)
out->lineto(curve_it2->finalPoint());
cubic = dynamic_cast<Geom::CubicBezier const *>(&*curve_it2);
if (cubic) {
- SBasisOut = out->first_segment()->toSBasis();
+ sbasis_out = out->first_segment()->toSBasis();
if(are_near((*cubic)[1],(*cubic)[0]) && !are_near((*cubic)[2],(*cubic)[3])) {
- nextPointAt1 = SBasisIn.valueAt(defaultStartPower);
+ next_point_at1 = sbasis_in.valueAt(DEFAULT_START_POWER);
} else {
- nextPointAt1 = SBasisOut.valueAt(Geom::nearest_point((*cubic)[1], *out->first_segment()));
+ next_point_at1 = sbasis_out.valueAt(Geom::nearest_time((*cubic)[1], *out->first_segment()));
}
} else {
- nextPointAt1 = out->first_segment()->initialPoint();
+ next_point_at1 = out->first_segment()->initialPoint();
}
out->reset();
delete out;
@@ -156,14 +159,14 @@ void LPEBSpline::doEffect(SPCurve *curve)
SPCurve *start = new SPCurve();
start->moveto(path_it->begin()->initialPoint());
start->lineto(path_it->begin()->finalPoint());
- Geom::D2<Geom::SBasis> SBasisStart = start->first_segment()->toSBasis();
- SPCurve *lineHelper = new SPCurve();
+ Geom::D2<Geom::SBasis> sbasis_start = start->first_segment()->toSBasis();
+ SPCurve *line_helper = new SPCurve();
cubic = dynamic_cast<Geom::CubicBezier const *>(&*path_it->begin());
if (cubic) {
- lineHelper->moveto(SBasisStart.valueAt(
- Geom::nearest_point((*cubic)[1], *start->first_segment())));
+ line_helper->moveto(sbasis_start.valueAt(
+ Geom::nearest_time((*cubic)[1], *start->first_segment())));
} else {
- lineHelper->moveto(start->first_segment()->initialPoint());
+ line_helper->moveto(start->first_segment()->initialPoint());
}
start->reset();
delete start;
@@ -171,41 +174,41 @@ void LPEBSpline::doEffect(SPCurve *curve)
SPCurve *end = new SPCurve();
end->moveto(curve_it1->initialPoint());
end->lineto(curve_it1->finalPoint());
- Geom::D2<Geom::SBasis> SBasisEnd = end->first_segment()->toSBasis();
+ Geom::D2<Geom::SBasis> sbasis_end = end->first_segment()->toSBasis();
cubic = dynamic_cast<Geom::CubicBezier const *>(&*curve_it1);
if (cubic) {
- lineHelper->lineto(SBasisEnd.valueAt(
- Geom::nearest_point((*cubic)[2], *end->first_segment())));
+ line_helper->lineto(sbasis_end.valueAt(
+ Geom::nearest_time((*cubic)[2], *end->first_segment())));
} else {
- lineHelper->lineto(end->first_segment()->finalPoint());
+ line_helper->lineto(end->first_segment()->finalPoint());
}
end->reset();
delete end;
- SBasisHelper = lineHelper->first_segment()->toSBasis();
- lineHelper->reset();
- delete lineHelper;
- node = SBasisHelper.valueAt(0.5);
- nCurve->curveto(pointAt1, pointAt2, node);
- nCurve->move_endpoints(node, node);
+ sbasis_helper = line_helper->first_segment()->toSBasis();
+ line_helper->reset();
+ delete line_helper;
+ node = sbasis_helper.valueAt(0.5);
+ curve_n->curveto(point_at1, point_at2, node);
+ curve_n->move_endpoints(node, node);
} else if ( curve_it2 == curve_endit) {
- nCurve->curveto(pointAt1, pointAt2, curve_it1->finalPoint());
- nCurve->move_endpoints(path_it->begin()->initialPoint(), curve_it1->finalPoint());
+ curve_n->curveto(point_at1, point_at2, curve_it1->finalPoint());
+ curve_n->move_endpoints(path_it->begin()->initialPoint(), curve_it1->finalPoint());
} else {
- SPCurve *lineHelper = new SPCurve();
- lineHelper->moveto(pointAt2);
- lineHelper->lineto(nextPointAt1);
- SBasisHelper = lineHelper->first_segment()->toSBasis();
- lineHelper->reset();
- delete lineHelper;
+ SPCurve *line_helper = new SPCurve();
+ line_helper->moveto(point_at2);
+ line_helper->lineto(next_point_at1);
+ sbasis_helper = line_helper->first_segment()->toSBasis();
+ line_helper->reset();
+ delete line_helper;
previousNode = node;
- node = SBasisHelper.valueAt(0.5);
+ node = sbasis_helper.valueAt(0.5);
Geom::CubicBezier const *cubic2 = dynamic_cast<Geom::CubicBezier const *>(&*curve_it1);
if((cubic && are_near((*cubic)[0],(*cubic)[1])) || (cubic2 && are_near((*cubic2)[2],(*cubic2)[3]))) {
node = curve_it1->finalPoint();
}
- nCurve->curveto(pointAt1, pointAt2, node);
+ curve_n->curveto(point_at1, point_at2, node);
}
- if(!are_near(node,curve_it1->finalPoint()) && helper_size > 0.0){
+ if(!are_near(node,curve_it1->finalPoint()) && helper_size > 0.0) {
drawHandle(node, helper_size);
}
++curve_it1;
@@ -213,15 +216,15 @@ void LPEBSpline::doEffect(SPCurve *curve)
}
//y cerramos la curva
if (path_it->closed()) {
- nCurve->closepath_current();
+ curve_n->closepath_current();
}
- curve->append(nCurve, false);
- nCurve->reset();
- delete nCurve;
+ curve->append(curve_n, false);
+ curve_n->reset();
+ delete curve_n;
}
- if(helper_size > 0.0){
+ if(helper_size > 0.0) {
Geom::PathVector const pathv = curve->get_pathvector();
- hp.push_back(pathv[0]);
+ hp.push_back(pathv[0]);
}
}
@@ -233,7 +236,7 @@ LPEBSpline::drawHandle(Geom::Point p, double helper_size)
Geom::Affine aff = Geom::Affine();
aff *= Geom::Scale(helper_size);
pathv *= aff;
- pathv += p - Geom::Point(0.5*helper_size, 0.5*helper_size);
+ pathv *= Geom::Translate(p - Geom::Point(0.5*helper_size, 0.5*helper_size));
hp.push_back(pathv[0]);
}
@@ -256,40 +259,40 @@ Gtk::Widget *LPEBSpline::newWidget()
Gtk::Widget *widg = dynamic_cast<Gtk::Widget *>(param->param_newWidget());
if (param->param_key == "weight") {
Gtk::HBox * buttons = Gtk::manage(new Gtk::HBox(true,0));
- Gtk::Button *defaultWeight =
+ Gtk::Button *default_weight =
Gtk::manage(new Gtk::Button(Glib::ustring(_("Default weight"))));
- defaultWeight->signal_clicked()
+ default_weight->signal_clicked()
.connect(sigc::mem_fun(*this, &LPEBSpline::toDefaultWeight));
- buttons->pack_start(*defaultWeight, true, true, 2);
- Gtk::Button *makeCusp =
+ buttons->pack_start(*default_weight, true, true, 2);
+ Gtk::Button *make_cusp =
Gtk::manage(new Gtk::Button(Glib::ustring(_("Make cusp"))));
- makeCusp->signal_clicked()
+ make_cusp->signal_clicked()
.connect(sigc::mem_fun(*this, &LPEBSpline::toMakeCusp));
- buttons->pack_start(*makeCusp, true, true, 2);
+ buttons->pack_start(*make_cusp, true, true, 2);
vbox->pack_start(*buttons, true, true, 2);
}
if (param->param_key == "weight" || param->param_key == "steps") {
- Inkscape::UI::Widget::Scalar *widgRegistered =
+ Inkscape::UI::Widget::Scalar *widg_registered =
Gtk::manage(dynamic_cast<Inkscape::UI::Widget::Scalar *>(widg));
- widgRegistered->signal_value_changed()
+ widg_registered->signal_value_changed()
.connect(sigc::mem_fun(*this, &LPEBSpline::toWeight));
- widg = dynamic_cast<Gtk::Widget *>(widgRegistered);
+ widg = dynamic_cast<Gtk::Widget *>(widg_registered);
if (widg) {
- Gtk::HBox * scalarParameter = dynamic_cast<Gtk::HBox *>(widg);
- std::vector< Gtk::Widget* > childList = scalarParameter->get_children();
- Gtk::Entry* entryWidg = dynamic_cast<Gtk::Entry *>(childList[1]);
- entryWidg->set_width_chars(6);
+ Gtk::HBox * hbox_weight_steps = dynamic_cast<Gtk::HBox *>(widg);
+ std::vector< Gtk::Widget* > childList = hbox_weight_steps->get_children();
+ Gtk::Entry* entry_widget = dynamic_cast<Gtk::Entry *>(childList[1]);
+ entry_widget->set_width_chars(6);
}
}
- if (param->param_key == "onlySelected") {
- Gtk::CheckButton *widgRegistered =
+ if (param->param_key == "only_selected") {
+ Gtk::CheckButton *widg_registered =
Gtk::manage(dynamic_cast<Gtk::CheckButton *>(widg));
- widg = dynamic_cast<Gtk::Widget *>(widgRegistered);
+ widg = dynamic_cast<Gtk::Widget *>(widg_registered);
}
- if (param->param_key == "ignoreCusp") {
- Gtk::CheckButton *widgRegistered =
+ if (param->param_key == "ignore_cusp") {
+ Gtk::CheckButton *widg_registered =
Gtk::manage(dynamic_cast<Gtk::CheckButton *>(widg));
- widg = dynamic_cast<Gtk::Widget *>(widgRegistered);
+ widg = dynamic_cast<Gtk::Widget *>(widg_registered);
}
Glib::ustring *tip = param->param_getTooltip();
if (widg) {
@@ -310,12 +313,12 @@ Gtk::Widget *LPEBSpline::newWidget()
void LPEBSpline::toDefaultWeight()
{
- changeWeight(defaultStartPower);
+ changeWeight(DEFAULT_START_POWER);
}
void LPEBSpline::toMakeCusp()
{
- changeWeight(noPower);
+ changeWeight(NO_POWER);
}
void LPEBSpline::toWeight()
@@ -323,22 +326,22 @@ void LPEBSpline::toWeight()
changeWeight(weight);
}
-void LPEBSpline::changeWeight(double weightValue)
+void LPEBSpline::changeWeight(double weight_ammount)
{
SPPath *path = dynamic_cast<SPPath *>(sp_lpe_item);
- if(path){
+ if(path) {
SPCurve *curve = path->get_curve_for_edit();
- LPEBSpline::doBSplineFromWidget(curve, weightValue);
+ doBSplineFromWidget(curve, weight_ammount);
gchar *str = sp_svg_write_path(curve->get_pathvector());
path->getRepr()->setAttribute("inkscape:original-d", str);
}
}
-void LPEBSpline::doBSplineFromWidget(SPCurve *curve, double weightValue)
+void LPEBSpline::doBSplineFromWidget(SPCurve *curve, double weight_ammount)
{
using Geom::X;
using Geom::Y;
-
+
if (curve->get_segment_count() < 1)
return;
// Make copy of old path as it is changed during processing
@@ -348,20 +351,20 @@ void LPEBSpline::doBSplineFromWidget(SPCurve *curve, double weightValue)
for (Geom::PathVector::const_iterator path_it = original_pathv.begin();
path_it != original_pathv.end(); ++path_it) {
- if (path_it->empty()){
+ if (path_it->empty()) {
continue;
}
Geom::Path::const_iterator curve_it1 = path_it->begin();
Geom::Path::const_iterator curve_it2 = ++(path_it->begin());
Geom::Path::const_iterator curve_endit = path_it->end_default();
- SPCurve *nCurve = new SPCurve();
- Geom::Point pointAt0(0, 0);
- Geom::Point pointAt1(0, 0);
- Geom::Point pointAt2(0, 0);
- Geom::Point pointAt3(0, 0);
- Geom::D2<Geom::SBasis> SBasisIn;
- Geom::D2<Geom::SBasis> SBasisOut;
+ SPCurve *curve_n = new SPCurve();
+ Geom::Point point_at0(0, 0);
+ Geom::Point point_at1(0, 0);
+ Geom::Point point_at2(0, 0);
+ Geom::Point point_at3(0, 0);
+ Geom::D2<Geom::SBasis> sbasis_in;
+ Geom::D2<Geom::SBasis> sbasis_out;
Geom::CubicBezier const *cubic = NULL;
if (path_it->closed()) {
// if the path is closed, maybe we have to stop a bit earlier because the
@@ -377,120 +380,120 @@ void LPEBSpline::doBSplineFromWidget(SPCurve *curve, double weightValue)
curve_endit = path_it->end_open();
}
}
- nCurve->moveto(curve_it1->initialPoint());
+ curve_n->moveto(curve_it1->initialPoint());
while (curve_it1 != curve_endit) {
SPCurve *in = new SPCurve();
in->moveto(curve_it1->initialPoint());
in->lineto(curve_it1->finalPoint());
cubic = dynamic_cast<Geom::CubicBezier const *>(&*curve_it1);
- pointAt0 = in->first_segment()->initialPoint();
- pointAt3 = in->first_segment()->finalPoint();
- SBasisIn = in->first_segment()->toSBasis();
- if (!onlySelected) {
+ point_at0 = in->first_segment()->initialPoint();
+ point_at3 = in->first_segment()->finalPoint();
+ sbasis_in = in->first_segment()->toSBasis();
+ if (!only_selected) {
if (cubic) {
- if (!ignoreCusp || !Geom::are_near((*cubic)[1], pointAt0)) {
- pointAt1 = SBasisIn.valueAt(weightValue);
- if (weightValue != noPower) {
- pointAt1 =
- Geom::Point(pointAt1[X] + handleCubicGap, pointAt1[Y] + handleCubicGap);
+ if (!ignore_cusp || !Geom::are_near((*cubic)[1], point_at0)) {
+ point_at1 = sbasis_in.valueAt(weight_ammount);
+ if (weight_ammount != NO_POWER) {
+ point_at1 =
+ Geom::Point(point_at1[X] + HANDLE_CUBIC_GAP, point_at1[Y] + HANDLE_CUBIC_GAP);
}
} else {
- pointAt1 = in->first_segment()->initialPoint();
+ point_at1 = in->first_segment()->initialPoint();
}
- if (!ignoreCusp || !Geom::are_near((*cubic)[2], pointAt3)) {
- pointAt2 = SBasisIn.valueAt(1 - weightValue);
- if (weightValue != noPower) {
- pointAt2 =
- Geom::Point(pointAt2[X] + handleCubicGap, pointAt2[Y] + handleCubicGap);
+ if (!ignore_cusp || !Geom::are_near((*cubic)[2], point_at3)) {
+ point_at2 = sbasis_in.valueAt(1 - weight_ammount);
+ if (weight_ammount != NO_POWER) {
+ point_at2 =
+ Geom::Point(point_at2[X] + HANDLE_CUBIC_GAP, point_at2[Y] + HANDLE_CUBIC_GAP);
}
} else {
- pointAt2 = in->first_segment()->finalPoint();
+ point_at2 = in->first_segment()->finalPoint();
}
} else {
- if (!ignoreCusp && weightValue != noPower) {
- pointAt1 = SBasisIn.valueAt(weightValue);
- if (weightValue != noPower) {
- pointAt1 =
- Geom::Point(pointAt1[X] + handleCubicGap, pointAt1[Y] + handleCubicGap);
+ if (!ignore_cusp && weight_ammount != NO_POWER) {
+ point_at1 = sbasis_in.valueAt(weight_ammount);
+ if (weight_ammount != NO_POWER) {
+ point_at1 =
+ Geom::Point(point_at1[X] + HANDLE_CUBIC_GAP, point_at1[Y] + HANDLE_CUBIC_GAP);
}
- pointAt2 = SBasisIn.valueAt(1 - weightValue);
- if (weightValue != noPower) {
- pointAt2 =
- Geom::Point(pointAt2[X] + handleCubicGap, pointAt2[Y] + handleCubicGap);
+ point_at2 = sbasis_in.valueAt(1 - weight_ammount);
+ if (weight_ammount != NO_POWER) {
+ point_at2 =
+ Geom::Point(point_at2[X] + HANDLE_CUBIC_GAP, point_at2[Y] + HANDLE_CUBIC_GAP);
}
} else {
- pointAt1 = in->first_segment()->initialPoint();
- pointAt2 = in->first_segment()->finalPoint();
+ point_at1 = in->first_segment()->initialPoint();
+ point_at2 = in->first_segment()->finalPoint();
}
}
} else {
if (cubic) {
- if (!ignoreCusp || !Geom::are_near((*cubic)[1], pointAt0)) {
- if (isNodePointSelected(pointAt0)) {
- pointAt1 = SBasisIn.valueAt(weightValue);
- if (weightValue != noPower) {
- pointAt1 =
- Geom::Point(pointAt1[X] + handleCubicGap, pointAt1[Y] + handleCubicGap);
+ if (!ignore_cusp || !Geom::are_near((*cubic)[1], point_at0)) {
+ if (isNodePointSelected(point_at0)) {
+ point_at1 = sbasis_in.valueAt(weight_ammount);
+ if (weight_ammount != NO_POWER) {
+ point_at1 =
+ Geom::Point(point_at1[X] + HANDLE_CUBIC_GAP, point_at1[Y] + HANDLE_CUBIC_GAP);
}
} else {
- pointAt1 = (*cubic)[1];
+ point_at1 = (*cubic)[1];
}
} else {
- pointAt1 = in->first_segment()->initialPoint();
+ point_at1 = in->first_segment()->initialPoint();
}
- if (!ignoreCusp || !Geom::are_near((*cubic)[2], pointAt3)) {
- if (isNodePointSelected(pointAt3)) {
- pointAt2 = SBasisIn.valueAt(1 - weightValue);
- if (weightValue != noPower) {
- pointAt2 =
- Geom::Point(pointAt2[X] + handleCubicGap, pointAt2[Y] + handleCubicGap);
+ if (!ignore_cusp || !Geom::are_near((*cubic)[2], point_at3)) {
+ if (isNodePointSelected(point_at3)) {
+ point_at2 = sbasis_in.valueAt(1 - weight_ammount);
+ if (weight_ammount != NO_POWER) {
+ point_at2 =
+ Geom::Point(point_at2[X] + HANDLE_CUBIC_GAP, point_at2[Y] + HANDLE_CUBIC_GAP);
}
} else {
- pointAt2 = (*cubic)[2];
+ point_at2 = (*cubic)[2];
}
} else {
- pointAt2 = in->first_segment()->finalPoint();
+ point_at2 = in->first_segment()->finalPoint();
}
} else {
- if (!ignoreCusp && weightValue != noPower) {
- if (isNodePointSelected(pointAt0)) {
- pointAt1 = SBasisIn.valueAt(weightValue);
- pointAt1 =
- Geom::Point(pointAt1[X] + handleCubicGap, pointAt1[Y] + handleCubicGap);
+ if (!ignore_cusp && weight_ammount != NO_POWER) {
+ if (isNodePointSelected(point_at0)) {
+ point_at1 = sbasis_in.valueAt(weight_ammount);
+ point_at1 =
+ Geom::Point(point_at1[X] + HANDLE_CUBIC_GAP, point_at1[Y] + HANDLE_CUBIC_GAP);
} else {
- pointAt1 = in->first_segment()->initialPoint();
+ point_at1 = in->first_segment()->initialPoint();
}
- if (isNodePointSelected(pointAt3)) {
- pointAt2 = SBasisIn.valueAt(weightValue);
- pointAt2 =
- Geom::Point(pointAt2[X] + handleCubicGap, pointAt2[Y] + handleCubicGap);
+ if (isNodePointSelected(point_at3)) {
+ point_at2 = sbasis_in.valueAt(weight_ammount);
+ point_at2 =
+ Geom::Point(point_at2[X] + HANDLE_CUBIC_GAP, point_at2[Y] + HANDLE_CUBIC_GAP);
} else {
- pointAt2 = in->first_segment()->finalPoint();
+ point_at2 = in->first_segment()->finalPoint();
}
} else {
- pointAt1 = in->first_segment()->initialPoint();
- pointAt2 = in->first_segment()->finalPoint();
+ point_at1 = in->first_segment()->initialPoint();
+ point_at2 = in->first_segment()->finalPoint();
}
}
}
in->reset();
delete in;
- nCurve->curveto(pointAt1, pointAt2, pointAt3);
+ curve_n->curveto(point_at1, point_at2, point_at3);
++curve_it1;
++curve_it2;
}
if (path_it->closed()) {
- nCurve->move_endpoints(path_it->begin()->initialPoint(),
+ curve_n->move_endpoints(path_it->begin()->initialPoint(),
path_it->begin()->initialPoint());
} else {
- nCurve->move_endpoints(path_it->begin()->initialPoint(), pointAt3);
+ curve_n->move_endpoints(path_it->begin()->initialPoint(), point_at3);
}
if (path_it->closed()) {
- nCurve->closepath_current();
+ curve_n->closepath_current();
}
- curve->append(nCurve, false);
- nCurve->reset();
- delete nCurve;
+ curve->append(curve_n, false);
+ curve_n->reset();
+ delete curve_n;
}
}
diff --git a/src/live_effects/lpe-bspline.h b/src/live_effects/lpe-bspline.h
index 8017e39ef..fc0f66353 100644
--- a/src/live_effects/lpe-bspline.h
+++ b/src/live_effects/lpe-bspline.h
@@ -18,7 +18,8 @@ public:
LPEBSpline(LivePathEffectObject *lpeobject);
virtual ~LPEBSpline();
- virtual LPEPathFlashType pathFlashType() const {
+ virtual LPEPathFlashType pathFlashType() const
+ {
return SUPPRESS_FLASH;
}
virtual void doOnApply(SPLPEItem const* lpeitem);
@@ -38,8 +39,8 @@ public:
private:
ScalarParam helper_size;
- BoolParam ignoreCusp;
- BoolParam onlySelected;
+ BoolParam ignore_cusp;
+ BoolParam only_selected;
ScalarParam weight;
Geom::PathVector hp;
diff --git a/src/live_effects/lpe-circle_3pts.cpp b/src/live_effects/lpe-circle_3pts.cpp
index fb7496f58..dbb1f4b6b 100644
--- a/src/live_effects/lpe-circle_3pts.cpp
+++ b/src/live_effects/lpe-circle_3pts.cpp
@@ -17,6 +17,7 @@
// You might need to include other 2geom files. You can add them here:
#include <2geom/path.h>
#include <2geom/circle.h>
+#include <2geom/path-sink.h>
namespace Inkscape {
namespace LivePathEffect {
@@ -30,7 +31,7 @@ LPECircle3Pts::~LPECircle3Pts()
{
}
-static void _circle3(Geom::Point const &A, Geom::Point const &B, Geom::Point const &C, std::vector<Geom::Path> &path_out) {
+static void _circle3(Geom::Point const &A, Geom::Point const &B, Geom::Point const &C, Geom::PathVector &path_out) {
using namespace Geom;
Point D = (A + B)/2;
@@ -47,13 +48,13 @@ static void _circle3(Geom::Point const &A, Geom::Point const &B, Geom::Point con
double radius = L2(M - A);
Geom::Circle c(M, radius);
- c.getPath(path_out);
+ path_out = Geom::Path(c);
}
-std::vector<Geom::Path>
-LPECircle3Pts::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector
+LPECircle3Pts::doEffect_path (Geom::PathVector const & path_in)
{
- std::vector<Geom::Path> path_out = std::vector<Geom::Path>();
+ Geom::PathVector path_out = Geom::PathVector();
// we assume that the path has >= 3 nodes
Geom::Point A = path_in[0].initialPoint();
diff --git a/src/live_effects/lpe-circle_3pts.h b/src/live_effects/lpe-circle_3pts.h
index 2533fe251..07c2eddb0 100644
--- a/src/live_effects/lpe-circle_3pts.h
+++ b/src/live_effects/lpe-circle_3pts.h
@@ -27,7 +27,7 @@ public:
LPECircle3Pts(LivePathEffectObject *lpeobject);
virtual ~LPECircle3Pts();
- virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
+ virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in);
private:
LPECircle3Pts(const LPECircle3Pts&);
diff --git a/src/live_effects/lpe-circle_with_radius.cpp b/src/live_effects/lpe-circle_with_radius.cpp
index 8a32cd230..8f2156044 100644
--- a/src/live_effects/lpe-circle_with_radius.cpp
+++ b/src/live_effects/lpe-circle_with_radius.cpp
@@ -15,11 +15,9 @@
#include "display/curve.h"
// You might need to include other 2geom files. You can add them here:
-#include <2geom/path.h>
-#include <2geom/sbasis.h>
-#include <2geom/bezier-to-sbasis.h>
-#include <2geom/d2.h>
+#include <2geom/pathvector.h>
#include <2geom/circle.h>
+#include <2geom/path-sink.h>
using namespace Geom;
@@ -40,10 +38,10 @@ LPECircleWithRadius::~LPECircleWithRadius()
}
-std::vector<Geom::Path>
-LPECircleWithRadius::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector
+LPECircleWithRadius::doEffect_path (Geom::PathVector const & path_in)
{
- std::vector<Geom::Path> path_out = std::vector<Geom::Path>();
+ Geom::PathVector path_out = Geom::PathVector();
Geom::Point center = path_in[0].initialPoint();
Geom::Point pt = path_in[0].finalPoint();
@@ -51,9 +49,7 @@ LPECircleWithRadius::doEffect_path (std::vector<Geom::Path> const & path_in)
double radius = Geom::L2(pt - center);
Geom::Circle c(center, radius);
- c.getPath(path_out);
-
- return path_out;
+ return Geom::Path(c);
}
/*
diff --git a/src/live_effects/lpe-circle_with_radius.h b/src/live_effects/lpe-circle_with_radius.h
index 10f652771..f5bf0c414 100644
--- a/src/live_effects/lpe-circle_with_radius.h
+++ b/src/live_effects/lpe-circle_with_radius.h
@@ -26,7 +26,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> const & path_in);
+ virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in);
private:
// add the parameters for your effect here:
diff --git a/src/live_effects/lpe-clone-original.cpp b/src/live_effects/lpe-clone-original.cpp
index d7cd6e19c..7541c0be2 100644
--- a/src/live_effects/lpe-clone-original.cpp
+++ b/src/live_effects/lpe-clone-original.cpp
@@ -28,7 +28,7 @@ LPECloneOriginal::~LPECloneOriginal()
void LPECloneOriginal::doEffect (SPCurve * curve)
{
if ( linked_path.linksToPath() ) {
- std::vector<Geom::Path> linked_pathv = linked_path.get_pathvector();
+ Geom::PathVector linked_pathv = linked_path.get_pathvector();
if ( !linked_pathv.empty() ) {
curve->set_pathvector(linked_pathv);
}
diff --git a/src/live_effects/lpe-constructgrid.cpp b/src/live_effects/lpe-constructgrid.cpp
index fbf9faf56..b1e0edaac 100644
--- a/src/live_effects/lpe-constructgrid.cpp
+++ b/src/live_effects/lpe-constructgrid.cpp
@@ -41,8 +41,8 @@ LPEConstructGrid::~LPEConstructGrid()
}
-std::vector<Geom::Path>
-LPEConstructGrid::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector
+LPEConstructGrid::doEffect_path (Geom::PathVector const & path_in)
{
// Check that the path has at least 3 nodes (i.e. 2 segments), more nodes are ignored
if (path_in[0].size() >= 2) {
@@ -64,7 +64,7 @@ LPEConstructGrid::doEffect_path (std::vector<Geom::Path> const & path_in)
second_path.appendNew<LineSegment>( origin + second_p*nr_x );
// use the gridpaths and set them in the correct grid
- std::vector<Geom::Path> path_out;
+ Geom::PathVector path_out;
path_out.push_back(first_path);
for (int ix = 0; ix < nr_x; ix++) {
path_out.push_back(path_out.back() * second_translation );
diff --git a/src/live_effects/lpe-constructgrid.h b/src/live_effects/lpe-constructgrid.h
index c7e695794..49c986742 100644
--- a/src/live_effects/lpe-constructgrid.h
+++ b/src/live_effects/lpe-constructgrid.h
@@ -25,7 +25,7 @@ public:
LPEConstructGrid(LivePathEffectObject *lpeobject);
virtual ~LPEConstructGrid();
- virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
+ virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in);
private:
ScalarParam nr_x;
diff --git a/src/live_effects/lpe-curvestitch.cpp b/src/live_effects/lpe-curvestitch.cpp
index 854cc0734..609447f26 100644
--- a/src/live_effects/lpe-curvestitch.cpp
+++ b/src/live_effects/lpe-curvestitch.cpp
@@ -68,8 +68,8 @@ LPECurveStitch::~LPECurveStitch()
}
-std::vector<Geom::Path>
-LPECurveStitch::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector
+LPECurveStitch::doEffect_path (Geom::PathVector const & path_in)
{
if (path_in.size() >= 2) {
startpoint_edge_variation.resetRandomizer();
@@ -86,7 +86,7 @@ LPECurveStitch::doEffect_path (std::vector<Geom::Path> const & path_in)
gdouble scaling = bndsStroke->max() - bndsStroke->min();
Point stroke_origin(bndsStroke->min(), (bndsStrokeY->max()+bndsStrokeY->min())/2);
- std::vector<Geom::Path> path_out;
+ Geom::PathVector path_out;
// do this for all permutations (ii,jj) if there are more than 2 paths? realllly cool!
for (unsigned ii = 0 ; ii < path_in.size() - 1; ii++)
@@ -127,7 +127,7 @@ LPECurveStitch::doEffect_path (std::vector<Geom::Path> const & path_in)
// add stuff to one big pw<d2<sbasis> > and then outside the loop convert to path?
// No: this way, the separate result paths are kept separate which might come in handy some time!
- std::vector<Geom::Path> result = Geom::path_from_piecewise(pwd2_out, LPE_CONVERSION_TOLERANCE);
+ Geom::PathVector result = Geom::path_from_piecewise(pwd2_out, LPE_CONVERSION_TOLERANCE);
path_out.push_back(result[0]);
}
gdouble svA = startpoint_spacing_variation - startpoint_spacing_variation.get_value()/2;
@@ -162,7 +162,7 @@ LPECurveStitch::resetDefaults(SPItem const* item)
// calculate bounding box: (isn't there a simpler way?)
Piecewise<D2<SBasis> > pwd2;
- std::vector<Geom::Path> temppath = sp_svg_read_pathv( item->getRepr()->attribute("inkscape:original-d"));
+ Geom::PathVector temppath = sp_svg_read_pathv( item->getRepr()->attribute("inkscape:original-d"));
for (unsigned int i=0; i < temppath.size(); i++) {
pwd2.concat( temppath[i].toPwSb() );
}
diff --git a/src/live_effects/lpe-curvestitch.h b/src/live_effects/lpe-curvestitch.h
index 38a11b4af..c6ea66f6c 100644
--- a/src/live_effects/lpe-curvestitch.h
+++ b/src/live_effects/lpe-curvestitch.h
@@ -28,7 +28,7 @@ public:
LPECurveStitch(LivePathEffectObject *lpeobject);
virtual ~LPECurveStitch();
- virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
+ virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in);
virtual void resetDefaults(SPItem const* item);
diff --git a/src/live_effects/lpe-ellipse_5pts.cpp b/src/live_effects/lpe-ellipse_5pts.cpp
index b0a5919fe..4c953bcda 100644
--- a/src/live_effects/lpe-ellipse_5pts.cpp
+++ b/src/live_effects/lpe-ellipse_5pts.cpp
@@ -67,10 +67,10 @@ static double _det5(double (*mat)[5])
return mat[4][4];
}
-std::vector<Geom::Path>
-LPEEllipse5Pts::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector
+LPEEllipse5Pts::doEffect_path (Geom::PathVector const & path_in)
{
- std::vector<Geom::Path> path_out = std::vector<Geom::Path>();
+ Geom::PathVector path_out = Geom::PathVector();
if (path_in[0].size() < 4) {
@@ -190,7 +190,7 @@ LPEEllipse5Pts::doEffect_path (std::vector<Geom::Path> const & path_in)
p.appendNew<Geom::CubicBezier>(Geom::Point(x1,y1), Geom::Point(x2,y2), Geom::Point(x3,y3));
}
- Geom::Affine aff = Geom::Scale(el.ray(Geom::X), el.ray(Geom::Y)) * Geom::Rotate(el.rot_angle()) * Geom::Translate(el.center());
+ Geom::Affine aff = Geom::Scale(el.rays()) * Geom::Rotate(el.rotationAngle()) * Geom::Translate(el.center());
path_out.push_back(p * aff);
diff --git a/src/live_effects/lpe-ellipse_5pts.h b/src/live_effects/lpe-ellipse_5pts.h
index d3b1fccfa..691a693dc 100644
--- a/src/live_effects/lpe-ellipse_5pts.h
+++ b/src/live_effects/lpe-ellipse_5pts.h
@@ -26,7 +26,7 @@ public:
LPEEllipse5Pts(LivePathEffectObject *lpeobject);
virtual ~LPEEllipse5Pts();
- virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
+ virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in);
private:
LPEEllipse5Pts(const LPEEllipse5Pts&);
diff --git a/src/live_effects/lpe-fill-between-many.cpp b/src/live_effects/lpe-fill-between-many.cpp
index 7cf354044..3e0810cfc 100644
--- a/src/live_effects/lpe-fill-between-many.cpp
+++ b/src/live_effects/lpe-fill-between-many.cpp
@@ -35,14 +35,14 @@ LPEFillBetweenMany::~LPEFillBetweenMany()
void LPEFillBetweenMany::doEffect (SPCurve * curve)
{
- std::vector<Geom::Path> res_pathv;
+ Geom::PathVector res_pathv;
SPItem * firstObj = NULL;
for (std::vector<PathAndDirection*>::iterator iter = linked_paths._vector.begin(); iter != linked_paths._vector.end(); iter++) {
SPObject *obj;
if ((*iter)->ref.isAttached() && (obj = (*iter)->ref.getObject()) && SP_IS_ITEM(obj) && !(*iter)->_pathvector.empty()) {
Geom::Path linked_path;
if ((*iter)->reversed) {
- linked_path = (*iter)->_pathvector.front().reverse();
+ linked_path = (*iter)->_pathvector.front().reversed();
} else {
linked_path = (*iter)->_pathvector.front();
}
diff --git a/src/live_effects/lpe-fill-between-strokes.cpp b/src/live_effects/lpe-fill-between-strokes.cpp
index e72979ed0..89ea80545 100644
--- a/src/live_effects/lpe-fill-between-strokes.cpp
+++ b/src/live_effects/lpe-fill-between-strokes.cpp
@@ -39,17 +39,17 @@ void LPEFillBetweenStrokes::doEffect (SPCurve * curve)
{
if (curve) {
if ( linked_path.linksToPath() && second_path.linksToPath() && linked_path.getObject() && second_path.getObject() ) {
- std::vector<Geom::Path> linked_pathv = linked_path.get_pathvector();
- std::vector<Geom::Path> second_pathv = second_path.get_pathvector();
- std::vector<Geom::Path> result_linked_pathv;
- std::vector<Geom::Path> result_second_pathv;
+ Geom::PathVector linked_pathv = linked_path.get_pathvector();
+ Geom::PathVector second_pathv = second_path.get_pathvector();
+ Geom::PathVector result_linked_pathv;
+ Geom::PathVector result_second_pathv;
Geom::Affine second_transform = second_path.getObject()->getRelativeTransform(linked_path.getObject());
- for (std::vector<Geom::Path>::iterator iter = linked_pathv.begin(); iter != linked_pathv.end(); ++iter)
+ for (Geom::PathVector::iterator iter = linked_pathv.begin(); iter != linked_pathv.end(); ++iter)
{
result_linked_pathv.push_back((*iter));
}
- for (std::vector<Geom::Path>::iterator iter = second_pathv.begin(); iter != second_pathv.end(); ++iter)
+ for (Geom::PathVector::iterator iter = second_pathv.begin(); iter != second_pathv.end(); ++iter)
{
result_second_pathv.push_back((*iter) * second_transform);
}
@@ -58,7 +58,7 @@ void LPEFillBetweenStrokes::doEffect (SPCurve * curve)
if (reverse_second.get_value())
{
result_linked_pathv.front().appendNew<Geom::LineSegment>(result_second_pathv.front().finalPoint());
- result_linked_pathv.front().append(result_second_pathv.front().reverse());
+ result_linked_pathv.front().append(result_second_pathv.front().reversed());
}
else
{
@@ -75,10 +75,10 @@ void LPEFillBetweenStrokes::doEffect (SPCurve * curve)
}
}
else if ( linked_path.linksToPath() && linked_path.getObject() ) {
- std::vector<Geom::Path> linked_pathv = linked_path.get_pathvector();
- std::vector<Geom::Path> result_pathv;
+ Geom::PathVector linked_pathv = linked_path.get_pathvector();
+ Geom::PathVector result_pathv;
- for (std::vector<Geom::Path>::iterator iter = linked_pathv.begin(); iter != linked_pathv.end(); ++iter)
+ for (Geom::PathVector::iterator iter = linked_pathv.begin(); iter != linked_pathv.end(); ++iter)
{
result_pathv.push_back((*iter));
}
@@ -87,10 +87,10 @@ void LPEFillBetweenStrokes::doEffect (SPCurve * curve)
}
}
else if ( second_path.linksToPath() && second_path.getObject() ) {
- std::vector<Geom::Path> second_pathv = second_path.get_pathvector();
- std::vector<Geom::Path> result_pathv;
+ Geom::PathVector second_pathv = second_path.get_pathvector();
+ Geom::PathVector result_pathv;
- for (std::vector<Geom::Path>::iterator iter = second_pathv.begin(); iter != second_pathv.end(); ++iter)
+ for (Geom::PathVector::iterator iter = second_pathv.begin(); iter != second_pathv.end(); ++iter)
{
result_pathv.push_back((*iter));
}
diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp
index c8458b8cb..a9a96864a 100644
--- a/src/live_effects/lpe-fillet-chamfer.cpp
+++ b/src/live_effects/lpe-fillet-chamfer.cpp
@@ -16,7 +16,7 @@
#include "live_effects/lpe-fillet-chamfer.h"
#include <2geom/sbasis-to-bezier.h>
-#include <2geom/svg-elliptical-arc.h>
+#include <2geom/elliptical-arc.h>
#include <2geom/line.h>
#include "desktop.h"
@@ -29,7 +29,6 @@
// for programmatically updating knots
#include "ui/tools-switch.h"
-#include <util/units.h>
// TODO due to internal breakage in glibmm headers, this must be last:
#include <glibmm/i18n.h>
@@ -57,7 +56,6 @@ LPEFilletChamfer::LPEFilletChamfer(LivePathEffectObject *lpeobject) :
only_selected(_("Change only selected nodes"), _("Change only selected nodes"), "only_selected", &wr, this, false),
flexible(_("Flexible radius size (%)"), _("Flexible radius size (%)"), "flexible", &wr, this, false),
use_knot_distance(_("Use knots distance instead radius"), _("Use knots distance instead radius"), "use_knot_distance", &wr, this, false),
- unit(_("Unit:"), _("Unit"), "unit", &wr, this),
method(_("Method:"), _("Fillets methods"), "method", FMConverter, &wr, this, FM_AUTO),
radius(_("Radius (unit or %):"), _("Radius, in unit or %"), "radius", &wr, this, 0.),
chamfer_steps(_("Chamfer steps:"), _("Chamfer steps"), "chamfer_steps", &wr, this, 0),
@@ -65,7 +63,6 @@ LPEFilletChamfer::LPEFilletChamfer(LivePathEffectObject *lpeobject) :
helper_size(_("Helper size with direction:"), _("Helper size with direction"), "helper_size", &wr, this, 0)
{
registerParameter(&fillet_chamfer_values);
- registerParameter(&unit);
registerParameter(&method);
registerParameter(&radius);
registerParameter(&chamfer_steps);
@@ -223,7 +220,7 @@ void LPEFilletChamfer::updateFillet()
{
double power = 0;
if (!flexible) {
- power = Inkscape::Util::Quantity::convert(radius, unit.get_abbreviation(), defaultUnit) * -1;
+ power = radius * -1;
} else {
power = radius;
}
@@ -275,11 +272,11 @@ void LPEFilletChamfer::refreshKnots()
}
}
-void LPEFilletChamfer::doUpdateFillet(std::vector<Geom::Path> const& original_pathv, double power)
+void LPEFilletChamfer::doUpdateFillet(Geom::PathVector const &original_pathv, double power)
{
std::vector<Point> filletChamferData = fillet_chamfer_values.data();
std::vector<Geom::Point> result;
- std::vector<Geom::Path> original_pathv_processed = pathv_to_linear_and_cubic_beziers(original_pathv);
+ Geom::PathVector original_pathv_processed = pathv_to_linear_and_cubic_beziers(original_pathv);
int counter = 0;
for (PathVector::const_iterator path_it = original_pathv_processed.begin();
path_it != original_pathv_processed.end(); ++path_it) {
@@ -323,11 +320,11 @@ void LPEFilletChamfer::doUpdateFillet(std::vector<Geom::Path> const& original_pa
fillet_chamfer_values.param_set_and_write_new_value(result);
}
-void LPEFilletChamfer::doChangeType(std::vector<Geom::Path> const& original_pathv, int type)
+void LPEFilletChamfer::doChangeType(Geom::PathVector const &original_pathv, int type)
{
std::vector<Point> filletChamferData = fillet_chamfer_values.data();
std::vector<Geom::Point> result;
- std::vector<Geom::Path> original_pathv_processed = pathv_to_linear_and_cubic_beziers(original_pathv);
+ Geom::PathVector original_pathv_processed = pathv_to_linear_and_cubic_beziers(original_pathv);
int counter = 0;
for (PathVector::const_iterator path_it = original_pathv_processed.begin(); path_it != original_pathv_processed.end(); ++path_it) {
int pathCounter = 0;
@@ -444,9 +441,7 @@ void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem)
} else {
fillet_chamfer_values.set_helper_size(helper_size);
}
- fillet_chamfer_values.set_document_unit(defaultUnit);
fillet_chamfer_values.set_use_distance(use_knot_distance);
- fillet_chamfer_values.set_unit(unit.get_abbreviation());
SPCurve *c = SP_IS_PATH(lpeItem) ? static_cast<SPPath const *>(lpeItem)
->get_original_curve()
: SP_SHAPE(lpeItem)->getCurve();
@@ -466,7 +461,7 @@ int LPEFilletChamfer::getKnotsNumber(SPCurve const *c)
{
int nKnots = c->nodes_in_path();
PathVector const pv = pathv_to_linear_and_cubic_beziers(c->get_pathvector());
- for (std::vector<Geom::Path>::const_iterator path_it = pv.begin();
+ for (Geom::PathVector::const_iterator path_it = pv.begin();
path_it != pv.end(); ++path_it) {
if (!(*path_it).closed()) {
nKnots--;
@@ -476,17 +471,17 @@ int LPEFilletChamfer::getKnotsNumber(SPCurve const *c)
}
void
-LPEFilletChamfer::adjustForNewPath(std::vector<Geom::Path> const &path_in)
+LPEFilletChamfer::adjustForNewPath(Geom::PathVector const &path_in)
{
if (!path_in.empty()) {
fillet_chamfer_values.recalculate_controlpoints_for_new_pwd2(pathv_to_linear_and_cubic_beziers(path_in)[0].toPwSb());
}
}
-std::vector<Geom::Path>
-LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in)
+Geom::PathVector
+LPEFilletChamfer::doEffect_path(Geom::PathVector const &path_in)
{
- std::vector<Geom::Path> pathvector_out;
+ Geom::PathVector pathvector_out;
Piecewise<D2<SBasis> > pwd2_in = paths_to_pw(pathv_to_linear_and_cubic_beziers(path_in));
pwd2_in = remove_short_cuts(pwd2_in, .01);
Piecewise<D2<SBasis> > der = derivative(pwd2_in);
@@ -495,7 +490,7 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in)
std::vector<Point> filletChamferData = fillet_chamfer_values.data();
unsigned int counter = 0;
const double K = (4.0 / 3.0) * (sqrt(2.0) - 1.0);
- std::vector<Geom::Path> path_in_processed = pathv_to_linear_and_cubic_beziers(path_in);
+ Geom::PathVector path_in_processed = pathv_to_linear_and_cubic_beziers(path_in);
for (PathVector::const_iterator path_it = path_in_processed.begin();
path_it != path_in_processed.end(); ++path_it) {
if (path_it->empty())
@@ -548,7 +543,7 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in)
ray2.setPoints(endArcPoint, (*cubic2)[1]);
}
Point handle2 = endArcPoint - Point::polar(ray2.angle(),k2);
- bool ccwToggle = cross(curve_it1->finalPoint() - startArcPoint, endArcPoint - startArcPoint) < 0;
+ bool ccwToggle = cross(curve_it1->finalPoint() - startArcPoint, endArcPoint - startArcPoint) > 0;
double angle = angle_between(ray1, ray2, ccwToggle);
double handleAngle = ray1.angle() - angle;
if (ccwToggle) {
@@ -587,7 +582,7 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in)
Geom::Path path_chamfer;
path_chamfer.start(path_out.finalPoint());
if((is_straight_curve(*curve_it1) && is_straight_curve(*curve_it2Fixed) && method != FM_BEZIER )|| method == FM_ARC){
- path_chamfer.appendNew<SVGEllipticalArc>(rx, ry, angleArc, 0, ccwToggle, endArcPoint);
+ path_chamfer.appendNew<EllipticalArc>(rx, ry, angleArc, 0, ccwToggle, endArcPoint);
} else {
path_chamfer.appendNew<Geom::CubicBezier>(handle1, handle2, endArcPoint);
}
@@ -603,7 +598,7 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in)
path_chamfer.start(path_out.finalPoint());
if((is_straight_curve(*curve_it1) && is_straight_curve(*curve_it2Fixed) && method != FM_BEZIER )|| method == FM_ARC){
ccwToggle = ccwToggle?0:1;
- path_chamfer.appendNew<SVGEllipticalArc>(rx, ry, angleArc, 0, ccwToggle, endArcPoint);
+ path_chamfer.appendNew<EllipticalArc>(rx, ry, angleArc, 0, ccwToggle, endArcPoint);
}else{
path_chamfer.appendNew<Geom::CubicBezier>(inverseHandle1, inverseHandle2, endArcPoint);
}
@@ -616,13 +611,13 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in)
} else if (type == 2) {
if((is_straight_curve(*curve_it1) && is_straight_curve(*curve_it2Fixed) && method != FM_BEZIER )|| method == FM_ARC){
ccwToggle = ccwToggle?0:1;
- path_out.appendNew<SVGEllipticalArc>(rx, ry, angleArc, 0, ccwToggle, endArcPoint);
+ path_out.appendNew<EllipticalArc>(rx, ry, angleArc, 0, ccwToggle, endArcPoint);
}else{
path_out.appendNew<Geom::CubicBezier>(inverseHandle1, inverseHandle2, endArcPoint);
}
} else if (type == 1){
if((is_straight_curve(*curve_it1) && is_straight_curve(*curve_it2Fixed) && method != FM_BEZIER )|| method == FM_ARC){
- path_out.appendNew<SVGEllipticalArc>(rx, ry, angleArc, 0, ccwToggle, endArcPoint);
+ path_out.appendNew<EllipticalArc>(rx, ry, angleArc, 0, ccwToggle, endArcPoint);
} else {
path_out.appendNew<Geom::CubicBezier>(handle1, handle2, endArcPoint);
}
diff --git a/src/live_effects/lpe-fillet-chamfer.h b/src/live_effects/lpe-fillet-chamfer.h
index 0d6a1ff17..290a37f92 100644
--- a/src/live_effects/lpe-fillet-chamfer.h
+++ b/src/live_effects/lpe-fillet-chamfer.h
@@ -15,14 +15,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#if defined(GLIBMM_DISABLE_DEPRECATED) && defined(HAVE_GLIBMM_THREADS_H)
-# include <glibmm/threads.h>
-#endif
-
#include "live_effects/parameter/enum.h"
#include "live_effects/parameter/bool.h"
#include "live_effects/parameter/unit.h"
@@ -45,11 +37,11 @@ public:
LPEFilletChamfer(LivePathEffectObject *lpeobject);
virtual ~LPEFilletChamfer();
- virtual std::vector<Geom::Path> doEffect_path(std::vector<Geom::Path> const &path_in);
+ virtual Geom::PathVector doEffect_path(Geom::PathVector const &path_in);
virtual void doOnApply(SPLPEItem const *lpeItem);
virtual void doBeforeEffect(SPLPEItem const *lpeItem);
- virtual void adjustForNewPath(std::vector<Geom::Path> const &path_in);
+ virtual void adjustForNewPath(Geom::PathVector const &path_in);
virtual Gtk::Widget* newWidget();
int getKnotsNumber(SPCurve const *c);
@@ -61,8 +53,8 @@ public:
void fillet();
void inverseFillet();
void updateFillet();
- void doUpdateFillet(std::vector<Geom::Path> const& original_pathv, double power);
- void doChangeType(std::vector<Geom::Path> const& original_pathv, int type);
+ void doUpdateFillet(Geom::PathVector const& original_pathv, double power);
+ void doChangeType(Geom::PathVector const& original_pathv, int type);
void refreshKnots();
FilletChamferPointArrayParam fillet_chamfer_values;
@@ -74,7 +66,6 @@ private:
BoolParam only_selected;
BoolParam flexible;
BoolParam use_knot_distance;
- UnitParam unit;
EnumParam<FilletMethod> method;
ScalarParam radius;
ScalarParam chamfer_steps;
diff --git a/src/live_effects/lpe-gears.cpp b/src/live_effects/lpe-gears.cpp
index 003e22567..d4d695542 100644
--- a/src/live_effects/lpe-gears.cpp
+++ b/src/live_effects/lpe-gears.cpp
@@ -168,7 +168,7 @@ Geom::Path Gear::path() {
D2<SBasis> root = _arc(cursor, cursor+root_advance, root_radius());
makeContinuous(root, prev);
pb.append(SBasisCurve(root));
- cursor += root_advance;
+ //cursor += root_advance;
prev = root.at1();
if (base_radius() > root_radius()) {
@@ -232,10 +232,10 @@ LPEGears::~LPEGears()
}
-std::vector<Geom::Path>
-LPEGears::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector
+LPEGears::doEffect_path (Geom::PathVector const &path_in)
{
- std::vector<Geom::Path> path_out;
+ Geom::PathVector path_out;
Geom::Path gearpath = path_in[0];
Geom::Path::iterator it(gearpath.begin());
diff --git a/src/live_effects/lpe-gears.h b/src/live_effects/lpe-gears.h
index bd5e4c4f9..5dd6dd239 100644
--- a/src/live_effects/lpe-gears.h
+++ b/src/live_effects/lpe-gears.h
@@ -22,7 +22,7 @@ public:
LPEGears(LivePathEffectObject *lpeobject);
virtual ~LPEGears();
- virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
+ virtual Geom::PathVector doEffect_path(Geom::PathVector const &path_in);
private:
ScalarParam teeth;
diff --git a/src/live_effects/lpe-interpolate.cpp b/src/live_effects/lpe-interpolate.cpp
index e41bc6f0e..b1ad07d23 100644
--- a/src/live_effects/lpe-interpolate.cpp
+++ b/src/live_effects/lpe-interpolate.cpp
@@ -61,7 +61,7 @@ LPEInterpolate::doEffect_path (Geom::PathVector const & path_in)
return path_in;
}
- std::vector<Geom::Path> path_out;
+ Geom::PathVector path_out;
Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2_A = path_in[0].toPwSb();
Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2_B = path_in[1].toPwSb();
diff --git a/src/live_effects/lpe-interpolate.h b/src/live_effects/lpe-interpolate.h
index 679001a81..ef8043e46 100644
--- a/src/live_effects/lpe-interpolate.h
+++ b/src/live_effects/lpe-interpolate.h
@@ -27,7 +27,7 @@ public:
LPEInterpolate(LivePathEffectObject *lpeobject);
virtual ~LPEInterpolate();
- virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
+ virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in);
virtual void resetDefaults(SPItem const* item);
private:
diff --git a/src/live_effects/lpe-interpolate_points.h b/src/live_effects/lpe-interpolate_points.h
index 7a3364747..eb706a320 100644
--- a/src/live_effects/lpe-interpolate_points.h
+++ b/src/live_effects/lpe-interpolate_points.h
@@ -25,7 +25,7 @@ public:
LPEInterpolatePoints(LivePathEffectObject *lpeobject);
virtual ~LPEInterpolatePoints();
- virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
+ virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in);
private:
EnumParam<unsigned> interpolator_type;
diff --git a/src/live_effects/lpe-jointype.cpp b/src/live_effects/lpe-jointype.cpp
index 0111a0f99..28f99eb94 100644
--- a/src/live_effects/lpe-jointype.cpp
+++ b/src/live_effects/lpe-jointype.cpp
@@ -20,7 +20,7 @@
#include "display/curve.h"
#include <2geom/path.h>
-#include <2geom/svg-elliptical-arc.h>
+#include <2geom/elliptical-arc.h>
#include "lpe-jointype.h"
@@ -110,6 +110,7 @@ void LPEJoinType::doOnApply(SPLPEItem const* lpeitem)
sp_repr_css_attr_unref (css);
line_width.param_set_value(width);
+ line_width.write_to_SVG();
}
}
@@ -150,7 +151,7 @@ void LPEJoinType::doOnRemove(SPLPEItem const* lpeitem)
}
}
-std::vector<Geom::Path> LPEJoinType::doEffect_path(std::vector<Geom::Path> const & path_in)
+Geom::PathVector LPEJoinType::doEffect_path(Geom::PathVector const & path_in)
{
Geom::PathVector ret;
for (size_t i = 0; i < path_in.size(); ++i) {
diff --git a/src/live_effects/lpe-jointype.h b/src/live_effects/lpe-jointype.h
index bca0961c9..fddaeb619 100644
--- a/src/live_effects/lpe-jointype.h
+++ b/src/live_effects/lpe-jointype.h
@@ -24,7 +24,7 @@ public:
virtual void doOnApply(SPLPEItem const* lpeitem);
virtual void doOnRemove(SPLPEItem const* lpeitem);
- virtual std::vector <Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
+ virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in);
private:
LPEJoinType(const LPEJoinType&);
diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp
index 820221abf..c3000fe0d 100644
--- a/src/live_effects/lpe-knot.cpp
+++ b/src/live_effects/lpe-knot.cpp
@@ -155,7 +155,7 @@ findShadowedTime(Geom::Path const &patha, std::vector<Geom::Point> const &pt_and
// -for each component, the time at which this crossing occurs + the order of this crossing along the component (when starting from 0).
namespace LPEKnotNS {//just in case...
-CrossingPoints::CrossingPoints(std::vector<Geom::Path> const &paths) : std::vector<CrossingPoint>(){
+CrossingPoints::CrossingPoints(Geom::PathVector const &paths) : std::vector<CrossingPoint>(){
// std::cout<<"\nCrossingPoints creation from path vector\n";
for( unsigned i=0; i<paths.size(); i++){
for( unsigned ii=0; ii < size_nondegenerate(paths[i]); ii++){
@@ -391,11 +391,11 @@ LPEKnot::updateSwitcher(){
}
}
-std::vector<Geom::Path>
-LPEKnot::doEffect_path (std::vector<Geom::Path> const &path_in)
+Geom::PathVector
+LPEKnot::doEffect_path (Geom::PathVector const &path_in)
{
using namespace Geom;
- std::vector<Geom::Path> path_out;
+ Geom::PathVector path_out;
if (gpaths.size()==0){
return path_in;
@@ -433,7 +433,7 @@ LPEKnot::doEffect_path (std::vector<Geom::Path> const &path_in)
std::vector<Point> flag_j = gpaths[j][curveidx].pointAndDerivatives(t,1);
- int geom_sign = ( cross(flag_i[1],flag_j[1]) > 0 ? 1 : -1);
+ int geom_sign = ( cross(flag_i[1], flag_j[1]) < 0 ? 1 : -1);
bool i0_is_under = false;
if ( crossing_points[p].sign * geom_sign > 0 ){
@@ -486,8 +486,9 @@ LPEKnot::doEffect_path (std::vector<Geom::Path> const &path_in)
++beg_comp;
--end_comp;
Path first = gpaths[i0].portion(dom.back());
- //FIXME: STITCH_DISCONTINUOUS should not be necessary (?!?)
- first.append(gpaths[i0].portion(dom.front()), Path::STITCH_DISCONTINUOUS);
+ //FIXME: stitching should not be necessary (?!?)
+ first.setStitching(true);
+ first.append(gpaths[i0].portion(dom.front()));
path_out.push_back(first);
}
}
@@ -503,11 +504,11 @@ LPEKnot::doEffect_path (std::vector<Geom::Path> const &path_in)
//recursively collect gpaths and stroke widths (stolen from "sp-lpe_item.cpp").
static void
-collectPathsAndWidths (SPLPEItem const *lpeitem, std::vector<Geom::Path> &paths, std::vector<double> &stroke_widths){
+collectPathsAndWidths (SPLPEItem const *lpeitem, Geom::PathVector &paths, std::vector<double> &stroke_widths){
if (SP_IS_GROUP(lpeitem)) {
- GSList const *item_list = sp_item_group_item_list(SP_GROUP(lpeitem));
- for ( GSList const *iter = item_list; iter; iter = iter->next ) {
- SPObject *subitem = static_cast<SPObject *>(iter->data);
+ std::vector<SPItem*> item_list = sp_item_group_item_list(SP_GROUP(lpeitem));
+ for ( std::vector<SPItem*>::const_iterator iter = item_list.begin(); iter != item_list.end(); iter++) {
+ SPObject *subitem = *iter;
if (SP_IS_LPE_ITEM(subitem)) {
collectPathsAndWidths(SP_LPE_ITEM(subitem), paths, stroke_widths);
}
@@ -615,8 +616,7 @@ LPEKnot::addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector<Geom::Pat
svgd = "M 10,0 C 10,5.52 5.52,10 0,10 -5.52,10 -10,5.52 -10,0 c 0,-5.52 4.48,-10 10,-10 5.52,0 10,4.48 10,10 z";
}
PathVector pathv = sp_svg_read_pathv(svgd);
- pathv *= Affine(r,0,0,r,0,0);
- pathv += switcher;
+ pathv *= Affine(r,0,0,r,0,0) * Translate(switcher);
hp_vec.push_back(pathv);
}
diff --git a/src/live_effects/lpe-knot.h b/src/live_effects/lpe-knot.h
index 080f32de2..95bfaf6e1 100644
--- a/src/live_effects/lpe-knot.h
+++ b/src/live_effects/lpe-knot.h
@@ -42,8 +42,8 @@ struct CrossingPoint {
class CrossingPoints : public std::vector<CrossingPoint>{
public:
CrossingPoints() : std::vector<CrossingPoint>() {}
- CrossingPoints(Geom::CrossingSet const &cs, std::vector<Geom::Path> const &path);//for self crossings only!
- CrossingPoints(std::vector<Geom::Path> const &paths);
+ CrossingPoints(Geom::CrossingSet const &cs, Geom::PathVector const &path);//for self crossings only!
+ CrossingPoints(Geom::PathVector const &paths);
CrossingPoints(std::vector<double> const &input);
std::vector<double> to_vector();
CrossingPoint get(unsigned const i, unsigned const ni);
@@ -57,7 +57,7 @@ public:
virtual ~LPEKnot();
virtual void doBeforeEffect (SPLPEItem const* lpeitem);
- virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & input_path);
+ virtual Geom::PathVector doEffect_path (Geom::PathVector const & input_path);
/* the knotholder entity classes must be declared friends */
friend class KnotHolderEntityCrossingSwitcher;
@@ -65,7 +65,7 @@ public:
protected:
virtual void addCanvasIndicators(SPLPEItem const *lpeitem, std::vector<Geom::PathVector> &hp_vec);
- std::vector<Geom::Path> supplied_path; //for knotholder business
+ Geom::PathVector supplied_path; //for knotholder business
private:
void updateSwitcher();
@@ -79,7 +79,7 @@ private:
LPEKnotNS::CrossingPoints crossing_points;//topology representation of the knot.
- std::vector<Geom::Path> gpaths;//the collection of all the paths in the object or group.
+ Geom::PathVector gpaths;//the collection of all the paths in the object or group.
std::vector<double> gstroke_widths;//the collection of all the stroke widths in the object or group.
//UI: please, someone, help me to improve this!!
diff --git a/src/live_effects/lpe-lattice2.cpp b/src/live_effects/lpe-lattice2.cpp
index 08bbbd504..8c7f46cbd 100644
--- a/src/live_effects/lpe-lattice2.cpp
+++ b/src/live_effects/lpe-lattice2.cpp
@@ -1,6 +1,6 @@
/** \file
* LPE <lattice2> implementation
-
+
*/
/*
* Authors:
@@ -11,13 +11,15 @@
* ~suv
* Jabiertxo Arraiza
*
-* Copyright (C) 2007-2008 Authors
+* Copyright (C) 2007-2008 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "live_effects/lpe-lattice2.h"
+#include <gtkmm/expander.h>
+
#include "sp-shape.h"
#include "sp-item.h"
#include "sp-path.h"
@@ -42,63 +44,63 @@ namespace LivePathEffect {
LPELattice2::LPELattice2(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
- horizontalMirror(_("Mirror movements in horizontal"), _("Mirror movements in horizontal"), "horizontalMirror", &wr, this, false),
- verticalMirror(_("Mirror movements in vertical"), _("Mirror movements in vertical"), "verticalMirror", &wr, this, false),
- grid_point0(_("Control 0:"), _("Control 0 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint0", &wr, this),
- grid_point1(_("Control 1:"), _("Control 1 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint1", &wr, this),
- grid_point2(_("Control 2:"), _("Control 2 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint2", &wr, this),
- grid_point3(_("Control 3:"), _("Control 3 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint3", &wr, this),
- grid_point4(_("Control 4:"), _("Control 4 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint4", &wr, this),
- grid_point5(_("Control 5:"), _("Control 5 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint5", &wr, this),
- grid_point6(_("Control 6:"), _("Control 6 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint6", &wr, this),
- grid_point7(_("Control 7:"), _("Control 7 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint7", &wr, this),
- grid_point8x9(_("Control 8x9:"), _("Control 8x9 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint8x9", &wr, this),
- grid_point10x11(_("Control 10x11:"), _("Control 10x11 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint10x11", &wr, this),
- grid_point12(_("Control 12:"), _("Control 12 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint12", &wr, this),
- grid_point13(_("Control 13:"), _("Control 13 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint13", &wr, this),
- grid_point14(_("Control 14:"), _("Control 14 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint14", &wr, this),
- grid_point15(_("Control 15:"), _("Control 15 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint15", &wr, this),
- grid_point16(_("Control 16:"), _("Control 16 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint16", &wr, this),
- grid_point17(_("Control 17:"), _("Control 17 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint17", &wr, this),
- grid_point18(_("Control 18:"), _("Control 18 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint18", &wr, this),
- grid_point19(_("Control 19:"), _("Control 19 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint19", &wr, this),
- grid_point20x21(_("Control 20x21:"), _("Control 20x21 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint20x21", &wr, this),
- grid_point22x23(_("Control 22x23:"), _("Control 22x23 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint22x23", &wr, this),
- grid_point24x26(_("Control 24x26:"), _("Control 24x26 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint24x26", &wr, this),
- grid_point25x27(_("Control 25x27:"), _("Control 25x27 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint25x27", &wr, this),
- grid_point28x30(_("Control 28x30:"), _("Control 28x30 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint28x30", &wr, this),
- grid_point29x31(_("Control 29x31:"), _("Control 29x31 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint29x31", &wr, this),
- grid_point32x33x34x35(_("Control 32x33x34x35:"), _("Control 32x33x34x35 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint32x33x34x35", &wr, this),
+ horizontal_mirror(_("Mirror movements in horizontal"), _("Mirror movements in horizontal"), "horizontal_mirror", &wr, this, false),
+ vertical_mirror(_("Mirror movements in vertical"), _("Mirror movements in vertical"), "vertical_mirror", &wr, this, false),
+ grid_point_0(_("Control 0:"), _("Control 0 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint0", &wr, this),
+ grid_point_1(_("Control 1:"), _("Control 1 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint1", &wr, this),
+ grid_point_2(_("Control 2:"), _("Control 2 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint2", &wr, this),
+ grid_point_3(_("Control 3:"), _("Control 3 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint3", &wr, this),
+ grid_point_4(_("Control 4:"), _("Control 4 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint4", &wr, this),
+ grid_point_5(_("Control 5:"), _("Control 5 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint5", &wr, this),
+ grid_point_6(_("Control 6:"), _("Control 6 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint6", &wr, this),
+ grid_point_7(_("Control 7:"), _("Control 7 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint7", &wr, this),
+ grid_point_8x9(_("Control 8x9:"), _("Control 8x9 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint8x9", &wr, this),
+ grid_point_10x11(_("Control 10x11:"), _("Control 10x11 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint10x11", &wr, this),
+ grid_point_12(_("Control 12:"), _("Control 12 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint12", &wr, this),
+ grid_point_13(_("Control 13:"), _("Control 13 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint13", &wr, this),
+ grid_point_14(_("Control 14:"), _("Control 14 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint14", &wr, this),
+ grid_point_15(_("Control 15:"), _("Control 15 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint15", &wr, this),
+ grid_point_16(_("Control 16:"), _("Control 16 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint16", &wr, this),
+ grid_point_17(_("Control 17:"), _("Control 17 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint17", &wr, this),
+ grid_point_18(_("Control 18:"), _("Control 18 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint18", &wr, this),
+ grid_point_19(_("Control 19:"), _("Control 19 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint19", &wr, this),
+ grid_point_20x21(_("Control 20x21:"), _("Control 20x21 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint20x21", &wr, this),
+ grid_point_22x23(_("Control 22x23:"), _("Control 22x23 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint22x23", &wr, this),
+ grid_point_24x26(_("Control 24x26:"), _("Control 24x26 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint24x26", &wr, this),
+ grid_point_25x27(_("Control 25x27:"), _("Control 25x27 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint25x27", &wr, this),
+ grid_point_28x30(_("Control 28x30:"), _("Control 28x30 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint28x30", &wr, this),
+ grid_point_29x31(_("Control 29x31:"), _("Control 29x31 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint29x31", &wr, this),
+ grid_point_32x33x34x35(_("Control 32x33x34x35:"), _("Control 32x33x34x35 - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "gridpoint32x33x34x35", &wr, this),
expanded(false)
{
// register all your parameters here, so Inkscape knows which parameters this effect has:
- registerParameter(&horizontalMirror);
- registerParameter(&verticalMirror);
- registerParameter(&grid_point0);
- registerParameter(&grid_point1);
- registerParameter(&grid_point2);
- registerParameter(&grid_point3);
- registerParameter(&grid_point4);
- registerParameter(&grid_point5);
- registerParameter(&grid_point6);
- registerParameter(&grid_point7);
- registerParameter(&grid_point8x9);
- registerParameter(&grid_point10x11);
- registerParameter(&grid_point12);
- registerParameter(&grid_point13);
- registerParameter(&grid_point14);
- registerParameter(&grid_point15);
- registerParameter(&grid_point16);
- registerParameter(&grid_point17);
- registerParameter(&grid_point18);
- registerParameter(&grid_point19);
- registerParameter(&grid_point20x21);
- registerParameter(&grid_point22x23);
- registerParameter(&grid_point24x26);
- registerParameter(&grid_point25x27);
- registerParameter(&grid_point28x30);
- registerParameter(&grid_point29x31);
- registerParameter(&grid_point32x33x34x35);
+ registerParameter(&horizontal_mirror);
+ registerParameter(&vertical_mirror);
+ registerParameter(&grid_point_0);
+ registerParameter(&grid_point_1);
+ registerParameter(&grid_point_2);
+ registerParameter(&grid_point_3);
+ registerParameter(&grid_point_4);
+ registerParameter(&grid_point_5);
+ registerParameter(&grid_point_6);
+ registerParameter(&grid_point_7);
+ registerParameter(&grid_point_8x9);
+ registerParameter(&grid_point_10x11);
+ registerParameter(&grid_point_12);
+ registerParameter(&grid_point_13);
+ registerParameter(&grid_point_14);
+ registerParameter(&grid_point_15);
+ registerParameter(&grid_point_16);
+ registerParameter(&grid_point_17);
+ registerParameter(&grid_point_18);
+ registerParameter(&grid_point_19);
+ registerParameter(&grid_point_20x21);
+ registerParameter(&grid_point_22x23);
+ registerParameter(&grid_point_24x26);
+ registerParameter(&grid_point_25x27);
+ registerParameter(&grid_point_28x30);
+ registerParameter(&grid_point_29x31);
+ registerParameter(&grid_point_32x33x34x35);
}
LPELattice2::~LPELattice2()
@@ -113,7 +115,7 @@ LPELattice2::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd
PathVector cubic = pathv_to_cubicbezier(pathv);
Geom::Piecewise<Geom::D2<Geom::SBasis> > const &pwd2_in_linear_and_cubic = paths_to_pw(cubic);
D2<SBasis2d> sb2;
-
+
//Initialisation of the sb2
for(unsigned dim = 0; dim < 2; dim++) {
sb2[dim].us = 3;
@@ -125,46 +127,46 @@ LPELattice2::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd
//Grouping the point params in a convenient vector
std::vector<Geom::Point > handles(36);
-
- handles[0] = grid_point0;
- handles[1] = grid_point1;
- handles[2] = grid_point2;
- handles[3] = grid_point3;
- handles[4] = grid_point4;
- handles[5] = grid_point5;
- handles[6] = grid_point6;
- handles[7] = grid_point7;
- handles[8] = grid_point8x9;
- handles[9] = grid_point8x9;
- handles[10] = grid_point10x11;
- handles[11] = grid_point10x11;
- handles[12] = grid_point12;
- handles[13] = grid_point13;
- handles[14] = grid_point14;
- handles[15] = grid_point15;
- handles[16] = grid_point16;
- handles[17] = grid_point17;
- handles[18] = grid_point18;
- handles[19] = grid_point19;
- handles[20] = grid_point20x21;
- handles[21] = grid_point20x21;
- handles[22] = grid_point22x23;
- handles[23] = grid_point22x23;
- handles[24] = grid_point24x26;
- handles[25] = grid_point25x27;
- handles[26] = grid_point24x26;
- handles[27] = grid_point25x27;
- handles[28] = grid_point28x30;
- handles[29] = grid_point29x31;
- handles[30] = grid_point28x30;
- handles[31] = grid_point29x31;
- handles[32] = grid_point32x33x34x35;
- handles[33] = grid_point32x33x34x35;
- handles[34] = grid_point32x33x34x35;
- handles[35] = grid_point32x33x34x35;
+
+ handles[0] = grid_point_0;
+ handles[1] = grid_point_1;
+ handles[2] = grid_point_2;
+ handles[3] = grid_point_3;
+ handles[4] = grid_point_4;
+ handles[5] = grid_point_5;
+ handles[6] = grid_point_6;
+ handles[7] = grid_point_7;
+ handles[8] = grid_point_8x9;
+ handles[9] = grid_point_8x9;
+ handles[10] = grid_point_10x11;
+ handles[11] = grid_point_10x11;
+ handles[12] = grid_point_12;
+ handles[13] = grid_point_13;
+ handles[14] = grid_point_14;
+ handles[15] = grid_point_15;
+ handles[16] = grid_point_16;
+ handles[17] = grid_point_17;
+ handles[18] = grid_point_18;
+ handles[19] = grid_point_19;
+ handles[20] = grid_point_20x21;
+ handles[21] = grid_point_20x21;
+ handles[22] = grid_point_22x23;
+ handles[23] = grid_point_22x23;
+ handles[24] = grid_point_24x26;
+ handles[25] = grid_point_25x27;
+ handles[26] = grid_point_24x26;
+ handles[27] = grid_point_25x27;
+ handles[28] = grid_point_28x30;
+ handles[29] = grid_point_29x31;
+ handles[30] = grid_point_28x30;
+ handles[31] = grid_point_29x31;
+ handles[32] = grid_point_32x33x34x35;
+ handles[33] = grid_point_32x33x34x35;
+ handles[34] = grid_point_32x33x34x35;
+ handles[35] = grid_point_32x33x34x35;
Geom::Point origin = Geom::Point(boundingbox_X.min(),boundingbox_Y.min());
-
+
double width = boundingbox_X.extent();
double height = boundingbox_Y.extent();
@@ -178,16 +180,16 @@ LPELattice2::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd
for(unsigned iu = 0; iu < 2; iu++) {
unsigned corner = iu + 2*iv;
unsigned i = ui + vi*sb2[dim].us;
-
+
//This is the offset from the Upperleft point
Geom::Point base( (ui + iu*(4-2*ui))*width/4.,
(vi + iv*(4-2*vi))*height/4.);
-
+
//Special action for corners
if(vi == 0 && ui == 0) {
base = Geom::Point(0,0);
}
-
+
// i = Upperleft corner of the considerated rectangle
// corner = actual corner of the rectangle
// origin = Upperleft point
@@ -198,7 +200,7 @@ LPELattice2::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd
}
}
}
-
+
Piecewise<D2<SBasis> > output;
output.push_cut(0.);
for(unsigned i = 0; i < pwd2_in_linear_and_cubic.size(); i++) {
@@ -228,28 +230,28 @@ LPELattice2::newWidget()
vbox->set_homogeneous(false);
vbox->set_spacing(6);
Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false,0));
- Gtk::VBox * vboxExpander = Gtk::manage( new Gtk::VBox(Effect::newWidget()) );
- vboxExpander->set_border_width(0);
- vboxExpander->set_spacing(2);
- Gtk::Button * resetButton = Gtk::manage(new Gtk::Button(Glib::ustring(_("Reset grid"))));
- resetButton->signal_clicked().connect(sigc::mem_fun (*this,&LPELattice2::resetGrid));
- resetButton->set_size_request(140,30);
+ Gtk::VBox * vbox_expander = Gtk::manage( new Gtk::VBox(Effect::newWidget()) );
+ vbox_expander->set_border_width(0);
+ vbox_expander->set_spacing(2);
+ Gtk::Button * reset_button = Gtk::manage(new Gtk::Button(Glib::ustring(_("Reset grid"))));
+ reset_button->signal_clicked().connect(sigc::mem_fun (*this,&LPELattice2::resetGrid));
+ reset_button->set_size_request(140,30);
vbox->pack_start(*hbox, true,true,2);
- hbox->pack_start(*resetButton, false, false,2);
+ hbox->pack_start(*reset_button, false, false,2);
std::vector<Parameter *>::iterator it = param_vector.begin();
while (it != param_vector.end()) {
if ((*it)->widget_is_visible) {
Parameter * param = *it;
Gtk::Widget * widg = dynamic_cast<Gtk::Widget *>(param->param_newWidget());
- if(param->param_key == "grid"){
+ if(param->param_key == "grid") {
widg = NULL;
}
Glib::ustring * tip = param->param_getTooltip();
if (widg) {
- if (param->param_key == "horizontalMirror" || param->param_key == "verticalMirror") {
+ if (param->param_key == "horizontal_mirror" || param->param_key == "vertical_mirror") {
vbox->pack_start(*widg, true, true, 2);
} else {
- vboxExpander->pack_start(*widg, true, true, 2);
+ vbox_expander->pack_start(*widg, true, true, 2);
}
if (tip) {
widg->set_tooltip_text(*tip);
@@ -262,63 +264,65 @@ LPELattice2::newWidget()
++it;
}
-
+
expander = Gtk::manage(new Gtk::Expander(Glib::ustring(_("Show Points"))));
- expander->add(*vboxExpander);
+ expander->add(*vbox_expander);
expander->set_expanded(expanded);
vbox->pack_start(*expander, true, true, 2);
- expander->property_expanded().signal_changed().connect(sigc::mem_fun(*this, &LPELattice2::on_expander_changed) );
+ expander->property_expanded().signal_changed().connect(sigc::mem_fun(*this, &LPELattice2::onExpanderChanged) );
return dynamic_cast<Gtk::Widget *>(vbox);
}
void
-LPELattice2::on_expander_changed()
+LPELattice2::onExpanderChanged()
{
expanded = expander->get_expanded();
- if(expander->get_expanded()){
+ if(expander->get_expanded()) {
expander->set_label (Glib::ustring(_("Hide Points")));
} else {
expander->set_label (Glib::ustring(_("Show Points")));
}
}
void
-LPELattice2::vertical(PointParam &paramA, PointParam &paramB, Geom::Line vert){
- Geom::Point A = paramA;
- Geom::Point B = paramB;
+LPELattice2::vertical(PointParam &param_one, PointParam &param_two, Geom::Line vert)
+{
+ Geom::Point A = param_one;
+ Geom::Point B = param_two;
double Y = (A[Geom::Y] + B[Geom::Y])/2;
A[Geom::Y] = Y;
B[Geom::Y] = Y;
- Geom::Point nearest = vert.pointAt(vert.nearestPoint(A));
- double distA = Geom::distance(A,nearest);
- double distB = Geom::distance(B,nearest);
- double distanceMed = (distA + distB)/2;
- if(A[Geom::X] > B[Geom::X]){
- distanceMed *= -1;
+ Geom::Point nearest = vert.pointAt(vert.nearestTime(A));
+ double distance_one = Geom::distance(A,nearest);
+ double distance_two = Geom::distance(B,nearest);
+ double distance_middle = (distance_one + distance_two)/2;
+ if(A[Geom::X] > B[Geom::X]) {
+ distance_middle *= -1;
}
- A[Geom::X] = nearest[Geom::X] - distanceMed;
- B[Geom::X] = nearest[Geom::X] + distanceMed;
- paramA.param_setValue(A, true);
- paramB.param_setValue(B, true);
+ A[Geom::X] = nearest[Geom::X] - distance_middle;
+ B[Geom::X] = nearest[Geom::X] + distance_middle;
+ param_one.param_setValue(A, true);
+ param_two.param_setValue(B, true);
}
void
-LPELattice2::horizontal(PointParam &paramA, PointParam &paramB, Geom::Line horiz){
- Geom::Point A = paramA;
- Geom::Point B = paramB;
+LPELattice2::horizontal(PointParam &param_one, PointParam &param_two, Geom::Line horiz)
+{
+ Geom::Point A = param_one;
+ Geom::Point B = param_two;
double X = (A[Geom::X] + B[Geom::X])/2;
A[Geom::X] = X;
B[Geom::X] = X;
- Geom::Point nearest = horiz.pointAt(horiz.nearestPoint(A));
- double distA = Geom::distance(A,nearest);
- double distB = Geom::distance(B,nearest);
- double distanceMed = (distA + distB)/2;
- if(A[Geom::Y] > B[Geom::Y]){
- distanceMed *= -1;
+ Geom::Point nearest = horiz.pointAt(horiz.nearestTime(A));
+ double distance_one = Geom::distance(A,nearest);
+ double distance_two = Geom::distance(B,nearest);
+ double distance_middle = (distance_one + distance_two)/2;
+ if(A[Geom::Y] > B[Geom::Y]) {
+ distance_middle *= -1;
}
- A[Geom::Y] = nearest[Geom::Y] - distanceMed;
- B[Geom::Y] = nearest[Geom::Y] + distanceMed;
- paramA.param_setValue(A, true);
- paramB.param_setValue(B, true);
+ A[Geom::Y] = nearest[Geom::Y] - distance_middle;
+ B[Geom::Y] = nearest[Geom::Y] + distance_middle;
+ param_one.param_setValue(A, true);
+ param_two.param_setValue(B, true);
}
void
@@ -326,31 +330,31 @@ LPELattice2::doBeforeEffect (SPLPEItem const* lpeitem)
{
original_bbox(lpeitem);
setDefaults();
- Geom::Line vert(grid_point8x9.param_get_default(),grid_point10x11.param_get_default());
- Geom::Line horiz(grid_point24x26.param_get_default(),grid_point25x27.param_get_default());
- if(verticalMirror){
- vertical(grid_point0, grid_point1,vert);
- vertical(grid_point2, grid_point3,vert);
- vertical(grid_point4, grid_point5,vert);
- vertical(grid_point6, grid_point7,vert);
- vertical(grid_point12, grid_point13,vert);
- vertical(grid_point14, grid_point15,vert);
- vertical(grid_point16, grid_point17,vert);
- vertical(grid_point18, grid_point19,vert);
- vertical(grid_point24x26, grid_point25x27,vert);
- vertical(grid_point28x30, grid_point29x31,vert);
+ Geom::Line vert(grid_point_8x9.param_get_default(),grid_point_10x11.param_get_default());
+ Geom::Line horiz(grid_point_24x26.param_get_default(),grid_point_25x27.param_get_default());
+ if(vertical_mirror) {
+ vertical(grid_point_0, grid_point_1,vert);
+ vertical(grid_point_2, grid_point_3,vert);
+ vertical(grid_point_4, grid_point_5,vert);
+ vertical(grid_point_6, grid_point_7,vert);
+ vertical(grid_point_12, grid_point_13,vert);
+ vertical(grid_point_14, grid_point_15,vert);
+ vertical(grid_point_16, grid_point_17,vert);
+ vertical(grid_point_18, grid_point_19,vert);
+ vertical(grid_point_24x26, grid_point_25x27,vert);
+ vertical(grid_point_28x30, grid_point_29x31,vert);
}
- if(horizontalMirror){
- horizontal(grid_point0, grid_point2,horiz);
- horizontal(grid_point1, grid_point3,horiz);
- horizontal(grid_point4, grid_point6,horiz);
- horizontal(grid_point5, grid_point7,horiz);
- horizontal(grid_point8x9, grid_point10x11,horiz);
- horizontal(grid_point12, grid_point14,horiz);
- horizontal(grid_point13, grid_point15,horiz);
- horizontal(grid_point16, grid_point18,horiz);
- horizontal(grid_point17, grid_point19,horiz);
- horizontal(grid_point20x21, grid_point22x23,horiz);
+ if(horizontal_mirror) {
+ horizontal(grid_point_0, grid_point_2,horiz);
+ horizontal(grid_point_1, grid_point_3,horiz);
+ horizontal(grid_point_4, grid_point_6,horiz);
+ horizontal(grid_point_5, grid_point_7,horiz);
+ horizontal(grid_point_8x9, grid_point_10x11,horiz);
+ horizontal(grid_point_12, grid_point_14,horiz);
+ horizontal(grid_point_13, grid_point_15,horiz);
+ horizontal(grid_point_16, grid_point_18,horiz);
+ horizontal(grid_point_17, grid_point_19,horiz);
+ horizontal(grid_point_20x21, grid_point_22x23,horiz);
}
SPLPEItem * item = const_cast<SPLPEItem*>(lpeitem);
item->apply_to_clippath(item);
@@ -385,111 +389,111 @@ LPELattice2::setDefaults()
(boundingbox_Y.max()-boundingbox_Y.min())/4*4+boundingbox_Y.min());
Geom::Point gp8x9((boundingbox_X.max()-boundingbox_X.min())/4*2+boundingbox_X.min(),
- (boundingbox_Y.max()-boundingbox_Y.min())/4*0+boundingbox_Y.min());
+ (boundingbox_Y.max()-boundingbox_Y.min())/4*0+boundingbox_Y.min());
Geom::Point gp10x11((boundingbox_X.max()-boundingbox_X.min())/4*2+boundingbox_X.min(),
- (boundingbox_Y.max()-boundingbox_Y.min())/4*4+boundingbox_Y.min());
+ (boundingbox_Y.max()-boundingbox_Y.min())/4*4+boundingbox_Y.min());
Geom::Point gp12((boundingbox_X.max()-boundingbox_X.min())/4*0+boundingbox_X.min(),
- (boundingbox_Y.max()-boundingbox_Y.min())/4*1+boundingbox_Y.min());
+ (boundingbox_Y.max()-boundingbox_Y.min())/4*1+boundingbox_Y.min());
Geom::Point gp13((boundingbox_X.max()-boundingbox_X.min())/4*4+boundingbox_X.min(),
- (boundingbox_Y.max()-boundingbox_Y.min())/4*1+boundingbox_Y.min());
+ (boundingbox_Y.max()-boundingbox_Y.min())/4*1+boundingbox_Y.min());
Geom::Point gp14((boundingbox_X.max()-boundingbox_X.min())/4*0+boundingbox_X.min(),
- (boundingbox_Y.max()-boundingbox_Y.min())/4*3+boundingbox_Y.min());
+ (boundingbox_Y.max()-boundingbox_Y.min())/4*3+boundingbox_Y.min());
Geom::Point gp15((boundingbox_X.max()-boundingbox_X.min())/4*4+boundingbox_X.min(),
- (boundingbox_Y.max()-boundingbox_Y.min())/4*3+boundingbox_Y.min());
+ (boundingbox_Y.max()-boundingbox_Y.min())/4*3+boundingbox_Y.min());
Geom::Point gp16((boundingbox_X.max()-boundingbox_X.min())/4*1+boundingbox_X.min(),
- (boundingbox_Y.max()-boundingbox_Y.min())/4*1+boundingbox_Y.min());
+ (boundingbox_Y.max()-boundingbox_Y.min())/4*1+boundingbox_Y.min());
Geom::Point gp17((boundingbox_X.max()-boundingbox_X.min())/4*3+boundingbox_X.min(),
- (boundingbox_Y.max()-boundingbox_Y.min())/4*1+boundingbox_Y.min());
+ (boundingbox_Y.max()-boundingbox_Y.min())/4*1+boundingbox_Y.min());
Geom::Point gp18((boundingbox_X.max()-boundingbox_X.min())/4*1+boundingbox_X.min(),
- (boundingbox_Y.max()-boundingbox_Y.min())/4*3+boundingbox_Y.min());
+ (boundingbox_Y.max()-boundingbox_Y.min())/4*3+boundingbox_Y.min());
Geom::Point gp19((boundingbox_X.max()-boundingbox_X.min())/4*3+boundingbox_X.min(),
- (boundingbox_Y.max()-boundingbox_Y.min())/4*3+boundingbox_Y.min());
+ (boundingbox_Y.max()-boundingbox_Y.min())/4*3+boundingbox_Y.min());
Geom::Point gp20x21((boundingbox_X.max()-boundingbox_X.min())/4*2+boundingbox_X.min(),
- (boundingbox_Y.max()-boundingbox_Y.min())/4*1+boundingbox_Y.min());
+ (boundingbox_Y.max()-boundingbox_Y.min())/4*1+boundingbox_Y.min());
Geom::Point gp22x23((boundingbox_X.max()-boundingbox_X.min())/4*2+boundingbox_X.min(),
- (boundingbox_Y.max()-boundingbox_Y.min())/4*3+boundingbox_Y.min());
+ (boundingbox_Y.max()-boundingbox_Y.min())/4*3+boundingbox_Y.min());
Geom::Point gp24x26((boundingbox_X.max()-boundingbox_X.min())/4*0+boundingbox_X.min(),
- (boundingbox_Y.max()-boundingbox_Y.min())/4*2+boundingbox_Y.min());
+ (boundingbox_Y.max()-boundingbox_Y.min())/4*2+boundingbox_Y.min());
Geom::Point gp25x27((boundingbox_X.max()-boundingbox_X.min())/4*4+boundingbox_X.min(),
- (boundingbox_Y.max()-boundingbox_Y.min())/4*2+boundingbox_Y.min());
+ (boundingbox_Y.max()-boundingbox_Y.min())/4*2+boundingbox_Y.min());
Geom::Point gp28x30((boundingbox_X.max()-boundingbox_X.min())/4*1+boundingbox_X.min(),
- (boundingbox_Y.max()-boundingbox_Y.min())/4*2+boundingbox_Y.min());
+ (boundingbox_Y.max()-boundingbox_Y.min())/4*2+boundingbox_Y.min());
Geom::Point gp29x31((boundingbox_X.max()-boundingbox_X.min())/4*3+boundingbox_X.min(),
- (boundingbox_Y.max()-boundingbox_Y.min())/4*2+boundingbox_Y.min());
+ (boundingbox_Y.max()-boundingbox_Y.min())/4*2+boundingbox_Y.min());
Geom::Point gp32x33x34x35((boundingbox_X.max()-boundingbox_X.min())/4*2+boundingbox_X.min(),
- (boundingbox_Y.max()-boundingbox_Y.min())/4*2+boundingbox_Y.min());
-
- grid_point0.param_update_default(gp0);
- grid_point1.param_update_default(gp1);
- grid_point2.param_update_default(gp2);
- grid_point3.param_update_default(gp3);
- grid_point4.param_update_default(gp4);
- grid_point5.param_update_default(gp5);
- grid_point6.param_update_default(gp6);
- grid_point7.param_update_default(gp7);
- grid_point8x9.param_update_default(gp8x9);
- grid_point10x11.param_update_default(gp10x11);
- grid_point12.param_update_default(gp12);
- grid_point13.param_update_default(gp13);
- grid_point14.param_update_default(gp14);
- grid_point15.param_update_default(gp15);
- grid_point16.param_update_default(gp16);
- grid_point17.param_update_default(gp17);
- grid_point18.param_update_default(gp18);
- grid_point19.param_update_default(gp19);
- grid_point20x21.param_update_default(gp20x21);
- grid_point22x23.param_update_default(gp22x23);
- grid_point24x26.param_update_default(gp24x26);
- grid_point25x27.param_update_default(gp25x27);
- grid_point28x30.param_update_default(gp28x30);
- grid_point29x31.param_update_default(gp29x31);
- grid_point32x33x34x35.param_update_default(gp32x33x34x35);
+ (boundingbox_Y.max()-boundingbox_Y.min())/4*2+boundingbox_Y.min());
+
+ grid_point_0.param_update_default(gp0);
+ grid_point_1.param_update_default(gp1);
+ grid_point_2.param_update_default(gp2);
+ grid_point_3.param_update_default(gp3);
+ grid_point_4.param_update_default(gp4);
+ grid_point_5.param_update_default(gp5);
+ grid_point_6.param_update_default(gp6);
+ grid_point_7.param_update_default(gp7);
+ grid_point_8x9.param_update_default(gp8x9);
+ grid_point_10x11.param_update_default(gp10x11);
+ grid_point_12.param_update_default(gp12);
+ grid_point_13.param_update_default(gp13);
+ grid_point_14.param_update_default(gp14);
+ grid_point_15.param_update_default(gp15);
+ grid_point_16.param_update_default(gp16);
+ grid_point_17.param_update_default(gp17);
+ grid_point_18.param_update_default(gp18);
+ grid_point_19.param_update_default(gp19);
+ grid_point_20x21.param_update_default(gp20x21);
+ grid_point_22x23.param_update_default(gp22x23);
+ grid_point_24x26.param_update_default(gp24x26);
+ grid_point_25x27.param_update_default(gp25x27);
+ grid_point_28x30.param_update_default(gp28x30);
+ grid_point_29x31.param_update_default(gp29x31);
+ grid_point_32x33x34x35.param_update_default(gp32x33x34x35);
}
void
LPELattice2::resetGrid()
{
- grid_point0.param_set_default();
- grid_point1.param_set_default();
- grid_point2.param_set_default();
- grid_point3.param_set_default();
- grid_point4.param_set_default();
- grid_point5.param_set_default();
- grid_point6.param_set_default();
- grid_point7.param_set_default();
- grid_point8x9.param_set_default();
- grid_point10x11.param_set_default();
- grid_point12.param_set_default();
- grid_point13.param_set_default();
- grid_point14.param_set_default();
- grid_point15.param_set_default();
- grid_point16.param_set_default();
- grid_point17.param_set_default();
- grid_point18.param_set_default();
- grid_point19.param_set_default();
- grid_point20x21.param_set_default();
- grid_point22x23.param_set_default();
- grid_point24x26.param_set_default();
- grid_point25x27.param_set_default();
- grid_point28x30.param_set_default();
- grid_point29x31.param_set_default();
- grid_point32x33x34x35.param_set_default();
+ grid_point_0.param_set_default();
+ grid_point_1.param_set_default();
+ grid_point_2.param_set_default();
+ grid_point_3.param_set_default();
+ grid_point_4.param_set_default();
+ grid_point_5.param_set_default();
+ grid_point_6.param_set_default();
+ grid_point_7.param_set_default();
+ grid_point_8x9.param_set_default();
+ grid_point_10x11.param_set_default();
+ grid_point_12.param_set_default();
+ grid_point_13.param_set_default();
+ grid_point_14.param_set_default();
+ grid_point_15.param_set_default();
+ grid_point_16.param_set_default();
+ grid_point_17.param_set_default();
+ grid_point_18.param_set_default();
+ grid_point_19.param_set_default();
+ grid_point_20x21.param_set_default();
+ grid_point_22x23.param_set_default();
+ grid_point_24x26.param_set_default();
+ grid_point_25x27.param_set_default();
+ grid_point_28x30.param_set_default();
+ grid_point_29x31.param_set_default();
+ grid_point_32x33x34x35.param_set_default();
}
void
@@ -519,55 +523,55 @@ LPELattice2::addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector<Geom:
hp_vec.clear();
SPCurve *c = new SPCurve();
- calculateCurve(grid_point0,grid_point4, c,true, true);
- calculateCurve(grid_point4,grid_point8x9, c,true, false);
- calculateCurve(grid_point8x9,grid_point5, c,true, false);
- calculateCurve(grid_point5,grid_point1, c,true, false);
-
- calculateCurve(grid_point12,grid_point16, c,true, true);
- calculateCurve(grid_point16,grid_point20x21, c,true, false);
- calculateCurve(grid_point20x21,grid_point17, c,true, false);
- calculateCurve(grid_point17,grid_point13, c,true, false);
-
- calculateCurve(grid_point24x26,grid_point28x30, c,true, true);
- calculateCurve(grid_point28x30,grid_point32x33x34x35, c,true, false);
- calculateCurve(grid_point32x33x34x35,grid_point29x31, c,true, false);
- calculateCurve(grid_point29x31,grid_point25x27, c,true, false);
-
- calculateCurve(grid_point14,grid_point18, c,true, true);
- calculateCurve(grid_point18,grid_point22x23, c,true, false);
- calculateCurve(grid_point22x23,grid_point19, c,true, false);
- calculateCurve(grid_point19,grid_point15, c,true, false);
-
- calculateCurve(grid_point2,grid_point6, c,true, true);
- calculateCurve(grid_point6,grid_point10x11, c,true, false);
- calculateCurve(grid_point10x11,grid_point7, c,true, false);
- calculateCurve(grid_point7,grid_point3, c,true, false);
-
- calculateCurve(grid_point0,grid_point12, c,false, true);
- calculateCurve(grid_point12,grid_point24x26, c,false, false);
- calculateCurve(grid_point24x26,grid_point14, c,false, false);
- calculateCurve(grid_point14,grid_point2, c,false, false);
-
- calculateCurve(grid_point4,grid_point16, c,false, true);
- calculateCurve(grid_point16,grid_point28x30, c,false, false);
- calculateCurve(grid_point28x30,grid_point18, c,false, false);
- calculateCurve(grid_point18,grid_point6, c,false, false);
-
- calculateCurve(grid_point8x9,grid_point20x21, c,false, true);
- calculateCurve(grid_point20x21,grid_point32x33x34x35, c,false, false);
- calculateCurve(grid_point32x33x34x35,grid_point22x23, c,false, false);
- calculateCurve(grid_point22x23,grid_point10x11, c,false, false);
-
- calculateCurve(grid_point5,grid_point17, c, false, true);
- calculateCurve(grid_point17,grid_point29x31, c,false, false);
- calculateCurve(grid_point29x31,grid_point19, c,false, false);
- calculateCurve(grid_point19,grid_point7, c,false, false);
-
- calculateCurve(grid_point1,grid_point13, c, false, true);
- calculateCurve(grid_point13,grid_point25x27, c,false, false);
- calculateCurve(grid_point25x27,grid_point15, c,false, false);
- calculateCurve(grid_point15,grid_point3, c, false, false);
+ calculateCurve(grid_point_0,grid_point_4, c,true, true);
+ calculateCurve(grid_point_4,grid_point_8x9, c,true, false);
+ calculateCurve(grid_point_8x9,grid_point_5, c,true, false);
+ calculateCurve(grid_point_5,grid_point_1, c,true, false);
+
+ calculateCurve(grid_point_12,grid_point_16, c,true, true);
+ calculateCurve(grid_point_16,grid_point_20x21, c,true, false);
+ calculateCurve(grid_point_20x21,grid_point_17, c,true, false);
+ calculateCurve(grid_point_17,grid_point_13, c,true, false);
+
+ calculateCurve(grid_point_24x26,grid_point_28x30, c,true, true);
+ calculateCurve(grid_point_28x30,grid_point_32x33x34x35, c,true, false);
+ calculateCurve(grid_point_32x33x34x35,grid_point_29x31, c,true, false);
+ calculateCurve(grid_point_29x31,grid_point_25x27, c,true, false);
+
+ calculateCurve(grid_point_14,grid_point_18, c,true, true);
+ calculateCurve(grid_point_18,grid_point_22x23, c,true, false);
+ calculateCurve(grid_point_22x23,grid_point_19, c,true, false);
+ calculateCurve(grid_point_19,grid_point_15, c,true, false);
+
+ calculateCurve(grid_point_2,grid_point_6, c,true, true);
+ calculateCurve(grid_point_6,grid_point_10x11, c,true, false);
+ calculateCurve(grid_point_10x11,grid_point_7, c,true, false);
+ calculateCurve(grid_point_7,grid_point_3, c,true, false);
+
+ calculateCurve(grid_point_0,grid_point_12, c,false, true);
+ calculateCurve(grid_point_12,grid_point_24x26, c,false, false);
+ calculateCurve(grid_point_24x26,grid_point_14, c,false, false);
+ calculateCurve(grid_point_14,grid_point_2, c,false, false);
+
+ calculateCurve(grid_point_4,grid_point_16, c,false, true);
+ calculateCurve(grid_point_16,grid_point_28x30, c,false, false);
+ calculateCurve(grid_point_28x30,grid_point_18, c,false, false);
+ calculateCurve(grid_point_18,grid_point_6, c,false, false);
+
+ calculateCurve(grid_point_8x9,grid_point_20x21, c,false, true);
+ calculateCurve(grid_point_20x21,grid_point_32x33x34x35, c,false, false);
+ calculateCurve(grid_point_32x33x34x35,grid_point_22x23, c,false, false);
+ calculateCurve(grid_point_22x23,grid_point_10x11, c,false, false);
+
+ calculateCurve(grid_point_5,grid_point_17, c, false, true);
+ calculateCurve(grid_point_17,grid_point_29x31, c,false, false);
+ calculateCurve(grid_point_29x31,grid_point_19, c,false, false);
+ calculateCurve(grid_point_19,grid_point_7, c,false, false);
+
+ calculateCurve(grid_point_1,grid_point_13, c, false, true);
+ calculateCurve(grid_point_13,grid_point_25x27, c,false, false);
+ calculateCurve(grid_point_25x27,grid_point_15, c,false, false);
+ calculateCurve(grid_point_15,grid_point_3, c, false, false);
hp_vec.push_back(c->get_pathvector());
}
diff --git a/src/live_effects/lpe-lattice2.h b/src/live_effects/lpe-lattice2.h
index 086bdab7e..b32903c9e 100644
--- a/src/live_effects/lpe-lattice2.h
+++ b/src/live_effects/lpe-lattice2.h
@@ -18,12 +18,16 @@
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#include <gtkmm.h>
#include "live_effects/parameter/enum.h"
+#include <gtkmm/widget.h>
#include "live_effects/effect.h"
#include "live_effects/parameter/point.h"
#include "live_effects/lpegroupbbox.h"
+namespace Gtk {
+class Expander;
+}
+
namespace Inkscape {
namespace LivePathEffect {
@@ -34,7 +38,7 @@ public:
virtual ~LPELattice2();
virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
-
+
virtual void resetDefaults(SPItem const* item);
virtual void doBeforeEffect(SPLPEItem const* lpeitem);
@@ -49,46 +53,41 @@ public:
virtual void setDefaults();
- virtual void on_expander_changed();
+ virtual void onExpanderChanged();
virtual void resetGrid();
- //virtual void original_bbox(SPLPEItem const* lpeitem, bool absolute = false);
-
- //virtual void addCanvasIndicators(SPLPEItem const*/*lpeitem*/, std::vector<Geom::PathVector> &/*hp_vec*/);
-
- //virtual std::vector<Geom::PathVector> getHelperPaths(SPLPEItem const* lpeitem);
protected:
void addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector<Geom::PathVector> &hp_vec);
private:
- BoolParam horizontalMirror;
- BoolParam verticalMirror;
- PointParam grid_point0;
- PointParam grid_point1;
- PointParam grid_point2;
- PointParam grid_point3;
- PointParam grid_point4;
- PointParam grid_point5;
- PointParam grid_point6;
- PointParam grid_point7;
- PointParam grid_point8x9;
- PointParam grid_point10x11;
- PointParam grid_point12;
- PointParam grid_point13;
- PointParam grid_point14;
- PointParam grid_point15;
- PointParam grid_point16;
- PointParam grid_point17;
- PointParam grid_point18;
- PointParam grid_point19;
- PointParam grid_point20x21;
- PointParam grid_point22x23;
- PointParam grid_point24x26;
- PointParam grid_point25x27;
- PointParam grid_point28x30;
- PointParam grid_point29x31;
- PointParam grid_point32x33x34x35;
+ BoolParam horizontal_mirror;
+ BoolParam vertical_mirror;
+ PointParam grid_point_0;
+ PointParam grid_point_1;
+ PointParam grid_point_2;
+ PointParam grid_point_3;
+ PointParam grid_point_4;
+ PointParam grid_point_5;
+ PointParam grid_point_6;
+ PointParam grid_point_7;
+ PointParam grid_point_8x9;
+ PointParam grid_point_10x11;
+ PointParam grid_point_12;
+ PointParam grid_point_13;
+ PointParam grid_point_14;
+ PointParam grid_point_15;
+ PointParam grid_point_16;
+ PointParam grid_point_17;
+ PointParam grid_point_18;
+ PointParam grid_point_19;
+ PointParam grid_point_20x21;
+ PointParam grid_point_22x23;
+ PointParam grid_point_24x26;
+ PointParam grid_point_25x27;
+ PointParam grid_point_28x30;
+ PointParam grid_point_29x31;
+ PointParam grid_point_32x33x34x35;
bool expanded;
Gtk::Expander * expander;
diff --git a/src/live_effects/lpe-line_segment.cpp b/src/live_effects/lpe-line_segment.cpp
index 78d286143..dfd8aea8f 100644
--- a/src/live_effects/lpe-line_segment.cpp
+++ b/src/live_effects/lpe-line_segment.cpp
@@ -48,16 +48,16 @@ LPELineSegment::doBeforeEffect (SPLPEItem const* lpeitem)
Inkscape::UI::Tools::lpetool_get_limiting_bbox_corners(lpeitem->document, bboxA, bboxB);
}
-std::vector<Geom::Path>
-LPELineSegment::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector
+LPELineSegment::doEffect_path (Geom::PathVector const & path_in)
{
- std::vector<Geom::Path> output;
+ Geom::PathVector output;
- A = initialPoint(path_in);
- B = finalPoint(path_in);
+ A = path_in.initialPoint();
+ B = path_in.finalPoint();
Geom::Rect dummyRect(bboxA, bboxB);
- boost::optional<Geom::LineSegment> intersection_segment = Geom::rect_line_intersect(dummyRect, Geom::Line(A, B));
+ boost::optional<Geom::LineSegment> intersection_segment = Geom::Line(A, B).clip(dummyRect);
if (!intersection_segment) {
g_print ("Possible error - no intersection with limiting bounding box.\n");
@@ -65,11 +65,11 @@ LPELineSegment::doEffect_path (std::vector<Geom::Path> const & path_in)
}
if (end_type == END_OPEN_INITIAL || end_type == END_OPEN_BOTH) {
- A = (*intersection_segment).initialPoint();
+ A = intersection_segment->initialPoint();
}
if (end_type == END_OPEN_FINAL || end_type == END_OPEN_BOTH) {
- B = (*intersection_segment).finalPoint();
+ B = intersection_segment->finalPoint();
}
Geom::Path path(A);
diff --git a/src/live_effects/lpe-line_segment.h b/src/live_effects/lpe-line_segment.h
index 1a57688b6..def828fe2 100644
--- a/src/live_effects/lpe-line_segment.h
+++ b/src/live_effects/lpe-line_segment.h
@@ -34,7 +34,7 @@ public:
virtual void doBeforeEffect (SPLPEItem const* lpeitem);
- virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
+ virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in);
//private:
EnumParam<EndType> end_type;
diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp
index 0bb67a4a2..783053df2 100644
--- a/src/live_effects/lpe-mirror_symmetry.cpp
+++ b/src/live_effects/lpe-mirror_symmetry.cpp
@@ -64,24 +64,24 @@ LPEMirrorSymmetry::doOnApply (SPLPEItem const* lpeitem)
Point B(bbox.left(), bbox.top());
A *= t;
B *= t;
- Piecewise<D2<SBasis> > rline = Piecewise<D2<SBasis> >(D2<SBasis>(Linear(A[X], B[X]), Linear(A[Y], B[Y])));
+ Piecewise<D2<SBasis> > rline = Piecewise<D2<SBasis> >(D2<SBasis>(SBasis(A[X], B[X]), SBasis(A[Y], B[Y])));
reflection_line.set_new_value(rline, true);
}
-std::vector<Geom::Path>
-LPEMirrorSymmetry::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector
+LPEMirrorSymmetry::doEffect_path (Geom::PathVector const & path_in)
{
// Don't allow empty path parameter:
if ( reflection_line.get_pathvector().empty() ) {
return path_in;
}
- std::vector<Geom::Path> path_out;
+ Geom::PathVector path_out;
if (!discard_orig_path) {
path_out = path_in;
}
- std::vector<Geom::Path> mline(reflection_line.get_pathvector());
+ Geom::PathVector mline(reflection_line.get_pathvector());
Geom::Point A(mline.front().initialPoint());
Geom::Point B(mline.back().finalPoint());
diff --git a/src/live_effects/lpe-mirror_symmetry.h b/src/live_effects/lpe-mirror_symmetry.h
index a4a2b86c0..7a484a473 100644
--- a/src/live_effects/lpe-mirror_symmetry.h
+++ b/src/live_effects/lpe-mirror_symmetry.h
@@ -32,7 +32,7 @@ public:
virtual void doBeforeEffect (SPLPEItem const* lpeitem);
- virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
+ virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in);
private:
BoolParam discard_orig_path;
diff --git a/src/live_effects/lpe-offset.cpp b/src/live_effects/lpe-offset.cpp
index ba7179476..dd7af92a2 100644
--- a/src/live_effects/lpe-offset.cpp
+++ b/src/live_effects/lpe-offset.cpp
@@ -20,7 +20,7 @@
#include <2geom/path.h>
#include <2geom/piecewise.h>
#include <2geom/sbasis-geometric.h>
-#include <2geom/svg-elliptical-arc.h>
+#include <2geom/elliptical-arc.h>
#include <2geom/transforms.h>
namespace Inkscape {
@@ -52,7 +52,7 @@ static void append_half_circle(Geom::Piecewise<Geom::D2<Geom::SBasis> > &pwd2,
using namespace Geom;
double r = L2(dir);
- SVGEllipticalArc cap(center + dir, r, r, angle_between(Point(1,0), dir), false, false, center - dir);
+ EllipticalArc cap(center + dir, r, r, angle_between(Point(1,0), dir), false, false, center - dir);
Piecewise<D2<SBasis> > cap_pwd2(cap.toSBasis());
pwd2.continuousConcat(cap_pwd2);
}
@@ -72,7 +72,7 @@ LPEOffset::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_
Piecewise<D2<SBasis> > output;
- double t = nearest_point(offset_pt, pwd2_in);
+ double t = nearest_time(offset_pt, pwd2_in);
Point A = pwd2_in.valueAt(t);
double offset = L2(A - offset_pt);
diff --git a/src/live_effects/lpe-parallel.cpp b/src/live_effects/lpe-parallel.cpp
index aa7405607..23cd5e2e7 100644
--- a/src/live_effects/lpe-parallel.cpp
+++ b/src/live_effects/lpe-parallel.cpp
@@ -91,7 +91,7 @@ LPEParallel::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd
C = offset_pt - dir * length_left;
D = offset_pt + dir * length_right;
- output = Piecewise<D2<SBasis> >(D2<SBasis>(Linear(C[X], D[X]), Linear(C[Y], D[Y])));
+ output = Piecewise<D2<SBasis> >(D2<SBasis>(SBasis(C[X], D[X]), SBasis(C[Y], D[Y])));
return output + dir;
}
diff --git a/src/live_effects/lpe-perp_bisector.cpp b/src/live_effects/lpe-perp_bisector.cpp
index feed55b26..660318c57 100644
--- a/src/live_effects/lpe-perp_bisector.cpp
+++ b/src/live_effects/lpe-perp_bisector.cpp
@@ -67,7 +67,7 @@ KnotHolderEntityEnd::bisector_end_set(Geom::Point const &p, guint state, bool le
Geom::Point const s = snap_knot_position(p, state);
- double lambda = Geom::nearest_point(s, lpe->M, lpe->perp_dir);
+ double lambda = Geom::nearest_time(s, lpe->M, lpe->perp_dir);
if (left) {
lpe->C = lpe->M + lpe->perp_dir * lambda;
lpe->length_left.param_set_value(lambda);
@@ -146,7 +146,7 @@ LPEPerpBisector::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const &
C = M + perp_dir * length_left;
D = M - perp_dir * length_right;
- output = Piecewise<D2<SBasis> >(D2<SBasis>(Linear(C[X], D[X]), Linear(C[Y], D[Y])));
+ output = Piecewise<D2<SBasis> >(D2<SBasis>(SBasis(C[X], D[X]), SBasis(C[Y], D[Y])));
return output;
}
diff --git a/src/live_effects/lpe-perspective-envelope.cpp b/src/live_effects/lpe-perspective-envelope.cpp
index b5885bdb3..72c1b0e99 100644
--- a/src/live_effects/lpe-perspective-envelope.cpp
+++ b/src/live_effects/lpe-perspective-envelope.cpp
@@ -1,6 +1,6 @@
/** \file
* LPE <perspective-envelope> implementation
-
+
*/
/*
* Authors:
@@ -8,8 +8,8 @@
* Aaron Spike, aaron@ekips.org from envelope and perspective phyton code
* Dmitry Platonov, shadowjack@mail.ru, 2006 perspective approach & math
* Jose Hevia (freon) Transform algorithm from envelope
- *
- * Copyright (C) 2007-2014 Authors
+ *
+ * Copyright (C) 2007-2014 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
@@ -27,8 +27,8 @@ namespace Inkscape {
namespace LivePathEffect {
enum DeformationType {
- DEFORMATION_PERSPECTIVE,
- DEFORMATION_ENVELOPE
+ DEFORMATION_PERSPECTIVE,
+ DEFORMATION_ENVELOPE
};
static const Util::EnumData<unsigned> DeformationTypeData[] = {
@@ -40,54 +40,65 @@ static const Util::EnumDataConverter<unsigned> DeformationTypeConverter(Deformat
LPEPerspectiveEnvelope::LPEPerspectiveEnvelope(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
- // initialise your parameters here:
+ horizontal_mirror(_("Mirror movements in horizontal"), _("Mirror movements in horizontal"), "horizontal_mirror", &wr, this, false),
+ vertical_mirror(_("Mirror movements in vertical"), _("Mirror movements in vertical"), "vertical_mirror", &wr, this, false),
deform_type(_("Type"), _("Select the type of deformation"), "deform_type", DeformationTypeConverter, &wr, this, DEFORMATION_PERSPECTIVE),
- Up_Left_Point(_("Top Left"), _("Top Left - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "Up_Left_Point", &wr, this),
- Up_Right_Point(_("Top Right"), _("Top Right - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "Up_Right_Point", &wr, this),
- Down_Left_Point(_("Down Left"), _("Down Left - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "Down_Left_Point", &wr, this),
- Down_Right_Point(_("Down Right"), _("Down Right - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "Down_Right_Point", &wr, this)
+ up_left_point(_("Top Left"), _("Top Left - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "up_left_point", &wr, this),
+ up_right_point(_("Top Right"), _("Top Right - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "up_right_point", &wr, this),
+ down_left_point(_("Down Left"), _("Down Left - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "down_left_point", &wr, this),
+ down_right_point(_("Down Right"), _("Down Right - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "down_right_point", &wr, this)
{
// register all your parameters here, so Inkscape knows which parameters this effect has:
registerParameter(&deform_type);
- registerParameter(&Up_Left_Point);
- registerParameter(&Up_Right_Point);
- registerParameter(&Down_Left_Point);
- registerParameter(&Down_Right_Point);
+ registerParameter(&horizontal_mirror);
+ registerParameter(&vertical_mirror);
+ registerParameter(&up_left_point);
+ registerParameter(&up_right_point);
+ registerParameter(&down_left_point);
+ registerParameter(&down_right_point);
}
LPEPerspectiveEnvelope::~LPEPerspectiveEnvelope()
{
}
-void LPEPerspectiveEnvelope::doEffect(SPCurve *curve) {
+void LPEPerspectiveEnvelope::doEffect(SPCurve *curve)
+{
using Geom::X;
using Geom::Y;
+ if(are_near(up_left_point, up_right_point) &&
+ are_near(up_right_point, down_left_point) &&
+ are_near(down_left_point, down_right_point)) {
+ g_warning("Perspective/Envelope LPE::doBeforeEffect - lpeobj with invalid parameter, the same value in 4 handles!");
+ resetGrid();
+ return;
+ }
double projmatrix[3][3];
- if(deform_type == DEFORMATION_PERSPECTIVE){
+ if(deform_type == DEFORMATION_PERSPECTIVE) {
std::vector<Geom::Point> handles(4);
- handles[0] = Down_Left_Point;
- handles[1] = Up_Left_Point;
- handles[2] = Up_Right_Point;
- handles[3] = Down_Right_Point;
- std::vector<Geom::Point> sourceHandles(4);
- sourceHandles[0] = Geom::Point(boundingbox_X.min(), boundingbox_Y.max());
- sourceHandles[1] = Geom::Point(boundingbox_X.min(), boundingbox_Y.min());
- sourceHandles[2] = Geom::Point(boundingbox_X.max(), boundingbox_Y.min());
- sourceHandles[3] = Geom::Point(boundingbox_X.max(), boundingbox_Y.max());
+ handles[0] = down_left_point;
+ handles[1] = up_left_point;
+ handles[2] = up_right_point;
+ handles[3] = down_right_point;
+ std::vector<Geom::Point> source_handles(4);
+ source_handles[0] = Geom::Point(boundingbox_X.min(), boundingbox_Y.max());
+ source_handles[1] = Geom::Point(boundingbox_X.min(), boundingbox_Y.min());
+ source_handles[2] = Geom::Point(boundingbox_X.max(), boundingbox_Y.min());
+ source_handles[3] = Geom::Point(boundingbox_X.max(), boundingbox_Y.max());
double solmatrix[8][8] = {{0}};
double free_term[8] = {0};
double gslSolmatrix[64];
- for(unsigned int i = 0; i < 4; ++i){
- solmatrix[i][0] = sourceHandles[i][X];
- solmatrix[i][1] = sourceHandles[i][Y];
+ for(unsigned int i = 0; i < 4; ++i) {
+ solmatrix[i][0] = source_handles[i][X];
+ solmatrix[i][1] = source_handles[i][Y];
solmatrix[i][2] = 1;
- solmatrix[i][6] = -handles[i][X] * sourceHandles[i][X];
- solmatrix[i][7] = -handles[i][X] * sourceHandles[i][Y];
- solmatrix[i+4][3] = sourceHandles[i][X];
- solmatrix[i+4][4] = sourceHandles[i][Y];
+ solmatrix[i][6] = -handles[i][X] * source_handles[i][X];
+ solmatrix[i][7] = -handles[i][X] * source_handles[i][Y];
+ solmatrix[i+4][3] = source_handles[i][X];
+ solmatrix[i+4][4] = source_handles[i][Y];
solmatrix[i+4][5] = 1;
- solmatrix[i+4][6] = -handles[i][Y] * sourceHandles[i][X];
- solmatrix[i+4][7] = -handles[i][Y] * sourceHandles[i][Y];
+ solmatrix[i+4][6] = -handles[i][Y] * source_handles[i][X];
+ solmatrix[i+4][7] = -handles[i][Y] * source_handles[i][Y];
free_term[i] = handles[i][X];
free_term[i+4] = handles[i][Y];
}
@@ -110,7 +121,7 @@ void LPEPerspectiveEnvelope::doEffect(SPCurve *curve) {
h = 0;
for( int i = 0; i < 3; i++ ) {
for( int j = 0; j < 3; j++ ) {
- if(h==8){
+ if(h==8) {
projmatrix[2][2] = 1.0;
continue;
}
@@ -124,19 +135,19 @@ void LPEPerspectiveEnvelope::doEffect(SPCurve *curve) {
Geom::PathVector const original_pathv = pathv_to_linear_and_cubic_beziers(curve->get_pathvector());
curve->reset();
Geom::CubicBezier const *cubic = NULL;
- Geom::Point pointAt1(0, 0);
- Geom::Point pointAt2(0, 0);
- Geom::Point pointAt3(0, 0);
+ Geom::Point point_at1(0, 0);
+ Geom::Point point_at2(0, 0);
+ Geom::Point point_at3(0, 0);
for (Geom::PathVector::const_iterator path_it = original_pathv.begin(); path_it != original_pathv.end(); ++path_it) {
//Si está vacío...
if (path_it->empty())
- continue;
+ continue;
//Itreadores
SPCurve *nCurve = new SPCurve();
Geom::Path::const_iterator curve_it1 = path_it->begin();
Geom::Path::const_iterator curve_it2 = ++(path_it->begin());
Geom::Path::const_iterator curve_endit = path_it->end_default();
-
+
if (path_it->closed()) {
const Geom::Curve &closingline =
path_it->back_closed();
@@ -144,40 +155,40 @@ void LPEPerspectiveEnvelope::doEffect(SPCurve *curve) {
curve_endit = path_it->end_open();
}
}
- if(deform_type == DEFORMATION_PERSPECTIVE){
- nCurve->moveto(project_point(curve_it1->initialPoint(),projmatrix));
- }else{
- nCurve->moveto(project_point(curve_it1->initialPoint()));
+ if(deform_type == DEFORMATION_PERSPECTIVE) {
+ nCurve->moveto(projectPoint(curve_it1->initialPoint(),projmatrix));
+ } else {
+ nCurve->moveto(projectPoint(curve_it1->initialPoint()));
}
while (curve_it1 != curve_endit) {
- cubic = dynamic_cast<Geom::CubicBezier const *>(&*curve_it1);
- if (cubic) {
- pointAt1 = (*cubic)[1];
- pointAt2 = (*cubic)[2];
- } else {
- pointAt1 = curve_it1->initialPoint();
- pointAt2 = curve_it1->finalPoint();
- }
- pointAt3 = curve_it1->finalPoint();
- if(deform_type == DEFORMATION_PERSPECTIVE){
- pointAt1 = project_point(pointAt1,projmatrix);
- pointAt2 = project_point(pointAt2,projmatrix);
- pointAt3 = project_point(pointAt3,projmatrix);
- }else{
- pointAt1 = project_point(pointAt1);
- pointAt2 = project_point(pointAt2);
- pointAt3 = project_point(pointAt3);
- }
- nCurve->curveto(pointAt1, pointAt2, pointAt3);
- ++curve_it1;
- if(curve_it2 != curve_endit) {
- ++curve_it2;
- }
+ cubic = dynamic_cast<Geom::CubicBezier const *>(&*curve_it1);
+ if (cubic) {
+ point_at1 = (*cubic)[1];
+ point_at2 = (*cubic)[2];
+ } else {
+ point_at1 = curve_it1->initialPoint();
+ point_at2 = curve_it1->finalPoint();
+ }
+ point_at3 = curve_it1->finalPoint();
+ if(deform_type == DEFORMATION_PERSPECTIVE) {
+ point_at1 = projectPoint(point_at1,projmatrix);
+ point_at2 = projectPoint(point_at2,projmatrix);
+ point_at3 = projectPoint(point_at3,projmatrix);
+ } else {
+ point_at1 = projectPoint(point_at1);
+ point_at2 = projectPoint(point_at2);
+ point_at3 = projectPoint(point_at3);
+ }
+ nCurve->curveto(point_at1, point_at2, point_at3);
+ ++curve_it1;
+ if(curve_it2 != curve_endit) {
+ ++curve_it2;
+ }
}
//y cerramos la curva
if (path_it->closed()) {
- nCurve->move_endpoints(pointAt3, pointAt3);
- nCurve->closepath_current();
+ nCurve->move_endpoints(point_at3, point_at3);
+ nCurve->closepath_current();
}
curve->append(nCurve, false);
nCurve->reset();
@@ -185,41 +196,44 @@ void LPEPerspectiveEnvelope::doEffect(SPCurve *curve) {
}
}
-Geom::Point
-LPEPerspectiveEnvelope::project_point(Geom::Point p){
+Geom::Point
+LPEPerspectiveEnvelope::projectPoint(Geom::Point p)
+{
double width = boundingbox_X.extent();
double height = boundingbox_Y.extent();
double delta_x = boundingbox_X.min() - p[X];
double delta_y = boundingbox_Y.max() - p[Y];
- Geom::Coord xratio = (delta_x * -1) / width;
- Geom::Coord yratio = delta_y / height;
+ Geom::Coord x_ratio = (delta_x * -1) / width;
+ Geom::Coord y_ratio = delta_y / height;
Geom::Line* horiz = new Geom::Line();
Geom::Line* vert = new Geom::Line();
- vert->setPoints (pointAtRatio(yratio,Down_Left_Point,Up_Left_Point),pointAtRatio(yratio,Down_Right_Point,Up_Right_Point));
- horiz->setPoints (pointAtRatio(xratio,Down_Left_Point,Down_Right_Point),pointAtRatio(xratio,Up_Left_Point,Up_Right_Point));
+ vert->setPoints (pointAtRatio(y_ratio,down_left_point,up_left_point),pointAtRatio(y_ratio,down_right_point,up_right_point));
+ horiz->setPoints (pointAtRatio(x_ratio,down_left_point,down_right_point),pointAtRatio(x_ratio,up_left_point,up_right_point));
OptCrossing crossPoint = intersection(*horiz,*vert);
- if(crossPoint){
+ if(crossPoint) {
return horiz->pointAt(Geom::Coord(crossPoint->ta));
- }else{
+ } else {
return p;
}
}
-Geom::Point
-LPEPerspectiveEnvelope::project_point(Geom::Point p, double m[][3]){
+Geom::Point
+LPEPerspectiveEnvelope::projectPoint(Geom::Point p, double m[][3])
+{
Geom::Coord x = p[0];
Geom::Coord y = p[1];
return Geom::Point(
- Geom::Coord((x*m[0][0] + y*m[0][1] + m[0][2])/(x*m[2][0]+y*m[2][1]+m[2][2])),
- Geom::Coord((x*m[1][0] + y*m[1][1] + m[1][2])/(x*m[2][0]+y*m[2][1]+m[2][2])));
+ Geom::Coord((x*m[0][0] + y*m[0][1] + m[0][2])/(x*m[2][0]+y*m[2][1]+m[2][2])),
+ Geom::Coord((x*m[1][0] + y*m[1][1] + m[1][2])/(x*m[2][0]+y*m[2][1]+m[2][2])));
}
Geom::Point
-LPEPerspectiveEnvelope::pointAtRatio(Geom::Coord ratio,Geom::Point A, Geom::Point B){
- Geom::Coord x = A[X] + (ratio * (B[X]-A[X]));
- Geom::Coord y = A[Y]+ (ratio * (B[Y]-A[Y]));
- return Point(x, y);
+LPEPerspectiveEnvelope::pointAtRatio(Geom::Coord ratio,Geom::Point A, Geom::Point B)
+{
+ Geom::Coord x = A[X] + (ratio * (B[X]-A[X]));
+ Geom::Coord y = A[Y]+ (ratio * (B[Y]-A[Y]));
+ return Point(x, y);
}
@@ -233,36 +247,35 @@ LPEPerspectiveEnvelope::newWidget()
vbox->set_homogeneous(false);
vbox->set_spacing(6);
std::vector<Parameter *>::iterator it = param_vector.begin();
- Gtk::HBox * hboxUpHandles = Gtk::manage(new Gtk::HBox(false,0));
- Gtk::HBox * hboxDownHandles = Gtk::manage(new Gtk::HBox(false,0));
+ Gtk::HBox * hbox_up_handles = Gtk::manage(new Gtk::HBox(false,0));
+ Gtk::HBox * hbox_down_handles = Gtk::manage(new Gtk::HBox(false,0));
while (it != param_vector.end()) {
if ((*it)->widget_is_visible) {
Parameter * param = *it;
Gtk::Widget * widg = dynamic_cast<Gtk::Widget *>(param->param_newWidget());
- if (param->param_key == "Up_Left_Point" ||
- param->param_key == "Up_Right_Point" ||
- param->param_key == "Down_Left_Point" ||
- param->param_key == "Down_Right_Point")
- {
- Gtk::HBox * pointParameter = dynamic_cast<Gtk::HBox *>(widg);
- std::vector< Gtk::Widget* > childList = pointParameter->get_children();
- Gtk::HBox * pointParameterHBox = dynamic_cast<Gtk::HBox *>(childList[0]);
- std::vector< Gtk::Widget* > childList2 = pointParameterHBox->get_children();
- pointParameterHBox->remove(childList2[0][0]);
+ if (param->param_key == "up_left_point" ||
+ param->param_key == "up_right_point" ||
+ param->param_key == "down_left_point" ||
+ param->param_key == "down_right_point") {
+ Gtk::HBox * point_hbox = dynamic_cast<Gtk::HBox *>(widg);
+ std::vector< Gtk::Widget* > child_list = point_hbox->get_children();
+ Gtk::HBox * point_hboxHBox = dynamic_cast<Gtk::HBox *>(child_list[0]);
+ std::vector< Gtk::Widget* > child_list2 = point_hboxHBox->get_children();
+ point_hboxHBox->remove(child_list2[0][0]);
Glib::ustring * tip = param->param_getTooltip();
if (widg) {
- if(param->param_key == "Up_Left_Point"){
+ if(param->param_key == "up_left_point") {
Gtk::Label* handles = Gtk::manage(new Gtk::Label(Glib::ustring(_("Handles:")),Gtk::ALIGN_START));
vbox->pack_start(*handles, false, false, 2);
- hboxUpHandles->pack_start(*widg, true, true, 2);
- hboxUpHandles->pack_start(*Gtk::manage(new Gtk::VSeparator()), Gtk::PACK_EXPAND_WIDGET);
- }else if(param->param_key == "Up_Right_Point"){
- hboxUpHandles->pack_start(*widg, true, true, 2);
- }else if(param->param_key == "Down_Left_Point"){
- hboxDownHandles->pack_start(*widg, true, true, 2);
- hboxDownHandles->pack_start(*Gtk::manage(new Gtk::VSeparator()), Gtk::PACK_EXPAND_WIDGET);
- }else{
- hboxDownHandles->pack_start(*widg, true, true, 2);
+ hbox_up_handles->pack_start(*widg, true, true, 2);
+ hbox_up_handles->pack_start(*Gtk::manage(new Gtk::VSeparator()), Gtk::PACK_EXPAND_WIDGET);
+ } else if(param->param_key == "up_right_point") {
+ hbox_up_handles->pack_start(*widg, true, true, 2);
+ } else if(param->param_key == "down_left_point") {
+ hbox_down_handles->pack_start(*widg, true, true, 2);
+ hbox_down_handles->pack_start(*Gtk::manage(new Gtk::VSeparator()), Gtk::PACK_EXPAND_WIDGET);
+ } else {
+ hbox_down_handles->pack_start(*widg, true, true, 2);
}
if (tip) {
widg->set_tooltip_text(*tip);
@@ -271,7 +284,7 @@ LPEPerspectiveEnvelope::newWidget()
widg->set_has_tooltip(false);
}
}
- }else{
+ } else {
Glib::ustring * tip = param->param_getTooltip();
if (widg) {
vbox->pack_start(*widg, true, true, 2);
@@ -287,25 +300,77 @@ LPEPerspectiveEnvelope::newWidget()
++it;
}
- vbox->pack_start(*hboxUpHandles,true, true, 2);
- Gtk::HBox * hboxMiddle = Gtk::manage(new Gtk::HBox(true,2));
- hboxMiddle->pack_start(*Gtk::manage(new Gtk::HSeparator()), Gtk::PACK_EXPAND_WIDGET);
- hboxMiddle->pack_start(*Gtk::manage(new Gtk::HSeparator()), Gtk::PACK_EXPAND_WIDGET);
- vbox->pack_start(*hboxMiddle, false, true, 2);
- vbox->pack_start(*hboxDownHandles, true, true, 2);
+ vbox->pack_start(*hbox_up_handles,true, true, 2);
+ Gtk::HBox * hbox_middle = Gtk::manage(new Gtk::HBox(true,2));
+ hbox_middle->pack_start(*Gtk::manage(new Gtk::HSeparator()), Gtk::PACK_EXPAND_WIDGET);
+ hbox_middle->pack_start(*Gtk::manage(new Gtk::HSeparator()), Gtk::PACK_EXPAND_WIDGET);
+ vbox->pack_start(*hbox_middle, false, true, 2);
+ vbox->pack_start(*hbox_down_handles, true, true, 2);
Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false,0));
- Gtk::Button* resetButton = Gtk::manage(new Gtk::Button(Gtk::Stock::CLEAR));
- resetButton->signal_clicked().connect(sigc::mem_fun (*this,&LPEPerspectiveEnvelope::resetGrid));
- resetButton->set_size_request(140,30);
+ Gtk::Button* reset_button = Gtk::manage(new Gtk::Button(Gtk::Stock::CLEAR));
+ reset_button->signal_clicked().connect(sigc::mem_fun (*this,&LPEPerspectiveEnvelope::resetGrid));
+ reset_button->set_size_request(140,30);
vbox->pack_start(*hbox, true,true,2);
- hbox->pack_start(*resetButton, false, false,2);
+ hbox->pack_start(*reset_button, false, false,2);
return dynamic_cast<Gtk::Widget *>(vbox);
}
void
+LPEPerspectiveEnvelope::vertical(PointParam &param_one, PointParam &param_two, Geom::Line vert)
+{
+ Geom::Point A = param_one;
+ Geom::Point B = param_two;
+ double Y = (A[Geom::Y] + B[Geom::Y])/2;
+ A[Geom::Y] = Y;
+ B[Geom::Y] = Y;
+ Geom::Point nearest = vert.pointAt(vert.nearestTime(A));
+ double distance_one = Geom::distance(A,nearest);
+ double distance_two = Geom::distance(B,nearest);
+ double distance_middle = (distance_one + distance_two)/2;
+ if(A[Geom::X] > B[Geom::X]) {
+ distance_middle *= -1;
+ }
+ A[Geom::X] = nearest[Geom::X] - distance_middle;
+ B[Geom::X] = nearest[Geom::X] + distance_middle;
+ param_one.param_setValue(A, true);
+ param_two.param_setValue(B, true);
+}
+
+void
+LPEPerspectiveEnvelope::horizontal(PointParam &param_one, PointParam &param_two, Geom::Line horiz)
+{
+ Geom::Point A = param_one;
+ Geom::Point B = param_two;
+ double X = (A[Geom::X] + B[Geom::X])/2;
+ A[Geom::X] = X;
+ B[Geom::X] = X;
+ Geom::Point nearest = horiz.pointAt(horiz.nearestTime(A));
+ double distance_one = Geom::distance(A,nearest);
+ double distance_two = Geom::distance(B,nearest);
+ double distance_middle = (distance_one + distance_two)/2;
+ if(A[Geom::Y] > B[Geom::Y]) {
+ distance_middle *= -1;
+ }
+ A[Geom::Y] = nearest[Geom::Y] - distance_middle;
+ B[Geom::Y] = nearest[Geom::Y] + distance_middle;
+ param_one.param_setValue(A, true);
+ param_two.param_setValue(B, true);
+}
+
+void
LPEPerspectiveEnvelope::doBeforeEffect (SPLPEItem const* lpeitem)
{
original_bbox(lpeitem);
+ Geom::Line vert(Geom::Point(boundingbox_X.middle(),boundingbox_Y.max()), Geom::Point(boundingbox_X.middle(), boundingbox_Y.min()));
+ Geom::Line horiz(Geom::Point(boundingbox_X.min(),boundingbox_Y.middle()), Geom::Point(boundingbox_X.max(), boundingbox_Y.middle()));
+ if(vertical_mirror) {
+ vertical(up_left_point, up_right_point,vert);
+ vertical(down_left_point, down_right_point,vert);
+ }
+ if(horizontal_mirror) {
+ horizontal(up_left_point, down_left_point,horiz);
+ horizontal(up_right_point, down_right_point,horiz);
+ }
SPLPEItem * item = const_cast<SPLPEItem*>(lpeitem);
item->apply_to_clippath(item);
item->apply_to_mask(item);
@@ -315,24 +380,24 @@ LPEPerspectiveEnvelope::doBeforeEffect (SPLPEItem const* lpeitem)
void
LPEPerspectiveEnvelope::setDefaults()
{
- Geom::Point Up_Left(boundingbox_X.min(), boundingbox_Y.min());
- Geom::Point Up_Right(boundingbox_X.max(), boundingbox_Y.min());
- Geom::Point Down_Left(boundingbox_X.min(), boundingbox_Y.max());
- Geom::Point Down_Right(boundingbox_X.max(), boundingbox_Y.max());
-
- Up_Left_Point.param_update_default(Up_Left);
- Up_Right_Point.param_update_default(Up_Right);
- Down_Right_Point.param_update_default(Down_Right);
- Down_Left_Point.param_update_default(Down_Left);
+ Geom::Point up_left(boundingbox_X.min(), boundingbox_Y.min());
+ Geom::Point up_right(boundingbox_X.max(), boundingbox_Y.min());
+ Geom::Point down_left(boundingbox_X.min(), boundingbox_Y.max());
+ Geom::Point down_right(boundingbox_X.max(), boundingbox_Y.max());
+
+ up_left_point.param_update_default(up_left);
+ up_right_point.param_update_default(up_right);
+ down_right_point.param_update_default(down_right);
+ down_left_point.param_update_default(down_left);
}
void
LPEPerspectiveEnvelope::resetGrid()
{
- Up_Left_Point.param_set_default();
- Up_Right_Point.param_set_default();
- Down_Right_Point.param_set_default();
- Down_Left_Point.param_set_default();
+ up_left_point.param_set_default();
+ up_right_point.param_set_default();
+ down_right_point.param_set_default();
+ down_left_point.param_set_default();
}
void
@@ -351,11 +416,11 @@ LPEPerspectiveEnvelope::addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::v
SPCurve *c = new SPCurve();
c->reset();
- c->moveto(Up_Left_Point);
- c->lineto(Up_Right_Point);
- c->lineto(Down_Right_Point);
- c->lineto(Down_Left_Point);
- c->lineto(Up_Left_Point);
+ c->moveto(up_left_point);
+ c->lineto(up_right_point);
+ c->lineto(down_right_point);
+ c->lineto(down_left_point);
+ c->lineto(up_left_point);
hp_vec.push_back(c->get_pathvector());
}
diff --git a/src/live_effects/lpe-perspective-envelope.h b/src/live_effects/lpe-perspective-envelope.h
index d3ff76445..dd14dc212 100644
--- a/src/live_effects/lpe-perspective-envelope.h
+++ b/src/live_effects/lpe-perspective-envelope.h
@@ -3,7 +3,7 @@
/** \file
* LPE <perspective-envelope> implementation , see lpe-perspective-envelope.cpp.
-
+
*/
/*
* Authors:
@@ -11,8 +11,8 @@
* Aaron Spike, aaron@ekips.org from envelope and perspective phyton code
* Dmitry Platonov, shadowjack@mail.ru, 2006 perspective approach & math
* Jose Hevia (freon) Transform algorithm from envelope
- *
- * Copyright (C) 2007-2014 Authors
+ *
+ * Copyright (C) 2007-2014 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
@@ -34,14 +34,18 @@ public:
virtual void doEffect(SPCurve *curve);
- virtual Geom::Point project_point(Geom::Point p);
+ virtual Geom::Point projectPoint(Geom::Point p);
- virtual Geom::Point project_point(Geom::Point p, double m[][3]);
+ virtual Geom::Point projectPoint(Geom::Point p, double m[][3]);
virtual Geom::Point pointAtRatio(Geom::Coord ratio,Geom::Point A, Geom::Point B);
virtual void resetDefaults(SPItem const* item);
+ virtual void vertical(PointParam &paramA,PointParam &paramB, Geom::Line vert);
+
+ virtual void horizontal(PointParam &paramA,PointParam &paramB,Geom::Line horiz);
+
virtual void doBeforeEffect(SPLPEItem const* lpeitem);
virtual Gtk::Widget * newWidget();
@@ -54,11 +58,13 @@ protected:
void addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector<Geom::PathVector> &hp_vec);
private:
+ BoolParam horizontal_mirror;
+ BoolParam vertical_mirror;
EnumParam<unsigned> deform_type;
- PointParam Up_Left_Point;
- PointParam Up_Right_Point;
- PointParam Down_Left_Point;
- PointParam Down_Right_Point;
+ PointParam up_left_point;
+ PointParam up_right_point;
+ PointParam down_left_point;
+ PointParam down_right_point;
LPEPerspectiveEnvelope(const LPEPerspectiveEnvelope&);
LPEPerspectiveEnvelope& operator=(const LPEPerspectiveEnvelope&);
diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp
index 5d9d224e8..f90d67d4e 100644
--- a/src/live_effects/lpe-powerstroke.cpp
+++ b/src/live_effects/lpe-powerstroke.cpp
@@ -27,12 +27,13 @@
#include <2geom/sbasis-geometric.h>
#include <2geom/transforms.h>
#include <2geom/bezier-utils.h>
-#include <2geom/svg-elliptical-arc.h>
+#include <2geom/elliptical-arc.h>
#include <2geom/sbasis-to-bezier.h>
#include <2geom/path-sink.h>
#include <2geom/path-intersection.h>
#include <2geom/crossing.h>
#include <2geom/ellipse.h>
+#include <2geom/circle.h>
#include <2geom/math-utils.h>
#include <math.h>
@@ -46,9 +47,9 @@ namespace Geom {
static boost::optional<Point> intersection_point( Point const & origin_a, Point const & vector_a,
Point const & origin_b, Point const & vector_b)
{
- Coord denom = cross(vector_b, vector_a);
+ Coord denom = cross(vector_a, vector_b);
if (!are_near(denom,0.)){
- Coord t = (cross(origin_a,vector_b) + cross(vector_b,origin_b)) / denom;
+ Coord t = (cross(vector_b, origin_a) + cross(origin_b, vector_b)) / denom;
return origin_a + t * vector_a;
}
return boost::none;
@@ -94,71 +95,6 @@ static Ellipse find_ellipse(Point P, Point Q, Point O)
}
/**
- * Refer to: Weisstein, Eric W. "Circle-Circle Intersection."
- From MathWorld--A Wolfram Web Resource.
- http://mathworld.wolfram.com/Circle-CircleIntersection.html
- *
- * @return 0 if no intersection
- * @return 1 if one circle is contained in the other
- * @return 2 if intersections are found (they are written to p0 and p1)
- */
-static int circle_circle_intersection(Circle const &circle0, Circle const &circle1,
- Point & p0, Point & p1)
-{
- Point X0 = circle0.center();
- double r0 = circle0.ray();
- Point X1 = circle1.center();
- double r1 = circle1.ray();
-
- /* dx and dy are the vertical and horizontal distances between
- * the circle centers.
- */
- Point D = X1 - X0;
-
- /* Determine the straight-line distance between the centers. */
- double d = L2(D);
-
- /* Check for solvability. */
- if (d > (r0 + r1))
- {
- /* no solution. circles do not intersect. */
- return 0;
- }
- if (d <= fabs(r0 - r1))
- {
- /* no solution. one circle is contained in the other */
- return 1;
- }
-
- /* 'point 2' is the point where the line through the circle
- * intersection points crosses the line between the circle
- * centers.
- */
-
- /* Determine the distance from point 0 to point 2. */
- double a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ;
-
- /* Determine the coordinates of point 2. */
- Point p2 = X0 + D * (a/d);
-
- /* Determine the distance from point 2 to either of the
- * intersection points.
- */
- double h = std::sqrt((r0*r0) - (a*a));
-
- /* Now determine the offsets of the intersection points from
- * point 2.
- */
- Point r = (h/d)*rot90(D);
-
- /* Determine the absolute intersection points. */
- p0 = p2 + r;
- p1 = p2 - r;
-
- return 2;
-}
-
-/**
* Find circle that touches inside of the curve, with radius matching the curvature, at time value \c t.
* Because this method internally uses unitTangentAt, t should be smaller than 1.0 (see unitTangentAt).
*/
@@ -313,7 +249,7 @@ LPEPowerStroke::doOnApply(SPLPEItem const* lpeitem)
Geom::Path const &path = pathv.front();
Geom::Path::size_type const size = path.size_default();
if (!path.closed()) {
- points.push_back( Geom::Point(0.2,width) );
+ points.push_back( Geom::Point(0.2,width) );
}
points.push_back( Geom::Point(0.5*size,width) );
if (!path.closed()) {
@@ -362,7 +298,7 @@ void LPEPowerStroke::doOnRemove(SPLPEItem const* lpeitem)
}
void
-LPEPowerStroke::adjustForNewPath(std::vector<Geom::Path> const & path_in)
+LPEPowerStroke::adjustForNewPath(Geom::PathVector const & path_in)
{
if (!path_in.empty()) {
offset_points.recalculate_controlpoints_for_new_pwd2(path_in[0].toPwSb());
@@ -387,6 +323,8 @@ static Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise<Geom::D2<Geom::
return pb.peek().front();
}
+ pb.setStitching(true);
+
Geom::Point start = B[0].at0();
pb.moveTo(start);
build_from_sbasis(pb, B[0], tol, false);
@@ -446,7 +384,7 @@ static Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise<Geom::D2<Geom::
break;
}
- pb.arcTo( ellipse.ray(Geom::X), ellipse.ray(Geom::Y), ellipse.rot_angle(),
+ pb.arcTo( ellipse.ray(Geom::X), ellipse.ray(Geom::Y), ellipse.rotationAngle(),
false, width < 0, B[i].at0() );
break;
@@ -482,24 +420,24 @@ static Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise<Geom::D2<Geom::
// Extrapolate using the curvature at the end of the path segments to join
Geom::Circle circle1 = Geom::touching_circle(reverse(B[prev_i]), 0.0);
Geom::Circle circle2 = Geom::touching_circle(B[i], 0.0);
- Geom::Point points[2];
- int solutions = circle_circle_intersection(circle1, circle2, points[0], points[1]);
- if (solutions == 2) {
+ std::vector<Geom::ShapeIntersection> solutions;
+ solutions = circle1.intersect(circle2);
+ if (solutions.size() == 2) {
Geom::Point sol(0.,0.);
- if ( dot(tang2,points[0]-B[i].at0()) > 0 ) {
+ if ( dot(tang2, solutions[0].point() - B[i].at0()) > 0 ) {
// points[0] is bad, choose points[1]
- sol = points[1];
- } else if ( dot(tang2,points[1]-B[i].at0()) > 0 ) { // points[0] could be good, now check points[1]
+ sol = solutions[1].point();
+ } else if ( dot(tang2, solutions[1].point() - B[i].at0()) > 0 ) { // points[0] could be good, now check points[1]
// points[1] is bad, choose points[0]
- sol = points[0];
+ sol = solutions[0].point();
} else {
// both points are good, choose nearest
- sol = ( distanceSq(B[i].at0(), points[0]) < distanceSq(B[i].at0(), points[1]) ) ?
- points[0] : points[1];
+ sol = ( distanceSq(B[i].at0(), solutions[0].point()) < distanceSq(B[i].at0(), solutions[1].point()) ) ?
+ solutions[0].point() : solutions[1].point();
}
- Geom::EllipticalArc *arc0 = circle1.arc(B[prev_i].at1(), 0.5*(B[prev_i].at1()+sol), sol, true);
- Geom::EllipticalArc *arc1 = circle2.arc(sol, 0.5*(sol+B[i].at0()), B[i].at0(), true);
+ Geom::EllipticalArc *arc0 = circle1.arc(B[prev_i].at1(), 0.5*(B[prev_i].at1()+sol), sol);
+ Geom::EllipticalArc *arc1 = circle2.arc(sol, 0.5*(sol+B[i].at0()), B[i].at0());
if (arc0) {
build_from_sbasis(pb,arc0->toSBasis(), tol, false);
@@ -574,7 +512,7 @@ static Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise<Geom::D2<Geom::
Geom::Path spiro;
Spiro::spiro_run(controlpoints, 4, spiro);
- pb.append(spiro.portion(1,spiro.size_open()-1), Geom::Path::STITCH_DISCONTINUOUS);
+ pb.append(spiro.portion(1, spiro.size_open() - 1));
break;
}
case LINEJOIN_BEVEL:
@@ -593,15 +531,15 @@ static Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise<Geom::D2<Geom::
if (cross.size() != 1) {
// empty crossing or too many crossings: default to bevel
pb.lineTo(B[i].at0());
- pb.append(bzr2, Geom::Path::STITCH_DISCONTINUOUS);
+ pb.append(bzr2);
} else {
// :-) quick hack:
for (unsigned i=0; i < bzr1.size_open(); ++i) {
pb.backspace();
}
- pb.append( bzr1.portion(0, cross[0].ta), Geom::Path::STITCH_DISCONTINUOUS );
- pb.append( bzr2.portion(cross[0].tb, bzr2.size_open()), Geom::Path::STITCH_DISCONTINUOUS );
+ pb.append( bzr1.portion(0, cross[0].ta) );
+ pb.append( bzr2.portion(cross[0].tb, bzr2.size_open()) );
}
}
} else {
@@ -615,12 +553,12 @@ static Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise<Geom::D2<Geom::
}
-std::vector<Geom::Path>
-LPEPowerStroke::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector
+LPEPowerStroke::doEffect_path (Geom::PathVector const & path_in)
{
using namespace Geom;
- std::vector<Geom::Path> path_out;
+ Geom::PathVector path_out;
if (path_in.empty()) {
return path_out;
}
@@ -737,12 +675,12 @@ LPEPowerStroke::doEffect_path (std::vector<Geom::Path> const & path_in)
default:
{
double radius1 = 0.5 * distance(pwd2_out.lastValue(), mirrorpath.firstValue());
- fixed_path.appendNew<SVGEllipticalArc>( radius1, radius1, M_PI/2., false, y.lastValue() < 0, mirrorpath.firstValue() );
+ fixed_path.appendNew<EllipticalArc>( radius1, radius1, M_PI/2., false, y.lastValue() < 0, mirrorpath.firstValue() );
break;
}
}
- fixed_path.append(fixed_mirrorpath, Geom::Path::STITCH_DISCONTINUOUS);
+ fixed_path.append(fixed_mirrorpath);
switch (start_linecap) {
case LINECAP_ZERO_WIDTH:
@@ -775,7 +713,7 @@ LPEPowerStroke::doEffect_path (std::vector<Geom::Path> const & path_in)
default:
{
double radius2 = 0.5 * distance(pwd2_out.firstValue(), mirrorpath.lastValue());
- fixed_path.appendNew<SVGEllipticalArc>( radius2, radius2, M_PI/2., false, y.firstValue() < 0, pwd2_out.firstValue() );
+ fixed_path.appendNew<EllipticalArc>( radius2, radius2, M_PI/2., false, y.firstValue() < 0, pwd2_out.firstValue() );
break;
}
}
diff --git a/src/live_effects/lpe-powerstroke.h b/src/live_effects/lpe-powerstroke.h
index a773434aa..135d39274 100644
--- a/src/live_effects/lpe-powerstroke.h
+++ b/src/live_effects/lpe-powerstroke.h
@@ -26,13 +26,13 @@ public:
virtual ~LPEPowerStroke();
- virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
+ virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in);
virtual void doOnApply(SPLPEItem const* lpeitem);
virtual void doOnRemove(SPLPEItem const* lpeitem);
// methods called by path-manipulator upon edits
- void adjustForNewPath(std::vector<Geom::Path> const & path_in);
+ void adjustForNewPath(Geom::PathVector const & path_in);
PowerStrokePointArrayParam offset_points;
diff --git a/src/live_effects/lpe-rough-hatches.cpp b/src/live_effects/lpe-rough-hatches.cpp
index 455653e46..76421e0f0 100644
--- a/src/live_effects/lpe-rough-hatches.cpp
+++ b/src/live_effects/lpe-rough-hatches.cpp
@@ -529,7 +529,8 @@ LPERoughHatches::smoothSnake(std::vector<std::vector<Point> > const &linearSnake
}
if ( fat_output.get_value() ){
res_comp = res_comp_bot;
- res_comp.append(res_comp_top.reverse(),Geom::Path::STITCH_DISCONTINUOUS);
+ res_comp.setStitching(true);
+ res_comp.append(res_comp_top.reversed());
}
result.concat(res_comp.toPwSb());
}
diff --git a/src/live_effects/lpe-roughen.cpp b/src/live_effects/lpe-roughen.cpp
index 8cef9a3a3..33ffd96d6 100644
--- a/src/live_effects/lpe-roughen.cpp
+++ b/src/live_effects/lpe-roughen.cpp
@@ -20,7 +20,6 @@
#include "live_effects/parameter/parameter.h"
#include "helper/geom.h"
#include <glibmm/i18n.h>
-#include <util/units.h>
#include <cmath>
namespace Inkscape {
@@ -36,39 +35,37 @@ DMConverter(DivisionMethodData, DM_END);
LPERoughen::LPERoughen(LivePathEffectObject *lpeobject)
: Effect(lpeobject),
// initialise your parameters here:
- unit(_("Unit"), _("Unit"), "unit", &wr, this),
method(_("Method"), _("Division method"), "method", DMConverter, &wr,
this, DM_SEGMENTS),
- maxSegmentSize(_("Max. segment size"), _("Max. segment size"),
- "maxSegmentSize", &wr, this, 10.),
+ max_segment_size(_("Max. segment size"), _("Max. segment size"),
+ "max_segment_size", &wr, this, 10.),
segments(_("Number of segments"), _("Number of segments"), "segments",
&wr, this, 2),
- displaceX(_("Max. displacement in X"), _("Max. displacement in X"),
- "displaceX", &wr, this, 10.),
- displaceY(_("Max. displacement in Y"), _("Max. displacement in Y"),
- "displaceY", &wr, this, 10.),
- globalRandomize(_("Global randomize"), _("Global randomize"),
- "globalRandomize", &wr, this, 1.),
- shiftNodes(_("Shift nodes"), _("Shift nodes"), "shiftNodes", &wr, this,
+ displace_x(_("Max. displacement in X"), _("Max. displacement in X"),
+ "displace_x", &wr, this, 10.),
+ displace_y(_("Max. displacement in Y"), _("Max. displacement in Y"),
+ "displace_y", &wr, this, 10.),
+ global_randomize(_("Global randomize"), _("Global randomize"),
+ "global_randomize", &wr, this, 1.),
+ shift_nodes(_("Shift nodes"), _("Shift nodes"), "shift_nodes", &wr, this,
true),
- shiftNodeHandles(_("Shift node handles"), _("Shift node handles"),
- "shiftNodeHandles", &wr, this, true)
+ shift_node_handles(_("Shift node handles"), _("Shift node handles"),
+ "shift_node_handles", &wr, this, true)
{
- registerParameter(&unit);
registerParameter(&method);
- registerParameter(&maxSegmentSize);
+ registerParameter(&max_segment_size);
registerParameter(&segments);
- registerParameter(&displaceX);
- registerParameter(&displaceY);
- registerParameter(&globalRandomize);
- registerParameter(&shiftNodes);
- registerParameter(&shiftNodeHandles);
- displaceX.param_set_range(0., Geom::infinity());
- displaceY.param_set_range(0., Geom::infinity());
- globalRandomize.param_set_range(0., Geom::infinity());
- maxSegmentSize.param_set_range(0., Geom::infinity());
- maxSegmentSize.param_set_increments(1, 1);
- maxSegmentSize.param_set_digits(1);
+ registerParameter(&displace_x);
+ registerParameter(&displace_y);
+ registerParameter(&global_randomize);
+ registerParameter(&shift_nodes);
+ registerParameter(&shift_node_handles);
+ displace_x.param_set_range(0., Geom::infinity());
+ displace_y.param_set_range(0., Geom::infinity());
+ global_randomize.param_set_range(0., Geom::infinity());
+ max_segment_size.param_set_range(0., Geom::infinity());
+ max_segment_size.param_set_increments(1, 1);
+ max_segment_size.param_set_digits(1);
segments.param_set_range(1, Geom::infinity());
segments.param_set_increments(1, 1);
segments.param_set_digits(0);
@@ -78,9 +75,9 @@ LPERoughen::~LPERoughen() {}
void LPERoughen::doBeforeEffect(SPLPEItem const *lpeitem)
{
- displaceX.resetRandomizer();
- displaceY.resetRandomizer();
- globalRandomize.resetRandomizer();
+ displace_x.resetRandomizer();
+ displace_y.resetRandomizer();
+ global_randomize.resetRandomizer();
srand(1);
SPLPEItem * item = const_cast<SPLPEItem*>(lpeitem);
item->apply_to_clippath(item);
@@ -98,38 +95,30 @@ Gtk::Widget *LPERoughen::newWidget()
if ((*it)->widget_is_visible) {
Parameter *param = *it;
Gtk::Widget *widg = dynamic_cast<Gtk::Widget *>(param->param_newWidget());
- if (param->param_key == "unit") {
- Gtk::Label *unitLabel = Gtk::manage(new Gtk::Label(
- Glib::ustring(_("<b>Roughen unit</b>")), Gtk::ALIGN_START));
- unitLabel->set_use_markup(true);
- vbox->pack_start(*unitLabel, false, false, 2);
- vbox->pack_start(*Gtk::manage(new Gtk::HSeparator()),
- Gtk::PACK_EXPAND_WIDGET);
- }
if (param->param_key == "method") {
- Gtk::Label *methodLabel = Gtk::manage(new Gtk::Label(
+ Gtk::Label *method_label = Gtk::manage(new Gtk::Label(
Glib::ustring(_("<b>Add nodes</b> Subdivide each segment")),
Gtk::ALIGN_START));
- methodLabel->set_use_markup(true);
- vbox->pack_start(*methodLabel, false, false, 2);
+ method_label->set_use_markup(true);
+ vbox->pack_start(*method_label, false, false, 2);
vbox->pack_start(*Gtk::manage(new Gtk::HSeparator()),
Gtk::PACK_EXPAND_WIDGET);
}
- if (param->param_key == "displaceX") {
- Gtk::Label *displaceXLabel = Gtk::manage(new Gtk::Label(
+ if (param->param_key == "displace_x") {
+ Gtk::Label *displace_x_label = Gtk::manage(new Gtk::Label(
Glib::ustring(_("<b>Jitter nodes</b> Move nodes/handles")),
Gtk::ALIGN_START));
- displaceXLabel->set_use_markup(true);
- vbox->pack_start(*displaceXLabel, false, false, 2);
+ displace_x_label->set_use_markup(true);
+ vbox->pack_start(*displace_x_label, false, false, 2);
vbox->pack_start(*Gtk::manage(new Gtk::HSeparator()),
Gtk::PACK_EXPAND_WIDGET);
}
- if (param->param_key == "globalRandomize") {
- Gtk::Label *displaceXLabel = Gtk::manage(new Gtk::Label(
+ if (param->param_key == "global_randomize") {
+ Gtk::Label *global_rand = Gtk::manage(new Gtk::Label(
Glib::ustring(_("<b>Extra roughen</b> Add a extra layer of rough")),
Gtk::ALIGN_START));
- displaceXLabel->set_use_markup(true);
- vbox->pack_start(*displaceXLabel, false, false, 2);
+ global_rand->set_use_markup(true);
+ vbox->pack_start(*global_rand, false, false, 2);
vbox->pack_start(*Gtk::manage(new Gtk::HSeparator()),
Gtk::PACK_EXPAND_WIDGET);
}
@@ -150,23 +139,20 @@ Gtk::Widget *LPERoughen::newWidget()
return dynamic_cast<Gtk::Widget *>(vbox);
}
-double LPERoughen::sign(double randNumber)
+double LPERoughen::sign(double random_number)
{
if (rand() % 100 < 49) {
- randNumber *= -1.;
+ random_number *= -1.;
}
- return randNumber;
+ return random_number;
}
Geom::Point LPERoughen::randomize()
{
- Inkscape::Util::Unit const *svg_units = SP_ACTIVE_DESKTOP->namedview->svg_units;
- double displaceXParsed = Inkscape::Util::Quantity::convert(
- displaceX * globalRandomize, unit.get_abbreviation(), svg_units->abbr);
- double displaceYParsed = Inkscape::Util::Quantity::convert(
- displaceY * globalRandomize, unit.get_abbreviation(), svg_units->abbr);
+ double displace_x_parsed = displace_x * global_randomize;
+ double displace_y_parsed = displace_y * global_randomize;
- Geom::Point output = Geom::Point(sign(displaceXParsed), sign(displaceYParsed));
+ Geom::Point output = Geom::Point(sign(displace_x_parsed), sign(displace_y_parsed));
return output;
}
@@ -175,7 +161,6 @@ void LPERoughen::doEffect(SPCurve *curve)
Geom::PathVector const original_pathv =
pathv_to_linear_and_cubic_beziers(curve->get_pathvector());
curve->reset();
- Inkscape::Util::Unit const *svg_units = SP_ACTIVE_DESKTOP->namedview->svg_units;
for (Geom::PathVector::const_iterator path_it = original_pathv.begin();
path_it != original_pathv.end(); ++path_it) {
if (path_it->empty())
@@ -193,40 +178,39 @@ void LPERoughen::doEffect(SPCurve *curve)
}
}
Geom::Point initialMove(0, 0);
- if (shiftNodes) {
+ if (shift_nodes) {
initialMove = randomize();
}
Geom::Point initialPoint = curve_it1->initialPoint() + initialMove;
nCurve->moveto(initialPoint);
- Geom::Point A0(0, 0);
- Geom::Point A1(0, 0);
- Geom::Point A2(0, 0);
- Geom::Point A3(0, 0);
+ Geom::Point point0(0, 0);
+ Geom::Point point1(0, 0);
+ Geom::Point point2(0, 0);
+ Geom::Point point3(0, 0);
bool first = true;
while (curve_it1 != curve_endit) {
Geom::CubicBezier const *cubic = NULL;
- A0 = curve_it1->initialPoint();
- A1 = curve_it1->initialPoint();
- A2 = curve_it1->finalPoint();
- A3 = curve_it1->finalPoint();
+ point0 = curve_it1->initialPoint();
+ point1 = curve_it1->initialPoint();
+ point2 = curve_it1->finalPoint();
+ point3 = curve_it1->finalPoint();
cubic = dynamic_cast<Geom::CubicBezier const *>(&*curve_it1);
if (cubic) {
- A1 = (*cubic)[1];
- if (shiftNodes && first) {
- A1 = (*cubic)[1] + initialMove;
+ point1 = (*cubic)[1];
+ if (shift_nodes && first) {
+ point1 = (*cubic)[1] + initialMove;
}
- A2 = (*cubic)[2];
- nCurve->curveto(A1, A2, A3);
+ point2 = (*cubic)[2];
+ nCurve->curveto(point1, point2, point3);
} else {
- nCurve->lineto(A3);
+ nCurve->lineto(point3);
}
- double length = Inkscape::Util::Quantity::convert(
- curve_it1->length(0.001), svg_units->abbr, unit.get_abbreviation());
+ double length = curve_it1->length(0.001);
std::size_t splits = 0;
if (method == DM_SEGMENTS) {
splits = segments;
} else {
- splits = ceil(length / maxSegmentSize);
+ splits = ceil(length / max_segment_size);
}
for (unsigned int t = splits; t >= 1; t--) {
if (t == 1 && splits != 1) {
@@ -265,42 +249,42 @@ SPCurve *LPERoughen::addNodesAndJitter(const Geom::Curve *A, double t)
{
SPCurve *out = new SPCurve();
Geom::CubicBezier const *cubic = dynamic_cast<Geom::CubicBezier const *>(&*A);
- Geom::Point A1(0, 0);
- Geom::Point A2(0, 0);
- Geom::Point A3(0, 0);
- Geom::Point B1(0, 0);
- Geom::Point B2(0, 0);
- Geom::Point B3(0, 0);
- if (shiftNodes) {
- A3 = randomize();
- B3 = randomize();
+ Geom::Point point1(0, 0);
+ Geom::Point point2(0, 0);
+ Geom::Point point3(0, 0);
+ Geom::Point point_b1(0, 0);
+ Geom::Point point_b2(0, 0);
+ Geom::Point point_b3(0, 0);
+ if (shift_nodes) {
+ point3 = randomize();
+ point_b3 = randomize();
}
- if (shiftNodeHandles) {
- A1 = randomize();
- A2 = randomize();
- B1 = randomize();
- B2 = randomize();
+ if (shift_node_handles) {
+ point1 = randomize();
+ point2 = randomize();
+ point_b1 = randomize();
+ point_b2 = randomize();
} else {
- A2 = A3;
- B1 = A3;
- B2 = B3;
+ point2 = point3;
+ point_b1 = point3;
+ point_b2 = point_b3;
}
if (cubic) {
std::pair<Geom::CubicBezier, Geom::CubicBezier> div = cubic->subdivide(t);
- std::vector<Geom::Point> seg1 = div.first.points(),
- seg2 = div.second.points();
+ std::vector<Geom::Point> seg1 = div.first.controlPoints(),
+ seg2 = div.second.controlPoints();
out->moveto(seg1[0]);
- out->curveto(seg1[1] + A1, seg1[2] + A2, seg1[3] + A3);
- out->curveto(seg2[1] + B1, seg2[2], seg2[3]);
- } else if (shiftNodeHandles) {
+ out->curveto(seg1[1] + point1, seg1[2] + point2, seg1[3] + point3);
+ out->curveto(seg2[1] + point_b1, seg2[2], seg2[3]);
+ } else if (shift_node_handles) {
out->moveto(A->initialPoint());
- out->curveto(A->pointAt(t / 3) + A1, A->pointAt((t / 3) * 2) + A2,
- A->pointAt(t) + A3);
- out->curveto(A->pointAt(t + (t / 3)) + B1, A->pointAt(t + ((t / 3) * 2)),
+ out->curveto(A->pointAt(t / 3) + point1, A->pointAt((t / 3) * 2) + point2,
+ A->pointAt(t) + point3);
+ out->curveto(A->pointAt(t + (t / 3)) + point_b1, A->pointAt(t + ((t / 3) * 2)),
A->finalPoint());
} else {
out->moveto(A->initialPoint());
- out->lineto(A->pointAt(t) + A3);
+ out->lineto(A->pointAt(t) + point3);
out->lineto(A->finalPoint());
}
return out;
@@ -310,33 +294,33 @@ SPCurve *LPERoughen::jitter(const Geom::Curve *A)
{
SPCurve *out = new SPCurve();
Geom::CubicBezier const *cubic = dynamic_cast<Geom::CubicBezier const *>(&*A);
- Geom::Point A1(0, 0);
- Geom::Point A2(0, 0);
- Geom::Point A3(0, 0);
- if (shiftNodes) {
- A3 = randomize();
+ Geom::Point point1(0, 0);
+ Geom::Point point2(0, 0);
+ Geom::Point point3(0, 0);
+ if (shift_nodes) {
+ point3 = randomize();
}
- if (shiftNodeHandles) {
- A1 = randomize();
- A2 = randomize();
+ if (shift_node_handles) {
+ point1 = randomize();
+ point2 = randomize();
} else {
- A2 = A3;
+ point2 = point3;
}
if (cubic) {
out->moveto((*cubic)[0]);
- out->curveto((*cubic)[1] + A1, (*cubic)[2] + A2, (*cubic)[3] + A3);
- } else if (shiftNodeHandles) {
+ out->curveto((*cubic)[1] + point1, (*cubic)[2] + point2, (*cubic)[3] + point3);
+ } else if (shift_node_handles) {
out->moveto(A->initialPoint());
- out->curveto(A->pointAt(0.3333) + A1, A->pointAt(0.6666) + A2,
- A->finalPoint() + A3);
+ out->curveto(A->pointAt(0.3333) + point1, A->pointAt(0.6666) + point2,
+ A->finalPoint() + point3);
} else {
out->moveto(A->initialPoint());
- out->lineto(A->finalPoint() + A3);
+ out->lineto(A->finalPoint() + point3);
}
return out;
}
-Geom::Point LPERoughen::tpoint(Geom::Point A, Geom::Point B, double t)
+Geom::Point LPERoughen::tPoint(Geom::Point A, Geom::Point B, double t)
{
using Geom::X;
using Geom::Y;
diff --git a/src/live_effects/lpe-roughen.h b/src/live_effects/lpe-roughen.h
index 74331f1ef..2b285cd40 100644
--- a/src/live_effects/lpe-roughen.h
+++ b/src/live_effects/lpe-roughen.h
@@ -17,7 +17,6 @@
#include "live_effects/parameter/parameter.h"
#include "live_effects/parameter/path.h"
#include "live_effects/parameter/bool.h"
-#include "live_effects/parameter/unit.h"
#include "live_effects/parameter/random.h"
namespace Inkscape {
@@ -41,19 +40,18 @@ public:
virtual void doBeforeEffect(SPLPEItem const * lpeitem);
virtual SPCurve *addNodesAndJitter(const Geom::Curve *A, double t);
virtual SPCurve *jitter(const Geom::Curve *A);
- virtual Geom::Point tpoint(Geom::Point A, Geom::Point B, double t = 0.5);
+ virtual Geom::Point tPoint(Geom::Point A, Geom::Point B, double t = 0.5);
virtual Gtk::Widget *newWidget();
private:
- UnitParam unit;
EnumParam<DivisionMethod> method;
- ScalarParam maxSegmentSize;
+ ScalarParam max_segment_size;
ScalarParam segments;
- RandomParam displaceX;
- RandomParam displaceY;
- RandomParam globalRandomize;
- BoolParam shiftNodes;
- BoolParam shiftNodeHandles;
+ RandomParam displace_x;
+ RandomParam displace_y;
+ RandomParam global_randomize;
+ BoolParam shift_nodes;
+ BoolParam shift_node_handles;
LPERoughen(const LPERoughen &);
LPERoughen &operator=(const LPERoughen &);
diff --git a/src/live_effects/lpe-ruler.cpp b/src/live_effects/lpe-ruler.cpp
index fd611c78d..49b5faa2e 100644
--- a/src/live_effects/lpe-ruler.cpp
+++ b/src/live_effects/lpe-ruler.cpp
@@ -111,7 +111,7 @@ LPERuler::ruler_mark(Geom::Point const &A, Geom::Point const &n, MarkType const
break;
}
- Piecewise<D2<SBasis> > seg(D2<SBasis>(Linear(C[X], D[X]), Linear(C[Y], D[Y])));
+ Piecewise<D2<SBasis> > seg(D2<SBasis>(SBasis(C[X], D[X]), SBasis(C[Y], D[Y])));
return seg;
}
diff --git a/src/live_effects/lpe-show_handles.cpp b/src/live_effects/lpe-show_handles.cpp
index 2d8148730..0bc1c4f17 100644
--- a/src/live_effects/lpe-show_handles.cpp
+++ b/src/live_effects/lpe-show_handles.cpp
@@ -24,25 +24,25 @@ LPEShowHandles::LPEShowHandles(LivePathEffectObject *lpeobject)
: Effect(lpeobject),
nodes(_("Show nodes"), _("Show nodes"), "nodes", &wr, this, true),
handles(_("Show handles"), _("Show handles"), "handles", &wr, this, true),
- originalPath(_("Show path"), _("Show path"), "originalPath", &wr, this, true),
- scaleNodesAndHandles(_("Scale nodes and handles"), _("Scale nodes and handles"), "scaleNodesAndHandles", &wr, this, 10),
- rotateNodes(_("Rotate nodes"), _("Rotate nodes"), "rotateNodes", &wr, this, 0)
+ original_path(_("Show path"), _("Show path"), "original_path", &wr, this, true),
+ scale_nodes_and_handles(_("Scale nodes and handles"), _("Scale nodes and handles"), "scale_nodes_and_handles", &wr, this, 10),
+ rotate_nodes(_("Rotate nodes"), _("Rotate nodes"), "rotate_nodes", &wr, this, 0)
{
- registerParameter(dynamic_cast<Parameter *>(&nodes));
- registerParameter(dynamic_cast<Parameter *>(&handles));
- registerParameter(dynamic_cast<Parameter *>(&originalPath));
- registerParameter(dynamic_cast<Parameter *>(&scaleNodesAndHandles));
- registerParameter(dynamic_cast<Parameter *>(&rotateNodes));
- scaleNodesAndHandles.param_set_range(0, 500.);
- scaleNodesAndHandles.param_set_increments(1, 1);
- scaleNodesAndHandles.param_set_digits(2);
- rotateNodes.param_set_range(0, 365);
- rotateNodes.param_set_increments(1, 1);
- rotateNodes.param_set_digits(0);
- strokeWidth = 1.0;
+ registerParameter(&nodes);
+ registerParameter(&handles);
+ registerParameter(&original_path);
+ registerParameter(&scale_nodes_and_handles);
+ registerParameter(&rotate_nodes);
+ scale_nodes_and_handles.param_set_range(0, 500.);
+ scale_nodes_and_handles.param_set_increments(1, 1);
+ scale_nodes_and_handles.param_set_digits(2);
+ rotate_nodes.param_set_range(0, 365);
+ rotate_nodes.param_set_increments(1, 1);
+ rotate_nodes.param_set_digits(0);
+ stroke_width = 1.0;
}
-bool LPEShowHandles::alertsOff = false;
+bool LPEShowHandles::alerts_off = false;
/**
* Sets default styles to element
@@ -51,11 +51,11 @@ bool LPEShowHandles::alertsOff = false;
void LPEShowHandles::doOnApply(SPLPEItem const* lpeitem)
{
- if(!alertsOff) {
+ if(!alerts_off) {
char *msg = _("The \"show handles\" path effect will remove any custom style on the object you are applying it to. If this is not what you want, click Cancel.");
Gtk::MessageDialog dialog(msg, false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_OK_CANCEL, true);
gint response = dialog.run();
- alertsOff = true;
+ alerts_off = true;
if(response == GTK_RESPONSE_CANCEL) {
SPLPEItem* item = const_cast<SPLPEItem*>(lpeitem);
item->removeCurrentPathEffect(false);
@@ -76,24 +76,24 @@ void LPEShowHandles::doOnApply(SPLPEItem const* lpeitem)
void LPEShowHandles::doBeforeEffect (SPLPEItem const* lpeitem)
{
SPItem const* item = SP_ITEM(lpeitem);
- strokeWidth = item->style->stroke_width.computed;
+ stroke_width = item->style->stroke_width.computed;
}
-std::vector<Geom::Path> LPEShowHandles::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector LPEShowHandles::doEffect_path (Geom::PathVector const & path_in)
{
- std::vector<Geom::Path> path_out;
+ Geom::PathVector path_out;
Geom::PathVector const original_pathv = pathv_to_linear_and_cubic_beziers(path_in);
- if(originalPath) {
+ if(original_path) {
for (unsigned int i=0; i < path_in.size(); i++) {
path_out.push_back(path_in[i]);
}
}
- if(!outlinepath.empty()) {
- outlinepath.clear();
+ if(!outline_path.empty()) {
+ outline_path.clear();
}
generateHelperPath(original_pathv);
- for (unsigned int i=0; i < outlinepath.size(); i++) {
- path_out.push_back(outlinepath[i]);
+ for (unsigned int i=0; i < outline_path.size(); i++) {
+ path_out.push_back(outline_path[i]);
}
return path_out;
}
@@ -112,14 +112,14 @@ LPEShowHandles::generateHelperPath(Geom::PathVector result)
continue;
}
//Itreadores
- Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve
- Geom::Path::const_iterator curve_it2 = ++(path_it->begin()); // outgoing curve
- Geom::Path::const_iterator curve_endit = path_it->end_default(); // this determines when the loop has to stop
+ Geom::Path::iterator curve_it1 = path_it->begin(); // incoming curve
+ Geom::Path::iterator curve_it2 = ++(path_it->begin()); // outgoing curve
+ Geom::Path::iterator curve_endit = path_it->end_default(); // this determines when the loop has to stop
if (path_it->closed()) {
// if the path is closed, maybe we have to stop a bit earlier because the
// closing line segment has zerolength.
- const Geom::Curve &closingline = path_it->back_closed(); // the closing line segment is always of type
+ Geom::Curve const &closingline = path_it->back_closed(); // the closing line segment is always of type
// Geom::LineSegment.
if (are_near(closingline.initialPoint(), closingline.finalPoint())) {
// closingline.isDegenerate() did not work, because it only checks for
@@ -136,11 +136,11 @@ LPEShowHandles::generateHelperPath(Geom::PathVector result)
cubic = dynamic_cast<Geom::CubicBezier const *>(&*curve_it1);
if (cubic) {
if(handles) {
- if(!are_near((*cubic)[0],(*cubic)[1])){
+ if(!are_near((*cubic)[0],(*cubic)[1])) {
drawHandle((*cubic)[1]);
drawHandleLine((*cubic)[0],(*cubic)[1]);
}
- if(!are_near((*cubic)[3],(*cubic)[2])){
+ if(!are_near((*cubic)[3],(*cubic)[2])) {
drawHandle((*cubic)[2]);
drawHandleLine((*cubic)[3],(*cubic)[2]);
}
@@ -150,7 +150,7 @@ LPEShowHandles::generateHelperPath(Geom::PathVector result)
drawNode(curve_it1->finalPoint());
}
++curve_it1;
- if(curve_it2 != curve_endit){
+ if(curve_it2 != curve_endit) {
++curve_it2;
}
}
@@ -160,30 +160,27 @@ LPEShowHandles::generateHelperPath(Geom::PathVector result)
void
LPEShowHandles::drawNode(Geom::Point p)
{
- if(strokeWidth * scaleNodesAndHandles > 0.0) {
- double diameter = strokeWidth * scaleNodesAndHandles;
+ if(stroke_width * scale_nodes_and_handles > 0.0) {
+ double diameter = stroke_width * scale_nodes_and_handles;
char const * svgd;
svgd = "M 0.05,0 A 0.05,0.05 0 0 1 0,0.05 0.05,0.05 0 0 1 -0.05,0 0.05,0.05 0 0 1 0,-0.05 0.05,0.05 0 0 1 0.05,0 Z M -0.5,-0.5 0.5,-0.5 0.5,0.5 -0.5,0.5 Z";
Geom::PathVector pathv = sp_svg_read_pathv(svgd);
- pathv *= Geom::Rotate::from_degrees(rotateNodes);
- pathv *= Geom::Scale (diameter);
- pathv += p;
- outlinepath.push_back(pathv[0]);
- outlinepath.push_back(pathv[1]);
+ pathv *= Geom::Rotate::from_degrees(rotate_nodes) * Geom::Scale(diameter) * Geom::Translate(p);
+ outline_path.push_back(pathv[0]);
+ outline_path.push_back(pathv[1]);
}
}
void
LPEShowHandles::drawHandle(Geom::Point p)
{
- if(strokeWidth * scaleNodesAndHandles > 0.0) {
- double diameter = strokeWidth * scaleNodesAndHandles;
+ if(stroke_width * scale_nodes_and_handles > 0.0) {
+ double diameter = stroke_width * scale_nodes_and_handles;
char const * svgd;
svgd = "M 0.7,0.35 A 0.35,0.35 0 0 1 0.35,0.7 0.35,0.35 0 0 1 0,0.35 0.35,0.35 0 0 1 0.35,0 0.35,0.35 0 0 1 0.7,0.35 Z";
Geom::PathVector pathv = sp_svg_read_pathv(svgd);
- pathv *= Geom::Scale (diameter);
- pathv += p-Geom::Point(diameter * 0.35,diameter * 0.35);
- outlinepath.push_back(pathv[0]);
+ pathv *= Geom::Scale (diameter) * Geom::Translate(p - Geom::Point(diameter * 0.35,diameter * 0.35));
+ outline_path.push_back(pathv[0]);
}
}
@@ -192,14 +189,14 @@ void
LPEShowHandles::drawHandleLine(Geom::Point p,Geom::Point p2)
{
Geom::Path path;
- double diameter = strokeWidth * scaleNodesAndHandles;
- if(diameter > 0.0 && Geom::distance(p,p2) > (diameter * 0.35)){
+ double diameter = stroke_width * scale_nodes_and_handles;
+ if(diameter > 0.0 && Geom::distance(p,p2) > (diameter * 0.35)) {
Geom::Ray ray2(p, p2);
p2 = p2 - Geom::Point::polar(ray2.angle(),(diameter * 0.35));
}
path.start( p );
path.appendNew<Geom::LineSegment>( p2 );
- outlinepath.push_back(path);
+ outline_path.push_back(path);
}
}; //namespace LivePathEffect
diff --git a/src/live_effects/lpe-show_handles.h b/src/live_effects/lpe-show_handles.h
index a405c26ee..34390dd32 100644
--- a/src/live_effects/lpe-show_handles.h
+++ b/src/live_effects/lpe-show_handles.h
@@ -20,7 +20,7 @@ class LPEShowHandles : public Effect , GroupBBoxEffect {
public:
LPEShowHandles(LivePathEffectObject *lpeobject);
- virtual ~LPEShowHandles(){}
+ virtual ~LPEShowHandles() {}
virtual void doOnApply(SPLPEItem const* lpeitem);
@@ -36,19 +36,19 @@ public:
protected:
- virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
+ virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in);
private:
BoolParam nodes;
BoolParam handles;
- BoolParam originalPath;
- ScalarParam scaleNodesAndHandles;
- ScalarParam rotateNodes;
- double strokeWidth;
- static bool alertsOff;
+ BoolParam original_path;
+ ScalarParam scale_nodes_and_handles;
+ ScalarParam rotate_nodes;
+ double stroke_width;
+ static bool alerts_off;
- Geom::PathVector outlinepath;
+ Geom::PathVector outline_path;
LPEShowHandles(const LPEShowHandles &);
LPEShowHandles &operator=(const LPEShowHandles &);
diff --git a/src/live_effects/lpe-simplify.cpp b/src/live_effects/lpe-simplify.cpp
index 7fc20ede1..265192a17 100644
--- a/src/live_effects/lpe-simplify.cpp
+++ b/src/live_effects/lpe-simplify.cpp
@@ -164,14 +164,13 @@ LPESimplify::generateHelperPathAndSmooth(Geom::PathVector &result)
Geom::PathVector tmp_path;
Geom::CubicBezier const *cubic = NULL;
for (Geom::PathVector::iterator path_it = result.begin(); path_it != result.end(); ++path_it) {
- //Si está vacío...
if (path_it->empty()) {
continue;
}
- //Itreadores
- Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve
- Geom::Path::const_iterator curve_it2 = ++(path_it->begin());// outgoing curve
- Geom::Path::const_iterator curve_endit = path_it->end_default(); // this determines when the loop has to stop
+
+ Geom::Path::iterator curve_it1 = path_it->begin(); // incoming curve
+ Geom::Path::iterator curve_it2 = ++(path_it->begin());// outgoing curve
+ Geom::Path::iterator curve_endit = path_it->end_default(); // this determines when the loop has to stop
SPCurve *nCurve = new SPCurve();
if (path_it->closed()) {
// if the path is closed, maybe we have to stop a bit earlier because the
@@ -264,8 +263,7 @@ LPESimplify::drawNode(Geom::Point p)
char const * svgd;
svgd = "M 0.55,0.5 A 0.05,0.05 0 0 1 0.5,0.55 0.05,0.05 0 0 1 0.45,0.5 0.05,0.05 0 0 1 0.5,0.45 0.05,0.05 0 0 1 0.55,0.5 Z M 0,0 1,0 1,1 0,1 Z";
Geom::PathVector pathv = sp_svg_read_pathv(svgd);
- pathv *= Geom::Affine(r,0,0,r,0,0);
- pathv += p - Geom::Point(0.5*r,0.5*r);
+ pathv *= Geom::Scale(r) * Geom::Translate(p - Geom::Point(0.5*r,0.5*r));
hp.push_back(pathv[0]);
hp.push_back(pathv[1]);
}
@@ -277,8 +275,7 @@ LPESimplify::drawHandle(Geom::Point p)
char const * svgd;
svgd = "M 0.7,0.35 A 0.35,0.35 0 0 1 0.35,0.7 0.35,0.35 0 0 1 0,0.35 0.35,0.35 0 0 1 0.35,0 0.35,0.35 0 0 1 0.7,0.35 Z";
Geom::PathVector pathv = sp_svg_read_pathv(svgd);
- pathv *= Geom::Affine(r,0,0,r,0,0);
- pathv += p - Geom::Point(0.35*r,0.35*r);
+ pathv *= Geom::Scale(r) * Geom::Translate(p - Geom::Point(0.35*r,0.35*r));
hp.push_back(pathv[0]);
}
diff --git a/src/live_effects/lpe-skeleton.cpp b/src/live_effects/lpe-skeleton.cpp
index c61e9773f..6e4afbe9b 100644
--- a/src/live_effects/lpe-skeleton.cpp
+++ b/src/live_effects/lpe-skeleton.cpp
@@ -62,10 +62,10 @@ LPESkeleton::doEffect (SPCurve * curve)
// spice this up to make the effect actually *do* something!
}
-std::vector<Geom::Path>
-LPESkeleton::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector
+LPESkeleton::doEffect_path (Geom::PathVector const & path_in)
{
- std::vector<Geom::Path> path_out;
+ Geom::PathVector path_out;
path_out = path_in; // spice this up to make the effect actually *do* something!
diff --git a/src/live_effects/lpe-skeleton.h b/src/live_effects/lpe-skeleton.h
index 124d1a4cb..3b45b6978 100644
--- a/src/live_effects/lpe-skeleton.h
+++ b/src/live_effects/lpe-skeleton.h
@@ -36,8 +36,8 @@ public:
// Choose to implement one of the doEffect functions. You can delete or comment out the others.
// virtual void doEffect (SPCurve * curve);
-// 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);
+// virtual Geom::PathVector doEffect_path (Geom::PathVector const &path_in);
+ virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const &pwd2_in);
/* the knotholder entity classes (if any) can be declared friends */
//friend class Skeleton::KnotHolderEntityMyHandle;
diff --git a/src/live_effects/lpe-sketch.cpp b/src/live_effects/lpe-sketch.cpp
index 551dbe16a..82d343f6e 100644
--- a/src/live_effects/lpe-sketch.cpp
+++ b/src/live_effects/lpe-sketch.cpp
@@ -346,7 +346,7 @@ LPESketch::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_
//TODO: put this 4 as a parameter in the UI...
//TODO: what if with v=0?
double l = tgtlength*(1-tgtlength_rdm)/v_t.length();
- double r = std::pow(v_t.length(),3)/cross(a_t,v_t);
+ double r = std::pow(v_t.length(), 3) / cross(v_t, a_t);
r = sqrt((2*fabs(r)-tgtscale)*tgtscale)/v_t.length();
l=(r<l)?r:l;
//collect the tgt segment into output.
diff --git a/src/live_effects/lpe-spiro.cpp b/src/live_effects/lpe-spiro.cpp
index 8b4274ab2..eefd25c7d 100644
--- a/src/live_effects/lpe-spiro.cpp
+++ b/src/live_effects/lpe-spiro.cpp
@@ -10,8 +10,7 @@
#include <typeinfo>
#include <2geom/pathvector.h>
#include <2geom/affine.h>
-#include <2geom/bezier-curve.h>
-#include <2geom/hvlinesegment.h>
+#include <2geom/curves.h>
#include "helper/geom-nodetype.h"
#include "helper/geom-curves.h"
diff --git a/src/live_effects/lpe-tangent_to_curve.cpp b/src/live_effects/lpe-tangent_to_curve.cpp
index bce4876af..978ab57fb 100644
--- a/src/live_effects/lpe-tangent_to_curve.cpp
+++ b/src/live_effects/lpe-tangent_to_curve.cpp
@@ -90,7 +90,7 @@ LPETangentToCurve::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const
C = ptA - derivA * length_left;
D = ptA + derivA * length_right;
- output = Piecewise<D2<SBasis> >(D2<SBasis>(Linear(C[X], D[X]), Linear(C[Y], D[Y])));
+ output = Piecewise<D2<SBasis> >(D2<SBasis>(SBasis(C[X], D[X]), SBasis(C[Y], D[Y])));
return output;
}
@@ -135,7 +135,7 @@ KnotHolderEntityAttachPt::knot_set(Geom::Point const &p, Geom::Point const &/*or
}
Piecewise<D2<SBasis> > pwd2 = paths_to_pw( lpe->pathvector_before_effect );
- double t0 = nearest_point(s, pwd2);
+ double t0 = nearest_time(s, pwd2);
lpe->t_attach.param_set_value(t0);
// FIXME: this should not directly ask for updating the item. It should write to SVG, which triggers updating.
@@ -149,7 +149,7 @@ KnotHolderEntityLeftEnd::knot_set(Geom::Point const &p, Geom::Point const &/*ori
Geom::Point const s = snap_knot_position(p, state);
- double lambda = Geom::nearest_point(s, lpe->ptA, lpe->derivA);
+ double lambda = Geom::nearest_time(s, lpe->ptA, lpe->derivA);
lpe->length_left.param_set_value(-lambda);
sp_lpe_item_update_patheffect (SP_LPE_ITEM(item), false, true);
@@ -162,7 +162,7 @@ KnotHolderEntityRightEnd::knot_set(Geom::Point const &p, Geom::Point const &/*or
Geom::Point const s = snap_knot_position(p, state);
- double lambda = Geom::nearest_point(s, lpe->ptA, lpe->derivA);
+ double lambda = Geom::nearest_time(s, lpe->ptA, lpe->derivA);
lpe->length_right.param_set_value(lambda);
sp_lpe_item_update_patheffect (SP_LPE_ITEM(item), false, true);
diff --git a/src/live_effects/lpe-taperstroke.cpp b/src/live_effects/lpe-taperstroke.cpp
index 2c74af6d6..ef616f802 100644
--- a/src/live_effects/lpe-taperstroke.cpp
+++ b/src/live_effects/lpe-taperstroke.cpp
@@ -14,7 +14,6 @@
#include "live_effects/lpe-taperstroke.h"
#include <2geom/path.h>
-#include <2geom/shape.h>
#include <2geom/path.h>
#include <2geom/circle.h>
#include <2geom/sbasis-to-bezier.h>
@@ -126,6 +125,7 @@ void LPETaperStroke::doOnApply(SPLPEItem const* lpeitem)
sp_repr_css_attr_unref (css);
line_width.param_set_value(width);
+ line_width.write_to_SVG();
} else {
printf("WARNING: It only makes sense to apply Taper stroke to paths (not groups).\n");
}
@@ -193,7 +193,7 @@ Piecewise<D2<SBasis> > stretch_along(Piecewise<D2<SBasis> > pwd2_in, Geom::Path
Geom::PathVector LPETaperStroke::doEffect_path(Geom::PathVector const& path_in)
{
Geom::Path first_cusp = return_at_first_cusp(path_in[0]);
- Geom::Path last_cusp = return_at_first_cusp(path_in[0].reverse());
+ Geom::Path last_cusp = return_at_first_cusp(path_in[0].reversed());
bool zeroStart = false; // [distance from start taper knot -> start of path] == 0
bool zeroEnd = false; // [distance from end taper knot -> end of path] == 0
@@ -275,7 +275,7 @@ Geom::PathVector LPETaperStroke::doEffect_path(Geom::PathVector const& path_in)
pat_str << "M 1,0 C " << 1 - (double)smoothing << ",0 0,0.5 0,0.5 0,0.5 " << 1 - (double)smoothing << ",1 1,1";
pat_vec = sp_svg_read_pathv(pat_str.str().c_str());
- pwd2.concat(stretch_along(pathv_out[0].toPwSb(), pat_vec[0], -fabs(line_width)));
+ pwd2.concat(stretch_along(pathv_out[0].toPwSb(), pat_vec[0], fabs(line_width)));
throwaway_path = Geom::path_from_piecewise(pwd2, LPE_CONVERSION_TOLERANCE)[0];
real_path.append(throwaway_path);
@@ -304,7 +304,7 @@ Geom::PathVector LPETaperStroke::doEffect_path(Geom::PathVector const& path_in)
pat_vec = sp_svg_read_pathv(pat_str_1.str().c_str());
pwd2 = Piecewise<D2<SBasis> >();
- pwd2.concat(stretch_along(pathv_out[2].toPwSb(), pat_vec[0], -fabs(line_width)));
+ pwd2.concat(stretch_along(pathv_out[2].toPwSb(), pat_vec[0], fabs(line_width)));
throwaway_path = Geom::path_from_piecewise(pwd2, LPE_CONVERSION_TOLERANCE)[0];
if (!Geom::are_near(real_path.finalPoint(), throwaway_path.initialPoint()) && real_path.size() >= 1) {
@@ -317,7 +317,7 @@ Geom::PathVector LPETaperStroke::doEffect_path(Geom::PathVector const& path_in)
if (!metInMiddle) {
// append the inside outline of the path (against direction)
- throwaway_path = half_outline(pathv_out[1].reverse(), fabs(line_width)/2., miter_limit, static_cast<LineJoinType>(join_type.get_value()));
+ throwaway_path = half_outline(pathv_out[1].reversed(), fabs(line_width)/2., miter_limit, static_cast<LineJoinType>(join_type.get_value()));
if (!Geom::are_near(real_path.finalPoint(), throwaway_path.initialPoint()) && real_path.size() >= 1) {
real_path.appendNew<Geom::LineSegment>(throwaway_path.initialPoint());
@@ -389,13 +389,9 @@ Piecewise<D2<SBasis> > stretch_along(Piecewise<D2<SBasis> > pwd2_in, Geom::Path
x0 -= pattBndsX->min();
y0 -= pattBndsY->middle();
- double xspace = 0;
double noffset = 0;
double toffset = 0;
// Prevent more than 90% overlap...
- if (xspace < -pattBndsX->extent()*.9) {
- xspace = -pattBndsX->extent()*.9;
- }
y0+=noffset;
@@ -486,7 +482,7 @@ void KnotHolderEntityAttachBegin::knot_set(Geom::Point const &p, Geom::Point con
Geom::Path p_in = return_at_first_cusp(pathv[0]);
pwd2.concat(p_in.toPwSb());
- double t0 = nearest_point(s, pwd2);
+ double t0 = nearest_time(s, pwd2);
lpe->attach_start.param_set_value(t0);
// FIXME: this should not directly ask for updating the item. It should write to SVG, which triggers updating.
@@ -511,10 +507,10 @@ void KnotHolderEntityAttachEnd::knot_set(Geom::Point const &p, Geom::Point const
return;
}
Geom::PathVector pathv = lpe->pathvector_before_effect;
- Geom::Path p_in = return_at_first_cusp(pathv[0].reverse());
+ Geom::Path p_in = return_at_first_cusp(pathv[0].reversed());
Piecewise<D2<SBasis> > pwd2 = p_in.toPwSb();
- double t0 = nearest_point(s, pwd2);
+ double t0 = nearest_time(s, pwd2);
lpe->attach_end.param_set_value(t0);
sp_lpe_item_update_patheffect (SP_LPE_ITEM(item), false, true);
diff --git a/src/live_effects/lpe-test-doEffect-stack.cpp b/src/live_effects/lpe-test-doEffect-stack.cpp
index c6787aae1..2bcd4c136 100644
--- a/src/live_effects/lpe-test-doEffect-stack.cpp
+++ b/src/live_effects/lpe-test-doEffect-stack.cpp
@@ -47,14 +47,14 @@ LPEdoEffectStackTest::doEffect (SPCurve * curve)
}
}
-std::vector<Geom::Path>
-LPEdoEffectStackTest::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector
+LPEdoEffectStackTest::doEffect_path (Geom::PathVector const &path_in)
{
if (step >= 2) {
return Effect::doEffect_path(path_in);
} else {
// return here
- std::vector<Geom::Path> path_out = path_in;
+ Geom::PathVector path_out = path_in;
return path_out;
}
}
diff --git a/src/live_effects/lpe-test-doEffect-stack.h b/src/live_effects/lpe-test-doEffect-stack.h
index fa3ee09be..208a345c6 100644
--- a/src/live_effects/lpe-test-doEffect-stack.h
+++ b/src/live_effects/lpe-test-doEffect-stack.h
@@ -27,7 +27,7 @@ public:
virtual ~LPEdoEffectStackTest();
virtual void doEffect (SPCurve * curve);
- virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
+ virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in);
virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
private:
diff --git a/src/live_effects/lpe-vonkoch.cpp b/src/live_effects/lpe-vonkoch.cpp
index b52816c87..7b424e019 100644
--- a/src/live_effects/lpe-vonkoch.cpp
+++ b/src/live_effects/lpe-vonkoch.cpp
@@ -76,12 +76,12 @@ LPEVonKoch::~LPEVonKoch()
}
-std::vector<Geom::Path>
-LPEVonKoch::doEffect_path (std::vector<Geom::Path> const & path_in)
+Geom::PathVector
+LPEVonKoch::doEffect_path (Geom::PathVector const & path_in)
{
using namespace Geom;
- std::vector<Geom::Path> generating_path = generator.get_pathvector();
+ Geom::PathVector generating_path = generator.get_pathvector();
if (generating_path.empty()) {
return path_in;
@@ -148,15 +148,15 @@ LPEVonKoch::doEffect_path (std::vector<Geom::Path> const & path_in)
}
//Generate path:
- std::vector<Geom::Path> pathi = path_in;
- std::vector<Geom::Path> path_out = path_in;
+ Geom::PathVector pathi = path_in;
+ Geom::PathVector path_out = path_in;
for (unsigned i = 0; i<nbgenerations; i++){
if (drawall.get_value()){
path_out = path_in;
complexity = path_in_complexity;
}else{
- path_out = std::vector<Geom::Path>();
+ path_out = Geom::PathVector();
complexity = 0;
}
for (unsigned j = 0; j<transforms.size(); j++){
@@ -203,7 +203,7 @@ LPEVonKoch::doEffect_path (std::vector<Geom::Path> const & path_in)
hp_vec.push_back(refbox_as_vect);
}
//Draw the transformed boxes
- std::vector<Geom::Path> generating_path = generator.get_pathvector();
+ Geom::PathVector generating_path = generator.get_pathvector();
for (unsigned i=0;i<generating_path.size(); i++){
if (generating_path[i].size()==0){
//Ooops! this should not happen.
@@ -243,7 +243,7 @@ LPEVonKoch::doBeforeEffect (SPLPEItem const* lpeitem)
using namespace Geom;
original_bbox(lpeitem);
- std::vector<Geom::Path> paths = ref_path.get_pathvector();
+ Geom::PathVector paths = ref_path.get_pathvector();
Geom::Point A,B;
if (paths.empty()||paths.front().size()==0){
//FIXME: a path is used as ref instead of 2 points to work around path/point param incompatibility bug.
@@ -258,7 +258,7 @@ LPEVonKoch::doBeforeEffect (SPLPEItem const* lpeitem)
if (paths.size()!=1||paths.front().size()!=1){
Geom::Path tmp_path(A);
tmp_path.appendNew<LineSegment>(B);
- std::vector<Geom::Path> tmp_pathv;
+ Geom::PathVector tmp_pathv;
tmp_pathv.push_back(tmp_path);
ref_path.set_new_value(tmp_pathv,true);
}
@@ -282,7 +282,7 @@ LPEVonKoch::resetDefaults(SPItem const* item)
B[Geom::X] = boundingbox_X.max();
B[Geom::Y] = boundingbox_Y.middle();
- std::vector<Geom::Path> paths,refpaths;
+ Geom::PathVector paths,refpaths;
Geom::Path path = Geom::Path(A);
path.appendNew<Geom::LineSegment>(B);
@@ -298,7 +298,7 @@ LPEVonKoch::resetDefaults(SPItem const* item)
//refA[Geom::Y] = boundingbox_Y.middle();
//refB[Geom::X] = boundingbox_X.max();
//refB[Geom::Y] = boundingbox_Y.middle();
- //std::vector<Geom::Path> paths;
+ //Geom::PathVector paths;
//Geom::Path path = Geom::Path( (Point) refA);
//path.appendNew<Geom::LineSegment>( (Point) refB );
//paths.push_back(path * Affine(1./3,0,0,1./3, refA[X]*2./3, refA[Y]*2./3 + boundingbox_Y.extent()/2));
diff --git a/src/live_effects/lpe-vonkoch.h b/src/live_effects/lpe-vonkoch.h
index 7dff2be52..bffbebd54 100644
--- a/src/live_effects/lpe-vonkoch.h
+++ b/src/live_effects/lpe-vonkoch.h
@@ -49,7 +49,7 @@ public:
LPEVonKoch(LivePathEffectObject *lpeobject);
virtual ~LPEVonKoch();
- virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
+ virtual Geom::PathVector doEffect_path (Geom::PathVector const & path_in);
virtual void resetDefaults(SPItem const* item);
diff --git a/src/live_effects/lpeobject-reference.cpp b/src/live_effects/lpeobject-reference.cpp
index 573c8a2fd..d9de6e77f 100644
--- a/src/live_effects/lpeobject-reference.cpp
+++ b/src/live_effects/lpeobject-reference.cpp
@@ -43,14 +43,7 @@ LPEObjectReference::~LPEObjectReference(void)
bool LPEObjectReference::_acceptObject(SPObject * const obj) const
{
if (IS_LIVEPATHEFFECT(obj)) {
- SPObject * const owner = getOwner();
- /* Refuse references to us or to an ancestor. */
- for ( SPObject *iter = owner ; iter ; iter = iter->parent ) {
- if ( iter == obj ) {
- return false;
- }
- }
- return true;
+ return URIReference::_acceptObject(obj);
} else {
return false;
}
diff --git a/src/live_effects/parameter/filletchamferpointarray.cpp b/src/live_effects/parameter/filletchamferpointarray.cpp
index e9d375b93..b089213fd 100644
--- a/src/live_effects/parameter/filletchamferpointarray.cpp
+++ b/src/live_effects/parameter/filletchamferpointarray.cpp
@@ -11,7 +11,6 @@
#include <2geom/piecewise.h>
#include <2geom/sbasis-to-bezier.h>
#include <2geom/sbasis-geometric.h>
-#include <2geom/svg-elliptical-arc.h>
#include <2geom/line.h>
#include <2geom/path-intersection.h>
@@ -205,7 +204,7 @@ void FilletChamferPointArrayParam::recalculate_controlpoints_for_new_pwd2(
//delete temp vector
std::vector<Point>().swap(tmp);
if (last_pathv.size() > counterPaths) {
- last_pathv[counterPaths] = last_pathv[counterPaths].reverse();
+ last_pathv[counterPaths] = last_pathv[counterPaths].reversed();
}
} else {
if (last_pathv.size() > counterPaths) {
@@ -223,7 +222,7 @@ void FilletChamferPointArrayParam::recalculate_controlpoints_for_new_pwd2(
}
double xPos = 0;
if (_vector[1][X] > 0) {
- xPos = nearest_point(curve_it1->initialPoint(), pwd2_in);
+ xPos = nearest_time(curve_it1->initialPoint(), pwd2_in);
}
if (nodetype == NODE_CUSP) {
result.push_back(Point(xPos, 1));
@@ -234,7 +233,7 @@ void FilletChamferPointArrayParam::recalculate_controlpoints_for_new_pwd2(
double xPos = _vector[counter - offset][X];
if (_vector.size() <= (unsigned)(counter - offset)) {
if (_vector[1][X] > 0) {
- xPos = nearest_point(curve_it1->initialPoint(), pwd2_in);
+ xPos = nearest_time(curve_it1->initialPoint(), pwd2_in);
} else {
xPos = 0;
}
@@ -270,6 +269,9 @@ void FilletChamferPointArrayParam::recalculate_knots(
Piecewise<D2<SBasis> > const &pwd2_in)
{
bool change = false;
+ if(_vector.size() == 0){
+ return;
+ }
PathVector pathv = path_from_piecewise(pwd2_in, 0.001);
if (!pathv.empty()) {
std::vector<Point> result;
@@ -354,11 +356,6 @@ void FilletChamferPointArrayParam::set_pwd2(
last_pwd2_normal = pwd2_normal_in;
}
-void FilletChamferPointArrayParam::set_document_unit(Glib::ustring value_document_unit)
-{
- documentUnit = value_document_unit;
-}
-
void FilletChamferPointArrayParam::set_helper_size(int hs)
{
helper_size = hs;
@@ -374,11 +371,6 @@ void FilletChamferPointArrayParam::set_use_distance(bool use_knot_distance )
use_distance = use_knot_distance;
}
-void FilletChamferPointArrayParam::set_unit(const gchar *abbr)
-{
- unit = abbr;
-}
-
void FilletChamferPointArrayParam::updateCanvasIndicators()
{
std::vector<Point> ts = data();
@@ -403,8 +395,8 @@ void FilletChamferPointArrayParam::updateCanvasIndicators()
Geom::Affine aff = Geom::Affine();
aff *= Geom::Scale(helper_size);
aff *= Geom::Rotate(ray1.angle() - deg_to_rad(270));
+ aff *= Geom::Translate(last_pwd2[i].valueAt(Xvalue));
pathv *= aff;
- pathv += last_pwd2[i].valueAt(Xvalue);
hp.push_back(pathv[0]);
hp.push_back(pathv[1]);
i++;
@@ -420,7 +412,7 @@ void FilletChamferPointArrayParam::addCanvasIndicators(
double FilletChamferPointArrayParam::rad_to_len(int index, double rad)
{
double len = 0;
- std::vector<Geom::Path> subpaths = path_from_piecewise(last_pwd2, 0.1);
+ Geom::PathVector subpaths = path_from_piecewise(last_pwd2, 0.1);
std::pair<std::size_t, std::size_t> positions = get_positions(index, subpaths);
D2<SBasis> A = last_pwd2[last_index(index, subpaths)];
if(positions.second != 0){
@@ -438,7 +430,7 @@ double FilletChamferPointArrayParam::rad_to_len(int index, double rad)
Geom::Crossings cs = Geom::crossings(p0, p1);
if(cs.size() > 0){
Point cp =p0(cs[0].ta);
- double p0pt = nearest_point(cp, B);
+ double p0pt = nearest_time(cp, B);
len = time_to_len(index,p0pt);
} else {
if(rad < 0){
@@ -453,7 +445,7 @@ double FilletChamferPointArrayParam::len_to_rad(int index, double len)
double rad = 0;
double tmp_len = _vector[index][X];
_vector[index] = Geom::Point(len,_vector[index][Y]);
- std::vector<Geom::Path> subpaths = path_from_piecewise(last_pwd2, 0.1);
+ Geom::PathVector subpaths = path_from_piecewise(last_pwd2, 0.1);
std::pair<std::size_t, std::size_t> positions = get_positions(index, subpaths);
Piecewise<D2<SBasis> > u;
u.push_cut(0);
@@ -485,14 +477,14 @@ double FilletChamferPointArrayParam::len_to_rad(int index, double len)
if (cubic2) {
ray2.setPoints(endArcPoint, (*cubic2)[1]);
}
- bool ccwToggle = cross(A->finalPoint() - startArcPoint, endArcPoint - startArcPoint) < 0;
+ bool ccwToggle = cross(A->finalPoint() - startArcPoint, endArcPoint - startArcPoint) > 0;
double distanceArc = Geom::distance(startArcPoint,middle_point(startArcPoint,endArcPoint));
double angleBetween = angle_between(ray1, ray2, ccwToggle);
rad = distanceArc/sin(angleBetween/2.0);
return rad * -1;
}
-std::vector<double> FilletChamferPointArrayParam::get_times(int index, std::vector<Geom::Path> subpaths, bool last)
+std::vector<double> FilletChamferPointArrayParam::get_times(int index, Geom::PathVector subpaths, bool last)
{
const double tolerance = 0.001;
const double gapHelper = 0.00001;
@@ -501,12 +493,18 @@ std::vector<double> FilletChamferPointArrayParam::get_times(int index, std::vect
curve_it1 = subpaths[positions.first][positions.second].duplicate();
Coord it1_length = (*curve_it1).length(tolerance);
double time_it1, time_it2, time_it1_B, intpart;
+ if(_vector.size() <= index){
+ std::vector<double> out;
+ out.push_back(0);
+ out.push_back(1);
+ out.push_back(0);
+ return out;
+ }
time_it1 = modf(to_time(index, _vector[index][X]), &intpart);
if (_vector[index][Y] == 0) {
time_it1 = 0;
}
double resultLenght = 0;
- time_it1_B = 1;
if (subpaths[positions.first].closed() && last) {
time_it2 = modf(to_time(index - positions.second , _vector[index - positions.second ][X]), &intpart);
resultLenght = it1_length + to_len(index - positions.second, _vector[index - positions.second ][X]);
@@ -541,7 +539,7 @@ std::vector<double> FilletChamferPointArrayParam::get_times(int index, std::vect
return out;
}
-std::pair<std::size_t, std::size_t> FilletChamferPointArrayParam::get_positions(int index, std::vector<Geom::Path> subpaths)
+std::pair<std::size_t, std::size_t> FilletChamferPointArrayParam::get_positions(int index, Geom::PathVector subpaths)
{
int counter = -1;
std::size_t first = 0;
@@ -583,7 +581,7 @@ std::pair<std::size_t, std::size_t> FilletChamferPointArrayParam::get_positions(
return out;
}
-int FilletChamferPointArrayParam::last_index(int index, std::vector<Geom::Path> subpaths)
+int FilletChamferPointArrayParam::last_index(int index, Geom::PathVector subpaths)
{
int counter = -1;
bool inSubpath = false;
@@ -709,9 +707,9 @@ void FilletChamferPointArrayParamKnotHolderEntity::knot_set(Point const &p,
return;
}
Piecewise<D2<SBasis> > const &pwd2 = _pparam->get_pwd2();
- double t = nearest_point(p, pwd2[_index]);
+ double t = nearest_time(p, pwd2[_index]);
Geom::Point const s = snap_knot_position(pwd2[_index].valueAt(t), state);
- t = nearest_point(s, pwd2[_index]);
+ t = nearest_time(s, pwd2[_index]);
if (t == 1) {
t = 0.9999;
}
@@ -803,7 +801,7 @@ void FilletChamferPointArrayParamKnotHolderEntity::knot_click(guint state)
if(xModified < 0 && !_pparam->use_distance){
xModified = _pparam->len_to_rad(_index, _pparam->_vector.at(_index).x());
}
- std::vector<Geom::Path> subpaths = path_from_piecewise(_pparam->last_pwd2, 0.1);
+ Geom::PathVector subpaths = path_from_piecewise(_pparam->last_pwd2, 0.1);
std::pair<std::size_t, std::size_t> positions = _pparam->get_positions(_index, subpaths);
D2<SBasis> A = _pparam->last_pwd2[_pparam->last_index(_index, subpaths)];
if(positions.second != 0){
@@ -813,7 +811,7 @@ void FilletChamferPointArrayParamKnotHolderEntity::knot_click(guint state)
bool aprox = (A[0].degreesOfFreedom() != 2 || B[0].degreesOfFreedom() != 2) && !_pparam->use_distance?true:false;
Geom::Point offset = Geom::Point(xModified, _pparam->_vector.at(_index).y());
Inkscape::UI::Dialogs::FilletChamferPropertiesDialog::showDialog(
- this->desktop, offset, this, _pparam->unit, _pparam->use_distance, aprox, _pparam->documentUnit);
+ this->desktop, offset, this, _pparam->use_distance, aprox);
}
}
diff --git a/src/live_effects/parameter/filletchamferpointarray.h b/src/live_effects/parameter/filletchamferpointarray.h
index 7849d5afb..48cd26d2d 100644
--- a/src/live_effects/parameter/filletchamferpointarray.h
+++ b/src/live_effects/parameter/filletchamferpointarray.h
@@ -47,14 +47,12 @@ public:
virtual double len_to_rad(int index, double len);
virtual double len_to_time(int index, double len);
virtual double time_to_len(int index, double time);
- virtual std::pair<std::size_t, std::size_t> get_positions(int index, std::vector<Geom::Path> subpaths);
- virtual int last_index(int index, std::vector<Geom::Path> subpaths);
- std::vector<double> get_times(int index, std::vector<Geom::Path> subpaths, bool last);
+ virtual std::pair<std::size_t, std::size_t> get_positions(int index, Geom::PathVector subpaths);
+ virtual int last_index(int index, Geom::PathVector subpaths);
+ std::vector<double> get_times(int index, Geom::PathVector subpaths, bool last);
virtual void set_helper_size(int hs);
virtual void set_use_distance(bool use_knot_distance);
virtual void set_chamfer_steps(int value_chamfer_steps);
- virtual void set_document_unit(Glib::ustring value_document_unit);
- virtual void set_unit(const gchar *abbr);
virtual void addCanvasIndicators(SPLPEItem const *lpeitem,
std::vector<Geom::PathVector> &hp_vec);
virtual bool providesKnotHolderEntities() const {
@@ -89,8 +87,6 @@ private:
int helper_size;
int chamfer_steps;
bool use_distance;
- const gchar *unit;
- Glib::ustring documentUnit;
Geom::PathVector hp;
Geom::Piecewise<Geom::D2<Geom::SBasis> > last_pwd2;
diff --git a/src/live_effects/parameter/originalpath.cpp b/src/live_effects/parameter/originalpath.cpp
index 0884c4c9c..2741461be 100644
--- a/src/live_effects/parameter/originalpath.cpp
+++ b/src/live_effects/parameter/originalpath.cpp
@@ -8,10 +8,6 @@
# include "config.h"
#endif
-#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H
-#include <glibmm/threads.h>
-#endif
-
#include <gtkmm/box.h>
#include "live_effects/parameter/originalpath.h"
diff --git a/src/live_effects/parameter/originalpatharray.cpp b/src/live_effects/parameter/originalpatharray.cpp
index 7706dbdf8..78e061e66 100644
--- a/src/live_effects/parameter/originalpatharray.cpp
+++ b/src/live_effects/parameter/originalpatharray.cpp
@@ -8,10 +8,6 @@
# include "config.h"
#endif
-#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H
-#include <glibmm/threads.h>
-#endif
-
#include "live_effects/parameter/originalpatharray.h"
#include <gtkmm/widget.h>
diff --git a/src/live_effects/parameter/originalpatharray.h b/src/live_effects/parameter/originalpatharray.h
index 6c792613f..296c0f7f7 100644
--- a/src/live_effects/parameter/originalpatharray.h
+++ b/src/live_effects/parameter/originalpatharray.h
@@ -40,7 +40,7 @@ public:
}
gchar *href;
URIReference ref;
- std::vector<Geom::Path> _pathvector;
+ Geom::PathVector _pathvector;
bool reversed;
sigc::connection linked_changed_connection;
diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp
index beb750404..527bc06fe 100644
--- a/src/live_effects/parameter/parameter.cpp
+++ b/src/live_effects/parameter/parameter.cpp
@@ -42,13 +42,6 @@ Parameter::param_write_to_repr(const char * svgd)
param_effect->getRepr()->setAttribute(param_key.c_str(), svgd);
}
-// In gtk2, this wasn't an issue; we could toss around
-// G_MAXDOUBLE and not worry about size allocations. But
-// in gtk3, it is an issue: it allocates widget size for the maxmium
-// value you pass to it, leading to some insane lengths.
-// If you need this to be more, please be conservative about it.
-const double SCALARPARAM_G_MAXDOUBLE = 10000000000.0; // TODO fixme: using an arbitrary large number as a magic value seems fragile.
-
void Parameter::write_to_SVG(void)
{
gchar * str = param_getSVGValue();
diff --git a/src/live_effects/parameter/parameter.h b/src/live_effects/parameter/parameter.h
index 2e6cae49f..cc2c4f3d6 100644
--- a/src/live_effects/parameter/parameter.h
+++ b/src/live_effects/parameter/parameter.h
@@ -13,6 +13,13 @@
#include <2geom/forward.h>
#include <2geom/pathvector.h>
+// In gtk2, this wasn't an issue; we could toss around
+// G_MAXDOUBLE and not worry about size allocations. But
+// in gtk3, it is an issue: it allocates widget size for the maxmium
+// value you pass to it, leading to some insane lengths.
+// If you need this to be more, please be conservative about it.
+const double SCALARPARAM_G_MAXDOUBLE = 10000000000.0; // TODO fixme: using an arbitrary large number as a magic value seems fragile.
+
class KnotHolder;
class SPLPEItem;
class SPDesktop;
diff --git a/src/live_effects/parameter/path-reference.cpp b/src/live_effects/parameter/path-reference.cpp
index a76fb1b32..42589b050 100644
--- a/src/live_effects/parameter/path-reference.cpp
+++ b/src/live_effects/parameter/path-reference.cpp
@@ -22,7 +22,7 @@ bool PathReference::_acceptObject(SPObject * const obj) const
return false;
}
// TODO: check whether the referred path has this LPE applied, if so: deny deny deny!
- return true;
+ return URIReference::_acceptObject(obj);
} else {
return false;
}
diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp
index ba95affd9..e0369e662 100644
--- a/src/live_effects/parameter/path.cpp
+++ b/src/live_effects/parameter/path.cpp
@@ -77,7 +77,7 @@ PathParam::~PathParam()
g_free(defvalue);
}
-std::vector<Geom::Path> const &
+Geom::PathVector const &
PathParam::get_pathvector() const
{
return _pathvector;
@@ -255,7 +255,7 @@ PathParam::param_transform_multiply(Geom::Affine const& postmul, bool /*set*/)
}
/*
- * See comments for set_new_value(std::vector<Geom::Path>).
+ * See comments for set_new_value(Geom::PathVector).
*/
void
PathParam::set_new_value (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & newpath, bool write_to_svg)
@@ -291,7 +291,7 @@ PathParam::set_new_value (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & newpa
* The new path data is not written to SVG. This method will emit the signal_path_changed signal.
*/
void
-PathParam::set_new_value (std::vector<Geom::Path> const &newpath, bool write_to_svg)
+PathParam::set_new_value (Geom::PathVector const &newpath, bool write_to_svg)
{
remove_link();
_pathvector = newpath;
@@ -427,7 +427,13 @@ PathParam::paste_param_path(const char *svgd)
if (svgd && *svgd) {
// remove possible link to path
remove_link();
-
+ SPItem * item = SP_ACTIVE_DESKTOP->getSelection()->singleItem();
+ if (item != NULL) {
+ Geom::PathVector path_clipboard = sp_svg_read_pathv(svgd);
+ path_clipboard *= item->i2doc_affine().inverse();
+ svgd = sp_svg_write_path( path_clipboard );
+ }
+
param_write_to_repr(svgd);
signal_path_pasted.emit();
}
diff --git a/src/live_effects/parameter/path.h b/src/live_effects/parameter/path.h
index 112a1ea13..d2dddbe97 100644
--- a/src/live_effects/parameter/path.h
+++ b/src/live_effects/parameter/path.h
@@ -31,7 +31,7 @@ public:
const gchar * default_value = "M0,0 L1,1");
virtual ~PathParam();
- std::vector<Geom::Path> const & get_pathvector() const;
+ Geom::PathVector const & get_pathvector() const;
Geom::Piecewise<Geom::D2<Geom::SBasis> > const & get_pwd2();
virtual Gtk::Widget * param_newWidget();
@@ -41,7 +41,7 @@ public:
virtual void param_set_default();
void param_set_and_write_default();
- void set_new_value (std::vector<Geom::Path> const &newpath, bool write_to_svg);
+ void set_new_value (Geom::PathVector const &newpath, bool write_to_svg);
void set_new_value (Geom::Piecewise<Geom::D2<Geom::SBasis> > const &newpath, bool write_to_svg);
virtual void param_editOncanvas(SPItem * item, SPDesktop * dt);
@@ -59,7 +59,7 @@ public:
void on_paste_button_click();
protected:
- std::vector<Geom::Path> _pathvector; // this is primary data storage, since it is closest to SVG.
+ Geom::PathVector _pathvector; // this is primary data storage, since it is closest to SVG.
Geom::Piecewise<Geom::D2<Geom::SBasis> > _pwd2; // secondary, hence the bool must_recalculate_pwd2
bool must_recalculate_pwd2; // set when _pathvector was updated, but _pwd2 not
diff --git a/src/live_effects/parameter/powerstrokepointarray.cpp b/src/live_effects/parameter/powerstrokepointarray.cpp
index e0c2f4c68..c61e8f9cb 100644
--- a/src/live_effects/parameter/powerstrokepointarray.cpp
+++ b/src/live_effects/parameter/powerstrokepointarray.cpp
@@ -79,7 +79,7 @@ PowerStrokePointArrayParam::recalculate_controlpoints_for_new_pwd2(Geom::Piecewi
Geom::Point pt = _vector[i];
Geom::Point position = last_pwd2.valueAt(pt[Geom::X]) + pt[Geom::Y] * last_pwd2_normal.valueAt(pt[Geom::X]);
- double t = nearest_point(position, pwd2_in);
+ double t = nearest_time(position, pwd2_in);
double offset = dot(position - pwd2_in.valueAt(t), normal.valueAt(t));
_vector[i] = Geom::Point(t, offset);
}
@@ -161,7 +161,7 @@ PowerStrokePointArrayParamKnotHolderEntity::knot_set(Geom::Point const &p, Geom:
Piecewise<D2<SBasis> > const & n = _pparam->get_pwd2_normal();
Geom::Point const s = snap_knot_position(p, state);
- double t = nearest_point(s, pwd2);
+ double t = nearest_time(s, pwd2);
double offset = dot(s - pwd2.valueAt(t), n.valueAt(t));
_pparam->_vector.at(_index) = Geom::Point(t, offset);
sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false);
diff --git a/src/live_effects/spiro-converters.cpp b/src/live_effects/spiro-converters.cpp
index 3c7bdf99e..f116d5256 100644
--- a/src/live_effects/spiro-converters.cpp
+++ b/src/live_effects/spiro-converters.cpp
@@ -64,7 +64,11 @@ ConverterSPCurve::curveto(double x1, double y1, double x2, double y2, double x3,
}
-
+ConverterPath::ConverterPath(Geom::Path &path)
+ : _path(path)
+{
+ _path.setStitching(true);
+}
void
ConverterPath::moveto(double x, double y, bool is_open)
diff --git a/src/live_effects/spiro-converters.h b/src/live_effects/spiro-converters.h
index 83f6ebbc3..90855d2d6 100644
--- a/src/live_effects/spiro-converters.h
+++ b/src/live_effects/spiro-converters.h
@@ -25,7 +25,7 @@ class ConverterSPCurve : public ConverterBase {
public:
ConverterSPCurve(SPCurve &curve)
: _curve(curve)
- {} ;
+ {}
virtual void moveto(double x, double y, bool is_open);
virtual void lineto(double x, double y);
@@ -45,9 +45,7 @@ private:
*/
class ConverterPath : public ConverterBase {
public:
- ConverterPath(Geom::Path &path)
- : _path(path)
- {} ;
+ ConverterPath(Geom::Path &path);
virtual void moveto(double x, double y, bool is_open);
virtual void lineto(double x, double y);
diff --git a/src/live_effects/spiro.h b/src/live_effects/spiro.h
index 0d85da74b..066b44ca8 100644
--- a/src/live_effects/spiro.h
+++ b/src/live_effects/spiro.h
@@ -25,11 +25,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
#define INKSCAPE_SPIRO_H
#include "live_effects/spiro-converters.h"
+#include <2geom/forward.h>
class SPCurve;
-namespace Geom {
- class Path;
-}
namespace Spiro {
@@ -53,4 +51,4 @@ double get_knot_th(const spiro_seg *s, int i);
} // namespace Spiro
-#endif // INKSCAPE_SPIRO_H \ No newline at end of file
+#endif // INKSCAPE_SPIRO_H