0022420: [CEA 1004] Take the "incremental limit check" into account at the first mesh display.

This commit is contained in:
akl 2014-09-08 16:36:41 +04:00 committed by vsr
parent 54ea8ad8bb
commit f5b69ee44c
16 changed files with 380 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

@ -9,4 +9,13 @@ edges or combine them.
\image html image58.gif Only Edges
If the mesh contains a lot of elements, select <b>Choose...</b> item,
\image html display_entity_choose_item.png Item to call 'Display Entity' dialog box
and <b>Display Entity</b> dialog box will provide a way to display only some entities at first display instead of displaying all entities long time.
\image html display_entity_dlg.png 'Display Entity' dialog allows to select entities before displaying
\note This menu item is available from popup menu in both Object browser and 3D viewer.
*/

View File

@ -33,7 +33,7 @@ viewer.</li>
<li>\subpage display_mode_page "Display Mode" - allows to select between
Wireframe, Shading and Nodes presentation.</li>
<li>\subpage display_entity_page "Display Entity" - allows to display
Faces, Edges or both.</li>
entities by types (Faces, Edges, Volumes etc.).</li>
<li><b>2D Quadratic</b> - allows to select between the representation
of quadratic edges as broken <b>lines</b> or as <b>arcs</b></li>
<li><b>Orientation of faces</b> - shows vectors of orientation of

View File

