diff --git a/src/helper/geom-nodesatellite.h b/src/helper/geom-nodesatellite.h index 1bb6c540e99dc7104733f660a47f1d9cfe6c8464..4b32770af66b8f3d9b4ab0d0d5075db224551383 100644 --- a/src/helper/geom-nodesatellite.h +++ b/src/helper/geom-nodesatellite.h @@ -61,7 +61,7 @@ public: { angle = set_angle; } - void setSteps(size_t set_steps) + void setSteps(std::size_t set_steps) { steps = set_steps; } @@ -89,7 +89,7 @@ public: // in "amount" we store the time or distance used in the nodesatellite double amount; double angle; - size_t steps; + std::size_t steps; }; double timeAtArcLength(double const A, Geom::Curve const &curve_in); diff --git a/src/helper/geom-pathvector_nodesatellites.cpp b/src/helper/geom-pathvector_nodesatellites.cpp index a8bc0744fb90faae425f93ded582a92f541087bd..288161d1ee2634c954b1d7384b2cecb63a48e62e 100644 --- a/src/helper/geom-pathvector_nodesatellites.cpp +++ b/src/helper/geom-pathvector_nodesatellites.cpp @@ -42,20 +42,20 @@ void PathVectorNodeSatellites::setNodeSatellites(NodeSatellites nodesatellites) _nodesatellites = nodesatellites; } -size_t PathVectorNodeSatellites::getTotalNodeSatellites() +std::size_t PathVectorNodeSatellites::getTotalNodeSatellites() { - size_t counter = 0; + std::size_t counter = 0; for (auto &_nodesatellite : _nodesatellites) { counter += _nodesatellite.size(); } return counter; } -std::pair PathVectorNodeSatellites::getIndexData(size_t index) +std::pair PathVectorNodeSatellites::getIndexData(std::size_t index) { - size_t counter = 0; - for (size_t i = 0; i < _nodesatellites.size(); ++i) { - for (size_t j = 0; j < _nodesatellites[i].size(); ++j) { + std::size_t counter = 0; + for (std::size_t i = 0; i < _nodesatellites.size(); ++i) { + for (std::size_t j = 0; j < _nodesatellites[i].size(); ++j) { if (index == counter) { return std::make_pair(i,j); } @@ -65,9 +65,9 @@ std::pair PathVectorNodeSatellites::getIndexData(size_t index) return std::make_pair(0,0); } -void PathVectorNodeSatellites::setSelected(std::vector selected) +void PathVectorNodeSatellites::setSelected(std::vector selected) { - size_t counter = 0; + std::size_t counter = 0; for (auto &_nodesatellite : _nodesatellites) { for (auto &j : _nodesatellite) { if (find (selected.begin(), selected.end(), counter) != selected.end()) { @@ -80,7 +80,7 @@ void PathVectorNodeSatellites::setSelected(std::vector selected) } } -void PathVectorNodeSatellites::updateSteps(size_t steps, bool apply_no_radius, bool apply_with_radius, +void PathVectorNodeSatellites::updateSteps(std::size_t steps, bool apply_no_radius, bool apply_with_radius, bool only_selected) { for (auto &_nodesatellite : _nodesatellites) { @@ -110,9 +110,9 @@ void PathVectorNodeSatellites::updateAmount(double radius, bool apply_no_radius, } else { power = radius / 100; } - for (size_t i = 0; i < _nodesatellites.size(); ++i) { - for (size_t j = 0; j < _nodesatellites[i].size(); ++j) { - std::optional previous_index = std::nullopt; + for (std::size_t i = 0; i < _nodesatellites.size(); ++i) { + for (std::size_t j = 0; j < _nodesatellites[i].size(); ++j) { + std::optional previous_index = std::nullopt; if (j == 0 && _pathvector[i].closed()) { previous_index = count_path_nodes(_pathvector[i]) - 1; } else if (!_pathvector[i].closed() || j != 0) { @@ -152,8 +152,8 @@ void PathVectorNodeSatellites::updateAmount(double radius, bool apply_no_radius, void PathVectorNodeSatellites::convertUnit(Glib::ustring in, Glib::ustring to, bool apply_no_radius, bool apply_with_radius) { - for (size_t i = 0; i < _nodesatellites.size(); ++i) { - for (size_t j = 0; j < _nodesatellites[i].size(); ++j) { + for (std::size_t i = 0; i < _nodesatellites.size(); ++i) { + for (std::size_t j = 0; j < _nodesatellites[i].size(); ++j) { if (!_pathvector[i].closed() && j == 0) { _nodesatellites[i][j].amount = 0; continue; @@ -174,8 +174,8 @@ void PathVectorNodeSatellites::convertUnit(Glib::ustring in, Glib::ustring to, b void PathVectorNodeSatellites::updateNodeSatelliteType(NodeSatelliteType nodesatellitetype, bool apply_no_radius, bool apply_with_radius, bool only_selected) { - for (size_t i = 0; i < _nodesatellites.size(); ++i) { - for (size_t j = 0; j < _nodesatellites[i].size(); ++j) { + for (std::size_t i = 0; i < _nodesatellites.size(); ++i) { + for (std::size_t j = 0; j < _nodesatellites[i].size(); ++j) { if ((!apply_no_radius && _nodesatellites[i][j].amount == 0) || (!apply_with_radius && _nodesatellites[i][j].amount != 0)) { continue; @@ -206,18 +206,18 @@ void PathVectorNodeSatellites::recalculateForNewPathVector(Geom::PathVector cons NodeSatellites nodesatellites; bool found = false; // TODO evaluate fix on nodes at same position - // size_t number_nodes = count_pathvector_nodes(pathv); - // size_t previous_number_nodes = getTotalNodeSatellites(); + // std::size_t number_nodes = count_pathvector_nodes(pathv); + // std::size_t previous_number_nodes = getTotalNodeSatellites(); for (const auto & i : pathv) { std::vector path_nodesatellites; - size_t count = count_path_nodes(i); - for (size_t j = 0; j < count; j++) { + std::size_t count = count_path_nodes(i); + for (std::size_t j = 0; j < count; j++) { found = false; - for (size_t k = 0; k < _pathvector.size(); k++) { + for (std::size_t k = 0; k < _pathvector.size(); k++) { if (k == _nodesatellites.size()) break; - size_t count2 = std::min(count_path_nodes(_pathvector[k]), _nodesatellites[k].size()); - for (size_t l = 0; l < count2; l++) { + std::size_t count2 = std::min(count_path_nodes(_pathvector[k]), _nodesatellites[k].size()); + for (std::size_t l = 0; l < count2; l++) { if (Geom::are_near(_pathvector[k][l].initialPoint(), i[j].initialPoint())) { path_nodesatellites.push_back(_nodesatellites.at(k).at(l)); found = true; diff --git a/src/helper/geom-pathvector_nodesatellites.h b/src/helper/geom-pathvector_nodesatellites.h index 4631b320dc1b5e9e5b0030551e534671eee3623f..4c699f3798c7eba8e6198b61a3753de4ddc7a499 100644 --- a/src/helper/geom-pathvector_nodesatellites.h +++ b/src/helper/geom-pathvector_nodesatellites.h @@ -32,15 +32,15 @@ public: void setPathVector(Geom::PathVector pathv); NodeSatellites getNodeSatellites(); void setNodeSatellites(NodeSatellites nodesatellites); - size_t getTotalNodeSatellites(); - void setSelected(std::vector selected); - void updateSteps(size_t steps, bool apply_no_radius, bool apply_with_radius, bool only_selected); + std::size_t getTotalNodeSatellites(); + void setSelected(std::vector selected); + void updateSteps(std::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 updateNodeSatelliteType(NodeSatelliteType nodesatellitetype, bool apply_no_radius, bool apply_with_radius, bool only_selected); - std::pair getIndexData(size_t index); + std::pair getIndexData(std::size_t index); void recalculateForNewPathVector(Geom::PathVector const pathv, NodeSatellite const S); private: diff --git a/src/live_effects/lpe-fillet-chamfer.cpp b/src/live_effects/lpe-fillet-chamfer.cpp index 49dde9e3512048cd72ad92d9686bd67c549a32ef..3a85b1f37242562347acb57a28c0a112ff5021a2 100644 --- a/src/live_effects/lpe-fillet-chamfer.cpp +++ b/src/live_effects/lpe-fillet-chamfer.cpp @@ -334,8 +334,8 @@ void LPEFilletChamfer::setSelected(PathVectorNodeSatellites *_pathvector_nodesat } else { Geom::PathVector const pathv = _pathvector_nodesatellites->getPathVector(); NodeSatellites nodesatellites = _pathvector_nodesatellites->getNodeSatellites(); - for (size_t i = 0; i < nodesatellites.size(); ++i) { - for (size_t j = 0; j < nodesatellites[i].size(); ++j) { + for (std::size_t i = 0; i < nodesatellites.size(); ++i) { + for (std::size_t j = 0; j < nodesatellites[i].size(); ++j) { Geom::Curve const &curve_in = pathv[i][j]; if (only_selected && isNodePointSelected(curve_in.initialPoint()) ){ nodesatellites[i][j].setSelected(true); @@ -407,8 +407,8 @@ void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem) } bool write = false; if (_pathvector_nodesatellites) { - size_t number_nodes = count_pathvector_nodes(pathvres); - size_t previous_number_nodes = _pathvector_nodesatellites->getTotalNodeSatellites(); + std::size_t number_nodes = count_pathvector_nodes(pathvres); + std::size_t previous_number_nodes = _pathvector_nodesatellites->getTotalNodeSatellites(); if (number_nodes != previous_number_nodes) { double power = radius; if (!flexible) { @@ -438,8 +438,8 @@ void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem) } nodesatellites_param.setGlobalKnotHide(false); - for (size_t i = 0; i < nodesatellites.size(); ++i) { - for (size_t j = 0; j < nodesatellites[i].size(); ++j) { + for (std::size_t i = 0; i < nodesatellites.size(); ++i) { + for (std::size_t j = 0; j < nodesatellites[i].size(); ++j) { if (pathvres.size() <= i || j >= count_path_nodes(pathvres[i])) { // we are on the end of a open path // for the moment we dont want to use @@ -474,8 +474,8 @@ void LPEFilletChamfer::doBeforeEffect(SPLPEItem const *lpeItem) _pathvector_nodesatellites->setPathVector(pathvres); _pathvector_nodesatellites->setNodeSatellites(nodesatellites); nodesatellites_param.setPathVectorNodeSatellites(_pathvector_nodesatellites, write); - size_t number_nodes = count_pathvector_nodes(pathvres); - size_t previous_number_nodes = _pathvector_nodesatellites->getTotalNodeSatellites(); + std::size_t number_nodes = count_pathvector_nodes(pathvres); + std::size_t previous_number_nodes = _pathvector_nodesatellites->getTotalNodeSatellites(); if (number_nodes != previous_number_nodes) { doOnApply(lpeItem); // dont want _impl to not update versioning nodesatellites = nodesatellites_param.data(); @@ -503,11 +503,11 @@ LPEFilletChamfer::addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector< } void -LPEFilletChamfer::addChamferSteps(Geom::Path &tmp_path, Geom::Path path_chamfer, Geom::Point end_arc_point, size_t steps) +LPEFilletChamfer::addChamferSteps(Geom::Path &tmp_path, Geom::Path path_chamfer, Geom::Point end_arc_point, std::size_t steps) { setSelected(_pathvector_nodesatellites); double path_subdivision = 1.0 / steps; - for (size_t i = 1; i < steps; i++) { + for (std::size_t i = 1; i < steps; i++) { Geom::Point chamfer_step = path_chamfer.pointAt(path_subdivision * i); tmp_path.appendNew(chamfer_step); } @@ -519,7 +519,7 @@ LPEFilletChamfer::doEffect_path(Geom::PathVector const &path_in) { const double GAP_HELPER = 0.00001; Geom::PathVector path_out; - size_t path = 0; + std::size_t path = 0; const double K = (4.0 / 3.0) * (sqrt(2.0) - 1.0); _degenerate_hide = false; Geom::PathVector const pathv = _pathvector_nodesatellites->getPathVector(); @@ -528,7 +528,7 @@ LPEFilletChamfer::doEffect_path(Geom::PathVector const &path_in) Geom::Path tmp_path; double time0 = 0; - size_t curve = 0; + std::size_t curve = 0; Geom::Path::const_iterator curve_it1 = path_it.begin(); Geom::Path::const_iterator curve_endit = path_it.end_default(); if (path_it.closed()) { @@ -544,7 +544,7 @@ LPEFilletChamfer::doEffect_path(Geom::PathVector const &path_in) } } while (curve_it1 != curve_endit) { - size_t next_index = curve + 1; + std::size_t next_index = curve + 1; if (curve == count_path_nodes(pathv[path]) - 1 && pathv[path].closed()) { next_index = 0; } @@ -639,7 +639,7 @@ LPEFilletChamfer::doEffect_path(Geom::PathVector const &path_in) } } NodeSatelliteType type = nodesatellite.nodesatellite_type; - size_t steps = nodesatellite.steps; + std::size_t steps = nodesatellite.steps; if (!steps) steps = 1; Geom::Line const x_line(Geom::Point(0, 0), Geom::Point(1, 0)); Geom::Line const angled_line(start_arc_point, end_arc_point); diff --git a/src/live_effects/lpe-fillet-chamfer.h b/src/live_effects/lpe-fillet-chamfer.h index 7e4e92e04089af7250b87097a321b9a026a3da09..8661e63545dc98b46b1575895764265db1586b41 100644 --- a/src/live_effects/lpe-fillet-chamfer.h +++ b/src/live_effects/lpe-fillet-chamfer.h @@ -39,7 +39,7 @@ public: void doOnApply(SPLPEItem const *lpeItem) override; Gtk::Widget *newWidget() override; Geom::Ray getRay(Geom::Point start, Geom::Point end, Geom::Curve *curve, bool reverse); - void addChamferSteps(Geom::Path &tmp_path, Geom::Path path_chamfer, Geom::Point end_arc_point, size_t steps); + void addChamferSteps(Geom::Path &tmp_path, Geom::Path path_chamfer, Geom::Point end_arc_point, std::size_t steps); void addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector &hp_vec) override; void updateNodeSatelliteType(NodeSatelliteType nodesatellitetype); void setSelected(PathVectorNodeSatellites *_pathvector_nodesatellites); diff --git a/src/live_effects/parameter/nodesatellitesarray.cpp b/src/live_effects/parameter/nodesatellitesarray.cpp index 70cc0769147df9249047b8244363b9022b471489..3c2253af1d589e1771badc06be2f51022159d096 100644 --- a/src/live_effects/parameter/nodesatellitesarray.cpp +++ b/src/live_effects/parameter/nodesatellitesarray.cpp @@ -124,8 +124,8 @@ void NodeSatelliteArrayParam::updateCanvasIndicators(bool mirror) _hp.clear(); } if (_effectType == FILLET_CHAMFER) { - for (size_t i = 0; i < _vector.size(); ++i) { - for (size_t j = 0; j < _vector[i].size(); ++j) { + for (std::size_t i = 0; i < _vector.size(); ++i) { + for (std::size_t j = 0; j < _vector[i].size(); ++j) { if (_vector[i][j].hidden || // Ignore if hidden (!_vector[i][j].has_mirror && mirror == true) || // Ignore if not have mirror and we are in mirror // loop @@ -204,9 +204,9 @@ void NodeSatelliteArrayParam::addKnotHolderEntities(KnotHolder *knotholder, SPIt if (!_last_pathvector_nodesatellites) { return; } - size_t index = 0; - for (size_t i = 0; i < _vector.size(); ++i) { - for (size_t j = 0; j < _vector[i].size(); ++j) { + std::size_t index = 0; + for (std::size_t i = 0; i < _vector.size(); ++i) { + for (std::size_t j = 0; j < _vector[i].size(); ++j) { if (!_vector[i][j].has_mirror && mirror) { continue; } @@ -255,8 +255,8 @@ void NodeSatelliteArrayParam::updateAmmount(double amount) { Geom::PathVector const pathv = _last_pathvector_nodesatellites->getPathVector(); NodeSatellites nodesatellites = _last_pathvector_nodesatellites->getNodeSatellites(); - for (size_t i = 0; i < nodesatellites.size(); ++i) { - for (size_t j = 0; j < nodesatellites[i].size(); ++j) { + for (std::size_t i = 0; i < nodesatellites.size(); ++i) { + for (std::size_t j = 0; j < nodesatellites[i].size(); ++j) { Geom::Curve const &curve_in = pathv[i][j]; if (param_effect->isNodePointSelected(curve_in.initialPoint()) ){ _vector[i][j].amount = amount; @@ -274,7 +274,7 @@ void NodeSatelliteArrayParam::addKnotHolderEntities(KnotHolder *knotholder, SPIt addKnotHolderEntities(knotholder, item, true); } -FilletChamferKnotHolderEntity::FilletChamferKnotHolderEntity(NodeSatelliteArrayParam *p, size_t index) +FilletChamferKnotHolderEntity::FilletChamferKnotHolderEntity(NodeSatelliteArrayParam *p, std::size_t index) : _pparam(p) , _index(index) {} @@ -286,16 +286,16 @@ void FilletChamferKnotHolderEntity::knot_set(Geom::Point const &p, if (!_pparam->_last_pathvector_nodesatellites || _pparam->_global_knot_hide) { return; } - size_t total_nodesatellites = _pparam->_last_pathvector_nodesatellites->getTotalNodeSatellites(); + std::size_t total_nodesatellites = _pparam->_last_pathvector_nodesatellites->getTotalNodeSatellites(); bool is_mirror = false; - size_t index = _index; + std::size_t index = _index; if (_index >= total_nodesatellites) { index = _index - total_nodesatellites; is_mirror = true; } - std::pair index_data = _pparam->_last_pathvector_nodesatellites->getIndexData(index); - size_t satelite_index = index_data.first; - size_t subsatelite_index = index_data.second; + std::pair index_data = _pparam->_last_pathvector_nodesatellites->getIndexData(index); + std::size_t satelite_index = index_data.first; + std::size_t subsatelite_index = index_data.second; Geom::Point s = p; if (!valid_index(satelite_index, subsatelite_index)) { return; @@ -384,16 +384,16 @@ Geom::Point FilletChamferKnotHolderEntity::knot_get() const return Geom::Point(Geom::infinity(), Geom::infinity()); } Geom::Point tmp_point; - size_t total_nodesatellites = _pparam->_last_pathvector_nodesatellites->getTotalNodeSatellites(); + std::size_t total_nodesatellites = _pparam->_last_pathvector_nodesatellites->getTotalNodeSatellites(); bool is_mirror = false; - size_t index = _index; + std::size_t index = _index; if (_index >= total_nodesatellites) { index = _index - total_nodesatellites; is_mirror = true; } - std::pair index_data = _pparam->_last_pathvector_nodesatellites->getIndexData(index); - size_t satelite_index = index_data.first; - size_t subsatelite_index = index_data.second; + std::pair index_data = _pparam->_last_pathvector_nodesatellites->getIndexData(index); + std::size_t satelite_index = index_data.first; + std::size_t subsatelite_index = index_data.second; if (!valid_index(satelite_index, subsatelite_index)) { return Geom::Point(Geom::infinity(), Geom::infinity()); } @@ -497,16 +497,16 @@ void FilletChamferKnotHolderEntity::knot_click(guint state) if (!_pparam->_last_pathvector_nodesatellites) { return; } - size_t total_nodesatellites = _pparam->_last_pathvector_nodesatellites->getTotalNodeSatellites(); + std::size_t total_nodesatellites = _pparam->_last_pathvector_nodesatellites->getTotalNodeSatellites(); bool is_mirror = false; - size_t index = _index; + std::size_t index = _index; if (_index >= total_nodesatellites) { index = _index - total_nodesatellites; is_mirror = true; } - std::pair index_data = _pparam->_last_pathvector_nodesatellites->getIndexData(index); - size_t satelite_index = index_data.first; - size_t subsatelite_index = index_data.second; + std::pair index_data = _pparam->_last_pathvector_nodesatellites->getIndexData(index); + std::size_t satelite_index = index_data.first; + std::size_t subsatelite_index = index_data.second; if (!valid_index(satelite_index, subsatelite_index)) { return; } @@ -595,16 +595,16 @@ void FilletChamferKnotHolderEntity::knot_set_offset(NodeSatellite nodesatellite) if (!_pparam->_last_pathvector_nodesatellites || _pparam->_global_knot_hide) { return; } - size_t total_nodesatellites = _pparam->_last_pathvector_nodesatellites->getTotalNodeSatellites(); + std::size_t total_nodesatellites = _pparam->_last_pathvector_nodesatellites->getTotalNodeSatellites(); bool is_mirror = false; - size_t index = _index; + std::size_t index = _index; if (_index >= total_nodesatellites) { index = _index - total_nodesatellites; is_mirror = true; } - std::pair index_data = _pparam->_last_pathvector_nodesatellites->getIndexData(index); - size_t satelite_index = index_data.first; - size_t subsatelite_index = index_data.second; + std::pair index_data = _pparam->_last_pathvector_nodesatellites->getIndexData(index); + std::size_t satelite_index = index_data.first; + std::size_t subsatelite_index = index_data.second; if (!valid_index(satelite_index, subsatelite_index)) { return; } diff --git a/src/live_effects/parameter/nodesatellitesarray.h b/src/live_effects/parameter/nodesatellitesarray.h index 24352e864459c119282f5ba5eda323479a22ec82..38113aa90e218d05caf3e3866c1ebdb8d9d999c1 100644 --- a/src/live_effects/parameter/nodesatellitesarray.h +++ b/src/live_effects/parameter/nodesatellitesarray.h @@ -89,7 +89,7 @@ private: class FilletChamferKnotHolderEntity : public KnotHolderEntity { public: - FilletChamferKnotHolderEntity(NodeSatelliteArrayParam *p, size_t index); + FilletChamferKnotHolderEntity(NodeSatelliteArrayParam *p, std::size_t index); ~FilletChamferKnotHolderEntity() override { _pparam->_knotholder = nullptr; @@ -103,14 +103,14 @@ public: void knot_set_offset(NodeSatellite); /** Checks whether the index falls within the size of the parameter's vector */ - bool valid_index(size_t index, size_t subindex) const + bool valid_index(std::size_t index, std::size_t subindex) const { return (_pparam->_vector.size() > index && _pparam->_vector[index].size() > subindex); }; private: NodeSatelliteArrayParam *_pparam; - size_t _index; + std::size_t _index; bool _updating = false; };