Version: 6.3.1

src/VISUGUI/VisuGUI_ClippingDlg.h

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #ifndef DIALOGBOX_CLIPPING_H
00024 #define DIALOGBOX_CLIPPING_H
00025 
00026 #include "SALOME_InteractiveObject.hxx"
00027 
00028 #include "SalomeApp_DoubleSpinBox.h"
00029 
00030 // QT Includes
00031 #include <QDialog>
00032 #include <QPointer>
00033 
00034 // VTK Includes
00035 #include <vtkSmartPointer.h>
00036 #include <vtkPlane.h>
00037 
00038 // STL Includes
00039 #include <vector>
00040 
00041 class QLabel;
00042 class QPushButton;
00043 class QCheckBox;
00044 class QGroupBox;
00045 class QComboBox;
00046 class QButtonGroup;
00047 class QTabWidget;
00048 class QListWidget;
00049 
00050 class SALOME_Actor;
00051 
00052 class SVTK_ViewWindow;
00053 
00054 class LightApp_SelectionMgr;
00055 
00056 class SalomeApp_IntSpinBox;
00057 
00058 class VisuGUI;
00059 class vtkPlaneSource;
00060 class vtkDataSetMapper;
00061 class OrientedPlane;
00062 class VISU_Actor;
00063 class PreviewPlane;
00064 
00065 namespace VISU {
00066   class Prs3d_i;
00067 
00068   typedef vtkSmartPointer<OrientedPlane> TVTKPlane;
00069   typedef std::vector<TVTKPlane> TPlanes;
00070   enum Orientation {XY, YZ, ZX};
00071 };
00072 
00073 //=================================================================================
00074 //class    : OrientedPlane
00075 //purpose  :
00076 //=================================================================================
00077 class OrientedPlane: public vtkPlane
00078 {
00079   QPointer<SVTK_ViewWindow> myViewWindow;
00080   vtkDataSetMapper* myMapper;
00081 
00082 public:
00083   static OrientedPlane* New();
00084   static OrientedPlane* New (SVTK_ViewWindow* vw);
00085 
00086   vtkTypeMacro(OrientedPlane, vtkPlane);
00087 
00088   VISU::Orientation myOrientation;
00089   float myDistance;
00090   double myAngle[2];
00091 
00092   vtkPlaneSource* myPlaneSource;
00093   SALOME_Actor* myActor;
00094 
00095   void SetOrientation(VISU::Orientation theOrientation);
00096   VISU::Orientation GetOrientation();
00097 
00098   void SetDistance(float theDistance);
00099   float GetDistance();
00100 
00101   void ShallowCopy(OrientedPlane* theOrientedPlane);
00102 
00103 protected:
00104   OrientedPlane();
00105   OrientedPlane(SVTK_ViewWindow* vw);
00106   ~OrientedPlane();
00107 
00108   void Init();
00109 
00110 private:
00111   OrientedPlane(const OrientedPlane&);
00112   void operator=(const OrientedPlane&);
00113 };
00114 
00115 //=================================================================================
00116 // class    : VisuGUI_ClippingDlg
00117 // purpose  :
00118 //=================================================================================
00119 class VisuGUI_ClippingDlg : public QDialog
00120 {
00121     Q_OBJECT
00122 
00123 public:
00124     VisuGUI_ClippingDlg( VisuGUI* theModule,
00125                          bool modal = false );
00126 
00127     float  getDistance()  { return (float)SpinBoxDistance->value(); }
00128     void   setDistance(const float theDistance) { SpinBoxDistance->setValue(theDistance); }
00129     double getRotation1() { return SpinBoxRot1->value(); }
00130     double getRotation2() { return SpinBoxRot2->value(); }
00131     void   setRotation(const double theRot1, const double theRot2);
00132     void Sinchronize();
00133 
00134     ~VisuGUI_ClippingDlg();
00135 
00136 private:
00137     void keyPressEvent( QKeyEvent* e );
00138   
00139     void SetPrs3d(VISU::Prs3d_i* thePrs);
00140   
00141     VISU_Actor* getSelectedActor();
00142 
00143     void applyLocalPlanes();
00144 
00145     void removeAllClippingPlanes(VISU::Prs3d_i* thePrs);
00146 
00147 private:
00148 
00149     LightApp_SelectionMgr* mySelectionMgr;
00150     Handle(SALOME_InteractiveObject) myIO;
00151 
00152     VisuGUI       * myVisuGUI;
00153     VISU::Prs3d_i * myPrs3d;
00154     VISU::TPlanes   myPlanes;
00155 
00156     QComboBox*        ComboBoxPlanes;
00157     QPushButton*      buttonNew;
00158     QPushButton*      buttonDelete;
00159 
00160     QLabel*           TextLabelOrientation;
00161     QLabel*           TextLabelDistance;
00162     QLabel*           TextLabelRot1;
00163     QLabel*           TextLabelRot2;
00164 
00165     QTabWidget*       TabPane;
00166 
00167     QComboBox*        ComboBoxOrientation;
00168     SalomeApp_DoubleSpinBox*  SpinBoxDistance;
00169     SalomeApp_DoubleSpinBox*  SpinBoxRot1;
00170     SalomeApp_DoubleSpinBox*  SpinBoxRot2;
00171 
00172     QWidget*          WidgetIJKTab;
00173     QButtonGroup*     ButtonGroupIJKAxis;
00174     QGroupBox*        GroupBoxIJKAxis;
00175     QLabel*           TextLabelIJKIndex;
00176     SalomeApp_IntSpinBox* SpinBoxIJKIndex;
00177     QCheckBox*        CheckBoxIJKPlaneReverse;
00178 
00179     QCheckBox*        PreviewCheckBox;
00180     QCheckBox*        AutoApplyCheckBox;
00181 
00182     QPushButton*      buttonOk;
00183     QPushButton*      buttonCancel;
00184     QPushButton*      buttonApply;
00185     QPushButton*      buttonHelp;
00186 
00187     bool myIsSelectPlane;
00188 
00189     VISU_Actor* myDSActor;
00190     QList<PreviewPlane*> myPreviewList;
00191 
00192 protected:
00193     QWidget* createParamsTab();
00194     QWidget* createIJKParamsTab();
00195     void setIJKByNonStructured();
00196     bool isStructured() const;
00197 
00198 public slots:
00199 
00200     void onSelectPlane(int theIndex);
00201     void ClickOnNew();
00202     void ClickOnDelete();
00203     void onSelectOrientation(int theItem);
00204     void SetCurrentPlaneParam();
00205     void SetCurrentPlaneIJKParam();
00206     void onIJKAxisChanged(int axis);
00207     void onTabChanged(QWidget* newTab);
00208     void onSelectionChanged();
00209     void OnPreviewToggle(bool theIsToggled);
00210     void ClickOnOk();
00211     void ClickOnCancel();
00212     void ClickOnApply();
00213     void ClickOnHelp();
00214 };
00215 
00216 #endif // DIALOGBOX_CLIPPING_H
00217 
00218 
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS