Salome HOME
Update copyrights
[modules/shaper.git] / src / XGUI / XGUI_InspectionPanel.h
1 // Copyright (C) 2014-2019  CEA/DEN, EDF R&D
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 #ifndef XGUI_INSPECTIONPANEL_H_
21 #define XGUI_INSPECTIONPANEL_H_
22
23 #include "XGUI.h"
24
25 #include <QDockWidget>
26
27 #include <memory>
28
29 class XGUI_SelectionMgr;
30 class QLineEdit;
31 class QTableWidget;
32 class QLabel;
33 class QTextBrowser;
34 class QVBoxLayout;
35 class QResizeEvent;
36
37 class TopoDS_Shape;
38
39 class GeomAPI_Vertex;
40 class GeomAPI_Edge;
41 class GeomAPI_Wire;
42 class GeomAPI_Face;
43 class GeomAPI_Shell;
44 class GeomAPI_Solid;
45 class GeomAPI_Shape;
46
47 class GeomAPI_Pln;
48 class GeomAPI_Sphere;
49 class GeomAPI_Cylinder;
50 class GeomAPI_Cone;
51 class GeomAPI_Torus;
52 class GeomAPI_Box;
53
54 /// Internal name of property panel widget
55 const static char* INSPECTION_PANEL = "inspection_panel_dock";
56
57 /**
58 * \ingroup GUI
59 * A class which represents an inspection panel: to show content of currently selected objects
60 */
61 class XGUI_EXPORT XGUI_InspectionPanel : public QDockWidget
62 {
63   Q_OBJECT
64 public:
65   /// Type of selected objects
66   enum SudShape {
67     ShapeId,
68     CompoundId,
69     CompsolidId,
70     SolidId,
71     ShellId,
72     FaceId,
73     WireId,
74     EdgeId,
75     VertexId
76   };
77
78   /// Constructor
79   /// \param theParent is a parent of the property panel
80   /// \param theMgr operation manager
81   XGUI_InspectionPanel(QWidget* theParent, XGUI_SelectionMgr* theMgr);
82
83   // Destructor
84   virtual ~XGUI_InspectionPanel();
85
86
87 private slots:
88   /// A slot to react on selection changed
89   void onSelectionChanged();
90
91 private:
92   /// Set counts of a sub-shapes
93   /// \param theId an id of sub-shape type
94   /// \param theVal a number of sub-shapes of corresponded type
95   void setSubShapeValue(SudShape theId, int theVal);
96
97   /// Set name of current selection
98   /// \param theName the name
99   void setName(const QString& theName);
100
101   /// Set content of selected shape into table
102   /// \param theShape the shape
103   void setShapeContent(const TopoDS_Shape& theShape);
104
105   /// Set parameters of the selected shape
106   /// \param theShape the shape
107   void setShapeParams(const TopoDS_Shape& theShape);
108
109   /// Clear content of the window
110   void clearContent();
111
112   /// Show parameters of a vertex
113   /// \param theVertex the vertex
114   void fillVertex(const std::shared_ptr<GeomAPI_Vertex>& theVertex);
115
116   /// Show parameters of a edge
117   /// \param theEdge the edge
118   void fillEdge(const std::shared_ptr<GeomAPI_Edge>& theEdge);
119
120   /// Show parameters of a wire
121   /// \param theWire the wire
122   void fillWire(const std::shared_ptr<GeomAPI_Wire>& theWire);
123
124   /// Show parameters of a face
125   /// \param theFace the face
126   void fillFace(const std::shared_ptr<GeomAPI_Face>& theFace);
127
128   /// Show parameters of a shell
129   /// \param theShell the shell
130   void fillShell(const std::shared_ptr<GeomAPI_Shell>& theShell);
131
132   /// Show parameters of a solid
133   /// \param theSolid the solid
134   void fillSolid(const std::shared_ptr<GeomAPI_Solid>& theSolid);
135
136   /// Show parameters of a compound
137   /// \param theShape the compound
138   void fillContainer(const std::shared_ptr<GeomAPI_Shape>& theShape);
139
140   /// Show parameters of a plane
141   /// \param theTitle a title of the object
142   /// \param thePlane the plane
143   void setPlaneType(const QString& theTitle, const std::shared_ptr<GeomAPI_Pln>& thePlane);
144
145   /// Show parameters of a sphere
146   /// \param theTitle a title of the object
147   /// \param theSphere the sphere
148   void setSphereType(const QString& theTitle, const std::shared_ptr<GeomAPI_Sphere>& theSphere);
149
150   /// Show parameters of a cylinder
151   /// \param theTitle a title of the object
152   /// \param theCyl the cylinder
153   void setCylinderType(const QString& theTitle, const std::shared_ptr<GeomAPI_Cylinder>& theCyl);
154
155   /// Show parameters of a cone
156   /// \param theTitle a title of the object
157   /// \param theCone the cone
158   void setConeType(const QString& theTitle, const std::shared_ptr<GeomAPI_Cone>& theCone);
159
160   /// Show parameters of a torus
161   /// \param theTitle a title of the object
162   /// \param theTorus the torus
163   void setTorusType(const QString& theTitle, const std::shared_ptr<GeomAPI_Torus>& theTorus);
164
165   /// Show parameters of a box
166   /// \param theTitle a title of the object
167   /// \param theBox the box
168   void setBoxType(const QString& theTitle, const std::shared_ptr<GeomAPI_Box>& theBox);
169
170   /// Show parameters of a rotated box
171   /// \param theTitle a title of the object
172   /// \param theBox the box
173   void setRotatedBoxType(const QString& theTitle, const std::shared_ptr<GeomAPI_Box>& theBox);
174
175
176   /// Set text into parameters area
177   /// \param theText the text
178   void setParamsText(const QString& theText);
179
180 private:
181   XGUI_SelectionMgr* mySelectionMgr; //> selection manager
182
183   QLineEdit* myNameEdt; //> Name field
184   QTableWidget* mySubShapesTab; //> table of sub-shapes
185   QLabel* myTypeLbl; //> label of a type
186   QTextBrowser* myTypeParams; //> parameters area
187   QVBoxLayout* myMainLayout; //> main layout
188   //QWidget* myMainWidget;  //> main widget
189 };
190
191 #endif