@ -34,6 +34,8 @@ SET(SMESH_RESOURCES_FILES
mesh_aspect_3d.png
mesh_biquad_quadrangle.png
mesh_biquad_triangle.png
mesh_choose.png
mesh_choose_all.png
mesh_clear.png
mesh_compute.png
mesh_diagonal.png

BIN
resources/mesh_choose.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 B

View File

@ -142,6 +142,7 @@ SET(_moc_HEADERS
SMESHGUI_PropertiesDlg.h
SMESHGUI_Add0DElemsOnAllNodesDlg.h
SMESHGUI_FieldSelectorWdg.h
SMESHGUI_DisplayEntitiesDlg.h
)
# header files / no moc processing
@ -249,6 +250,7 @@ SET(_other_SOURCES
SMESHGUI_MeshEditPreview.cxx
SMESHGUI_FileValidator.cxx
SMESHGUI_FieldSelectorWdg.cxx
SMESHGUI_DisplayEntitiesDlg.cxx
)
# sources / to compile

View File

@ -81,6 +81,7 @@
#include "SMESHGUI_SymmetryDlg.h"
#include "SMESHGUI_TranslationDlg.h"
#include "SMESHGUI_TransparencyDlg.h"
#include "SMESHGUI_DisplayEntitiesDlg.h"
#include "SMESHGUI_FilterUtils.h"
#include "SMESHGUI_GEOMGenUtils.h"
@ -2516,6 +2517,13 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
::SetDisplayEntity(theCommandID);
break;
// Choose entities to be displayed
case SMESHOp::OpDEChoose:
{
( new SMESHGUI_DisplayEntitiesDlg( SMESHGUI::desktop() ) )->exec();
break;
}
case SMESHOp::OpOrientationOnFaces:
{
LightApp_SelectionMgr* mgr = selectionMgr();
@ -3903,7 +3911,8 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( SMESHOp::OpDEFaces, "FACES", "ICON_DLG_TRIANGLE", 0, true );
createSMESHAction( SMESHOp::OpDEVolumes, "VOLUMES", "ICON_DLG_TETRAS", 0, true );
createSMESHAction( SMESHOp::OpDEBalls, "BALLS", "ICON_DLG_BALL", 0, true );
createSMESHAction( SMESHOp::OpDEAllEntity, "ALL" );
createSMESHAction( SMESHOp::OpDEChoose, "CHOOSE", "ICON_DLG_CHOOSE", 0, false );
createSMESHAction( SMESHOp::OpDEAllEntity, "ALL", "ICON_DLG_CHOOSE_ALL", 0, false );
createSMESHAction( SMESHOp::OpOrientationOnFaces, "FACE_ORIENTATION", "", 0, true );
createSMESHAction( SMESHOp::OpRepresentationLines, "LINE_REPRESENTATION", "", 0, true );
@ -4436,6 +4445,11 @@ void SMESHGUI::initialize( CAM_Application* app )
popupMgr()->insert( separator(), anId, -1 );
popupMgr()->insert( action( SMESHOp::OpDEChoose ), anId, -1 );
popupMgr()->setRule( action( SMESHOp::OpDEChoose ), aClient + "&&" + aType + "&&" + isNotEmpty, QtxPopupMgr::VisibleRule );
popupMgr()->insert( separator(), anId, -1 );
popupMgr()->insert( action( SMESHOp::OpDEAllEntity ), anId, -1 );
popupMgr()->setRule( action( SMESHOp::OpDEAllEntity ), aDiffElemsInVTK + "&& isVisible && not( elemTypes in entityMode )", QtxPopupMgr::VisibleRule );

View File

@ -0,0 +1,247 @@
// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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, or (at your option) any later version.
//
// 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_DisplayEntitiesDlg.cxx
// Author : Alexander KOVALEV, Open CASCADE S.A.S. (alexander.kovalev@opencascade.com)
#include "SMESHGUI_DisplayEntitiesDlg.h"
#include "SMESHGUI.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_MeshUtils.h"
#include <QLabel>
#include <QGroupBox>
#include <QGridLayout>
#include <QVBoxLayout>
#include <QCheckBox>
#include <SUIT_Session.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SALOME_ListIteratorOfListIO.hxx>
const int MARGIN = 9;
const int SPACING = 6;
/*!
\class SMESHGUI_DisplayEntitiesDlg
\brief Dialog box to select entities to be displayed in viewer
*/
/*
\brief Constructor
\param parent parent widget
*/
SMESHGUI_DisplayEntitiesDlg::SMESHGUI_DisplayEntitiesDlg( QWidget* parent )
: SMESHGUI_Dialog( parent, true, false, Standard )
{
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
LightApp_SelectionMgr* mgr = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
mgr->selectedObjects( selected );
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_nil();
myActor = 0;
myNbCheckedButtons = 0;
SALOME_ListIteratorOfListIO it( selected );
myIObject = selected.First();
if ( myIObject->hasEntry() ) {
myActor = SMESH::FindActorByEntry( myIObject->getEntry() );
}
myEntityMode = myActor ? myActor->GetEntityMode() : 0;
aMesh = SMESH::GetMeshByIO( myIObject );
// set title
setWindowTitle( tr( "MEN_DISP_ENT" ) );
// create widgets
QGroupBox* anEntitiesGrp = new QGroupBox( tr( "SMESH_MESHINFO_ENTITIES" ), mainFrame() );
QGridLayout* hl = new QGridLayout( anEntitiesGrp );
hl->setMargin( MARGIN );
hl->setSpacing( SPACING );
int nbElements;
// 0DElements
nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_0DElement ) : aMesh->Nb0DElements();
my0DElemsTB = new QCheckBox( tr("SMESH_ELEMS0D"), anEntitiesGrp );
my0DElemsTB->setIcon( QIcon( aResMgr->loadPixmap( "SMESH", tr( "ICON_DLG_ELEM0D" ) ) ) );
bool has0DElems = myEntityMode & SMESH_Actor::e0DElements;
my0DElemsTB->setChecked( has0DElems );
if ( has0DElems )
myNbCheckedButtons++;
connect( my0DElemsTB, SIGNAL(toggled(bool)), this, SLOT(onChangeEntityMode(bool)) );
QLabel* nb0DElemsLab = new QLabel( QString("%1").arg(nbElements).toLatin1().data(), anEntitiesGrp );
hl->addWidget( my0DElemsTB, 0, 0 );
hl->addWidget( nb0DElemsLab, 0, 1 );
my0DElemsTB->setEnabled( nbElements );
nb0DElemsLab->setEnabled( nbElements );
// Edges
nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Edge ) : aMesh->NbEdges();
myEdgesTB = new QCheckBox( tr("SMESH_EDGES"), anEntitiesGrp );
myEdgesTB->setIcon( QIcon( aResMgr->loadPixmap( "SMESH", tr( "ICON_DLG_EDGE" ) ) ) );
bool hasEdges = myEntityMode & SMESH_Actor::eEdges;
myEdgesTB->setChecked( hasEdges );
if ( hasEdges )
myNbCheckedButtons++;
connect( myEdgesTB, SIGNAL(toggled(bool)), this, SLOT(onChangeEntityMode(bool)) );
QLabel* nbEdgesLab = new QLabel( QString("%1").arg(nbElements).toLatin1().data(), anEntitiesGrp );
hl->addWidget( myEdgesTB, 1, 0 );
hl->addWidget( nbEdgesLab, 1, 1 );
myEdgesTB->setEnabled( nbElements );
nbEdgesLab->setEnabled( nbElements );
// Faces
nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Face ) : aMesh->NbFaces();
myFacesTB = new QCheckBox( tr("SMESH_FACES"), anEntitiesGrp );
myFacesTB->setIcon( QIcon( aResMgr->loadPixmap( "SMESH", tr( "ICON_DLG_TRIANGLE" ) ) ) );
bool hasFaces = myEntityMode & SMESH_Actor::eFaces;
myFacesTB->setChecked( hasFaces );
if ( hasFaces )
myNbCheckedButtons++;
connect( myFacesTB, SIGNAL(toggled(bool)), this, SLOT(onChangeEntityMode(bool)) );
QLabel* nbFacesLab = new QLabel( QString("%1").arg(nbElements).toLatin1().data(), anEntitiesGrp );
hl->addWidget( myFacesTB, 2, 0 );
hl->addWidget( nbFacesLab, 2, 1 );
myFacesTB->setEnabled( nbElements );
nbFacesLab->setEnabled( nbElements );
// Volumes
nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Volume ) : aMesh->NbVolumes();
myVolumesTB = new QCheckBox( tr("SMESH_VOLUMES"), anEntitiesGrp );
myVolumesTB->setIcon( QIcon( aResMgr->loadPixmap( "SMESH", tr( "ICON_DLG_TETRAS" ) ) ) );
bool hasVolumes = myEntityMode & SMESH_Actor::eVolumes;
myVolumesTB->setChecked( hasVolumes );
if ( hasVolumes )
myNbCheckedButtons++;
connect( myVolumesTB, SIGNAL(toggled(bool)), this, SLOT(onChangeEntityMode(bool) ) );
QLabel* nbVolumesLab = new QLabel( QString("%1").arg(nbElements).toLatin1().data(), anEntitiesGrp );
hl->addWidget( myVolumesTB, 3, 0 );
hl->addWidget( nbVolumesLab, 3, 1 );
myVolumesTB->setEnabled( nbElements );
nbVolumesLab->setEnabled( nbElements );
// Balls
nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Ball ) : aMesh->NbBalls();
myBallsTB = new QCheckBox( tr("SMESH_BALLS"), anEntitiesGrp );
myBallsTB->setIcon( QIcon( aResMgr->loadPixmap( "SMESH", tr( "ICON_DLG_BALL" ) ) ) );
bool hasBalls = myEntityMode & SMESH_Actor::eBallElem;
myBallsTB->setChecked( hasBalls );
if ( hasBalls )
myNbCheckedButtons++;
connect( myBallsTB, SIGNAL(toggled(bool)), this, SLOT(onChangeEntityMode(bool)) );
QLabel* nbBallsLab = new QLabel( QString("%1").arg(nbElements).toLatin1().data(), anEntitiesGrp );
hl->addWidget( myBallsTB, 4, 0 );
hl->addWidget( nbBallsLab, 4, 1 );
myBallsTB->setEnabled( nbElements );
nbBallsLab->setEnabled( nbElements );
QVBoxLayout* aDlgLay = new QVBoxLayout( mainFrame() );
aDlgLay->setMargin( 0 );
aDlgLay->setSpacing( SPACING );
aDlgLay->addWidget( anEntitiesGrp );
button( OK )->setText( tr( "SMESH_BUT_OK" ) );
connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
connect( this, SIGNAL( dlgOk() ), this, SLOT( onOk() ) );
}
/*
\brief Destructor: clean-up resources if necessary
*/
SMESHGUI_DisplayEntitiesDlg::~SMESHGUI_DisplayEntitiesDlg()
{
}
void SMESHGUI_DisplayEntitiesDlg::InverseEntityMode(unsigned int& theOutputMode,
unsigned int theMode)
{
bool anIsNotPresent = ~theOutputMode & theMode;
if(anIsNotPresent)
theOutputMode |= theMode;
else
theOutputMode &= ~theMode;
}
/*!
\brief Slot for changing entities state
*/
void SMESHGUI_DisplayEntitiesDlg::onChangeEntityMode( bool isChecked )
{
QCheckBox* aSender = (QCheckBox*)sender();
if ( myNbCheckedButtons == 1 && !isChecked ) {
SUIT_MessageBox::warning(this, tr("SMESH_WRN_WARNING"),
tr("WRN_AT_LEAST_ONE"));
disconnect( aSender, SIGNAL(toggled(bool)), this, SLOT(onChangeEntityMode(bool)) );
aSender->setChecked( true );
connect( aSender, SIGNAL(toggled(bool)), this, SLOT(onChangeEntityMode(bool)) );
return;
}
if ( my0DElemsTB == aSender )
InverseEntityMode( myEntityMode, SMESH_Actor::e0DElements );
else if ( myEdgesTB == aSender )
InverseEntityMode( myEntityMode, SMESH_Actor::eEdges );
else if ( myFacesTB == aSender )
InverseEntityMode( myEntityMode, SMESH_Actor::eFaces );
else if ( myVolumesTB == aSender )
InverseEntityMode( myEntityMode, SMESH_Actor::eVolumes );
else if ( myBallsTB == aSender )
InverseEntityMode( myEntityMode, SMESH_Actor::eBallElem );
isChecked ? myNbCheckedButtons++ : myNbCheckedButtons--;
}
/*!
\brief Show online help on dialog box
*/
void SMESHGUI_DisplayEntitiesDlg::onHelp()
{
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
app->onHelpContextModule( "SMESH", "display_entity_page.html" );
}
/*!
\brief Display or update the mesh in the 3D view with selected entity mode
*/
void SMESHGUI_DisplayEntitiesDlg::onOk()
{
const char* entry = myIObject->getEntry();
if ( !myActor ) {
myActor = SMESH::CreateActor(SMESH::GetActiveStudyDocument(),
entry, true);
}
if( myEntityMode != myActor->GetEntityMode() ) {
myActor->SetEntityMode(myEntityMode);
SUIT_ViewWindow* wnd = SMESH::GetActiveWindow();
SMESH::DisplayActor( wnd, myActor );
SUIT_DataOwnerPtrList aList;
aList.append( new LightApp_DataOwner( entry ) );
SMESHGUI::selectionMgr()->setSelected( aList, false );
SMESH::UpdateView( wnd, SMESH::eDisplay, entry );
}
}

