diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-05-10 11:40:31 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2015-05-10 11:40:31 +0000 |
| commit | 870dbb0348163f55263eb9dca601d525d53a8d79 (patch) | |
| tree | 63ad837d271d8134f393aa587516e45cf4e6550b /src | |
| parent | update to trunk (diff) | |
| download | inkscape-870dbb0348163f55263eb9dca601d525d53a8d79.tar.gz inkscape-870dbb0348163f55263eb9dca601d525d53a8d79.zip | |
Working on Krzysztof review. Seems to be all fixed.
TODO: double check review and comment
(bzr r13645.1.89)
Diffstat (limited to 'src')
| -rw-r--r-- | src/helper/Makefile_insert | 1 | ||||
| -rw-r--r-- | src/helper/geom-pathinfo.cpp | 20 | ||||
| -rw-r--r-- | src/helper/geom-pathinfo.h | 12 | ||||
| -rw-r--r-- | src/helper/geom-pointwise.cpp | 34 | ||||
| -rw-r--r-- | src/helper/geom-pointwise.h | 20 | ||||
| -rw-r--r-- | src/helper/geom-satellite.cpp | 71 | ||||
| -rw-r--r-- | src/helper/geom-satellite.h | 55 | ||||
| -rw-r--r-- | src/live_effects/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/live_effects/lpe-fillet-chamfer.cpp | 154 | ||||
| -rw-r--r-- | src/live_effects/lpe-fillet-chamfer.h | 6 | ||||
| -rw-r--r-- | src/live_effects/parameter/array.cpp | 9 | ||||
| -rw-r--r-- | src/live_effects/parameter/satellitearray.cpp | 90 | ||||
| -rw-r--r-- | src/ui/dialog/lpe-fillet-chamfer-properties.cpp | 18 |
13 files changed, 249 insertions, 245 deletions
diff --git a/src/helper/Makefile_insert b/src/helper/Makefile_insert index 1d051734e..919234b47 100644 --- a/src/helper/Makefile_insert +++ b/src/helper/Makefile_insert @@ -20,7 +20,6 @@ ink_common_sources += \ helper/geom-pointwise.h \ helper/geom-satellite.cpp \ helper/geom-satellite.h \ - helper/geom-satellite-enum.h \ helper/gnome-utils.cpp \ helper/gnome-utils.h \ helper/mathfns.h \ diff --git a/src/helper/geom-pathinfo.cpp b/src/helper/geom-pathinfo.cpp index 9e5e409c3..5ffd1d31e 100644 --- a/src/helper/geom-pathinfo.cpp +++ b/src/helper/geom-pathinfo.cpp @@ -1,6 +1,6 @@ /** * \file - * \brief Pathinfo store the _data of a pathvector and allow get info about it + * \brief Pathinfo store the _data of a Geom::PathVector and allow get info about it */ /* * Authors: * 2015 Jabier Arraiza Cenoz<jabier.arraiza@marker.es> @@ -12,10 +12,10 @@ #include <2geom/sbasis-to-bezier.h> /** - * @brief Pathinfo store the _data of a pathvector and allow get info about it + * @brief Pathinfo store the _data of a Geom::PathVector and allow get info about it * */ -Pathinfo::Pathinfo(Piecewise<D2<SBasis> > pwd2) +Pathinfo::Pathinfo(Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2) { set(pwd2); } @@ -29,7 +29,7 @@ Pathinfo::Pathinfo(Geom::PathVector path_vector, bool skip_degenerate) Pathinfo::~Pathinfo() {} -void Pathinfo::set(Piecewise<D2<SBasis> > pwd2) +void Pathinfo::set(Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2) { set(path_from_piecewise(remove_short_cuts(pwd2, 0.1), 0.001)); } @@ -39,7 +39,7 @@ void Pathinfo::set(Geom::PathVector path_vector, bool skip_degenerate) { _data.clear(); size_t counter = 0; - for (PathVector::const_iterator path_it = path_vector.begin(); + for (Geom::PathVector::const_iterator path_it = path_vector.begin(); path_it != path_vector.end(); ++path_it) { if (path_it->empty()) { @@ -48,7 +48,7 @@ void Pathinfo::set(Geom::PathVector path_vector, bool skip_degenerate) Geom::Path::const_iterator curve_it1 = path_it->begin(); Geom::Path::const_iterator curve_endit = path_it->end_default(); if (path_it->closed()) { - const Curve &closingline = path_it->back_closed(); + Geom::Curve const &closingline = path_it->back_closed(); if (are_near(closingline.initialPoint(), closingline.finalPoint())) { curve_endit = path_it->end_open(); } @@ -69,7 +69,7 @@ void Pathinfo::set(Geom::PathVector path_vector, bool skip_degenerate) } } -size_t Pathinfo::subPathCounter() const +size_t Pathinfo::size() const { return _data.back().first + 1; } @@ -78,7 +78,11 @@ size_t Pathinfo::subPathSize(size_t index) const { size_t size = 0; if( _data.size() > index){ - size = _data[index].first + 1; + double prev = 0; + if(index != 0){ + prev = _data[index - 1].first; + } + size = prev - _data[index].first + 1; } return size; } diff --git a/src/helper/geom-pathinfo.h b/src/helper/geom-pathinfo.h index ae05f5b89..8a6c51e51 100644 --- a/src/helper/geom-pathinfo.h +++ b/src/helper/geom-pathinfo.h @@ -1,6 +1,6 @@ /** * \file - * \brief Pathinfo store data of a pathvector and allow get info about it + * \brief Pathinfo store data of a Geom::PathVector and allow get info about it * \ */ /* * Authors: @@ -16,19 +16,19 @@ #include <boost/optional.hpp> /** - * @brief Pathinfo store the data of a pathvector and allow get info about it + * @brief Pathinfo store the data of a Geom::PathVector and allow get info about it * */ -using namespace Geom; + class Pathinfo { public: - Pathinfo(Piecewise<D2<SBasis> > pwd2); + Pathinfo(Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2); Pathinfo(Geom::PathVector path_vector, bool skip_degenerate = false); virtual ~Pathinfo(); - void set(Piecewise<D2<SBasis> > pwd2); + void set(Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2); void set(Geom::PathVector path_vector, bool skip_degenerate = false); std::vector<std::pair<size_t, bool> > get(){return _data;}; - size_t subPathCounter() const; + size_t size() const; size_t subPathSize(size_t index) const; size_t subPathIndex(size_t index) const; size_t last(size_t index) const; diff --git a/src/helper/geom-pointwise.cpp b/src/helper/geom-pointwise.cpp index bd03f1d89..3041c60ea 100644 --- a/src/helper/geom-pointwise.cpp +++ b/src/helper/geom-pointwise.cpp @@ -23,7 +23,7 @@ * optional satellites, and remove the active variable in satellites. * */ -Pointwise::Pointwise(Piecewise<D2<SBasis> > pwd2, +Pointwise::Pointwise(Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2, std::vector<Satellite> satellites) : _pwd2(pwd2), _satellites(satellites), _path_info(pwd2) { @@ -34,17 +34,23 @@ Pointwise::Pointwise(Piecewise<D2<SBasis> > pwd2, Pointwise::~Pointwise() {} -Piecewise<D2<SBasis> > Pointwise::getPwd2() const +Geom::Piecewise<Geom::D2<Geom::SBasis> > Pointwise::getPwd2() const { return _pwd2; } -void Pointwise::setPwd2(Piecewise<D2<SBasis> > const pwd2_in) +void Pointwise::setPwd2(Geom::Piecewise<Geom::D2<Geom::SBasis> > const pwd2_in) { _pwd2 = pwd2_in; _path_info.set(_pwd2); } +void Pointwise::setPathInfo(Geom::PathVector const pv) +{ + _path_info.set(pv); + setStart(); +} + std::vector<Satellite> Pointwise::getSatellites() const { return _satellites; @@ -76,7 +82,7 @@ void Pointwise::setStart() /** Fired when a path is modified. */ -void Pointwise::recalculateForNewPwd2(Piecewise<D2<SBasis> > const A, Geom::PathVector const B, Satellite const S) +void Pointwise::recalculateForNewPwd2(Geom::Piecewise<Geom::D2<Geom::SBasis> > const A, Geom::PathVector const B, Satellite const S) { if (_pwd2.size() > A.size()) { pwd2Sustract(A); @@ -89,11 +95,11 @@ void Pointwise::recalculateForNewPwd2(Piecewise<D2<SBasis> > const A, Geom::Path /** Some nodes/subpaths are removed. */ -void Pointwise::pwd2Sustract(Piecewise<D2<SBasis> > const A) +void Pointwise::pwd2Sustract(Geom::Piecewise<Geom::D2<Geom::SBasis> > const A) { size_t counter = 0; std::vector<Satellite> sats; - Piecewise<D2<SBasis> > pwd2 = _pwd2; + Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2 = _pwd2; setPwd2(A); for (size_t i = 0; i < _satellites.size(); i++) { if (_path_info.last(i - counter) < i - counter || @@ -109,7 +115,7 @@ void Pointwise::pwd2Sustract(Piecewise<D2<SBasis> > const A) /** Append nodes/subpaths to current pointwise */ -void Pointwise::pwd2Append(Piecewise<D2<SBasis> > const A, Satellite const S) +void Pointwise::pwd2Append(Geom::Piecewise<Geom::D2<Geom::SBasis> > const A, Satellite const S) { size_t counter = 0; std::vector<Satellite> sats; @@ -161,7 +167,7 @@ void Pointwise::subpathToBack(size_t subpath) size_t counter = 0; std::vector<Geom::Path> tmp_path; Geom::Path to_back; - for (PathVector::const_iterator path_it = path_in.begin(); + for (Geom::PathVector::const_iterator path_it = path_in.begin(); path_it != path_in.end(); ++path_it) { if (path_it->empty()) { @@ -169,7 +175,7 @@ void Pointwise::subpathToBack(size_t subpath) } Geom::Path::const_iterator curve_it1 = path_it->begin(); Geom::Path::const_iterator curve_endit = path_it->end_default(); - const Curve &closingline = path_it->back_closed(); + Geom::Curve const &closingline = path_it->back_closed(); if (are_near(closingline.initialPoint(), closingline.finalPoint())) { curve_endit = path_it->end_open(); } @@ -207,7 +213,7 @@ void Pointwise::subpathReverse(size_t start, size_t end) size_t subpath = _path_info.subPathIndex(start); std::vector<Geom::Path> tmp_path; Geom::Path rev; - for (PathVector::const_iterator path_it = path_in.begin(); + for (Geom::PathVector::const_iterator path_it = path_in.begin(); path_it != path_in.end(); ++path_it) { if (path_it->empty()) { @@ -226,18 +232,18 @@ void Pointwise::subpathReverse(size_t start, size_t end) /** Fired when a path is modified duplicating a node. Piecewise ignore degenerated curves. */ -void Pointwise::insertDegenerateSatellites(Piecewise<D2<SBasis> > const A, Geom::PathVector const B, Satellite const S) +void Pointwise::insertDegenerateSatellites(Geom::Piecewise<Geom::D2<Geom::SBasis> > const A, Geom::PathVector const B, Satellite const S) { size_t size_A = A.size(); _path_info.set(B); - size_t size_B = _path_info.subPathCounter(); + size_t size_B = _path_info.size(); size_t satellite_gap = size_B - size_A; if (satellite_gap == 0){ return; } size_t counter = 0; size_t counter_added = 0; - for (PathVector::const_iterator path_it = B.begin(); + for (Geom::PathVector::const_iterator path_it = B.begin(); path_it != B.end(); ++path_it) { if (path_it->empty()) { @@ -246,7 +252,7 @@ void Pointwise::insertDegenerateSatellites(Piecewise<D2<SBasis> > const A, Geom: Geom::Path::const_iterator curve_it1 = path_it->begin(); Geom::Path::const_iterator curve_endit = path_it->end_default(); if (path_it->closed()) { - const Curve &closingline = path_it->back_closed(); + Geom::Curve const &closingline = path_it->back_closed(); if (are_near(closingline.initialPoint(), closingline.finalPoint())) { curve_endit = path_it->end_open(); } diff --git a/src/helper/geom-pointwise.h b/src/helper/geom-pointwise.h index 787cdbfff..b1f2235c6 100644 --- a/src/helper/geom-pointwise.h +++ b/src/helper/geom-pointwise.h @@ -33,29 +33,29 @@ * optional satellites, and remove the active variable in satellites. * */ -using namespace Geom; + class Pointwise { public: - Pointwise(Piecewise<D2<SBasis> > pwd2, std::vector<Satellite> satellites); + Pointwise(Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2, std::vector<Satellite> satellites); virtual ~Pointwise(); - Piecewise<D2<SBasis> > getPwd2() const; - void setPwd2(Piecewise<D2<SBasis> > const pwd2_in); + Geom::Piecewise<Geom::D2<Geom::SBasis> > getPwd2() const; + void setPwd2(Geom::Piecewise<Geom::D2<Geom::SBasis> > const pwd2_in); std::vector<Satellite> getSatellites() const; void setSatellites(std::vector<Satellite> const sats); - + void setPathInfo(Geom::PathVector const pv); void setStart(); - void recalculateForNewPwd2(Piecewise<D2<SBasis> > const A, Geom::PathVector const B, Satellite const S); - void pwd2Sustract(Piecewise<D2<SBasis> > const A); - void pwd2Append(Piecewise<D2<SBasis> > const A, Satellite const S); + void recalculateForNewPwd2(Geom::Piecewise<Geom::D2<Geom::SBasis> > const A, Geom::PathVector const B, Satellite const S); + void pwd2Sustract(Geom::Piecewise<Geom::D2<Geom::SBasis> > const A); + void pwd2Append(Geom::Piecewise<Geom::D2<Geom::SBasis> > const A, Satellite const S); void subpathToBack(size_t subpath); void subpathReverse(size_t start, size_t end); - void insertDegenerateSatellites(Piecewise<D2<SBasis> > const A, Geom::PathVector const B, Satellite const S); + void insertDegenerateSatellites(Geom::Piecewise<Geom::D2<Geom::SBasis> > const A, Geom::PathVector const B, Satellite const S); private: - Piecewise<D2<SBasis> > _pwd2; + Geom::Piecewise<Geom::D2<Geom::SBasis> > _pwd2; std::vector<Satellite> _satellites; Pathinfo _path_info; }; diff --git a/src/helper/geom-satellite.cpp b/src/helper/geom-satellite.cpp index 51cff7d79..c2d4ef715 100644 --- a/src/helper/geom-satellite.cpp +++ b/src/helper/geom-satellite.cpp @@ -28,7 +28,56 @@ Satellite::Satellite(SatelliteType satellite_type) Satellite::~Satellite() {} +/** + * Calculate the time in d2_in with a size of A + * TODO: find a better place to it + */ +double timeAtArcLength(double A, Geom::D2<Geom::SBasis> const d2_in) +{ + if (!d2_in.isFinite() || d2_in.isZero() || A == 0) { + return 0; + } + double t = 0; + double length_part = Geom::length(d2_in, Geom::EPSILON); + if (A > length_part || d2_in[0].degreesOfFreedom() == 2) { + if (length_part != 0) { + t = A / length_part; + } + } else if (d2_in[0].degreesOfFreedom() != 2) { + Geom::Piecewise<Geom::D2<Geom::SBasis> > u; + u.push_cut(0); + u.push(d2_in, 1); + std::vector<double> t_roots = roots(arcLengthSb(u) - A); + if (t_roots.size() > 0) { + t = t_roots[0]; + } + } + return t; +} + +/** + * Calculate the size in d2_in with a point at A + * TODO: find a better place to it + */ +double arcLengthAt(double A, Geom::D2<Geom::SBasis> const d2_in) +{ + if (!d2_in.isFinite() || d2_in.isZero() || A == 0) { + return 0; + } + double s = 0; + double length_part = Geom::length(d2_in, Geom::EPSILON); + if (A > length_part || d2_in[0].degreesOfFreedom() == 2) { + s = (A * length_part); + } else if (d2_in[0].degreesOfFreedom() != 2) { + Geom::Piecewise<Geom::D2<Geom::SBasis> > u; + u.push_cut(0); + u.push(d2_in, 1); + u = Geom::portion(u, 0.0, A); + s = Geom::length(u, 0.001); + } + return s; +} /** * Calculate the length of a satellite from a radious A input. @@ -40,17 +89,17 @@ double Satellite::radToLen( Satellite const previousSatellite) const { double len = 0; - Piecewise<D2<SBasis> > offset_curve0 = - Piecewise<D2<SBasis> >(d2_in) + + Geom::Piecewise<Geom::D2<Geom::SBasis> > offset_curve0 = + Geom::Piecewise<Geom::D2<Geom::SBasis> >(d2_in) + rot90(unitVector(derivative(d2_in))) * (A); - Piecewise<D2<SBasis> > offset_curve1 = - Piecewise<D2<SBasis> >(d2_out) + + Geom::Piecewise<Geom::D2<Geom::SBasis> > offset_curve1 = + Geom::Piecewise<Geom::D2<Geom::SBasis> >(d2_out) + rot90(unitVector(derivative(d2_out))) * (A); Geom::Path p0 = path_from_piecewise(offset_curve0, 0.1)[0]; Geom::Path p1 = path_from_piecewise(offset_curve1, 0.1)[0]; Geom::Crossings cs = Geom::crossings(p0, p1); if (cs.size() > 0) { - Point cp = p0(cs[0].ta); + Geom::Point cp = p0(cs[0].ta); double p0pt = nearest_point(cp, d2_out); len = arcLengthAt(p0pt, d2_out); } else { @@ -74,25 +123,25 @@ double Satellite::lenToRad( double time_out = timeAtArcLength(A, d2_out); Geom::Point startArcPoint = (d2_in).valueAt(time_in); Geom::Point endArcPoint = d2_out.valueAt(time_out); - Piecewise<D2<SBasis> > u; + Geom::Piecewise<Geom::D2<Geom::SBasis> > u; u.push_cut(0); u.push(d2_in, 1); Geom::Curve *C = path_from_piecewise(u, 0.1)[0][0].duplicate(); - Piecewise<D2<SBasis> > u2; + Geom::Piecewise<Geom::D2<Geom::SBasis> > u2; u2.push_cut(0); u2.push(d2_out, 1); Geom::Curve *D = path_from_piecewise(u2, 0.1)[0][0].duplicate(); - Curve *knotCurve1 = C->portion(0, time_in); - Curve *knotCurve2 = D->portion(time_out, 1); + Geom::Curve *knotCurve1 = C->portion(0, time_in); + Geom::Curve *knotCurve2 = D->portion(time_out, 1); Geom::CubicBezier const *cubic1 = dynamic_cast<Geom::CubicBezier const *>(&*knotCurve1); - Ray ray1(startArcPoint, (d2_in).valueAt(1)); + Geom::Ray ray1(startArcPoint, (d2_in).valueAt(1)); if (cubic1) { ray1.setPoints((*cubic1)[2], startArcPoint); } Geom::CubicBezier const *cubic2 = dynamic_cast<Geom::CubicBezier const *>(&*knotCurve2); - Ray ray2(d2_out.valueAt(0), endArcPoint); + Geom::Ray ray2(d2_out.valueAt(0), endArcPoint); if (cubic2) { ray2.setPoints(endArcPoint, (*cubic2)[1]); } diff --git a/src/helper/geom-satellite.h b/src/helper/geom-satellite.h index a4b1b23b9..722adbef4 100644 --- a/src/helper/geom-satellite.h +++ b/src/helper/geom-satellite.h @@ -28,7 +28,7 @@ enum SatelliteType { /** * @brief Satellite a per ?node/curve holder of data. */ -using namespace Geom; + class Satellite { public: @@ -68,57 +68,8 @@ public: double angle; size_t steps; }; - -/** - * Calculate the time in d2_in with a size of A - * TODO: find a better place to it - */ -double timeAtArcLength(double A, Geom::D2<Geom::SBasis> const d2_in) -{ - if (!d2_in.isFinite() || d2_in.isZero() || A == 0) { - return 0; - } - double t = 0; - double length_part = Geom::length(d2_in, Geom::EPSILON); - if (A > length_part || d2_in[0].degreesOfFreedom() == 2) { - if (length_part != 0) { - t = A / length_part; - } - } else if (d2_in[0].degreesOfFreedom() != 2) { - Geom::Piecewise<Geom::D2<Geom::SBasis> > u; - u.push_cut(0); - u.push(d2_in, 1); - std::vector<double> t_roots = roots(arcLengthSb(u) - A); - if (t_roots.size() > 0) { - t = t_roots[0]; - } - } - - return t; -} - -/** - * Calculate the size in d2_in with a point at A - * TODO: find a better place to it - */ -double arcLengthAt(double A, Geom::D2<Geom::SBasis> const d2_in) -{ - if (!d2_in.isFinite() || d2_in.isZero() || A == 0) { - return 0; - } - double s = 0; - double length_part = Geom::length(d2_in, Geom::EPSILON); - if (A > length_part || d2_in[0].degreesOfFreedom() == 2) { - s = (A * length_part); - } else if (d2_in[0].degreesOfFreedom() != 2) { - Geom::Piecewise<Geom::D2<Geom::SBasis> > u; - u.push_cut(0); - u.push(d2_in, 1); - u = Geom::portion(u, 0.0, A); - s = Geom::length(u, 0.001); - } - return s; -} +double timeAtArcLength(double A, Geom::D2<Geom::SBasis> const d2_in); +double arcLengthAt(double A, Geom::D2<Geom::SBasis> const d2_in); #endif // SEEN_SATELLITE_H diff --git a/src/live_effects/CMakeLists.txt b/src/live_effects/CMakeLists.txt index e06afef2f..a5bb1741c 100644 --- a/src/live_effects/CMakeLists.txt +++ b/src/live_effects/CMakeLists.txt @@ -58,11 +58,11 @@ set(live_effects_SRC parameter/array.cpp parameter/bool.cpp - parameter/parameter.cpp - parameter/path.cpp parameter/originalpath.cpp parameter/originalpatharray.cpp + parameter/parameter.cpp parameter/path-reference.cpp + parameter/path.cpp parameter/point.cpp parameter/powerstrokepointarray.cpp parameter/satellitearray.cpp diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp index 8d457c90b..16bef6a99 100644 --- a/src/live_effects/lpe-fillet-chamfer.cpp +++ b/src/live_effects/lpe-fillet-chamfer.cpp @@ -4,13 +4,6 @@ * * Copyright (C) 2014 Author(s) * - * Special thanks to Johan Engelen for the base of the effect -powerstroke- - * Also to ScislaC for point me to the idea - * Also su_v for his construvtive feedback and time - * Also to Mc- (IRC nick) for his important contribution to find real time - * values based on - * and finaly to Liam P. White for his big help on coding, that save me a lot of - * hours * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -27,7 +20,6 @@ // TODO due to internal breakage in glibmm headers, this must be last: #include <glibmm/i18n.h> -using namespace Geom; namespace Inkscape { namespace LivePathEffect { @@ -45,7 +37,7 @@ LPEFilletChamfer::LPEFilletChamfer(LivePathEffectObject *lpeobject) method(_("Method:"), _("Methods to calculate the fillet or chamfer"), "method", FMConverter, &wr, this, FM_AUTO), radius(_("Radius (unit or %):"), _("Radius, in unit or %"), "radius", &wr, - this, 0.), + this, 0.0), chamfer_steps(_("Chamfer steps:"), _("Chamfer steps"), "chamfer_steps", &wr, this, 1), flexible(_("Flexible radius size (%)"), _("Flexible radius size (%)"), @@ -78,7 +70,7 @@ LPEFilletChamfer::LPEFilletChamfer(LivePathEffectObject *lpeobject) registerParameter(&only_selected); registerParameter(&hide_knots); - radius.param_set_range(0., infinity()); + radius.param_set_range(0.0, Geom::infinity()); radius.param_set_increments(1, 1); radius.param_set_digits(4); chamfer_steps.param_set_range(1, 999); @@ -96,13 +88,13 @@ void LPEFilletChamfer::doOnApply(SPLPEItem const *lpeItem) SPLPEItem *splpeitem = const_cast<SPLPEItem *>(lpeItem); SPShape *shape = dynamic_cast<SPShape *>(splpeitem); if (shape) { - PathVector const original_pathv = + Geom::PathVector const original_pathv = pathv_to_linear_and_cubic_beziers(shape->getCurve()->get_pathvector()); - Piecewise<D2<SBasis> > pwd2_in = paths_to_pw(original_pathv); + Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2_in = paths_to_pw(original_pathv); pwd2_in = remove_short_cuts(pwd2_in, 0.01); int global_counter = 0; std::vector<Satellite> satellites; - for (PathVector::const_iterator path_it = original_pathv.begin(); + for (Geom::PathVector::const_iterator path_it = original_pathv.begin(); path_it != original_pathv.end(); ++path_it) { if (path_it->empty()) { continue; @@ -110,7 +102,7 @@ void LPEFilletChamfer::doOnApply(SPLPEItem const *lpeItem) Geom::Path::const_iterator curve_it1 = path_it->begin(); Geom::Path::const_iterator curve_endit = path_it->end_default(); if (path_it->closed()) { - Curve const &closingline = path_it->back_closed(); + Geom::Curve const &closingline = path_it->back_closed(); // the closing line segment is always of type // LineSegment. if (are_near(closingline.initialPoint(), closingline.finalPoint())) { @@ -133,11 +125,11 @@ void LPEFilletChamfer::doOnApply(SPLPEItem const *lpeItem) active = false; } } - Satellite satellite(F); + Satellite satellite(FILLET); satellite.setIsTime(flexible); - satellite.setActive(active) - satellite.setMirror(mirror_knots) - satellite.setHidden(hidden) + satellite.setActive(active); + satellite.setHasMirror(mirror_knots); + satellite.setHidden(hidden); satellite.setAmount(0.0); satellite.setAngle(0.0); satellite.setSteps(steps); @@ -148,6 +140,7 @@ void LPEFilletChamfer::doOnApply(SPLPEItem const *lpeItem) } } pointwise = new Pointwise(pwd2_in, satellites); + pointwise->setPathInfo(original_pathv); satellites_param.setPointwise(pointwise); } else { g_warning("LPE Fillet/Chamfer can only be applied to shapes (not groups)."); @@ -250,22 +243,22 @@ Gtk::Widget *LPEFilletChamfer::newWidget() void LPEFilletChamfer::fillet() { - updateSatelliteType(F); + updateSatelliteType(FILLET); } void LPEFilletChamfer::inverseFillet() { - updateSatelliteType(IF); + updateSatelliteType(INVERSE_FILLET); } void LPEFilletChamfer::chamfer() { - updateSatelliteType(C); + updateSatelliteType(CHAMFER); } void LPEFilletChamfer::inverseChamfer() { - updateSatelliteType(IC); + updateSatelliteType(INVERSE_CHAMFER); } void LPEFilletChamfer::refreshKnots() @@ -284,7 +277,7 @@ void LPEFilletChamfer::updateAmount() power = radius / 100; } std::vector<Satellite> satellites = pointwise->getSatellites(); - Piecewise<D2<SBasis> > pwd2 = pointwise->getPwd2(); + Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2 = pointwise->getPwd2(); Pathinfo path_info(pwd2); for (std::vector<Satellite>::iterator it = satellites.begin(); it != satellites.end(); ++it) @@ -335,7 +328,7 @@ void LPEFilletChamfer::updateAmount() void LPEFilletChamfer::updateChamferSteps() { std::vector<Satellite> satellites = pointwise->getSatellites(); - Piecewise<D2<SBasis> > pwd2 = pointwise->getPwd2(); + Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2 = pointwise->getPwd2(); for (std::vector<Satellite>::iterator it = satellites.begin(); it != satellites.end(); ++it) { if (ignore_radius_0 && it->amount == 0) { @@ -357,7 +350,7 @@ void LPEFilletChamfer::updateChamferSteps() void LPEFilletChamfer::updateSatelliteType(SatelliteType satellitetype) { std::vector<Satellite> satellites = pointwise->getSatellites(); - Piecewise<D2<SBasis> > pwd2 = pointwise->getPwd2(); + Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2 = pointwise->getPwd2(); for (std::vector<Satellite>::iterator it = satellites.begin(); it != satellites.end(); ++it) { if (ignore_radius_0 && it->amount == 0) { @@ -366,10 +359,10 @@ void LPEFilletChamfer::updateSatelliteType(SatelliteType satellitetype) if (only_selected) { Geom::Point satellite_point = pwd2.valueAt(it - satellites.begin()); if (isNodePointSelected(satellite_point)) { - it->satelliteType = satellitetype; + it->satellite_type = satellitetype; } } else { - it->satelliteType = satellitetype; + it->satellite_type = satellitetype; } } pointwise->setSatellites(satellites); @@ -394,9 +387,9 @@ void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem) //mandatory call satellites_param.setEffectType(effectType()); - PathVector const &original_pathv = + Geom::PathVector const original_pathv = pathv_to_linear_and_cubic_beziers(c->get_pathvector()); - Piecewise<D2<SBasis> > pwd2_in = paths_to_pw(original_pathv); + Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2_in = paths_to_pw(original_pathv); pwd2_in = remove_short_cuts(pwd2_in, 0.01); std::vector<Satellite> sats = satellites_param.data(); if(sats.empty()){ @@ -410,20 +403,20 @@ void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem) } for (std::vector<Satellite>::iterator it = sats.begin(); it != sats.end();) { - if (it->isTime != flexible) { - it->isTime = flexible; + if (it->is_time != flexible) { + it->is_time = flexible; double amount = it->amount; - D2<SBasis> d2_in = pwd2_in[it - sats.begin()]; - if (it->isTime) { - double time = it->timeAtArcLength(amount, d2_in); + Geom::D2<Geom::SBasis> d2_in = pwd2_in[it - sats.begin()]; + if (it->is_time) { + double time = timeAtArcLength(amount, d2_in); it->amount = time; } else { - double size = it->arcLengthAt(amount, d2_in); + double size = arcLengthAt(amount, d2_in); it->amount = size; } } - if (it->hasMirror != mirror_knots) { - it->hasMirror = mirror_knots; + if (it->has_mirror != mirror_knots) { + it->has_mirror = mirror_knots; } it->hidden = hide_knots; ++it; @@ -431,19 +424,19 @@ void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem) Pathinfo path_info(original_pathv); size_t number_curves = path_info.size(); if (pointwise && number_curves != sats.size()) { - bool active = true; - bool hidden = false; - bool is_time = sats[0].isTime; - bool mirror_knots = sats[0].hasMirror; - double amount = 0.0; - double degrees = 0.0; - int steps = 0; - Satellite sat(sats[0].satelliteType, is_time, active, mirror_knots, - hidden, amount, degrees, steps); + Satellite sat(sats[0].satellite_type); + sat.setIsTime(sats[0].is_time); + sat.setActive(true); + sat.setHasMirror( sats[0].has_mirror); + sat.setHidden(false); + sat.setAmount(0.0); + sat.setAngle(0.0); + sat.setSteps(0); pointwise->recalculateForNewPwd2(pwd2_in, original_pathv, sat); } else { pointwise = new Pointwise(pwd2_in, sats); } + pointwise->setPathInfo(original_pathv); satellites_param.setPointwise(pointwise); refreshKnots(); } else { @@ -466,7 +459,7 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in) 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); - for (PathVector::const_iterator path_it = path_in_processed.begin(); + for (Geom::PathVector::const_iterator path_it = path_in_processed.begin(); path_it != path_in_processed.end(); ++path_it) { if (path_it->empty()) { continue; @@ -511,7 +504,7 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in) continue; } Satellite satellite; - Curve *curve_it2_fixed = path_it->begin()->duplicate(); + Geom::Curve *curve_it2_fixed = path_it->begin()->duplicate(); if (!path_it->closed()) { if (curve_it2 != curve_endit) { curve_it2_fixed = (*curve_it2).duplicate(); @@ -520,7 +513,7 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in) } } else { if (time0 != 1) { - Curve *last_curve = curve_it1->portion(time0, 1); + Geom::Curve *last_curve = curve_it1->portion(time0, 1); last_curve->setInitial(tmp_path.finalPoint()); tmp_path.append(*last_curve); } @@ -552,7 +545,7 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in) } bool last = curve_it2 == curve_endit; - double s = satellite.size(curve_it2_fixed->toSBasis()); + double s = satellite.arcDistance(curve_it2_fixed->toSBasis()); double time1 = satellite.time(s, true, (*curve_it1).toSBasis()); double time2 = satellite.time(curve_it2_fixed->toSBasis()); if (!satellite.active) { @@ -567,15 +560,15 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in) times.push_back(time0); times.push_back(time1); times.push_back(time2); - Curve *knot_curve_1 = curve_it1->portion(times[0], times[1]); + Geom::Curve *knot_curve_1 = curve_it1->portion(times[0], times[1]); if (counter_curves > 0) { knot_curve_1->setInitial(tmp_path.finalPoint()); } else { tmp_path.start((*curve_it1).pointAt(times[0])); } - Point start_arc_point = knot_curve_1->finalPoint(); - Point end_arc_point = curve_it2_fixed->pointAt(times[2]); + Geom::Point start_arc_point = knot_curve_1->finalPoint(); + Geom::Point end_arc_point = curve_it2_fixed->pointAt(times[2]); if (times[2] == 1) { end_arc_point = curve_it2_fixed->pointAt(times[2] - GAP_HELPER); } @@ -586,22 +579,22 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in) double k2 = distance(end_arc_point, curve_it2_fixed->initialPoint()) * K; Geom::CubicBezier const *cubic_1 = dynamic_cast<Geom::CubicBezier const *>(&*knot_curve_1); - Ray ray_1(start_arc_point, curve_it1->finalPoint()); + Geom::Ray ray_1(start_arc_point, curve_it1->finalPoint()); if (cubic_1) { ray_1.setPoints((*cubic_1)[2], start_arc_point); } - Point handle_1 = Point::polar(ray_1.angle(), k1) + start_arc_point; + Geom::Point handle_1 = Geom::Point::polar(ray_1.angle(), k1) + start_arc_point; if (time0 == 1) { handle_1 = start_arc_point; } - Curve *knot_curve_2 = curve_it2_fixed->portion(times[2], 1); + Geom::Curve *knot_curve_2 = curve_it2_fixed->portion(times[2], 1); Geom::CubicBezier const *cubic_2 = dynamic_cast<Geom::CubicBezier const *>(&*knot_curve_2); - Ray ray_2(curve_it2_fixed->initialPoint(), end_arc_point); + Geom::Ray ray_2(curve_it2_fixed->initialPoint(), end_arc_point); if (cubic_2) { ray_2.setPoints(end_arc_point, (*cubic_2)[1]); } - Point handle_2 = end_arc_point - Point::polar(ray_2.angle(), k2); + Geom::Point handle_2 = end_arc_point - Geom::Point::polar(ray_2.angle(), k2); bool ccw_toggle = cross(curve_it1->finalPoint() - start_arc_point, end_arc_point - start_arc_point) < 0; @@ -610,7 +603,7 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in) if (ccw_toggle) { handleAngle = ray_1.angle() + angle; } - Point inverse_handle_1 = Point::polar(handleAngle, k1) + start_arc_point; + Geom::Point inverse_handle_1 = Geom::Point::polar(handleAngle, k1) + start_arc_point; if (time0 == 1) { inverse_handle_1 = start_arc_point; } @@ -618,39 +611,40 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in) if (ccw_toggle) { handleAngle = ray_2.angle() - angle; } - Point inverse_handle_2 = end_arc_point - Point::polar(handleAngle, k2); + Geom::Point inverse_handle_2 = end_arc_point - Geom::Point::polar(handleAngle, k2); if (times[2] == 1) { end_arc_point = curve_it2_fixed->pointAt(times[2]); } if (times[1] == times[0]) { start_arc_point = curve_it1->pointAt(times[0]); } - Line const x_line(Geom::Point(0, 0), Geom::Point(1, 0)); - Line const angled_line(start_arc_point, end_arc_point); + Geom::Line const x_line(Geom::Point(0, 0), Geom::Point(1, 0)); + Geom::Line const angled_line(start_arc_point, end_arc_point); double arc_angle = Geom::angle_between(x_line, angled_line); double radius = Geom::distance(start_arc_point, middle_point(start_arc_point, end_arc_point)) / sin(angle / 2.0); - Coord rx = radius; - Coord ry = rx; + Geom::Coord rx = radius; + Geom::Coord ry = rx; if (times[1] != 1) { if (times[1] != times[0] || times[1] == times[0] == 1) { if (!knot_curve_1->isDegenerate()) { tmp_path.append(*knot_curve_1); } } - SatelliteType type = satellite.satelliteType; + SatelliteType type = satellite.satellite_type; size_t steps = satellite.steps; if (steps < 1) { steps = 1; } - if (type == C) { + if (type == CHAMFER) { Geom::Path path_chamfer; path_chamfer.start(tmp_path.finalPoint()); if ((is_straight_curve(*curve_it1) && is_straight_curve(*curve_it2_fixed) && method != FM_BEZIER) || - method == FM_ARC) { - path_chamfer.appendNew<SVGEllipticalArc>(rx, ry, arc_angle, 0, + method == FM_ARC) + { + path_chamfer.appendNew<Geom::SVGEllipticalArc>(rx, ry, arc_angle, 0, ccw_toggle, end_arc_point); } else { path_chamfer.appendNew<Geom::CubicBezier>(handle_1, handle_2, @@ -658,19 +652,19 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in) } double chamfer_stepsTime = 1.0 / steps; for (size_t i = 1; i < steps; i++) { - Geom::Point chamfer_step = - path_chamfer.pointAt(chamfer_stepsTime * i); + Geom::Point chamfer_step = path_chamfer.pointAt(chamfer_stepsTime * i); tmp_path.appendNew<Geom::LineSegment>(chamfer_step); } tmp_path.appendNew<Geom::LineSegment>(end_arc_point); - } else if (type == IC) { + } else if (type == INVERSE_CHAMFER) { Geom::Path path_chamfer; path_chamfer.start(tmp_path.finalPoint()); if ((is_straight_curve(*curve_it1) && is_straight_curve(*curve_it2_fixed) && method != FM_BEZIER) || - method == FM_ARC) { + method == FM_ARC) + { ccw_toggle = ccw_toggle ? 0 : 1; - path_chamfer.appendNew<SVGEllipticalArc>(rx, ry, arc_angle, 0, + path_chamfer.appendNew<Geom::SVGEllipticalArc>(rx, ry, arc_angle, 0, ccw_toggle, end_arc_point); } else { path_chamfer.appendNew<Geom::CubicBezier>( @@ -683,22 +677,24 @@ LPEFilletChamfer::doEffect_path(std::vector<Geom::Path> const &path_in) tmp_path.appendNew<Geom::LineSegment>(chamfer_step); } tmp_path.appendNew<Geom::LineSegment>(end_arc_point); - } else if (type == IF) { + } else if (type == INVERSE_FILLET) { if ((is_straight_curve(*curve_it1) && is_straight_curve(*curve_it2_fixed) && method != FM_BEZIER) || - method == FM_ARC) { + method == FM_ARC) + { ccw_toggle = ccw_toggle ? 0 : 1; - tmp_path.appendNew<SVGEllipticalArc>(rx, ry, arc_angle, 0, ccw_toggle, + tmp_path.appendNew<Geom::SVGEllipticalArc>(rx, ry, arc_angle, 0, ccw_toggle, end_arc_point); } else { tmp_path.appendNew<Geom::CubicBezier>(inverse_handle_1, inverse_handle_2, end_arc_point); } - } else if (type == F) { + } else if (type == FILLET) { if ((is_straight_curve(*curve_it1) && is_straight_curve(*curve_it2_fixed) && method != FM_BEZIER) || - method == FM_ARC) { - tmp_path.appendNew<SVGEllipticalArc>(rx, ry, arc_angle, 0, ccw_toggle, + method == FM_ARC) + { + tmp_path.appendNew<Geom::SVGEllipticalArc>(rx, ry, arc_angle, 0, ccw_toggle, end_arc_point); } else { tmp_path.appendNew<Geom::CubicBezier>(handle_1, handle_2, diff --git a/src/live_effects/lpe-fillet-chamfer.h b/src/live_effects/lpe-fillet-chamfer.h index 48056924a..bab278cf5 100644 --- a/src/live_effects/lpe-fillet-chamfer.h +++ b/src/live_effects/lpe-fillet-chamfer.h @@ -7,11 +7,7 @@ * * Copyright (C) 2014 Author(s) * - * Special thanks to Johan Engelen for the base of the effect -powerstroke- - * Also to ScislaC for point me to the idea - * Also su_v for his construvtive feedback and time - * and finaly to Liam P. White for his big help on coding, that save me a lot of - * hours + * Jabiertxof:Thanks to all people help me * * Released under GNU GPL, read the file 'COPYING' for more information */ diff --git a/src/live_effects/parameter/array.cpp b/src/live_effects/parameter/array.cpp index c71b8ed55..9b326fe32 100644 --- a/src/live_effects/parameter/array.cpp +++ b/src/live_effects/parameter/array.cpp @@ -83,7 +83,14 @@ ArrayParam<Satellite >::readsvg(const gchar * str) if (sp_svg_satellite_read_d(str, &sat)) { return sat; } - Satellite satellite(Geom::F, true, false, false, true, 0.0, 0.0, 0); + Satellite satellite(FILLET); + satellite.setIsTime(true); + satellite.setActive(false); + satellite.setHasMirror(false); + satellite.setHidden(true); + satellite.setAmount(0.0); + satellite.setAngle(0.0); + satellite.setSteps(0); return satellite; } diff --git a/src/live_effects/parameter/satellitearray.cpp b/src/live_effects/parameter/satellitearray.cpp index 5a90d1930..7df849c24 100644 --- a/src/live_effects/parameter/satellitearray.cpp +++ b/src/live_effects/parameter/satellitearray.cpp @@ -1,10 +1,8 @@ /* - * Copyright (C) Jabiertxo Arraiza Cenoz <jabier.arraiza@marker.es> - * Special thanks to Johan Engelen for the base of the effect -powerstroke- - * Also to ScislaC for point me to the idea - * Also su_v for his construvtive feedback and time - * and finaly to Liam P. White for his big help on coding, that save me a lot of - * hours + * Author(s): + * Jabiertxo Arraiza Cenoz <jabier.arraiza@marker.es> + * + * Copyright (C) 2014 Author(s) * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -19,8 +17,6 @@ // this has to be included last. #include <glibmm/i18n.h> -using namespace Geom; - namespace Inkscape { namespace LivePathEffect { @@ -88,7 +84,7 @@ void SatelliteArrayParam::updateCanvasIndicators(bool mirror) if (!_vector[i].active || _vector[i].hidden) { continue; } - if ((!_vector[i].hasMirror && mirror == true) || _vector[i].amount == 0) { + if ((!_vector[i].has_mirror && mirror == true) || _vector[i].amount == 0) { continue; } double pos = 0; @@ -97,7 +93,7 @@ void SatelliteArrayParam::updateCanvasIndicators(bool mirror) } Geom::D2<Geom::SBasis> d2 = pwd2[i]; bool overflow = false; - double size_out = _vector[i].size(pwd2[i]); + double size_out = _vector[i].arcDistance(pwd2[i]); double lenght_out = Geom::length(pwd2[i], Geom::EPSILON); double lenght_in = 0; boost::optional<size_t> d2_prev_index = path_info.previous(i); @@ -133,9 +129,9 @@ void SatelliteArrayParam::updateCanvasIndicators(bool mirror) Geom::Affine aff = Geom::Affine(); aff *= Geom::Scale(_helper_size); if (mirror == true) { - aff *= Geom::Rotate(ray_1.angle() - deg_to_rad(90)); + aff *= Geom::Rotate(ray_1.angle() - Geom::deg_to_rad(90)); } else { - aff *= Geom::Rotate(ray_1.angle() - deg_to_rad(270)); + aff *= Geom::Rotate(ray_1.angle() - Geom::deg_to_rad(270)); } pathv *= aff; pathv += d2.valueAt(pos); @@ -161,9 +157,9 @@ void SatelliteArrayParam::updateCanvasIndicators(bool mirror) aff = Geom::Affine(); aff *= Geom::Scale(_helper_size / 2.0); if (mirror == true) { - aff *= Geom::Rotate(ray_1.angle() - deg_to_rad(90)); + aff *= Geom::Rotate(ray_1.angle() - Geom::deg_to_rad(90)); } else { - aff *= Geom::Rotate(ray_1.angle() - deg_to_rad(270)); + aff *= Geom::Rotate(ray_1.angle() - Geom::deg_to_rad(270)); } pathv *= aff; pathv += d2.valueAt(pos); @@ -193,7 +189,7 @@ void SatelliteArrayParam::param_transform_multiply(Geom::Affine const &postmul, if (prefs->getBool("/options/transform/rectcorners", true)) { for (size_t i = 0; i < _vector.size(); ++i) { - if (!_vector[i].isTime && _vector[i].amount > 0) { + if (!_vector[i].is_time && _vector[i].amount > 0) { _vector[i].amount = _vector[i].amount * ((postmul.expansionX() + postmul.expansionY()) / 2); } @@ -214,23 +210,23 @@ void SatelliteArrayParam::addKnotHolderEntities(KnotHolder *knotholder, if (!_vector[i].active) { continue; } - if (!_vector[i].hasMirror && mirror == true) { + if (!_vector[i].has_mirror && mirror == true) { continue; } using namespace Geom; - SatelliteType type = _vector[i].satelliteType; + SatelliteType type = _vector[i].satellite_type; //IF is for filletChamfer effect... if (_effectType == FILLET_CHAMFER) { const gchar *tip; - if (type == C) { + if (type == CHAMFER) { tip = _("<b>Chamfer</b>: <b>Ctrl+Click</b> toggle type, " "<b>Shift+Click</b> open dialog, " "<b>Ctrl+Alt+Click</b> reset"); - } else if (type == IC) { + } else if (type == INVERSE_CHAMFER) { tip = _("<b>Inverse Chamfer</b>: <b>Ctrl+Click</b> toggle type, " "<b>Shift+Click</b> open dialog, " "<b>Ctrl+Alt+Click</b> reset"); - } else if (type == IF) { + } else if (type == INVERSE_FILLET) { tip = _("<b>Inverse Fillet</b>: <b>Ctrl+Click</b> toggle type, " "<b>Shift+Click</b> open dialog, " "<b>Ctrl+Alt+Click</b> reset"); @@ -263,8 +259,8 @@ FilletChamferKnotHolderEntity::FilletChamferKnotHolderEntity( SatelliteArrayParam *p, size_t index) : _pparam(p), _index(index) {} -void FilletChamferKnotHolderEntity::knot_set(Point const &p, - Point const &/*origin*/, +void FilletChamferKnotHolderEntity::knot_set(Geom::Point const &p, + Geom::Point const &/*origin*/, guint state) { Geom::Point s = snap_knot_position(p, state); @@ -298,10 +294,10 @@ void FilletChamferKnotHolderEntity::knot_set(Point const &p, if (time_start > mirror_time) { mirror_time = time_start; } - double size = satellite.arcLengthAt(mirror_time, d2_in); + double size = arcLengthAt(mirror_time, d2_in); double amount = Geom::length(d2_in, Geom::EPSILON) - size; - if (satellite.isTime) { - amount = satellite.timeAtArcLength(amount, pwd2[index]); + if (satellite.is_time) { + amount = timeAtArcLength(amount, pwd2[index]); } satellite.amount = amount; } @@ -323,20 +319,20 @@ Geom::Point FilletChamferKnotHolderEntity::knot_get() const index = _index - _pparam->_vector.size(); } if (!valid_index(index)) { - return Point(infinity(), infinity()); + return Geom::Point(Geom::infinity(), Geom::infinity()); } Satellite satellite = _pparam->_vector.at(index); if (!_pparam->_last_pointwise) { - return Point(infinity(), infinity()); + return Geom::Point(Geom::infinity(), Geom::infinity()); } if (!satellite.active || satellite.hidden) { - return Point(infinity(), infinity()); + return Geom::Point(Geom::infinity(), Geom::infinity()); } Pointwise *pointwise = _pparam->_last_pointwise; Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2 = pointwise->getPwd2(); Pathinfo path_info(pwd2); if (pwd2.size() <= index) { - return Point(infinity(), infinity()); + return Geom::Point(Geom::infinity(), Geom::infinity()); } this->knot->show(); if (_index >= _pparam->_vector.size()) { @@ -344,7 +340,7 @@ Geom::Point FilletChamferKnotHolderEntity::knot_get() const boost::optional<size_t> d2_prev_index = path_info.previous(index); if (d2_prev_index) { Geom::D2<Geom::SBasis> d2_in = pwd2[*d2_prev_index]; - double s = satellite.size(pwd2[index]); + double s = satellite.arcDistance(pwd2[index]); double t = satellite.time(s, true, d2_in); if (t > 1) { t = 1; @@ -383,34 +379,34 @@ void FilletChamferKnotHolderEntity::knot_click(guint state) sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false); } else { using namespace Geom; - SatelliteType type = _pparam->_vector.at(index).satelliteType; + SatelliteType type = _pparam->_vector.at(index).satellite_type; switch (type) { - case F: - type = IF; + case FILLET: + type = INVERSE_FILLET; break; - case IF: - type = C; + case INVERSE_FILLET: + type = CHAMFER; break; - case C: - type = IC; + case CHAMFER: + type = INVERSE_CHAMFER; break; default: - type = F; + type = FILLET; break; } - _pparam->_vector.at(index).satelliteType = type; + _pparam->_vector.at(index).satellite_type = type; _pparam->param_set_and_write_new_value(_pparam->_vector); sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false); const gchar *tip; - if (type == C) { + if (type == CHAMFER) { tip = _("<b>Chamfer</b>: <b>Ctrl+Click</b> toggle type, " "<b>Shift+Click</b> open dialog, " "<b>Ctrl+Alt+Click</b> reset"); - } else if (type == IC) { + } else if (type == INVERSE_CHAMFER) { tip = _("<b>Inverse Chamfer</b>: <b>Ctrl+Click</b> toggle type, " "<b>Shift+Click</b> open dialog, " "<b>Ctrl+Alt+Click</b> reset"); - } else if (type == IF) { + } else if (type == INVERSE_FILLET) { tip = _("<b>Inverse Fillet</b>: <b>Ctrl+Click</b> toggle type, " "<b>Shift+Click</b> open dialog, " "<b>Ctrl+Alt+Click</b> reset"); @@ -423,10 +419,10 @@ void FilletChamferKnotHolderEntity::knot_click(guint state) this->knot->show(); } } else if (state & GDK_SHIFT_MASK) { - Piecewise<D2<SBasis> > pwd2 = _pparam->_last_pointwise->getPwd2(); + Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2 = _pparam->_last_pointwise->getPwd2(); Pathinfo path_info(pwd2); double amount = _pparam->_vector.at(index).amount; - if (!_pparam->_use_distance && !_pparam->_vector.at(index).isTime) { + if (!_pparam->_use_distance && !_pparam->_vector.at(index).is_time) { boost::optional<size_t> prev = path_info.previous(index); if (prev) { amount = _pparam->_vector.at(index).lenToRad(amount, pwd2[*prev], pwd2[index],_pparam->_vector.at(*prev)); @@ -435,7 +431,7 @@ void FilletChamferKnotHolderEntity::knot_click(guint state) } } bool aprox = false; - D2<SBasis> d2_out = _pparam->_last_pointwise->getPwd2()[index]; + Geom::D2<Geom::SBasis> d2_out = _pparam->_last_pointwise->getPwd2()[index]; boost::optional<size_t> d2_prev_index = path_info.previous(index); if (d2_prev_index) { Geom::D2<Geom::SBasis> d2_in = @@ -464,8 +460,8 @@ void FilletChamferKnotHolderEntity::knot_set_offset(Satellite satellite) } double amount = satellite.amount; double max_amount = amount; - if (!_pparam->_use_distance && !satellite.isTime) { - Piecewise<D2<SBasis> > pwd2 = _pparam->_last_pointwise->getPwd2(); + if (!_pparam->_use_distance && !satellite.is_time) { + Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2 = _pparam->_last_pointwise->getPwd2(); Pathinfo path_info(pwd2); boost::optional<size_t> prev = path_info.previous(index); if (prev) { diff --git a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp index 2b49d1952..f89668a4c 100644 --- a/src/ui/dialog/lpe-fillet-chamfer-properties.cpp +++ b/src/ui/dialog/lpe-fillet-chamfer-properties.cpp @@ -151,13 +151,13 @@ void FilletChamferPropertiesDialog::_apply() double d_pos = _fillet_chamfer_position_numeric.get_value(); if (d_pos >= 0) { if (_fillet_chamfer_type_fillet.get_active() == true) { - _satellite.satelliteType = Geom::F; + _satellite.satellite_type = FILLET; } else if (_fillet_chamfer_type_inverse_fillet.get_active() == true) { - _satellite.satelliteType = Geom::IF; + _satellite.satellite_type = INVERSE_FILLET; } else if (_fillet_chamfer_type_inverse_chamfer.get_active() == true) { - _satellite.satelliteType = Geom::IC; + _satellite.satellite_type = INVERSE_CHAMFER; } else { - _satellite.satelliteType = Geom::C; + _satellite.satellite_type = CHAMFER; } if (_flexible) { if (d_pos > 99.99999 || d_pos < 0) { @@ -210,7 +210,7 @@ void FilletChamferPropertiesDialog::_setSatellite(Satellite satellite) if(_use_distance) { distance_or_radius = std::string(_("Knot distance")); } - if (satellite.isTime) { + if (satellite.is_time) { position = _amount * 100; _flexible = true; _fillet_chamfer_position_label.set_label(_("Position (%):")); @@ -222,13 +222,13 @@ void FilletChamferPropertiesDialog::_setSatellite(Satellite satellite) } _fillet_chamfer_position_numeric.set_value(position); _fillet_chamfer_chamfer_subdivisions.set_value(satellite.steps); - if (satellite.satelliteType == Geom::F) { + if (satellite.satellite_type == FILLET) { _fillet_chamfer_type_fillet.set_active(true); - } else if (satellite.satelliteType == Geom::IF) { + } else if (satellite.satellite_type == INVERSE_FILLET) { _fillet_chamfer_type_inverse_fillet.set_active(true); - } else if (satellite.satelliteType == Geom::C) { + } else if (satellite.satellite_type == CHAMFER) { _fillet_chamfer_type_chamfer.set_active(true); - } else if (satellite.satelliteType == Geom::IC) { + } else if (satellite.satellite_type == INVERSE_CHAMFER) { _fillet_chamfer_type_inverse_chamfer.set_active(true); } _satellite = satellite; |
