Surface: Fix several clazy issues:
* Missing reference in range-for with non trivial type [-Wclazy-range-loop-reference] * Use multi-arg instead [-Wclazy-qstring-arg]
This commit is contained in:
@@ -245,12 +245,12 @@ void Filling::addConstraints(BRepFill_Filling& builder,
|
||||
const App::PropertyLinkSubList& pointsList)
|
||||
{
|
||||
auto points = pointsList.getSubListValues();
|
||||
for (auto it : points) {
|
||||
for (const auto& it : points) {
|
||||
App::DocumentObject* obj = it.first;
|
||||
std::vector<std::string> sub = it.second;
|
||||
if (obj && obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
const Part::TopoShape& shape = static_cast<Part::Feature*>(obj)->Shape.getShape();
|
||||
for (auto jt : sub) {
|
||||
for (const auto& jt : sub) {
|
||||
TopoDS_Shape subShape = shape.getSubShape(jt.c_str());
|
||||
if (!subShape.IsNull() && subShape.ShapeType() == TopAbs_VERTEX) {
|
||||
gp_Pnt pnt = BRep_Tool::Pnt(TopoDS::Vertex(subShape));
|
||||
@@ -288,7 +288,7 @@ App::DocumentObjectExecReturn *Filling::execute(void)
|
||||
if (initFace && initFace->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
const Part::TopoShape& shape = static_cast<Part::Feature*>(initFace)->Shape.getShape();
|
||||
std::vector<std::string> subNames = InitialFace.getSubValues();
|
||||
for (auto it : subNames) {
|
||||
for (const auto& it : subNames) {
|
||||
TopoDS_Shape subShape = shape.getSubShape(it.c_str());
|
||||
if (!subShape.IsNull() && subShape.ShapeType() == TopAbs_FACE) {
|
||||
builder.LoadInitSurface(TopoDS::Face(subShape));
|
||||
|
||||
@@ -218,7 +218,7 @@ bool GeomFillSurface::getWire(TopoDS_Wire& aWire)
|
||||
App::PropertyLinkSubList::SubSet set = boundary[i];
|
||||
|
||||
if (set.first->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
for (auto jt: set.second) {
|
||||
for (const auto& jt: set.second) {
|
||||
const Part::TopoShape &ts = static_cast<Part::Feature*>(set.first)->Shape.getShape();
|
||||
validator.checkAndAdd(ts, jt.c_str(), &aWD);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ App::DocumentObjectExecReturn *Sewing::execute(void)
|
||||
Part::TopoShape ts = static_cast<Part::Feature*>(it->first)->Shape.getShape();
|
||||
|
||||
//we want only the subshape which is linked
|
||||
for (auto jt: it->second) {
|
||||
for (const auto& jt: it->second) {
|
||||
TopoDS_Shape sub = ts.getSubShape(jt.c_str());
|
||||
builder.Add(sub);
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ QIcon ViewProviderFilling::getIcon(void) const
|
||||
|
||||
void ViewProviderFilling::highlightReferences(ShapeType type, const References& refs, bool on)
|
||||
{
|
||||
for (auto it : refs) {
|
||||
for (const auto& it : refs) {
|
||||
Part::Feature* base = dynamic_cast<Part::Feature*>(it.first);
|
||||
if (base) {
|
||||
PartGui::ViewProviderPartExt* svp = dynamic_cast<PartGui::ViewProviderPartExt*>(
|
||||
@@ -116,7 +116,7 @@ void ViewProviderFilling::highlightReferences(ShapeType type, const References&
|
||||
TopExp::MapShapes(base->Shape.getValue(), TopAbs_VERTEX, vMap);
|
||||
colors.resize(vMap.Extent(), svp->PointColor.getValue());
|
||||
|
||||
for (auto jt : it.second) {
|
||||
for (const auto& jt : it.second) {
|
||||
// check again that the index is in range because it's possible that the
|
||||
// sub-names are invalid
|
||||
std::size_t idx = static_cast<std::size_t>(std::stoi(jt.substr(6)) - 1);
|
||||
@@ -137,7 +137,7 @@ void ViewProviderFilling::highlightReferences(ShapeType type, const References&
|
||||
TopExp::MapShapes(base->Shape.getValue(), TopAbs_EDGE, eMap);
|
||||
colors.resize(eMap.Extent(), svp->LineColor.getValue());
|
||||
|
||||
for (auto jt : it.second) {
|
||||
for (const auto& jt : it.second) {
|
||||
std::size_t idx = static_cast<std::size_t>(std::stoi(jt.substr(4)) - 1);
|
||||
// check again that the index is in range because it's possible that the
|
||||
// sub-names are invalid
|
||||
@@ -158,7 +158,7 @@ void ViewProviderFilling::highlightReferences(ShapeType type, const References&
|
||||
TopExp::MapShapes(base->Shape.getValue(), TopAbs_FACE, fMap);
|
||||
colors.resize(fMap.Extent(), svp->ShapeColor.getValue());
|
||||
|
||||
for (auto jt : it.second) {
|
||||
for (const auto& jt : it.second) {
|
||||
std::size_t idx = static_cast<std::size_t>(std::stoi(jt.substr(4)) - 1);
|
||||
// check again that the index is in range because it's possible that the
|
||||
// sub-names are invalid
|
||||
@@ -234,9 +234,9 @@ private:
|
||||
return false;
|
||||
|
||||
auto links = editedObject->BoundaryEdges.getSubListValues();
|
||||
for (auto it : links) {
|
||||
for (const auto& it : links) {
|
||||
if (it.first == pObj) {
|
||||
for (auto jt : it.second) {
|
||||
for (const auto& jt : it.second) {
|
||||
if (jt == sSubName)
|
||||
return !appendEdges;
|
||||
}
|
||||
@@ -295,8 +295,8 @@ void FillingPanel::setEditedObject(Surface::Filling* fea)
|
||||
const std::vector<std::string>& subList = editedObject->InitialFace.getSubValues();
|
||||
if (initFace && subList.size() == 1) {
|
||||
QString text = QString::fromLatin1("%1.%2")
|
||||
.arg(QString::fromUtf8(initFace->Label.getValue()))
|
||||
.arg(QString::fromStdString(subList.front()));
|
||||
.arg(QString::fromUtf8(initFace->Label.getValue()),
|
||||
QString::fromStdString(subList.front()));
|
||||
ui->lineInitFaceName->setText(text);
|
||||
}
|
||||
|
||||
@@ -329,8 +329,8 @@ void FillingPanel::setEditedObject(Surface::Filling* fea)
|
||||
ui->listBoundary->addItem(item);
|
||||
|
||||
QString text = QString::fromLatin1("%1.%2")
|
||||
.arg(QString::fromUtf8(obj->Label.getValue()))
|
||||
.arg(QString::fromStdString(edge));
|
||||
.arg(QString::fromUtf8(obj->Label.getValue()),
|
||||
QString::fromStdString(edge));
|
||||
item->setText(text);
|
||||
|
||||
// The user data field of a list widget item
|
||||
@@ -581,8 +581,8 @@ void FillingPanel::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
if (selectionMode == InitFace) {
|
||||
Gui::SelectionObject sel(msg);
|
||||
QString text = QString::fromLatin1("%1.%2")
|
||||
.arg(QString::fromUtf8(sel.getObject()->Label.getValue()))
|
||||
.arg(QString::fromLatin1(msg.pSubName));
|
||||
.arg(QString::fromUtf8(sel.getObject()->Label.getValue()),
|
||||
QString::fromLatin1(msg.pSubName));
|
||||
ui->lineInitFaceName->setText(text);
|
||||
|
||||
std::vector<std::string> subList;
|
||||
@@ -603,8 +603,8 @@ void FillingPanel::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
|
||||
Gui::SelectionObject sel(msg);
|
||||
QString text = QString::fromLatin1("%1.%2")
|
||||
.arg(QString::fromUtf8(sel.getObject()->Label.getValue()))
|
||||
.arg(QString::fromLatin1(msg.pSubName));
|
||||
.arg(QString::fromUtf8(sel.getObject()->Label.getValue()),
|
||||
QString::fromLatin1(msg.pSubName));
|
||||
item->setText(text);
|
||||
|
||||
QList<QVariant> data;
|
||||
|
||||
@@ -97,9 +97,9 @@ private:
|
||||
return false;
|
||||
|
||||
auto links = editedObject->UnboundEdges.getSubListValues();
|
||||
for (auto it : links) {
|
||||
for (const auto& it : links) {
|
||||
if (it.first == pObj) {
|
||||
for (auto jt : it.second) {
|
||||
for (const auto& jt : it.second) {
|
||||
if (jt == sSubName)
|
||||
return !appendEdges;
|
||||
}
|
||||
@@ -179,8 +179,8 @@ void FillingEdgePanel::setEditedObject(Surface::Filling* fea)
|
||||
ui->listUnbound->addItem(item);
|
||||
|
||||
QString text = QString::fromLatin1("%1.%2")
|
||||
.arg(QString::fromUtf8(obj->Label.getValue()))
|
||||
.arg(QString::fromStdString(edge));
|
||||
.arg(QString::fromUtf8(obj->Label.getValue()),
|
||||
QString::fromStdString(edge));
|
||||
item->setText(text);
|
||||
|
||||
// The user data field of a list widget item
|
||||
@@ -381,8 +381,8 @@ void FillingEdgePanel::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
|
||||
Gui::SelectionObject sel(msg);
|
||||
QString text = QString::fromLatin1("%1.%2")
|
||||
.arg(QString::fromUtf8(sel.getObject()->Label.getValue()))
|
||||
.arg(QString::fromLatin1(msg.pSubName));
|
||||
.arg(QString::fromUtf8(sel.getObject()->Label.getValue()),
|
||||
QString::fromLatin1(msg.pSubName));
|
||||
item->setText(text);
|
||||
|
||||
QList<QVariant> data;
|
||||
|
||||
@@ -96,9 +96,9 @@ private:
|
||||
return false;
|
||||
|
||||
auto links = editedObject->Points.getSubListValues();
|
||||
for (auto it : links) {
|
||||
for (const auto& it : links) {
|
||||
if (it.first == pObj) {
|
||||
for (auto jt : it.second) {
|
||||
for (const auto& jt : it.second) {
|
||||
if (jt == sSubName)
|
||||
return !appendVertex;
|
||||
}
|
||||
@@ -160,8 +160,8 @@ void FillingVertexPanel::setEditedObject(Surface::Filling* obj)
|
||||
ui->listFreeVertex->addItem(item);
|
||||
|
||||
QString text = QString::fromLatin1("%1.%2")
|
||||
.arg(QString::fromUtf8((*it)->Label.getValue()))
|
||||
.arg(QString::fromStdString(*jt));
|
||||
.arg(QString::fromUtf8((*it)->Label.getValue()),
|
||||
QString::fromStdString(*jt));
|
||||
item->setText(text);
|
||||
|
||||
QList<QVariant> data;
|
||||
@@ -259,8 +259,8 @@ void FillingVertexPanel::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
|
||||
Gui::SelectionObject sel(msg);
|
||||
QString text = QString::fromLatin1("%1.%2")
|
||||
.arg(QString::fromUtf8(sel.getObject()->Label.getValue()))
|
||||
.arg(QString::fromLatin1(msg.pSubName));
|
||||
.arg(QString::fromUtf8(sel.getObject()->Label.getValue()),
|
||||
QString::fromLatin1(msg.pSubName));
|
||||
item->setText(text);
|
||||
|
||||
QList<QVariant> data;
|
||||
|
||||
@@ -106,7 +106,7 @@ void ViewProviderGeomFillSurface::highlightReferences(bool on)
|
||||
{
|
||||
Surface::GeomFillSurface* surface = static_cast<Surface::GeomFillSurface*>(getObject());
|
||||
auto bounds = surface->BoundaryList.getSubListValues();
|
||||
for (auto it : bounds) {
|
||||
for (const auto& it : bounds) {
|
||||
Part::Feature* base = dynamic_cast<Part::Feature*>(it.first);
|
||||
if (base) {
|
||||
PartGui::ViewProviderPartExt* svp = dynamic_cast<PartGui::ViewProviderPartExt*>(
|
||||
@@ -118,7 +118,7 @@ void ViewProviderGeomFillSurface::highlightReferences(bool on)
|
||||
TopExp::MapShapes(base->Shape.getValue(), TopAbs_EDGE, eMap);
|
||||
colors.resize(eMap.Extent(), svp->LineColor.getValue());
|
||||
|
||||
for (auto jt : it.second) {
|
||||
for (const auto& jt : it.second) {
|
||||
std::size_t idx = static_cast<std::size_t>(std::stoi(jt.substr(4)) - 1);
|
||||
assert (idx < colors.size());
|
||||
colors[idx] = App::Color(1.0,0.0,1.0); // magenta
|
||||
@@ -171,9 +171,9 @@ bool GeomFillSurface::EdgeSelection::allow(App::Document* , App::DocumentObject*
|
||||
return false;
|
||||
|
||||
auto links = editedObject->BoundaryList.getSubListValues();
|
||||
for (auto it : links) {
|
||||
for (const auto& it : links) {
|
||||
if (it.first == pObj) {
|
||||
for (auto jt : it.second) {
|
||||
for (const auto& jt : it.second) {
|
||||
if (jt == sSubName)
|
||||
return !appendEdges;
|
||||
}
|
||||
@@ -258,8 +258,8 @@ void GeomFillSurface::setEditedObject(Surface::GeomFillSurface* obj)
|
||||
ui->listWidget->addItem(item);
|
||||
|
||||
QString text = QString::fromLatin1("%1.%2")
|
||||
.arg(QString::fromUtf8((*it)->Label.getValue()))
|
||||
.arg(QString::fromStdString(*jt));
|
||||
.arg(QString::fromUtf8((*it)->Label.getValue()),
|
||||
QString::fromStdString(*jt));
|
||||
item->setText(text);
|
||||
|
||||
QList<QVariant> data;
|
||||
@@ -424,8 +424,8 @@ void GeomFillSurface::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
|
||||
Gui::SelectionObject sel(msg);
|
||||
QString text = QString::fromLatin1("%1.%2")
|
||||
.arg(QString::fromUtf8(sel.getObject()->Label.getValue()))
|
||||
.arg(QString::fromLatin1(msg.pSubName));
|
||||
.arg(QString::fromUtf8(sel.getObject()->Label.getValue()),
|
||||
QString::fromLatin1(msg.pSubName));
|
||||
item->setText(text);
|
||||
|
||||
QList<QVariant> data;
|
||||
|
||||
@@ -106,7 +106,7 @@ QIcon ViewProviderSections::getIcon(void) const
|
||||
|
||||
void ViewProviderSections::highlightReferences(ShapeType type, const References& refs, bool on)
|
||||
{
|
||||
for (auto it : refs) {
|
||||
for (const auto& it : refs) {
|
||||
Part::Feature* base = dynamic_cast<Part::Feature*>(it.first);
|
||||
if (base) {
|
||||
PartGui::ViewProviderPartExt* svp = dynamic_cast<PartGui::ViewProviderPartExt*>(
|
||||
@@ -120,7 +120,7 @@ void ViewProviderSections::highlightReferences(ShapeType type, const References&
|
||||
TopExp::MapShapes(base->Shape.getValue(), TopAbs_VERTEX, vMap);
|
||||
colors.resize(vMap.Extent(), svp->PointColor.getValue());
|
||||
|
||||
for (auto jt : it.second) {
|
||||
for (const auto& jt : it.second) {
|
||||
// check again that the index is in range because it's possible that the
|
||||
// sub-names are invalid
|
||||
std::size_t idx = static_cast<std::size_t>(std::stoi(jt.substr(6)) - 1);
|
||||
@@ -141,7 +141,7 @@ void ViewProviderSections::highlightReferences(ShapeType type, const References&
|
||||
TopExp::MapShapes(base->Shape.getValue(), TopAbs_EDGE, eMap);
|
||||
colors.resize(eMap.Extent(), svp->LineColor.getValue());
|
||||
|
||||
for (auto jt : it.second) {
|
||||
for (const auto& jt : it.second) {
|
||||
std::size_t idx = static_cast<std::size_t>(std::stoi(jt.substr(4)) - 1);
|
||||
// check again that the index is in range because it's possible that the
|
||||
// sub-names are invalid
|
||||
@@ -162,7 +162,7 @@ void ViewProviderSections::highlightReferences(ShapeType type, const References&
|
||||
TopExp::MapShapes(base->Shape.getValue(), TopAbs_FACE, fMap);
|
||||
colors.resize(fMap.Extent(), svp->ShapeColor.getValue());
|
||||
|
||||
for (auto jt : it.second) {
|
||||
for (const auto& jt : it.second) {
|
||||
std::size_t idx = static_cast<std::size_t>(std::stoi(jt.substr(4)) - 1);
|
||||
// check again that the index is in range because it's possible that the
|
||||
// sub-names are invalid
|
||||
@@ -229,9 +229,9 @@ private:
|
||||
return false;
|
||||
|
||||
auto links = editedObject->NSections.getSubListValues();
|
||||
for (auto it : links) {
|
||||
for (const auto& it : links) {
|
||||
if (it.first == pObj) {
|
||||
for (auto jt : it.second) {
|
||||
for (const auto& jt : it.second) {
|
||||
if (jt == sSubName)
|
||||
return !appendEdges;
|
||||
}
|
||||
@@ -295,8 +295,8 @@ void SectionsPanel::setEditedObject(Surface::Sections* fea)
|
||||
ui->listSections->addItem(item);
|
||||
|
||||
QString text = QString::fromLatin1("%1.%2")
|
||||
.arg(QString::fromUtf8(obj->Label.getValue()))
|
||||
.arg(QString::fromStdString(edge));
|
||||
.arg(QString::fromUtf8(obj->Label.getValue()),
|
||||
QString::fromStdString(edge));
|
||||
item->setText(text);
|
||||
|
||||
// The user data field of a list widget item
|
||||
@@ -428,8 +428,8 @@ void SectionsPanel::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
|
||||
Gui::SelectionObject sel(msg);
|
||||
QString text = QString::fromLatin1("%1.%2")
|
||||
.arg(QString::fromUtf8(sel.getObject()->Label.getValue()))
|
||||
.arg(QString::fromLatin1(msg.pSubName));
|
||||
.arg(QString::fromUtf8(sel.getObject()->Label.getValue()),
|
||||
QString::fromLatin1(msg.pSubName));
|
||||
item->setText(text);
|
||||
|
||||
QList<QVariant> data;
|
||||
|
||||
Reference in New Issue
Block a user