Version: 9.12.0
StdMeshersGUI_SubShapeSelectorWdg.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 // File : StdMeshersGUI_SubShapeSelectorWdg.h
21 // Author : Open CASCADE S.A.S. (dmv)
22 //
23 #ifndef STDMESHERSGUI_SUBSHAPESELECTORWDG_H
24 #define STDMESHERSGUI_SUBSHAPESELECTORWDG_H
25 
26 // SMESH includes
27 #include "SMESHGUI.h"
28 #include "SMESH_StdMeshersGUI.hxx"
29 #include "SMESH_SMESHGUI.hxx"
30 
31 // Qt includes
32 #include <QWidget>
33 #include <QStringList>
34 #include <TopoDS_Shape.hxx>
35 
36 #include <string>
37 
38 class SMESHGUI;
39 class LightApp_SelectionMgr;
40 class SVTK_Selector;
41 class QPushButton;
42 class QLabel;
43 class QListWidget;
45 class vtkRenderer;
47 
49 {
50  Q_OBJECT
51 
52 public:
54  TopAbs_ShapeEnum subShType = TopAbs_EDGE,
55  const bool toShowList = true,
56  const bool toShowSelectBtn = false,
57  const int minListWidth=300);
59 
60  SMESH::long_array_var GetListOfIDs();
61  bool SetListOfIDs( SMESH::long_array_var );
62  const QList<int>& GetSelectedIDs() const { return mySelectedIDs; }
63 
64  void SetGeomShapeEntry( const QString& theEntry,
65  const QString& theMainShapeEntry);
66  const char* GetMainShapeEntry();
67 
68  TopoDS_Shape GetGeomShape() { return myGeomShape; }
69  TopoDS_Shape GetMainShape() { return myMainShape; }
70 
71  static GEOM::GEOM_Object_var GetGeomObjectByEntry( const QString& );
72  static TopoDS_Shape GetTopoDSByEntry( const QString& );
73 
74  QString GetValue() const { return myParamValue; }
75 
76  void ShowPreview( bool );
77 
78  int GetListSize() { return myListOfIDs.size(); }
79 
80  void SetMaxSize(int aMaxSize) { myMaxSize = aMaxSize; }
81 
82  vtkRenderer* GetRenderer() { return myRenderer; }
83  SMESH_PreviewActorsCollection* GetActorCollection() { return myPreviewActor; }
84  void ClearSelected();
85 
86  void AvoidSimultaneousSelection( StdMeshersGUI_SubShapeSelectorWdg* other);
87 
88 public slots:
89 
90  void ActivateSelection( bool );
91  void deactivateSelection() { ActivateSelection( false ); }
92 
93 signals:
94  void selectionChanged(); // in the list
95  void shapeSelected(); // globally
103 
104 private:
105  void updateState();
106  void setFilter();
107  void updateButtons();
108 
109 private slots:
110  void onAdd();
111  void onRemove();
112  void onPrevious();
113  void onNext();
114  void selectionIntoArgument();
115  void onListSelectionChanged();
116 
117 private:
118  void init();
119 
120 private:
122  LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
123  SVTK_Selector* mySelector;
124  SMESH::SMESH_Mesh_var myMesh;
125  TopoDS_Shape myGeomShape; // shape whose sub-shapes are selected
126  TopoDS_Shape myMainShape; // main shape of the mesh
127  std::string myEntry;
128  std::string myMainEntry;
129  vtkRenderer* myRenderer;
130 
131  QListWidget* myListWidget;
132  QPushButton* myActivateButton;
133  QPushButton* myAddButton;
134  QPushButton* myRemoveButton;
136  QPushButton* myPrevButton;
137  QPushButton* myNextButton;
138  QList<int> mySelectedIDs;
139  QList<int> myListOfIDs;
140 
141  QString myParamValue;
142  bool myIsShown;
143 
144  // for manage possible size of myListOfIDs
146  // for manage type of selected subshape
147  TopAbs_ShapeEnum mySubShType;
148 
150  QList<SUIT_SelectionFilter*> myGeomFilters;
152 };
153 
154 #endif // STDMESHERSGUI_SUBSHAPESELECTORWDG_H
#define STDMESHERSGUI_EXPORT
Definition: SMESH_StdMeshersGUI.hxx:36
Definition: SMESHGUI.h:84
Definition: SMESH_PreviewActorsCollection.h:41
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:49
void deactivateSelection()
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:91
QList< int > mySelectedIDs
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:138
QString GetValue() const
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:74
int GetListSize()
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:78
SMESH_PreviewActorsCollection * GetActorCollection()
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:83
QString myParamValue
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:141
QLabel * myInfoLabel
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:135
QPushButton * myPrevButton
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:136
SMESHGUI * mySMESHGUI
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:121
QPushButton * myAddButton
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:133
bool myIsShown
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:142
int myMaxSize
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:145
TopoDS_Shape myGeomShape
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:125
QPushButton * myActivateButton
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:132
vtkRenderer * myRenderer
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:129
const QList< int > & GetSelectedIDs() const
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:62
LightApp_SelectionMgr * mySelectionMgr
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:122
void SetMaxSize(int aMaxSize)
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:80
QList< SUIT_SelectionFilter * > myGeomFilters
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:150
QList< int > myListOfIDs
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:139
SMESH_PreviewActorsCollection * myPreviewActor
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:149
void selectionActivated()
Emitted when selection is activated.
TopoDS_Shape GetGeomShape()
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:68
SMESH::SMESH_Mesh_var myMesh
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:124
QPushButton * myNextButton
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:137
QListWidget * myListWidget
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:131
SUIT_SelectionFilter * myFilter
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:151
std::string myMainEntry
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:128
TopoDS_Shape GetMainShape()
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:69
TopAbs_ShapeEnum mySubShType
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:147
TopoDS_Shape myMainShape
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:126
std::string myEntry
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:127
vtkRenderer * GetRenderer()
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:82
SVTK_Selector * mySelector
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:123
QPushButton * myRemoveButton
Definition: StdMeshersGUI_SubShapeSelectorWdg.h:134