1 // Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : StdMeshersGUI_SubShapeSelectorWdg.h
21 // Author : Open CASCADE S.A.S. (dmv)
23 #ifndef STDMESHERSGUI_SUBSHAPESELECTORWDG_H
24 #define STDMESHERSGUI_SUBSHAPESELECTORWDG_H
28 #include "SMESH_StdMeshersGUI.hxx"
29 #include "SMESH_SMESHGUI.hxx"
33 #include <QStringList>
34 #include <TopoDS_Shape.hxx>
39 class LightApp_SelectionMgr;
44 class SMESH_PreviewActorsCollection;
46 class SUIT_SelectionFilter;
48 class STDMESHERSGUI_EXPORT StdMeshersGUI_SubShapeSelectorWdg : public QWidget
53 StdMeshersGUI_SubShapeSelectorWdg( QWidget* parent = 0,
54 TopAbs_ShapeEnum subShType = TopAbs_EDGE,
55 const bool toShowList = true,
56 const bool toShowSelectBtn = false,
57 const int minListWidth=300);
58 ~StdMeshersGUI_SubShapeSelectorWdg();
60 SMESH::long_array_var GetListOfIDs();
61 bool SetListOfIDs( SMESH::long_array_var );
62 const QList<int>& GetSelectedIDs() const { return mySelectedIDs; }
64 void SetGeomShapeEntry( const QString& theEntry,
65 const QString& theMainShapeEntry);
66 const char* GetMainShapeEntry();
68 TopoDS_Shape GetGeomShape() { return myGeomShape; }
69 TopoDS_Shape GetMainShape() { return myMainShape; }
71 static GEOM::GEOM_Object_var GetGeomObjectByEntry( const QString& );
72 static TopoDS_Shape GetTopoDSByEntry( const QString& );
74 QString GetValue() const { return myParamValue; }
76 void ShowPreview( bool );
78 int GetListSize() { return myListOfIDs.size(); }
80 void SetMaxSize(int aMaxSize) { myMaxSize = aMaxSize; }
82 vtkRenderer* GetRenderer() { return myRenderer; }
83 SMESH_PreviewActorsCollection* GetActorCollection() { return myPreviewActor; }
86 void AvoidSimultaneousSelection( StdMeshersGUI_SubShapeSelectorWdg* other);
90 void ActivateSelection( bool );
91 void deactivateSelection() { ActivateSelection( false ); }
94 void selectionChanged(); // in the list
95 void shapeSelected(); // globally
97 * \brief Emitted when selection is activated
99 * Useful to deactivate one Object Reference param widget when an other
102 void selectionActivated();
107 void updateButtons();
114 void selectionIntoArgument();
115 void onListSelectionChanged();
121 SMESHGUI* mySMESHGUI;
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
128 std::string myMainEntry;
129 vtkRenderer* myRenderer;
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;
141 QString myParamValue;
144 // for manage possible size of myListOfIDs
146 // for manage type of selected subshape
147 TopAbs_ShapeEnum mySubShType;
149 SMESH_PreviewActorsCollection* myPreviewActor;
150 QList<SUIT_SelectionFilter*> myGeomFilters;
151 SUIT_SelectionFilter* myFilter;
154 #endif // STDMESHERSGUI_SUBSHAPESELECTORWDG_H