PAL20885 EDF 607 SMESH: Measure tools

Improve mesh information dialog boxes
This commit is contained in:
vsr 2010-10-28 19:55:28 +00:00
parent 53f24eefb2
commit 1cd7b4a0c0
8 changed files with 1542 additions and 36 deletions

View File

@ -47,9 +47,7 @@ salomeinclude_HEADERS = \
SMESHGUI_GroupDlg.h \
SMESHGUI_RemoveNodesDlg.h \
SMESHGUI_RemoveElementsDlg.h \
SMESHGUI_MeshInfosDlg.h \
SMESHGUI_StandardMeshInfosDlg.h \
SMESHGUI_WhatIsDlg.h \
SMESHGUI_MeshInfo.h \
SMESHGUI_Preferences_ColorDlg.h \
SMESHGUI_Preferences_ScalarBarDlg.h \
SMESHGUI_AddMeshElementDlg.h \
@ -111,9 +109,7 @@ dist_libSMESH_la_SOURCES = \
SMESHGUI_GroupDlg.cxx \
SMESHGUI_RemoveNodesDlg.cxx \
SMESHGUI_RemoveElementsDlg.cxx \
SMESHGUI_MeshInfosDlg.cxx \
SMESHGUI_StandardMeshInfosDlg.cxx \
SMESHGUI_WhatIsDlg.cxx \
SMESHGUI_MeshInfo.cxx \
SMESHGUI_Preferences_ColorDlg.cxx \
SMESHGUI_Preferences_ScalarBarDlg.cxx \
SMESHGUI_AddMeshElementDlg.cxx \
@ -183,9 +179,7 @@ MOC_FILES = \
SMESHGUI_GroupDlg_moc.cxx \
SMESHGUI_RemoveNodesDlg_moc.cxx \
SMESHGUI_RemoveElementsDlg_moc.cxx \
SMESHGUI_MeshInfosDlg_moc.cxx \
SMESHGUI_StandardMeshInfosDlg_moc.cxx \
SMESHGUI_WhatIsDlg_moc.cxx \
SMESHGUI_MeshInfo_moc.cxx \
SMESHGUI_Preferences_ColorDlg_moc.cxx \
SMESHGUI_Preferences_ScalarBarDlg_moc.cxx \
SMESHGUI_AddMeshElementDlg_moc.cxx \

View File

