Mesh: Apply clang-format
This commit is contained in:
@@ -22,22 +22,22 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <Inventor/nodes/SoBaseColor.h>
|
||||
# include <Inventor/nodes/SoCoordinate3.h>
|
||||
# include <Inventor/nodes/SoDrawStyle.h>
|
||||
# include <Inventor/nodes/SoFaceSet.h>
|
||||
# include <Inventor/nodes/SoLineSet.h>
|
||||
# include <Inventor/nodes/SoMarkerSet.h>
|
||||
# include <Inventor/nodes/SoSeparator.h>
|
||||
# include <Inventor/nodes/SoShapeHints.h>
|
||||
#include <Inventor/nodes/SoBaseColor.h>
|
||||
#include <Inventor/nodes/SoCoordinate3.h>
|
||||
#include <Inventor/nodes/SoDrawStyle.h>
|
||||
#include <Inventor/nodes/SoFaceSet.h>
|
||||
#include <Inventor/nodes/SoLineSet.h>
|
||||
#include <Inventor/nodes/SoMarkerSet.h>
|
||||
#include <Inventor/nodes/SoSeparator.h>
|
||||
#include <Inventor/nodes/SoShapeHints.h>
|
||||
#endif
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Gui/Inventor/MarkerBitmaps.h>
|
||||
#include <Mod/Mesh/App/MeshFeature.h>
|
||||
#include <Mod/Mesh/App/Core/Degeneration.h>
|
||||
#include <Mod/Mesh/App/Core/Iterator.h>
|
||||
#include <Mod/Mesh/App/MeshFeature.h>
|
||||
|
||||
#include "ViewProviderDefects.h"
|
||||
|
||||
@@ -59,7 +59,7 @@ PROPERTY_SOURCE(MeshGui::ViewProviderMeshFolds, MeshGui::ViewProviderMeshDefects
|
||||
|
||||
ViewProviderMeshDefects::ViewProviderMeshDefects()
|
||||
{
|
||||
ADD_PROPERTY(LineWidth,(2.0f));
|
||||
ADD_PROPERTY(LineWidth, (2.0f));
|
||||
|
||||
pcCoords = new SoCoordinate3();
|
||||
pcCoords->ref();
|
||||
@@ -80,8 +80,9 @@ void ViewProviderMeshDefects::onChanged(const App::Property* prop)
|
||||
if (prop == &LineWidth) {
|
||||
pcDrawStyle->lineWidth = 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 behaviour
|
||||
// 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
|
||||
// behaviour
|
||||
else if (prop == &Visibility) {
|
||||
Visibility.getValue() ? show() : hide();
|
||||
}
|
||||
@@ -105,7 +106,7 @@ ViewProviderMeshOrientation::~ViewProviderMeshOrientation()
|
||||
|
||||
void ViewProviderMeshOrientation::attach(App::DocumentObject* pcFeat)
|
||||
{
|
||||
ViewProviderDocumentObject::attach( pcFeat );
|
||||
ViewProviderDocumentObject::attach(pcFeat);
|
||||
|
||||
SoGroup* pcFaceRoot = new SoGroup();
|
||||
|
||||
@@ -113,24 +114,28 @@ void ViewProviderMeshOrientation::attach(App::DocumentObject* pcFeat)
|
||||
pcFlatStyle->style = SoDrawStyle::FILLED;
|
||||
pcFaceRoot->addChild(pcFlatStyle);
|
||||
|
||||
SoShapeHints * flathints = new SoShapeHints;
|
||||
flathints->vertexOrdering = SoShapeHints::COUNTERCLOCKWISE ;
|
||||
SoShapeHints* 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;
|
||||
basecol->rgb.setValue( 1.0f, 0.5f, 0.0f );
|
||||
SoBaseColor* 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;
|
||||
markcol->rgb.setValue( 1.0f, 1.0f, 0.0f );
|
||||
SoBaseColor* 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));
|
||||
marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex(
|
||||
"PLUS",
|
||||
App::GetApplication()
|
||||
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
|
||||
->GetInt("MarkerSize", 7));
|
||||
linesep->addChild(markcol);
|
||||
linesep->addChild(marker);
|
||||
|
||||
@@ -142,19 +147,19 @@ 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 = f->Mesh.getValue().getKernel();
|
||||
|
||||
pcCoords->point.deleteValues(0);
|
||||
pcCoords->point.setNum(3*inds.size());
|
||||
pcCoords->point.setNum(3 * inds.size());
|
||||
MeshCore::MeshFacetIterator cF(rMesh);
|
||||
int i=0;
|
||||
int j=0;
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
for (Mesh::ElementIndex ind : inds) {
|
||||
cF.Set(ind);
|
||||
for (auto cP : cF->_aclPoints) {
|
||||
// move a bit in opposite normal direction to overlay the original faces
|
||||
cP -= 0.001f * cF->GetNormal();
|
||||
pcCoords->point.set1Value(i++,cP.x,cP.y,cP.z);
|
||||
pcCoords->point.set1Value(i++, cP.x, cP.y, cP.z);
|
||||
}
|
||||
pcFaces->numVertices.set1Value(j++, 3);
|
||||
}
|
||||
@@ -177,7 +182,7 @@ ViewProviderMeshNonManifolds::~ViewProviderMeshNonManifolds()
|
||||
|
||||
void ViewProviderMeshNonManifolds::attach(App::DocumentObject* pcFeat)
|
||||
{
|
||||
ViewProviderDocumentObject::attach( pcFeat );
|
||||
ViewProviderDocumentObject::attach(pcFeat);
|
||||
|
||||
SoGroup* pcLineRoot = new SoGroup();
|
||||
pcDrawStyle->lineWidth = 3;
|
||||
@@ -185,18 +190,22 @@ void ViewProviderMeshNonManifolds::attach(App::DocumentObject* pcFeat)
|
||||
|
||||
// Draw lines
|
||||
SoSeparator* linesep = new SoSeparator;
|
||||
SoBaseColor * basecol = new SoBaseColor;
|
||||
basecol->rgb.setValue( 1.0f, 0.0f, 0.0f );
|
||||
SoBaseColor* basecol = new SoBaseColor;
|
||||
basecol->rgb.setValue(1.0f, 0.0f, 0.0f);
|
||||
linesep->addChild(basecol);
|
||||
linesep->addChild(pcCoords);
|
||||
linesep->addChild(pcLines);
|
||||
pcLineRoot->addChild(linesep);
|
||||
|
||||
// Draw markers
|
||||
SoBaseColor * markcol = new SoBaseColor;
|
||||
markcol->rgb.setValue( 1.0f, 1.0f, 0.0f );
|
||||
SoBaseColor* 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));
|
||||
marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex(
|
||||
"PLUS",
|
||||
App::GetApplication()
|
||||
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
|
||||
->GetInt("MarkerSize", 7));
|
||||
linesep->addChild(markcol);
|
||||
linesep->addChild(marker);
|
||||
|
||||
@@ -205,22 +214,24 @@ void ViewProviderMeshNonManifolds::attach(App::DocumentObject* pcFeat)
|
||||
|
||||
void ViewProviderMeshNonManifolds::showDefects(const std::vector<Mesh::ElementIndex>& inds)
|
||||
{
|
||||
if ((inds.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 = f->Mesh.getValue().getKernel();
|
||||
|
||||
pcCoords->point.deleteValues(0);
|
||||
pcCoords->point.setNum(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) {
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
for (std::vector<Mesh::ElementIndex>::const_iterator 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
|
||||
pcCoords->point.set1Value(i++, cP->x, cP->y, cP->z);
|
||||
++it; // go to end point
|
||||
cP.Set(*it);
|
||||
pcCoords->point.set1Value(i++,cP->x,cP->y,cP->z);
|
||||
pcCoords->point.set1Value(i++, cP->x, cP->y, cP->z);
|
||||
pcLines->numVertices.set1Value(j++, 2);
|
||||
}
|
||||
|
||||
@@ -242,7 +253,7 @@ ViewProviderMeshNonManifoldPoints::~ViewProviderMeshNonManifoldPoints()
|
||||
|
||||
void ViewProviderMeshNonManifoldPoints::attach(App::DocumentObject* pcFeat)
|
||||
{
|
||||
ViewProviderDocumentObject::attach( pcFeat );
|
||||
ViewProviderDocumentObject::attach(pcFeat);
|
||||
|
||||
SoGroup* pcPointRoot = new SoGroup();
|
||||
pcDrawStyle->pointSize = 3;
|
||||
@@ -250,18 +261,22 @@ void ViewProviderMeshNonManifoldPoints::attach(App::DocumentObject* pcFeat)
|
||||
|
||||
// Draw points
|
||||
SoSeparator* pointsep = new SoSeparator;
|
||||
SoBaseColor * basecol = new SoBaseColor;
|
||||
basecol->rgb.setValue( 1.0f, 0.5f, 0.0f );
|
||||
SoBaseColor* basecol = new SoBaseColor;
|
||||
basecol->rgb.setValue(1.0f, 0.5f, 0.0f);
|
||||
pointsep->addChild(basecol);
|
||||
pointsep->addChild(pcCoords);
|
||||
pointsep->addChild(pcPoints);
|
||||
pcPointRoot->addChild(pointsep);
|
||||
|
||||
// Draw markers
|
||||
SoBaseColor * markcol = new SoBaseColor;
|
||||
markcol->rgb.setValue( 1.0f, 1.0f, 0.0f );
|
||||
SoBaseColor* 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));
|
||||
marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex(
|
||||
"PLUS",
|
||||
App::GetApplication()
|
||||
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
|
||||
->GetInt("MarkerSize", 7));
|
||||
pointsep->addChild(markcol);
|
||||
pointsep->addChild(marker);
|
||||
|
||||
@@ -271,14 +286,14 @@ 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 = f->Mesh.getValue().getKernel();
|
||||
pcCoords->point.deleteValues(0);
|
||||
pcCoords->point.setNum(inds.size());
|
||||
MeshCore::MeshPointIterator cP(rMesh);
|
||||
int i = 0;
|
||||
for (Mesh::ElementIndex ind : inds) {
|
||||
cP.Set(ind);
|
||||
pcCoords->point.set1Value(i++,cP->x,cP->y,cP->z);
|
||||
pcCoords->point.set1Value(i++, cP->x, cP->y, cP->z);
|
||||
}
|
||||
|
||||
setDisplayMaskMode("Point");
|
||||
@@ -299,7 +314,7 @@ ViewProviderMeshDuplicatedFaces::~ViewProviderMeshDuplicatedFaces()
|
||||
|
||||
void ViewProviderMeshDuplicatedFaces::attach(App::DocumentObject* pcFeat)
|
||||
{
|
||||
ViewProviderDocumentObject::attach( pcFeat );
|
||||
ViewProviderDocumentObject::attach(pcFeat);
|
||||
|
||||
SoGroup* pcFaceRoot = new SoGroup();
|
||||
|
||||
@@ -307,25 +322,29 @@ void ViewProviderMeshDuplicatedFaces::attach(App::DocumentObject* pcFeat)
|
||||
pcFlatStyle->style = SoDrawStyle::FILLED;
|
||||
pcFaceRoot->addChild(pcFlatStyle);
|
||||
|
||||
SoShapeHints * flathints = new SoShapeHints;
|
||||
flathints->vertexOrdering = SoShapeHints::COUNTERCLOCKWISE ;
|
||||
SoShapeHints* 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;
|
||||
basecol->rgb.setValue( 1.0f, 0.0f, 0.0f );
|
||||
SoBaseColor* basecol = new SoBaseColor;
|
||||
basecol->rgb.setValue(1.0f, 0.0f, 0.0f);
|
||||
linesep->addChild(basecol);
|
||||
linesep->addChild(pcCoords);
|
||||
linesep->addChild(pcFaces);
|
||||
pcFaceRoot->addChild(linesep);
|
||||
|
||||
// Draw markers
|
||||
SoBaseColor * markcol = new SoBaseColor;
|
||||
markcol->rgb.setValue( 1.0f, 1.0f, 0.0f );
|
||||
SoBaseColor* 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));
|
||||
marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex(
|
||||
"PLUS",
|
||||
App::GetApplication()
|
||||
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
|
||||
->GetInt("MarkerSize", 7));
|
||||
linesep->addChild(markcol);
|
||||
linesep->addChild(marker);
|
||||
|
||||
@@ -335,19 +354,19 @@ 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 = f->Mesh.getValue().getKernel();
|
||||
|
||||
pcCoords->point.deleteValues(0);
|
||||
pcCoords->point.setNum(3*inds.size());
|
||||
pcCoords->point.setNum(3 * inds.size());
|
||||
MeshCore::MeshFacetIterator cF(rMesh);
|
||||
int i=0;
|
||||
int j=0;
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
for (Mesh::ElementIndex ind : inds) {
|
||||
cF.Set(ind);
|
||||
for (auto cP : cF->_aclPoints) {
|
||||
// move a bit in normal direction to overlay the original faces
|
||||
cP += 0.001f * cF->GetNormal();
|
||||
pcCoords->point.set1Value(i++,cP.x,cP.y,cP.z);
|
||||
pcCoords->point.set1Value(i++, cP.x, cP.y, cP.z);
|
||||
}
|
||||
pcFaces->numVertices.set1Value(j++, 3);
|
||||
}
|
||||
@@ -370,7 +389,7 @@ ViewProviderMeshDuplicatedPoints::~ViewProviderMeshDuplicatedPoints()
|
||||
|
||||
void ViewProviderMeshDuplicatedPoints::attach(App::DocumentObject* pcFeat)
|
||||
{
|
||||
ViewProviderDocumentObject::attach( pcFeat );
|
||||
ViewProviderDocumentObject::attach(pcFeat);
|
||||
|
||||
SoGroup* pcPointRoot = new SoGroup();
|
||||
pcDrawStyle->pointSize = 3;
|
||||
@@ -378,18 +397,22 @@ void ViewProviderMeshDuplicatedPoints::attach(App::DocumentObject* pcFeat)
|
||||
|
||||
// Draw points
|
||||
SoSeparator* pointsep = new SoSeparator;
|
||||
SoBaseColor * basecol = new SoBaseColor;
|
||||
basecol->rgb.setValue( 1.0f, 0.5f, 0.0f );
|
||||
SoBaseColor* basecol = new SoBaseColor;
|
||||
basecol->rgb.setValue(1.0f, 0.5f, 0.0f);
|
||||
pointsep->addChild(basecol);
|
||||
pointsep->addChild(pcCoords);
|
||||
pointsep->addChild(pcPoints);
|
||||
pcPointRoot->addChild(pointsep);
|
||||
|
||||
// Draw markers
|
||||
SoBaseColor * markcol = new SoBaseColor;
|
||||
markcol->rgb.setValue( 1.0f, 1.0f, 0.0f );
|
||||
SoBaseColor* 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));
|
||||
marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex(
|
||||
"PLUS",
|
||||
App::GetApplication()
|
||||
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
|
||||
->GetInt("MarkerSize", 7));
|
||||
pointsep->addChild(markcol);
|
||||
pointsep->addChild(marker);
|
||||
|
||||
@@ -399,14 +422,14 @@ 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 = f->Mesh.getValue().getKernel();
|
||||
pcCoords->point.deleteValues(0);
|
||||
pcCoords->point.setNum(inds.size());
|
||||
MeshCore::MeshPointIterator cP(rMesh);
|
||||
int i = 0;
|
||||
for (Mesh::ElementIndex ind : inds) {
|
||||
cP.Set(ind);
|
||||
pcCoords->point.set1Value(i++,cP->x,cP->y,cP->z);
|
||||
pcCoords->point.set1Value(i++, cP->x, cP->y, cP->z);
|
||||
}
|
||||
|
||||
setDisplayMaskMode("Point");
|
||||
@@ -427,7 +450,7 @@ ViewProviderMeshDegenerations::~ViewProviderMeshDegenerations()
|
||||
|
||||
void ViewProviderMeshDegenerations::attach(App::DocumentObject* pcFeat)
|
||||
{
|
||||
ViewProviderDocumentObject::attach( pcFeat );
|
||||
ViewProviderDocumentObject::attach(pcFeat);
|
||||
|
||||
SoGroup* pcLineRoot = new SoGroup();
|
||||
pcDrawStyle->lineWidth = 3;
|
||||
@@ -435,18 +458,22 @@ void ViewProviderMeshDegenerations::attach(App::DocumentObject* pcFeat)
|
||||
|
||||
// Draw lines
|
||||
SoSeparator* linesep = new SoSeparator;
|
||||
SoBaseColor * basecol = new SoBaseColor;
|
||||
basecol->rgb.setValue( 1.0f, 0.5f, 0.0f );
|
||||
SoBaseColor* basecol = new SoBaseColor;
|
||||
basecol->rgb.setValue(1.0f, 0.5f, 0.0f);
|
||||
linesep->addChild(basecol);
|
||||
linesep->addChild(pcCoords);
|
||||
linesep->addChild(pcLines);
|
||||
pcLineRoot->addChild(linesep);
|
||||
|
||||
// Draw markers
|
||||
SoBaseColor * markcol = new SoBaseColor;
|
||||
markcol->rgb.setValue( 1.0f, 1.0f, 0.0f );
|
||||
SoBaseColor* 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));
|
||||
marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex(
|
||||
"PLUS",
|
||||
App::GetApplication()
|
||||
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
|
||||
->GetInt("MarkerSize", 7));
|
||||
linesep->addChild(markcol);
|
||||
linesep->addChild(marker);
|
||||
|
||||
@@ -456,13 +483,13 @@ 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 = f->Mesh.getValue().getKernel();
|
||||
|
||||
pcCoords->point.deleteValues(0);
|
||||
pcCoords->point.setNum(2*inds.size());
|
||||
pcCoords->point.setNum(2 * inds.size());
|
||||
MeshCore::MeshFacetIterator cF(rMesh);
|
||||
int i=0;
|
||||
int j=0;
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
for (Mesh::ElementIndex ind : inds) {
|
||||
cF.Set(ind);
|
||||
const MeshCore::MeshPoint& rE0 = cF->_aclPoints[0];
|
||||
@@ -474,32 +501,38 @@ void ViewProviderMeshDegenerations::showDefects(const std::vector<Mesh::ElementI
|
||||
// set a small tolerance to get a non-degenerated line
|
||||
float eps = 0.005f;
|
||||
Base::Vector3f cP1, 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);
|
||||
pcCoords->point.set1Value(i++,cP2.x,cP2.y,cP2.z);
|
||||
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);
|
||||
pcCoords->point.set1Value(i++, cP2.x, cP2.y, cP2.z);
|
||||
}
|
||||
else if (rE0 == rE1) {
|
||||
pcCoords->point.set1Value(i++,rE1.x,rE1.y,rE1.z);
|
||||
pcCoords->point.set1Value(i++,rE2.x,rE2.y,rE2.z);
|
||||
pcCoords->point.set1Value(i++, rE1.x, rE1.y, rE1.z);
|
||||
pcCoords->point.set1Value(i++, rE2.x, rE2.y, rE2.z);
|
||||
}
|
||||
else if (rE1 == rE2) {
|
||||
pcCoords->point.set1Value(i++,rE2.x,rE2.y,rE2.z);
|
||||
pcCoords->point.set1Value(i++,rE0.x,rE0.y,rE0.z);
|
||||
pcCoords->point.set1Value(i++, rE2.x, rE2.y, rE2.z);
|
||||
pcCoords->point.set1Value(i++, rE0.x, rE0.y, rE0.z);
|
||||
}
|
||||
else if (rE2 == rE0) {
|
||||
pcCoords->point.set1Value(i++,rE0.x,rE0.y,rE0.z);
|
||||
pcCoords->point.set1Value(i++,rE1.x,rE1.y,rE1.z);
|
||||
pcCoords->point.set1Value(i++, rE0.x, rE0.y, rE0.z);
|
||||
pcCoords->point.set1Value(i++, rE1.x, rE1.y, rE1.z);
|
||||
}
|
||||
else {
|
||||
for (int j=0; j<3; j++) {
|
||||
Base::Vector3f cVec1 = cF->_aclPoints[(j+1)%3] - cF->_aclPoints[j];
|
||||
Base::Vector3f cVec2 = cF->_aclPoints[(j+2)%3] - cF->_aclPoints[j];
|
||||
for (int j = 0; j < 3; j++) {
|
||||
Base::Vector3f cVec1 = cF->_aclPoints[(j + 1) % 3] - cF->_aclPoints[j];
|
||||
Base::Vector3f cVec2 = cF->_aclPoints[(j + 2) % 3] - cF->_aclPoints[j];
|
||||
|
||||
// adjust the neighbourhoods and point indices
|
||||
if (cVec1 * cVec2 < 0.0f) {
|
||||
pcCoords->point.set1Value(i++,cF->_aclPoints[(j+1)%3].x,cF->_aclPoints[(j+1)%3].y,cF->_aclPoints[(j+1)%3].z);
|
||||
pcCoords->point.set1Value(i++,cF->_aclPoints[(j+2)%3].x,cF->_aclPoints[(j+2)%3].y,cF->_aclPoints[(j+2)%3].z);
|
||||
pcCoords->point.set1Value(i++,
|
||||
cF->_aclPoints[(j + 1) % 3].x,
|
||||
cF->_aclPoints[(j + 1) % 3].y,
|
||||
cF->_aclPoints[(j + 1) % 3].z);
|
||||
pcCoords->point.set1Value(i++,
|
||||
cF->_aclPoints[(j + 2) % 3].x,
|
||||
cF->_aclPoints[(j + 2) % 3].y,
|
||||
cF->_aclPoints[(j + 2) % 3].z);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -526,7 +559,7 @@ ViewProviderMeshIndices::~ViewProviderMeshIndices()
|
||||
|
||||
void ViewProviderMeshIndices::attach(App::DocumentObject* pcFeat)
|
||||
{
|
||||
ViewProviderDocumentObject::attach( pcFeat );
|
||||
ViewProviderDocumentObject::attach(pcFeat);
|
||||
|
||||
SoGroup* pcFaceRoot = new SoGroup();
|
||||
|
||||
@@ -534,25 +567,29 @@ void ViewProviderMeshIndices::attach(App::DocumentObject* pcFeat)
|
||||
pcFlatStyle->style = SoDrawStyle::FILLED;
|
||||
pcFaceRoot->addChild(pcFlatStyle);
|
||||
|
||||
SoShapeHints * flathints = new SoShapeHints;
|
||||
flathints->vertexOrdering = SoShapeHints::COUNTERCLOCKWISE ;
|
||||
SoShapeHints* 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;
|
||||
basecol->rgb.setValue( 1.0f, 0.5f, 0.0f );
|
||||
SoBaseColor* basecol = new SoBaseColor;
|
||||
basecol->rgb.setValue(1.0f, 0.5f, 0.0f);
|
||||
linesep->addChild(basecol);
|
||||
linesep->addChild(pcCoords);
|
||||
linesep->addChild(pcFaces);
|
||||
pcFaceRoot->addChild(linesep);
|
||||
|
||||
// Draw markers
|
||||
SoBaseColor * markcol = new SoBaseColor;
|
||||
markcol->rgb.setValue( 1.0f, 1.0f, 0.0f );
|
||||
SoBaseColor* 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));
|
||||
marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex(
|
||||
"PLUS",
|
||||
App::GetApplication()
|
||||
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
|
||||
->GetInt("MarkerSize", 7));
|
||||
linesep->addChild(markcol);
|
||||
linesep->addChild(marker);
|
||||
|
||||
@@ -562,20 +599,20 @@ 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 = f->Mesh.getValue().getKernel();
|
||||
|
||||
if (!inds.empty()) {
|
||||
pcCoords->point.deleteValues(0);
|
||||
pcCoords->point.setNum(3*inds.size());
|
||||
pcCoords->point.setNum(3 * inds.size());
|
||||
MeshCore::MeshFacetIterator cF(rMesh);
|
||||
int i=0;
|
||||
int j=0;
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
for (Mesh::ElementIndex ind : inds) {
|
||||
cF.Set(ind);
|
||||
for (auto cP : cF->_aclPoints) {
|
||||
// move a bit in opposite normal direction to overlay the original faces
|
||||
cP -= 0.001f * cF->GetNormal();
|
||||
pcCoords->point.set1Value(i++,cP.x,cP.y,cP.z);
|
||||
pcCoords->point.set1Value(i++, cP.x, cP.y, cP.z);
|
||||
}
|
||||
pcFaces->numVertices.set1Value(j++, 3);
|
||||
}
|
||||
@@ -599,7 +636,7 @@ ViewProviderMeshSelfIntersections::~ViewProviderMeshSelfIntersections()
|
||||
|
||||
void ViewProviderMeshSelfIntersections::attach(App::DocumentObject* pcFeat)
|
||||
{
|
||||
ViewProviderDocumentObject::attach( pcFeat );
|
||||
ViewProviderDocumentObject::attach(pcFeat);
|
||||
|
||||
SoGroup* pcLineRoot = new SoGroup();
|
||||
pcDrawStyle->lineWidth = 3;
|
||||
@@ -607,18 +644,22 @@ void ViewProviderMeshSelfIntersections::attach(App::DocumentObject* pcFeat)
|
||||
|
||||
// Draw lines
|
||||
SoSeparator* linesep = new SoSeparator;
|
||||
SoBaseColor * basecol = new SoBaseColor;
|
||||
basecol->rgb.setValue( 1.0f, 0.5f, 0.0f );
|
||||
SoBaseColor* basecol = new SoBaseColor;
|
||||
basecol->rgb.setValue(1.0f, 0.5f, 0.0f);
|
||||
linesep->addChild(basecol);
|
||||
linesep->addChild(pcCoords);
|
||||
linesep->addChild(pcLines);
|
||||
pcLineRoot->addChild(linesep);
|
||||
|
||||
// Draw markers
|
||||
SoBaseColor * markcol = new SoBaseColor;
|
||||
markcol->rgb.setValue( 1.0f, 1.0f, 0.0f );
|
||||
SoBaseColor* 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));
|
||||
marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex(
|
||||
"PLUS",
|
||||
App::GetApplication()
|
||||
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
|
||||
->GetInt("MarkerSize", 7));
|
||||
linesep->addChild(markcol);
|
||||
linesep->addChild(marker);
|
||||
|
||||
@@ -627,30 +668,33 @@ void ViewProviderMeshSelfIntersections::attach(App::DocumentObject* pcFeat)
|
||||
|
||||
void ViewProviderMeshSelfIntersections::showDefects(const std::vector<Mesh::ElementIndex>& indices)
|
||||
{
|
||||
if (indices.size() % 2 != 0)
|
||||
if (indices.size() % 2 != 0) {
|
||||
return;
|
||||
}
|
||||
Mesh::Feature* f = static_cast<Mesh::Feature*>(pcObject);
|
||||
const MeshCore::MeshKernel & rMesh = f->Mesh.getValue().getKernel();
|
||||
const MeshCore::MeshKernel& rMesh = f->Mesh.getValue().getKernel();
|
||||
MeshCore::MeshEvalSelfIntersection eval(rMesh);
|
||||
|
||||
std::vector<std::pair<Mesh::ElementIndex, Mesh::ElementIndex> > intersection;
|
||||
std::vector<std::pair<Mesh::ElementIndex, Mesh::ElementIndex>> intersection;
|
||||
std::vector<Mesh::ElementIndex>::const_iterator it;
|
||||
for (it = indices.begin(); it != indices.end(); ) {
|
||||
Mesh::ElementIndex id1 = *it; ++it;
|
||||
Mesh::ElementIndex id2 = *it; ++it;
|
||||
intersection.emplace_back(id1,id2);
|
||||
for (it = indices.begin(); it != indices.end();) {
|
||||
Mesh::ElementIndex id1 = *it;
|
||||
++it;
|
||||
Mesh::ElementIndex id2 = *it;
|
||||
++it;
|
||||
intersection.emplace_back(id1, id2);
|
||||
}
|
||||
|
||||
std::vector<std::pair<Base::Vector3f, Base::Vector3f> > lines;
|
||||
std::vector<std::pair<Base::Vector3f, Base::Vector3f>> lines;
|
||||
eval.GetIntersections(intersection, lines);
|
||||
|
||||
pcCoords->point.deleteValues(0);
|
||||
pcCoords->point.setNum(2*lines.size());
|
||||
int i=0;
|
||||
int j=0;
|
||||
for (const auto & line : lines) {
|
||||
pcCoords->point.set1Value(i++,line.first.x,line.first.y,line.first.z);
|
||||
pcCoords->point.set1Value(i++,line.second.x,line.second.y,line.second.z);
|
||||
pcCoords->point.setNum(2 * lines.size());
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
for (const auto& line : lines) {
|
||||
pcCoords->point.set1Value(i++, line.first.x, line.first.y, line.first.z);
|
||||
pcCoords->point.set1Value(i++, line.second.x, line.second.y, line.second.z);
|
||||
pcLines->numVertices.set1Value(j++, 2);
|
||||
}
|
||||
|
||||
@@ -672,7 +716,7 @@ ViewProviderMeshFolds::~ViewProviderMeshFolds()
|
||||
|
||||
void ViewProviderMeshFolds::attach(App::DocumentObject* pcFeat)
|
||||
{
|
||||
ViewProviderDocumentObject::attach( pcFeat );
|
||||
ViewProviderDocumentObject::attach(pcFeat);
|
||||
|
||||
SoGroup* pcFaceRoot = new SoGroup();
|
||||
|
||||
@@ -680,25 +724,29 @@ void ViewProviderMeshFolds::attach(App::DocumentObject* pcFeat)
|
||||
pcFlatStyle->style = SoDrawStyle::FILLED;
|
||||
pcFaceRoot->addChild(pcFlatStyle);
|
||||
|
||||
SoShapeHints * flathints = new SoShapeHints;
|
||||
flathints->vertexOrdering = SoShapeHints::COUNTERCLOCKWISE ;
|
||||
SoShapeHints* 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;
|
||||
basecol->rgb.setValue( 1.0f, 0.0f, 0.0f );
|
||||
SoBaseColor* basecol = new SoBaseColor;
|
||||
basecol->rgb.setValue(1.0f, 0.0f, 0.0f);
|
||||
linesep->addChild(basecol);
|
||||
linesep->addChild(pcCoords);
|
||||
linesep->addChild(pcFaces);
|
||||
pcFaceRoot->addChild(linesep);
|
||||
|
||||
// Draw markers
|
||||
SoBaseColor * markcol = new SoBaseColor;
|
||||
markcol->rgb.setValue( 1.0f, 1.0f, 0.0f );
|
||||
SoBaseColor* 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));
|
||||
marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex(
|
||||
"PLUS",
|
||||
App::GetApplication()
|
||||
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
|
||||
->GetInt("MarkerSize", 7));
|
||||
linesep->addChild(markcol);
|
||||
linesep->addChild(marker);
|
||||
|
||||
@@ -708,19 +756,19 @@ 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 = f->Mesh.getValue().getKernel();
|
||||
|
||||
pcCoords->point.deleteValues(0);
|
||||
pcCoords->point.setNum(3*inds.size());
|
||||
pcCoords->point.setNum(3 * inds.size());
|
||||
MeshCore::MeshFacetIterator cF(rMesh);
|
||||
int i=0;
|
||||
int j=0;
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
for (Mesh::ElementIndex ind : inds) {
|
||||
cF.Set(ind);
|
||||
for (auto cP : cF->_aclPoints) {
|
||||
// move a bit in normal direction to overlay the original faces
|
||||
cP += 0.001f * cF->GetNormal();
|
||||
pcCoords->point.set1Value(i++,cP.x,cP.y,cP.z);
|
||||
pcCoords->point.set1Value(i++, cP.x, cP.y, cP.z);
|
||||
}
|
||||
pcFaces->numVertices.set1Value(j++, 3);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user