Back to index

salome-smesh  6.5.0
StdMeshersGUI_SubShapeSelectorWdg.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 // File   : StdMeshersGUI_SubShapeSelectorWdg.h
00021 // Author : Open CASCADE S.A.S. (dmv)
00022 //
00023 #ifndef STDMESHERSGUI_SUBSHAPESELECTORWDG_H
00024 #define STDMESHERSGUI_SUBSHAPESELECTORWDG_H
00025 
00026 // SMESH includes
00027 #include <SMESHGUI.h>
00028 #include "SMESH_StdMeshersGUI.hxx"
00029 #include "SMESH_SMESHGUI.hxx"
00030 
00031 // Qt includes
00032 #include <QWidget>
00033 #include <QStringList>
00034 #include <TopoDS_Shape.hxx>
00035 
00036 #include <SMESHGUI_VTKUtils.h>
00037 
00038 class SMESHGUI;
00039 class LightApp_SelectionMgr;
00040 class SVTK_Selector;
00041 class QPushButton;
00042 class QLabel;
00043 class QLineEdit;
00044 class QCheckBox;
00045 class QListWidget;
00046 class SMESH_Actor;
00047 class SMESH_PreviewActorsCollection;
00048 class vtkRenderer;
00049 class SUIT_SelectionFilter;
00050 
00051 class STDMESHERSGUI_EXPORT StdMeshersGUI_SubShapeSelectorWdg : public QWidget
00052 {
00053   Q_OBJECT
00054 
00055 public:
00056   StdMeshersGUI_SubShapeSelectorWdg( QWidget* parent = 0,
00057                                      TopAbs_ShapeEnum aSubShType = TopAbs_EDGE );
00058   ~StdMeshersGUI_SubShapeSelectorWdg();
00059 
00060   SMESH::long_array_var          GetListOfIDs();
00061   void                           SetListOfIDs( SMESH::long_array_var );
00062 
00063   void                           SetGeomShapeEntry( const QString& theEntry );
00064   const char*                    GetGeomShapeEntry() { return myEntry.toLatin1().data();}
00065 
00066   void                           SetMainShapeEntry( const QString& theEntry );
00067   const char*                    GetMainShapeEntry();
00068 
00069   TopoDS_Shape                   GetGeomShape() { return myGeomShape; }
00070   TopoDS_Shape                   GetMainShape() { return myMainShape; }
00071 
00072   QList<int>                     GetCorrectedListOfIDs( bool fromSubshapeToMainshape = true );
00073 
00074   static GEOM::GEOM_Object_var   GetGeomObjectByEntry( const QString& );
00075   static TopoDS_Shape            GetTopoDSByEntry( const QString& );
00076 
00077   QString                        GetValue() const { return myParamValue; }
00078 
00079   void                           showPreview ( bool );
00080 
00081   int                            GetListSize() { return myListOfIDs.size(); }
00082 
00083   void SetMaxSize(int aMaxSize) { myMaxSize = aMaxSize; }
00084   //void SetSubShType(TopAbs_ShapeEnum aSubShType) { mySubShType = aSubShType; }
00085 
00086 private:
00087   void                           updateState();
00088   void                           setFilter();
00089   void                           updateButtons();
00090 
00091 private slots:
00092   void                           onAdd(); 
00093   void                           onRemove(); 
00094   void                           onPrevious(); 
00095   void                           onNext(); 
00096   void                           SelectionIntoArgument();
00097   void                           onListSelectionChanged();
00098 
00099 private:
00100   void                           init();
00101 
00102 private:
00103   SMESHGUI*                      mySMESHGUI;
00104   LightApp_SelectionMgr*         mySelectionMgr;          /* User shape selection */
00105   SVTK_Selector*                 mySelector;
00106   SMESH::SMESH_Mesh_var          myMesh;
00107   TopoDS_Shape                   myGeomShape; // shape whose sub-shapes are selected
00108   TopoDS_Shape                   myMainShape; // main shape of the mesh
00109   QString                        myEntry;
00110   QString                        myMainEntry;
00111   vtkRenderer*                   myRenderer;
00112   
00113   QListWidget*                   myListWidget;
00114   QPushButton*                   myAddButton;
00115   QPushButton*                   myRemoveButton;
00116   QLabel*                        myInfoLabel;
00117   QPushButton*                   myPrevButton;
00118   QPushButton*                   myNextButton;
00119   QList<int>                     mySelectedIDs;
00120   QList<int>                     myListOfIDs;
00121   
00122   QString                        myParamValue;
00123   bool                           myIsShown;
00124   bool                           myIsNotCorrected;
00125 
00126   // for manage possible size of myListOfIDs
00127   int                            myMaxSize;
00128   // for manage type of selected subshape
00129   TopAbs_ShapeEnum               mySubShType;
00130   
00131   SMESH_PreviewActorsCollection* myPreviewActor;
00132   QList<SUIT_SelectionFilter*>   myGeomFilters;
00133   SUIT_SelectionFilter*          myFilter;
00134 };
00135 
00136 #endif // STDMESHERSGUI_SUBSHAPESELECTORWDG_H