smesh/src/SMESHGUI/SMESHGUI_ComputeDlg.h

323 lines
8.7 KiB
C
Raw Normal View History

2013-04-01 19:05:47 +06:00
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
2009-02-17 10:27:49 +05:00
//
2012-08-09 16:03:55 +06:00
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
2012-08-09 16:03:55 +06:00
// 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
// Lesser General Public License for more details.
//
2012-08-09 16:03:55 +06:00
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
2012-08-09 16:03:55 +06:00
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
2012-08-09 16:03:55 +06:00
2009-02-17 10:27:49 +05:00
// File : SMESHGUI_ComputeDlg.h
// Author : Edward AGAPOV, Open CASCADE S.A.S.
//
2009-02-17 10:27:49 +05:00
#ifndef SMESHGUI_COMPUTEDLG_H
#define SMESHGUI_COMPUTEDLG_H
2009-02-17 10:27:49 +05:00
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
#include "SMESHGUI_Dialog.h"
2009-02-17 10:27:49 +05:00
#include "SMESHGUI_Operation.h"
2009-02-17 10:27:49 +05:00
// SALOME GUI includes
#include <SALOME_InteractiveObject.hxx>
2009-02-17 10:27:49 +05:00
// Qt includes
#include <QMap>
2012-08-09 16:03:55 +06:00
#include <QList>
2009-02-17 10:27:49 +05:00
#include <QPointer>
#include <QGroupBox>
2012-08-09 16:03:55 +06:00
#include <QThread>
2009-02-17 10:27:49 +05:00
// IDL includes
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Gen)
#include CORBA_SERVER_HEADER(SMESH_Mesh)
class QFrame;
class QPushButton;
2009-02-17 10:27:49 +05:00
class QTableWidget;
class QLabel;
2009-02-17 10:27:49 +05:00
class QtxComboBox;
class SMESHGUI_ComputeDlg;
2012-08-09 16:03:55 +06:00
class SMESHGUI_MeshInfosBox;
2009-02-17 10:27:49 +05:00
class SMESHGUI_PrecomputeDlg;
class SMESHGUI_MeshEditPreview;
2009-02-17 10:27:49 +05:00
namespace SMESH
{
class TShapeDisplayer;
}
2009-02-17 10:27:49 +05:00
/*!
* \brief Base operation to compute a mesh and show computation errors
*/
class SMESHGUI_EXPORT SMESHGUI_BaseComputeOp: public SMESHGUI_Operation
{
Q_OBJECT
public:
SMESHGUI_BaseComputeOp();
virtual ~SMESHGUI_BaseComputeOp();
2012-08-09 16:03:55 +06:00
SMESH::SMESH_Mesh_ptr getMesh();
2009-02-17 10:27:49 +05:00
protected:
virtual void startOperation();
virtual void stopOperation();
SMESHGUI_ComputeDlg* computeDlg() const;
void computeMesh();
void showComputeResult( const bool,
2012-08-09 16:03:55 +06:00
const bool,
SMESH::compute_error_array_var&,
const bool,
const QString& );
SMESHGUI_ComputeDlg* evaluateDlg() const;
void evaluateMesh();
void showEvaluateResult(const SMESH::long_array& theRes,
const bool,
const bool,
SMESH::compute_error_array_var&,
const bool,
const QString&);
virtual bool isValid( SUIT_Operation* theOp ) const;
2009-02-17 10:27:49 +05:00
protected slots:
2012-08-09 16:03:55 +06:00
virtual bool onApply();
2009-02-17 10:27:49 +05:00
void onPreviewShape();
void onPublishShape();
void onShowBadMesh();
void onGroupOfBadMesh();
2009-02-17 10:27:49 +05:00
void currentCellChanged();
private:
QTableWidget* table();
private:
QPointer<SMESHGUI_ComputeDlg> myCompDlg;
protected:
SMESH::SMESH_Mesh_var myMesh;
GEOM::GEOM_Object_var myMainShape;
SMESH::TShapeDisplayer* myTShapeDisplayer;
SMESHGUI_MeshEditPreview* myBadMeshDisplayer;
Handle(SALOME_InteractiveObject) myIObject;
};
/*!
* \brief Operation to compute a mesh and show computation errors
*/
2009-02-17 10:27:49 +05:00
class SMESHGUI_EXPORT SMESHGUI_ComputeOp: public SMESHGUI_BaseComputeOp
{
Q_OBJECT
public:
SMESHGUI_ComputeOp();
virtual ~SMESHGUI_ComputeOp();
virtual LightApp_Dialog* dlg() const;
protected:
virtual void startOperation();
protected slots:
2009-02-17 10:27:49 +05:00
};
2012-08-09 16:03:55 +06:00
class SMESHGUI_MeshOrderMgr;
2009-02-17 10:27:49 +05:00
/*!
* \brief Operation to preview and compute a mesh and show computation errors
*/
class SMESHGUI_EXPORT SMESHGUI_PrecomputeOp: public SMESHGUI_BaseComputeOp
{
Q_OBJECT
2009-02-17 10:27:49 +05:00
public:
SMESHGUI_PrecomputeOp();
virtual ~SMESHGUI_PrecomputeOp();
2009-02-17 10:27:49 +05:00
virtual LightApp_Dialog* dlg() const;
2012-08-09 16:03:55 +06:00
/**
* \brief returns map of assigned algorithms modes
*/
static void getAssignedAlgos(_PTR(SObject) theMesh,
QMap<int,int>& theModeMap);
2009-02-17 10:27:49 +05:00
protected:
virtual void startOperation();
virtual void stopOperation();
virtual void resumeOperation();
virtual void initDialog();
protected slots:
virtual void onCancel();
2009-02-17 10:27:49 +05:00
private slots:
void onPreview();
2012-08-09 16:03:55 +06:00
void onCompute();
2009-02-17 10:27:49 +05:00
private:
2012-08-09 16:03:55 +06:00
//! private fields
2009-02-17 10:27:49 +05:00
QMap< int, int > myMapShapeId;
QPointer<LightApp_Dialog> myActiveDlg;
QPointer<SMESHGUI_PrecomputeDlg> myDlg;
SMESHGUI_MeshEditPreview* myPreviewDisplayer;
2012-08-09 16:03:55 +06:00
//! fields for mesh order
typedef QList<int> TListOfInt;
typedef QList<TListOfInt> TListOfListOfInt;
TListOfListOfInt myPrevOrder;
SMESHGUI_MeshOrderMgr* myOrderMgr;
};
/*!
2012-08-09 16:03:55 +06:00
* \brief Operation to evaluate a mesh and show result
*/
2012-08-09 16:03:55 +06:00
class SMESHGUI_EXPORT SMESHGUI_EvaluateOp: public SMESHGUI_BaseComputeOp
{
Q_OBJECT
2009-02-17 10:27:49 +05:00
public:
2012-08-09 16:03:55 +06:00
SMESHGUI_EvaluateOp();
virtual ~SMESHGUI_EvaluateOp();
2012-08-09 16:03:55 +06:00
virtual LightApp_Dialog* dlg() const;
2012-08-09 16:03:55 +06:00
protected:
virtual void startOperation();
protected slots:
};
/*!
* \brief Dialog to compute a mesh and show computation errors
*/
2009-02-17 10:27:49 +05:00
class SMESHGUI_EXPORT SMESHGUI_ComputeDlg : public SMESHGUI_Dialog
{
Q_OBJECT
public:
2012-08-09 16:03:55 +06:00
SMESHGUI_ComputeDlg( QWidget*, bool );
2009-02-17 10:27:49 +05:00
virtual ~SMESHGUI_ComputeDlg();
2009-02-17 10:27:49 +05:00
protected:
2012-08-09 16:03:55 +06:00
QFrame* createMainFrame( QWidget*, bool );
QLabel* myMeshName;
QGroupBox* myMemoryLackGroup;
QGroupBox* myCompErrorGroup;
QGroupBox* myHypErrorGroup;
QLabel* myHypErrorLabel;
2012-08-09 16:03:55 +06:00
QLabel* myWarningLabel;
2009-02-17 10:27:49 +05:00
QTableWidget* myTable;
QPushButton* myShowBtn;
QPushButton* myPublishBtn;
2009-02-17 10:27:49 +05:00
QPushButton* myBadMeshBtn;
QPushButton* myBadMeshToGroupBtn;
SMESHGUI_MeshInfosBox* myBriefInfo;
SMESHGUI_MeshInfosBox* myFullInfo;
2009-02-17 10:27:49 +05:00
friend class SMESHGUI_BaseComputeOp;
friend class SMESHGUI_PrecomputeOp;
};
2012-08-09 16:03:55 +06:00
class SMESHGUI_MeshOrderBox;
2009-02-17 10:27:49 +05:00
/*!
* \brief Dialog to preview and compute a mesh and show computation errors
*/
2009-02-17 10:27:49 +05:00
class SMESHGUI_EXPORT SMESHGUI_PrecomputeDlg : public SMESHGUI_Dialog
{
Q_OBJECT
public:
SMESHGUI_PrecomputeDlg( QWidget* );
virtual ~SMESHGUI_PrecomputeDlg();
void setPreviewModes( const QList<int>& );
int getPreviewMode() const;
2012-08-09 16:03:55 +06:00
SMESHGUI_MeshOrderBox* getMeshOrderBox() const;
2009-02-17 10:27:49 +05:00
signals:
void preview();
private:
2012-08-09 16:03:55 +06:00
SMESHGUI_MeshOrderBox* myOrderBox;
2009-02-17 10:27:49 +05:00
QPushButton* myPreviewBtn;
QtxComboBox* myPreviewMode;
};
2012-08-09 16:03:55 +06:00
/*!
* \brief Thread to launch computation
*/
class SMESHGUI_EXPORT SMESHGUI_ComputeDlg_QThread : public QThread
{
Q_OBJECT
public:
2013-02-12 20:37:44 +06:00
SMESHGUI_ComputeDlg_QThread(SMESH::SMESH_Gen_var gen,
2012-08-09 16:03:55 +06:00
SMESH::SMESH_Mesh_var mesh,
GEOM::GEOM_Object_var mainShape);
2013-02-12 20:37:44 +06:00
bool result();
void cancel();
SMESH::SMESH_Mesh_var& getMesh() { return myMesh; }
2012-08-09 16:03:55 +06:00
protected:
void run();
private:
2013-02-12 20:37:44 +06:00
SMESH::SMESH_Gen_var myGen;
2012-08-09 16:03:55 +06:00
SMESH::SMESH_Mesh_var myMesh;
GEOM::GEOM_Object_var myMainShape;
2013-02-12 20:37:44 +06:00
bool myResult;
2012-08-09 16:03:55 +06:00
};
/*!
* \brief Dialog to display Cancel button
*/
class SMESHGUI_EXPORT SMESHGUI_ComputeDlg_QThreadQDialog : public QDialog
{
Q_OBJECT
public:
2013-02-12 20:37:44 +06:00
SMESHGUI_ComputeDlg_QThreadQDialog(QWidget * parent,
SMESH::SMESH_Gen_var gen,
2012-08-09 16:03:55 +06:00
SMESH::SMESH_Mesh_var mesh,
GEOM::GEOM_Object_var mainShape);
bool result();
protected:
void timerEvent(QTimerEvent *timer);
void closeEvent(QCloseEvent *event);
private slots:
void onCancel();
private:
SMESHGUI_ComputeDlg_QThread qthread;
2013-02-12 20:37:44 +06:00
QPushButton * cancelButton;
QLabel * nbNodesLabel;
QLabel * nbElemsLabel;
2012-08-09 16:03:55 +06:00
};
2009-02-17 10:27:49 +05:00
#endif // SMESHGUI_COMPUTEDLG_H