1 // Copyright (C) 2014-2020 CEA/DEN, EDF R&D
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 #ifndef XGUI_INSPECTIONPANEL_H_
21 #define XGUI_INSPECTIONPANEL_H_
25 #include <ModelAPI_Feature.h>
27 #include <QDockWidget>
53 class GeomAPI_Cylinder;
57 class ModuleBase_PageWidget;
59 /// Internal name of property panel widget
60 MAYBE_UNUSED const static char* INSPECTION_PANEL = "inspection_panel_dock";
64 * A class which represents an inspection panel: to show content of currently selected objects
66 class XGUI_EXPORT XGUI_InspectionPanel : public QDockWidget
70 /// Type of selected objects
84 /// \param theParent is a parent of the property panel
85 /// \param theMgr operation manager
86 XGUI_InspectionPanel(QWidget* theParent, XGUI_Workshop* theWorkshop);
89 virtual ~XGUI_InspectionPanel();
92 virtual void showEvent(QShowEvent* theEvent);
95 /// A slot to react on selection changed
96 void onSelectionChanged();
99 /// Set counts of a sub-shapes
100 /// \param theId an id of sub-shape type
101 /// \param theVal a number of sub-shapes of corresponded type
102 void setSubShapeValue(SudShape theId, int theVal);
104 /// Set name of current selection
105 /// \param theName the name
106 void setName(const QString& theName);
108 /// Set content of selected shape into table
109 /// \param theShape the shape
110 void setShapeContent(const TopoDS_Shape& theShape);
112 /// Set parameters of the selected shape
113 /// \param theShape the shape
114 void setShapeParams(const TopoDS_Shape& theShape);
116 /// Clear content of the window
119 /// Show parameters of a vertex
120 /// \param theVertex the vertex
121 void fillVertex(const std::shared_ptr<GeomAPI_Vertex>& theVertex);
123 /// Show parameters of a edge
124 /// \param theEdge the edge
125 void fillEdge(const std::shared_ptr<GeomAPI_Edge>& theEdge);
127 /// Show parameters of a wire
128 /// \param theWire the wire
129 void fillWire(const std::shared_ptr<GeomAPI_Wire>& theWire);
131 /// Show parameters of a face
132 /// \param theFace the face
133 void fillFace(const std::shared_ptr<GeomAPI_Face>& theFace);
135 /// Show parameters of a shell
136 /// \param theShell the shell
137 void fillShell(const std::shared_ptr<GeomAPI_Shell>& theShell);
139 /// Show parameters of a solid
140 /// \param theSolid the solid
141 void fillSolid(const std::shared_ptr<GeomAPI_Solid>& theSolid);
143 /// Show parameters of a compound
144 /// \param theShape the compound
145 void fillContainer(const std::shared_ptr<GeomAPI_Shape>& theShape);
147 /// Show parameters of a plane
148 /// \param theTitle a title of the object
149 /// \param thePlane the plane
150 void setPlaneType(const QString& theTitle, const std::shared_ptr<GeomAPI_Pln>& thePlane);
152 /// Show parameters of a sphere
153 /// \param theTitle a title of the object
154 /// \param theSphere the sphere
155 void setSphereType(const QString& theTitle, const std::shared_ptr<GeomAPI_Sphere>& theSphere);
157 /// Show parameters of a cylinder
158 /// \param theTitle a title of the object
159 /// \param theCyl the cylinder
160 void setCylinderType(const QString& theTitle, const std::shared_ptr<GeomAPI_Cylinder>& theCyl);
162 /// Show parameters of a cone
163 /// \param theTitle a title of the object
164 /// \param theCone the cone
165 void setConeType(const QString& theTitle, const std::shared_ptr<GeomAPI_Cone>& theCone);
167 /// Show parameters of a torus
168 /// \param theTitle a title of the object
169 /// \param theTorus the torus
170 void setTorusType(const QString& theTitle, const std::shared_ptr<GeomAPI_Torus>& theTorus);
172 /// Show parameters of a box
173 /// \param theTitle a title of the object
174 /// \param theBox the box
175 void setBoxType(const QString& theTitle, const std::shared_ptr<GeomAPI_Box>& theBox);
177 /// Show parameters of a rotated box
178 /// \param theTitle a title of the object
179 /// \param theBox the box
180 void setRotatedBoxType(const QString& theTitle, const std::shared_ptr<GeomAPI_Box>& theBox);
182 /// Set text into parameters area
183 /// \param theText the text
184 void setParamsText(const QString& theText);
186 /// Fills Feature panel with controls specific to the given feature
187 /// \param theFeature the selected feature
188 void buildFeaturePane(const FeaturePtr& theFeature);
191 XGUI_Workshop* myWorkshop; //> selection manager
193 QLineEdit* myNameEdt; ///> Name field
194 QTableWidget* mySubShapesTab; ///> table of sub-shapes
195 QLabel* myTypeLbl; ///> label of a type
196 QTextBrowser* myTypeParams; ///> parameters area
197 QVBoxLayout* myMainLayout; ///> main layout
198 ModuleBase_PageWidget* myFeaturePane; ///> Content of feature property panel
199 QGridLayout* myFeatureLayout; ///> Layout of feature panel
200 QStackedWidget* myStackWgt; ///> base widget of the panel
202 int myFeaturePanelId;