1 // Copyright (C) 2007-2021 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>
41 #include <SALOMEconfig.h>
42 #include CORBA_SERVER_HEADER(SMESH_Filter)
44 #include <SALOME_InteractiveObject.hxx>
45 #include <SALOME_GenericObj_wrap.hxx>
47 class QAbstractButton;
50 class QContextMenuEvent;
56 class QTreeWidgetItem;
57 class SMDS_MeshElement;
59 class SMESHGUI_IdPreview;
60 class SMESHGUI_SpinBox;
66 class SMESHGUI_EXPORT SMESHGUI_Info : public QWidget
69 SMESHGUI_Info( QWidget* = 0 );
70 virtual void saveInfo( QTextStream& ) = 0;
73 class SMESHGUI_EXPORT SMESHGUI_BaseInfo : public SMESHGUI_Info
80 iObjectStart = iStart,
84 iNodesStart = iObjectEnd,
87 iElementsStart = iNodesEnd,
88 iElementsTitleStart = iElementsStart,
91 iElementsTotalStart = iElementsTitleEnd,
94 i0DStart = iElementsTotalEnd,
100 i1DStart = iBallsEnd,
118 iElementsEnd = i3DEnd,
134 typedef QMap<int, QWidget*> wlist;
135 typedef QMap<int, wlist> iwlist;
138 SMESHGUI_BaseInfo( QWidget* = 0 );
139 ~SMESHGUI_BaseInfo();
141 void showInfo( const SMESH::SelectionProxy& );
143 void saveInfo( QTextStream& );
146 QWidget* addWidget( QWidget*, int, int, int = 1 );
147 QWidget* widget( int, int ) const;
148 QString value( int, int ) const;
149 void setFieldsVisible( int, int, bool );
157 SMESH::SelectionProxy myProxy;
160 class SMESHGUI_EXPORT SMESHGUI_ElemInfo : public SMESHGUI_Info
165 SMESHGUI_ElemInfo( QWidget* = 0 );
166 ~SMESHGUI_ElemInfo();
168 void showInfo( const SMESH::SelectionProxy&, uint, bool );
169 void showInfo( const SMESH::SelectionProxy&, QSet<uint>, bool );
170 void showInfo( const SMESH::SelectionProxy& );
172 void saveInfo( QTextStream& );
175 enum { ShowNone, ShowNodes, ShowElements };
177 QWidget* centralWidget() const;
179 SMESH::SelectionProxy proxy() const;
182 QString type2str( int, bool = false );
183 QString stype2str( int );
184 QString etype2str( int );
185 QString ctrl2str( int );
186 void writeInfo( InfoWriter*, const QList<uint>& );
187 virtual void information( const QList<uint>& ) = 0;
188 virtual void clearInternal();
191 void itemInfo( int type, const QString& ids );
196 void updateControls();
200 ExtraWidget* myExtra;
201 SMESH::SelectionProxy myProxy;
207 class SMESHGUI_EXPORT SMESHGUI_SimpleElemInfo : public SMESHGUI_ElemInfo
212 SMESHGUI_SimpleElemInfo( QWidget* = 0 );
215 void information( const QList<uint>& );
216 void clearInternal();
219 void connectivityClicked(const QUrl &);
222 QTextBrowser* myInfo;
225 class SMESHGUI_EXPORT SMESHGUI_TreeElemInfo : public SMESHGUI_ElemInfo
233 SMESHGUI_TreeElemInfo( QWidget* = 0 );
236 void contextMenuEvent( QContextMenuEvent* );
237 void information( const QList<uint>& );
238 void nodeInfo( const SMDS_MeshNode*, int, int, QTreeWidgetItem* );
239 void clearInternal();
242 void itemDoubleClicked( QTreeWidgetItem*, int );
243 void saveExpanded( QTreeWidgetItem* );
246 QTreeWidgetItem* createItem( QTreeWidgetItem* = 0, int = 0 );
247 QString expandedResource( QTreeWidgetItem* );
253 class InfoComputor: public QObject
258 enum { GrpSize, GrpNbNodes };
260 InfoComputor( QObject*, const SMESH::SelectionProxy&, int );
269 SMESH::SelectionProxy myProxy;
273 class SMESHGUI_EXPORT SMESHGUI_AddInfo : public SMESHGUI_Info
278 SMESHGUI_AddInfo( QWidget* = 0 );
281 void showInfo( const SMESH::SelectionProxy& );
283 void saveInfo( QTextStream& );
287 void showPreviousGroups();
288 void showNextGroups();
289 void showPreviousSubMeshes();
290 void showNextSubMeshes();
293 QTreeWidgetItem* createItem( QTreeWidgetItem* = 0, int = 0 );
294 void meshInfo( const SMESH::SelectionProxy&, QTreeWidgetItem* );
295 void subMeshInfo( const SMESH::SelectionProxy&, QTreeWidgetItem* );
296 void groupInfo( const SMESH::SelectionProxy&, QTreeWidgetItem* );
299 void showSubMeshes();
302 SMESH::SelectionProxy myProxy;
304 QList<InfoComputor*> myComputors;
305 QList<SMESH::SelectionProxy> myGroups;
306 QList<SMESH::SelectionProxy> mySubMeshes;
309 class SMESHGUI_EXPORT SMESHGUI_CtrlInfo : public SMESHGUI_Info
314 SMESHGUI_CtrlInfo( QWidget* = 0 );
315 ~SMESHGUI_CtrlInfo();
317 void showInfo( const SMESH::SelectionProxy& );
318 void saveInfo( QTextStream& );
321 enum ObjectType { Mesh, SubMesh, Group };
322 QwtPlot* createPlot( QWidget* );
323 void clearInternal();
324 #ifndef DISABLE_PLOT2DVIEWER
325 Plot2d_Histogram* getHistogram( SMESH::NumericalFunctor_ptr );
327 void computeNb( int, int, int );
330 void computeAspectRatio();
331 void computeAspectRatio3D();
332 void computeFreeNodesInfo();
333 void computeNodesNbConnInfo();
334 void computeDoubleNodesInfo();
335 void computeDoubleEdgesInfo();
336 void computeDoubleFacesInfo();
337 void computeOverConstrainedFacesInfo();
338 void computeDoubleVolumesInfo();
339 void computeOverConstrainedVolumesInfo();
340 void setTolerance( double );
343 typedef SALOME::GenericObj_wrap< SMESH::Predicate > TPredicate;
344 typedef SALOME::GenericObj_wrap< SMESH::NumericalFunctor > TNumFunctor;
345 SMESH::SelectionProxy myProxy;
346 ObjectType myObjectType;
347 SMESHGUI_SpinBox* myToleranceWidget;
348 QList<QLabel*> myWidgets;
352 QList<QAbstractButton*> myButtons;
353 QList<TPredicate> myPredicates;
354 TNumFunctor myAspectRatio, myAspectRatio3D, myNodeConnFunctor;
357 class SMESHGUI_EXPORT SMESHGUI_MeshInfoDlg : public QDialog
361 enum { NodeMode, ElemMode, GroupMode };
367 BaseInfo, //!< base mesh information
368 ElemInfo, //!< mesh element information
369 AddInfo, //!< additional information
370 CtrlInfo //!< controls information
373 SMESHGUI_MeshInfoDlg( QWidget* = 0, int = BaseInfo );
374 ~SMESHGUI_MeshInfoDlg();
376 void showInfo( const Handle(SALOME_InteractiveObject)& );
380 void keyPressEvent( QKeyEvent* );
383 void switchMode( int );
387 void updateSelection();
392 void idPreviewChange( bool );
393 void showItemInfo( int type, const QString& ids );
397 void showInfo( const SMESH::SelectionProxy& );
399 SMESH::SelectionProxy myProxy;
400 QTabWidget* myTabWidget;
401 SMESHGUI_BaseInfo* myBaseInfo;
402 SMESHGUI_ElemInfo* myElemInfo;
403 SMESHGUI_AddInfo* myAddInfo;
404 SMESHGUI_CtrlInfo* myCtrlInfo;
405 QButtonGroup* myMode;
407 QCheckBox* myIDPreviewCheck;
408 GroupCombo* myGroups;
409 SMESHGUI_IdPreview* myIDPreview;
412 class SMESHGUI_EXPORT SMESHGUI_CtrlInfoDlg : public QDialog
417 SMESHGUI_CtrlInfoDlg( QWidget* = 0 );
418 ~SMESHGUI_CtrlInfoDlg();
420 void showInfo( const Handle(SALOME_InteractiveObject)& );
426 void updateSelection();
431 void showInfo( const SMESH::SelectionProxy& );
433 SMESH::SelectionProxy myProxy;
434 SMESHGUI_CtrlInfo* myCtrlInfo;
437 #endif // SMESHGUI_MESHINFO_H