Mesh: Fix linter warnings

This commit is contained in:
wmayer
2024-11-20 23:02:40 +01:00
committed by wwmayer
parent 4e82a0af48
commit 7a2bfb7370
86 changed files with 1734 additions and 1882 deletions

View File

@@ -45,7 +45,7 @@
using namespace Mesh;
using namespace MeshGui;
// NOLINTBEGIN
PROPERTY_SOURCE_ABSTRACT(MeshGui::ViewProviderMeshDefects, Gui::ViewProviderDocumentObject)
PROPERTY_SOURCE(MeshGui::ViewProviderMeshOrientation, MeshGui::ViewProviderMeshDefects)
PROPERTY_SOURCE(MeshGui::ViewProviderMeshNonManifolds, MeshGui::ViewProviderMeshDefects)
@@ -56,7 +56,9 @@ PROPERTY_SOURCE(MeshGui::ViewProviderMeshDegenerations, MeshGui::ViewProviderMes
PROPERTY_SOURCE(MeshGui::ViewProviderMeshIndices, MeshGui::ViewProviderMeshDefects)
PROPERTY_SOURCE(MeshGui::ViewProviderMeshSelfIntersections, MeshGui::ViewProviderMeshDefects)
PROPERTY_SOURCE(MeshGui::ViewProviderMeshFolds, MeshGui::ViewProviderMeshDefects)
// NOLINTEND
// NOLINTBEGIN(readability-magic-numbers,cppcoreguidelines-pro-bounds*)
ViewProviderMeshDefects::ViewProviderMeshDefects()
{
ADD_PROPERTY(LineWidth, (2.0F));
@@ -66,7 +68,7 @@ ViewProviderMeshDefects::ViewProviderMeshDefects()
pcDrawStyle = new SoDrawStyle();
pcDrawStyle->ref();
pcDrawStyle->style = SoDrawStyle::LINES;
pcDrawStyle->lineWidth = LineWidth.getValue();
pcDrawStyle->lineWidth = float(LineWidth.getValue());
}
ViewProviderMeshDefects::~ViewProviderMeshDefects()
@@ -78,7 +80,7 @@ ViewProviderMeshDefects::~ViewProviderMeshDefects()
void ViewProviderMeshDefects::onChanged(const App::Property* prop)
{
if (prop == &LineWidth) {
pcDrawStyle->lineWidth = LineWidth.getValue();
pcDrawStyle->lineWidth = float(LineWidth.getValue());
}
// Visibility changes must be handled here because in the base class it changes the attribute of
// the feature and thus affects the visibility of the mesh view provider which is undesired
@@ -91,6 +93,24 @@ void ViewProviderMeshDefects::onChanged(const App::Property* prop)
}
}
SoMarkerSet* ViewProviderMeshDefects::makeMarkerSet() const
{
auto marker = new SoMarkerSet;
marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex(
"PLUS",
int(App::GetApplication()
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
->GetInt("MarkerSize", 7)));
return marker;
}
const MeshCore::MeshKernel& ViewProviderMeshDefects::getMeshKernel() const
{
auto mf = dynamic_cast<Mesh::Feature*>(pcObject);
const Mesh::MeshObject& mesh = mf->Mesh.getValue();
return mesh.getKernel();
}
// ----------------------------------------------------------------------
ViewProviderMeshOrientation::ViewProviderMeshOrientation()
@@ -106,38 +126,33 @@ ViewProviderMeshOrientation::~ViewProviderMeshOrientation()
pcFaces->unref();
}
void ViewProviderMeshOrientation::attach(App::DocumentObject* pcFeat)
void ViewProviderMeshOrientation::attach(App::DocumentObject* obj)
{
ViewProviderDocumentObject::attach(pcFeat);
ViewProviderDocumentObject::attach(obj); // NOLINT
SoGroup* pcFaceRoot = new SoGroup();
auto pcFaceRoot = new SoGroup();
SoDrawStyle* pcFlatStyle = new SoDrawStyle();
auto pcFlatStyle = new SoDrawStyle();
pcFlatStyle->style = SoDrawStyle::FILLED;
pcFaceRoot->addChild(pcFlatStyle);
SoShapeHints* flathints = new SoShapeHints;
auto flathints = new SoShapeHints;
flathints->vertexOrdering = SoShapeHints::COUNTERCLOCKWISE;
flathints->shapeType = SoShapeHints::UNKNOWN_SHAPE_TYPE;
pcFaceRoot->addChild(flathints);
// Draw faces
SoSeparator* linesep = new SoSeparator;
SoBaseColor* basecol = new SoBaseColor;
auto linesep = new SoSeparator;
auto basecol = new SoBaseColor;
basecol->rgb.setValue(1.0F, 0.5F, 0.0F);
linesep->addChild(basecol);
linesep->addChild(pcCoords);
linesep->addChild(pcFaces);
// Draw markers
SoBaseColor* markcol = new SoBaseColor;
auto markcol = new SoBaseColor;
markcol->rgb.setValue(1.0F, 1.0F, 0.0F);
SoMarkerSet* marker = new SoMarkerSet;
marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex(
"PLUS",
App::GetApplication()
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
->GetInt("MarkerSize", 7));
SoMarkerSet* marker = makeMarkerSet();
linesep->addChild(markcol);
linesep->addChild(marker);
@@ -148,11 +163,10 @@ void ViewProviderMeshOrientation::attach(App::DocumentObject* pcFeat)
void ViewProviderMeshOrientation::showDefects(const std::vector<Mesh::ElementIndex>& inds)
{
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
const MeshCore::MeshKernel& rMesh = f->Mesh.getValue().getKernel();
const MeshCore::MeshKernel& rMesh = getMeshKernel();
pcCoords->point.deleteValues(0);
pcCoords->point.setNum(3 * inds.size());
pcCoords->point.setNum(int(3 * inds.size()));
MeshCore::MeshFacetIterator cF(rMesh);
int i = 0;
int j = 0;
@@ -184,17 +198,17 @@ ViewProviderMeshNonManifolds::~ViewProviderMeshNonManifolds()
pcLines->unref();
}
void ViewProviderMeshNonManifolds::attach(App::DocumentObject* pcFeat)
void ViewProviderMeshNonManifolds::attach(App::DocumentObject* obj)
{
ViewProviderDocumentObject::attach(pcFeat);
ViewProviderDocumentObject::attach(obj); // NOLINT
SoGroup* pcLineRoot = new SoGroup();
auto pcLineRoot = new SoGroup();
pcDrawStyle->lineWidth = 3;
pcLineRoot->addChild(pcDrawStyle);
// Draw lines
SoSeparator* linesep = new SoSeparator;
SoBaseColor* basecol = new SoBaseColor;
auto linesep = new SoSeparator;
auto basecol = new SoBaseColor;
basecol->rgb.setValue(1.0F, 0.0F, 0.0F);
linesep->addChild(basecol);
linesep->addChild(pcCoords);
@@ -202,14 +216,9 @@ void ViewProviderMeshNonManifolds::attach(App::DocumentObject* pcFeat)
pcLineRoot->addChild(linesep);
// Draw markers
SoBaseColor* markcol = new SoBaseColor;
auto markcol = new SoBaseColor;
markcol->rgb.setValue(1.0F, 1.0F, 0.0F);
SoMarkerSet* marker = new SoMarkerSet;
marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex(
"PLUS",
App::GetApplication()
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
->GetInt("MarkerSize", 7));
SoMarkerSet* marker = makeMarkerSet();
linesep->addChild(markcol);
linesep->addChild(marker);
@@ -221,16 +230,14 @@ void ViewProviderMeshNonManifolds::showDefects(const std::vector<Mesh::ElementIn
if ((inds.size() % 2) != 0) {
return;
}
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
const MeshCore::MeshKernel& rMesh = f->Mesh.getValue().getKernel();
const MeshCore::MeshKernel& rMesh = getMeshKernel();
pcCoords->point.deleteValues(0);
pcCoords->point.setNum(inds.size());
pcCoords->point.setNum(int(inds.size()));
MeshCore::MeshPointIterator cP(rMesh);
int i = 0;
int j = 0;
for (std::vector<Mesh::ElementIndex>::const_iterator it = inds.begin(); it != inds.end();
++it) {
for (auto it = inds.begin(); it != inds.end(); ++it) {
cP.Set(*it);
pcCoords->point.set1Value(i++, cP->x, cP->y, cP->z);
++it; // go to end point
@@ -257,17 +264,17 @@ ViewProviderMeshNonManifoldPoints::~ViewProviderMeshNonManifoldPoints()
pcPoints->unref();
}
void ViewProviderMeshNonManifoldPoints::attach(App::DocumentObject* pcFeat)
void ViewProviderMeshNonManifoldPoints::attach(App::DocumentObject* obj)
{
ViewProviderDocumentObject::attach(pcFeat);
ViewProviderDocumentObject::attach(obj); // NOLINT
SoGroup* pcPointRoot = new SoGroup();
auto pcPointRoot = new SoGroup();
pcDrawStyle->pointSize = 3;
pcPointRoot->addChild(pcDrawStyle);
// Draw points
SoSeparator* pointsep = new SoSeparator;
SoBaseColor* basecol = new SoBaseColor;
auto pointsep = new SoSeparator;
auto basecol = new SoBaseColor;
basecol->rgb.setValue(1.0F, 0.5F, 0.0F);
pointsep->addChild(basecol);
pointsep->addChild(pcCoords);
@@ -275,14 +282,9 @@ void ViewProviderMeshNonManifoldPoints::attach(App::DocumentObject* pcFeat)
pcPointRoot->addChild(pointsep);
// Draw markers
SoBaseColor* markcol = new SoBaseColor;
auto markcol = new SoBaseColor;
markcol->rgb.setValue(1.0F, 1.0F, 0.0F);
SoMarkerSet* marker = new SoMarkerSet;
marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex(
"PLUS",
App::GetApplication()
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
->GetInt("MarkerSize", 7));
SoMarkerSet* marker = makeMarkerSet();
pointsep->addChild(markcol);
pointsep->addChild(marker);
@@ -291,10 +293,9 @@ void ViewProviderMeshNonManifoldPoints::attach(App::DocumentObject* pcFeat)
void ViewProviderMeshNonManifoldPoints::showDefects(const std::vector<Mesh::ElementIndex>& inds)
{
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
const MeshCore::MeshKernel& rMesh = f->Mesh.getValue().getKernel();
const MeshCore::MeshKernel& rMesh = getMeshKernel();
pcCoords->point.deleteValues(0);
pcCoords->point.setNum(inds.size());
pcCoords->point.setNum(int(inds.size()));
MeshCore::MeshPointIterator cP(rMesh);
int i = 0;
for (Mesh::ElementIndex ind : inds) {
@@ -320,24 +321,24 @@ ViewProviderMeshDuplicatedFaces::~ViewProviderMeshDuplicatedFaces()
pcFaces->unref();
}
void ViewProviderMeshDuplicatedFaces::attach(App::DocumentObject* pcFeat)
void ViewProviderMeshDuplicatedFaces::attach(App::DocumentObject* obj)
{
ViewProviderDocumentObject::attach(pcFeat);
ViewProviderDocumentObject::attach(obj); // NOLINT
SoGroup* pcFaceRoot = new SoGroup();
auto pcFaceRoot = new SoGroup();
SoDrawStyle* pcFlatStyle = new SoDrawStyle();
auto pcFlatStyle = new SoDrawStyle();
pcFlatStyle->style = SoDrawStyle::FILLED;
pcFaceRoot->addChild(pcFlatStyle);
SoShapeHints* flathints = new SoShapeHints;
auto flathints = new SoShapeHints;
flathints->vertexOrdering = SoShapeHints::COUNTERCLOCKWISE;
flathints->shapeType = SoShapeHints::UNKNOWN_SHAPE_TYPE;
pcFaceRoot->addChild(flathints);
// Draw lines
SoSeparator* linesep = new SoSeparator;
SoBaseColor* basecol = new SoBaseColor;
auto linesep = new SoSeparator;
auto basecol = new SoBaseColor;
basecol->rgb.setValue(1.0F, 0.0F, 0.0F);
linesep->addChild(basecol);
linesep->addChild(pcCoords);
@@ -345,14 +346,9 @@ void ViewProviderMeshDuplicatedFaces::attach(App::DocumentObject* pcFeat)
pcFaceRoot->addChild(linesep);
// Draw markers
SoBaseColor* markcol = new SoBaseColor;
auto markcol = new SoBaseColor;
markcol->rgb.setValue(1.0F, 1.0F, 0.0F);
SoMarkerSet* marker = new SoMarkerSet;
marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex(
"PLUS",
App::GetApplication()
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
->GetInt("MarkerSize", 7));
SoMarkerSet* marker = makeMarkerSet();
linesep->addChild(markcol);
linesep->addChild(marker);
@@ -361,11 +357,10 @@ void ViewProviderMeshDuplicatedFaces::attach(App::DocumentObject* pcFeat)
void ViewProviderMeshDuplicatedFaces::showDefects(const std::vector<Mesh::ElementIndex>& inds)
{
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
const MeshCore::MeshKernel& rMesh = f->Mesh.getValue().getKernel();
const MeshCore::MeshKernel& rMesh = getMeshKernel();
pcCoords->point.deleteValues(0);
pcCoords->point.setNum(3 * inds.size());
pcCoords->point.setNum(int(3 * inds.size()));
MeshCore::MeshFacetIterator cF(rMesh);
int i = 0;
int j = 0;
@@ -397,17 +392,17 @@ ViewProviderMeshDuplicatedPoints::~ViewProviderMeshDuplicatedPoints()
pcPoints->unref();
}
void ViewProviderMeshDuplicatedPoints::attach(App::DocumentObject* pcFeat)
void ViewProviderMeshDuplicatedPoints::attach(App::DocumentObject* obj)
{
ViewProviderDocumentObject::attach(pcFeat);
ViewProviderDocumentObject::attach(obj); // NOLINT
SoGroup* pcPointRoot = new SoGroup();
auto pcPointRoot = new SoGroup();
pcDrawStyle->pointSize = 3;
pcPointRoot->addChild(pcDrawStyle);
// Draw points
SoSeparator* pointsep = new SoSeparator;
SoBaseColor* basecol = new SoBaseColor;
auto pointsep = new SoSeparator;
auto basecol = new SoBaseColor;
basecol->rgb.setValue(1.0F, 0.5F, 0.0F);
pointsep->addChild(basecol);
pointsep->addChild(pcCoords);
@@ -415,14 +410,9 @@ void ViewProviderMeshDuplicatedPoints::attach(App::DocumentObject* pcFeat)
pcPointRoot->addChild(pointsep);
// Draw markers
SoBaseColor* markcol = new SoBaseColor;
auto markcol = new SoBaseColor;
markcol->rgb.setValue(1.0F, 1.0F, 0.0F);
SoMarkerSet* marker = new SoMarkerSet;
marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex(
"PLUS",
App::GetApplication()
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
->GetInt("MarkerSize", 7));
SoMarkerSet* marker = makeMarkerSet();
pointsep->addChild(markcol);
pointsep->addChild(marker);
@@ -431,10 +421,9 @@ void ViewProviderMeshDuplicatedPoints::attach(App::DocumentObject* pcFeat)
void ViewProviderMeshDuplicatedPoints::showDefects(const std::vector<Mesh::ElementIndex>& inds)
{
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
const MeshCore::MeshKernel& rMesh = f->Mesh.getValue().getKernel();
const MeshCore::MeshKernel& rMesh = getMeshKernel();
pcCoords->point.deleteValues(0);
pcCoords->point.setNum(inds.size());
pcCoords->point.setNum(int(inds.size()));
MeshCore::MeshPointIterator cP(rMesh);
int i = 0;
for (Mesh::ElementIndex ind : inds) {
@@ -460,17 +449,17 @@ ViewProviderMeshDegenerations::~ViewProviderMeshDegenerations()
pcLines->unref();
}
void ViewProviderMeshDegenerations::attach(App::DocumentObject* pcFeat)
void ViewProviderMeshDegenerations::attach(App::DocumentObject* obj)
{
ViewProviderDocumentObject::attach(pcFeat);
ViewProviderDocumentObject::attach(obj); // NOLINT
SoGroup* pcLineRoot = new SoGroup();
auto pcLineRoot = new SoGroup();
pcDrawStyle->lineWidth = 3;
pcLineRoot->addChild(pcDrawStyle);
// Draw lines
SoSeparator* linesep = new SoSeparator;
SoBaseColor* basecol = new SoBaseColor;
auto linesep = new SoSeparator;
auto basecol = new SoBaseColor;
basecol->rgb.setValue(1.0F, 0.5F, 0.0F);
linesep->addChild(basecol);
linesep->addChild(pcCoords);
@@ -478,14 +467,9 @@ void ViewProviderMeshDegenerations::attach(App::DocumentObject* pcFeat)
pcLineRoot->addChild(linesep);
// Draw markers
SoBaseColor* markcol = new SoBaseColor;
auto markcol = new SoBaseColor;
markcol->rgb.setValue(1.0F, 1.0F, 0.0F);
SoMarkerSet* marker = new SoMarkerSet;
marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex(
"PLUS",
App::GetApplication()
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
->GetInt("MarkerSize", 7));
SoMarkerSet* marker = makeMarkerSet();
linesep->addChild(markcol);
linesep->addChild(marker);
@@ -494,11 +478,10 @@ void ViewProviderMeshDegenerations::attach(App::DocumentObject* pcFeat)
void ViewProviderMeshDegenerations::showDefects(const std::vector<Mesh::ElementIndex>& inds)
{
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
const MeshCore::MeshKernel& rMesh = f->Mesh.getValue().getKernel();
const MeshCore::MeshKernel& rMesh = getMeshKernel();
pcCoords->point.deleteValues(0);
pcCoords->point.setNum(2 * inds.size());
pcCoords->point.setNum(int(2 * inds.size()));
MeshCore::MeshFacetIterator cF(rMesh);
int i = 0;
int j = 0;
@@ -512,7 +495,8 @@ void ViewProviderMeshDegenerations::showDefects(const std::vector<Mesh::ElementI
if (rE0 == rE1 && rE0 == rE2) {
// set a small tolerance to get a non-degenerated line
float eps = 0.005F;
Base::Vector3f cP1, cP2;
Base::Vector3f cP1;
Base::Vector3f cP2;
cP1.Set(rE1.x + eps, rE1.y + eps, rE1.z + eps);
cP2.Set(rE2.x - eps, rE2.y - eps, rE2.z - eps);
pcCoords->point.set1Value(i++, cP1.x, cP1.y, cP1.z);
@@ -571,24 +555,24 @@ ViewProviderMeshIndices::~ViewProviderMeshIndices()
pcFaces->unref();
}
void ViewProviderMeshIndices::attach(App::DocumentObject* pcFeat)
void ViewProviderMeshIndices::attach(App::DocumentObject* obj)
{
ViewProviderDocumentObject::attach(pcFeat);
ViewProviderDocumentObject::attach(obj); // NOLINT
SoGroup* pcFaceRoot = new SoGroup();
auto pcFaceRoot = new SoGroup();
SoDrawStyle* pcFlatStyle = new SoDrawStyle();
auto pcFlatStyle = new SoDrawStyle();
pcFlatStyle->style = SoDrawStyle::FILLED;
pcFaceRoot->addChild(pcFlatStyle);
SoShapeHints* flathints = new SoShapeHints;
auto flathints = new SoShapeHints;
flathints->vertexOrdering = SoShapeHints::COUNTERCLOCKWISE;
flathints->shapeType = SoShapeHints::UNKNOWN_SHAPE_TYPE;
pcFaceRoot->addChild(flathints);
// Draw lines
SoSeparator* linesep = new SoSeparator;
SoBaseColor* basecol = new SoBaseColor;
auto linesep = new SoSeparator;
auto basecol = new SoBaseColor;
basecol->rgb.setValue(1.0F, 0.5F, 0.0F);
linesep->addChild(basecol);
linesep->addChild(pcCoords);
@@ -596,14 +580,9 @@ void ViewProviderMeshIndices::attach(App::DocumentObject* pcFeat)
pcFaceRoot->addChild(linesep);
// Draw markers
SoBaseColor* markcol = new SoBaseColor;
auto markcol = new SoBaseColor;
markcol->rgb.setValue(1.0F, 1.0F, 0.0F);
SoMarkerSet* marker = new SoMarkerSet;
marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex(
"PLUS",
App::GetApplication()
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
->GetInt("MarkerSize", 7));
SoMarkerSet* marker = makeMarkerSet();
linesep->addChild(markcol);
linesep->addChild(marker);
@@ -612,12 +591,11 @@ void ViewProviderMeshIndices::attach(App::DocumentObject* pcFeat)
void ViewProviderMeshIndices::showDefects(const std::vector<Mesh::ElementIndex>& inds)
{
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
const MeshCore::MeshKernel& rMesh = f->Mesh.getValue().getKernel();
const MeshCore::MeshKernel& rMesh = getMeshKernel();
if (!inds.empty()) {
pcCoords->point.deleteValues(0);
pcCoords->point.setNum(3 * inds.size());
pcCoords->point.setNum(int(3 * inds.size()));
MeshCore::MeshFacetIterator cF(rMesh);
int i = 0;
int j = 0;
@@ -650,17 +628,17 @@ ViewProviderMeshSelfIntersections::~ViewProviderMeshSelfIntersections()
pcLines->unref();
}
void ViewProviderMeshSelfIntersections::attach(App::DocumentObject* pcFeat)
void ViewProviderMeshSelfIntersections::attach(App::DocumentObject* obj)
{
ViewProviderDocumentObject::attach(pcFeat);
ViewProviderDocumentObject::attach(obj); // NOLINT
SoGroup* pcLineRoot = new SoGroup();
auto pcLineRoot = new SoGroup();
pcDrawStyle->lineWidth = 3;
pcLineRoot->addChild(pcDrawStyle);
// Draw lines
SoSeparator* linesep = new SoSeparator;
SoBaseColor* basecol = new SoBaseColor;
auto linesep = new SoSeparator;
auto basecol = new SoBaseColor;
basecol->rgb.setValue(1.0F, 0.5F, 0.0F);
linesep->addChild(basecol);
linesep->addChild(pcCoords);
@@ -668,32 +646,26 @@ void ViewProviderMeshSelfIntersections::attach(App::DocumentObject* pcFeat)
pcLineRoot->addChild(linesep);
// Draw markers
SoBaseColor* markcol = new SoBaseColor;
auto markcol = new SoBaseColor;
markcol->rgb.setValue(1.0F, 1.0F, 0.0F);
SoMarkerSet* marker = new SoMarkerSet;
marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex(
"PLUS",
App::GetApplication()
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
->GetInt("MarkerSize", 7));
SoMarkerSet* marker = makeMarkerSet();
linesep->addChild(markcol);
linesep->addChild(marker);
addDisplayMaskMode(pcLineRoot, "Line");
}
void ViewProviderMeshSelfIntersections::showDefects(const std::vector<Mesh::ElementIndex>& indices)
void ViewProviderMeshSelfIntersections::showDefects(const std::vector<Mesh::ElementIndex>& inds)
{
if (indices.size() % 2 != 0) {
if (inds.size() % 2 != 0) {
return;
}
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
const MeshCore::MeshKernel& rMesh = f->Mesh.getValue().getKernel();
const MeshCore::MeshKernel& rMesh = getMeshKernel();
MeshCore::MeshEvalSelfIntersection eval(rMesh);
std::vector<std::pair<Mesh::ElementIndex, Mesh::ElementIndex>> intersection;
std::vector<Mesh::ElementIndex>::const_iterator it;
for (it = indices.begin(); it != indices.end();) {
for (auto it = inds.begin(); it != inds.end();) {
Mesh::ElementIndex id1 = *it;
++it;
Mesh::ElementIndex id2 = *it;
@@ -705,7 +677,7 @@ void ViewProviderMeshSelfIntersections::showDefects(const std::vector<Mesh::Elem
eval.GetIntersections(intersection, lines);
pcCoords->point.deleteValues(0);
pcCoords->point.setNum(2 * lines.size());
pcCoords->point.setNum(int(2 * lines.size()));
int i = 0;
int j = 0;
for (const auto& line : lines) {
@@ -732,24 +704,24 @@ ViewProviderMeshFolds::~ViewProviderMeshFolds()
pcFaces->unref();
}
void ViewProviderMeshFolds::attach(App::DocumentObject* pcFeat)
void ViewProviderMeshFolds::attach(App::DocumentObject* obj)
{
ViewProviderDocumentObject::attach(pcFeat);
ViewProviderDocumentObject::attach(obj); // NOLINT
SoGroup* pcFaceRoot = new SoGroup();
auto pcFaceRoot = new SoGroup();
SoDrawStyle* pcFlatStyle = new SoDrawStyle();
auto pcFlatStyle = new SoDrawStyle();
pcFlatStyle->style = SoDrawStyle::FILLED;
pcFaceRoot->addChild(pcFlatStyle);
SoShapeHints* flathints = new SoShapeHints;
auto flathints = new SoShapeHints;
flathints->vertexOrdering = SoShapeHints::COUNTERCLOCKWISE;
flathints->shapeType = SoShapeHints::UNKNOWN_SHAPE_TYPE;
pcFaceRoot->addChild(flathints);
// Draw lines
SoSeparator* linesep = new SoSeparator;
SoBaseColor* basecol = new SoBaseColor;
auto linesep = new SoSeparator;
auto basecol = new SoBaseColor;
basecol->rgb.setValue(1.0F, 0.0F, 0.0F);
linesep->addChild(basecol);
linesep->addChild(pcCoords);
@@ -757,14 +729,9 @@ void ViewProviderMeshFolds::attach(App::DocumentObject* pcFeat)
pcFaceRoot->addChild(linesep);
// Draw markers
SoBaseColor* markcol = new SoBaseColor;
auto markcol = new SoBaseColor;
markcol->rgb.setValue(1.0F, 1.0F, 0.0F);
SoMarkerSet* marker = new SoMarkerSet;
marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex(
"PLUS",
App::GetApplication()
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
->GetInt("MarkerSize", 7));
SoMarkerSet* marker = makeMarkerSet();
linesep->addChild(markcol);
linesep->addChild(marker);
@@ -773,11 +740,10 @@ void ViewProviderMeshFolds::attach(App::DocumentObject* pcFeat)
void ViewProviderMeshFolds::showDefects(const std::vector<Mesh::ElementIndex>& inds)
{
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
const MeshCore::MeshKernel& rMesh = f->Mesh.getValue().getKernel();
const MeshCore::MeshKernel& rMesh = getMeshKernel();
pcCoords->point.deleteValues(0);
pcCoords->point.setNum(3 * inds.size());
pcCoords->point.setNum(int(3 * inds.size()));
MeshCore::MeshFacetIterator cF(rMesh);
int i = 0;
int j = 0;
@@ -793,3 +759,4 @@ void ViewProviderMeshFolds::showDefects(const std::vector<Mesh::ElementIndex>& i
setDisplayMaskMode("Face");
}
// NOLINTEND(readability-magic-numbers,cppcoreguidelines-pro-bounds*)