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_OFFSET_H 00024 #define DIALOGBOX_OFFSET_H 00025 00026 #include "VTKViewer.h" 00027 #include "VISU_Prs3d_i.hh" 00028 #include "VISU_PointMap3d_i.hh" 00029 00030 // QT Includes 00031 #include <QDialog> 00032 #include <QList> 00033 00034 class QCheckBox; 00035 class SalomeApp_DoubleSpinBox; 00036 class VisuGUI; 00037 class LightApp_SelectionMgr; 00038 00039 struct OffsetStruct 00040 { 00041 vtkFloatingPointType myOffset[3]; 00042 00043 OffsetStruct() 00044 { 00045 myOffset[0] = myOffset[1] = myOffset[2] = 0; 00046 } 00047 00048 OffsetStruct(vtkFloatingPointType theX, 00049 vtkFloatingPointType theY, 00050 vtkFloatingPointType theZ) 00051 { 00052 myOffset[0] = theX; 00053 myOffset[1] = theY; 00054 myOffset[2] = theZ; 00055 } 00056 }; 00057 00058 class VisuGUI_OffsetDlg: public QDialog 00059 { 00060 Q_OBJECT 00061 public: 00062 VisuGUI_OffsetDlg (VisuGUI* theModule); 00063 ~VisuGUI_OffsetDlg() {}; 00064 00065 virtual void setVisible(bool); 00066 00067 void addPresentation (VISU::Prs3d_i* thePrs); 00068 void addPointMapPresentation (VISU::PointMap3d_i* thePrs); 00069 int getPrsCount() const { return myPrsList.count() + myPointMapList.count(); } 00070 void clearPresentations(); 00071 00072 void setOffset (const vtkFloatingPointType* theOffset); 00073 void getOffset (vtkFloatingPointType* theOffset) const; 00074 bool isToSave() const; 00075 00076 private: 00077 void keyPressEvent( QKeyEvent* e ); 00078 00079 public slots: 00080 void onReset(); 00081 00082 protected slots: 00083 virtual void accept(); 00084 virtual void reject(); 00085 void onApply(); 00086 void onHelp(); 00087 void onSelectionChanged(); 00088 00089 private: 00090 void updateOffset (VISU::Prs3d_i* thePrs, vtkFloatingPointType* theOffset); 00091 void updatePointMapOffset (VISU::PointMap3d_i* thePrs, vtkFloatingPointType* theOffset); 00092 00093 VisuGUI * myModule; 00094 LightApp_SelectionMgr* mySelectionMgr; 00095 00096 SalomeApp_DoubleSpinBox * myDxEdt; 00097 SalomeApp_DoubleSpinBox * myDyEdt; 00098 SalomeApp_DoubleSpinBox * myDzEdt; 00099 QCheckBox * mySaveChk; 00100 00101 QList<VISU::Prs3d_i*> myPrsList; 00102 QList<OffsetStruct> myOldOffsets; 00103 00104 QList<VISU::PointMap3d_i*> myPointMapList; 00105 QList<OffsetStruct> myOldPointMapOffsets; 00106 }; 00107 00108 #endif // DIALOGBOX_OFFSET_H