1 // Copyright (C) 2007-2010 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.
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
22 // File : SMESHGUI_MeshInfo.h
23 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
25 #ifndef SMESHGUI_MESHINFO_H
26 #define SMESHGUI_MESHINFO_H
28 #include "SMESH_SMESHGUI.hxx"
29 #include <SALOME_InteractiveObject.hxx>
37 #include <SALOMEconfig.h>
38 #include CORBA_SERVER_HEADER(SMESH_Mesh)
46 class QTreeWidgetItem;
49 class SMDS_MeshElement;
51 class SMESHGUI_EXPORT SMESHGUI_MeshInfo : public QFrame
61 iElementsStart = iNodesEnd,
93 typedef QList<QWidget*> wlist;
94 typedef QVector<wlist> iwlist;
97 SMESHGUI_MeshInfo( QWidget* = 0 );
100 void showInfo( SMESH::SMESH_IDSource_ptr );
104 enum { Bold = 0x01, Italic = 0x02 };
106 QLabel* createField();
107 QWidget* createLine();
108 void setFontAttributes( QWidget*, int, bool = true );
109 void setFieldsVisible( int, int, bool );
115 class SMESHGUI_EXPORT SMESHGUI_ElemInfo : public QWidget
120 SMESHGUI_ElemInfo( QWidget* = 0 );
121 ~SMESHGUI_ElemInfo();
123 void setSource( SMESH_Actor* );
124 virtual void showInfo( long, bool );
125 virtual void clear() = 0;
130 double myX, myY, myZ;
131 XYZ() { myX = myY = myZ = 0.0; }
132 void add( double x, double y, double z ) { myX += x; myY += y; myZ += z; }
133 void divide( double a ) { if ( a != 0.) { myX /= a; myY /= a; myZ /= a; } }
134 double x() const { return myX; }
135 double y() const { return myY; }
136 double z() const { return myZ; }
138 typedef QMap< int, QList<int> > Connectivity;
140 Connectivity nodeConnectivity( const SMDS_MeshNode* );
141 QString formatConnectivity( Connectivity, int );
142 XYZ gravityCenter( const SMDS_MeshElement* );
145 SMESH_Actor* myActor;
150 class SMESHGUI_EXPORT SMESHGUI_SimpleElemInfo : public SMESHGUI_ElemInfo
153 SMESHGUI_SimpleElemInfo( QWidget* = 0 );
155 void showInfo( long, bool );
159 QTextBrowser* myInfo;
162 class SMESHGUI_EXPORT SMESHGUI_TreeElemInfo : public SMESHGUI_ElemInfo
167 SMESHGUI_TreeElemInfo( QWidget* = 0 );
169 void showInfo( long, bool );
173 QTreeWidgetItem* createItem( QTreeWidgetItem* = 0, int = 100 );
179 class SMESHGUI_EXPORT SMESHGUI_MeshInfoDlg : public QDialog
183 enum { NodeMode, ElemMode };
188 BaseInfo, //!< base mesh information
189 ElemInfo //!< mesh element information
192 SMESHGUI_MeshInfoDlg( QWidget* = 0, int = BaseInfo );
193 ~SMESHGUI_MeshInfoDlg();
195 void showInfo( const Handle(SALOME_InteractiveObject)& );
199 void keyPressEvent( QKeyEvent* );
200 void enterEvent( QEvent* );
204 void updateSelection();
212 QTabWidget* myTabWidget;
213 SMESHGUI_MeshInfo* myBaseInfo;
214 QButtonGroup* myMode;
216 SMESHGUI_ElemInfo* myElemInfo;
217 SMESH_Actor* myActor;
220 #endif // SMESHGUI_MESHINFO_H