diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2016-05-11 20:27:45 +0000 |
|---|---|---|
| committer | jabiertxof <info@marker.es> | 2016-05-11 20:27:45 +0000 |
| commit | b03cc6d03c9cfa57ebee8c70412e96c5d92f4f83 (patch) | |
| tree | f415fc8013a6905b0771cd50a46d1a2899fbcf2e /src | |
| parent | update to trunk (diff) | |
| download | inkscape-b03cc6d03c9cfa57ebee8c70412e96c5d92f4f83.tar.gz inkscape-b03cc6d03c9cfa57ebee8c70412e96c5d92f4f83.zip | |
pre-remove of subpath update satellites
(bzr r13645.1.132)
Diffstat (limited to 'src')
| -rw-r--r-- | src/helper/geom-pointwise.cpp | 147 | ||||
| -rw-r--r-- | src/live_effects/lpe-fillet-chamfer.cpp | 28 | ||||
| -rw-r--r-- | src/live_effects/parameter/satellitesarray.cpp | 1 |
3 files changed, 90 insertions, 86 deletions
diff --git a/src/helper/geom-pointwise.cpp b/src/helper/geom-pointwise.cpp index a7082ec24..1fbed612c 100644 --- a/src/helper/geom-pointwise.cpp +++ b/src/helper/geom-pointwise.cpp @@ -54,11 +54,13 @@ void Pointwise::setSatellites(Satellites const &satellites) void Pointwise::recalculateForNewPwd2(PwD2SBasis const &A, Geom::PathVector const &B, Satellite const &S) { - if (_pwd2.size() > A.size() || _pwd2.size() < A.size()) { - recalculatePwD2(A, S); - } else { - insertDegenerateSatellites(A, B, S); - } +//Remove subpath update for this version of fillet chamfer +// if (_pwd2.size() > A.size() || _pwd2.size() < A.size()) { +// recalculatePwD2(A, S); +// } else { +// //insertDegenerateSatellites(A, B, S); +// } + recalculatePwD2(A, S); } void Pointwise::recalculatePwD2(PwD2SBasis const &A, Satellite const &S) @@ -69,7 +71,7 @@ void Pointwise::recalculatePwD2(PwD2SBasis const &A, Satellite const &S) _pathvector.clear(); size_t new_size = new_pathv.size(); size_t old_size = old_pathv.size(); - size_t old_increments = old_size; +// size_t old_increments = old_size; for (size_t i = 0; i < new_pathv.size(); i++) { bool match = false; for (size_t j = 0; j < old_pathv.size(); j++) { @@ -81,76 +83,79 @@ void Pointwise::recalculatePwD2(PwD2SBasis const &A, Satellite const &S) break; } } - if (!match && new_size > old_increments){ - std::vector<Satellite> subpath_satellites; - for (size_t k = 0; k < new_pathv[i].size_closed(); k++) { - subpath_satellites.push_back(Satellite(_satellites[0][0].satellite_type)); - } - satellites.push_back(subpath_satellites); - old_increments ++; - } - } - if (new_size == old_size) { - //we asume not change the order of subpaths when remove or add nodes to existing subpaths - for (size_t l = 0; l < old_pathv.size(); l++) { - //we assume we only can delete or add nodes not a mix of both - std::vector<Satellite> subpath_satellites; - if (old_pathv[l].size() > new_pathv[l].size()){ - //erase nodes - for (size_t m = 0; m < old_pathv[l].size(); m++) { - if (are_near(old_pathv[l][m].initialPoint(), new_pathv[l][m].initialPoint())) { - subpath_satellites.push_back(_satellites[l][m]); - } - } - if (!old_pathv[l].closed() && - are_near(old_pathv[l][old_pathv[l].size() - 1].finalPoint(), new_pathv[l][new_pathv[l].size() - 1].finalPoint())) - { - subpath_satellites.push_back(_satellites[l][old_pathv[l].size()]); - } - } else if (old_pathv[l].size() < new_pathv[l].size()) { - //add nodes - for (size_t m = 0; m < old_pathv[l].size(); m++) { - if (!are_near(old_pathv[l][m].initialPoint(), new_pathv[l][m].initialPoint())) { - _satellites[l].insert(_satellites[l].begin() + m, S); - } - } - if (!old_pathv[l].closed() && !are_near(old_pathv[l][old_pathv[l].size()-1].finalPoint(), new_pathv[l][old_pathv[l].size()-1].finalPoint())) { - _satellites[l].insert(_satellites[l].begin() + old_pathv[l].size(), S); - } - } else { - //never happends - } - satellites.push_back(subpath_satellites); + //Removed subpath update for this version of fillet chamfer + std::vector<Satellite> subpath_satellites; + for (size_t k = 0; k < new_pathv[i].size_closed(); k++) { + subpath_satellites.push_back(S); } + satellites.push_back(subpath_satellites); } - setPwd2(A); - setSatellites(satellites); -} -void Pointwise::insertDegenerateSatellites(PwD2SBasis const &A, Geom::PathVector const &B, Satellite const &S) -{ - size_t size_A = A.size(); - size_t size_B = B.curveCount(); - size_t satellite_gap = size_B - size_A; - if (satellite_gap == 0) { - return; - } - size_t counter_added = 0; - for (size_t i = 0; i < B.size(); i++) { - size_t counter = 0; - if (B[i].empty()) { - continue; - } - for (size_t j = 0; j < B[i].size_closed(); j++) { - if (B[i][j].isDegenerate() && counter_added < satellite_gap) { - counter_added++; - _satellites[i].insert(_satellites[i].begin() + counter + 1 ,S); - } - counter++; - } - } +// if (new_size == old_size) { +// //TODO: ensure select remaining old_path subpath with the updated subpath remaining in new_path +// //This cam make bug with reversed paths or reorderer ones. +// for (size_t l = 0; l < old_pathv.size(); l++) { +// //we assume we only can delete or add nodes not a mix of both +// std::vector<Satellite> subpath_satellites; +// if (old_pathv[l].size() > new_pathv[l].size()){ +// //erase nodes +// size_t erased = 0; +// for (size_t m = 0; m < old_pathv[l].size(); m++) { +// if (are_near(old_pathv[l][m].initialPoint(), new_pathv[l][m - erased].initialPoint())) { +// subpath_satellites.push_back(_satellites[l][m]); +// } else { +// erased++; +// } +// } +// if (!old_pathv[l].closed() && +// are_near(old_pathv[l][old_pathv[l].size() - 1].finalPoint(), new_pathv[l][new_pathv[l].size() - 1].finalPoint())) +// { +// subpath_satellites.push_back(_satellites[l][old_pathv[l].size()]); +// } +// } else if (old_pathv[l].size() < new_pathv[l].size()) { +// //add nodes +// for (size_t m = 0; m < old_pathv[l].size(); m++) { +// if (!are_near(old_pathv[l][m].initialPoint(), new_pathv[l][m].initialPoint())) { +// _satellites[l].insert(_satellites[l].begin() + m, S); +// } +// } +// if (!old_pathv[l].closed() && !are_near(old_pathv[l][old_pathv[l].size()-1].finalPoint(), new_pathv[l][old_pathv[l].size()-1].finalPoint())) { +// _satellites[l].insert(_satellites[l].begin() + old_pathv[l].size(), S); +// } +// } else { +// //never happends +// } +// satellites.push_back(subpath_satellites); +// } +// } setPwd2(A); + setSatellites(satellites); } +//Remove subpath update for this version of fillet chamfer +//void Pointwise::insertDegenerateSatellites(PwD2SBasis const &A, Geom::PathVector const &B, Satellite const &S) +//{ +// size_t size_A = A.size(); +// size_t size_B = B.curveCount(); +// size_t satellite_gap = size_B - size_A; +// if (satellite_gap == 0) { +// return; +// } +// size_t counter_added = 0; +// for (size_t i = 0; i < B.size(); i++) { +// size_t counter = 0; +// if (B[i].empty()) { +// continue; +// } +// for (size_t j = 0; j < B[i].size_closed(); j++) { +// if (B[i][j].isDegenerate() && counter_added < satellite_gap) { +// counter_added++; +// _satellites[i].insert(_satellites[i].begin() + counter + 1 ,S); +// } +// counter++; +// } +// } +// setPwd2(A); +//} /* Local Variables: diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp index ab1cf41e3..7379efcf6 100644 --- a/src/live_effects/lpe-fillet-chamfer.cpp +++ b/src/live_effects/lpe-fillet-chamfer.cpp @@ -410,22 +410,21 @@ void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem) } } //if are diferent sizes call to poinwise recalculate - //todo: fire a reverse satellites on reverse path. Maybe a new method - //like "are_similar" to avoid precission issues on reverse a pointwise - //and after convert to Pathvector + //TODO: Update the satellite data in paths modified, Goal 0.93 if (pointwise && number_nodes != pointwise->getTotalSatellites()) { - std::cout << "gasdfgffffffffffffffffffffffffffffffffffffffffffffffffff\n"; + pointwise->setSatellites(satellites); Satellite satellite(satellites[0][0].satellite_type); satellite.setIsTime(satellites[0][0].is_time); satellite.setHasMirror(satellites[0][0].has_mirror); pointwise->recalculateForNewPwd2(pwd2, pathv, satellite); + satellites_param.setPointwise(pointwise); } else { pointwise = new Pointwise(); pointwise->setPwd2(pwd2); pointwise->setSatellites(satellites); + satellites_param.setPointwise(pointwise); + refreshKnots(); } - satellites_param.setPointwise(pointwise); - refreshKnots(); } else { g_warning("LPE Fillet can only be applied to shapes (not groups)."); } @@ -477,16 +476,15 @@ LPEFilletChamfer::doEffect_path(Geom::PathVector const &path_in) } continue; } + if (curve_next_index && *curve_next_index != pathv[path].size() - 1 && pathv[path][*curve_next_index].isDegenerate()) { + curve_next_index = *curve_next_index + 1; + } Geom::Curve const &curve_it2 = pathv[path][*curve_next_index]; -// if (curve != pathv[path].size() && (*curve_it2).isDegenerate()) { -// ++curve_it2; -// } -// if ((*curve_it1).isDegenerate()) { -// ++curve_it1; -// counter_curves++; -// time0 = 0.0; -// continue; -// } + if ((*curve_it1).isDegenerate()) { + curve++; + time0 = 0.0; + continue; + } Satellite satellite = satellites[path][*curve_next_index]; if (!curve) { //curve == 0 if (!path_it->closed()) { diff --git a/src/live_effects/parameter/satellitesarray.cpp b/src/live_effects/parameter/satellitesarray.cpp index 9f14a1d5b..8e6ba0b41 100644 --- a/src/live_effects/parameter/satellitesarray.cpp +++ b/src/live_effects/parameter/satellitesarray.cpp @@ -339,6 +339,7 @@ Geom::Point FilletChamferKnotHolderEntity::knot_get() const return Geom::Point(Geom::infinity(), Geom::infinity()); } Geom::PathVector pathv = pointwise->getPV(); + if (pathv[_index].size() <= subindex){ //We know this path is open and is last satellite. Hide it _pparam->_vector[_index][subindex].hidden = true; return Geom::Point(Geom::infinity(), Geom::infinity()); |
