1 // Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef SMESHGUI_MESHINFO_H
24 #define SMESHGUI_MESHINFO_H
26 #include "SMESH_SMESHGUI.hxx"
27 #include "SMESHGUI_SelectionProxy.h"
29 #ifndef DISABLE_PLOT2DVIEWER
30 #include <Plot2d_Histogram.h>
40 #include <SALOMEconfig.h>
41 #include CORBA_SERVER_HEADER(SMESH_Filter)
43 #include <SALOME_InteractiveObject.hxx>
44 #include <SALOME_GenericObj_wrap.hxx>
46 class QAbstractButton;
49 class QContextMenuEvent;
55 class QTreeWidgetItem;
56 class SMDS_MeshElement;
58 class SMESHGUI_IdPreview;
59 class SMESHGUI_SpinBox;
65 class SMESHGUI_EXPORT SMESHGUI_Info : public QWidget
68 SMESHGUI_Info( QWidget* = 0 );
69 virtual void saveInfo( QTextStream& ) = 0;
72 class SMESHGUI_EXPORT SMESHGUI_BaseInfo : public SMESHGUI_Info
79 iObjectStart = iStart,
83 iNodesStart = iObjectEnd,
86 iElementsStart = iNodesEnd,
87 iElementsTitleStart = iElementsStart,
90 iElementsTotalStart = iElementsTitleEnd,
93 i0DStart = iElementsTotalEnd,
117 iElementsEnd = i3DEnd,
133 typedef QMap<int, QWidget*> wlist;
134 typedef QMap<int, wlist> iwlist;
137 SMESHGUI_BaseInfo( QWidget* = 0 );
138 ~SMESHGUI_BaseInfo();
140 void showInfo( const SMESH::SelectionProxy& );
142 void saveInfo( QTextStream& );
145 QWidget* addWidget( QWidget*, int, int, int = 1 );
146 QWidget* widget( int, int ) const;
147 QString value( int, int ) const;
148 void setFieldsVisible( int, int, bool );
156 SMESH::SelectionProxy myProxy;
159 class SMESHGUI_EXPORT SMESHGUI_ElemInfo : public SMESHGUI_Info
164 SMESHGUI_ElemInfo( QWidget* = 0 );
165 ~SMESHGUI_ElemInfo();
167 void showInfo( const SMESH::SelectionProxy&, uint, bool );
168 void showInfo( const SMESH::SelectionProxy&, QSet<uint>, bool );
169 void showInfo( const SMESH::SelectionProxy& );
171 void saveInfo( QTextStream& );
174 enum { ShowNone, ShowNodes, ShowElements };
176 QWidget* centralWidget() const;
178 SMESH::SelectionProxy proxy() const;
181 QString type2str( int, bool = false );
182 QString stype2str( int );
183 QString etype2str( int );
184 QString ctrl2str( int );
185 void writeInfo( InfoWriter*, const QList<uint>& );
186 virtual void information( const QList<uint>& ) = 0;
187 virtual void clearInternal();
190 void itemInfo( int type, const QString& ids );
195 void updateControls();
199 ExtraWidget* myExtra;
200 SMESH::SelectionProxy myProxy;
206 class SMESHGUI_EXPORT SMESHGUI_SimpleElemInfo : public SMESHGUI_ElemInfo
211 SMESHGUI_SimpleElemInfo( QWidget* = 0 );
214 void information( const QList<uint>& );
215 void clearInternal();
218 void connectivityClicked(const QUrl &);
221 QTextBrowser* myInfo;
224 class SMESHGUI_EXPORT SMESHGUI_TreeElemInfo : public SMESHGUI_ElemInfo
232 SMESHGUI_TreeElemInfo( QWidget* = 0 );
235 void contextMenuEvent( QContextMenuEvent* );
236 void information( const QList<uint>& );
237 void nodeInfo( const SMDS_MeshNode*, int, int, QTreeWidgetItem* );
238 void clearInternal();
241 void itemDoubleClicked( QTreeWidgetItem*, int );
242 void saveExpanded( QTreeWidgetItem* );
245 QTreeWidgetItem* createItem( QTreeWidgetItem* = 0, int = 0 );
246 QString expandedResource( QTreeWidgetItem* );
252 class InfoComputor: public QObject
257 enum { GrpSize, GrpNbNodes };
259 InfoComputor( QObject*, const SMESH::SelectionProxy&, int );
268 SMESH::SelectionProxy myProxy;
272 class SMESHGUI_EXPORT SMESHGUI_AddInfo : public SMESHGUI_Info
277 SMESHGUI_AddInfo( QWidget* = 0 );
280 void showInfo( const SMESH::SelectionProxy& );
282 void saveInfo( QTextStream& );
286 void showPreviousGroups();
287 void showNextGroups();
288 void showPreviousSubMeshes();
289 void showNextSubMeshes();
292 QTreeWidgetItem* createItem( QTreeWidgetItem* = 0, int = 0 );
293 void meshInfo( const SMESH::SelectionProxy&, QTreeWidgetItem* );
294 void subMeshInfo( const SMESH::SelectionProxy&, QTreeWidgetItem* );
295 void groupInfo( const SMESH::SelectionProxy&, QTreeWidgetItem* );
298 void showSubMeshes();
301 SMESH::SelectionProxy myProxy;
303 QList<InfoComputor*> myComputors;
304 QList<SMESH::SelectionProxy> myGroups;
305 QList<SMESH::SelectionProxy> mySubMeshes;
308 class SMESHGUI_EXPORT SMESHGUI_CtrlInfo : public SMESHGUI_Info
313 SMESHGUI_CtrlInfo( QWidget* = 0 );
314 ~SMESHGUI_CtrlInfo();
316 void showInfo( const SMESH::SelectionProxy& );
317 void saveInfo( QTextStream& );
320 enum ObjectType { Mesh, SubMesh, Group };
321 QwtPlot* createPlot( QWidget* );
322 void clearInternal();
323 #ifndef DISABLE_PLOT2DVIEWER
324 Plot2d_Histogram* getHistogram( SMESH::NumericalFunctor_ptr );
326 void computeNb( int, int, int );
329 void computeAspectRatio();
330 void computeAspectRatio3D();
331 void computeFreeNodesInfo();
332 void computeNodesNbConnInfo();
333 void computeDoubleNodesInfo();
334 void computeDoubleEdgesInfo();
335 void computeDoubleFacesInfo();
336 void computeOverConstrainedFacesInfo();
337 void computeDoubleVolumesInfo();
338 void computeOverConstrainedVolumesInfo();
339 void setTolerance( double );
342 typedef SALOME::GenericObj_wrap< SMESH::Predicate > TPredicate;
343 typedef SALOME::GenericObj_wrap< SMESH::NumericalFunctor > TNumFunctor;
344 SMESH::SelectionProxy myProxy;
345 ObjectType myObjectType;
346 SMESHGUI_SpinBox* myToleranceWidget;
347 QList<QLabel*> myWidgets;
350 QList<QAbstractButton*> myButtons;
351 QList<TPredicate> myPredicates;
352 TNumFunctor myAspectRatio, myAspectRatio3D, myNodeConnFunctor;
355 class SMESHGUI_EXPORT SMESHGUI_MeshInfoDlg : public QDialog
359 enum { NodeMode, ElemMode, GroupMode };
365 BaseInfo, //!< base mesh information
366 ElemInfo, //!< mesh element information
367 AddInfo, //!< additional information
368 CtrlInfo //!< controls information
371 SMESHGUI_MeshInfoDlg( QWidget* = 0, int = BaseInfo );
372 ~SMESHGUI_MeshInfoDlg();
374 void showInfo( const Handle(SALOME_InteractiveObject)& );
378 void keyPressEvent( QKeyEvent* );
381 void switchMode( int );
385 void updateSelection();
390 void idPreviewChange( bool );
391 void showItemInfo( int type, const QString& ids );
395 void showInfo( const SMESH::SelectionProxy& );
397 SMESH::SelectionProxy myProxy;
398 QTabWidget* myTabWidget;
399 SMESHGUI_BaseInfo* myBaseInfo;
400 SMESHGUI_ElemInfo* myElemInfo;
401 SMESHGUI_AddInfo* myAddInfo;
402 SMESHGUI_CtrlInfo* myCtrlInfo;
403 QButtonGroup* myMode;
405 QCheckBox* myIDPreviewCheck;
406 GroupCombo* myGroups;
407 SMESHGUI_IdPreview* myIDPreview;
410 class SMESHGUI_EXPORT SMESHGUI_CtrlInfoDlg : public QDialog
415 SMESHGUI_CtrlInfoDlg( QWidget* = 0 );
416 ~SMESHGUI_CtrlInfoDlg();
418 void showInfo( const Handle(SALOME_InteractiveObject)& );
424 void updateSelection();
429 void showInfo( const SMESH::SelectionProxy& );
431 SMESH::SelectionProxy myProxy;
432 SMESHGUI_CtrlInfo* myCtrlInfo;
435 #endif // SMESHGUI_MESHINFO_H