+ allow to customize algorithms in mesh evalutation panel

This commit is contained in:
wmayer 2016-07-30 19:51:16 +02:00
parent dfb460d3bd
commit 8a5c03b671
22 changed files with 833 additions and 411 deletions

View File

@ -448,68 +448,61 @@ bool MeshEvalInternalFacets::Evaluate()
bool MeshEvalDegeneratedFacets::Evaluate()
{
MeshFacetIterator it(_rclMesh);
for ( it.Init(); it.More(); it.Next() )
{
if ( it->IsDegenerated() )
return false;
}
MeshFacetIterator it(_rclMesh);
for (it.Init(); it.More(); it.Next()) {
if (it->IsDegenerated(fEpsilon))
return false;
}
return true;
return true;
}
unsigned long MeshEvalDegeneratedFacets::CountEdgeTooSmall (float fMinEdgeLength) const
{
MeshFacetIterator clFIter(_rclMesh);
unsigned long k = 0;
MeshFacetIterator clFIter(_rclMesh);
unsigned long k = 0;
while (clFIter.EndReached() == false)
{
for ( int i = 0; i < 3; i++)
{
if (Base::Distance(clFIter->_aclPoints[i], clFIter->_aclPoints[(i+1)%3]) < fMinEdgeLength)
k++;
while (clFIter.EndReached() == false) {
for (int i = 0; i < 3; i++) {
if (Base::Distance(clFIter->_aclPoints[i], clFIter->_aclPoints[(i+1)%3]) < fMinEdgeLength)
k++;
}
++clFIter;
}
++clFIter;
}
return k;
return k;
}
std::vector<unsigned long> MeshEvalDegeneratedFacets::GetIndices() const
{
std::vector<unsigned long> aInds;
MeshFacetIterator it(_rclMesh);
for ( it.Init(); it.More(); it.Next() )
{
if ( it->IsDegenerated() )
aInds.push_back(it.Position());
}
std::vector<unsigned long> aInds;
MeshFacetIterator it(_rclMesh);
for (it.Init(); it.More(); it.Next()) {
if (it->IsDegenerated(fEpsilon))
aInds.push_back(it.Position());
}
return aInds;
return aInds;
}
bool MeshFixDegeneratedFacets::Fixup()
{
MeshTopoAlgorithm cTopAlg(_rclMesh);
MeshTopoAlgorithm cTopAlg(_rclMesh);
MeshFacetIterator it(_rclMesh);
for ( it.Init(); it.More(); it.Next() )
{
if ( it->IsDegenerated() )
{
unsigned long uCt = _rclMesh.CountFacets();
unsigned long uId = it.Position();
cTopAlg.RemoveDegeneratedFacet(uId);
if ( uCt != _rclMesh.CountFacets() )
{
// due to a modification of the array the iterator became invalid
it.Set(uId-1);
}
MeshFacetIterator it(_rclMesh);
for (it.Init(); it.More(); it.Next()) {
if (it->IsDegenerated(fEpsilon)) {
unsigned long uCt = _rclMesh.CountFacets();
unsigned long uId = it.Position();
cTopAlg.RemoveDegeneratedFacet(uId);
if (uCt != _rclMesh.CountFacets()) {
// due to a modification of the array the iterator became invalid
it.Set(uId-1);
}
}
}
}
return true;
return true;
}
unsigned long MeshFixDegeneratedFacets::RemoveEdgeTooSmall (float fMinEdgeLength, float fMinEdgeAngle)
@ -610,97 +603,91 @@ unsigned long MeshFixDegeneratedFacets::RemoveEdgeTooSmall (float fMinEdgeLength
bool MeshEvalDeformedFacets::Evaluate()
{
MeshFacetIterator it(_rclMesh);
for ( it.Init(); it.More(); it.Next() )
{
if ( it->IsDeformed() )
return false;
}
MeshFacetIterator it(_rclMesh);
for (it.Init(); it.More(); it.Next()) {
if (it->IsDeformed())
return false;
}
return true;
return true;
}
std::vector<unsigned long> MeshEvalDeformedFacets::GetIndices() const
{
std::vector<unsigned long> aInds;
MeshFacetIterator it(_rclMesh);
for ( it.Init(); it.More(); it.Next() )
{
if ( it->IsDeformed() )
aInds.push_back(it.Position());
}
std::vector<unsigned long> aInds;
MeshFacetIterator it(_rclMesh);
for (it.Init(); it.More(); it.Next()) {
if (it->IsDeformed())
aInds.push_back(it.Position());
}
return aInds;
return aInds;
}
bool MeshFixDeformedFacets::Fixup()
{
Base::Vector3f u,v;
MeshTopoAlgorithm cTopAlg(_rclMesh);
Base::Vector3f u,v;
MeshTopoAlgorithm cTopAlg(_rclMesh);
MeshFacetIterator it(_rclMesh);
for ( it.Init(); it.More(); it.Next() )
{
// possibly deformed but not degenerated
if ( !it->IsDegenerated() )
{
// store the angles to avoid to compute twice
float fCosAngles[3] = {0,0,0};
bool done=false;
MeshFacetIterator it(_rclMesh);
for (it.Init(); it.More(); it.Next()) {
// possibly deformed but not degenerated
if (!it->IsDegenerated(fEpsilon)) {
// store the angles to avoid to compute twice
float fCosAngles[3] = {0,0,0};
bool done=false;
for (int i=0; i<3; i++)
{
u = it->_aclPoints[(i+1)%3]-it->_aclPoints[i];
v = it->_aclPoints[(i+2)%3]-it->_aclPoints[i];
u.Normalize();
v.Normalize();
for (int i=0; i<3; i++) {
u = it->_aclPoints[(i+1)%3]-it->_aclPoints[i];
v = it->_aclPoints[(i+2)%3]-it->_aclPoints[i];
u.Normalize();
v.Normalize();
float fCosAngle = u * v;
fCosAngles[i] = fCosAngle;
}
float fCosAngle = u * v;
fCosAngles[i] = fCosAngle;
}
// first check for angle > 120 deg: in this case we swap with the opposite edge
for (int i=0; i<3; i++)
{
float fCosAngle = fCosAngles[i];
if (fCosAngle < -0.5f) {
const MeshFacet& face = it.GetReference();
unsigned long uNeighbour = face._aulNeighbours[(i+1)%3];
if (uNeighbour!=ULONG_MAX && cTopAlg.ShouldSwapEdge(it.Position(), uNeighbour, fMaxAngle)) {
cTopAlg.SwapEdge(it.Position(), uNeighbour);
done = true;
}
break;
// first check for angle > 120 deg: in this case we swap with the opposite edge
for (int i=0; i<3; i++) {
float fCosAngle = fCosAngles[i];
if (fCosAngle < -0.5f) {
const MeshFacet& face = it.GetReference();
unsigned long uNeighbour = face._aulNeighbours[(i+1)%3];
if (uNeighbour!=ULONG_MAX && cTopAlg.ShouldSwapEdge(it.Position(), uNeighbour, fMaxAngle)) {
cTopAlg.SwapEdge(it.Position(), uNeighbour);
done = true;
}
break;
}
}
// we have swapped already
if (done)
continue;
// now check for angle < 30 deg: in this case we swap with one of the edges the corner is part of
for (int j=0; j<3; j++) {
float fCosAngle = fCosAngles[j];
if (fCosAngle > 0.86f) {
const MeshFacet& face = it.GetReference();
unsigned long uNeighbour = face._aulNeighbours[j];
if (uNeighbour!=ULONG_MAX && cTopAlg.ShouldSwapEdge(it.Position(), uNeighbour, fMaxAngle)) {
cTopAlg.SwapEdge(it.Position(), uNeighbour);
break;
}
uNeighbour = face._aulNeighbours[(j+2)%3];
if (uNeighbour!=ULONG_MAX && cTopAlg.ShouldSwapEdge(it.Position(), uNeighbour, fMaxAngle)) {
cTopAlg.SwapEdge(it.Position(), uNeighbour);
break;
}
}
}
}
}
// we have swapped already
if (done)
continue;
// now check for angle < 30 deg: in this case we swap with one of the edges the corner is part of
for (int j=0; j<3; j++)
{
float fCosAngle = fCosAngles[j];
if (fCosAngle > 0.86f) {
const MeshFacet& face = it.GetReference();
unsigned long uNeighbour = face._aulNeighbours[j];
if (uNeighbour!=ULONG_MAX && cTopAlg.ShouldSwapEdge(it.Position(), uNeighbour, fMaxAngle)) {
cTopAlg.SwapEdge(it.Position(), uNeighbour);
break;
}
uNeighbour = face._aulNeighbours[(j+2)%3];
if (uNeighbour!=ULONG_MAX && cTopAlg.ShouldSwapEdge(it.Position(), uNeighbour, fMaxAngle)) {
cTopAlg.SwapEdge(it.Position(), uNeighbour);
break;
}
}
}
}
}
return true;
return true;
}
// ----------------------------------------------------------------------

View File

@ -280,7 +280,8 @@ public:
/**
* Construction.
*/
MeshEvalDegeneratedFacets (const MeshKernel &rclM) : MeshEvaluation( rclM ) { }
MeshEvalDegeneratedFacets (const MeshKernel &rclM, float fEps)
: MeshEvaluation(rclM), fEpsilon(fEps) {}
/**
* Destruction.
*/
@ -297,6 +298,9 @@ public:
* Returns the indices of all corrupt facets.
*/
std::vector<unsigned long> GetIndices() const;
private:
float fEpsilon;
};
/**
@ -310,7 +314,8 @@ public:
/**
* Construction.
*/
MeshFixDegeneratedFacets (MeshKernel &rclM) : MeshValidation( rclM ) { }
MeshFixDegeneratedFacets (MeshKernel &rclM, float fEps)
: MeshValidation(rclM), fEpsilon(fEps) { }
/**
* Destruction.
*/
@ -325,6 +330,8 @@ public:
*/
unsigned long RemoveEdgeTooSmall (float fMinEdgeLength = MeshDefinitions::_fMinPointDistance,
float fMinEdgeAngle = MeshDefinitions::_fMinEdgeAngle);
private:
float fEpsilon;
};
/**
@ -367,7 +374,8 @@ public:
/**
* Construction.
*/
MeshFixDeformedFacets (MeshKernel &rclM, float fAngle) : MeshValidation( rclM ), fMaxAngle(fAngle) { }
MeshFixDeformedFacets (MeshKernel &rclM, float fAngle, float fEps)
: MeshValidation(rclM), fMaxAngle(fAngle), fEpsilon(fEps) { }
/**
* Destruction.
*/
@ -379,6 +387,7 @@ public:
private:
float fMaxAngle;
float fEpsilon;
};
/**

View File

@ -388,8 +388,14 @@ void MeshGeomFacet::Enlarge (float fDist)
_aclPoints[2] = clPNew[2];
}
bool MeshGeomFacet::IsDegenerated() const
bool MeshGeomFacet::IsDegenerated(float epsilon) const
{
// if we do a strict test then compute the area
if (epsilon == 0) {
float fArea = Area();
return fArea < epsilon;
}
// The triangle has the points A,B,C where we can define the vector u and v
// u = b-a and v = c-a. Then we define the line g: r = a+t*u and the plane
// E: (x-c)*u=0. The intersection point of g and E is S.
@ -409,11 +415,16 @@ bool MeshGeomFacet::IsDegenerated() const
// BTW (u*u)*(v*v)-(u*v)*(u*v) is the same as (uxv)*(uxv).
Base::Vector3f u = _aclPoints[1] - _aclPoints[0];
Base::Vector3f v = _aclPoints[2] - _aclPoints[0];
float eps = MeshDefinitions::_fMinPointDistanceP2;
float uu = u*u; if (uu < eps) return true;
float vv = v*v; if (vv < eps) return true;
float eps = epsilon;
float uu = u*u;
if (uu < eps)
return true;
float vv = v*v;
if (vv < eps)
return true;
float uv = u*v;
if (uu*vv-uv*uv < eps*std::max<float>(uu,vv))
float crosssqr = uu*vv-uv*uv;
if (crosssqr < eps*std::max<float>(uu,vv))
return true;
return false;
}

View File

@ -358,7 +358,7 @@ public:
* Checks whether the triangle is degenerated. A triangle is degenerated if its area
* is less than an epsilon.
*/
bool IsDegenerated() const;
bool IsDegenerated(float epsilon) const;
/**
* Checks whether the triangle is deformed. The definition of a deformed triangles is not as strong
* as the definition of a degenerated triangle. A triangle is deformed if the maximum angle exceeds 120 deg

View File

@ -38,6 +38,7 @@
#include "Algorithm.h"
#include "Evaluation.h"
#include "Triangulation.h"
#include "Definitions.h"
#include <Base/Console.h>
using namespace MeshCore;
@ -585,10 +586,10 @@ bool MeshTopoAlgorithm::IsSwapEdgeLegal(unsigned long ulFacetPos, unsigned long
// do not allow to create degenerated triangles
MeshGeomFacet cT3(cP4, cP3, cP1);
if ( cT3.IsDegenerated() )
if ( cT3.IsDegenerated(MeshDefinitions::_fMinPointDistanceP2) )
return false;
MeshGeomFacet cT4(cP3, cP4, cP2);
if ( cT4.IsDegenerated() )
if ( cT4.IsDegenerated(MeshDefinitions::_fMinPointDistanceP2) )
return false;
// We must make sure that the two adjacent triangles builds a convex polygon, otherwise

View File

@ -75,5 +75,11 @@ Get a list of intersection points with another triangle.
</Documentation>
<Parameter Name="NeighbourIndices" Type="Tuple"/>
</Attribute>
</PythonExport>
</GenerateModel>
<Attribute Name="Area" ReadOnly="true">
<Documentation>
<UserDocu>The area of the facet</UserDocu>
</Documentation>
<Parameter Name="Area" Type="Float"/>
</Attribute>
</PythonExport>
</GenerateModel>

View File

@ -25,8 +25,8 @@
#include "Mesh.h"
#include "Facet.h"
#include "FacetPy.h"
#include "FacetPy.cpp"
#include <Mod/Mesh/App/FacetPy.h>
#include <Mod/Mesh/App/FacetPy.cpp>
#include <Base/VectorPy.h>
@ -170,6 +170,17 @@ Py::Tuple FacetPy::getNeighbourIndices(void) const
return idxTuple;
}
Py::Float FacetPy::getArea(void) const
{
FacetPy::PointerType face = this->getFacetPtr();
if (!face->isBound())
{ return Py::Float(0.0); }
const MeshCore::MeshKernel& kernel = face->Mesh->getKernel();
MeshCore::MeshGeomFacet tria = kernel.GetFacet(face->Index);
return Py::Float(tria.Area());
}
PyObject *FacetPy::getCustomAttributes(const char* attr) const
{
return 0;

View File

@ -44,6 +44,7 @@ PROPERTY_SOURCE(Mesh::FixDefects, Mesh::Feature)
FixDefects::FixDefects()
{
ADD_PROPERTY(Source ,(0));
ADD_PROPERTY(Epsilon ,(0));
}
FixDefects::~FixDefects()
@ -223,7 +224,7 @@ App::DocumentObjectExecReturn *FixDegenerations::execute(void)
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
std::auto_ptr<MeshObject> mesh(new MeshObject);
*mesh = kernel->getValue();
mesh->validateDegenerations();
mesh->validateDegenerations(static_cast<float>(Epsilon.getValue()));
this->Mesh.setValuePtr(mesh.release());
}
@ -252,7 +253,8 @@ App::DocumentObjectExecReturn *FixDeformations::execute(void)
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
std::auto_ptr<MeshObject> mesh(new MeshObject);
*mesh = kernel->getValue();
mesh->validateDeformations((float)MaxAngle.getValue());
mesh->validateDeformations(static_cast<float>(MaxAngle.getValue()),
static_cast<float>(Epsilon.getValue()));
this->Mesh.setValuePtr(mesh.release());
}

View File

@ -24,6 +24,7 @@
#ifndef MESH_FEATURE_MESH_DEFECTS_H
#define MESH_FEATURE_MESH_DEFECTS_H
#include <App/PropertyStandard.h>
#include <App/PropertyLinks.h>
#include "MeshFeature.h"
@ -46,6 +47,7 @@ public:
/** @name Properties */
//@{
App::PropertyLink Source;
App::PropertyFloat Epsilon;
//@}
/** @name methods override Feature */

View File

@ -1240,6 +1240,10 @@ void MeshObject::removeNonManifolds()
f_fix.Fixup();
deletedFacets(f_fix.GetDeletedFaces());
}
}
void MeshObject::removeNonManifoldPoints()
{
MeshCore::MeshEvalPointManifolds p_eval(_kernel);
if (!p_eval.Evaluate()) {
std::vector<unsigned long> faces;
@ -1371,19 +1375,19 @@ void MeshObject::validateIndices()
this->_segments.clear();
}
void MeshObject::validateDeformations(float fMaxAngle)
void MeshObject::validateDeformations(float fMaxAngle, float fEps)
{
unsigned long count = _kernel.CountFacets();
MeshCore::MeshFixDeformedFacets eval(_kernel, fMaxAngle);
MeshCore::MeshFixDeformedFacets eval(_kernel, fMaxAngle, fEps);
eval.Fixup();
if (_kernel.CountFacets() < count)
this->_segments.clear();
}
void MeshObject::validateDegenerations()
void MeshObject::validateDegenerations(float fEps)
{
unsigned long count = _kernel.CountFacets();
MeshCore::MeshFixDegeneratedFacets eval(_kernel);
MeshCore::MeshFixDegeneratedFacets eval(_kernel, fEps);
eval.Fixup();
if (_kernel.CountFacets() < count)
this->_segments.clear();

View File

@ -270,12 +270,13 @@ public:
void flipNormals();
void harmonizeNormals();
void validateIndices();
void validateDeformations(float fMaxAngle);
void validateDegenerations();
void validateDeformations(float fMaxAngle, float fEps);
void validateDegenerations(float fEps);
void removeDuplicatedPoints();
void removeDuplicatedFacets();
bool hasNonManifolds() const;
void removeNonManifolds();
void removeNonManifoldPoints();
bool hasSelfIntersections() const;
void removeSelfIntersections();
void removeSelfIntersections(const std::vector<unsigned long>&);

View File

@ -42,6 +42,11 @@ d.addObject(\"Mesh::Feature\").
<UserDocu>Remove non-manifolds</UserDocu>
</Documentation>
</Methode>
<Methode Name="removeNonManifoldPoints">
<Documentation>
<UserDocu>Remove non-manifold points</UserDocu>
</Documentation>
</Methode>
<Methode Name="fixIndices">
<Documentation>
<UserDocu>Repair any invalid indices</UserDocu>
@ -78,4 +83,4 @@ d.addObject(\"Mesh::Feature\").
</Documentation>
</Methode>
</PythonExport>
</GenerateModel>
</GenerateModel>

View File

@ -26,12 +26,12 @@
#include <Base/Handle.h>
#include "Core/Evaluation.h"
#include "MeshPy.h"
#include "MeshFeature.h"
// inclusion of the generated files (generated out of MeshFeaturePy.xml)
#include "MeshFeaturePy.h"
#include "MeshFeaturePy.cpp"
#include <Mod/Mesh/App/MeshPy.h>
#include <Mod/Mesh/App/MeshFeaturePy.h>
#include <Mod/Mesh/App/MeshFeaturePy.cpp>
using namespace Mesh;
@ -94,7 +94,18 @@ PyObject* MeshFeaturePy::removeNonManifolds(PyObject *args)
MeshObject* kernel = obj->Mesh.startEditing();
kernel->removeNonManifolds();
obj->Mesh.finishEditing();
Py_Return
Py_Return;
}
PyObject* MeshFeaturePy::removeNonManifoldPoints(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Mesh::Feature* obj = getFeaturePtr();
MeshObject* kernel = obj->Mesh.startEditing();
kernel->removeNonManifoldPoints();
obj->Mesh.finishEditing();
Py_Return;
}
PyObject* MeshFeaturePy::fixIndices(PyObject *args)
@ -114,13 +125,14 @@ PyObject* MeshFeaturePy::fixIndices(PyObject *args)
PyObject* MeshFeaturePy::fixDegenerations(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
float fEpsilon = MeshCore::MeshDefinitions::_fMinPointDistanceP2;
if (!PyArg_ParseTuple(args, "|f", &fEpsilon))
return NULL;
PY_TRY {
Mesh::Feature* obj = getFeaturePtr();
MeshObject* kernel = obj->Mesh.startEditing();
kernel->validateDegenerations();
kernel->validateDegenerations(fEpsilon);
obj->Mesh.finishEditing();
} PY_CATCH;

View File

@ -220,6 +220,11 @@ for c in mesh.getSeparatecomponents():
<UserDocu>Remove non-manifolds</UserDocu>
</Documentation>
</Methode>
<Methode Name="removeNonManifoldPoints">
<Documentation>
<UserDocu>Remove non-manifold points</UserDocu>
</Documentation>
</Methode>
<Methode Name="hasSelfIntersections" Const="true">
<Documentation>
<UserDocu>Check if the mesh intersects itself</UserDocu>

View File

@ -905,6 +905,14 @@ PyObject* MeshPy::removeNonManifolds(PyObject *args)
Py_Return
}
PyObject* MeshPy::removeNonManifoldPoints(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
getMeshObjectPtr()->removeNonManifoldPoints();
Py_Return
}
PyObject* MeshPy::hasSelfIntersections(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
@ -1073,11 +1081,12 @@ PyObject* MeshPy::fixIndices(PyObject *args)
PyObject* MeshPy::fixDeformations(PyObject *args)
{
float fMaxAngle;
if (!PyArg_ParseTuple(args, "f", &fMaxAngle))
float fEpsilon = MeshCore::MeshDefinitions::_fMinPointDistanceP2;
if (!PyArg_ParseTuple(args, "f|f", &fMaxAngle, &fEpsilon))
return NULL;
PY_TRY {
getMeshObjectPtr()->validateDeformations(fMaxAngle);
getMeshObjectPtr()->validateDeformations(fMaxAngle, fEpsilon);
} PY_CATCH;
Py_Return;
@ -1085,11 +1094,12 @@ PyObject* MeshPy::fixDeformations(PyObject *args)
PyObject* MeshPy::fixDegenerations(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
float fEpsilon = MeshCore::MeshDefinitions::_fMinPointDistanceP2;
if (!PyArg_ParseTuple(args, "|f", &fEpsilon))
return NULL;
PY_TRY {
getMeshObjectPtr()->validateDegenerations();
getMeshObjectPtr()->validateDegenerations(fEpsilon);
} PY_CATCH;
Py_Return;

View File

@ -17,6 +17,7 @@ set(MeshGui_LIBS
set(Mesh_MOC_HDRS
DlgEvaluateMeshImp.h
DlgEvaluateSettings.h
DlgRegularSolidImp.h
DlgSettingsMeshView.h
DlgSettingsImportExportImp.h
@ -32,6 +33,7 @@ SOURCE_GROUP("Moc" FILES ${Mesh_MOC_SRCS})
set(Dialogs_UIC_SRCS
DlgEvaluateMesh.ui
DlgEvaluateSettings.ui
DlgRegularSolid.ui
DlgSettingsMeshView.ui
DlgSettingsImportExport.ui
@ -46,6 +48,9 @@ SET(Dialogs_SRCS
DlgEvaluateMesh.ui
DlgEvaluateMeshImp.cpp
DlgEvaluateMeshImp.h
DlgEvaluateSettings.ui
DlgEvaluateSettings.cpp
DlgEvaluateSettings.h
DlgRegularSolid.ui
DlgRegularSolidImp.cpp
DlgRegularSolidImp.h

View File

@ -885,7 +885,7 @@
<item row="20" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close|QDialogButtonBox::Help</set>
<set>QDialogButtonBox::Close|QDialogButtonBox::Open|QDialogButtonBox::Reset</set>
</property>
</widget>
</item>

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,8 @@
#include <App/Application.h>
#include <App/Document.h>
#include <App/DocumentObserver.h>
#include "ui_DlgEvaluateMesh.h"
class QAbstractButton;
namespace Gui {
class View3DInventor;
@ -61,15 +62,15 @@ public Q_SLOTS:
/**
* \author Werner Mayer
*/
class DlgEvaluateMeshImp : public QDialog, public Ui_DlgEvaluateMesh, public App::DocumentObserver
class DlgEvaluateMeshImp : public QDialog, public App::DocumentObserver
{
Q_OBJECT
public:
DlgEvaluateMeshImp( QWidget* parent = 0, Qt::WindowFlags fl = 0 );
DlgEvaluateMeshImp(QWidget* parent = 0, Qt::WindowFlags fl = 0);
~DlgEvaluateMeshImp();
void setMesh( Mesh::Feature* );
void setMesh(Mesh::Feature*);
private:
/** Checks if the given document is about to be closed */
@ -119,6 +120,7 @@ protected Q_SLOTS:
void on_refreshButton_clicked();
void on_meshNameButton_activated(int);
void on_buttonBox_clicked(QAbstractButton *);
protected:
void refreshList();
@ -127,7 +129,7 @@ protected:
void addViewProvider(const char* vp, const std::vector<unsigned long>& indices);
void removeViewProvider(const char* vp);
void removeViewProviders();
void changeEvent(QEvent *e);
void changeEvent(QEvent *e);
private:
class Private;

View File

@ -0,0 +1,77 @@
/***************************************************************************
* Copyright (c) 2016 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#endif
#include "DlgEvaluateSettings.h"
#include "ui_DlgEvaluateSettings.h"
using namespace MeshGui;
/* TRANSLATOR MeshGui::DlgEvaluateSettings */
DlgEvaluateSettings::DlgEvaluateSettings(QWidget* parent, Qt::WindowFlags fl)
: QDialog(parent, fl), ui(new Ui_DlgEvaluateSettings)
{
ui->setupUi(this);
}
DlgEvaluateSettings::~DlgEvaluateSettings()
{
delete ui;
}
void DlgEvaluateSettings::setNonmanifoldPointsChecked(bool on)
{
ui->checkNonmanifoldPoints->setChecked(on);
}
bool DlgEvaluateSettings::isNonmanifoldPointsChecked() const
{
return ui->checkNonmanifoldPoints->isChecked();
}
void DlgEvaluateSettings::setFoldsChecked(bool on)
{
ui->checkFolds->setChecked(on);
}
bool DlgEvaluateSettings::isFoldsChecked() const
{
return ui->checkFolds->isChecked();
}
void DlgEvaluateSettings::setDegenratedFacetsChecked(bool on)
{
ui->checkDegenrated->setChecked(on);
}
bool DlgEvaluateSettings::isDegenratedFacetsChecked() const
{
return ui->checkDegenrated->isChecked();
}
#include "moc_DlgEvaluateSettings.cpp"

View File

@ -0,0 +1,59 @@
/***************************************************************************
* Copyright (c) 2016 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef MESHGUI_DLG_EVALUATE_SETTINGS_H
#define MESHGUI_DLG_EVALUATE_SETTINGS_H
#include <QDialog>
namespace MeshGui {
class Ui_DlgEvaluateSettings;
/**
* \author Werner Mayer
*/
class DlgEvaluateSettings : public QDialog
{
Q_OBJECT
public:
DlgEvaluateSettings(QWidget* parent = 0, Qt::WindowFlags fl = 0);
~DlgEvaluateSettings();
void setNonmanifoldPointsChecked(bool);
bool isNonmanifoldPointsChecked() const;
void setFoldsChecked(bool);
bool isFoldsChecked() const;
void setDegenratedFacetsChecked(bool);
bool isDegenratedFacetsChecked() const;
private:
Ui_DlgEvaluateSettings* ui;
};
} // namespace MeshGui
#endif // MESHGUI_DLG_EVALUATE_SETTINGS_H

View File

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MeshGui::DlgEvaluateSettings</class>
<widget class="QDialog" name="MeshGui::DlgEvaluateSettings">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>344</width>
<height>149</height>
</rect>
</property>
<property name="windowTitle">
<string>Evaluation settings</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="checkNonmanifoldPoints">
<property name="text">
<string>Check for non-manifold points</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkFolds">
<property name="text">
<string>Enable check for folds on surface</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkDegenrated">
<property name="text">
<string>Consider a face only degenerated if it has no area</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>MeshGui::DlgEvaluateSettings</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>MeshGui::DlgEvaluateSettings</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>