smesh/src/SMESHGUI/SMESHGUI_ClippingDlg.h

214 lines
6.4 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
2004-12-01 15:48:31 +05:00
//
2012-08-09 16:03:55 +06:00
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
2004-12-01 15:48:31 +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.
2004-12-01 15:48:31 +05:00
//
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.
2004-12-01 15:48:31 +05:00
//
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
2009-02-17 10:27:49 +05:00
//
2012-08-09 16:03:55 +06:00
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
2009-02-17 10:27:49 +05:00
//
2012-08-09 16:03:55 +06:00
2009-02-17 10:27:49 +05:00
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_ClippingDlg.h
// Author : Nicolas REJNERI, Open CASCADE S.A.S.
//
#ifndef SMESHGUI_CLIPPINGDLG_H
#define SMESHGUI_CLIPPINGDLG_H
2004-12-01 15:48:31 +05:00
2009-02-17 10:27:49 +05:00
// SMESH includes
#include "SMESH_SMESHGUI.hxx"
2009-02-17 10:27:49 +05:00
// SALOME includes
#include <SVTK_ViewWindow.h>
// Qt includes
#include <QDialog>
2012-08-09 16:03:55 +06:00
#include <QPointer>
2004-12-01 15:48:31 +05:00
2009-02-17 10:27:49 +05:00
// VTK includes
2012-08-09 16:03:55 +06:00
#include <vtkPlane.h>
2004-12-01 15:48:31 +05:00
#include <vtkSmartPointer.h>
2009-02-17 10:27:49 +05:00
// STL includes
2012-08-09 16:03:55 +06:00
#include <list>
#include <map>
2004-12-01 15:48:31 +05:00
#include <vector>
class QLabel;
class QPushButton;
class QCheckBox;
class QComboBox;
2012-08-09 16:03:55 +06:00
class QListWidget;
class QListWidgetItem;
class SALOME_Actor;
class SMESHGUI;
2004-12-01 15:48:31 +05:00
class SMESH_Actor;
2009-02-17 10:27:49 +05:00
class SMESHGUI_SpinBox;
2012-08-09 16:03:55 +06:00
class vtkActor;
class vtkDataSetMapper;
class vtkPlaneSource;
2004-12-01 15:48:31 +05:00
2009-02-17 10:27:49 +05:00
namespace SMESH
{
enum Orientation { XY, YZ, ZX };
2004-12-01 15:48:31 +05:00
2012-08-09 16:03:55 +06:00
class OrientedPlane: public vtkPlane
{
QPointer<SVTK_ViewWindow> myViewWindow;
vtkDataSetMapper* myMapper;
public:
static OrientedPlane *New();
static OrientedPlane *New(SVTK_ViewWindow* theViewWindow);
vtkTypeMacro (OrientedPlane, vtkPlane);
SMESH::Orientation myOrientation;
float myDistance;
double myAngle[2];
vtkPlaneSource* myPlaneSource;
SALOME_Actor *myActor;
void SetOrientation (SMESH::Orientation theOrientation) { myOrientation = theOrientation; }
SMESH::Orientation GetOrientation() { return myOrientation; }
void SetDistance (float theDistance) { myDistance = theDistance; }
float GetDistance() { return myDistance; }
void ShallowCopy (OrientedPlane* theOrientedPlane);
protected:
OrientedPlane(SVTK_ViewWindow* theViewWindow);
OrientedPlane();
void Init();
~OrientedPlane();
private:
// Not implemented.
OrientedPlane (const OrientedPlane&);
void operator= (const OrientedPlane&);
};
typedef vtkSmartPointer<OrientedPlane> TPlane;
typedef std::list<vtkActor*> TActorList;
struct TPlaneData
{
TPlaneData( TPlane thePlane,
TActorList theActorList )
{
Plane = thePlane;
ActorList = theActorList;
}
TPlane Plane;
TActorList ActorList;
};
typedef std::vector<TPlane> TPlaneVector;
typedef std::vector<TPlaneData> TPlaneDataVector;
};
2004-12-01 15:48:31 +05:00
//=================================================================================
// class : SMESHGUI_ClippingDlg
// purpose :
//=================================================================================
class SMESHGUI_EXPORT SMESHGUI_ClippingDlg : public QDialog
{
2009-02-17 10:27:49 +05:00
Q_OBJECT
2004-12-01 15:48:31 +05:00
public:
2012-08-09 16:03:55 +06:00
SMESHGUI_ClippingDlg( SMESHGUI*, SVTK_ViewWindow* );
2009-02-17 10:27:49 +05:00
~SMESHGUI_ClippingDlg();
double getDistance() const;
void setDistance( const double );
double getRotation1() const;
double getRotation2() const;
void setRotation( const double, const double );
// used in SMESHGUI::restoreVisualParameters() to avoid
// declaration of OrientedPlane outside of SMESHGUI_ClippingDlg.cxx
2012-08-09 16:03:55 +06:00
static SMESH::OrientedPlane* AddPlane (SMESH::TActorList theActorList,
SVTK_ViewWindow* theViewWindow,
SMESH::Orientation theOrientation,
double theDistance,
2013-03-01 19:13:25 +06:00
const double theAngle[2]);
2009-02-17 10:27:49 +05:00
protected:
void keyPressEvent( QKeyEvent* );
2004-12-01 15:48:31 +05:00
private:
2012-08-09 16:03:55 +06:00
void initializePlaneData();
void synchronize();
void updateActorList();
SMESH::TActorList getCurrentActors();
void updateActorItem( QListWidgetItem* theItem,
bool theUpdateSelectAll,
bool theUpdateClippingPlaneMap );
void dumpPlaneData() const;
private:
2009-02-17 10:27:49 +05:00
SMESHGUI* mySMESHGUI;
2012-08-09 16:03:55 +06:00
SVTK_ViewWindow* myViewWindow;
SMESH::TPlaneDataVector myPlanes;
2009-02-17 10:27:49 +05:00
QComboBox* ComboBoxPlanes;
QPushButton* buttonNew;
QPushButton* buttonDelete;
2012-08-09 16:03:55 +06:00
QListWidget* ActorList;
QCheckBox* SelectAllCheckBox;
2009-02-17 10:27:49 +05:00
QLabel* TextLabelOrientation;
QComboBox* ComboBoxOrientation;
QLabel* TextLabelDistance;
SMESHGUI_SpinBox* SpinBoxDistance;
QLabel* TextLabelRot1;
SMESHGUI_SpinBox* SpinBoxRot1;
QLabel* TextLabelRot2;
SMESHGUI_SpinBox* SpinBoxRot2;
QCheckBox* PreviewCheckBox;
QCheckBox* AutoApplyCheckBox;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QPushButton* buttonApply;
QPushButton* buttonHelp;
bool myIsSelectPlane;
QString myHelpFileName;
2013-02-28 21:07:35 +06:00
protected slots:
virtual void reject();
2004-12-01 15:48:31 +05:00
public slots:
2009-02-17 10:27:49 +05:00
void onSelectPlane( int );
void ClickOnNew();
void ClickOnDelete();
2012-08-09 16:03:55 +06:00
void onActorItemChanged( QListWidgetItem* );
void onSelectAll( int );
2009-02-17 10:27:49 +05:00
void onSelectOrientation( int );
void SetCurrentPlaneParam();
void OnPreviewToggle( bool );
2012-10-08 17:56:59 +06:00
void onAutoApply(bool);
2009-02-17 10:27:49 +05:00
void ClickOnOk();
void ClickOnApply();
void ClickOnHelp();
2004-12-01 15:48:31 +05:00
};
2009-02-17 10:27:49 +05:00
#endif // SMESHGUI_CLIPPINGDLG_H