View File

@ -0,0 +1,61 @@
// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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, or (at your option) any later version.
//
// 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_DisplayEntitiesDlg.h
// Author : Alexander KOVALEV, Open CASCADE S.A.S. (alexander.kovalev@opencascade.com)
#ifndef SMESHGUI_DISPLAYENTITIES_H
#define SMESHGUI_DISPLAYENTITIES_H
#include "SMESHGUI_Dialog.h"
#include "SMESH_SMESHGUI.hxx"
#include <SMESH_Actor.h>
class QCheckBox;
class SMESHGUI_EXPORT SMESHGUI_DisplayEntitiesDlg : public SMESHGUI_Dialog
{
Q_OBJECT
public:
SMESHGUI_DisplayEntitiesDlg( QWidget* parent );
~SMESHGUI_DisplayEntitiesDlg();
private:
void InverseEntityMode( unsigned int& theOutputMode,
unsigned int theMode );
private slots:
void onOk();
void onHelp();
void onChangeEntityMode( bool isChecked );
private:
Handle(SALOME_InteractiveObject) myIObject;
unsigned int myEntityMode;
SMESH_Actor *myActor;
int myNbCheckedButtons;
QCheckBox* my0DElemsTB;
QCheckBox* myEdgesTB;
QCheckBox* myFacesTB;
QCheckBox* myVolumesTB;
QCheckBox* myBallsTB;
};
#endif // SMESHGUI_DISPLAYENTITIES_H

