#include "SMESHGUI_Hypotheses.h"
#include "SMESHGUI_Make2DFrom3DOp.h"
#include "SMESHGUI_MakeNodeAtPointDlg.h"
-//#include "SMESHGUI_MeshInfosDlg.h"
#include "SMESHGUI_Measurements.h"
#include "SMESHGUI_MeshInfo.h"
#include "SMESHGUI_MeshOp.h"
#include "SMESHGUI_SewingDlg.h"
#include "SMESHGUI_SingleEditDlg.h"
#include "SMESHGUI_SmoothingDlg.h"
-//#include "SMESHGUI_StandardMeshInfosDlg.h"
#include "SMESHGUI_SymmetryDlg.h"
#include "SMESHGUI_TranslationDlg.h"
#include "SMESHGUI_ScaleDlg.h"
}
break;
}
- /*
- case 902: // STANDARD MESH INFOS
- {
- EmitSignalDeactivateDialog();
- LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
- SALOME_ListIO selected;
- if( aSel )
- aSel->selectedObjects( selected );
-
- if ( selected.Extent() > 1 ) { // a dlg for each IO
- SALOME_ListIO IOs;
- SALOME_ListIteratorOfListIO It (selected);
- for ( ; It.More(); It.Next() ) {
- IOs.Clear();
- IOs.Append( It.Value() );
- aSel->setSelectedObjects( IOs );
- ( new SMESHGUI_StandardMeshInfosDlg( this ) )->show();
- }
- // restore selection
- aSel->setSelectedObjects( selected );
- }
- else
- ( new SMESHGUI_StandardMeshInfosDlg( this ) )->show();
- break;
- }
- case 903: // WHAT IS
- {
- EmitSignalDeactivateDialog();
- ( new SMESHGUI_WhatIsDlg( this ) )->show();
- break;
- }
- */
case 904: // FIND ELEM
{
+++ /dev/null
-// Copyright (C) 2007-2011 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_MeshInfosDlg.cxx
-// Author : Nicolas BARBEROU
-// SMESH includes
-//
-#include "SMESHGUI_MeshInfosDlg.h"
-
-#include "SMESHGUI.h"
-#include "SMESHGUI_Utils.h"
-#include "SMESHGUI_MeshInfosBox.h"
-
-// SALOME GUI includes
-#include <SUIT_Desktop.h>
-#include <SUIT_ResourceMgr.h>
-#include <SUIT_OverrideCursor.h>
-#include <SUIT_Session.h>
-#include <SUIT_MessageBox.h>
-
-#include <LightApp_SelectionMgr.h>
-#include <LightApp_Application.h>
-#include <SALOME_ListIO.hxx>
-
-// SALOME KERNEL includes
-#include <SALOMEDSClient_Study.hxx>
-
-// Qt includes
-#include <QGroupBox>
-#include <QLabel>
-#include <QFrame>
-#include <QStackedWidget>
-#include <QVBoxLayout>
-#include <QHBoxLayout>
-#include <QGridLayout>
-#include <QPushButton>
-#include <QKeyEvent>
-
-// IDL includes
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SMESH_Mesh)
-#include CORBA_SERVER_HEADER(SMESH_Group)
-
-#define COLONIZE(str) (QString(str).contains(":") > 0 ? QString(str) : QString(str) + " :" )
-#define SPACING 6
-#define MARGIN 11
-
-//=================================================================================
-// function : SMESHGUI_MeshInfosDlg()
-// purpose : Constructor
-//=================================================================================
-SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg(SMESHGUI* theModule):
- QDialog(SMESH::GetDesktop(theModule)),
- mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
- mySMESHGUI(theModule)
-{
- setModal( false );
- setAttribute( Qt::WA_DeleteOnClose, true );
- setWindowTitle(tr("SMESH_MESHINFO_TITLE"));
- setSizeGripEnabled(true);
-
- myStartSelection = true;
- myIsActiveWindow = true;
-
- QVBoxLayout* aTopLayout = new QVBoxLayout(this);
- aTopLayout->setSpacing(SPACING); aTopLayout->setMargin(MARGIN);
-
- // select button & label
- QPixmap image0(SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH",tr("ICON_SELECT")));
- mySelectBtn = new QPushButton(this);
- mySelectBtn->setIcon(image0);
- mySelectBtn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
-
- mySelectLab = new QLabel(this);
- mySelectLab->setAlignment(Qt::AlignCenter);
- QFont fnt = mySelectLab->font(); fnt.setBold(true);
- mySelectLab->setFont(fnt);
-
- QHBoxLayout* aSelectLayout = new QHBoxLayout;
- aSelectLayout->setMargin(0); aSelectLayout->setSpacing(0);
- aSelectLayout->addWidget(mySelectBtn);
- aSelectLayout->addWidget(mySelectLab);
-
- // top widget stack
- myWGStack = new QStackedWidget(this);
-
- // no valid selection
- QWidget* myBadWidget = new QWidget(myWGStack);
- QVBoxLayout* aBadLayout = new QVBoxLayout(myBadWidget);
- QLabel* myBadLab = new QLabel(tr("SMESH_BAD_SELECTION"), myBadWidget);
- myBadLab->setAlignment(Qt::AlignCenter);
- myBadLab->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
- aBadLayout->addWidget(myBadLab);
- myWGStack->addWidget(myBadWidget);
-
- // mesh
- myMeshWidget = new QWidget(myWGStack);
- QGridLayout* aMeshLayout = new QGridLayout(myMeshWidget);
- aMeshLayout->setSpacing(SPACING); aMeshLayout->setMargin(0);
- myWGStack->addWidget(myMeshWidget);
-
- // --> name
- QLabel* myMeshNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), myMeshWidget);
- myMeshName = new QLabel(myMeshWidget);
- myMeshName->setMinimumWidth(100);
- QFrame* line1 = new QFrame(myMeshWidget);
- line1->setFrameStyle(QFrame::HLine | QFrame::Sunken);
-
- myMeshInfoBox = new SMESHGUI_MeshInfosBox(true, myMeshWidget);
-
- aMeshLayout->addWidget(myMeshNameLab, 0, 0);
- aMeshLayout->addWidget(myMeshName, 0, 1);
- aMeshLayout->addWidget(line1, 1, 0, 1, 2);
- aMeshLayout->addWidget(myMeshInfoBox, 2, 0, 1, 2);
- aMeshLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 3, 0);
-
- // buttons
- myButtonsGroup = new QGroupBox(this);
- QHBoxLayout* myButtonsGroupLayout = new QHBoxLayout(myButtonsGroup);
- myButtonsGroupLayout->setSpacing(SPACING); myButtonsGroupLayout->setMargin(MARGIN);
-
- // buttons --> OK and Help buttons
- myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), myButtonsGroup);
- myOkBtn->setAutoDefault(true);
- myOkBtn->setDefault(true);
- myOkBtn->setFocus();
- myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP" ), myButtonsGroup);
- myHelpBtn->setAutoDefault(true);
-
- myButtonsGroupLayout->addWidget(myOkBtn);
- myButtonsGroupLayout->addSpacing(10);
- myButtonsGroupLayout->addStretch();
- myButtonsGroupLayout->addWidget(myHelpBtn);
-
- aTopLayout->addLayout(aSelectLayout);
- aTopLayout->addWidget(myWGStack);
- aTopLayout->addWidget(myButtonsGroup);
-
- mySMESHGUI->SetActiveDialogBox(this);
-
- // connect signals
- connect(myOkBtn, SIGNAL(clicked()), this, SLOT(close()));
- connect( myHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp()));
- connect(mySelectBtn, SIGNAL(clicked()), this, SLOT(onStartSelection()));
- connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(close()));
- connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
- connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
-
- // init dialog with current selection
- onSelectionChanged();
-
- myHelpFileName = "mesh_infos_page.html#advanced_mesh_infos_anchor";
-}
-
-//=================================================================================
-// function : ~SMESHGUI_MeshInfosDlg()
-// purpose : Destructor
-//=================================================================================
-SMESHGUI_MeshInfosDlg::~SMESHGUI_MeshInfosDlg()
-{
-}
-
-//=================================================================================
-// function : DumpMeshInfos()
-// purpose :
-//=================================================================================
-void SMESHGUI_MeshInfosDlg::DumpMeshInfos()
-{
- SUIT_OverrideCursor wc;
-
- SALOME_ListIO aList;
- mySelectionMgr->selectedObjects(aList);
-
- int nbSel = aList.Extent();
- if (nbSel == 1) {
- myStartSelection = false;
- mySelectLab->setText("");
- Handle(SALOME_InteractiveObject) IObject = aList.First();
- _PTR(SObject) aSO = SMESH::GetActiveStudyDocument()->FindObjectID(IObject->getEntry());
- if (aSO) {
- //CORBA::Object_var anObject = aSO->GetObject();
- CORBA::Object_var anObject = SMESH::SObjectToObject(aSO);
- if (!CORBA::is_nil(anObject)) {
- SMESH::SMESH_IDSource_var anIDSource = SMESH::SMESH_IDSource::_narrow(anObject);
- if (!anIDSource->_is_nil()) {
- myWGStack->setCurrentWidget(myMeshWidget);
- setWindowTitle(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_OBJECT_MESH") + "]");
- myMeshName->setText(aSO->GetName().c_str());
-
- SMESH::long_array_var aMeshInfo = anIDSource->GetMeshInfo();
- myMeshInfoBox->SetMeshInfo( aMeshInfo );
-
- return;
- }
- }
- }
- }
- myWGStack->setCurrentIndex(0);
- setWindowTitle(tr("SMESH_MESHINFO_TITLE"));
-}
-
-//=================================================================================
-// function : SelectionIntoArgument()
-// purpose : Called when selection has changed
-//=================================================================================
-void SMESHGUI_MeshInfosDlg::onSelectionChanged()
-{
- if (myStartSelection)
- DumpMeshInfos();
-}
-
-//=================================================================================
-// function : closeEvent()
-// purpose :
-//=================================================================================
-void SMESHGUI_MeshInfosDlg::closeEvent(QCloseEvent* e)
-{
- mySMESHGUI->ResetState();
- QDialog::closeEvent(e);
-}
-
-//=================================================================================
-// function : windowActivationChange()
-// purpose : called when window is activated/deactivated
-//=================================================================================
-void SMESHGUI_MeshInfosDlg::windowActivationChange(bool oldActive)
-{
- QDialog::windowActivationChange(oldActive);
- if (isActiveWindow() && myIsActiveWindow != isActiveWindow())
- ActivateThisDialog();
- myIsActiveWindow = isActiveWindow();
-}
-
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose :
-//=================================================================================
-void SMESHGUI_MeshInfosDlg::DeactivateActiveDialog()
-{
- disconnect(mySelectionMgr, 0, this, 0);
-}
-
-//=================================================================================
-// function : ActivateThisDialog()
-// purpose :
-//=================================================================================
-void SMESHGUI_MeshInfosDlg::ActivateThisDialog()
-{
- /* Emit a signal to deactivate any active dialog */
- mySMESHGUI->EmitSignalDeactivateDialog();
- connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
-}
-
-//=================================================================================
-// function : onStartSelection()
-// purpose : starts selection
-//=================================================================================
-void SMESHGUI_MeshInfosDlg::onStartSelection()
-{
- myStartSelection = true;
- onSelectionChanged();
- myStartSelection = true;
- mySelectLab->setText(tr("INF_SELECT_OBJECT"));
-}
-
-//=================================================================================
-// function : onHelp()
-// purpose :
-//=================================================================================
-void SMESHGUI_MeshInfosDlg::onHelp()
-{
- 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 : keyPressEvent()
-// purpose :
-//=================================================================================
-void SMESHGUI_MeshInfosDlg::keyPressEvent( QKeyEvent* e )
-{
- QDialog::keyPressEvent( e );
- if ( e->isAccepted() )
- return;
-
- if ( e->key() == Qt::Key_F1 ) {
- e->accept();
- onHelp();
- }
-}
+++ /dev/null
-// Copyright (C) 2007-2011 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_MeshInfosDlg.h
-// Author : Nicolas BARBEROU
-//
-#ifndef SMESHGUI_MESHINFOSDLG_H
-#define SMESHGUI_MESHINFOSDLG_H
-
-// SMESH includes
-#include "SMESH_SMESHGUI.hxx"
-
-// Qt includes
-#include <QDialog>
-
-class QGroupBox;
-class QLabel;
-class QPushButton;
-class QStackedWidget;
-
-class LightApp_SelectionMgr;
-class SMESHGUI;
-class SMESHGUI_MeshInfosBox;
-
-class SMESHGUI_EXPORT SMESHGUI_MeshInfosDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- SMESHGUI_MeshInfosDlg( SMESHGUI* );
- ~SMESHGUI_MeshInfosDlg();
-
-protected:
- void closeEvent( QCloseEvent* );
- void keyPressEvent( QKeyEvent* );
- void windowActivationChange( bool );
- void DumpMeshInfos();
-
-private slots:
- void onSelectionChanged();
- void DeactivateActiveDialog();
- void ActivateThisDialog();
- void onStartSelection();
- void onHelp();
-
-private:
- SMESHGUI* mySMESHGUI;
- LightApp_SelectionMgr* mySelectionMgr;
- bool myStartSelection;
- bool myIsActiveWindow;
-
- QPushButton* mySelectBtn;
- QLabel* mySelectLab;
-
- QStackedWidget* myWGStack;
-
- QWidget* myMeshWidget;
- QLabel* myMeshName;
- SMESHGUI_MeshInfosBox* myMeshInfoBox;
-
- QGroupBox* myButtonsGroup;
- QPushButton* myOkBtn;
- QPushButton* myHelpBtn;
-
- QString myHelpFileName;
-};
-
-#endif // SMESHGUI_MESHINFOSDLG_H
+++ /dev/null
-// Copyright (C) 2007-2011 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_MoveNodesDlg.cxx
-// Author : Nicolas REJNERI, Open CASCADE S.A.S.
-// SMESH includes
-//
-#include "SMESHGUI_MoveNodesDlg.h"
-
-#include "SMESHGUI.h"
-#include "SMESHGUI_SpinBox.h"
-#include "SMESHGUI_IdValidator.h"
-#include "SMESHGUI_Utils.h"
-#include "SMESHGUI_VTKUtils.h"
-#include "SMESHGUI_MeshUtils.h"
-
-#include <SMESH_Actor.h>
-#include <SMDS_Mesh.hxx>
-
-// SALOME GUI includes
-#include <LightApp_SelectionMgr.h>
-#include <LightApp_Application.h>
-#include <SUIT_ResourceMgr.h>
-#include <SUIT_Desktop.h>
-#include <SUIT_Session.h>
-#include <SUIT_MessageBox.h>
-
-#include <SVTK_ViewModel.h>
-#include <SVTK_ViewWindow.h>
-#include <SALOME_ListIO.hxx>
-
-#include <VTKViewer_CellLocationsArray.h>
-
-// OCCT includes
-#include <TColStd_MapOfInteger.hxx>
-
-// VTK includes
-#include <vtkIdList.h>
-#include <vtkCellArray.h>
-#include <vtkUnsignedCharArray.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkDataSetMapper.h>
-#include <vtkProperty.h>
-
-// Qt includes
-#include <QGroupBox>
-#include <QLabel>
-#include <QLineEdit>
-#include <QPushButton>
-#include <QRadioButton>
-#include <QHBoxLayout>
-#include <QVBoxLayout>
-#include <QKeyEvent>
-#include <QButtonGroup>
-
-// IDL includes
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SMESH_Mesh)
-#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
-
-#define SPACING 6
-#define MARGIN 11
-
-//=================================================================================
-// name : SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg
-// Purpose :
-//=================================================================================
-SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg(SMESHGUI* theModule):
- QDialog(SMESH::GetDesktop(theModule)),
- mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
- mySMESHGUI(theModule)
-{
- myPreviewActor = 0;
- myBusy = false;
-
- setModal(false);
- setWindowTitle(tr("CAPTION"));
-
- QVBoxLayout* aDlgLay = new QVBoxLayout(this);
- aDlgLay->setSpacing(SPACING);
- aDlgLay->setMargin(MARGIN);
-
- QWidget* aMainFrame = createMainFrame (this);
- QWidget* aBtnFrame = createButtonFrame(this);
-
- aDlgLay->addWidget(aMainFrame);
- aDlgLay->addWidget(aBtnFrame);
-
- mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector();
-
- myHelpFileName = "moving_nodes_page.html";
-
- Init();
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::createButtonFrame
-// Purpose : Create frame containing buttons
-//=======================================================================
-QWidget* SMESHGUI_MoveNodesDlg::createButtonFrame (QWidget* theParent)
-{
- QFrame* aFrame = new QFrame(theParent);
- aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
-
- myOkBtn = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aFrame);
- myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame);
- myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame);
- myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame);
-
- QHBoxLayout* aLay = new QHBoxLayout(aFrame);
- aLay->setSpacing(SPACING);
- aLay->setMargin(MARGIN);
-
- aLay->addWidget(myOkBtn);
- aLay->addSpacing(10);
- aLay->addWidget(myApplyBtn);
- aLay->addSpacing(10);
- aLay->addStretch();
- aLay->addWidget(myCloseBtn);
- aLay->addWidget(myHelpBtn);
-
- connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk()));
- connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
- connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
- connect(myHelpBtn, SIGNAL(clicked()), SLOT(onHelp()));
-
- return aFrame;
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::createMainFrame
-// Purpose : Create frame containing dialog's input fields
-//=======================================================================
-QWidget* SMESHGUI_MoveNodesDlg::createMainFrame (QWidget* theParent)
-{
- QWidget* aFrame = new QWidget(theParent);
-
- QPixmap iconMoveNode (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_MOVE_NODE")));
- QPixmap iconSelect (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
-
- //------------------------------------------------------------
- QGroupBox* aPixGrp = new QGroupBox(tr("MESH_NODE"), aFrame);
- QButtonGroup* aBtnGrp = new QButtonGroup(this);
- QHBoxLayout* aPixGrpLayout = new QHBoxLayout(aPixGrp);
- aPixGrpLayout->setSpacing(SPACING);
- aPixGrpLayout->setMargin(MARGIN);
-
- QRadioButton* aRBut = new QRadioButton(aPixGrp);
- aRBut->setIcon(iconMoveNode);
- aRBut->setChecked(true);
-
- aPixGrpLayout->addWidget(aRBut);
- aBtnGrp->addButton(aRBut, 0);
-
- //------------------------------------------------------------
- QGroupBox* anIdGrp = new QGroupBox(tr("SMESH_MOVE"), aFrame);
- QHBoxLayout* anIdGrpLayout = new QHBoxLayout(anIdGrp);
- anIdGrpLayout->setSpacing(SPACING);
- anIdGrpLayout->setMargin(MARGIN);
-
- QLabel* idLabl = new QLabel(tr("NODE_ID"), anIdGrp);
- QPushButton* idBtn = new QPushButton(anIdGrp);
- idBtn->setIcon(iconSelect);
- myId = new QLineEdit(anIdGrp);
- myId->setValidator(new SMESHGUI_IdValidator(this, 1));
-
- anIdGrpLayout->addWidget(idLabl);
- anIdGrpLayout->addWidget(idBtn);
- anIdGrpLayout->addWidget(myId);
-
- //------------------------------------------------------------
- QGroupBox* aCoordGrp = new QGroupBox(tr("SMESH_COORDINATES"), aFrame);
- QHBoxLayout* aCoordGrpLayout = new QHBoxLayout(aCoordGrp);
- aCoordGrpLayout->setSpacing(SPACING);
- aCoordGrpLayout->setMargin(MARGIN);
-
- QLabel* aXLabel = new QLabel(tr("SMESH_X"), aCoordGrp);
- myX = new SMESHGUI_SpinBox(aCoordGrp);
-
- QLabel* aYLabel = new QLabel(tr("SMESH_Y"), aCoordGrp);
- myY = new SMESHGUI_SpinBox(aCoordGrp);
-
- QLabel* aZLabel = new QLabel(tr("SMESH_Z"), aCoordGrp);
- myZ = new SMESHGUI_SpinBox(aCoordGrp);
-
- aCoordGrpLayout->addWidget(aXLabel);
- aCoordGrpLayout->addWidget(myX);
- aCoordGrpLayout->addWidget(aYLabel);
- aCoordGrpLayout->addWidget(myY);
- aCoordGrpLayout->addWidget(aZLabel);
- aCoordGrpLayout->addWidget(myZ);
-
- //------------------------------------------------------------
- myX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, "length_precision");
- myY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, "length_precision");
- myZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, "length_precision");
-
- //------------------------------------------------------------
- QVBoxLayout* aLay = new QVBoxLayout(aFrame);
- aLay->setMargin(0);
- aLay->setMargin(SPACING);
- aLay->addWidget(aPixGrp);
- aLay->addWidget(anIdGrp);
- aLay->addWidget(aCoordGrp);
-
- //------------------------------------------------------------
- // connect signale and slots
- connect(myX, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
- connect(myY, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
- connect(myZ, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
- connect(myId, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&)));
-
- return aFrame;
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::~SMESHGUI_MoveNodesDlg
-// Purpose :
-//=======================================================================
-SMESHGUI_MoveNodesDlg::~SMESHGUI_MoveNodesDlg()
-{
- erasePreview();
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::Init
-// Purpose : Init dialog fields
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::Init()
-{
- myPreviewActor = 0;
- myMeshActor = 0;
- myBusy = false;
-
- mySMESHGUI->SetActiveDialogBox((QDialog*)this);
-
- // selection and SMESHGUI
- connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
- connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
- connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
-
- reset();
- setEnabled(true);
-
- // set selection mode
- SMESH::SetPointRepresentation(true);
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(NodeSelection);
-
- onSelectionDone();
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::isValid
-// Purpose : Verify validity of entry information
-//=======================================================================
-bool SMESHGUI_MoveNodesDlg::isValid (const bool theMess)
-{
- if (myId->text().isEmpty()) {
- if (theMess)
- SUIT_MessageBox::information(this, tr("SMESH_WARNING"),
- tr("NODE_ID_IS_NOT_DEFINED"));
- return false;
- }
-
- QString msg;
- bool ok = true;
- ok = myX->isValid( msg, theMess ) && ok;
- ok = myY->isValid( msg, theMess ) && ok;
- ok = myZ->isValid( msg, theMess ) && ok;
- if( !ok ) {
- if( theMess ) {
- QString str( tr( "SMESH_INCORRECT_INPUT" ) );
- if ( !msg.isEmpty() )
- str += "\n" + msg;
- SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
- }
- return false;
- }
-
- return true;
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::reset
-// Purpose : Reset the dialog state
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::reset()
-{
- myId->clear();
- myX->SetValue(0);
- myY->SetValue(0);
- myZ->SetValue(0);
- redisplayPreview();
- updateButtons();
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::onApply
-// Purpose : SLOT called when "Apply" button pressed.
-//=======================================================================
-bool SMESHGUI_MoveNodesDlg::onApply()
-{
- if (mySMESHGUI->isActiveStudyLocked())
- return false;
-
- if (!isValid(true))
- return false;
-
- SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO());
- if (aMesh->_is_nil()) {
- SUIT_MessageBox::information(this, tr("SMESH_ERROR"),
- tr("SMESHG_NO_MESH"));
- return false;
- }
-
- SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
- if (aMeshEditor->_is_nil())
- return false;
-
- int anId = myId->text().toInt();
- bool aResult = false;
- try {
- aResult = aMeshEditor->MoveNode(anId, myX->GetValue(), myY->GetValue(), myZ->GetValue());
-
- QStringList aParameters;
- aParameters << myX->text();
- aParameters << myY->text();
- aParameters << myZ->text();
- aMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
- } catch (...) {
- }
-
- if (aResult) {
- SALOME_ListIO aList;
- aList.Append(myMeshActor->getIO());
- mySelectionMgr->setSelectedObjects(aList,false);
- SMESH::UpdateView();
- SMESHGUI::Modified();
- reset();
- }
-
- return aResult;
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::onOk
-// Purpose : SLOT called when "Ok" button pressed.
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::onOk()
-{
- if (onApply())
- onClose();
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::onClose
-// Purpose : SLOT called when "Close" button pressed. Close dialog
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::onClose()
-{
- //mySelectionMgr->clearSelected();
- SMESH::SetPointRepresentation(false);
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(ActorSelection);
- disconnect(mySelectionMgr, 0, this, 0);
- disconnect(mySMESHGUI, 0, this, 0);
- erasePreview();
- mySMESHGUI->ResetState();
- reject();
-}
-
-//=================================================================================
-// function : onHelp()
-// purpose :
-//=================================================================================
-void SMESHGUI_MoveNodesDlg::onHelp()
-{
- 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));
- }
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::onTextChange
-// Purpose :
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::onTextChange (const QString& theNewText)
-{
- if (myBusy) return;
-
- myOkBtn->setEnabled(false);
- myApplyBtn->setEnabled(false);
- erasePreview();
-
- // select entered node
- if(myMeshActor){
- if(SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh()){
- myBusy = true;
- Handle(SALOME_InteractiveObject) anIO = myMeshActor->getIO();
- SALOME_ListIO aList;
- aList.Append(anIO);
- mySelectionMgr->setSelectedObjects(aList,false);
- myBusy = false;
-
- if(const SMDS_MeshElement *anElem = aMesh->FindElement(theNewText.toInt())) {
- TColStd_MapOfInteger aListInd;
- aListInd.Add(anElem->GetID());
- mySelector->AddOrRemoveIndex(anIO,aListInd, false);
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->highlight(anIO,true,true);
-
- onSelectionDone();
- }
- }
- }
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::onSelectionDone
-// Purpose : SLOT called when selection changed
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::onSelectionDone()
-{
- if (myBusy) return;
- myMeshActor = 0;
-
- SALOME_ListIO aList;
- mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
-
- if (aList.Extent() == 1) {
- Handle(SALOME_InteractiveObject) anIO = aList.First();
- myMeshActor = SMESH::FindActorByEntry(anIO->getEntry());
- if(myMeshActor){
- QString aText;
- if (SMESH::GetNameOfSelectedNodes(mySelector,anIO,aText) == 1) {
- if(SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh()) {
- if(const SMDS_MeshNode* aNode = aMesh->FindNode(aText.toInt())) {
- myBusy = true;
- myId->setText(aText);
- myX->SetValue(aNode->X());
- myY->SetValue(aNode->Y());
- myZ->SetValue(aNode->Z());
- myBusy = false;
- erasePreview(); // avoid overlapping of a selection and a preview
- updateButtons();
- return;
- }
- }
- }
- }
- }
-
- reset();
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::onDeactivate
-// Purpose : SLOT called when dialog must be deativated
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::onDeactivate()
-{
- setEnabled(false);
- erasePreview();
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::enterEvent
-// Purpose : Event filter
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::enterEvent (QEvent*)
-{
- if (!isEnabled()) {
- mySMESHGUI->EmitSignalDeactivateDialog();
-
- // set selection mode
- SMESH::SetPointRepresentation(true);
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(NodeSelection);
-
- redisplayPreview();
-
- setEnabled(true);
- }
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::closeEvent
-// Purpose :
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::closeEvent (QCloseEvent*)
-{
- onClose();
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->Repaint();
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::hideEvent
-// Purpose : may be caused by ESC key
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::hideEvent (QHideEvent*)
-{
- if (!isMinimized())
- onClose();
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::updateButtons
-// Purpose : Update buttons state
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::updateButtons()
-{
- bool isEnabled = isValid(false);
- myOkBtn->setEnabled(isEnabled);
- myApplyBtn->setEnabled(isEnabled);
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::erasePreview
-// Purpose : Erase preview
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::erasePreview()
-{
- if (myPreviewActor == 0)
- return;
-
- SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI );
- if (aViewWindow)
- aViewWindow->RemoveActor(myPreviewActor);
- myPreviewActor->Delete();
- myPreviewActor = 0;
- if (aViewWindow)
- aViewWindow->Repaint();
-}
-
-//=======================================================================
-// name : SMESHGUI_MoveNodesDlg::redisplayPreview
-// Purpose : Redisplay preview
-//=======================================================================
-void SMESHGUI_MoveNodesDlg::redisplayPreview()
-{
- if (myBusy)
- return;
-
- if (myPreviewActor != 0)
- erasePreview();
-
- if (!isValid(false))
- return;
-
- vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New();
-
- vtkPoints* aPoints = vtkPoints::New();
- aPoints->SetNumberOfPoints(1);
- aPoints->SetPoint(0, myX->GetValue(), myY->GetValue(), myZ->GetValue());
-
- // Create cells
-
- vtkIdList *anIdList = vtkIdList::New();
- anIdList->SetNumberOfIds(1);
-
- vtkCellArray *aCells = vtkCellArray::New();
- aCells->Allocate(2, 0);
-
- vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
- aCellTypesArray->SetNumberOfComponents(1);
- aCellTypesArray->Allocate(1);
-
- anIdList->SetId(0, 0);
- aCells->InsertNextCell(anIdList);
- aCellTypesArray->InsertNextValue(VTK_VERTEX);
- anIdList->Delete();
-
- VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
- aCellLocationsArray->SetNumberOfComponents(1);
- aCellLocationsArray->SetNumberOfTuples(1);
-
- aCells->InitTraversal();
- vtkIdType npts;
- aCellLocationsArray->SetValue(0, aCells->GetTraversalLocation(npts));
-
- aGrid->SetPoints(aPoints);
- aPoints->Delete();
-
- aGrid->SetCells(aCellTypesArray,aCellLocationsArray,aCells);
- aCellLocationsArray->Delete();
- aCellTypesArray->Delete();
- aCells->Delete();
-
- // Create and display actor
- vtkDataSetMapper* aMapper = vtkDataSetMapper::New();
- aMapper->SetInput(aGrid);
- aGrid->Delete();
-
- myPreviewActor = SALOME_Actor::New();
- myPreviewActor->PickableOff();
- myPreviewActor->SetMapper(aMapper);
- aMapper->Delete();
-
- vtkProperty* aProp = vtkProperty::New();
- aProp->SetRepresentationToWireframe();
- aProp->SetColor(250, 0, 250);
- aProp->SetPointSize(5);
- myPreviewActor->SetProperty(aProp);
- aProp->Delete();
-
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- {
- aViewWindow->AddActor(myPreviewActor);
- aViewWindow->Repaint();
- }
-}
-
-//=================================================================================
-// function : keyPressEvent()
-// purpose :
-//=================================================================================
-void SMESHGUI_MoveNodesDlg::keyPressEvent( QKeyEvent* e )
-{
- QDialog::keyPressEvent( e );
- if ( e->isAccepted() )
- return;
-
- if ( e->key() == Qt::Key_F1 ) {
- e->accept();
- onHelp();
- }
-}
+++ /dev/null
-// Copyright (C) 2007-2011 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_MoveNodesDlg.h
-// Author : Nicolas REJNERI, Open CASCADE S.A.S.
-//
-#ifndef SMESHGUI_MOVENODESDLG_H
-#define SMESHGUI_MOVENODESDLG_H
-
-// SMESH includes
-#include "SMESH_SMESHGUI.hxx"
-
-// Qt includes
-#include <QDialog>
-
-class QLineEdit;
-class QPushButton;
-
-class SMESHGUI;
-class SMESH_Actor;
-class SMESHGUI_SpinBox;
-class SALOME_Actor;
-class SVTK_Selector;
-class LightApp_SelectionMgr;
-
-//=================================================================================
-// class : SMESHGUI_MoveNodesDlg
-// purpose :
-//=================================================================================
-class SMESHGUI_EXPORT SMESHGUI_MoveNodesDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- SMESHGUI_MoveNodesDlg( SMESHGUI* );
- virtual ~SMESHGUI_MoveNodesDlg();
-
- void Init();
-
-private slots:
- void onOk();
- bool onApply();
- void onClose();
- void onHelp();
-
- void onDeactivate();
-
- void onSelectionDone();
- void redisplayPreview();
- void onTextChange( const QString& );
-
-private:
- void closeEvent( QCloseEvent* );
- void enterEvent( QEvent* );
- void hideEvent( QHideEvent* );
- void keyPressEvent( QKeyEvent* );
- void erasePreview();
- QWidget* createButtonFrame( QWidget* );
- QWidget* createMainFrame ( QWidget* );
- bool isValid( const bool );
- void reset();
- void updateButtons();
-
-private:
- QPushButton* myOkBtn;
- QPushButton* myApplyBtn;
- QPushButton* myCloseBtn;
- QPushButton* myHelpBtn;
-
- QLineEdit* myId;
- SMESHGUI_SpinBox* myX;
- SMESHGUI_SpinBox* myY;
- SMESHGUI_SpinBox* myZ;
-
- LightApp_SelectionMgr* mySelectionMgr;
- SVTK_Selector* mySelector;
- SMESHGUI* mySMESHGUI;
-
- SALOME_Actor* myPreviewActor;
- SMESH_Actor* myMeshActor;
- bool myBusy;
-
- QString myHelpFileName;
-};
-
-#endif // SMESHGUI_MOVENODESDLG_H
+++ /dev/null
-// Copyright (C) 2007-2011 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_StandardMeshInfosDlg.cxx
-// Author : Michael ZORIN, Open CASCADE S.A.S.
-// SMESH includes
-//
-#include "SMESHGUI_StandardMeshInfosDlg.h"
-
-#include "SMESHGUI.h"
-#include "SMESHGUI_Utils.h"
-#include "SMESHGUI_MeshUtils.h"
-
-#include <SMESH_TypeFilter.hxx>
-
-// SALOME KERNEL includes
-#include <SALOMEDSClient_Study.hxx>
-#include <SALOMEDSClient_SObject.hxx>
-
-// SALOME GUI includes
-#include <SUIT_Desktop.h>
-#include <SUIT_Session.h>
-#include <SUIT_OverrideCursor.h>
-#include <SUIT_MessageBox.h>
-#include <SUIT_ResourceMgr.h>
-
-#include <LightApp_Application.h>
-#include <LightApp_SelectionMgr.h>
-
-#include <SALOME_ListIO.hxx>
-
-// Qt includes
-#include <QGroupBox>
-#include <QLabel>
-#include <QVBoxLayout>
-#include <QHBoxLayout>
-#include <QLineEdit>
-#include <QTextBrowser>
-#include <QPushButton>
-#include <QKeyEvent>
-
-// IDL includes
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SMESH_Mesh)
-#include CORBA_SERVER_HEADER(SMESH_Group)
-
-#define SPACING 6
-#define MARGIN 11
-
-//=================================================================================
-/*!
- * SMESHGUI_StandardMeshInfosDlg::SMESHGUI_StandardMeshInfosDlg
- *
- * Constructor
- */
-//=================================================================================
-SMESHGUI_StandardMeshInfosDlg::SMESHGUI_StandardMeshInfosDlg( SMESHGUI* theModule )
- : QDialog( SMESH::GetDesktop( theModule ) ),
- mySMESHGUI( theModule ),
- mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
-{
- setModal(false);
- setAttribute(Qt::WA_DeleteOnClose, true);
- setWindowTitle(tr("SMESH_STANDARD_MESHINFO_TITLE"));
- setSizeGripEnabled(true);
-
- myStartSelection = true;
- myIsActiveWindow = true;
-
- // dialog layout
- QVBoxLayout* aDlgLayout = new QVBoxLayout(this);
- aDlgLayout->setSpacing(SPACING);
- aDlgLayout->setMargin(MARGIN);
-
- // mesh group box
- myMeshGroup = new QGroupBox(tr("SMESH_MESH"), this);
- QHBoxLayout* myMeshGroupLayout = new QHBoxLayout(myMeshGroup);
- myMeshGroupLayout->setSpacing(SPACING);
- myMeshGroupLayout->setMargin(MARGIN);
-
- // select button, label and line edit with mesh name
- myNameLab = new QLabel(tr("SMESH_NAME"), myMeshGroup);
- myMeshGroupLayout->addWidget(myNameLab);
-
- QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH",tr("ICON_SELECT")));
- mySelectBtn = new QPushButton(myMeshGroup);
- mySelectBtn->setIcon(image0);
- myMeshGroupLayout->addWidget(mySelectBtn);
-
- myMeshLine = new QLineEdit(myMeshGroup);
- myMeshGroupLayout->addWidget(myMeshLine);
-
- aDlgLayout->addWidget(myMeshGroup);
-
- // information group box
- myInfoGroup = new QGroupBox(tr("SMESH_INFORMATION"), this);
- QVBoxLayout* myInfoGroupLayout = new QVBoxLayout(myInfoGroup);
- myInfoGroupLayout->setSpacing(SPACING);
- myInfoGroupLayout->setMargin(MARGIN);
-
- // information text browser
- myInfo = new QTextBrowser(myInfoGroup);
- myInfo->setMinimumSize(200, 150);
- myInfoGroupLayout->addWidget(myInfo);
-
- aDlgLayout->addWidget(myInfoGroup);
-
- // buttons group
- myButtonsGroup = new QGroupBox(this);
- QHBoxLayout* myButtonsGroupLayout = new QHBoxLayout(myButtonsGroup);
- myButtonsGroupLayout->setSpacing(SPACING);
- myButtonsGroupLayout->setMargin(MARGIN);
-
- // buttons --> OK and Help buttons
- myOkBtn = new QPushButton(tr("SMESH_BUT_OK"), myButtonsGroup);
- myOkBtn->setAutoDefault(true); myOkBtn->setDefault(true);
- myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), myButtonsGroup);
- myHelpBtn->setAutoDefault(true);
-
- myButtonsGroupLayout->addWidget(myOkBtn);
- myButtonsGroupLayout->addSpacing(10);
- myButtonsGroupLayout->addStretch();
- myButtonsGroupLayout->addWidget(myHelpBtn);
-
- aDlgLayout->addWidget(myButtonsGroup);
-
- mySMESHGUI->SetActiveDialogBox(this);
-
- // connect signals
- connect( myOkBtn, SIGNAL(clicked()), this, SLOT(close()));
- connect( myHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp()));
- connect( mySelectBtn, SIGNAL(clicked()), this, SLOT(onStartSelection()));
- connect( mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(close()));
- connect( mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
- connect( mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
-
- // init dialog with current selection
- myMeshFilter = new SMESH_TypeFilter (MESH);
- mySelectionMgr->installFilter(myMeshFilter);
- onSelectionChanged();
-
- myHelpFileName = "mesh_infos_page.html#standard_mesh_infos_anchor";
-}
-
-//=================================================================================
-/*!
- * SMESHGUI_StandardMeshInfosDlg::~SMESHGUI_StandardMeshInfosDlg
- *
- * Destructor
- */
-//=================================================================================
-SMESHGUI_StandardMeshInfosDlg::~SMESHGUI_StandardMeshInfosDlg()
-{
-}
-
-//=================================================================================
-/*!
- * SMESHGUI_StandardMeshInfosDlg::DumpMeshInfos
- */
-//=================================================================================
-void SMESHGUI_StandardMeshInfosDlg::DumpMeshInfos()
-{
- SUIT_OverrideCursor wc;
-
- SALOME_ListIO aList;
- mySelectionMgr->selectedObjects(aList);
-
- int nbSel = aList.Extent();
- myInfo->clear();
- if (nbSel == 1) {
- myStartSelection = false;
- myMeshLine->setText("");
- SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(aList.First());
-
- if (!aMesh->_is_nil()) {
- QString aName, anInfo;
- SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aName);
- myMeshLine->setText(aName);
- int aNbNodes = (int)aMesh->NbNodes();
- int aNbEdges = (int)aMesh->NbEdges();
- int aNbFaces = (int)aMesh->NbFaces();
- int aNbVolumes = (int)aMesh->NbVolumes();
-
- int aDimension = 0;
- double aNbDimElements = 0;
- if (aNbVolumes > 0) {
- aNbDimElements = aNbVolumes;
- aDimension = 3;
- }
- else if(aNbFaces > 0) {
- aNbDimElements = aNbFaces;
- aDimension = 2;
- }
- else if(aNbEdges > 0) {
- aNbDimElements = aNbEdges;
- aDimension = 1;
- }
- else if(aNbNodes > 0) {
- aNbDimElements = aNbNodes;
- aDimension = 0;
- }
-
- // information about the mesh
- anInfo.append(QString("Nb of element of dimension %1:<b> %2</b><br>").arg(aDimension).arg(aNbDimElements));
- anInfo.append(QString("Nb of nodes: <b>%1</b><br><br>").arg(aNbNodes));
-
- // information about the groups of the mesh
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
- _PTR(SObject) aMeshSO = SMESH::FindSObject(aMesh);
- _PTR(SObject) anObj;
-
- bool hasGroup = false;
-
- // info about groups on nodes
- aMeshSO->FindSubObject(SMESH::Tag_NodeGroups, anObj);
- if (anObj) {
- _PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
- if (it->More()) {
- anInfo.append(QString("Groups:<br><br>"));
- hasGroup = true;
- }
- for ( ; it->More(); it->Next()) {
- _PTR(SObject) subObj = it->Value();
- CORBA::Object_var anObject = SMESH::SObjectToObject(subObj);
- SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
- if (!aGroup->_is_nil()) {
- anInfo.append(QString("- <b>%1</b><br>").arg(aGroup->GetName()));
- anInfo.append(QString("%1<br>").arg("on nodes"));
- anInfo.append(QString("%1<br>").arg(aGroup->Size()));
- // check if the group based on geometry
- SMESH::SMESH_GroupOnGeom_var aGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow(aGroup);
- if (!aGroupOnGeom->_is_nil()) {
- GEOM::GEOM_Object_var aGroupMainShape = aGroupOnGeom->GetShape();
- QString aShapeName = "<unknown>";
- _PTR(SObject) aGeomObj, aRef;
- if (subObj->FindSubObject(1, aGeomObj) && aGeomObj->ReferencedObject(aRef))
- aShapeName = aRef->GetName().c_str();
- anInfo.append(QString("based on <i>%1</i> geometry object<br><br>").arg(aShapeName));
- } else {
- anInfo.append(QString("<br>"));
- }
- }
- }
- }
-
- // info about groups on edges
- anObj.reset();
- aMeshSO->FindSubObject(SMESH::Tag_EdgeGroups, anObj);
- if (anObj) {
- _PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
- if (!hasGroup && it->More()) {
- anInfo.append(QString("Groups:<br><br>"));
- hasGroup = true;
- }
- for ( ; it->More(); it->Next()) {
- _PTR(SObject) subObj = it->Value();
- CORBA::Object_var anObject = SMESH::SObjectToObject(subObj);
- SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
- if (!aGroup->_is_nil()) {
- anInfo.append(QString("- <b>%1</b><br>").arg(aGroup->GetName()));
- anInfo.append(QString("%1<br>").arg("on edges"));
- anInfo.append(QString("%1<br>").arg(aGroup->Size()));
- // check if the group based on geometry
- SMESH::SMESH_GroupOnGeom_var aGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow(aGroup);
- if (!aGroupOnGeom->_is_nil()) {
- GEOM::GEOM_Object_var aGroupMainShape = aGroupOnGeom->GetShape();
- QString aShapeName = "<unknown>";
- _PTR(SObject) aGeomObj, aRef;
- if (subObj->FindSubObject(1, aGeomObj) && aGeomObj->ReferencedObject(aRef))
- aShapeName = aRef->GetName().c_str();
- anInfo.append(QString("based on <i>%1</i> geometry object<br><br>").arg(aShapeName));
- } else {
- anInfo.append(QString("<br>"));
- }
- }
- }
- }
-
- // info about groups on faces
- anObj.reset();
- aMeshSO->FindSubObject(SMESH::Tag_FaceGroups, anObj);
- if (anObj) {
- _PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
- if (!hasGroup && it->More()) {
- anInfo.append(QString("Groups:<br><br>"));
- hasGroup = true;
- }
- for ( ; it->More(); it->Next()) {
- _PTR(SObject) subObj = it->Value();
- CORBA::Object_var anObject = SMESH::SObjectToObject(subObj);
- SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
- if (!aGroup->_is_nil()) {
- anInfo.append(QString("- <b>%1</b><br>").arg(aGroup->GetName()));
- anInfo.append(QString("%1<br>").arg("on faces"));
- anInfo.append(QString("%1<br>").arg(aGroup->Size()));
- // check if the group based on geometry
- SMESH::SMESH_GroupOnGeom_var aGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow(aGroup);
- if (!aGroupOnGeom->_is_nil()) {
- GEOM::GEOM_Object_var aGroupMainShape = aGroupOnGeom->GetShape();
- QString aShapeName = "<unknown>";
- _PTR(SObject) aGeomObj, aRef;
- if (subObj->FindSubObject(1, aGeomObj) && aGeomObj->ReferencedObject(aRef))
- aShapeName = aRef->GetName().c_str();
- anInfo.append(QString("based on <i>%1</i> geometry object<br><br>").arg(aShapeName));
- } else {
- anInfo.append(QString("<br>"));
- }
- }
- }
- }
-
- // info about groups on volumes
- anObj.reset();
- aMeshSO->FindSubObject(SMESH::Tag_VolumeGroups, anObj);
- if (anObj) {
- _PTR(ChildIterator) it = aStudy->NewChildIterator(anObj);
- if (!hasGroup && it->More())
- anInfo.append(QString("Groups:<br>"));
- for ( ; it->More(); it->Next()) {
- _PTR(SObject) subObj = it->Value();
- CORBA::Object_var anObject = SMESH::SObjectToObject(subObj);
- SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject);
- if (!aGroup->_is_nil()) {
- anInfo.append(QString("- <b>%1</b><br>").arg(aGroup->GetName()));
- anInfo.append(QString("%1<br>").arg("on volumes"));
- anInfo.append(QString("%1<br>").arg(aGroup->Size()));
- // check if the group based on geometry
- SMESH::SMESH_GroupOnGeom_var aGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow(aGroup);
- if (!aGroupOnGeom->_is_nil()) {
- GEOM::GEOM_Object_var aGroupMainShape = aGroupOnGeom->GetShape();
- QString aShapeName = "<unknown>";
- _PTR(SObject) aGeomObj, aRef;
- if (subObj->FindSubObject(1, aGeomObj) && aGeomObj->ReferencedObject(aRef))
- aShapeName = aRef->GetName().c_str();
- anInfo.append(QString("based on <i>%1</i> geometry object<br><br>").arg(aShapeName));
- } else {
- anInfo.append(QString("<br>"));
- }
- }
- }
- }
-
- myInfo->setText(anInfo);
- return;
- }
- }
-}
-
-//=================================================================================
-// function : SelectionIntoArgument()
-// purpose : Called when selection has changed
-//=================================================================================
-void SMESHGUI_StandardMeshInfosDlg::onSelectionChanged()
-{
- if (myStartSelection)
- DumpMeshInfos();
-}
-
-//=================================================================================
-// function : closeEvent()
-// purpose :
-//=================================================================================
-void SMESHGUI_StandardMeshInfosDlg::closeEvent (QCloseEvent* e)
-{
- mySelectionMgr->clearFilters();
- mySMESHGUI->ResetState();
- QDialog::closeEvent(e);
-}
-
-//=================================================================================
-// function : windowActivationChange()
-// purpose : called when window is activated/deactivated
-//=================================================================================
-void SMESHGUI_StandardMeshInfosDlg::windowActivationChange (bool oldActive)
-{
- QDialog::windowActivationChange(oldActive);
- if (isActiveWindow() && myIsActiveWindow != isActiveWindow())
- ActivateThisDialog();
- myIsActiveWindow = isActiveWindow();
-}
-
-//=================================================================================
-// function : DeactivateActiveDialog()
-// purpose :
-//=================================================================================
-void SMESHGUI_StandardMeshInfosDlg::DeactivateActiveDialog()
-{
- disconnect(mySelectionMgr, 0, this, 0);
-}
-
-//=================================================================================
-// function : ActivateThisDialog()
-// purpose :
-//=================================================================================
-void SMESHGUI_StandardMeshInfosDlg::ActivateThisDialog()
-{
- /* Emit a signal to deactivate any active dialog */
- mySMESHGUI->EmitSignalDeactivateDialog();
- connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
-}
-
-//=================================================================================
-// function : onStartSelection()
-// purpose : starts selection
-//=================================================================================
-void SMESHGUI_StandardMeshInfosDlg::onStartSelection()
-{
- myStartSelection = true;
- mySelectionMgr->installFilter(myMeshFilter);
- myMeshLine->setText(tr("Select a mesh"));
- onSelectionChanged();
- myStartSelection = true;
-}
-
-//=================================================================================
-// function : onHelp()
-// purpose :
-//=================================================================================
-void SMESHGUI_StandardMeshInfosDlg::onHelp()
-{
- 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 : keyPressEvent()
-// purpose :
-//=================================================================================
-void SMESHGUI_StandardMeshInfosDlg::keyPressEvent( QKeyEvent* e )
-{
- QDialog::keyPressEvent( e );
- if ( e->isAccepted() )
- return;
-
- if ( e->key() == Qt::Key_F1 ) {
- e->accept();
- onHelp();
- }
-}
+++ /dev/null
-// Copyright (C) 2007-2011 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_StandardMeshInfosDlg.h
-// Author : Michael ZORIN, Open CASCADE S.A.S.
-//
-#ifndef SMESHGUI_STANDARDMESHINFOSDLG_H
-#define SMESHGUI_STANDARDMESHINFOSDLG_H
-
-// SMESH includes
-#include "SMESH_SMESHGUI.hxx"
-
-// Qt includes
-#include <QDialog>
-
-class QGroupBox;
-class QLabel;
-class QPushButton;
-class QLineEdit;
-class QTextBrowser;
-class SMESHGUI;
-class LightApp_SelectionMgr;
-class SUIT_SelectionFilter;
-
-class SMESHGUI_EXPORT SMESHGUI_StandardMeshInfosDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- SMESHGUI_StandardMeshInfosDlg( SMESHGUI* );
- ~SMESHGUI_StandardMeshInfosDlg();
-
-protected:
- void closeEvent( QCloseEvent* );
- void keyPressEvent( QKeyEvent* );
- void windowActivationChange( bool );
- void DumpMeshInfos();
-
-private slots:
- void onSelectionChanged();
- void DeactivateActiveDialog();
- void ActivateThisDialog();
- void onStartSelection();
- void onHelp();
-
-private:
- SMESHGUI* mySMESHGUI;
- LightApp_SelectionMgr* mySelectionMgr;
- bool myStartSelection;
- bool myIsActiveWindow;
-
- SUIT_SelectionFilter* myMeshFilter;
-
- QLabel* myNameLab;
- QPushButton* mySelectBtn;
- QLineEdit* myMeshLine;
-
- QTextBrowser* myInfo;
-
- QGroupBox* myMeshGroup;
- QGroupBox* myInfoGroup;
-
- QGroupBox* myButtonsGroup;
- QPushButton* myOkBtn;
- QPushButton* myHelpBtn;
-
- QString myHelpFileName;
-};
-
-#endif // SMESHGUI_STANDARDMESHINFOSDLG_H