diff options
| author | Jabiertxof <jtx@jtx> | 2017-01-22 17:53:31 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx> | 2017-01-22 17:53:31 +0000 |
| commit | d431044fc72f9b668dcfa5771f361f4d6088bdd7 (patch) | |
| tree | 69862e58b8ed2adc86ab9220ed4a28b617a65c65 /src/helper | |
| parent | Update to trunk (diff) | |
| download | inkscape-d431044fc72f9b668dcfa5771f361f4d6088bdd7.tar.gz inkscape-d431044fc72f9b668dcfa5771f361f4d6088bdd7.zip | |
Update to new code in trunk
(bzr r13645.1.166)
Diffstat (limited to 'src/helper')
| -rw-r--r-- | src/helper/geom-pathvectorsatellites.cpp | 23 | ||||
| -rw-r--r-- | src/helper/geom-pathvectorsatellites.h | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/helper/geom-pathvectorsatellites.cpp b/src/helper/geom-pathvectorsatellites.cpp index eca866978..79055af8d 100644 --- a/src/helper/geom-pathvectorsatellites.cpp +++ b/src/helper/geom-pathvectorsatellites.cpp @@ -15,6 +15,8 @@ */ #include <helper/geom-pathvectorsatellites.h> +#include "util/units.h" + Geom::PathVector PathVectorSatellites::getPathVector() const { return _pathvector; @@ -141,6 +143,27 @@ void PathVectorSatellites::updateAmount(double radius, bool apply_no_radius, boo } } +void PathVectorSatellites::convertUnit(Glib::ustring in, Glib::ustring to, bool apply_no_radius, bool apply_with_radius) +{ + for (size_t i = 0; i < _satellites.size(); ++i) { + for (size_t j = 0; j < _satellites[i].size(); ++j) { + if (!_pathvector[i].closed() && j == 0) { + _satellites[i][j].amount = 0; + continue; + } + if (_pathvector[i].size() == j) { + continue; + } + if ((!apply_no_radius && _satellites[i][j].amount == 0) || + (!apply_with_radius && _satellites[i][j].amount != 0)) + { + continue; + } + _satellites[i][j].amount = Inkscape::Util::Quantity::convert(_satellites[i][j].amount, in.c_str(), to.c_str()); + } + } +} + void PathVectorSatellites::updateSatelliteType(SatelliteType satellitetype, bool apply_no_radius, bool apply_with_radius, bool only_selected) { diff --git a/src/helper/geom-pathvectorsatellites.h b/src/helper/geom-pathvectorsatellites.h index 4a020f553..d86e6cb25 100644 --- a/src/helper/geom-pathvectorsatellites.h +++ b/src/helper/geom-pathvectorsatellites.h @@ -34,6 +34,7 @@ public: void updateSteps(size_t steps, bool apply_no_radius, bool apply_with_radius, bool only_selected); void updateAmount(double radius, bool apply_no_radius, bool apply_with_radius, bool only_selected, bool use_knot_distance, bool flexible); + void convertUnit(Glib::ustring in, Glib::ustring to, bool apply_no_radius, bool apply_with_radius); void updateSatelliteType(SatelliteType satellitetype, bool apply_no_radius, bool apply_with_radius, bool only_selected); std::pair<size_t, size_t> getIndexData(size_t index); void recalculateForNewPathVector(Geom::PathVector const pathv, Satellite const S); |