View File

@ -200,7 +200,8 @@ namespace SMESHOp {
OpDEFaces = 6042, // POPUP MENU - DISPLAY ENTITY - FACES
OpDEVolumes = 6043, // POPUP MENU - DISPLAY ENTITY - VOLUMES
OpDEBalls = 6044, // POPUP MENU - DISPLAY ENTITY - BALLS
OpDEAllEntity = 6045, // POPUP MENU - DISPLAY ENTITY - ALL ENTITY
OpDEAllEntity = 6045, // POPUP MENU - DISPLAY ENTITY - ALL ENTITIES
OpDEChoose = 6046, // POPUP MENU - DISPLAY ENTITY - CHOOSE ENTITIES
// Representation -----------------//--------------------------------
OpRepresentationLines = 6050, // POPUP MENU - 2D QUADRATIC - LINES
OpRepresentationArcs = 6051, // POPUP MENU - 2D QUADRATIC - ARCS

View File

@ -255,6 +255,14 @@
<source>ICON_DLG_TRIANGLE</source>
<translation>mesh_triangle.png</translation>
</message>
<message>
<source>ICON_DLG_CHOOSE</source>
<translation>mesh_choose.png</translation>
</message>
<message>
<source>ICON_DLG_CHOOSE_ALL</source>
<translation>mesh_choose_all.png</translation>
</message>
<message>
<source>ICON_EDIT_GROUP</source>
<translation>mesh_edit_group.png</translation>

View File

@ -396,6 +396,10 @@
<source>MEN_EDGES</source>
<translation>Edges</translation>
</message>
<message>
<source>MEN_CHOOSE</source>
<translation>Choose...</translation>
</message>
<message>
<source>MEN_EDIT</source>
<translation>Edit</translation>
@ -7805,4 +7809,11 @@ as they are of improper type:
<translation>Shrink coef:</translation>
</message>
</context>
<context>
<name>SMESHGUI_DisplayEntitiesDlg</name>
<message>
<source>WRN_AT_LEAST_ONE</source>
<translation>At least one entity type should be chosen!</translation>
</message>
</context>
</TS>

View File

@ -396,6 +396,10 @@
<source>MEN_EDGES</source>
<translation>Arêtes</translation>
</message>
<message>
<source>MEN_CHOOSE</source>
<translation type="unfinished">Choose...</translation>
</message>
<message>
<source>MEN_EDIT</source>
<translation>Edition</translation>
@ -7753,4 +7757,11 @@ en raison de leurs types incompatibles:
<translation>Coef de réduction:</translation>
</message>
</context>
<context>
<name>SMESHGUI_DisplayEntitiesDlg</name>
<message>
<source>WRN_AT_LEAST_ONE</source>
<translation type="unfinished">At least one entity type should be chosen!</translation>
</message>
</context>
</TS>

View File

@ -395,6 +395,10 @@
<source>MEN_EDGES</source>
<translation></translation>
</message>
<message>
<source>MEN_CHOOSE</source>
<translation type="unfinished">Choose...</translation>
</message>
<message>
<source>MEN_EDIT</source>
<translation>(&amp;E)</translation>
@ -7687,4 +7691,11 @@
<translation>:</translation>
</message>
</context>
<context>
<name>SMESHGUI_DisplayEntitiesDlg</name>
<message>
<source>WRN_AT_LEAST_ONE</source>
<translation type="unfinished">At least one entity type should be chosen!</translation>
</message>
</context>
</TS>