doing merge

This commit is contained in:
wmayer 2012-04-26 15:10:48 +02:00
parent d8f150e384
commit 2549b555bc
7 changed files with 118 additions and 2 deletions

View File

@ -642,8 +642,13 @@ void Document::RestoreDocFile(Base::Reader &reader)
std::string sMsg = "SetCamera ";
sMsg += ppReturn;
if (strcmp(ppReturn, "") != 0) { // non-empty attribute
if (d->_pcAppWnd->sendHasMsgToActiveView("SetCamera"))
d->_pcAppWnd->sendMsgToActiveView(sMsg.c_str());
try {
if (d->_pcAppWnd->sendHasMsgToActiveView("SetCamera"))
d->_pcAppWnd->sendMsgToActiveView(sMsg.c_str());
}
catch (const Base::Exception& e) {
Base::Console().Error("%s\n", e.what());
}
}
}

View File

@ -27,11 +27,13 @@
# include <QDesktopWidget>
# include <QDialogButtonBox>
# include <QDrag>
# include <QEventLoop>
# include <QKeyEvent>
# include <QMimeData>
# include <QPainter>
# include <QPlainTextEdit>
# include <QStylePainter>
# include <QTimer>
# include <QToolTip>
#endif
@ -641,6 +643,17 @@ void StatusWidget::setStatusText(const QString& s)
label->setText(s);
}
void StatusWidget::showText(int ms)
{
show();
QTimer timer;
QEventLoop loop;
QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
timer.start(ms);
loop.exec(QEventLoop::ExcludeUserInputEvents);
hide();
}
QSize StatusWidget::sizeHint () const
{
return QSize(250,100);

View File

@ -275,6 +275,7 @@ public:
~StatusWidget();
void setStatusText(const QString&);
QSize sizeHint () const;
void showText(int ms);
protected:
void showEvent(QShowEvent*);

View File

@ -38,6 +38,7 @@
#include "Grid.h"
#include "TopoAlgorithm.h"
#include <boost/math/special_functions/fpclassify.hpp>
#include <Base/Sequencer.h>
using namespace MeshCore;
@ -228,6 +229,47 @@ bool MeshFixDuplicatePoints::Fixup()
// ----------------------------------------------------------------------
bool MeshEvalNaNPoints::Evaluate()
{
const MeshPointArray& rPoints = _rclMesh.GetPoints();
for (MeshPointArray::_TConstIterator it = rPoints.begin(); it != rPoints.end(); ++it) {
if (boost::math::isnan(it->x) || boost::math::isnan(it->y) || boost::math::isnan(it->z))
return false;
}
return true;
}
std::vector<unsigned long> MeshEvalNaNPoints::GetIndices() const
{
std::vector<unsigned long> aInds;
const MeshPointArray& rPoints = _rclMesh.GetPoints();
for (MeshPointArray::_TConstIterator it = rPoints.begin(); it != rPoints.end(); ++it) {
if (boost::math::isnan(it->x) || boost::math::isnan(it->y) || boost::math::isnan(it->z))
aInds.push_back(it - rPoints.begin());
}
return aInds;
}
bool MeshFixNaNPoints::Fixup()
{
std::vector<unsigned long> aInds;
const MeshPointArray& rPoints = _rclMesh.GetPoints();
for (MeshPointArray::_TConstIterator it = rPoints.begin(); it != rPoints.end(); ++it) {
if (boost::math::isnan(it->x) || boost::math::isnan(it->y) || boost::math::isnan(it->z))
aInds.push_back(it - rPoints.begin());
}
// remove invalid indices
_rclMesh.DeletePoints(aInds);
_rclMesh.RebuildNeighbours();
return true;
}
// ----------------------------------------------------------------------
namespace MeshCore {
typedef MeshFacetArray::_TConstIterator FaceIterator;

View File

@ -138,6 +138,54 @@ public:
bool Fixup ();
};
/**
* The MeshEvalNaNPoints class searches for points with a coordinate that is NaN.
* @see MeshFixNaNPoints
* @author Werner Mayer
*/
class MeshExport MeshEvalNaNPoints : public MeshEvaluation
{
public:
/**
* Construction.
*/
MeshEvalNaNPoints (const MeshKernel &rclM) : MeshEvaluation( rclM ) { }
/**
* Destruction.
*/
~MeshEvalNaNPoints () { }
/**
* Returns false if a point with NaN coordinate is found.
*/
bool Evaluate ();
/**
* Returns the indices of all NaN points.
*/
std::vector<unsigned long> GetIndices() const;
};
/**
* The MeshFixNaNPoints class removes all points with a coordinate that is NaN.
* @see MeshEvalNaNPoints
* @author Werner Mayer
*/
class MeshExport MeshFixNaNPoints : public MeshValidation
{
public:
/**
* Construction.
*/
MeshFixNaNPoints (MeshKernel &rclM) : MeshValidation( rclM ) { }
/**
* Destruction.
*/
~MeshFixNaNPoints () { }
/**
* Merges duplicated points.
*/
bool Fixup ();
};
/**
* The MeshEvalDuplicateFacets class searches for duplicated facets.
* A facet is regarded as duplicated if all its point indices refer to the same location in the point array of the mesh kernel.

View File

@ -1123,6 +1123,12 @@ void MeshObject::removeFullBoundaryFacets()
}
}
void MeshObject::removeInvalidPoints()
{
MeshCore::MeshEvalNaNPoints nan(_kernel);
deletePoints(nan.GetIndices());
}
void MeshObject::validateIndices()
{
unsigned long count = _kernel.CountFacets();

View File

@ -256,6 +256,7 @@ public:
void removeSelfIntersections(const std::vector<unsigned long>&);
void removeFoldsOnSurface();
void removeFullBoundaryFacets();
void removeInvalidPoints();
//@}
/** @name Mesh segments */