Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef SMESHGUI_CLIPPINGDLG_H
00028 #define SMESHGUI_CLIPPINGDLG_H
00029
00030
00031 #include "SMESH_SMESHGUI.hxx"
00032
00033
00034 #include <SVTK_ViewWindow.h>
00035
00036
00037 #include <QDialog>
00038 #include <QPointer>
00039
00040
00041 #include <vtkPlane.h>
00042 #include <vtkSmartPointer.h>
00043
00044
00045 #include <list>
00046 #include <map>
00047 #include <vector>
00048
00049 class QLabel;
00050 class QPushButton;
00051 class QCheckBox;
00052 class QComboBox;
00053 class QListWidget;
00054 class QListWidgetItem;
00055 class SALOME_Actor;
00056 class SMESHGUI;
00057 class SMESH_Actor;
00058 class SMESHGUI_SpinBox;
00059 class vtkActor;
00060 class vtkDataSetMapper;
00061 class vtkPlaneSource;
00062
00063 namespace SMESH
00064 {
00065 enum Orientation { XY, YZ, ZX };
00066
00067 class OrientedPlane: public vtkPlane
00068 {
00069 QPointer<SVTK_ViewWindow> myViewWindow;
00070 vtkDataSetMapper* myMapper;
00071
00072 public:
00073 static OrientedPlane *New();
00074 static OrientedPlane *New(SVTK_ViewWindow* theViewWindow);
00075 vtkTypeMacro (OrientedPlane, vtkPlane);
00076
00077 SMESH::Orientation myOrientation;
00078 float myDistance;
00079 double myAngle[2];
00080
00081 vtkPlaneSource* myPlaneSource;
00082 SALOME_Actor *myActor;
00083
00084 void SetOrientation (SMESH::Orientation theOrientation) { myOrientation = theOrientation; }
00085 SMESH::Orientation GetOrientation() { return myOrientation; }
00086
00087 void SetDistance (float theDistance) { myDistance = theDistance; }
00088 float GetDistance() { return myDistance; }
00089
00090 void ShallowCopy (OrientedPlane* theOrientedPlane);
00091
00092 protected:
00093 OrientedPlane(SVTK_ViewWindow* theViewWindow);
00094 OrientedPlane();
00095
00096 void Init();
00097
00098 ~OrientedPlane();
00099 private:
00100
00101 OrientedPlane (const OrientedPlane&);
00102 void operator= (const OrientedPlane&);
00103 };
00104
00105 typedef vtkSmartPointer<OrientedPlane> TPlane;
00106 typedef std::list<vtkActor*> TActorList;
00107
00108 struct TPlaneData
00109 {
00110 TPlaneData( TPlane thePlane,
00111 TActorList theActorList )
00112 {
00113 Plane = thePlane;
00114 ActorList = theActorList;
00115 }
00116 TPlane Plane;
00117 TActorList ActorList;
00118 };
00119
00120 typedef std::vector<TPlane> TPlaneVector;
00121 typedef std::vector<TPlaneData> TPlaneDataVector;
00122 };
00123
00124
00125
00126
00127
00128 class SMESHGUI_EXPORT SMESHGUI_ClippingDlg : public QDialog
00129 {
00130 Q_OBJECT
00131
00132 public:
00133 SMESHGUI_ClippingDlg( SMESHGUI*, SVTK_ViewWindow* );
00134 ~SMESHGUI_ClippingDlg();
00135
00136 double getDistance() const;
00137 void setDistance( const double );
00138 double getRotation1() const;
00139 double getRotation2() const;
00140 void setRotation( const double, const double );
00141
00142
00143
00144 static SMESH::OrientedPlane* AddPlane (SMESH::TActorList theActorList,
00145 SVTK_ViewWindow* theViewWindow,
00146 SMESH::Orientation theOrientation,
00147 double theDistance,
00148 const vtkFloatingPointType theAngle[2]);
00149
00150 protected:
00151 void keyPressEvent( QKeyEvent* );
00152
00153 private:
00154 void initializePlaneData();
00155
00156 void synchronize();
00157
00158 void updateActorList();
00159 SMESH::TActorList getCurrentActors();
00160
00161 void updateActorItem( QListWidgetItem* theItem,
00162 bool theUpdateSelectAll,
00163 bool theUpdateClippingPlaneMap );
00164
00165 void dumpPlaneData() const;
00166
00167 private:
00168 SMESHGUI* mySMESHGUI;
00169 SVTK_ViewWindow* myViewWindow;
00170 SMESH::TPlaneDataVector myPlanes;
00171
00172 QComboBox* ComboBoxPlanes;
00173 QPushButton* buttonNew;
00174 QPushButton* buttonDelete;
00175 QListWidget* ActorList;
00176 QCheckBox* SelectAllCheckBox;
00177 QLabel* TextLabelOrientation;
00178 QComboBox* ComboBoxOrientation;
00179 QLabel* TextLabelDistance;
00180 SMESHGUI_SpinBox* SpinBoxDistance;
00181 QLabel* TextLabelRot1;
00182 SMESHGUI_SpinBox* SpinBoxRot1;
00183 QLabel* TextLabelRot2;
00184 SMESHGUI_SpinBox* SpinBoxRot2;
00185 QCheckBox* PreviewCheckBox;
00186 QCheckBox* AutoApplyCheckBox;
00187 QPushButton* buttonOk;
00188 QPushButton* buttonCancel;
00189 QPushButton* buttonApply;
00190 QPushButton* buttonHelp;
00191
00192 bool myIsSelectPlane;
00193 QString myHelpFileName;
00194
00195 public slots:
00196 void onSelectPlane( int );
00197 void ClickOnNew();
00198 void ClickOnDelete();
00199 void onActorItemChanged( QListWidgetItem* );
00200 void onSelectAll( int );
00201 void onSelectOrientation( int );
00202 void SetCurrentPlaneParam();
00203 void OnPreviewToggle( bool );
00204 void ClickOnOk();
00205 void ClickOnCancel();
00206 void ClickOnApply();
00207 void ClickOnHelp();
00208 };
00209
00210 #endif // SMESHGUI_CLIPPINGDLG_H