From f5b69ee44c7918a89e5fd9d21d3bd2a10a724b5d Mon Sep 17 00:00:00 2001 From: akl Date: Mon, 8 Sep 2014 16:36:41 +0400 Subject: [PATCH] 0022420: [CEA 1004] Take the "incremental limit check" into account at the first mesh display. --- .../images/display_entity_choose_item.png | Bin 0 -> 2186 bytes .../gui/SMESH/images/display_entity_dlg.png | Bin 0 -> 6216 bytes doc/salome/gui/SMESH/input/display_entity.doc | 9 + .../SMESH/input/viewing_meshes_overview.doc | 2 +- resources/CMakeLists.txt | 2 + resources/mesh_choose.png | Bin 0 -> 469 bytes resources/mesh_choose_all.png | Bin 0 -> 472 bytes src/SMESHGUI/CMakeLists.txt | 2 + src/SMESHGUI/SMESHGUI.cxx | 16 +- src/SMESHGUI/SMESHGUI_DisplayEntitiesDlg.cxx | 247 ++++++++++++++++++ src/SMESHGUI/SMESHGUI_DisplayEntitiesDlg.h | 61 +++++ src/SMESHGUI/SMESHGUI_Operations.h | 3 +- src/SMESHGUI/SMESH_images.ts | 8 + src/SMESHGUI/SMESH_msg_en.ts | 11 + src/SMESHGUI/SMESH_msg_fr.ts | 11 + src/SMESHGUI/SMESH_msg_ja.ts | 11 + 16 files changed, 380 insertions(+), 3 deletions(-) create mode 100644 doc/salome/gui/SMESH/images/display_entity_choose_item.png create mode 100644 doc/salome/gui/SMESH/images/display_entity_dlg.png create mode 100644 resources/mesh_choose.png create mode 100644 resources/mesh_choose_all.png create mode 100644 src/SMESHGUI/SMESHGUI_DisplayEntitiesDlg.cxx create mode 100644 src/SMESHGUI/SMESHGUI_DisplayEntitiesDlg.h diff --git a/doc/salome/gui/SMESH/images/display_entity_choose_item.png b/doc/salome/gui/SMESH/images/display_entity_choose_item.png new file mode 100644 index 0000000000000000000000000000000000000000..d09961822626937c7d20a29742f171541440b2df GIT binary patch literal 2186 zcmb7`c{~(a8^_Netr#i9O$@o+xS@<2X^^pu8n-Lk$QBJU23Zq^N*TK$Bs*y=HOMkF z*Tju%;kC;&rX))l+cYyVSKjIV*Z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S# zKE3A0H#qcW7pl>hNwiETaTN9WZ@U|qr{hIbnz<4dj-Wg=kV}lNvs2JJm37)<) z1_6~Oy$?LL!g`T|o1ma^7G)%kd`ZK6DeuqW&FDs6Q&YfFsf08;rncIAZ*EoeRM^2O z1ce~@tBN6|n}U;=WizPj3qz{Fd{QB0c6Iflq|~6uhs6={_jH*_8-C8RNqv`{Cf4get1w|;K1N{I zHNZ2UamG_y{S>8PoXx#O6W3)`=7L3|%*#m0U7m|!wDs8@nTWNS&JeceI2?+%s=Pq2 z3D~aMQW5C&o5$^nJuMM$s;{q4s&=U9?aR?3vpG(pYs`EXc357RXHoeJ>!PMsU*W#2 z7Ovpeh>~!Mtw;1qK!` z-F@tCu=hW)T-zuqJzXsVk`CgDUqy;1tt~;DubCpu?keVS767spLn|_xamqm34Og!YE8XU}(Naje!D}zPIc!5AUQ6D2EBOL&*BiP=ToDh@N)>E6HxPjF zSsYvlAjcE`<0<*^b*X)I&+?KHzp8Rx0-P8kEG1a}$wGF|2SD0#eM~#PeY)(%c-BJC z2p^jl1J%P7i<+z)+YLl3b<%;Svo;l0$K;lzQ9N@B9O|rbqOlLm&g`!&^|MW9r6)1^ z6yVxUklJ5L4<{UWvHg;t=t|QOAoS>`Z*~W)@_3q6ODhWPwr`|>$GQ=@UCBMX39}*m PCjgY0HIj19{r0~B+UWMZ literal 0 HcmV?d00001 diff --git a/doc/salome/gui/SMESH/images/display_entity_dlg.png b/doc/salome/gui/SMESH/images/display_entity_dlg.png new file mode 100644 index 0000000000000000000000000000000000000000..d0f4fa0ca38a63dbc445773aabddb3aa0a8623d7 GIT binary patch literal 6216 zcmb7IbyQUCw?2e2!bhW^bb}~^(lykO(v7r8NOyO92uP`jASn&fT@E4A&5%;kFhdO8 z_xRmE?(g2U?r+`ut~KwRv*(;WZ|uFF=Xs;lRpklsAK?Q4K&Yqy*8~78L-4vAf(`aU zfz|@x7nYl*yfjcYM6(6n+;dhia039MAAderNnAwKpb^hqQAHMS;oe{P1RUP`H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^+&CDbN3!BA+gcKmz{Y?>JVPW>2>sN1@jE=`JcNL$w ze{{SfI6W7|BPQm5yse|xYR)|9^P#EyE1Ky%dz;fi*f8WN4IQ1X>|xn-S8~1|tlwAu zp^h_7I((XQ&xXJ&=47ykwX?Gm)Q7If<~5t4OFrNG$biaK+u{qkwTb=xisQb)${1+C z7KZg?d9#P3*|JLQjc8xt+`JiaJn1?tgPQhX`lYw(cu#EVcu7;aD{AvuU2+_)xRty2 z2K|YS@%*|4?#-tnL&sV4pT%l$KIo{->E1o8EZ%oRM#!-m|G)s@k(%vg~Z^x)v}aa6Z;=T`L z=&Sn6kTqU56UMIDzl@6mwLCbjS?$kvJ#QRaYfj21(c-U0G@9-ky&`6jwv#Lu=%7RE z2qGNx*gMXq8%DLpdB^3{8nwuMk%i4CMy3W+;U-9(l~0X^PILI+GjoWbxlPW~7R8v< z{l8RFHfDmOwP!bsfO!@nmFJd+0HYPrsB5FLN<|2GE98;d}~QZ zN<0caKo+luy#6KfdE2prvE4+l{_80G&nf3wkl3+z5!U0LK=70wP?S}Lmr0w2{s%hg B-p&93 literal 0 HcmV?d00001 diff --git a/doc/salome/gui/SMESH/input/display_entity.doc b/doc/salome/gui/SMESH/input/display_entity.doc index 570674017..ccd0043ef 100644 --- a/doc/salome/gui/SMESH/input/display_entity.doc +++ b/doc/salome/gui/SMESH/input/display_entity.doc @@ -9,4 +9,13 @@ edges or combine them. \image html image58.gif Only Edges +If the mesh contains a lot of elements, select Choose... item, + +\image html display_entity_choose_item.png Item to call 'Display Entity' dialog box + +and Display Entity 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. */ \ No newline at end of file diff --git a/doc/salome/gui/SMESH/input/viewing_meshes_overview.doc b/doc/salome/gui/SMESH/input/viewing_meshes_overview.doc index 376da99b0..248685579 100644 --- a/doc/salome/gui/SMESH/input/viewing_meshes_overview.doc +++ b/doc/salome/gui/SMESH/input/viewing_meshes_overview.doc @@ -33,7 +33,7 @@ viewer.
  • \subpage display_mode_page "Display Mode" - allows to select between Wireframe, Shading and Nodes presentation.
  • \subpage display_entity_page "Display Entity" - allows to display -Faces, Edges or both.
  • +entities by types (Faces, Edges, Volumes etc.).
  • 2D Quadratic - allows to select between the representation of quadratic edges as broken lines or as arcs
  • Orientation of faces - shows vectors of orientation of diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index 4ffa049b7..46ca05a36 100755 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -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 diff --git a/resources/mesh_choose.png b/resources/mesh_choose.png new file mode 100644 index 0000000000000000000000000000000000000000..b5a40bacb8b4d12313d8f335b4f44a95811eced0 GIT binary patch literal 469 zcmV;`0V@89P)}Exmj9RXkY)MLgsv^eKc;@&Y~C_F@XjJ9slzlK2^oomp5htUY%$Q&|8jLZMKAIF7lVrfJ6EaL83B-*&rIBm^;3RfSTi1oQcvQS$M4l;Z34 znn?o4)xZyDrY_3m^0Vi8Kq97Tauc!DY9)8D-|w$7W4kb!OrTn=o_$G@FzFbHOE3#_ zU6)rR4BB9_<#PEGMUmVAaZ%EEJcd@Q1&-suY&L^tvk9Zo=q(6>FR>Oyr;-41AqM!q z&y7Z>(;+l44C7tb_1DE>!Tq$!5(06hX$tLj8^SQ;UrHt)#VpH$N~QAmRVFUtBTn14 zC1y0J*XwjTIRPdfQ>|8e!fKD#t}ZfvqJ3QK7vG6P)MA zI0%7m9dz^s+&cIU4&5R`hb~3P)_g+@R`kKhlN6+%BRqGSe8Yw!ykqr z4F&@>2m%72BUjxPP>{fFWhdLVO{39B7J?tT<2b&iX}9p_aydUMz^w@cnx;whdY!u6 zE)9o6;<01__{-%o@%$$CGEr42E083KU>>N~>q$VG%_c1t3j)dT=ks~0)oMRTexec(); + 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 ); diff --git a/src/SMESHGUI/SMESHGUI_DisplayEntitiesDlg.cxx b/src/SMESHGUI/SMESHGUI_DisplayEntitiesDlg.cxx new file mode 100644 index 000000000..741c0dbde --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_DisplayEntitiesDlg.cxx @@ -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 +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +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 ); + } +} diff --git a/src/SMESHGUI/SMESHGUI_DisplayEntitiesDlg.h b/src/SMESHGUI/SMESHGUI_DisplayEntitiesDlg.h new file mode 100644 index 000000000..4b36a6b25 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_DisplayEntitiesDlg.h @@ -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 + +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 diff --git a/src/SMESHGUI/SMESHGUI_Operations.h b/src/SMESHGUI/SMESHGUI_Operations.h index 0d1cfe56a..18c28a441 100644 --- a/src/SMESHGUI/SMESHGUI_Operations.h +++ b/src/SMESHGUI/SMESHGUI_Operations.h @@ -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 diff --git a/src/SMESHGUI/SMESH_images.ts b/src/SMESHGUI/SMESH_images.ts index 80c04e7d6..7da6cad1a 100644 --- a/src/SMESHGUI/SMESH_images.ts +++ b/src/SMESHGUI/SMESH_images.ts @@ -255,6 +255,14 @@ ICON_DLG_TRIANGLE mesh_triangle.png + + ICON_DLG_CHOOSE + mesh_choose.png + + + ICON_DLG_CHOOSE_ALL + mesh_choose_all.png + ICON_EDIT_GROUP mesh_edit_group.png diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index fcb37740a..3f8a01c03 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -396,6 +396,10 @@ MEN_EDGES Edges + + MEN_CHOOSE + Choose... + MEN_EDIT Edit @@ -7805,4 +7809,11 @@ as they are of improper type: Shrink coef: + + SMESHGUI_DisplayEntitiesDlg + + WRN_AT_LEAST_ONE + At least one entity type should be chosen! + + diff --git a/src/SMESHGUI/SMESH_msg_fr.ts b/src/SMESHGUI/SMESH_msg_fr.ts index f20d819eb..91596f776 100755 --- a/src/SMESHGUI/SMESH_msg_fr.ts +++ b/src/SMESHGUI/SMESH_msg_fr.ts @@ -396,6 +396,10 @@ MEN_EDGES Arêtes + + MEN_CHOOSE + Choose... + MEN_EDIT Edition @@ -7753,4 +7757,11 @@ en raison de leurs types incompatibles: Coef de réduction: + + SMESHGUI_DisplayEntitiesDlg + + WRN_AT_LEAST_ONE + At least one entity type should be chosen! + + diff --git a/src/SMESHGUI/SMESH_msg_ja.ts b/src/SMESHGUI/SMESH_msg_ja.ts index 5d6e78d20..0332875cf 100644 --- a/src/SMESHGUI/SMESH_msg_ja.ts +++ b/src/SMESHGUI/SMESH_msg_ja.ts @@ -395,6 +395,10 @@ MEN_EDGES エッジ + + MEN_CHOOSE + Choose... + MEN_EDIT 編集(&E) @@ -7687,4 +7691,11 @@ 減少係数: + + SMESHGUI_DisplayEntitiesDlg + + WRN_AT_LEAST_ONE + At least one entity type should be chosen! + +