@ -48,7 +48,8 @@
#include "SMESHGUI_Hypotheses.h"
#include "SMESHGUI_Make2DFrom3DOp.h"
#include "SMESHGUI_MakeNodeAtPointDlg.h"
#include "SMESHGUI_MeshInfosDlg.h"
//#include "SMESHGUI_MeshInfosDlg.h"
#include "SMESHGUI_MeshInfo.h"
#include "SMESHGUI_MeshOp.h"
#include "SMESHGUI_MeshOrderOp.h"
#include "SMESHGUI_MeshPatternDlg.h"
@ -65,12 +66,12 @@
#include "SMESHGUI_SewingDlg.h"
#include "SMESHGUI_SingleEditDlg.h"
#include "SMESHGUI_SmoothingDlg.h"
#include "SMESHGUI_StandardMeshInfosDlg.h"
//#include "SMESHGUI_StandardMeshInfosDlg.h"
#include "SMESHGUI_SymmetryDlg.h"
#include "SMESHGUI_TranslationDlg.h"
#include "SMESHGUI_ScaleDlg.h"
#include "SMESHGUI_TransparencyDlg.h"
#include "SMESHGUI_WhatIsDlg.h"
//#include "SMESHGUI_WhatIsDlg.h"
#include "SMESHGUI_DuplicateNodesDlg.h"
#include "SMESHGUI_Utils.h"
@ -2369,7 +2370,9 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
}
case 900: // MESH INFOS
case 903: // WHAT IS
{
int page = theCommandID == 900 ? SMESHGUI_MeshInfoDlg::BaseInfo : SMESHGUI_MeshInfoDlg::ElemInfo;
EmitSignalDeactivateDialog();
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
@ -2377,21 +2380,20 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
aSel->selectedObjects( selected );
if ( selected.Extent() > 1 ) { // a dlg for each IO
SALOME_ListIO IOs;
SALOME_ListIteratorOfListIO It (selected);
SALOME_ListIteratorOfListIO It( selected );
for ( ; It.More(); It.Next() ) {
IOs.Clear(); IOs.Append( It.Value() );
aSel->setSelectedObjects( IOs );
( new SMESHGUI_MeshInfosDlg( this ) )->show();
SMESHGUI_MeshInfoDlg* dlg = new SMESHGUI_MeshInfoDlg( SMESHGUI::desktop(), page );
dlg->showInfo( It.Value() );
dlg->show();
}
// restore selection
aSel->setSelectedObjects( selected );
}
else
( new SMESHGUI_MeshInfosDlg( this ) )->show();
else {
SMESHGUI_MeshInfoDlg* dlg = new SMESHGUI_MeshInfoDlg( SMESHGUI::desktop(), page );
dlg->show();
}
break;
}
/*
case 902: // STANDARD MESH INFOS
{
EmitSignalDeactivateDialog();
@ -2416,13 +2418,13 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
( new SMESHGUI_StandardMeshInfosDlg( this ) )->show();
break;
}
case 903: // WHAT IS
{
EmitSignalDeactivateDialog();
( new SMESHGUI_WhatIsDlg( this ) )->show();
break;
}
*/
case 904: // FIND ELEM
{
@ -3143,7 +3145,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( 814, "UNDERLYING_ELEMS","ICON_UNDERLYING_ELEMS" );
createSMESHAction( 813, "DEL_GROUP", "ICON_DEL_GROUP" );
createSMESHAction( 900, "ADV_INFO", "ICON_ADV_INFO" );
createSMESHAction( 902, "STD_INFO", "ICON_STD_INFO" );
//createSMESHAction( 902, "STD_INFO", "ICON_STD_INFO" );
createSMESHAction( 903, "WHAT_IS", "ICON_WHAT_IS" );
createSMESHAction( 904, "FIND_ELEM", "ICON_FIND_ELEM" );
createSMESHAction( 6001, "LENGTH", "ICON_LENGTH", 0, true );
@ -3306,7 +3308,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createMenu( 813, meshId, -1 );
createMenu( separator(), meshId, -1 );
createMenu( 900, meshId, -1 );
createMenu( 902, meshId, -1 );
//createMenu( 902, meshId, -1 );
createMenu( 903, meshId, -1 );
createMenu( 904, meshId, -1 );
createMenu( separator(), meshId, -1 );
@ -3407,7 +3409,7 @@ void SMESHGUI::initialize( CAM_Application* app )
//createTool( 815, meshTb );
createTool( separator(), meshTb );
createTool( 900, meshTb );
createTool( 902, meshTb );
//createTool( 902, meshTb );
createTool( 903, meshTb );
createTool( 904, meshTb );
createTool( separator(), meshTb );
@ -3540,7 +3542,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createPopupItem( 713, OB, mesh, "&& isComputable" ); // MESH ORDER
createPopupItem( 214, OB, mesh_group ); // UPDATE
createPopupItem( 900, OB, mesh_group ); // ADV_INFO
createPopupItem( 902, OB, mesh ); // STD_INFO
//createPopupItem( 902, OB, mesh ); // STD_INFO
createPopupItem( 903, OB, mesh_group ); // WHAT_IS
createPopupItem( 904, OB, mesh_group ); // FIND_ELEM
popupMgr()->insert( separator(), -1, 0 );
@ -3576,7 +3578,7 @@ void SMESHGUI::initialize( CAM_Application* app )
popupMgr()->insert( separator(), -1, 0 );
createPopupItem( 214, View, mesh_group ); // UPDATE
createPopupItem( 900, View, mesh_group ); // ADV_INFO
createPopupItem( 902, View, mesh ); // STD_INFO
//createPopupItem( 902, View, mesh ); // STD_INFO
createPopupItem( 903, View, mesh_group ); // WHAT_IS
createPopupItem( 904, View, mesh_group ); // FIND_ELEM
popupMgr()->insert( separator(), -1, 0 );

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,211 @@
// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SMESHGUI_MeshInfo.h
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
#ifndef SMESHGUI_MESHINFO_H
#define SMESHGUI_MESHINFO_H
#include "SMESH_SMESHGUI.hxx"
#include <SALOME_InteractiveObject.hxx>
#include <QFrame>
#include <QDialog>
#include <QList>
#include <QMap>
#include <QVector>
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Mesh)
class QButtonGroup;
class QLabel;
class QLineEdit;
class QTabWidget;
class QTextBrowser;
class SMESH_Actor;
class SMDS_MeshNode;
class SMDS_MeshElement;
class SMESHGUI_EXPORT SMESHGUI_MeshInfo : public QFrame
{
Q_OBJECT;
enum {
iName,
iObject,
iNodesStart,
iNodes,
iNodesEnd,
iElementsStart = iNodesEnd,
iElements,
i0DStart,
i0D,
i0DEnd,
i1DStart = i0DEnd,
i1D,
i1DEnd,
i2DStart = i1DEnd,
i2D,
i2DTriangles,
i2DQuadrangles,
i2DPolygons,
i2DEnd,
i3DStart = i2DEnd,
i3D,
i3DTetrahedrons,
i3DHexahedrons,
i3DPyramids,
i3DPrisms,
i3DPolyhedrons,
i3DEnd,
iElementsEnd = i3DEnd
};
enum {
iSingle = 1,
iTotal = iSingle,
iLinear,
iQuadratic
};
typedef QList<QWidget*> wlist;
typedef QVector<wlist> iwlist;
public:
SMESHGUI_MeshInfo( QWidget* = 0 );
~SMESHGUI_MeshInfo();
void showInfo( SMESH::SMESH_IDSource_ptr );
void clear();
private:
enum { Bold = 0x01, Italic = 0x02 };
QLabel* createField();
QWidget* createLine();
void setFontAttributes( QWidget*, int, bool = true );
void setFieldsVisible( int, int, bool );
private:
iwlist myWidgets;
};
class SMESHGUI_EXPORT SMESHGUI_ElemInfo : public QWidget
{
Q_OBJECT;
public:
SMESHGUI_ElemInfo( QWidget* = 0 );
~SMESHGUI_ElemInfo();
void setSource( SMESH_Actor* );
virtual void showInfo( long, bool ) = 0;
virtual void clear() = 0;
protected:
struct XYZ
{
double myX, myY, myZ;
XYZ() { myX = myY = myZ = 0.0; }
void add( double x, double y, double z ) { myX += x; myY += y; myZ += z; }
void divide( double a ) { if ( a != 0.) { myX /= a; myY /= a; myZ /= a; } }
double x() const { return myX; }
double y() const { return myY; }
double z() const { return myZ; }
};
typedef QMap< int, QList<int> > Connectivity;
Connectivity nodeConnectivity( const SMDS_MeshNode* );
XYZ gravityCenter( const SMDS_MeshElement* );
protected:
SMESH_Actor* myActor;
};
class SMESHGUI_EXPORT SMESHGUI_SimpleElemInfo : public SMESHGUI_ElemInfo
{
public:
SMESHGUI_SimpleElemInfo( QWidget* = 0 );
void showInfo( long, bool );
void clear();
protected:
QString formatConnectivity( Connectivity, int );
private:
QTextBrowser* myInfo;
};
class SMESHGUI_EXPORT SMESHGUI_TreeElemInfo : public SMESHGUI_ElemInfo
{
public:
SMESHGUI_TreeElemInfo( QWidget* = 0 );
void showInfo( long, bool );
void clear();
};
class SMESHGUI_EXPORT SMESHGUI_MeshInfoDlg : public QDialog
{
Q_OBJECT;
enum { NodeMode, ElemMode };
public:
//! Information type
enum {
BaseInfo, //!< base mesh information
ElemInfo //!< mesh element information
};
SMESHGUI_MeshInfoDlg( QWidget* = 0, int = BaseInfo );
~SMESHGUI_MeshInfoDlg();
void showInfo( const Handle(SALOME_InteractiveObject)& );
void reject();
protected:
void keyPressEvent( QKeyEvent* );
void enterEvent( QEvent* );
private slots:
void help();
void updateSelection();
void updateInfo();
void activate();
void deactivate();
void modeChanged();
void idChanged();
private:
QTabWidget* myTabWidget;
SMESHGUI_MeshInfo* myBaseInfo;
QButtonGroup* myMode;
QLineEdit* myID;
SMESHGUI_ElemInfo* myElemInfo;
SMESH_Actor* myActor;
};
#endif // SMESHGUI_MESHINFO_H

