From: ouv Date: Tue, 13 May 2008 12:11:43 +0000 (+0000) Subject: Unification of the VISU selection functionality X-Git-Tag: TG_VISU_2008_2008-06-26~48 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6dd4545cc5d5568627aab58f78a194cee7e991fc;p=modules%2Fvisu.git Unification of the VISU selection functionality Content moved from VisuGUI_PopupTools Previous content (VisuGUI_SelectionDlg class) moved to VisuGUI_SelectionPanel --- diff --git a/src/VISUGUI/VisuGUI_Selection.cxx b/src/VISUGUI/VisuGUI_Selection.cxx index 20462021..cf25b0b9 100644 --- a/src/VISUGUI/VisuGUI_Selection.cxx +++ b/src/VISUGUI/VisuGUI_Selection.cxx @@ -1,737 +1,576 @@ // VISU VISUGUI : GUI of VISU component // -// Copyright (C) 2003 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 -// +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // // File : VisuGUI_Selection.cxx -// Author : Laurent CORNABE & Hubert ROLLAND +// Author : Sergey Anikin // Module : VISU -// $Header$ #include "VisuGUI_Selection.h" -#include "VisuGUI.h" -#include "VisuGUI_Tools.h" #include "VisuGUI_ViewTools.h" +#include "VisuGUI_Tools.h" + +#include "VISU_Result_i.hh" +#include "VISU_Gen_i.hh" #include "VISU_Actor.h" -#include "VISU_PrsObject_i.hh" -#include "VISU_Prs3d_i.hh" -#include "VISU_PipeLine.hxx" +#include "VISU_ScalarMapAct.h" #include "SalomeApp_Study.h" -#include "SalomeApp_Application.h" -#include "LightApp_Application.h" -#include "LightApp_SelectionMgr.h" -#include "LightApp_VTKSelector.h" - -#include "SUIT_Desktop.h" -#include "SUIT_MessageBox.h" -#include "SUIT_ViewWindow.h" -#include "SUIT_Session.h" -#include "SUIT_ResourceMgr.h" - -#include "SALOME_ListIO.hxx" -#include "SALOME_ListIteratorOfListIO.hxx" - -#include "SVTK_ViewWindow.h" -#include "SVTK_Selector.h" - -#include "utilities.h" - -// OCCT Includes -#include -#include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// VTK Includes -#include -#include -#include -#include -#include - -// STL Includes -#include - -using namespace std; - -VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (const SalomeApp_Module* theModule): - QDialog(VISU::GetDesktop(theModule), - Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),//WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose), - mySelectionMgr(NULL), - myModule(theModule) +#include "LightApp_Study.h" + +using namespace VISU; + +////////////////////////////////////////////////// +// Class: VisuGUI_Selection +////////////////////////////////////////////////// + + +//--------------------------------------------------------------- +QVariant VisuGUI_Selection::parameter( const int ind, const QString& p ) const { - setModal( false ); - setAttribute( Qt::WA_DeleteOnClose, true ); - setWindowTitle( tr("WINDOW_TITLE" ) ); - setSizeGripEnabled(true); - - QGridLayout* TopLayout = new QGridLayout (this); - TopLayout->setSpacing(6); - TopLayout->setMargin(11); - TopLayout->setRowStretch(0, 0); - TopLayout->setRowStretch(1, 0); - TopLayout->setRowStretch(2, 1); - TopLayout->setRowStretch(3, 0); - - QGroupBox* aTypeBox = new QGroupBox (tr("MODE_TITLE"), this); - QHBoxLayout* aHBox = new QHBoxLayout(); - QButtonGroup* aBtnGroup = new QButtonGroup(); - - QRadioButton* aBtn = new QRadioButton (tr("MODE_POINT"), aTypeBox); - aHBox->addWidget( aBtn ); - aBtnGroup->addButton( aBtn, 0 ); - - aBtn = new QRadioButton (tr("MODE_CELL"), aTypeBox); - aHBox->addWidget( aBtn ); - aBtnGroup->addButton( aBtn, 1 ); - - aBtn = new QRadioButton (tr("MODE_ACTOR"), aTypeBox); - aHBox->addWidget( aBtn ); - aBtnGroup->addButton( aBtn, 2 ); - - aBtnGroup->button(0)->setChecked(true); + QVariant val( LightApp_Selection::parameter( ind, p ) ); + if ( !val.isValid() ) { + if ( p == "type" ) val = QVariant( type( ind ) ); + else if ( p == "nbComponents" ) val = QVariant( nbComponents( ind ) ); + else if ( p == "medEntity" ) val = QVariant( medEntity( ind ) ); + else if ( p == "medSource" ) val = QVariant( medSource( ind ) ); + else if ( p == "representation" ) val = QVariant( representation( ind ) ); + else if ( p == "nbTimeStamps" ) val = QVariant( nbTimeStamps( ind ) ); + else if ( p == "nbChildren" ) val = QVariant( nbChildren( ind ) ); + else if ( p == "nbNamedChildren") val = QVariant( nbNamedChildren( ind ) ); + else if ( p == "isVisible" ) val = QVariant( isVisible( ind ) ); + else if ( p == "isShrunk" ) val = QVariant( isShrunk( ind ) ); + else if ( p == "hasActor" ) val = QVariant( hasActor( ind ) ); + else if ( p == "isShading" ) val = QVariant( isShading( ind ) ); + else if ( p == "isScalarMapAct" ) val = QVariant( isScalarMapAct( ind ) ); + else if ( p == "isVisuComponent") val = QVariant( isVisuComponent( ind ) ); + else if ( p == "fullResolution" ) val = QVariant( fullResolution( ind ) ); + else if ( p == "mediumResolution" ) val = QVariant( mediumResolution( ind ) ); + else if ( p == "lowResolution" ) val = QVariant( lowResolution( ind ) ); + else if ( p == "resolutionState" ) val = QVariant( resolutionState( ind ) ); + } + + return val; +} - connect(aBtnGroup, SIGNAL(buttonClicked(int)), this, SLOT(onSelectionChange(int))); - aTypeBox->setLayout(aHBox); - TopLayout->addWidget(aTypeBox, 0, 0); +//--------------------------------------------------------------- +// Macro for converting VISU enumeration items into corresponding strings +#define ENUM2STRING( x, y ) \ + case y: \ + x = QString( #y ); \ + break - QWidget* aNamePane = new QWidget (this); - QGridLayout* aNameLay = new QGridLayout (aNamePane); +QString VisuGUI_Selection::type( const int ind ) const +{ + QString aResStr; + SalomeApp_Study* aStudy = GetStudy(); + if ( !aStudy ) + return aResStr; + + VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, (const char*)entry( ind ).toLatin1()); + VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject); + + VISU::Base_i* aBase = anObjectInfo.myBase; + if(aBase){ + VISU::VISUType aType = aBase->GetType(); + if(aType == VISU::TCOLOREDPRS3DHOLDER){ + CORBA::Object_var anObject = ClientSObjectToObject(anObjectInfo.mySObject); + VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject); + aType = aHolder->GetPrsType(); + } + switch (aType) { + ENUM2STRING( aResStr, VISU::TVISUGEN ); + ENUM2STRING( aResStr, VISU::TRESULT ); + ENUM2STRING( aResStr, VISU::TTABLE ); + ENUM2STRING( aResStr, VISU::TCURVE ); + ENUM2STRING( aResStr, VISU::TCONTAINER ); + ENUM2STRING( aResStr, VISU::TMESH ); + ENUM2STRING( aResStr, VISU::TSCALARMAP ); + ENUM2STRING( aResStr, VISU::TISOSURFACES ); + ENUM2STRING( aResStr, VISU::TDEFORMEDSHAPE ); + ENUM2STRING( aResStr, VISU::TSCALARMAPONDEFORMEDSHAPE ); + ENUM2STRING( aResStr, VISU::TCUTPLANES ); + ENUM2STRING( aResStr, VISU::TCUTLINES ); + ENUM2STRING( aResStr, VISU::TVECTORS ); + ENUM2STRING( aResStr, VISU::TSTREAMLINES ); + ENUM2STRING( aResStr, VISU::TPLOT3D ); + ENUM2STRING( aResStr, VISU::TANIMATION ); + } + } + + if(aResStr.isNull()){ + VISU::VISUType aType = VISU::Storable::RestoringMap2Type(aMap); + switch (aType) { + ENUM2STRING( aResStr, VISU::TENTITY ); + ENUM2STRING( aResStr, VISU::TFAMILY ); + ENUM2STRING( aResStr, VISU::TGROUP ); + ENUM2STRING( aResStr, VISU::TVIEW3D ); + ENUM2STRING( aResStr, VISU::TFIELD ); + ENUM2STRING( aResStr, VISU::TTIMESTAMP ); + } + } - QLabel* aMeshLbl = new QLabel (tr("MESH_NAME_LBL"), aNamePane); - myMeshName = new QLabel (aNamePane); + if(aResStr.isNull()){ + bool anIsExist; + QString aVal = VISU::Storable::FindValue(aMap, "myComment", &anIsExist); + if ( anIsExist && aVal != "MESH" ) + aResStr = "VISU::T" + aVal; + } - QLabel* aFieldLbl = new QLabel (tr("FIELD_NAME_LBL"), aNamePane); - myFieldName = new QLabel (aNamePane); + return aResStr; +} - aNameLay->addWidget(aMeshLbl, 0, 0); - aNameLay->addWidget(myMeshName, 0, 1); - aNameLay->addWidget(aFieldLbl, 1, 0); - aNameLay->addWidget(myFieldName, 1, 1); - TopLayout->addWidget(aNamePane, 1, 0); +//--------------------------------------------------------------- +QString VisuGUI_Selection::nbComponents( const int ind ) const +{ + QString aResStr; + SalomeApp_Study* aStudy = GetStudy(); + if ( !aStudy ) + return aResStr; + + VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, (const char*)entry( ind ).toLatin1()); + VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject); + + bool isExist; + QString aVal = VISU::Storable::FindValue(aMap,"myNumComponent",&isExist); + if ( isExist ) + aResStr = aVal; + return aResStr; +} - myWidgetStack = new QStackedWidget (this); - // Create Points pane - myPointsPane = new QWidget (myWidgetStack); - QVBoxLayout* aVBoxLayout = new QVBoxLayout(myPointsPane); +//--------------------------------------------------------------- +QString VisuGUI_Selection::resolutions( const int ind ) const +{ + QString aResStr; + SalomeApp_Study* aStudy = GetStudy(); + if ( !aStudy ) + return aResStr; - QGroupBox* aDataGrp = new QGroupBox ( tr("POINT_DATA_TITLE"), myPointsPane); - QGridLayout* aGridLay = new QGridLayout (aDataGrp); - aGridLay->setSpacing(6); + VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ).toLatin1().data()); + VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject); - aGridLay->addWidget( new QLabel (tr("DATA_ID_LBL"), aDataGrp) , 0, 0 ); - aGridLay->addWidget( new QLabel (tr("DATA_SCALAR_LBL"), aDataGrp), 1, 0 ); - aGridLay->addWidget( new QLabel (tr("DATA_VECTOR_LBL"), aDataGrp), 2, 0 ); - - myIDValLbl = new QLineEdit ("", aDataGrp); - aGridLay->addWidget( myIDValLbl, 0, 1 ); - QIntValidator* aIntValidator = new QIntValidator (myIDValLbl); - aIntValidator->setBottom(0); - myIDValLbl->setValidator(aIntValidator); - connect(myIDValLbl, SIGNAL(textChanged(const QString&)), this, SLOT(onPointIdEdit(const QString&))); - - myScalarValLbl = new QLabel ("", aDataGrp); - aGridLay->addWidget( myScalarValLbl, 1, 1 ); + bool isExist; + QString aVal = VISU::Storable::FindValue(aMap,"myResolutions",&isExist); + if ( isExist ) + aResStr = aVal; + + return aResStr; +} + + +//--------------------------------------------------------------- +QString VisuGUI_Selection::resolution( const int ind, char theResoltuion ) const +{ + QString aResStr; + + QString aResolutions = resolutions( ind ); + if(aResolutions.isEmpty()) + return aResStr; - myVectorValLbl = new QLabel ("", aDataGrp); - myVectorValLbl->setMinimumWidth(150); - aGridLay->addWidget( myVectorValLbl, 2, 1 ); - - aVBoxLayout->addWidget( aDataGrp ); - - QGroupBox* aCoordGrp = new QGroupBox ( tr("POINT_COORD_TITLE"), myPointsPane); - aGridLay = new QGridLayout (aCoordGrp); - aGridLay->setSpacing(6); - - aGridLay->addWidget( new QLabel ("X:", aCoordGrp), 0, 0 ); - myXValLbl = new QLabel ("", aCoordGrp); - aGridLay->addWidget( myXValLbl, 0, 1 ); - //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - aGridLay->addWidget( new QLabel ("I:", aCoordGrp), 0, 2 ); - myIValLbl = new QLabel ("-", aCoordGrp); - aGridLay->addWidget( myIValLbl, 0, 3 ); - //ENK: 23.11.2006 - aGridLay->addWidget( new QLabel ("Y:", aCoordGrp), 1, 0 ); - myYValLbl = new QLabel ("", aCoordGrp); - aGridLay->addWidget( myYValLbl, 1, 1 ); - //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - aGridLay->addWidget( new QLabel ("J:", aCoordGrp), 1, 2 ); - myJValLbl = new QLabel ("-", aCoordGrp); - aGridLay->addWidget( myJValLbl, 1, 3 ); - //ENK: 23.11.2006 - aGridLay->addWidget( new QLabel ("Z:",aCoordGrp ), 2, 0 ); - myZValLbl = new QLabel ("", aCoordGrp); - aGridLay->addWidget( myZValLbl, 2, 1 ); - //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - aGridLay->addWidget( new QLabel ("K:", aCoordGrp), 2, 2 ); - myKValLbl = new QLabel ("-", aCoordGrp); - aGridLay->addWidget( myKValLbl, 2, 3 ); - //ENK: 23.11.2006 - - aVBoxLayout->addWidget( aCoordGrp ); - - myWidgetStack->addWidget(myPointsPane); - - // Create Cells pane - myCellsPane = new QWidget (myWidgetStack); - QGridLayout* aCellLayout = new QGridLayout (myCellsPane); - aCellLayout->setSpacing(6); - aCellLayout->setRowStretch(0, 0); - aCellLayout->setRowStretch(1, 1); - - QGroupBox* aCellGrp = new QGroupBox( tr("CELL_DATA_TITLE"), myCellsPane); - aGridLay = new QGridLayout (aCellGrp); - - aGridLay->addWidget( new QLabel (tr("DATA_ID_LBL"), aCellGrp), 0, 0); - myCellIDValLbl = new QLineEdit ("", aCellGrp); - myCellIDValLbl->setValidator(aIntValidator); - aGridLay->addWidget( myCellIDValLbl, 0, 1); - connect(myCellIDValLbl, SIGNAL(textChanged(const QString&)), this, SLOT(onCellIdEdit(const QString&))); - - aGridLay->addWidget( new QLabel (tr("DATA_SCALAR_LBL"), aCellGrp), 1, 0); - myCellScalarValLbl = new QLabel ("", aCellGrp); - aGridLay->addWidget( myCellScalarValLbl, 1, 1); - aGridLay->addWidget( new QLabel (tr("DATA_VECTOR_LBL"), aCellGrp), 2, 0); - myCellVectorValLbl = new QLabel ("", aCellGrp); - aGridLay->addWidget(myCellVectorValLbl , 2, 1); - - aCellLayout->addWidget(aCellGrp, 0, 0); - - myListPoints = new QTableWidget (myCellsPane); - myListPoints->setEditTriggers( QAbstractItemView::NoEditTriggers ); - myListPoints->setColumnCount(9); - myListPoints->setRowCount(0); - myListPoints->setColumnWidth(0, 40); - myListPoints->setColumnWidth(1, 40); - myListPoints->setColumnWidth(2, 40); - myListPoints->setColumnWidth(3, 40); - myListPoints->setColumnWidth(4, 40);//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - myListPoints->setColumnWidth(5, 40);//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - myListPoints->setColumnWidth(6, 40);//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - myListPoints->setSelectionMode(QAbstractItemView::NoSelection); - - QStringList aLabels; - aLabels.append( "ID" ); - aLabels.append( "X" ); - aLabels.append( "Y" ); - aLabels.append( "Z" ); - aLabels.append( "I" );//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - aLabels.append( "J" );//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - aLabels.append( "K" );//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - aLabels.append( tr("CELL_DATA_SCALAR_HDR") ); - aLabels.append( tr("CELL_DATA_VECTOR_HDR") ); - myListPoints->setHorizontalHeaderLabels( aLabels ); - - aCellLayout->addWidget(myListPoints, 1, 0); - - myWidgetStack->addWidget(myCellsPane); - - // Actor Pane - myActorsPane = new QWidget (myWidgetStack); - aVBoxLayout = new QVBoxLayout(myActorsPane); - aVBoxLayout->setSpacing(6); - - QGroupBox* aPosGrp = new QGroupBox (tr("ACTOR_DATA_POSITION_TITLE"), myActorsPane); - aGridLay = new QGridLayout (aPosGrp); - aGridLay->setSpacing(6); - aGridLay->addWidget( new QLabel ("X:", aPosGrp), 0, 0); - myXPosLbl = new QLabel ("0", aPosGrp); - aGridLay->addWidget( myXPosLbl, 0, 1); - aGridLay->addWidget( new QLabel ("Y:", aPosGrp), 1, 0); - myYPosLbl = new QLabel ("0", aPosGrp); - aGridLay->addWidget( myYPosLbl, 1, 1); - aGridLay->addWidget( new QLabel ("Z:", aPosGrp), 2, 0); - myZPosLbl = new QLabel ("0", aPosGrp); - aGridLay->addWidget( myZPosLbl, 2, 1); - - aVBoxLayout->addWidget( aPosGrp ); - - QGroupBox* aSizeGrp = new QGroupBox ( tr("ACTOR_DATA_SIZE_TITLE"), myActorsPane); - aGridLay = new QGridLayout (aSizeGrp); - aGridLay->setSpacing(6); - aGridLay->addWidget( new QLabel ("dX:", aSizeGrp ), 0, 0); - myDXLbl = new QLabel ("0", aSizeGrp); - aGridLay->addWidget( myDXLbl, 0, 1); - aGridLay->addWidget( new QLabel ("dY:", aSizeGrp ), 1, 0); - myDYLbl = new QLabel ("0", aSizeGrp); - aGridLay->addWidget( myDYLbl, 1, 1); - aGridLay->addWidget( new QLabel ("dZ:", aSizeGrp ), 2, 0); - myDZLbl = new QLabel ("0", aSizeGrp); - aGridLay->addWidget( myDZLbl, 2, 1); - - aVBoxLayout->addWidget( aSizeGrp ); - - myWidgetStack->addWidget(myActorsPane); - - - TopLayout->addWidget(myWidgetStack, 2, 0); - - // Create buttons group - QWidget* aBtnBox = new QWidget (this); - QHBoxLayout* aBtnLayout = new QHBoxLayout( aBtnBox); - aBtnLayout->addStretch(); - - QPushButton* aCloseBtn = new QPushButton (tr("BUT_CLOSE"), aBtnBox); - aBtnLayout->addWidget(aCloseBtn); - connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(close())); - - QPushButton* aHelpBtn = new QPushButton (tr("BUT_HELP"), aBtnBox); - aBtnLayout->addWidget(aHelpBtn); - connect(aHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp())); - - TopLayout->addWidget(aBtnBox, 3, 0); - - SalomeApp_Application* anApp = dynamic_cast - (SUIT_Session::session()->activeApplication()); - mySelectionMgr = anApp->selectionMgr(); - connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionEvent())); - - //connect(visuGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(close())); - - myFl = false; - - // Activate Points pane - myWidgetStack->setCurrentWidget(myPointsPane); - if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow(myModule)) - aViewWindow->SetSelectionMode(NodeSelection); - onSelectionEvent(); + if(aResolutions.indexOf(theResoltuion) != -1) + aResStr = "1"; + else + aResStr = "0"; + + return aResStr; } -VisuGUI_SelectionDlg::~VisuGUI_SelectionDlg() + +//--------------------------------------------------------------- +QString VisuGUI_Selection::fullResolution( const int ind ) const { - SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow(myModule); - if ( !aViewWindow ) - return; - - switch ( aViewWindow->SelectionMode() ) { - case NodeSelection: - case CellSelection: - aViewWindow->SetSelectionMode(ActorSelection); - break; - } + return resolution( ind, 'F'); } -void VisuGUI_SelectionDlg::onSelectionChange (int theId) + +//--------------------------------------------------------------- +QString VisuGUI_Selection::mediumResolution( const int ind ) const { - SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow(myModule); - if (!aViewWindow) return; - - switch (theId) { - case 0: // Points - myWidgetStack->setCurrentWidget(myPointsPane); - aViewWindow->SetSelectionMode(NodeSelection); - onPointIdEdit(myIDValLbl->text()); - break; - case 1: // Cells - myWidgetStack->setCurrentWidget(myCellsPane); - aViewWindow->SetSelectionMode(CellSelection); - onCellIdEdit(myCellIDValLbl->text()); - break; - case 2: // Actor - myWidgetStack->setCurrentWidget(myActorsPane); - aViewWindow->SetSelectionMode(ActorSelection); - onSelectionEvent(); - } + return resolution( ind, 'M'); } -void VisuGUI_SelectionDlg::closeEvent (QCloseEvent* theEvent) +//--------------------------------------------------------------- +QString VisuGUI_Selection::lowResolution( const int ind ) const { - QDialog::closeEvent(theEvent); + return resolution( ind, 'L'); } -template QString getValue(TData* theData, int theId){ - if (vtkDataArray *aScalar = theData->GetScalars()){ - vtkFloatingPointType aVal = aScalar->GetTuple1(theId); - return QString::number(aVal); - } else { - return QString("No data"); + +//--------------------------------------------------------------- +QString VisuGUI_Selection::resolutionState( const int ind ) const +{ + QString aResStr; + SalomeApp_Study* aStudy = GetStudy(); + if ( !aStudy ) + return aResStr; + + VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, entry( ind ).toLatin1().data()); + VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject); + + bool isExist; + QString aVal = VISU::Storable::FindValue(aMap,"myState",&isExist); + if ( isExist ) { + if ( aVal.toInt() == VISU::Result::FULL ) + aResStr = "F"; + if ( aVal.toInt() == VISU::Result::MEDIUM ) + aResStr = "M"; + if ( aVal.toInt() == VISU::Result::LOW ) + aResStr = "L"; + if ( aVal.toInt() == VISU::Result::HIDDEN ) + aResStr = "H"; } + + return aResStr; } -template QString getVector(TData* theData, int theId){ - if (vtkDataArray *aVector = theData->GetVectors()) { - vtkFloatingPointType *aVal = aVector->GetTuple3(theId); - return QString("%1; %2; %3").arg(aVal[0]).arg(aVal[1]).arg(aVal[2]); - } else { - return QString("No data"); + +//--------------------------------------------------------------- +QString VisuGUI_Selection::medEntity( const int ind ) const +{ + SalomeApp_Study* aStudy = GetStudy(); + if ( !aStudy ) + return QString(); + + VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, (const char*)entry( ind ).toLatin1()); + VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject); + + bool isExist; + QString aVal = VISU::Storable::FindValue(aMap,"myEntityId",&isExist); + if ( isExist ) { + using namespace VISU; + TEntity anEntityId = TEntity(aVal.toInt()); + switch(anEntityId){ + case NODE_ENTITY : + return "NODE_ENTITY"; + case EDGE_ENTITY : + return "EDGE_ENTITY"; + case FACE_ENTITY : + return "FACE_ENTITY"; + case CELL_ENTITY : + return "CELL_ENTITY"; + default: + return QString(); + } } + return QString(); } -#define ABS(a) (a>=0)?a:-a - -void VisuGUI_SelectionDlg::onSelectionEvent() { - SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow(myModule); - if (!aViewWindow) - return; - - switch (aViewWindow->SelectionMode()) { - case NodeSelection: - case CellSelection: - case ActorSelection: - break; - default: - close(); - delete this; - return; +QString VisuGUI_Selection::medSource( const int ind ) const +{ + _PTR(Study) aStudyDS = GetStudy()->studyDS(); + if(_PTR(SObject) aSObject = aStudyDS->FindObjectID((const char*)entry(ind).toLatin1())){ + VISU::Result_var aRes; + if(VISU::Result_i* aResult = CheckResult(myModule,aSObject,aRes)){ + using namespace VISU; + Result_i::ECreationId aCreationId = aResult->GetCreationId(); + switch(aCreationId){ + case Result_i::eImportFile : + return "eImportFile"; + case Result_i::eCopyAndImportFile : + return "eCopyAndImportFile"; + case Result_i::eImportMed : + return "eImportMed"; + case Result_i::eImportMedField : + return "eImportMedField"; + default: + return QString(); + } + } } + return QString(); +} - if (myFl) - return; - myFl = true; +QString VisuGUI_Selection::nbTimeStamps( const int ind ) const +{ + QString aResStr; + SalomeApp_Study* aStudy = GetStudy(); + if ( !aStudy ) + return aResStr; + + VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, (const char*)entry( ind ).toLatin1()); + VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject); + + bool isExist; + const QString& aVal = VISU::Storable::FindValue(aMap,"myNbTimeStamps",&isExist); + if ( isExist ) + aResStr = aVal; + return aResStr; +} - int aType = myWidgetStack->indexOf(myWidgetStack->currentWidget()); - SVTK_Selector* aSelector = aViewWindow->GetSelector(); +//---------------------------------------------------------------------------- +template +struct TPopupDispatcher +{ + QString + operator()(const SalomeApp_Module* theModule, + const QString& theEntry) + { + if(SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()){ + QString aType = aViewManager->getType(); + TPopupFunctor aFunctor; + if(aType == SVTK_Viewer::Type()) + return aFunctor.template Get(theModule, theEntry); + else if(aType == VVTK_Viewer::Type()) + return aFunctor.template Get(theModule, theEntry); + } + return QString(); + } +}; + + +//---------------------------------------------------------------------------- +template +bool +GetPrs3dSelectionInfo(const SalomeApp_Module* theModule, + const QString& theEntry, + VISU::Prs3d_i*& thePrs3d, + SVTK_ViewWindow*& theViewWindow, + VISU_Actor*& thenActor) +{ + VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(theModule), (const char*)theEntry.toLatin1()); + thePrs3d = GetPrs3dFromBase(anObjectInfo.myBase); + if(!thePrs3d) + return false; + + typedef typename TViewer::TViewWindow TViewWindow; + theViewWindow = GetActiveViewWindow(theModule); + if(!theViewWindow) + return false; + + thenActor = FindActor(theViewWindow, thePrs3d); + if(!thenActor) + return false; + + return true; +} - _PTR(SObject) aSObject; - VISU::Prs3d_i* aPrs3d = NULL; - Handle(SALOME_InteractiveObject) anIO; - VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(myModule); - if(aSelectionInfo.size() == 1){ - // Get selected SObject - VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); - VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo; - aPrs3d = GetPrs3dFromBase(anObjectInfo.myBase); - if(aPrs3d){ - anIO = aSelectionItem.myIO; - aSObject = anObjectInfo.mySObject; - } +//---------------------------------------------------------------------------- +struct TViewFunctor +{ + template + QString + Get(const SalomeApp_Module* theModule, + const QString& theEntry) + { + VISU_Actor* anActor = NULL; + VISU::Prs3d_i* aPrs3d = NULL; + SVTK_ViewWindow* aViewWindow = NULL; + if(!GetPrs3dSelectionInfo(theModule, theEntry, aPrs3d, aViewWindow, anActor)) + return QString(); + + return get(aPrs3d, aViewWindow, anActor); } + QString + virtual + get(VISU::Prs3d_i* thePrs3d, + SVTK_ViewWindow* theViewWindow, + VISU_Actor* theActor) + { + return QString(); + } +}; - if (aPrs3d) { - QString aMeshName("NULL"), aFieldName("NULL"); - if (aSObject) { - VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(aSObject); - if (!aMap.empty()) { - aMeshName = VISU::Storable::FindValue(aMap, "myMeshName"); - aFieldName = VISU::Storable::FindValue(aMap, "myFieldName"); - } - } - myMeshName ->setText((aMeshName == "NULL") ? QString("No name") : aMeshName); - myFieldName->setText((aFieldName == "NULL") ? QString("No name") : aFieldName); - - VISU_Actor* anVISUActor = - VISU::FindActor(VISU::GetAppStudy(myModule), aViewWindow, aSObject->GetID().c_str()); - if (anVISUActor) { - vtkFloatingPointType aCoord[6]; - anVISUActor->GetBounds(aCoord); - myXPosLbl->setText(QString::number( aCoord[0] )); - myYPosLbl->setText(QString::number( aCoord[2] )); - myZPosLbl->setText(QString::number( aCoord[4] )); - - myDXLbl->setText(QString::number( ABS(aCoord[1]-aCoord[0]) )); - myDYLbl->setText(QString::number( ABS(aCoord[3]-aCoord[2]) )); - myDZLbl->setText(QString::number( ABS(aCoord[5]-aCoord[4]) )); - - TColStd_IndexedMapOfInteger aMapIndex; - typedef std::vector TCoordArray; - typedef map TPointCoordsMap; - TPointCoordsMap aPointCoordsMap; - - aSelector->GetIndex(anIO, aMapIndex); - - vtkDataSet* aDataSet = anVISUActor->GetMapper()->GetInput(); - vtkPointData* aPntData = aDataSet->GetPointData(); - - for (int ind = 1; ind <= aMapIndex.Extent(); ind++) { - int anID = aMapIndex(ind); - - switch (aType) { - case 0: - { - int aVTKID = anVISUActor->GetNodeVTKID(anID); - if(aVTKID >= 0){ - vtkFloatingPointType* aCoord = anVISUActor->GetNodeCoord(anID); - myXValLbl->setText( QString::number( aCoord[0] ) ); - myYValLbl->setText( QString::number( aCoord[1] ) ); - myZValLbl->setText( QString::number( aCoord[2] ) ); - myIDValLbl->setText( QString::number(anID) ); - myScalarValLbl->setText(getValue(aPntData, aVTKID)); - myVectorValLbl->setText(getVector(aPntData, aVTKID)); - //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - const VISU::PIDMapper& aMapper = aPrs3d->GetPipeLine()->GetIDMapper(); - VISU::TIdTypeVector aVec = aMapper->GetIndexesOfNode(anID); - switch(aVec.size()){ - case 3: - myKValLbl->setText(QString::number(aVec[2])); - case 2: - myJValLbl->setText(QString::number(aVec[1])); - case 1: - myIValLbl->setText(QString::number(aVec[0])); - break; - default: - myIValLbl->setText("-"); - myJValLbl->setText("-"); - myKValLbl->setText("-"); - } - //ENK: 23.11.2006 - } - } - break; - case 1: - { - vtkCellData* aCellData = aDataSet->GetCellData(); - vtkCell* aCell = anVISUActor->GetElemCell(anID); - int aVTKID = anVISUActor->GetElemVTKID(anID); - if (aCell != NULL) { - int aNbOfPoints = aCell->GetNumberOfPoints(); - if ( aNbOfPoints > 0 ) { - myCellIDValLbl->setText( QString::number(anID) ); - myCellScalarValLbl->setText(getValue(aCellData, aVTKID)); - myCellVectorValLbl->setText(getVector(aCellData, aVTKID)); - - vtkIdList *aPointList = aCell->GetPointIds(); - for (int i = 0; i < aNbOfPoints; i++) { - int aNodeVTKId = aPointList->GetId(i); - vtkFloatingPointType* aCoord = aDataSet->GetPoint(aNodeVTKId); - vtkIdType aNodeObjId = anVISUActor->GetNodeObjId(aNodeVTKId); - TCoordArray aCoordArray(aCoord, aCoord + 3); - aPointCoordsMap[aNodeObjId] = aCoordArray; - } - } - } - } - break; - } - } +//---------------------------------------------------------------------------- +struct TGetRepesentationFunctor: TViewFunctor +{ + QString + virtual + get(VISU::Prs3d_i* thePrs3d, + SVTK_ViewWindow* theViewWindow, + VISU_Actor* theActor) + { + QString aResStr; + switch (theActor->GetRepresentation()) { + ENUM2STRING( aResStr, VISU::POINT ); + ENUM2STRING( aResStr, VISU::WIREFRAME ); + ENUM2STRING( aResStr, VISU::SHADED ); + ENUM2STRING( aResStr, VISU::INSIDEFRAME ); + ENUM2STRING( aResStr, VISU::SURFACEFRAME ); + } + return aResStr; + } +}; + +QString VisuGUI_Selection::representation( const int ind ) const +{ + return TPopupDispatcher()(myModule, entry(ind)); +} - myListPoints->setRowCount(aPointCoordsMap.size()); - TPointCoordsMap::const_iterator anIter = aPointCoordsMap.begin(); - - const VISU::PIDMapper& aMapper = aPrs3d->GetPipeLine()->GetIDMapper(); - for (int i = 0; anIter != aPointCoordsMap.end() && i < myListPoints->rowCount(); anIter++, i++) { - myListPoints->model()->setHeaderData( i, Qt::Vertical, QVariant(QString::number( i )), Qt::DisplayRole ); - vtkIdType aNodeObjId = anIter->first; - //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - VISU::TIdTypeVector aVec = aMapper->GetIndexesOfNode(aNodeObjId); - QString aI,aJ,aK; - aI = "-"; - aJ = "-"; - aK = "-"; - switch(aVec.size()){ - case 3: - aK = QString::number(aVec[2]); - case 2: - aJ = QString::number(aVec[1]); - case 1: - aI = QString::number(aVec[0]); - break; - } - //ENK: 23.11.2006 - - QAbstractItemModel* aModel = myListPoints->model(); - aModel->setData( aModel->index(i,0), QVariant(QString::number( aNodeObjId )), Qt::DisplayRole ); - const TCoordArray& aCoordArray = anIter->second; - aModel->setData( aModel->index(i,1), QVariant(QString::number( aCoordArray[0] )), Qt::DisplayRole ); - aModel->setData( aModel->index(i,2), QVariant(QString::number( aCoordArray[1] )), Qt::DisplayRole ); - aModel->setData( aModel->index(i,3), QVariant(QString::number( aCoordArray[2] )), Qt::DisplayRole ); - aModel->setData( aModel->index(i,4), QVariant( aI ), Qt::DisplayRole );//ENK: 23.11.2006 - PAL13176 - aModel->setData( aModel->index(i,5), QVariant( aJ ), Qt::DisplayRole );//ENK: 23.11.2006 - PAL13176 - aModel->setData( aModel->index(i,6), QVariant( aK ), Qt::DisplayRole );//ENK: 23.11.2006 - PAL13176 - - vtkIdType aNodeVTKId = anVISUActor->GetNodeVTKID(aNodeObjId); - aModel->setData( aModel->index(i,7), QVariant(getValue(aPntData, aNodeVTKId)), Qt::DisplayRole ); - aModel->setData( aModel->index(i,8), QVariant(getVector(aPntData, aNodeVTKId)), Qt::DisplayRole ); +//---------------------------------------------------------------------------- +SalomeApp_Study* VisuGUI_Selection::GetStudy() const + +{ + LightApp_Study* aLightStudy = const_cast( study() ); + return dynamic_cast( aLightStudy ); +} + +//---------------------------------------------------------------------------- +int VisuGUI_Selection::nbChild( const int ind, const bool named ) const +{ + int cnt = 0; + SalomeApp_Study* aSStudy = GetStudy(); + if ( !aSStudy ) + return cnt; + _PTR(Study) aStudy = GetCStudy( aSStudy ); + if ( aStudy ){ + _PTR(SObject) SO = aStudy->FindObjectID( (const char*)entry( ind ).toLatin1() ); + if ( SO ){ + for ( _PTR(ChildIterator) Iter = aStudy->NewChildIterator( SO ); Iter->More(); Iter->Next() ) { + _PTR(SObject) refSO; + if ( !Iter->Value()->ReferencedObject( refSO ) && ( !named || Iter->Value()->GetName().size() ) ) + cnt++; } - //for(int aColumnId = 0; aColumnId < 9; aColumnId++) - myListPoints->resizeColumnsToContents(); } - } else { - clearFields(); } - myFl = false; + return cnt; } -#undef ABS - - -void VisuGUI_SelectionDlg::clearFields() { - int aType = myWidgetStack->indexOf(myWidgetStack->currentWidget()); - switch (aType) { - case 0: - myXValLbl->setText( "" ); - myYValLbl->setText( "" ); - myZValLbl->setText( "" ); - myIValLbl->setText( "-" );//ENK: 23.11.2006 - PAL13176 - myJValLbl->setText( "-" );//ENK: 23.11.2006 - PAL13176 - myKValLbl->setText( "-" );//ENK: 23.11.2006 - PAL13176 - myScalarValLbl->setText(""); - myVectorValLbl->setText(""); - break; - case 1: - myCellScalarValLbl->setText(""); - myCellVectorValLbl->setText(""); - myListPoints->setRowCount(0); - break; - case 2: - myXPosLbl->setText(""); - myYPosLbl->setText(""); - myZPosLbl->setText(""); - myDXLbl->setText(""); - myDYLbl->setText(""); - myDZLbl->setText(""); - } + +//---------------------------------------------------------------------------- +QString VisuGUI_Selection::nbChildren( const int ind ) const +{ + QString aResStr; + aResStr.setNum( nbChild( ind, false ) ); + return aResStr; +} + +//---------------------------------------------------------------------------- +QString VisuGUI_Selection::nbNamedChildren( const int ind ) const +{ + QString aResStr; + aResStr.setNum( nbChild( ind, true ) ); + return aResStr; } -typedef vtkIdType (VISU_PipeLine::* TGetVTKIdMethod)(vtkIdType theID); -bool onIdEdit (const QString& theText, - TGetVTKIdMethod theMethod, - bool theIsCell, - const SalomeApp_Module* theModule, - QLabel* theMeshName, - QString theValue, - QLabel* theFieldName) +//---------------------------------------------------------------------------- +struct TIsVisibleFunctor: TViewFunctor { - SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow(theModule); - if (!aViewWindow) - return false; - SVTK_Selector* aSelector = aViewWindow->GetSelector(); - - _PTR(SObject) aSObject; - VISU::Prs3d_i* aPrs3d = NULL; - Handle(SALOME_InteractiveObject) anIO; - - VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule); - if(aSelectionInfo.size() == 1){ - // Get selected SObject - VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); - VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo; - aPrs3d = GetPrs3dFromBase(anObjectInfo.myBase); - if(aPrs3d){ - anIO = aSelectionItem.myIO; - aSObject = anObjectInfo.mySObject; - } + QString + virtual + get(VISU::Prs3d_i* thePrs3d, + SVTK_ViewWindow* theViewWindow, + VISU_Actor* theActor) + { + return theActor->GetVisibility() ? "true" : "false"; } - if (aPrs3d) { - int anObjId = theText.toInt(); - VISU_PipeLine* aPipeLine = aPrs3d->GetPipeLine(); - int aVTKId = (aPipeLine->*theMethod)(anObjId); - if(aVTKId < 0) - return false; - - TColStd_MapOfInteger newIndices; - newIndices.Add(anObjId); - aSelector->AddOrRemoveIndex(anIO, newIndices, false); - aViewWindow->highlight(anIO, true, true); - - return true; - - } else { - theMeshName->setText(theValue); - theFieldName->setText(""); +}; + +QString VisuGUI_Selection::isVisible( const int ind ) const +{ + return TPopupDispatcher()(myModule, entry(ind)); +} + + +//---------------------------------------------------------------------------- +struct TIsShrunkFunctor: TViewFunctor +{ + QString + virtual + get(VISU::Prs3d_i* thePrs3d, + SVTK_ViewWindow* theViewWindow, + VISU_Actor* theActor) + { + return theActor->IsShrunk() ? "1" : "0"; } - return false; +}; + +QString VisuGUI_Selection::isShrunk( const int ind ) const +{ + return TPopupDispatcher()(myModule, entry(ind)); } -void VisuGUI_SelectionDlg::onPointIdEdit (const QString& theText) + +//---------------------------------------------------------------------------- +QString VisuGUI_Selection::hasActor( const int ind ) const { - if (myFl) return; - TGetVTKIdMethod aMethod = &VISU_PipeLine::GetNodeVTKID; - bool anIsSelected = onIdEdit(theText, - aMethod, - false, - myModule, - myMeshName, - tr("WRN_NO_AVAILABLE_DATA"), - myFieldName); - if (anIsSelected) - // as selection manager doesn't send signal currentSelectionChanged() - onSelectionEvent(); - else - clearFields(); + return representation( ind ).isEmpty() ? "0" : "1"; } -void VisuGUI_SelectionDlg::onCellIdEdit (const QString& theText) + +//---------------------------------------------------------------------------- +struct TIsShadingFunctor: TViewFunctor { - if (myFl) return; - TGetVTKIdMethod aMethod = &VISU_PipeLine::GetElemVTKID; - bool anIsSelected = onIdEdit(theText, - aMethod, - true, - myModule, - myMeshName, - tr("WRN_NO_AVAILABLE_DATA"), - myFieldName); - if (anIsSelected) - // as selection manager doesn't send signal currentSelectionChanged() - onSelectionEvent(); - else - clearFields(); + QString + virtual + get(VISU::Prs3d_i* thePrs3d, + SVTK_ViewWindow* theViewWindow, + VISU_Actor* theActor) + { + if(VISU_ScalarMapAct* anActor = dynamic_cast(theActor)) + return anActor->IsShading() ? "1" : "0"; + return QString(); + } +}; + +QString VisuGUI_Selection::isShading( const int ind ) const +{ + return TPopupDispatcher()(myModule, entry(ind)); } -void VisuGUI_SelectionDlg::onHelp() + +//---------------------------------------------------------------------------- +struct TIsScalarMapActFunctor: TViewFunctor { - QString aHelpFileName = "selection_info_page.html"; - LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); - if (app) - app->onHelpContextModule(myModule ? app->moduleName(myModule->moduleName()) : QString(""), aHelpFileName); - else { - QString platform; -#ifdef WIN32 - platform = "winapplication"; -#else - platform = "application"; -#endif - SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(aHelpFileName) ); + QString + virtual + get(VISU::Prs3d_i* thePrs3d, + SVTK_ViewWindow* theViewWindow, + VISU_Actor* theActor) + { + return dynamic_cast(theActor)? "1" : "0"; } +}; + + +//--------------------------------------------------------------- +QString VisuGUI_Selection::isScalarMapAct( const int ind ) const +{ + return TPopupDispatcher()(myModule, entry(ind)); } -void VisuGUI_SelectionDlg::keyPressEvent( QKeyEvent* e ) + +//---------------------------------------------------------------------------- +bool VisuGUI_Selection::isVisuComponent( const int ind ) const { - QDialog::keyPressEvent( e ); - if ( e->isAccepted() ) - return; - - if ( e->key() == Qt::Key_F1 ) - { - e->accept(); - onHelp(); - } + SalomeApp_Study* study = GetStudy(); + if ( !study ) + return false; + + _PTR(SObject) obj = study->studyDS()->FindObjectID( (const char*)entry( ind ).toLatin1() ); + if ( !obj ) + return false; + CORBA::Object_var anObj = VISU::ClientSObjectToObject( obj ); + if( CORBA::is_nil( anObj ) ) + return false; + + return dynamic_cast( VISU::GetServant( anObj ).in() ); } diff --git a/src/VISUGUI/VisuGUI_Selection.h b/src/VISUGUI/VisuGUI_Selection.h index 0e6d2de1..184547e3 100644 --- a/src/VISUGUI/VisuGUI_Selection.h +++ b/src/VISUGUI/VisuGUI_Selection.h @@ -1,6 +1,6 @@ // VISU VISUGUI : GUI of VISU component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// Copyright (C) 2005 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 @@ -22,82 +22,60 @@ // // // File : VisuGUI_Selection.h -// Author : Laurent CORNABE & Hubert ROLLAND +// Author : Sergey Anikin // Module : VISU -// $Header$ #ifndef VisuGUI_Selection_HeaderFile #define VisuGUI_Selection_HeaderFile -#include +#include -class QLabel; -class QStackedWidget; -//class QVBox; -class QLineEdit; -class QTableWidget; -class LightApp_SelectionMgr; -class SalomeApp_Application; -class SalomeApp_Module; +////////////////////////////////////////////////// +// Class: VisuGUI_Selection +////////////////////////////////////////////////// -class VisuGUI_SelectionDlg: public QDialog { - Q_OBJECT +class SalomeApp_Module; +class SalomeApp_Study; +class VisuGUI_Selection : public LightApp_Selection +{ public: - VisuGUI_SelectionDlg (const SalomeApp_Module* theModule); - virtual ~VisuGUI_SelectionDlg (); - -private: - void keyPressEvent( QKeyEvent* e ); - -protected: - void closeEvent (QCloseEvent* theEvent); - -private slots: - void onSelectionChange (int theId); - void onSelectionEvent (); - void onPointIdEdit (const QString& theText); - void onCellIdEdit (const QString& theText); - void onHelp(); + VisuGUI_Selection( SalomeApp_Module* theModule ) + : LightApp_Selection(), myModule( theModule ) {}; + virtual ~VisuGUI_Selection() {}; - private: - void clearFields (); + virtual QVariant parameter( const int, const QString& ) const; - QLabel* myMeshName; - QLabel* myFieldName; - - QStackedWidget* myWidgetStack; - QWidget* myPointsPane; - QWidget* myCellsPane; - QLabel* myXValLbl; - QLabel* myYValLbl; - QLabel* myZValLbl; - //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - QLabel* myIValLbl; //!< used for structured mesh selection - QLabel* myJValLbl; //!< used for structured mesh selection - QLabel* myKValLbl; //!< used for structured mesh selection - //ENK: 23.11.2006 - - QLineEdit* myIDValLbl; - QLabel* myScalarValLbl; - QLabel* myVectorValLbl; +private: + QString type( const int ) const; + QString nbComponents( const int ) const; + QString medEntity( const int ) const; + QString medSource( const int ) const; + QString nbTimeStamps( const int ) const; + QString representation( const int ) const; + QString nbChildren( const int ) const; + QString nbNamedChildren( const int ) const; + QString isVisible( const int ) const; + QString isShrunk( const int ) const; + QString hasActor( const int ) const; + QString isShading( const int ) const; + QString isScalarMapAct( const int ) const; + bool isVisuComponent( const int ) const; + + QString fullResolution( const int ) const; + QString mediumResolution( const int ) const; + QString lowResolution( const int ) const; + QString resolutionState( const int ) const; - QTableWidget* myListPoints; - QLineEdit* myCellIDValLbl; - QLabel* myCellScalarValLbl; - QLabel* myCellVectorValLbl; +private: + int nbChild( const int, const bool ) const; + SalomeApp_Study* GetStudy() const; - QWidget* myActorsPane; - QLabel* myXPosLbl; - QLabel* myYPosLbl; - QLabel* myZPosLbl; - QLabel* myDXLbl; - QLabel* myDYLbl; - QLabel* myDZLbl; + QString resolutions( const int ) const; + QString resolution( const int, char theResoltuion ) const; - const SalomeApp_Module* myModule; - LightApp_SelectionMgr* mySelectionMgr; - bool myFl; +private: + SalomeApp_Module* myModule; }; #endif