mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-15 03:50:32 +05:00
0020945: EDF 1465 SMESH: create a new mesh from a selected group or from selected elements
This commit is contained in:
parent
3096113268
commit
6498f37c2b
BIN
doc/salome/gui/SMESH/images/copy_mesh_dlg.png
Normal file
BIN
doc/salome/gui/SMESH/images/copy_mesh_dlg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
BIN
doc/salome/gui/SMESH/images/copy_mesh_icon.png
Normal file
BIN
doc/salome/gui/SMESH/images/copy_mesh_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -16,6 +16,9 @@ for example, a face.
|
|||||||
|
|
||||||
Several created meshes can be \subpage building_compounds_page "combined into mesh compounds".
|
Several created meshes can be \subpage building_compounds_page "combined into mesh compounds".
|
||||||
|
|
||||||
|
The whole mesh or it's part can be \subpage copy_mesh_page "copied"
|
||||||
|
into another mesh.
|
||||||
|
|
||||||
All created meshes and submeshes can be \subpage editing_meshes_page "edited".
|
All created meshes and submeshes can be \subpage editing_meshes_page "edited".
|
||||||
|
|
||||||
Meshes can be also edited using the MESH functions destined for
|
Meshes can be also edited using the MESH functions destined for
|
||||||
|
56
doc/salome/gui/SMESH/input/copy_mesh.doc
Normal file
56
doc/salome/gui/SMESH/input/copy_mesh.doc
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/*!
|
||||||
|
|
||||||
|
\page copy_mesh_page Copy Mesh
|
||||||
|
|
||||||
|
\n A mesh can be created by copying a part of or the whole other mesh.
|
||||||
|
|
||||||
|
<em>To make a copy of a mesh:</em>
|
||||||
|
|
||||||
|
\par
|
||||||
|
From the \b Mesh menu select <b>Copy Mesh</b> or click "<em>Copy Mesh
|
||||||
|
"</em> button in the toolbar.
|
||||||
|
|
||||||
|
\image html copy_mesh_icon.png
|
||||||
|
<center><em>"Copy Mesh" button</em></center>
|
||||||
|
|
||||||
|
\par
|
||||||
|
The following dialog box will appear:
|
||||||
|
|
||||||
|
\image html copy_mesh_dlg.png
|
||||||
|
|
||||||
|
\par
|
||||||
|
In the dialog:
|
||||||
|
<ul>
|
||||||
|
<li>specify the part of mesh to copy:
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><b>Select the whole mesh, submesh or group</b> by mouse activating
|
||||||
|
this checkbox; or</li>
|
||||||
|
<li>choose mesh elements with the mouse in the 3D Viewer. It is
|
||||||
|
possible to select a whole area with a mouse frame; or</li>
|
||||||
|
<li>input the <b>Source Element IDs</b> directly in this field. The
|
||||||
|
selected elements will be highlighted in the viewer; or</li>
|
||||||
|
<li>apply Filters. <b>Set filter</b> button allows to apply a filter
|
||||||
|
to the selection of elements. See more about filters in the \ref
|
||||||
|
selection_filter_library_page "Selection filter library" page.</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>specify the <b>New Mesh Name</b>;</li>
|
||||||
|
|
||||||
|
<li>specify the conditions of copying:
|
||||||
|
<ul>
|
||||||
|
<li>activate <b>Generate groups</b> checkbox to copy the groups of
|
||||||
|
elements of the source mesh to the newly created mesh.</li>
|
||||||
|
<li>activate <b>Preserve IDs of elements</b> checkbox to keep
|
||||||
|
the IDs of new nodes and elements the same as the IDs of source nodes
|
||||||
|
and elements.</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>Click \b Apply or <b>Apply and Close</b> button to confirm the operation.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<b>See Also</b> a sample
|
||||||
|
\ref tui_copy_mesh "TUI Example of mesh copying."
|
||||||
|
*/
|
@ -249,4 +249,48 @@ demonstrating the resulting mesh.
|
|||||||
\skipline import geompy
|
\skipline import geompy
|
||||||
\until #end
|
\until #end
|
||||||
|
|
||||||
|
<br>
|
||||||
|
\anchor tui_copy_mesh
|
||||||
|
<h2>Mesh Copying</h2>
|
||||||
|
\code
|
||||||
|
from smesh import *
|
||||||
|
SetCurrentStudy(salome.myStudy)
|
||||||
|
|
||||||
|
# make geometry of a box
|
||||||
|
box = geompy.MakeBoxDXDYDZ(100,100,100)
|
||||||
|
face = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])[0]
|
||||||
|
|
||||||
|
# generate 3D mesh
|
||||||
|
mesh = Mesh(box)
|
||||||
|
localAlgo = mesh.Triangle(face)
|
||||||
|
mesh.AutomaticHexahedralization()
|
||||||
|
|
||||||
|
# objects to copy
|
||||||
|
fGroup = mesh.GroupOnGeom( face, "2D on face")
|
||||||
|
nGroup = mesh.GroupOnGeom( face, "nodes on face", NODE)
|
||||||
|
subMesh = localAlgo.GetSubMesh()
|
||||||
|
|
||||||
|
# make a new mesh by copying different part of the mesh
|
||||||
|
|
||||||
|
# 1. copy the whole mesh
|
||||||
|
newMesh = CopyMesh( mesh, "whole mesh copy")
|
||||||
|
|
||||||
|
# 2. copy a group of 2D elements along with groups
|
||||||
|
newMesh = CopyMesh( fGroup, "face group copy with groups",toCopyGroups=True)
|
||||||
|
|
||||||
|
# 3. copy a group of nodes with preseving their ids
|
||||||
|
newMesh = CopyMesh( nGroup, "node group copy", toKeepIDs=True)
|
||||||
|
|
||||||
|
# 4. copy some faces
|
||||||
|
faceIds = fGroup.GetIDs()[-10:]
|
||||||
|
newMesh = CopyMesh( mesh.GetIDSource( faceIds, FACE ), "some faces copy")
|
||||||
|
|
||||||
|
# 5. copy some nodes
|
||||||
|
nodeIds = nGroup.GetIDs()[-10:]
|
||||||
|
newMesh = CopyMesh( mesh.GetIDSource( nodeIds, NODE), "some nodes copy")
|
||||||
|
|
||||||
|
# 6. copy a sub-mesh
|
||||||
|
newMesh = CopyMesh( subMesh, "submesh copy" )
|
||||||
|
\endcode
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
@ -172,6 +172,7 @@ dist_salomeres_DATA = \
|
|||||||
mesh_tree_hypo_projection_3d.png \
|
mesh_tree_hypo_projection_3d.png \
|
||||||
mesh_tree_hypo_projection_2d.png \
|
mesh_tree_hypo_projection_2d.png \
|
||||||
mesh_build_compound.png \
|
mesh_build_compound.png \
|
||||||
|
copy_mesh.png \
|
||||||
mesh_node_to_point.png \
|
mesh_node_to_point.png \
|
||||||
mesh_tree_mesh_partial.png \
|
mesh_tree_mesh_partial.png \
|
||||||
mesh_extractGroup.png \
|
mesh_extractGroup.png \
|
||||||
|
BIN
resources/copy_mesh.png
Normal file
BIN
resources/copy_mesh.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -94,6 +94,7 @@ salomeinclude_HEADERS = \
|
|||||||
SMESHGUI_MeshOrderDlg.h \
|
SMESHGUI_MeshOrderDlg.h \
|
||||||
SMESHGUI_MeshOrderOp.h \
|
SMESHGUI_MeshOrderOp.h \
|
||||||
SMESHGUI_FileValidator.h \
|
SMESHGUI_FileValidator.h \
|
||||||
|
SMESHGUI_CopyMeshDlg.h \
|
||||||
SMESH_SMESHGUI.hxx
|
SMESH_SMESHGUI.hxx
|
||||||
|
|
||||||
# Libraries targets
|
# Libraries targets
|
||||||
@ -167,6 +168,7 @@ dist_libSMESH_la_SOURCES = \
|
|||||||
SMESHGUI_FindElemByPointDlg.cxx \
|
SMESHGUI_FindElemByPointDlg.cxx \
|
||||||
SMESHGUI_MeshOrderDlg.cxx \
|
SMESHGUI_MeshOrderDlg.cxx \
|
||||||
SMESHGUI_MeshOrderOp.cxx \
|
SMESHGUI_MeshOrderOp.cxx \
|
||||||
|
SMESHGUI_CopyMeshDlg.cxx \
|
||||||
SMESHGUI_FileValidator.cxx
|
SMESHGUI_FileValidator.cxx
|
||||||
|
|
||||||
MOC_FILES = \
|
MOC_FILES = \
|
||||||
@ -224,6 +226,7 @@ MOC_FILES = \
|
|||||||
SMESHGUI_Make2DFrom3DOp_moc.cxx \
|
SMESHGUI_Make2DFrom3DOp_moc.cxx \
|
||||||
SMESHGUI_FindElemByPointDlg_moc.cxx \
|
SMESHGUI_FindElemByPointDlg_moc.cxx \
|
||||||
SMESHGUI_MeshOrderDlg_moc.cxx \
|
SMESHGUI_MeshOrderDlg_moc.cxx \
|
||||||
|
SMESHGUI_CopyMeshDlg_moc.cxx \
|
||||||
SMESHGUI_MeshOrderOp_moc.cxx
|
SMESHGUI_MeshOrderOp_moc.cxx
|
||||||
|
|
||||||
nodist_libSMESH_la_SOURCES= \
|
nodist_libSMESH_la_SOURCES= \
|
||||||
|
@ -75,6 +75,7 @@
|
|||||||
#include "SMESHGUI_TransparencyDlg.h"
|
#include "SMESHGUI_TransparencyDlg.h"
|
||||||
//#include "SMESHGUI_WhatIsDlg.h"
|
//#include "SMESHGUI_WhatIsDlg.h"
|
||||||
#include "SMESHGUI_DuplicateNodesDlg.h"
|
#include "SMESHGUI_DuplicateNodesDlg.h"
|
||||||
|
#include "SMESHGUI_CopyMeshDlg.h"
|
||||||
|
|
||||||
#include "SMESHGUI_Utils.h"
|
#include "SMESHGUI_Utils.h"
|
||||||
#include "SMESHGUI_MeshUtils.h"
|
#include "SMESHGUI_MeshUtils.h"
|
||||||
@ -2040,6 +2041,13 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
case 704: // Edit mesh/sub-mesh
|
case 704: // Edit mesh/sub-mesh
|
||||||
startOperation( theCommandID );
|
startOperation( theCommandID );
|
||||||
break;
|
break;
|
||||||
|
case 705: // copy mesh
|
||||||
|
{
|
||||||
|
if (checkLock(aStudy)) break;
|
||||||
|
EmitSignalDeactivateDialog();
|
||||||
|
( new SMESHGUI_CopyMeshDlg( this ) )->show();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 710: // Build compound mesh
|
case 710: // Build compound mesh
|
||||||
{
|
{
|
||||||
if (checkLock(aStudy)) break;
|
if (checkLock(aStudy)) break;
|
||||||
@ -3209,6 +3217,7 @@ void SMESHGUI::initialize( CAM_Application* app )
|
|||||||
createSMESHAction( 702, "CREATE_MESH", "ICON_DLG_INIT_MESH" );
|
createSMESHAction( 702, "CREATE_MESH", "ICON_DLG_INIT_MESH" );
|
||||||
createSMESHAction( 703, "CREATE_SUBMESH", "ICON_DLG_ADD_SUBMESH" );
|
createSMESHAction( 703, "CREATE_SUBMESH", "ICON_DLG_ADD_SUBMESH" );
|
||||||
createSMESHAction( 704, "EDIT_MESHSUBMESH","ICON_DLG_EDIT_MESH" );
|
createSMESHAction( 704, "EDIT_MESHSUBMESH","ICON_DLG_EDIT_MESH" );
|
||||||
|
createSMESHAction( 705, "COPY_MESH", "ICON_COPY_MESH" );
|
||||||
createSMESHAction( 710, "BUILD_COMPOUND", "ICON_BUILD_COMPOUND" );
|
createSMESHAction( 710, "BUILD_COMPOUND", "ICON_BUILD_COMPOUND" );
|
||||||
createSMESHAction( 711, "PRECOMPUTE", "ICON_PRECOMPUTE" );
|
createSMESHAction( 711, "PRECOMPUTE", "ICON_PRECOMPUTE" );
|
||||||
createSMESHAction( 712, "EVALUATE", "ICON_COMPUTE" );
|
createSMESHAction( 712, "EVALUATE", "ICON_COMPUTE" );
|
||||||
@ -3377,6 +3386,7 @@ void SMESHGUI::initialize( CAM_Application* app )
|
|||||||
createMenu( 703, meshId, -1 );
|
createMenu( 703, meshId, -1 );
|
||||||
createMenu( 704, meshId, -1 );
|
createMenu( 704, meshId, -1 );
|
||||||
createMenu( 710, meshId, -1 );
|
createMenu( 710, meshId, -1 );
|
||||||
|
createMenu( 705, meshId, -1 );
|
||||||
createMenu( separator(), meshId, -1 );
|
createMenu( separator(), meshId, -1 );
|
||||||
createMenu( 701, meshId, -1 );
|
createMenu( 701, meshId, -1 );
|
||||||
createMenu( 711, meshId, -1 );
|
createMenu( 711, meshId, -1 );
|
||||||
@ -3492,6 +3502,7 @@ void SMESHGUI::initialize( CAM_Application* app )
|
|||||||
createTool( 703, meshTb );
|
createTool( 703, meshTb );
|
||||||
createTool( 704, meshTb );
|
createTool( 704, meshTb );
|
||||||
createTool( 710, meshTb );
|
createTool( 710, meshTb );
|
||||||
|
createTool( 705, meshTb );
|
||||||
createTool( separator(), meshTb );
|
createTool( separator(), meshTb );
|
||||||
createTool( 701, meshTb );
|
createTool( 701, meshTb );
|
||||||
createTool( 711, meshTb );
|
createTool( 711, meshTb );
|
||||||
|
667
src/SMESHGUI/SMESHGUI_CopyMeshDlg.cxx
Normal file
667
src/SMESHGUI/SMESHGUI_CopyMeshDlg.cxx
Normal file
@ -0,0 +1,667 @@
|
|||||||
|
// 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
|
||||||
|
//
|
||||||
|
// SMESH SMESHGUI : GUI for SMESH component
|
||||||
|
// File : SMESHGUI_CopyMeshDlg.cxx
|
||||||
|
|
||||||
|
#include "SMESHGUI_CopyMeshDlg.h"
|
||||||
|
|
||||||
|
#include "SMESHGUI.h"
|
||||||
|
#include "SMESHGUI_SpinBox.h"
|
||||||
|
#include "SMESHGUI_Utils.h"
|
||||||
|
#include "SMESHGUI_VTKUtils.h"
|
||||||
|
#include "SMESHGUI_MeshUtils.h"
|
||||||
|
#include "SMESHGUI_IdValidator.h"
|
||||||
|
#include "SMESHGUI_FilterDlg.h"
|
||||||
|
|
||||||
|
#include <SMESH_Actor.h>
|
||||||
|
#include <SMESH_TypeFilter.hxx>
|
||||||
|
#include <SMDS_Mesh.hxx>
|
||||||
|
|
||||||
|
// SALOME GUI includes
|
||||||
|
#include <SUIT_Desktop.h>
|
||||||
|
#include <SUIT_ResourceMgr.h>
|
||||||
|
#include <SUIT_Session.h>
|
||||||
|
#include <SUIT_MessageBox.h>
|
||||||
|
#include <SUIT_OverrideCursor.h>
|
||||||
|
|
||||||
|
#include <LightApp_Application.h>
|
||||||
|
#include <LightApp_SelectionMgr.h>
|
||||||
|
|
||||||
|
#include <SVTK_ViewModel.h>
|
||||||
|
#include <SVTK_ViewWindow.h>
|
||||||
|
#include <SALOME_ListIO.hxx>
|
||||||
|
|
||||||
|
// SALOME KERNEL includes
|
||||||
|
#include <SALOMEDSClient_SObject.hxx>
|
||||||
|
|
||||||
|
// OCCT includes
|
||||||
|
#include <TColStd_MapOfInteger.hxx>
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QButtonGroup>
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QRadioButton>
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QGridLayout>
|
||||||
|
#include <QSpinBox>
|
||||||
|
#include <QKeyEvent>
|
||||||
|
|
||||||
|
// IDL includes
|
||||||
|
#include <SALOMEconfig.h>
|
||||||
|
#include CORBA_SERVER_HEADER(SMESH_Group)
|
||||||
|
#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\class BusyLocker
|
||||||
|
\brief Simple 'busy state' flag locker.
|
||||||
|
\internal
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
class BusyLocker
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Constructor. Sets passed boolean flag to \c true.
|
||||||
|
BusyLocker( bool& busy ) : myBusy( busy ) { myBusy = true; }
|
||||||
|
//! Destructor. Clear external boolean flag passed as parameter to the constructor to \c false.
|
||||||
|
~BusyLocker() { myBusy = false; }
|
||||||
|
private:
|
||||||
|
bool& myBusy; //! External 'busy state' boolean flag
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SPACING 6
|
||||||
|
#define MARGIN 11
|
||||||
|
|
||||||
|
//To disable automatic genericobj management, the following line should be commented.
|
||||||
|
//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
|
||||||
|
#define WITHGENERICOBJ
|
||||||
|
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Constructor
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
SMESHGUI_CopyMeshDlg::SMESHGUI_CopyMeshDlg( SMESHGUI* theModule )
|
||||||
|
: QDialog( SMESH::GetDesktop( theModule ) ),
|
||||||
|
mySMESHGUI( theModule ),
|
||||||
|
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||||
|
myFilterDlg(0),
|
||||||
|
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
||||||
|
{
|
||||||
|
QPixmap image (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_COPY_MESH")));
|
||||||
|
|
||||||
|
setModal(false);
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
setWindowTitle(tr("SMESH_COPY_MESH_TITLE"));
|
||||||
|
setSizeGripEnabled(true);
|
||||||
|
|
||||||
|
QVBoxLayout* SMESHGUI_CopyMeshDlgLayout = new QVBoxLayout(this);
|
||||||
|
SMESHGUI_CopyMeshDlgLayout->setSpacing(SPACING);
|
||||||
|
SMESHGUI_CopyMeshDlgLayout->setMargin(MARGIN);
|
||||||
|
|
||||||
|
/***************************************************************/
|
||||||
|
ConstructorsBox = new QGroupBox(tr("SMESH_COPY_MESH_TITLE"), this);
|
||||||
|
QButtonGroup* GroupConstructors = new QButtonGroup(this);
|
||||||
|
QHBoxLayout* ConstructorsBoxLayout = new QHBoxLayout(ConstructorsBox);
|
||||||
|
ConstructorsBoxLayout->setSpacing(SPACING);
|
||||||
|
ConstructorsBoxLayout->setMargin(MARGIN);
|
||||||
|
|
||||||
|
QRadioButton* RadioButton1= new QRadioButton(ConstructorsBox);
|
||||||
|
RadioButton1->setIcon(image);
|
||||||
|
GroupConstructors->addButton(RadioButton1, 0);
|
||||||
|
|
||||||
|
ConstructorsBoxLayout->addWidget(RadioButton1);
|
||||||
|
RadioButton1->setChecked(true);
|
||||||
|
GroupConstructors->addButton(RadioButton1, 0);
|
||||||
|
|
||||||
|
/***************************************************************/
|
||||||
|
GroupArguments = new QGroupBox(tr("SMESH_ARGUMENTS"), this);
|
||||||
|
QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments);
|
||||||
|
GroupArgumentsLayout->setSpacing(SPACING);
|
||||||
|
GroupArgumentsLayout->setMargin(MARGIN);
|
||||||
|
|
||||||
|
myIdValidator = new SMESHGUI_IdValidator(this);
|
||||||
|
|
||||||
|
// Controls for idSource/elements selection
|
||||||
|
myTextLabelElements = new QLabel(tr("OBJECT_NAME"), GroupArguments);
|
||||||
|
myLineEditElements = new QLineEdit(GroupArguments);
|
||||||
|
myLineEditElements->setValidator(myIdValidator);
|
||||||
|
myLineEditElements->setMaxLength(-1);
|
||||||
|
myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
|
||||||
|
connect(myFilterBtn, SIGNAL(clicked()), this, SLOT(setFilters()));
|
||||||
|
|
||||||
|
// Control for the mesh objects selection
|
||||||
|
myIdSourceCheck = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
|
||||||
|
|
||||||
|
// Name of a mesh to create
|
||||||
|
QLabel* meshNameLabel = new QLabel(tr("NEW_NAME"), GroupArguments);
|
||||||
|
myMeshNameEdit = new QLineEdit(GroupArguments);
|
||||||
|
|
||||||
|
// CheckBox for copying groups
|
||||||
|
myCopyGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
|
||||||
|
myCopyGroupsCheck->setChecked(false);
|
||||||
|
|
||||||
|
// CheckBox for keeping ids
|
||||||
|
myKeepIdsCheck = new QCheckBox(tr("SMESH_KEEP_IDS"), GroupArguments);
|
||||||
|
myKeepIdsCheck->setChecked(true);
|
||||||
|
|
||||||
|
// layout
|
||||||
|
GroupArgumentsLayout->addWidget(myTextLabelElements, 0, 0);
|
||||||
|
GroupArgumentsLayout->addWidget(myLineEditElements, 0, 1, 1, 5);
|
||||||
|
GroupArgumentsLayout->addWidget(myFilterBtn, 0, 6);
|
||||||
|
GroupArgumentsLayout->addWidget(myIdSourceCheck, 1, 0, 1, 6);
|
||||||
|
GroupArgumentsLayout->addWidget(meshNameLabel, 2, 0);
|
||||||
|
GroupArgumentsLayout->addWidget(myMeshNameEdit, 2, 1, 1, 5);
|
||||||
|
GroupArgumentsLayout->addWidget(myCopyGroupsCheck, 3, 0, 1, 6);
|
||||||
|
GroupArgumentsLayout->addWidget(myKeepIdsCheck, 4, 0, 1, 6);
|
||||||
|
|
||||||
|
/***************************************************************/
|
||||||
|
GroupButtons = new QGroupBox(this);
|
||||||
|
QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
|
||||||
|
GroupButtonsLayout->setSpacing(SPACING);
|
||||||
|
GroupButtonsLayout->setMargin(MARGIN);
|
||||||
|
|
||||||
|
buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
|
||||||
|
buttonOk->setAutoDefault(true);
|
||||||
|
buttonOk->setDefault(true);
|
||||||
|
buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
|
||||||
|
buttonApply->setAutoDefault(true);
|
||||||
|
buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons);
|
||||||
|
buttonCancel->setAutoDefault(true);
|
||||||
|
buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons);
|
||||||
|
buttonHelp->setAutoDefault(true);
|
||||||
|
|
||||||
|
GroupButtonsLayout->addWidget(buttonOk);
|
||||||
|
GroupButtonsLayout->addSpacing(10);
|
||||||
|
GroupButtonsLayout->addWidget(buttonApply);
|
||||||
|
GroupButtonsLayout->addSpacing(10);
|
||||||
|
GroupButtonsLayout->addStretch();
|
||||||
|
GroupButtonsLayout->addWidget(buttonCancel);
|
||||||
|
GroupButtonsLayout->addWidget(buttonHelp);
|
||||||
|
|
||||||
|
/***************************************************************/
|
||||||
|
SMESHGUI_CopyMeshDlgLayout->addWidget(ConstructorsBox);
|
||||||
|
SMESHGUI_CopyMeshDlgLayout->addWidget(GroupArguments);
|
||||||
|
SMESHGUI_CopyMeshDlgLayout->addWidget(GroupButtons);
|
||||||
|
|
||||||
|
/* Initialisations */
|
||||||
|
mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
|
||||||
|
|
||||||
|
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
|
||||||
|
|
||||||
|
// Selection filter
|
||||||
|
myIdSourceFilter = new SMESH_TypeFilter( IDSOURCE );
|
||||||
|
|
||||||
|
myHelpFileName = "copy_mesh_page.html";
|
||||||
|
|
||||||
|
Init();
|
||||||
|
|
||||||
|
/* signals and slots connections */
|
||||||
|
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||||
|
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
|
||||||
|
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||||
|
connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
|
||||||
|
|
||||||
|
connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()),
|
||||||
|
this, SLOT (DeactivateActiveDialog()));
|
||||||
|
connect(mySelectionMgr, SIGNAL (currentSelectionChanged()),
|
||||||
|
this, SLOT (SelectionIntoArgument()));
|
||||||
|
connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()),/* to close dialog if study change */
|
||||||
|
this, SLOT (ClickOnCancel()));
|
||||||
|
|
||||||
|
connect(myLineEditElements, SIGNAL(textChanged(const QString&)),
|
||||||
|
this, SLOT (onTextChange(const QString&)));
|
||||||
|
connect(myIdSourceCheck, SIGNAL(toggled(bool)),
|
||||||
|
this, SLOT (onSelectIdSource(bool)));
|
||||||
|
|
||||||
|
SelectionIntoArgument();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : ~SMESHGUI_CopyMeshDlg()
|
||||||
|
// purpose : Destroys the object and frees any allocated resources
|
||||||
|
//=================================================================================
|
||||||
|
|
||||||
|
SMESHGUI_CopyMeshDlg::~SMESHGUI_CopyMeshDlg()
|
||||||
|
{
|
||||||
|
if ( myFilterDlg )
|
||||||
|
{
|
||||||
|
myFilterDlg->setParent( 0 );
|
||||||
|
delete myFilterDlg; myFilterDlg = 0;
|
||||||
|
}
|
||||||
|
if ( myIdSourceFilter )
|
||||||
|
{
|
||||||
|
if ( mySelectionMgr )
|
||||||
|
mySelectionMgr->removeFilter( myIdSourceFilter );
|
||||||
|
delete myIdSourceFilter; myIdSourceFilter=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : Init()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_CopyMeshDlg::Init (bool ResetControls)
|
||||||
|
{
|
||||||
|
myBusy = false;
|
||||||
|
|
||||||
|
myMeshNameEdit->setText( SMESH::UniqueMeshName("Mesh"));
|
||||||
|
if ( ResetControls )
|
||||||
|
{
|
||||||
|
myLineEditElements->clear();
|
||||||
|
//myElementsId = "";
|
||||||
|
myNbOkElements = 0;
|
||||||
|
|
||||||
|
buttonOk->setEnabled(false);
|
||||||
|
buttonApply->setEnabled(false);
|
||||||
|
|
||||||
|
myActor = 0;
|
||||||
|
myMesh = SMESH::SMESH_Mesh::_nil();
|
||||||
|
|
||||||
|
myIdSourceCheck->setChecked(true);
|
||||||
|
myCopyGroupsCheck->setChecked(false);
|
||||||
|
myKeepIdsCheck->setChecked(false);
|
||||||
|
|
||||||
|
onSelectIdSource( myIdSourceCheck->isChecked() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : ClickOnApply()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
|
||||||
|
bool SMESHGUI_CopyMeshDlg::ClickOnApply()
|
||||||
|
{
|
||||||
|
if (mySMESHGUI->isActiveStudyLocked())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if( !isValid() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SUIT_OverrideCursor aWaitCursor;
|
||||||
|
SMESH::SMESH_IDSource_var aPartToCopy;
|
||||||
|
if ( myIdSourceCheck->isChecked())
|
||||||
|
{
|
||||||
|
aPartToCopy = mySelectedObject;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QStringList aListElementsId = myLineEditElements->text().split(" ", QString::SkipEmptyParts);
|
||||||
|
SMESH::long_array_var anElementsId = new SMESH::long_array;
|
||||||
|
anElementsId->length(aListElementsId.count());
|
||||||
|
for (int i = 0; i < aListElementsId.count(); i++)
|
||||||
|
anElementsId[i] = aListElementsId[i].toInt();
|
||||||
|
|
||||||
|
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||||
|
aPartToCopy = aMeshEditor->MakeIDSource( anElementsId, SMESH::ALL );
|
||||||
|
}
|
||||||
|
QByteArray meshName = myMeshNameEdit->text().toLatin1();
|
||||||
|
bool toCopyGroups = ( myCopyGroupsCheck->isChecked() );
|
||||||
|
bool toKeepIDs = ( myKeepIdsCheck->isChecked() );
|
||||||
|
|
||||||
|
SMESH::SMESH_Gen_var gen = SMESHGUI::GetSMESHGen();
|
||||||
|
SMESH::SMESH_Mesh_var newMesh =
|
||||||
|
gen->CopyMesh(aPartToCopy, meshName.constData(), toCopyGroups, toKeepIDs);
|
||||||
|
#ifdef WITHGENERICOBJ
|
||||||
|
// obj has been published in study. Its refcount has been incremented.
|
||||||
|
// It is safe to decrement its refcount
|
||||||
|
// so that it will be destroyed when the entry in study will be removed
|
||||||
|
newMesh->Destroy();
|
||||||
|
#endif
|
||||||
|
} catch (...) {
|
||||||
|
}
|
||||||
|
|
||||||
|
mySMESHGUI->updateObjBrowser(true);
|
||||||
|
SMESHGUI::Modified();
|
||||||
|
|
||||||
|
Init(false);
|
||||||
|
mySelectedObject = SMESH::SMESH_IDSource::_nil();
|
||||||
|
SelectionIntoArgument();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : ClickOnOk()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_CopyMeshDlg::ClickOnOk()
|
||||||
|
{
|
||||||
|
if( ClickOnApply() )
|
||||||
|
ClickOnCancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : ClickOnCancel()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_CopyMeshDlg::ClickOnCancel()
|
||||||
|
{
|
||||||
|
disconnect(mySelectionMgr, 0, this, 0);
|
||||||
|
if ( mySelectionMgr )
|
||||||
|
mySelectionMgr->removeFilter( myIdSourceFilter );
|
||||||
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
||||||
|
aViewWindow->SetSelectionMode( ActorSelection );
|
||||||
|
mySMESHGUI->ResetState();
|
||||||
|
reject();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : ClickOnHelp()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_CopyMeshDlg::ClickOnHelp()
|
||||||
|
{
|
||||||
|
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
|
||||||
|
if (app)
|
||||||
|
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
|
||||||
|
else {
|
||||||
|
QString platform;
|
||||||
|
#ifdef WIN32
|
||||||
|
platform = "winapplication";
|
||||||
|
#else
|
||||||
|
platform = "application";
|
||||||
|
#endif
|
||||||
|
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
|
||||||
|
tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
|
||||||
|
arg(app->resourceMgr()->stringValue("ExternalBrowser",
|
||||||
|
platform)).
|
||||||
|
arg(myHelpFileName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// function : onTextChange()
|
||||||
|
// purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
void SMESHGUI_CopyMeshDlg::onTextChange (const QString& theNewText)
|
||||||
|
{
|
||||||
|
QLineEdit* send = (QLineEdit*)sender();
|
||||||
|
|
||||||
|
if (myBusy) return;
|
||||||
|
BusyLocker lock( myBusy );
|
||||||
|
|
||||||
|
//if (send == myLineEditElements)
|
||||||
|
myNbOkElements = 0;
|
||||||
|
|
||||||
|
buttonOk->setEnabled(false);
|
||||||
|
buttonApply->setEnabled(false);
|
||||||
|
|
||||||
|
// hilight entered elements
|
||||||
|
SMDS_Mesh* aMesh = 0;
|
||||||
|
if (myActor)
|
||||||
|
aMesh = myActor->GetObject()->GetMesh();
|
||||||
|
|
||||||
|
QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
|
||||||
|
if (myActor && aMesh)
|
||||||
|
{
|
||||||
|
TColStd_MapOfInteger newIndices;
|
||||||
|
if (send == myLineEditElements) {
|
||||||
|
for (int i = 0; i < aListId.count(); i++)
|
||||||
|
if ( const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt()))
|
||||||
|
{
|
||||||
|
newIndices.Add(e->GetID());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
myNbOkElements = newIndices.Extent();
|
||||||
|
|
||||||
|
Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
|
||||||
|
mySelector->AddOrRemoveIndex( anIO, newIndices, false );
|
||||||
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
||||||
|
aViewWindow->highlight( anIO, true, true );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
myNbOkElements = aListId.count();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (myNbOkElements) {
|
||||||
|
buttonOk->setEnabled(true);
|
||||||
|
buttonApply->setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : SelectionIntoArgument()
|
||||||
|
// purpose : Called when selection as changed or other case
|
||||||
|
//=================================================================================
|
||||||
|
|
||||||
|
void SMESHGUI_CopyMeshDlg::SelectionIntoArgument()
|
||||||
|
{
|
||||||
|
if (myBusy) return;
|
||||||
|
BusyLocker lock( myBusy );
|
||||||
|
|
||||||
|
// clear
|
||||||
|
myActor = 0;
|
||||||
|
QString aString = "";
|
||||||
|
|
||||||
|
myLineEditElements->setText(aString);
|
||||||
|
myNbOkElements = 0;
|
||||||
|
buttonOk->setEnabled(false);
|
||||||
|
buttonApply->setEnabled(false);
|
||||||
|
myFilterBtn->setEnabled(false);
|
||||||
|
|
||||||
|
// get selected mesh
|
||||||
|
SALOME_ListIO aList;
|
||||||
|
mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
|
||||||
|
int nbSel = aList.Extent();
|
||||||
|
if (nbSel != 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Handle(SALOME_InteractiveObject) IO = aList.First();
|
||||||
|
mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
|
||||||
|
if ( mySelectedObject->_is_nil() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
myMesh = SMESH::GetMeshByIO(IO);
|
||||||
|
if (myMesh->_is_nil())
|
||||||
|
return;
|
||||||
|
|
||||||
|
myActor = SMESH::FindActorByEntry(IO->getEntry());
|
||||||
|
if (!myActor)
|
||||||
|
myActor = SMESH::FindActorByObject(myMesh);
|
||||||
|
|
||||||
|
if (myIdSourceCheck->isChecked())
|
||||||
|
{
|
||||||
|
SMESH::GetNameOfSelectedIObjects( mySelectionMgr, aString );
|
||||||
|
if ( aString.isEmpty() ) aString = " ";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SMESH::GetNameOfSelectedElements( mySelector, IO, aString );
|
||||||
|
myNbOkElements = aString.size();
|
||||||
|
myFilterBtn->setEnabled(true);
|
||||||
|
}
|
||||||
|
myLineEditElements->setText( aString );
|
||||||
|
bool ok = !aString.isEmpty();
|
||||||
|
|
||||||
|
buttonOk->setEnabled(ok);
|
||||||
|
buttonApply->setEnabled(ok);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : onSelectIdSource
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void SMESHGUI_CopyMeshDlg::onSelectIdSource (bool toSelectMesh)
|
||||||
|
{
|
||||||
|
if (toSelectMesh)
|
||||||
|
myTextLabelElements->setText(tr("OBJECT_NAME"));
|
||||||
|
else
|
||||||
|
myTextLabelElements->setText(tr("ELEM_IDS"));
|
||||||
|
|
||||||
|
if (toSelectMesh) {
|
||||||
|
myLineEditElements->clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
mySelectionMgr->clearFilters();
|
||||||
|
mySelectionMgr->installFilter(myIdSourceFilter);
|
||||||
|
SMESH::SetPointRepresentation(false);
|
||||||
|
|
||||||
|
if (toSelectMesh) {
|
||||||
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
||||||
|
aViewWindow->SetSelectionMode( ActorSelection );
|
||||||
|
myLineEditElements->setReadOnly(true);
|
||||||
|
myLineEditElements->setValidator(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
||||||
|
aViewWindow->SetSelectionMode( CellSelection );
|
||||||
|
myLineEditElements->setReadOnly(false);
|
||||||
|
myLineEditElements->setValidator(myIdValidator);
|
||||||
|
onTextChange(myLineEditElements->text());
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectionIntoArgument();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : isValid
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
|
||||||
|
bool SMESHGUI_CopyMeshDlg::isValid()
|
||||||
|
{
|
||||||
|
if ( myIdSourceCheck->isChecked() )
|
||||||
|
return !mySelectedObject->_is_nil();
|
||||||
|
|
||||||
|
return myNbOkElements > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : DeactivateActiveDialog()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_CopyMeshDlg::DeactivateActiveDialog()
|
||||||
|
{
|
||||||
|
if (ConstructorsBox->isEnabled()) {
|
||||||
|
ConstructorsBox->setEnabled(false);
|
||||||
|
GroupArguments->setEnabled(false);
|
||||||
|
GroupButtons->setEnabled(false);
|
||||||
|
mySMESHGUI->ResetState();
|
||||||
|
mySMESHGUI->SetActiveDialogBox(0);
|
||||||
|
if ( mySelectionMgr )
|
||||||
|
mySelectionMgr->removeFilter( myIdSourceFilter );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : ActivateThisDialog()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_CopyMeshDlg::ActivateThisDialog()
|
||||||
|
{
|
||||||
|
/* Emit a signal to deactivate the active dialog */
|
||||||
|
mySMESHGUI->EmitSignalDeactivateDialog();
|
||||||
|
ConstructorsBox->setEnabled(true);
|
||||||
|
GroupArguments->setEnabled(true);
|
||||||
|
GroupButtons->setEnabled(true);
|
||||||
|
|
||||||
|
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
|
||||||
|
|
||||||
|
onSelectIdSource( myIdSourceCheck->isChecked() );
|
||||||
|
|
||||||
|
SelectionIntoArgument();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : enterEvent()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_CopyMeshDlg::enterEvent (QEvent*)
|
||||||
|
{
|
||||||
|
if (!ConstructorsBox->isEnabled())
|
||||||
|
ActivateThisDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : closeEvent()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_CopyMeshDlg::closeEvent (QCloseEvent*)
|
||||||
|
{
|
||||||
|
/* same than click on cancel button */
|
||||||
|
ClickOnCancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : hideEvent
|
||||||
|
//purpose : caused by ESC key
|
||||||
|
//=======================================================================
|
||||||
|
void SMESHGUI_CopyMeshDlg::hideEvent (QHideEvent*)
|
||||||
|
{
|
||||||
|
if (!isMinimized())
|
||||||
|
ClickOnCancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : keyPressEvent()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_CopyMeshDlg::keyPressEvent( QKeyEvent* e )
|
||||||
|
{
|
||||||
|
QDialog::keyPressEvent( e );
|
||||||
|
if ( e->isAccepted() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ( e->key() == Qt::Key_F1 ) {
|
||||||
|
e->accept();
|
||||||
|
ClickOnHelp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : setFilters()
|
||||||
|
// purpose : SLOT. Called when "Filter" button pressed.
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_CopyMeshDlg::setFilters()
|
||||||
|
{
|
||||||
|
if(myMesh->_is_nil()) {
|
||||||
|
SUIT_MessageBox::critical(this,
|
||||||
|
tr("SMESH_ERROR"),
|
||||||
|
tr("NO_MESH_SELECTED"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( !myFilterDlg )
|
||||||
|
myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
|
||||||
|
|
||||||
|
myFilterDlg->SetSelection();
|
||||||
|
myFilterDlg->SetMesh( myMesh );
|
||||||
|
myFilterDlg->SetSourceWg( myLineEditElements );
|
||||||
|
|
||||||
|
myFilterDlg->show();
|
||||||
|
}
|
125
src/SMESHGUI/SMESHGUI_CopyMeshDlg.h
Normal file
125
src/SMESHGUI/SMESHGUI_CopyMeshDlg.h
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
// 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
|
||||||
|
//
|
||||||
|
|
||||||
|
// SMESH SMESHGUI : GUI for SMESH component
|
||||||
|
// File : SMESHGUI_CopyMeshDlg.h
|
||||||
|
//
|
||||||
|
#ifndef SMESHGUI_CopyMeshDLG_H
|
||||||
|
#define SMESHGUI_CopyMeshDLG_H
|
||||||
|
|
||||||
|
// SMESH includes
|
||||||
|
#include "SMESH_SMESHGUI.hxx"
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
// IDL includes
|
||||||
|
#include <SALOMEconfig.h>
|
||||||
|
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||||
|
|
||||||
|
class QCheckBox;
|
||||||
|
class QGroupBox;
|
||||||
|
class QLabel;
|
||||||
|
class QLineEdit;
|
||||||
|
class QPushButton;
|
||||||
|
|
||||||
|
class SMESHGUI;
|
||||||
|
class SMESHGUI_IdValidator;
|
||||||
|
class SMESHGUI_FilterDlg;
|
||||||
|
class SMESH_Actor;
|
||||||
|
class SVTK_Selector;
|
||||||
|
class LightApp_SelectionMgr;
|
||||||
|
class SUIT_SelectionFilter;
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// class : SMESHGUI_CopyMeshDlg
|
||||||
|
// purpose : copy some elements or a mesh object into a new mesh
|
||||||
|
//=================================================================================
|
||||||
|
|
||||||
|
class SMESHGUI_EXPORT SMESHGUI_CopyMeshDlg : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
SMESHGUI_CopyMeshDlg( SMESHGUI* );
|
||||||
|
~SMESHGUI_CopyMeshDlg();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void Init( bool = true );
|
||||||
|
void closeEvent( QCloseEvent* );
|
||||||
|
void enterEvent( QEvent* ); /* mouse enter the QWidget */
|
||||||
|
void hideEvent( QHideEvent* ); /* ESC key */
|
||||||
|
void keyPressEvent( QKeyEvent* );
|
||||||
|
int GetConstructorId();
|
||||||
|
void setNewMeshName();
|
||||||
|
|
||||||
|
bool isValid();
|
||||||
|
|
||||||
|
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||||
|
SMESHGUI_IdValidator* myIdValidator;
|
||||||
|
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||||
|
int myNbOkElements; /* to check when elements are defined */
|
||||||
|
|
||||||
|
SVTK_Selector* mySelector;
|
||||||
|
|
||||||
|
bool myBusy;
|
||||||
|
SMESH::SMESH_Mesh_var myMesh;
|
||||||
|
SMESH_Actor* myActor;
|
||||||
|
SUIT_SelectionFilter* myIdSourceFilter;
|
||||||
|
|
||||||
|
SMESH::SMESH_IDSource_var mySelectedObject;
|
||||||
|
|
||||||
|
QGroupBox* ConstructorsBox;
|
||||||
|
QGroupBox* GroupArguments;
|
||||||
|
QGroupBox* GroupButtons;
|
||||||
|
|
||||||
|
QPushButton* buttonOk;
|
||||||
|
QPushButton* buttonCancel;
|
||||||
|
QPushButton* buttonApply;
|
||||||
|
QPushButton* buttonHelp;
|
||||||
|
|
||||||
|
QLabel* myTextLabelElements;
|
||||||
|
QLineEdit* myLineEditElements;
|
||||||
|
QLineEdit* myMeshNameEdit;
|
||||||
|
QCheckBox* myIdSourceCheck;
|
||||||
|
QCheckBox* myCopyGroupsCheck;
|
||||||
|
QCheckBox* myKeepIdsCheck;
|
||||||
|
|
||||||
|
QPushButton* myFilterBtn;
|
||||||
|
SMESHGUI_FilterDlg* myFilterDlg;
|
||||||
|
|
||||||
|
QString myHelpFileName;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void ClickOnOk();
|
||||||
|
void ClickOnCancel();
|
||||||
|
bool ClickOnApply();
|
||||||
|
void ClickOnHelp();
|
||||||
|
void SelectionIntoArgument();
|
||||||
|
void DeactivateActiveDialog();
|
||||||
|
void ActivateThisDialog();
|
||||||
|
void onTextChange( const QString& );
|
||||||
|
void onSelectIdSource( bool );
|
||||||
|
void setFilters();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SMESHGUI_CopyMeshDLG_H
|
@ -214,7 +214,7 @@ namespace SMESH
|
|||||||
QString IOR = app->orb()->object_to_string( theObject );
|
QString IOR = app->orb()->object_to_string( theObject );
|
||||||
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
|
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
|
||||||
if ( study && !IOR.isEmpty() )
|
if ( study && !IOR.isEmpty() )
|
||||||
res = study->studyDS()->FindObjectIOR( IOR.toLatin1().constData() );
|
res = study->studyDS()->FindObjectIOR( IOR.toLatin1().constData() );
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,10 @@
|
|||||||
<source>ICON_BUILD_COMPOUND</source>
|
<source>ICON_BUILD_COMPOUND</source>
|
||||||
<translation>mesh_build_compound.png</translation>
|
<translation>mesh_build_compound.png</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>ICON_COPY_MESH</source>
|
||||||
|
<translation>copy_mesh.png</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>ICON_COMPUTE</source>
|
<source>ICON_COMPUTE</source>
|
||||||
<translation>mesh_compute.png</translation>
|
<translation>mesh_compute.png</translation>
|
||||||
@ -109,6 +113,10 @@
|
|||||||
<source>ICON_DLG_BUILD_COMPOUND_MESH</source>
|
<source>ICON_DLG_BUILD_COMPOUND_MESH</source>
|
||||||
<translation>mesh_build_compound.png</translation>
|
<translation>mesh_build_compound.png</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>ICON_DLG_COPY_MESH</source>
|
||||||
|
<translation>copy_mesh.png</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>ICON_DLG_ELEM0D</source>
|
<source>ICON_DLG_ELEM0D</source>
|
||||||
<translation>mesh_vertex.png</translation>
|
<translation>mesh_vertex.png</translation>
|
||||||
|
@ -187,6 +187,10 @@
|
|||||||
<source>MEN_BUILD_COMPOUND</source>
|
<source>MEN_BUILD_COMPOUND</source>
|
||||||
<translation>Build Compound</translation>
|
<translation>Build Compound</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>MEN_COPY_MESH</source>
|
||||||
|
<translation>Copy Mesh</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>MEN_CLIP</source>
|
<source>MEN_CLIP</source>
|
||||||
<translation>Clipping</translation>
|
<translation>Clipping</translation>
|
||||||
@ -1052,6 +1056,14 @@ Please enter correct values and try again</translation>
|
|||||||
<source>SMESH_BUILD_COMPOUND_TITLE</source>
|
<source>SMESH_BUILD_COMPOUND_TITLE</source>
|
||||||
<translation>Create a Compound</translation>
|
<translation>Create a Compound</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>SMESH_COPY_MESH_TITLE</source>
|
||||||
|
<translation>Copy Mesh</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>SMESH_KEEP_IDS</source>
|
||||||
|
<translation>Preserve IDs of elements</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>SMESH_BUT_ADD</source>
|
<source>SMESH_BUT_ADD</source>
|
||||||
<translation>A&dd</translation>
|
<translation>A&dd</translation>
|
||||||
@ -2280,6 +2292,10 @@ Consider saving your work before application crash</translation>
|
|||||||
<source>STB_BUILD_COMPOUND</source>
|
<source>STB_BUILD_COMPOUND</source>
|
||||||
<translation>Build Compound Mesh</translation>
|
<translation>Build Compound Mesh</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>STB_COPY_MESH</source>
|
||||||
|
<translation>Copy Mesh</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>STB_CLIP</source>
|
<source>STB_CLIP</source>
|
||||||
<translation>Clipping</translation>
|
<translation>Clipping</translation>
|
||||||
@ -2832,6 +2848,10 @@ Consider saving your work before application crash</translation>
|
|||||||
<source>TOP_BUILD_COMPOUND</source>
|
<source>TOP_BUILD_COMPOUND</source>
|
||||||
<translation>Build Compound Mesh</translation>
|
<translation>Build Compound Mesh</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>TOP_COPY_MESH</source>
|
||||||
|
<translation>Copy Mesh</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>TOP_CLIP</source>
|
<source>TOP_CLIP</source>
|
||||||
<translation>Clipping</translation>
|
<translation>Clipping</translation>
|
||||||
@ -5812,6 +5832,21 @@ It is impossible to read point coordinates from file</translation>
|
|||||||
<translation>Distance</translation>
|
<translation>Distance</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>SMESHGUI_CopyMeshDlg</name>
|
||||||
|
<message>
|
||||||
|
<source>OBJECT_NAME</source>
|
||||||
|
<translation>Source Object</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>ELEM_IDS</source>
|
||||||
|
<translation>Source Element IDs</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>NEW_NAME</source>
|
||||||
|
<translation>New Mesh Name</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>SMESHGUI_MeasureDlg</name>
|
<name>SMESHGUI_MeasureDlg</name>
|
||||||
<message>
|
<message>
|
||||||
|
Loading…
Reference in New Issue
Block a user