View File

@ -205,6 +205,20 @@ namespace SMESH
return SObjectToObject(theSObject,aStudy);
}
_PTR(SObject) ObjectToSObject( CORBA::Object_ptr theObject )
{
_PTR(SObject) res;
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>
(SUIT_Session::session()->activeApplication());
if ( app ) {
QString IOR = app->orb()->object_to_string( theObject );
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
if ( study && !IOR.isEmpty() )
res = study->studyDS()->FindObjectIOR( IOR.toLatin1().constData() );
}
return res;
}
CORBA::Object_var IObjectToObject (const Handle(SALOME_InteractiveObject)& theIO)
{
if (!theIO.IsNull()) {

View File

@ -129,6 +129,9 @@ SMESHGUI_EXPORT
return TInterface::_nil();
}
SMESHGUI_EXPORT
_PTR(SObject) ObjectToSObject( CORBA::Object_ptr );
SMESHGUI_EXPORT
CORBA::Object_var IObjectToObject( const Handle(SALOME_InteractiveObject)& );

View File

@ -463,7 +463,7 @@
</message>
<message>
<source>ICON_WHAT_IS</source>
<translation>mesh_whatis.png</translation>
<translation>mesh_elem_info.png</translation>
</message>
<message>
<source>ICON_WIRE</source>

View File

@ -157,7 +157,7 @@
</message>
<message>
<source>MEN_ADV_INFO</source>
<translation>Advanced Mesh Infos</translation>
<translation>Mesh Information</translation>
</message>
<message>
<source>MEN_ALL</source>
@ -761,7 +761,7 @@
</message>
<message>
<source>MEN_WHAT_IS</source>
<translation>Mesh Element Info</translation>
<translation>Mesh Element Information</translation>
</message>
<message>
<source>MEN_WIRE</source>
@ -2178,7 +2178,7 @@ Consider saving your work before application crash</translation>
</message>
<message>
<source>STB_ADV_INFO</source>
<translation>Advanced Mesh Infos</translation>
<translation>Show base information about the mesh object</translation>
</message>
<message>
<source>STB_ALL</source>
@ -2674,7 +2674,7 @@ Consider saving your work before application crash</translation>
</message>
<message>
<source>STB_WHAT_IS</source>
<translation>Mesh Element Info</translation>
<translation>Show information about the mesh node or element</translation>
</message>
<message>
<source>STB_WIRE</source>
@ -2710,7 +2710,7 @@ Consider saving your work before application crash</translation>
</message>
<message>
<source>TOP_ADV_INFO</source>
<translation>Advanced Mesh Infos</translation>
<translation>Mesh Information</translation>
</message>
<message>
<source>TOP_ALL</source>
@ -3206,7 +3206,7 @@ Consider saving your work before application crash</translation>
</message>
<message>
<source>TOP_WHAT_IS</source>
<translation>Mesh Element Info</translation>
<translation>Mesh Element Information</translation>
</message>
<message>
<source>TOP_WIRE</source>
@ -5368,4 +5368,245 @@ It is impossible to read point coordinates from file</translation>
<translation>Construct group with newly created elements</translation>
</message>
</context>
<context>
<name>SMESHGUI_MeshInfo</name>
<message>
<source>NAME_LAB</source>
<translation>Name:</translation>
</message>
<message>
<source>OBJECT_LAB</source>
<translation>Object:</translation>
</message>
<message>
<source>NODES_LAB</source>
<translation>Nodes:</translation>
</message>
<message>
<source>ELEMENTS_LAB</source>
<translation>Elements:</translation>
</message>
<message>
<source>TOTAL_LAB</source>
<translation>Total</translation>
</message>
<message>
<source>LINEAR_LAB</source>
<translation>Linear</translation>
</message>
<message>
<source>QUADRATIC_LAB</source>
<translation>Quadratic</translation>
</message>
<message>
<source>0D_LAB</source>
<translation>0D:</translation>
</message>
<message>
<source>1D_LAB</source>
<translation>1D (edges):</translation>
</message>
<message>
<source>2D_LAB</source>
<translation>2D (faces):</translation>
</message>
<message>
<source>TRIANGLES_LAB</source>
<translation>Triangles:</translation>
</message>
<message>
<source>QUADRANGLES_LAB</source>
<translation>Quadrandgles:</translation>
</message>
<message>
<source>POLYGONS_LAB</source>
<translation>Polygons:</translation>
</message>
<message>
<source>3D_LAB</source>
<translation>3D (volumes):</translation>
</message>
<message>
<source>TETRAHEDRONS_LAB</source>
<translation>Tetrahedrons:</translation>
</message>
<message>
<source>HEXAHEDONRS_LAB</source>
<translation>Hexahedrons:</translation>
</message>
<message>
<source>PYRAMIDS_LAB</source>
<translation>Pyramids:</translation>
</message>
<message>
<source>PRISMS_LAB</source>
<translation>Prisms:</translation>
</message>
<message>
<source>POLYHEDRONS_LAB</source>
<translation>Polyhedrons:</translation>
</message>
<message>
<source>OBJECT_MESH</source>
<translation>Mesh</translation>
</message>
<message>
<source>OBJECT_SUBMESH</source>
<translation>Sub-mesh</translation>
</message>
<message>
<source>OBJECT_GROUP</source>
<translation>Group</translation>
</message>
<message>
<source>OBJECT_GROUP_NODES</source>
<translation>Group of nodes</translation>
</message>
<message>
<source>OBJECT_GROUP_EDGES</source>
<translation>Group of edges</translation>
</message>
<message>
<source>OBJECT_GROUP_FACES</source>
<translation>Group of faces</translation>
</message>
<message>
<source>OBJECT_GROUP_VOLUMES</source>
<translation>Group of volumes</translation>
</message>
<message>
<source>OBJECT_GROUP_0DELEMS</source>
<translation>Group of 0D elements</translation>
</message>
</context>
<context>
<name>SMESHGUI_MeshInfoDlg</name>
<message>
<source>MESH_INFO</source>
<translation>Mesh Information</translation>
</message>
<message>
<source>BASE_INFO</source>
<translation>Base Info</translation>
</message>
<message>
<source>ELEM_INFO</source>
<translation>Element Info</translation>
</message>
<message>
<source>NODE_MODE</source>
<translation>Node</translation>
</message>
<message>
<source>ELEM_MODE</source>
<translation>Element</translation>
</message>
</context>
<context>
<name>SMESHGUI_ElemInfo</name>
<message>
<source>COORDINATES</source>
<translation>COORDINATES</translation>
</message>
<message>
<source>CONNECTIVITY</source>
<translation>CONNECTIVITY</translation>
</message>
<message>
<source>GRAVITY_CENTER</source>
<translation>GRAVITY CENTER</translation>
</message>
<message>
<source>NODE</source>
<translation>NODE</translation>
</message>
<message>
<source>0D_ELEMENT</source>
<translation>0D ELEMENT</translation>
</message>
<message>
<source>0D_ELEMENTS</source>
<translation>0D ELEMENTS</translation>
</message>
<message>
<source>EDGE</source>
<translation>EDGE</translation>
</message>
<message>
<source>EDGES</source>
<translation>EDGES</translation>
</message>
<message>
<source>FACE</source>
<translation>FACE</translation>
</message>
<message>
<source>FACES</source>
<translation>FACES</translation>
</message>
<message>
<source>VOLUME</source>
<translation>VOLUME</translation>
</message>
<message>
<source>VOLUMES</source>
<translation>VOLUMES</translation>
</message>
<message>
<source>FREE_NODE</source>
<translation>Free node (no connectivity)</translation>
</message>
<message>
<source>TYPE</source>
<translation>TYPE</translation>
</message>
<message>
<source>TRIANGLE</source>
<translation>Triangle</translation>
</message>
<message>
<source>QUADRANGLE</source>
<translation>Quadrangle</translation>
</message>
<message>
<source>POLYGON</source>
<translation>Polygon</translation>
</message>
<message>
<source>TETRAHEDRON</source>
<translation>Tetrahedron</translation>
</message>
<message>
<source>HEXAHEDRON</source>
<translation>Hexahedron</translation>
</message>
<message>
<source>PYRAMID</source>
<translation>Pyramid</translation>
</message>
<message>
<source>PRISM</source>
<translation>Prism</translation>
</message>
<message>
<source>POLYHEDRON</source>
<translation>Polyhedron</translation>
</message>
<message>
<source>QUADRATIC</source>
<translation>QUADRATIC</translation>
</message>
<message>
<source>YES</source>
<translation>Yes</translation>
</message>
<message>
<source>NO</source>
<translation>No</translation>
</message>
<message>
<source>GRAVITY_CENTER</source>
<translation>GRAVITY CENTER</translation>
</message>
</context>
</TS>