diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-05-10 20:36:27 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2015-05-10 20:36:27 +0000 |
| commit | c7925bda67f038dd5054329c43936658ca2cae76 (patch) | |
| tree | 60fbe1aab9418446cd40ab32495747034a0b65a9 /src/live_effects | |
| parent | Added some comments (diff) | |
| download | inkscape-c7925bda67f038dd5054329c43936658ca2cae76.tar.gz inkscape-c7925bda67f038dd5054329c43936658ca2cae76.zip | |
some comments and pointwise related refactor
(bzr r13645.1.91)
Diffstat (limited to 'src/live_effects')
| -rw-r--r-- | src/live_effects/lpe-fillet-chamfer.cpp | 25 | ||||
| -rw-r--r-- | src/live_effects/parameter/satellitearray.cpp | 27 |
2 files changed, 33 insertions, 19 deletions
diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp index 16bef6a99..3e7c1d0e1 100644 --- a/src/live_effects/lpe-fillet-chamfer.cpp +++ b/src/live_effects/lpe-fillet-chamfer.cpp @@ -139,8 +139,11 @@ void LPEFilletChamfer::doOnApply(SPLPEItem const *lpeItem) global_counter++; } } - pointwise = new Pointwise(pwd2_in, satellites); + pointwise = new Pointwise(); + pointwise->setPwd2(pwd2_in); + pointwise->setSatellites(satellites); pointwise->setPathInfo(original_pathv); + pointwise->setStart(); satellites_param.setPointwise(pointwise); } else { g_warning("LPE Fillet/Chamfer can only be applied to shapes (not groups)."); @@ -278,12 +281,13 @@ void LPEFilletChamfer::updateAmount() } std::vector<Satellite> satellites = pointwise->getSatellites(); Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2 = pointwise->getPwd2(); - Pathinfo path_info(pwd2); + Pathinfo* path_info = new Pathinfo(); + path_info->set(pwd2); for (std::vector<Satellite>::iterator it = satellites.begin(); it != satellites.end(); ++it) { - if (!path_info.closed(it - satellites.begin()) && - path_info.first(it - satellites.begin()) == + if (!path_info->closed(it - satellites.begin()) && + path_info->first(it - satellites.begin()) == (unsigned)(it - satellites.begin())) { it->amount = 0; @@ -293,7 +297,7 @@ void LPEFilletChamfer::updateAmount() continue; } boost::optional<size_t> previous = - path_info.previous(it - satellites.begin()); + path_info->previous(it - satellites.begin()); if (only_selected) { Geom::Point satellite_point = pwd2.valueAt(it - satellites.begin()); if (isNodePointSelected(satellite_point)) { @@ -421,8 +425,10 @@ void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem) it->hidden = hide_knots; ++it; } - Pathinfo path_info(original_pathv); - size_t number_curves = path_info.size(); + Pathinfo* path_info = new Pathinfo(); + path_info->set(original_pathv); + size_t number_curves = path_info->size(); + //if are diferent sizes call to poinwise recalculate if (pointwise && number_curves != sats.size()) { Satellite sat(sats[0].satellite_type); sat.setIsTime(sats[0].is_time); @@ -434,9 +440,12 @@ void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem) sat.setSteps(0); pointwise->recalculateForNewPwd2(pwd2_in, original_pathv, sat); } else { - pointwise = new Pointwise(pwd2_in, sats); + pointwise = new Pointwise(); + pointwise->setPwd2(pwd2_in); + pointwise->setSatellites(sats); } pointwise->setPathInfo(original_pathv); + pointwise->setStart(); satellites_param.setPointwise(pointwise); refreshKnots(); } else { diff --git a/src/live_effects/parameter/satellitearray.cpp b/src/live_effects/parameter/satellitearray.cpp index 7df849c24..4eefea0b0 100644 --- a/src/live_effects/parameter/satellitearray.cpp +++ b/src/live_effects/parameter/satellitearray.cpp @@ -76,7 +76,8 @@ void SatelliteArrayParam::updateCanvasIndicators(bool mirror) return; } Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2 = _last_pointwise->getPwd2(); - Pathinfo path_info(pwd2); + Pathinfo* path_info = new Pathinfo(); + path_info->set(pwd2); if (mirror == true) { _hp.clear(); } @@ -96,7 +97,7 @@ void SatelliteArrayParam::updateCanvasIndicators(bool mirror) 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); + boost::optional<size_t> d2_prev_index = path_info->previous(i); if (d2_prev_index) { lenght_in = Geom::length(pwd2[*d2_prev_index], Geom::EPSILON); } @@ -282,9 +283,10 @@ void FilletChamferKnotHolderEntity::knot_set(Geom::Point const &p, } Pointwise *pointwise = _pparam->_last_pointwise; Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2 = pointwise->getPwd2(); - Pathinfo path_info(pwd2); + Pathinfo* path_info = new Pathinfo(); + path_info->set(pwd2); if (_pparam->_vector.size() <= _index) { - boost::optional<size_t> d2_prev_index = path_info.previous(index); + 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 mirror_time = Geom::nearest_point(s, d2_in); @@ -330,14 +332,15 @@ Geom::Point FilletChamferKnotHolderEntity::knot_get() const } Pointwise *pointwise = _pparam->_last_pointwise; Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2 = pointwise->getPwd2(); - Pathinfo path_info(pwd2); + Pathinfo* path_info = new Pathinfo(); + path_info->set(pwd2); if (pwd2.size() <= index) { return Geom::Point(Geom::infinity(), Geom::infinity()); } this->knot->show(); if (_index >= _pparam->_vector.size()) { tmp_point = satellite.getPosition(pwd2[index]); - boost::optional<size_t> d2_prev_index = path_info.previous(index); + 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.arcDistance(pwd2[index]); @@ -420,10 +423,11 @@ void FilletChamferKnotHolderEntity::knot_click(guint state) } } else if (state & GDK_SHIFT_MASK) { Geom::Piecewise<Geom::D2<Geom::SBasis> > pwd2 = _pparam->_last_pointwise->getPwd2(); - Pathinfo path_info(pwd2); + Pathinfo* path_info = new Pathinfo(); + path_info->set(pwd2); double amount = _pparam->_vector.at(index).amount; if (!_pparam->_use_distance && !_pparam->_vector.at(index).is_time) { - boost::optional<size_t> prev = path_info.previous(index); + 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)); } else { @@ -432,7 +436,7 @@ void FilletChamferKnotHolderEntity::knot_click(guint state) } bool aprox = false; Geom::D2<Geom::SBasis> d2_out = _pparam->_last_pointwise->getPwd2()[index]; - boost::optional<size_t> d2_prev_index = path_info.previous(index); + boost::optional<size_t> d2_prev_index = path_info->previous(index); if (d2_prev_index) { Geom::D2<Geom::SBasis> d2_in = _pparam->_last_pointwise->getPwd2()[*d2_prev_index]; @@ -462,8 +466,9 @@ void FilletChamferKnotHolderEntity::knot_set_offset(Satellite satellite) double max_amount = amount; 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); + Pathinfo* path_info = new Pathinfo(); + path_info->set(pwd2); + boost::optional<size_t> prev = path_info->previous(index); if (prev) { amount = _pparam->_vector.at(index).radToLen(amount, pwd2[*prev], pwd2[index], _pparam->_vector.at(*prev)); } else { |
