X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_ClippingDlg.h;h=d36c92cc16cd14204874a97d8ddf8235faa2d9a0;hp=cbf044f6033e69ed83ad96eaac42d6fabc91c174;hb=bd8f1aee7c78f7d2eb82bd4fec5e08c9e3d280ce;hpb=c63ee099ad2b149bd70136839c973e8910137bc5 diff --git a/src/SMESHGUI/SMESHGUI_ClippingDlg.h b/src/SMESHGUI/SMESHGUI_ClippingDlg.h index cbf044f60..d36c92cc1 100644 --- a/src/SMESHGUI/SMESHGUI_ClippingDlg.h +++ b/src/SMESHGUI/SMESHGUI_ClippingDlg.h @@ -1,134 +1,213 @@ -// SMESH SMESHGUI : GUI for SMESH component +// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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. -// -// 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. -// -// 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 -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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. +// +// 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. // +// 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 // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File : SMESHGUI_TransparencyDlg.h -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ -#ifndef DIALOGBOX_CLIPPING_H -#define DIALOGBOX_CLIPPING_H +// 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 -#include +// SMESH includes +#include "SMESH_SMESHGUI.hxx" -#include +// SALOME includes +#include + +// Qt includes +#include +#include + +// VTK includes #include +#include +// STL includes +#include +#include #include -// QT Includes -#include -#include - class QLabel; class QPushButton; -class QTable; class QCheckBox; class QComboBox; - -class LightApp_SelectionMgr; -class SVTK_Selector; - +class QListWidget; +class QListWidgetItem; +class SALOME_Actor; class SMESHGUI; class SMESH_Actor; +class SMESHGUI_SpinBox; +class vtkActor; +class vtkDataSetMapper; +class vtkPlaneSource; -class OrientedPlane; - - -namespace SMESH { - - typedef vtkSmartPointer TVTKPlane; - typedef std::vector TPlanes; - enum Orientation {XY, YZ, ZX}; - +namespace SMESH +{ + enum Orientation { XY, YZ, ZX }; + + class OrientedPlane: public vtkPlane + { + QPointer 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 TPlane; + typedef std::list TActorList; + + struct TPlaneData + { + TPlaneData( TPlane thePlane, + TActorList theActorList ) + { + Plane = thePlane; + ActorList = theActorList; + } + TPlane Plane; + TActorList ActorList; + }; + + typedef std::vector TPlaneVector; + typedef std::vector TPlaneDataVector; }; - //================================================================================= // class : SMESHGUI_ClippingDlg // purpose : //================================================================================= -class SMESHGUI_ClippingDlg : public QDialog +class SMESHGUI_EXPORT SMESHGUI_ClippingDlg : public QDialog { - Q_OBJECT + Q_OBJECT public: - SMESHGUI_ClippingDlg (SMESHGUI* theModule, - const char* name = 0, - bool modal = false, - WFlags fl = 0); + SMESHGUI_ClippingDlg( SMESHGUI*, SVTK_ViewWindow* ); + ~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 + static SMESH::OrientedPlane* AddPlane (SMESH::TActorList theActorList, + SVTK_ViewWindow* theViewWindow, + SMESH::Orientation theOrientation, + double theDistance, + const double theAngle[2]); + +protected: + void keyPressEvent( QKeyEvent* ); - float getDistance() { return (float)SpinBoxDistance->GetValue(); } - void setDistance (const float theDistance) { SpinBoxDistance->SetValue(theDistance); } - double getRotation1() { return SpinBoxRot1->GetValue(); } - double getRotation2() { return SpinBoxRot2->GetValue(); } - void setRotation (const double theRot1, const double theRot2); - void Sinchronize(); +private: + void initializePlaneData(); - ~SMESHGUI_ClippingDlg(); + void synchronize(); -private: + void updateActorList(); + SMESH::TActorList getCurrentActors(); - LightApp_SelectionMgr* mySelectionMgr; - SVTK_Selector* mySelector; - SMESHGUI* mySMESHGUI; - SMESH_Actor* myActor; - SMESH::TPlanes myPlanes; - - QComboBox* ComboBoxPlanes; - QPushButton* buttonNew; - QPushButton* buttonDelete; - 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; + void updateActorItem( QListWidgetItem* theItem, + bool theUpdateSelectAll, + bool theUpdateClippingPlaneMap ); -public slots: + void dumpPlaneData() const; - void onSelectPlane (int theIndex); - void ClickOnNew(); - void ClickOnDelete(); - void onSelectOrientation (int theItem); - void SetCurrentPlaneParam(); - void onSelectionChanged(); - void OnPreviewToggle (bool theIsToggled); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void ClickOnHelp(); +private: + SMESHGUI* mySMESHGUI; + SVTK_ViewWindow* myViewWindow; + SMESH::TPlaneDataVector myPlanes; + + QComboBox* ComboBoxPlanes; + QPushButton* buttonNew; + QPushButton* buttonDelete; + QListWidget* ActorList; + QCheckBox* SelectAllCheckBox; + 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; + +protected slots: + virtual void reject(); + +public slots: + void onSelectPlane( int ); + void ClickOnNew(); + void ClickOnDelete(); + void onActorItemChanged( QListWidgetItem* ); + void onSelectAll( int ); + void onSelectOrientation( int ); + void SetCurrentPlaneParam(); + void OnPreviewToggle( bool ); + void onAutoApply(bool); + void ClickOnOk(); + void ClickOnApply(); + void ClickOnHelp(); }; -#endif // DIALOGBOX_TRANSPARENCYDLG_H +#endif // SMESHGUI_CLIPPINGDLG_H