diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-05-09 22:37:31 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2015-05-09 22:37:31 +0000 |
| commit | 6195a5fd157ff2681534aa90a279627e0048d4e1 (patch) | |
| tree | 2f3d936f145cc1b641a79dc12246bc87286672c9 /src/live_effects | |
| parent | fixing review (diff) | |
| download | inkscape-6195a5fd157ff2681534aa90a279627e0048d4e1.tar.gz inkscape-6195a5fd157ff2681534aa90a279627e0048d4e1.zip | |
fixing review
(bzr r13645.1.87)
Diffstat (limited to 'src/live_effects')
| -rw-r--r-- | src/live_effects/lpe-fillet-chamfer.cpp | 43 | ||||
| -rw-r--r-- | src/live_effects/parameter/satellitearray.cpp | 22 |
2 files changed, 34 insertions, 31 deletions
diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp index d26f47541..8d457c90b 100644 --- a/src/live_effects/lpe-fillet-chamfer.cpp +++ b/src/live_effects/lpe-fillet-chamfer.cpp @@ -20,7 +20,6 @@ #include "display/curve.h" #include "helper/geom-curves.h" #include "helper/geom-satellite.h" -#include "helper/geom-satellite-enum.h" #include "helper/geom-pathinfo.h" #include <2geom/svg-elliptical-arc.h> #include "knotholder.h" @@ -134,8 +133,14 @@ void LPEFilletChamfer::doOnApply(SPLPEItem const *lpeItem) active = false; } } - Satellite satellite(F, flexible, active, mirror_knots, hidden, 0.0, 0.0, - steps); + Satellite satellite(F); + satellite.setIsTime(flexible); + satellite.setActive(active) + satellite.setMirror(mirror_knots) + satellite.setHidden(hidden) + satellite.setAmount(0.0); + satellite.setAngle(0.0); + satellite.setSteps(steps); satellites.push_back(satellite); ++curve_it1; counter++; @@ -282,10 +287,12 @@ void LPEFilletChamfer::updateAmount() Piecewise<D2<SBasis> > pwd2 = pointwise->getPwd2(); Pathinfo path_info(pwd2); for (std::vector<Satellite>::iterator it = satellites.begin(); - it != satellites.end(); ++it) { + it != satellites.end(); ++it) + { if (!path_info.closed(it - satellites.begin()) && path_info.first(it - satellites.begin()) == - (unsigned)(it - satellites.begin())) { + (unsigned)(it - satellites.begin())) + { it->amount = 0; continue; } @@ -294,26 +301,28 @@ void LPEFilletChamfer::updateAmount() } boost::optional<size_t> previous = path_info.previous(it - satellites.begin()); - boost::optional<Geom::D2<Geom::SBasis> > previous_d2 = boost::none; - boost::optional<Satellite> previous_satellite = boost::none; - if (previous) { - previous_d2 = pwd2[*previous]; - previous_satellite = satellites[*previous]; - } if (only_selected) { Geom::Point satellite_point = pwd2.valueAt(it - satellites.begin()); if (isNodePointSelected(satellite_point)) { if (!use_knot_distance && !flexible) { - it->amount = it->radToLen(power, previous_d2, - pwd2[it - satellites.begin()], previous_satellite); + if(previous){ + it->amount = it->radToLen(power, pwd2[*previous], + pwd2[it - satellites.begin()], satellites[*previous]); + } else { + it->amount = 0.0; + } } else { it->amount = power; } } } else { if (!use_knot_distance && !flexible) { - it->amount = it->radToLen(power, previous_d2, - pwd2[it - satellites.begin()], previous_satellite); + if(previous){ + it->amount = it->radToLen(power, pwd2[*previous], + pwd2[it - satellites.begin()], satellites[*previous]); + } else { + it->amount = 0.0; + } } else { it->amount = power; } @@ -406,10 +415,10 @@ void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem) double amount = it->amount; D2<SBasis> d2_in = pwd2_in[it - sats.begin()]; if (it->isTime) { - double time = it->toTime(amount, d2_in); + double time = it->timeAtArcLength(amount, d2_in); it->amount = time; } else { - double size = it->toSize(amount, d2_in); + double size = it->arcLengthAt(amount, d2_in); it->amount = size; } } diff --git a/src/live_effects/parameter/satellitearray.cpp b/src/live_effects/parameter/satellitearray.cpp index 5a3b64dd3..5a90d1930 100644 --- a/src/live_effects/parameter/satellitearray.cpp +++ b/src/live_effects/parameter/satellitearray.cpp @@ -298,10 +298,10 @@ void FilletChamferKnotHolderEntity::knot_set(Point const &p, if (time_start > mirror_time) { mirror_time = time_start; } - double size = satellite.toSize(mirror_time, d2_in); + double size = satellite.arcLengthAt(mirror_time, d2_in); double amount = Geom::length(d2_in, Geom::EPSILON) - size; if (satellite.isTime) { - amount = satellite.toTime(amount, pwd2[index]); + amount = satellite.timeAtArcLength(amount, pwd2[index]); } satellite.amount = amount; } @@ -428,14 +428,11 @@ void FilletChamferKnotHolderEntity::knot_click(guint state) double amount = _pparam->_vector.at(index).amount; if (!_pparam->_use_distance && !_pparam->_vector.at(index).isTime) { boost::optional<size_t> prev = path_info.previous(index); - boost::optional<Geom::D2<Geom::SBasis> > prevPwd2 = boost::none; - boost::optional<Satellite> prevSat = boost::none; if (prev) { - prevPwd2 = pwd2[*prev]; - prevSat = _pparam->_vector.at(*prev); + amount = _pparam->_vector.at(index).lenToRad(amount, pwd2[*prev], pwd2[index],_pparam->_vector.at(*prev)); + } else { + amount = 0.0; } - amount = _pparam->_vector.at(index) - .lenToRad(amount, prevPwd2, pwd2[index], prevSat); } bool aprox = false; D2<SBasis> d2_out = _pparam->_last_pointwise->getPwd2()[index]; @@ -471,14 +468,11 @@ void FilletChamferKnotHolderEntity::knot_set_offset(Satellite satellite) Piecewise<D2<SBasis> > pwd2 = _pparam->_last_pointwise->getPwd2(); Pathinfo path_info(pwd2); boost::optional<size_t> prev = path_info.previous(index); - boost::optional<Geom::D2<Geom::SBasis> > prevPwd2 = boost::none; - boost::optional<Satellite> prevSat = boost::none; if (prev) { - prevPwd2 = pwd2[*prev]; - prevSat = _pparam->_vector.at(*prev); + amount = _pparam->_vector.at(index).radToLen(amount, pwd2[*prev], pwd2[index], _pparam->_vector.at(*prev)); + } else { + amount = 0.0; } - amount = _pparam->_vector.at(index) - .radToLen(amount, prevPwd2, pwd2[index], prevSat); if (max_amount > 0 && amount == 0) { amount = _pparam->_vector.at(index).amount; } |
