From 1061d29ee79e59d7d6327ae7617a9148ab312dc3 Mon Sep 17 00:00:00 2001 From: jfa Date: Tue, 26 Jul 2005 09:12:40 +0000 Subject: [PATCH] Remove useless files; Use SALOMEDSClient classes instead of CORBA interfaces; fix IPAL9532 --- src/VISUGUI/VISU_msg_en.po | 102 ------ src/VISUGUI/VisuGUI.cxx | 97 ++++-- src/VISUGUI/VisuGUI.h | 19 +- src/VISUGUI/VisuGUI_CellsResultsDlg.cxx | 138 -------- src/VISUGUI/VisuGUI_CellsResultsDlg.h | 59 ---- src/VISUGUI/VisuGUI_CursorDlg.cxx | 47 ++- src/VISUGUI/VisuGUI_CursorDlg.h | 38 +-- src/VISUGUI/VisuGUI_EditContainerDlg.cxx | 113 +------ src/VISUGUI/VisuGUI_EditContainerDlg.h | 35 +-- src/VISUGUI/VisuGUI_InitMeshDlg.cxx | 381 ----------------------- src/VISUGUI/VisuGUI_InitMeshDlg.h | 117 ------- src/VISUGUI/VisuGUI_PointsResultsDlg.cxx | 142 --------- src/VISUGUI/VisuGUI_PointsResultsDlg.h | 62 ---- src/VISUGUI/VisuGUI_Selection.cxx | 117 ++++--- src/VISUGUI/VisuGUI_Selection.h | 6 - src/VISUGUI/VisuGUI_StreamLinesDlg.cxx | 1 - src/VISUGUI/VisuGUI_StreamLinesDlg.h | 4 - src/VISUGUI/VisuGUI_Tools.cxx | 311 ++++++++---------- src/VISUGUI/VisuGUI_Tools.h | 15 +- src/VISU_I/VISUConfig.cc | 135 ++++++-- src/VISU_I/VISUConfig.hh | 42 ++- src/VISU_I/VISU_Result_i.cc | 37 --- src/VISU_I/VISU_Result_i.hh | 3 - 23 files changed, 477 insertions(+), 1544 deletions(-) delete mode 100644 src/VISUGUI/VisuGUI_CellsResultsDlg.cxx delete mode 100644 src/VISUGUI/VisuGUI_CellsResultsDlg.h delete mode 100644 src/VISUGUI/VisuGUI_InitMeshDlg.cxx delete mode 100644 src/VISUGUI/VisuGUI_InitMeshDlg.h delete mode 100644 src/VISUGUI/VisuGUI_PointsResultsDlg.cxx delete mode 100644 src/VISUGUI/VisuGUI_PointsResultsDlg.h diff --git a/src/VISUGUI/VISU_msg_en.po b/src/VISUGUI/VISU_msg_en.po index 824bffb0..1be18722 100644 --- a/src/VISUGUI/VISU_msg_en.po +++ b/src/VISUGUI/VISU_msg_en.po @@ -288,51 +288,6 @@ msgid "VisuGUI::DLG_LINEWIDTH_CMT2" msgstr "1 (thin) and 10 (thick)" -#: VisuGUI_CellsResultsDlg.cxx - -msgid "VisuGUI_CellsResultsDlg::&OK" -msgstr "" - -msgid "VisuGUI_CellsResultsDlg::IdCell" -msgstr "" - -msgid "VisuGUI_CellsResultsDlg::NbPoints" -msgstr "" - -msgid "VisuGUI_CellsResultsDlg::Number of Points :" -msgstr "" - -msgid "VisuGUI_CellsResultsDlg::Point" -msgstr "" - -msgid "VisuGUI_CellsResultsDlg::Results on Cell" -msgstr "" - -msgid "VisuGUI_CellsResultsDlg::Results on selected Cell" -msgstr "" - -msgid "VisuGUI_CellsResultsDlg::Scalar Value" -msgstr "" - -msgid "VisuGUI_CellsResultsDlg::Scalar result :" -msgstr "" - -msgid "VisuGUI_CellsResultsDlg::Vector Txt" -msgstr "" - -msgid "VisuGUI_CellsResultsDlg::Vector result :" -msgstr "" - -msgid "VisuGUI_CellsResultsDlg::X" -msgstr "" - -msgid "VisuGUI_CellsResultsDlg::Y" -msgstr "" - -msgid "VisuGUI_CellsResultsDlg::Z" -msgstr "" - - #: VisuGUI_CursorDlg.cxx msgid "VisuGUI_CursorDlg::&OK" @@ -496,27 +451,6 @@ msgid "VisuGUI_FileDlg::FULL_LOAD" msgstr "Full loading for current file" -#: VisuGUI_InitMeshDlg.cxx - -msgid "VisuGUI_InitMeshDlg::Visu_ARGUMENTS" -msgstr "Arguments" - -msgid "VisuGUI_InitMeshDlg::BUT_APPLY" -msgstr "Apply" - -msgid "VisuGUI_InitMeshDlg::Visu_INIT" -msgstr "Initialise" - -msgid "VisuGUI_InitMeshDlg::Visu_INIT_MESH" -msgstr "Initialise mesh" - -msgid "VisuGUI_InitMeshDlg::Visu_NAME" -msgstr "Name" - -msgid "VisuGUI_InitMeshDlg::Visu_OBJECT_GEOM" -msgstr "Geometrical object" - - #: VisuGUI_IsoSurfacesDlg.cxx msgid "VisuGUI_IsoSurfacesDlg::&OK" @@ -568,42 +502,6 @@ msgid "VisuGUI_NonIsometricDlg::LBL_Z" msgstr "Z :" -#: VisuGUI_PointsResultsDlg.cxx - -msgid "VisuGUI_PointsResultsDlg::&OK" -msgstr "" - -msgid "VisuGUI_PointsResultsDlg::DLG_TITLE" -msgstr "Results at selected point" - -msgid "VisuGUI_PointsResultsDlg::RESULTS_GRP" -msgstr "Results at Point" - -msgid "VisuGUI_PointsResultsDlg::IdPoint" -msgstr "" - -msgid "VisuGUI_PointsResultsDlg::LBL_X" -msgstr "X:" - -msgid "VisuGUI_PointsResultsDlg::LBL_Y" -msgstr "Y:" - -msgid "VisuGUI_PointsResultsDlg::LBL_Z" -msgstr "Z:" - -msgid "VisuGUI_PointsResultsDlg::LBL_SCALAR_RESULT" -msgstr "Scalar result :" - -msgid "VisuGUI_PointsResultsDlg::LBL_SCALAR_VALUE" -msgstr "Scalar Value" - -msgid "VisuGUI_PointsResultsDlg::LBL_VECTOR_RESULT" -msgstr "Vector result :" - -msgid "VisuGUI_PointsResultsDlg::LBL_VECTOR_TXT" -msgstr "Vector Txt" - - #: VisuGUI_ScalarBarDlg.cxx msgid "VisuGUI_ScalarBarDlg::&OK" diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 65074667..a99dee77 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -372,21 +372,21 @@ CreateCurves( SalomeApp_Module* theModule, template TPrs3d_i* CreatePrs3d(SalomeApp_Module* theModule, - SALOMEDS::SObject_var theTimeStamp, + _PTR(SObject) theTimeStamp, const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, int theTimeId) { VISU::Result_var aResult; - if(CheckResult(theModule,theTimeStamp,aResult)){ + if (CheckResult(theModule,theTimeStamp,aResult)){ QApplication::setOverrideCursor(Qt::waitCursor); typedef typename TPrs3d_i::TInterface TPrs3d; typename TPrs3d::_var_type aPrs3d = GetVisuGen(theModule)->template Prs3dOnField (aResult,theMeshName,theEntity,theFieldName,theTimeId); QApplication::restoreOverrideCursor(); - if(!CORBA::is_nil(aPrs3d.in())) + if (!CORBA::is_nil(aPrs3d.in())) return dynamic_cast(VISU::GetServant(aPrs3d.in()).in()); } SUIT_MessageBox::warn1(GetDesktop(theModule), @@ -400,7 +400,7 @@ CreatePrs3d(SalomeApp_Module* theModule, template bool CreatePrs3d(SalomeApp_Module* theModule, - SALOMEDS::SObject_var theTimeStamp, + _PTR(SObject) theTimeStamp, const Handle(SALOME_InteractiveObject)& theIO) { using namespace VISU; @@ -457,21 +457,21 @@ template void CreatePrs3d(SalomeApp_Module* theModule) { - if(CheckLock(GetCStudy(GetAppStudy(theModule)))) + if (CheckLock(GetCStudy(GetAppStudy(theModule)))) return; - SALOMEDS::SObject_var aTimeStampSObj; + _PTR(SObject) aTimeStampSObj; Handle(SALOME_InteractiveObject) anIO; - if(!CheckTimeStamp(theModule,aTimeStampSObj,&anIO)) + if (!CheckTimeStamp(theModule,aTimeStampSObj,&anIO)) return; - if(!CreatePrs3d(theModule,aTimeStampSObj,anIO)) + if (!CreatePrs3d(theModule,aTimeStampSObj,anIO)) return; theModule->application()->putInfo(QObject::tr("INF_DONE")); theModule->updateObjBrowser(); - if(SVTK_ViewWindow* aView = GetViewWindow(theModule)) + if (SVTK_ViewWindow* aView = GetViewWindow(theModule)) aView->onFitAll(); } @@ -484,7 +484,6 @@ OnCreateMesh() return; // Get selected SObject - SALOMEDS::SObject_var aResultSObj; Handle(SALOME_InteractiveObject) anIO; CORBA::Object_var anObject = GetSelectedObj(this, &anIO); if (anIO.IsNull() || !anIO->hasEntry()) @@ -1085,7 +1084,6 @@ OnDeleteObjects() _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); if (CheckLock(aCStudy)) return; - SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy); SALOME_ListIO aList; SalomeApp_SelectionMgr* mgr = GetSelectionMgr(this); @@ -1104,13 +1102,13 @@ OnDeleteObjects() if (nbSelected < 1) return; // There is a transaction - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder(); aStudyBuilder->NewCommand(); for (i = 0; i < nbSelected; i++) { - SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(entries[i]); - if (!aSObject->_is_nil()) { - DeleteSObject(this, aStudy, aSObject); + _PTR(SObject) aSObject = aCStudy->FindObjectID(entries[i]); + if (aSObject) { + DeleteSObject(this, aCStudy, aSObject); } } @@ -1326,7 +1324,6 @@ OnClearContainer() _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); if (CheckLock(aCStudy)) return; - SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy); Handle(SALOME_InteractiveObject) anIO; CORBA::Object_var anObject = GetSelectedObj(this, &anIO); if (anIO.IsNull() || CORBA::is_nil(anObject)) @@ -1359,7 +1356,8 @@ OnEditContainer() VISU::Container_i* aContainer = dynamic_cast(aServant.in()); if (!aContainer) return; - VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (GetDesktop(this)); + //VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (GetDesktop(this)); + VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this); aDlg->initFromPrsObject(aContainer); if (aDlg->exec()) { aDlg->storeToPrsObject(aContainer); @@ -1375,7 +1373,6 @@ OnSaveViewParams() _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); if (CheckLock(aCStudy)) return; - SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy); SUIT_ViewManager* aViewMgr = getApp()->activeViewManager(); if (aViewMgr->getType() != SVTK_Viewer::Type()) @@ -1864,7 +1861,6 @@ OnTranslatePrs() VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this); _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); - SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy); SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); SALOME_ListIO aListIO; @@ -1874,9 +1870,9 @@ OnTranslatePrs() for (; It.More(); It.Next()) { Handle(SALOME_InteractiveObject)& anIO = It.Value(); if (anIO->hasEntry()) { - SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry()); - if (!aSObject->_is_nil()) { - CORBA::Object_var aCORBAObject = VISU::SObjectToObject(aSObject); + _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry()); + if (aSObject) { + CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject); if (!CORBA::is_nil(aCORBAObject)) { PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject); if (VISU::Prs3d_i* aPrsObject = dynamic_cast(aServant.in())) { @@ -2488,22 +2484,71 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q { SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle); + SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); + SALOME_ListIO aListIO; + aSelectionMgr->selectedObjects(aListIO); + + if (aListIO.Extent() < 1) return; + + _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); + + // Check if "Merge Scalar Range" can be applied + int nbPrs = 0; + SALOME_ListIteratorOfListIO It (aListIO); + for (; It.More(); It.Next()) { + Handle(SALOME_InteractiveObject)& anIO = It.Value(); + /*std::vector aPrsList = GetPrs3dList(this, anIO); + nbPrs += aPrsList.size();*/ + + if (!anIO.IsNull() && anIO->hasEntry()) { + _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry()); + CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject); + if (CORBA::is_nil(aCORBAObject)) { + _PTR(GenericAttribute) anAttr; + if (aSObject->FindAttribute(anAttr, "AttributeComment")) { + _PTR(AttributeComment) aComment (anAttr); + string aComm = aComment->Value(); + QString strIn (aComm.c_str()); + VISU::Storable::TRestoringMap pMap; + VISU::Storable::StrToMap(strIn, pMap); + bool isExist; + VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt(); + if (isExist && aType == VISU::TTIMESTAMP) { + _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject); + _PTR(SObject) aPrs; + for (; anIter->More(); anIter->Next()) { + aPrs = anIter->Value(); + if (!aPrs) continue; + std::vector aSubList = GetPrs3dList(this, aPrs); + nbPrs += aSubList.size(); + } + } + } + } + } + } + + if (nbPrs > 1) { + theMenu->insertSeparator(); + action( VISU_MERGE_SCALAR_BARS )->addTo(theMenu); + action( VISU_FREE_SCALAR_BARS )->addTo(theMenu); + } + + theMenu->insertSeparator(); + // Check if some (nb > 0) removable objects selected if (IsRemovableSelected(this)) { action( VISU_DELETE_OBJS )->addTo(theMenu); } // Check single selection - SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); - SALOME_ListIO aListIO; - aSelectionMgr->selectedObjects(aListIO); if (aListIO.Extent() != 1) return; Handle(SALOME_InteractiveObject) anIO; VISU::Storable::TRestoringMap aMap; CORBA::Object_var anObject = GetSelectedObj( this, &anIO, &aMap); - _PTR(SObject) SO = GetCStudy(GetAppStudy(this))->FindObjectID(anIO->getEntry()); + _PTR(SObject) SO = aCStudy->FindObjectID(anIO->getEntry()); bool isExist; VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt(); diff --git a/src/VISUGUI/VisuGUI.h b/src/VISUGUI/VisuGUI.h index 10a62f2f..d43f4360 100644 --- a/src/VISUGUI/VisuGUI.h +++ b/src/VISUGUI/VisuGUI.h @@ -31,24 +31,10 @@ #include "SalomeApp_Module.h" -#include "SALOME_InteractiveObject.hxx" - -#include "VISUConfig.hh" - -#include "SALOMEconfig.h" -#include CORBA_SERVER_HEADER(SALOMEDS) -#include CORBA_SERVER_HEADER(VISU_Gen) -#include CORBA_SERVER_HEADER(MED_Gen) - -class SUIT_Desktop; - -namespace VISU { - class Prs3d_i; -} - class VisuGUI: public SalomeApp_Module { Q_OBJECT; + public: VisuGUI(); @@ -88,7 +74,6 @@ protected slots: void OnCreatePlot2dView(); void OnEditPrs(); - //void OnDeletePrs(); void OnDisplayPrs(); void OnDisplayOnlyPrs(); @@ -109,7 +94,6 @@ protected slots: void OnShowTable(); void OnCreateTable(); - //void OnDeleteObject(); void OnDeleteObjects(); void OnPlotData(); void OnCurveProperties(); @@ -121,7 +105,6 @@ protected slots: void OnSaveViewParams(); void OnRestoreViewParams(); - //void OnDeleteViewParams(); void OnRename(); void OnClippingPlanes(); diff --git a/src/VISUGUI/VisuGUI_CellsResultsDlg.cxx b/src/VISUGUI/VisuGUI_CellsResultsDlg.cxx deleted file mode 100644 index 5ee37e60..00000000 --- a/src/VISUGUI/VisuGUI_CellsResultsDlg.cxx +++ /dev/null @@ -1,138 +0,0 @@ -// 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 -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : VisuGUI_CellsResultsDlg.cxx -// Author : Laurent CORNABE & Hubert ROLLAND -// Module : VISU -// $Header$ - -using namespace std; -#include "VisuGUI_CellsResultsDlg.h" -#include -#include - -/*! - Constructor -*/ -VisuGUI_CellsResultsDlg::VisuGUI_CellsResultsDlg( QWidget* parent, const char* name, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - if ( !name ) - setName( "VisuGUI_CellsResultsDlg" ); - setCaption( tr( "Results on selected Cell" ) ); - setSizeGripEnabled( TRUE ); - - QGridLayout* TopLayout = new QGridLayout( this ); - TopLayout->setSpacing( 6 ); - TopLayout->setMargin( 11 ); - - GroupLimit = new QGroupBox( this, "GroupLimit" ); - GroupLimit->setTitle( tr( "Results on Cell" ) ); - GroupLimit->setColumnLayout(0, Qt::Vertical ); - GroupLimit->layout()->setSpacing( 0 ); - GroupLimit->layout()->setMargin( 0 ); - QGridLayout* GroupLimitLayout = new QGridLayout( GroupLimit->layout() ); - GroupLimitLayout->setAlignment( Qt::AlignTop ); - GroupLimitLayout->setSpacing( 6 ); - GroupLimitLayout->setMargin( 11 ); - - IdCell = new QLabel( tr( "IdCell" ), GroupLimit, "IdCell" ); - QFont IdCell_font = IdCell->font(); - IdCell_font.setBold( TRUE ); - IdCell->setFont( IdCell_font ); - IdCell->setAlignment( QLabel::AlignVCenter | QLabel::AlignRight ); - IdCell->setFrameStyle( QLabel::Box | QLabel::Plain ); - IdCell->setMargin( 5 ); - QHBoxLayout* IdLayout = new QHBoxLayout; - - IdLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum )); - IdLayout->addWidget( IdCell ); - GroupLimitLayout->addMultiCellLayout( IdLayout, 0, 0, 0, 2); - - NbPoints = new QLabel( tr( "Number of Points :"), GroupLimit, "NbPoints" ); - GroupLimitLayout->addWidget( NbPoints, 1, 0 ); - NbPoint = new QLabel( tr( "NbPoints" ), GroupLimit, "NbPoint" ); - NbPoint->setAlignment( AlignLeft ); - GroupLimitLayout->addWidget( NbPoint, 1, 1 ); - GroupLimitLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 1, 2 ); - - ListPoints = new QListView( GroupLimit, "ListPoints" ); - ListPoints->setMinimumSize( 300, 120 ); - ListPoints->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); - ListPoints->addColumn( tr( "Point" ) ); - ListPoints->addColumn( tr( "X" ) ); - ListPoints->addColumn( tr( "Y" ) ); - ListPoints->addColumn( tr( "Z" ) ); - ListPoints->setAllColumnsShowFocus( true ); - ListPoints->setShowToolTips( true ); - ListPoints->setSelectionMode( QListView::Single ); - ListPoints->header()->setStretchEnabled( true ); - ListPoints->header()->setStretchEnabled( true, 0 ); - ListPoints->header()->setStretchEnabled( true, 1 ); - ListPoints->header()->setStretchEnabled( true, 2 ); - ListPoints->header()->setStretchEnabled( true, 3 ); - GroupLimitLayout->addMultiCellWidget( ListPoints, 2, 2, 0, 2 ); - - Scalar_Results = new QLabel( tr( "Scalar result :" ), GroupLimit, "Scalar_Results" ); - GroupLimitLayout->addWidget( Scalar_Results, 3, 0 ); - ScalValue = new QLabel( tr( "Scalar Value" ), GroupLimit, "ScalValue" ); - ScalValue->setAlignment( AlignLeft ); - GroupLimitLayout->addWidget( ScalValue, 3, 1 ); - GroupLimitLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 3, 2 ); - - Vector_Results = new QLabel( tr( "Vector result :" ), GroupLimit, "Vector_Results" ); - GroupLimitLayout->addWidget( Vector_Results, 4, 0 ); - VectTxt = new QLabel( tr( "Vector Txt" ), GroupLimit, "VectTxt" ); - VectTxt->setAlignment( AlignLeft ); - GroupLimitLayout->addWidget( VectTxt, 4, 1 ); - GroupLimitLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 4, 2 ); - - GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - - buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 0 ); - GroupButtonsLayout->addWidget( buttonOk, 0, 1 ); - GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 2 ); - - TopLayout->addWidget( GroupLimit, 0, 0 ); - TopLayout->addWidget( GroupButtons, 1, 0 ); - - // signals and slots connections - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); -} - -/*! - Destructor -*/ -VisuGUI_CellsResultsDlg::~VisuGUI_CellsResultsDlg() -{ -} diff --git a/src/VISUGUI/VisuGUI_CellsResultsDlg.h b/src/VISUGUI/VisuGUI_CellsResultsDlg.h deleted file mode 100644 index e937e91c..00000000 --- a/src/VISUGUI/VisuGUI_CellsResultsDlg.h +++ /dev/null @@ -1,59 +0,0 @@ -// 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 -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : VisuGUI_CellsResultsDlg.h -// Author : Laurent CORNABE & Hubert ROLLAND -// Module : VISU -// $Header$ - -#ifndef VISUGUI_CELLSRESULTSDLG_H -#define VISUGUI_CELLSRESULTSDLG_H - -#include -#include -#include -#include -#include - -class VisuGUI_CellsResultsDlg : public QDialog -{ - Q_OBJECT - -public: - VisuGUI_CellsResultsDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); - ~VisuGUI_CellsResultsDlg(); - - QGroupBox* GroupLimit; - QLabel* IdCell; - QLabel* NbPoints; - QLabel* NbPoint; - QListView* ListPoints; - QLabel* Scalar_Results; - QLabel* ScalValue; - QLabel* Vector_Results; - QLabel* VectTxt; - QGroupBox* GroupButtons; - QPushButton* buttonOk; -}; - -#endif // VISUGUI_CELLSRESULTSDLG_H diff --git a/src/VISUGUI/VisuGUI_CursorDlg.cxx b/src/VISUGUI/VisuGUI_CursorDlg.cxx index a9743999..e1adefcf 100644 --- a/src/VISUGUI/VisuGUI_CursorDlg.cxx +++ b/src/VISUGUI/VisuGUI_CursorDlg.cxx @@ -1,28 +1,28 @@ // 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 -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // // // // File : VisuGUI_CursorDlg.cxx -// Author : Laurent CORNABE & Hubert ROLLAND +// Author : Laurent CORNABE & Hubert ROLLAND // Module : VISU // $Header$ @@ -41,10 +41,10 @@ VisuGUI_CursorDlg::VisuGUI_CursorDlg( QWidget* parent, const char* name, bool m setCaption( name ); setSizeGripEnabled( TRUE ); - QGridLayout* TopLayout = new QGridLayout( this ); + QGridLayout* TopLayout = new QGridLayout( this ); TopLayout->setSpacing( 6 ); TopLayout->setMargin( 11 ); - + TopGroupBox = new QGroupBox( this, "TopGroupBox" ); TopGroupBox->setColumnLayout(0, Qt::Vertical ); TopGroupBox->layout()->setSpacing( 0 ); @@ -71,9 +71,9 @@ VisuGUI_CursorDlg::VisuGUI_CursorDlg( QWidget* parent, const char* name, bool m SLayout->addWidget( SpinBox1 ); SLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ) ); TopGroupBoxLayout->addLayout( SLayout, 2, 0 ); - + GroupButtons = new QGroupBox (this, "GroupButtons"); - GroupButtons->setGeometry(QRect(10, 10, 281, 48)); + GroupButtons->setGeometry(QRect(10, 10, 281, 48)); GroupButtons->setColumnLayout(0, Qt::Vertical); GroupButtons->layout()->setSpacing(0); GroupButtons->layout()->setMargin(0); @@ -92,7 +92,7 @@ VisuGUI_CursorDlg::VisuGUI_CursorDlg( QWidget* parent, const char* name, bool m buttonCancel = new QPushButton(tr("&Cancel") , GroupButtons, "buttonCancel"); buttonCancel->setAutoDefault(TRUE); GroupButtonsLayout->addWidget(buttonCancel, 0, 2); - + TopLayout->addWidget(TopGroupBox, 0, 0); TopLayout->addWidget(GroupButtons, 1, 0); @@ -107,4 +107,3 @@ VisuGUI_CursorDlg::VisuGUI_CursorDlg( QWidget* parent, const char* name, bool m VisuGUI_CursorDlg::~VisuGUI_CursorDlg() { } - diff --git a/src/VISUGUI/VisuGUI_CursorDlg.h b/src/VISUGUI/VisuGUI_CursorDlg.h index 72958e42..018709cf 100644 --- a/src/VISUGUI/VisuGUI_CursorDlg.h +++ b/src/VISUGUI/VisuGUI_CursorDlg.h @@ -1,28 +1,28 @@ // 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 -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // // // // File : VisuGUI_CursorDlg.h -// Author : Laurent CORNABE & Hubert ROLLAND +// Author : Laurent CORNABE & Hubert ROLLAND // Module : VISU // $Header$ @@ -36,7 +36,7 @@ #include class VisuGUI_CursorDlg : public QDialog -{ +{ Q_OBJECT public: diff --git a/src/VISUGUI/VisuGUI_EditContainerDlg.cxx b/src/VISUGUI/VisuGUI_EditContainerDlg.cxx index 0d0d9c2e..353944e5 100644 --- a/src/VISUGUI/VisuGUI_EditContainerDlg.cxx +++ b/src/VISUGUI/VisuGUI_EditContainerDlg.cxx @@ -10,7 +10,10 @@ #include "VisuGUI_EditContainerDlg.h" + #include "VisuGUI.h" +#include "VisuGUI_Tools.h" + #include "VISU_Table_i.hh" #include "SalomeApp_Application.h" @@ -22,11 +25,6 @@ #include #include -#include CORBA_SERVER_HEADER(VISU_Gen) -#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) - -//extern VisuGUI *visuGUI; - using namespace std; @@ -195,9 +193,10 @@ static const char * right_xpm[] = { static QPixmap MYRightPix(right_xpm); -VisuGUI_EditContainerDlg::VisuGUI_EditContainerDlg (QWidget* parent, bool theIsModal) - : QDialog(parent, "VisuGUI_EditContainerDlg", theIsModal, WStyle_Customize | - WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +VisuGUI_EditContainerDlg::VisuGUI_EditContainerDlg (VisuGUI* theModule, bool theIsModal) + : QDialog(VISU::GetDesktop(theModule), "VisuGUI_EditContainerDlg", theIsModal, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), + myVisuGUI(theModule) { if (!theIsModal) { setWFlags(getWFlags() | WDestructiveClose); @@ -274,7 +273,8 @@ VisuGUI_EditContainerDlg::VisuGUI_EditContainerDlg (QWidget* parent, bool theIsM buttonOk->setAutoDefault(TRUE); buttonOk->setDefault(TRUE); GroupButtonsLayout->addWidget(buttonOk, 0, 0); - GroupButtonsLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1); + GroupButtonsLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Expanding, + QSizePolicy::Minimum), 0, 1); QPushButton* buttonCancel = new QPushButton(tr("&Cancel") , GroupButtons, "buttonCancel"); buttonCancel->setAutoDefault(TRUE); @@ -288,60 +288,7 @@ VisuGUI_EditContainerDlg::VisuGUI_EditContainerDlg (QWidget* parent, bool theIsM void VisuGUI_EditContainerDlg::initFromPrsObject (VISU::Container_i* theContainer) { - SALOMEDS::Study_var aStudy = theContainer->GetStudyDocument(); - SALOMEDS::SComponent_var aVisuSO = aStudy->FindComponent("VISU"); - if (CORBA::is_nil(aVisuSO)) { - return; - } - QValueList aStudyCurves; - QValueList aContainerCurves; - // Find curves in container - for (int i = 1; i <= theContainer->GetNbCurves(); i++) { - VISU::Curve_i* aCurve = theContainer->GetCurve(i); - if (aCurve == NULL) continue; - CurveStruct aEntry; - aEntry.CurveName = aCurve->GetTitle(); - aEntry.CurveEntry = aCurve->GetEntry(); - SALOMEDS::SObject_var aTableSO = aStudy->FindObjectID(aCurve->GetTableID()); - if (CORBA::is_nil(aTableSO)) continue; - aEntry.TableName = getSObjectName(aTableSO); - aContainerCurves.append(aEntry); - new QListViewItem(myContainerLst, aEntry.TableName, aEntry.CurveName, aEntry.CurveEntry); - } - // Find curves in study - SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator(aVisuSO); - for (aIter->InitEx(true); aIter->More(); aIter->Next()) { - SALOMEDS::SObject_var aSObject = aIter->Value(); - CORBA::Object_var anObject = VISU::SObjectToObject(aSObject); - VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject); - if (!CORBA::is_nil(aVisuObj)) { - if (aVisuObj->GetType() == VISU::TCURVE) { - SALOMEDS::SObject_var aTableSO = aSObject->GetFather(); - CurveStruct aEntry; - aEntry.TableName = getSObjectName(aTableSO); - aEntry.CurveName = getSObjectName(aSObject); - aEntry.CurveEntry = aSObject->GetID(); - aStudyCurves.append(aEntry); - } - } - } - //Show Curves which are not in Curve - QValueList::iterator it; - QValueList::iterator it2; - bool isExist = false; - for (it = aStudyCurves.begin(); it != aStudyCurves.end(); ++it) { - for (it2 = aContainerCurves.begin(); it2 != aContainerCurves.end(); ++it2) { - if (isExist = ((*it).CurveEntry == (*it2).CurveEntry)) - break; - } - if (!isExist) - new QListViewItem(myStudyLst, (*it).TableName, (*it).CurveName, (*it).CurveEntry); - } -} - -/*void VisuGUI_EditContainerDlg::initFromPrsObject (VISU::Container_i* theContainer) -{ - _PTR(Study) aStudy = theContainer->GetStudyDocument(); + _PTR(Study) aStudy = VISU::GetCStudy(VISU::GetAppStudy(myVisuGUI)); _PTR(SComponent) aVisuSO = aStudy->FindComponent("VISU"); if (!aVisuSO) { return; @@ -390,32 +337,13 @@ void VisuGUI_EditContainerDlg::initFromPrsObject (VISU::Container_i* theContaine if (!isExist) new QListViewItem(myStudyLst, (*it).TableName, (*it).CurveName, (*it).CurveEntry); } -}*/ - -void VisuGUI_EditContainerDlg::storeToPrsObject (VISU::Container_i* theContainer) -{ - theContainer->Clear(); - - SALOMEDS::Study_var aStudy = theContainer->GetStudyDocument(); - QListViewItem* anItem = myContainerLst->firstChild(); - while (anItem) { - SALOMEDS::SObject_var aCurveSO = aStudy->FindObjectID(anItem->text(2)); - if (!CORBA::is_nil(aCurveSO)) { - CORBA::Object_var aObject = VISU::SObjectToObject(aCurveSO); - if (!CORBA::is_nil(aObject)) { - VISU::Curve_i* aCurve = dynamic_cast(VISU::GetServant(aObject).in()); - if (aCurve) theContainer->AddCurve(aCurve->_this()); - } - } - anItem = anItem->nextSibling(); - } } -/*void VisuGUI_EditContainerDlg::storeToPrsObject (VISU::Container_i* theContainer) +void VisuGUI_EditContainerDlg::storeToPrsObject (VISU::Container_i* theContainer) { theContainer->Clear(); - _PTR(Study) aStudy = theContainer->GetStudyDocument(); + _PTR(Study) aStudy = VISU::GetCStudy(VISU::GetAppStudy(myVisuGUI)); QListViewItem* anItem = myContainerLst->firstChild(); while (anItem) { _PTR(SObject) aCurveSO = aStudy->FindObjectID(anItem->text(2)); @@ -428,22 +356,9 @@ void VisuGUI_EditContainerDlg::storeToPrsObject (VISU::Container_i* theContainer } anItem = anItem->nextSibling(); } -}*/ - -QString VisuGUI_EditContainerDlg::getSObjectName (SALOMEDS::SObject_ptr theSObject) -{ - if (CORBA::is_nil(theSObject)) return QString(""); - - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeName_var aName; - if (theSObject->FindAttribute(anAttr, "AttributeName")) { - aName = SALOMEDS::AttributeName::_narrow(anAttr); - return QString(aName->Value()); - } - return QString(""); } -/*QString VisuGUI_EditContainerDlg::getSObjectName (_PTR(SObject) theSObject) +QString VisuGUI_EditContainerDlg::getSObjectName (_PTR(SObject) theSObject) { if (!theSObject) return QString(""); @@ -453,7 +368,7 @@ QString VisuGUI_EditContainerDlg::getSObjectName (SALOMEDS::SObject_ptr theSObje return QString(aName->Value()); } return QString(""); -}*/ +} void VisuGUI_EditContainerDlg::onLeftClicked() { diff --git a/src/VISUGUI/VisuGUI_EditContainerDlg.h b/src/VISUGUI/VisuGUI_EditContainerDlg.h index 19c44d8c..8493d0ff 100644 --- a/src/VISUGUI/VisuGUI_EditContainerDlg.h +++ b/src/VISUGUI/VisuGUI_EditContainerDlg.h @@ -16,11 +16,9 @@ #include #include -#include -#include CORBA_SERVER_HEADER(SALOMEDS) +#include "SALOMEDSClient_SObject.hxx" - -class SALOMEDSClient_SObject; +class VisuGUI; namespace VISU { class Container_i; @@ -36,29 +34,30 @@ struct CurveStruct { class VisuGUI_EditContainerDlg: public QDialog { - Q_OBJECT + Q_OBJECT; -public: - VisuGUI_EditContainerDlg (QWidget* parent, bool theIsModal = true); - ~VisuGUI_EditContainerDlg() {}; + public: + VisuGUI_EditContainerDlg (VisuGUI* theModule, bool theIsModal = true); + ~VisuGUI_EditContainerDlg() {}; - void initFromPrsObject (VISU::Container_i* theContainer); - void storeToPrsObject (VISU::Container_i* theContainer); + void initFromPrsObject (VISU::Container_i* theContainer); + void storeToPrsObject (VISU::Container_i* theContainer); -private slots: + private slots: void onLeftClicked(); void onRightClicked(); void onLeftSelected(); void onRightSelected(); -private: - //QString getSObjectName (_PTR(SObject) theSObject); - QString getSObjectName (SALOMEDS::SObject_ptr theSObject); + private: + QString getSObjectName (_PTR(SObject) theSObject); + + QListView* myStudyLst; + QListView* myContainerLst; + QToolButton* myLeftBtn; + QToolButton* myRightBtn; - QListView* myStudyLst; - QListView* myContainerLst; - QToolButton* myLeftBtn; - QToolButton* myRightBtn; + VisuGUI* myVisuGUI; }; #endif // VISUGUI_EDITCONTAINER_H diff --git a/src/VISUGUI/VisuGUI_InitMeshDlg.cxx b/src/VISUGUI/VisuGUI_InitMeshDlg.cxx deleted file mode 100644 index ca011ddb..00000000 --- a/src/VISUGUI/VisuGUI_InitMeshDlg.cxx +++ /dev/null @@ -1,381 +0,0 @@ -z// 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 -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : VisuGUI_InitMeshDlg.cxx -// Author : Nicolas REJNERI -// Module : VISU -// $Header$ - -using namespace std; -#include "VisuGUI_InitMeshDlg.h" -#include "VisuGUI.h" - -#include "SUIT_Application.h" -#include "SUIT_Desktop.h" -#include "utilities.h" - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : VisuGUI_InitMeshDlg() -// purpose : Constructs a VisuGUI_InitMeshDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -VisuGUI_InitMeshDlg::VisuGUI_InitMeshDlg( QWidget* parent, const char* name, SALOME_Selection* Sel = 0, bool modal, WFlags fl ) - : QDialog( parent, name, modal, fl ) -{ - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "VISU",tr("ICON_DLG_INIT_MESH"))); - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "VISU",tr("ICON_SELECT"))); - if ( !name ) - setName( "VisuGUI_InitMeshDlg" ); - resize( 303, 175 ); - setCaption( tr( "Visu_INIT_MESH" ) ); - VisuGUI_InitMeshDlgLayout = new QGridLayout( this ); - VisuGUI_InitMeshDlgLayout->setSpacing( 6 ); - VisuGUI_InitMeshDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "Visu_INIT" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - //Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image1 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - VisuGUI_InitMeshDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupButtons = new QGroupBox (this, "GroupButtons"); - GroupButtons->setGeometry(QRect(10, 10, 281, 48)); - GroupButtons->setColumnLayout(0, Qt::Vertical); - GroupButtons->layout()->setSpacing(0); - GroupButtons->layout()->setMargin(0); - GroupButtonsLayout = new QGridLayout (GroupButtons->layout()); - GroupButtonsLayout->setAlignment(Qt::AlignTop); - GroupButtonsLayout->setSpacing(6); - GroupButtonsLayout->setMargin(11); - - buttonCancel = new QPushButton(GroupButtons, "buttonCancel"); - buttonCancel->setText(tr("BUT_CLOSE")); - buttonCancel->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonCancel, 0, 3); - - buttonApply = new QPushButton (GroupButtons, "buttonApply"); - buttonApply->setText(tr("BUT_APPLY")); - buttonApply->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonApply, 0, 1); - - QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupButtonsLayout->addItem(spacer_9, 0, 2); - - buttonOk = new QPushButton(GroupButtons, "buttonOk"); - buttonOk->setText(tr("BUT_OK")); - buttonOk->setAutoDefault(TRUE); - buttonOk->setDefault(TRUE); - GroupButtonsLayout->addWidget(buttonOk, 0, 0); - - VisuGUI_InitMeshDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "Visu_ARGUMENTS" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); - - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "Visu_OBJECT_GEOM" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - //SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image0 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - - TextLabel_NameMesh = new QLabel( GroupC1, "TextLabel_NameMesh" ); - TextLabel_NameMesh->setText( tr( "Visu_NAME" ) ); - GroupC1Layout->addWidget( TextLabel_NameMesh, 1, 0 ); - LineEdit_NameMesh = new QLineEdit( GroupC1, "LineEdit_NameMesh" ); - GroupC1Layout->addWidget( LineEdit_NameMesh, 1, 2 ); - - VisuGUI_InitMeshDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - - Init(Sel); -} - -//================================================================================= -// function : ~VisuGUI_InitMeshDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -VisuGUI_InitMeshDlg::~VisuGUI_InitMeshDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void VisuGUI_InitMeshDlg::Init( SALOME_Selection* Sel ) -{ - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myVisuGUI = VisuGUI::GetVisuGUI() ; - myVisuGUI->SetActiveDialogBox( (QDialog*)this ) ; - - myGeomFilter = new SALOME_TypeFilter( "GEOM" ); - mySelection->AddFilter( myGeomFilter ); - - myNameMesh = "Mesh"; - - /* signals and slots connections */ - connect( buttonOk, SIGNAL( pressed() ), this, SLOT( ClickOnOk() ) ); - connect( buttonApply, SIGNAL( pressed() ), this, SLOT(ClickOnApply() ) ); - connect( buttonCancel, SIGNAL( pressed() ), this, SLOT( ClickOnCancel() ) ) ; - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - - connect( SelectButtonC1A1, SIGNAL (pressed() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( LineEdit_NameMesh, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ; - - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - connect( myVisuGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - connect( myVisuGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; - -// int x, y ; -// myVisuGUI->DefineDlgPosition( this, x, y ) ; -// this->move( x, y ) ; - this->show() ; - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void VisuGUI_InitMeshDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void VisuGUI_InitMeshDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void VisuGUI_InitMeshDlg::ClickOnApply() -{ - switch(myConstructorId) - { - case 0 : - { - if ( !myNameMesh.isEmpty() && !myNameMesh.isNull() && !myGeomShape->_is_nil() ) - myVisuGUI->InitMesh( mySMeshMesh, myNameMesh ) ; - break ; - } - } -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void VisuGUI_InitMeshDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - disconnect( mySelection, 0, this, 0 ); - myVisuGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void VisuGUI_InitMeshDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - QString aString = ""; - myGeomShape = GEOM::GEOM_Shape::_nil(); - - int nbSel = myVisuGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - return ; - } else { - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - myGeomShape = myVisuGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) return ; - } - - myEditCurrentArgument->setText(aString) ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void VisuGUI_InitMeshDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void VisuGUI_InitMeshDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void VisuGUI_InitMeshDlg::ActivateThisDialog() -{ - myVisuGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void VisuGUI_InitMeshDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void VisuGUI_InitMeshDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; - return ; -} - -//================================================================================= -// function : TextChangedInLineEdit() -// purpose : -//================================================================================= -void VisuGUI_InitMeshDlg::TextChangedInLineEdit(const QString& newText) -{ - QLineEdit* send = (QLineEdit*)sender(); - - if (send == LineEdit_NameMesh) { - myNameMesh = newText; - } - return ; -} diff --git a/src/VISUGUI/VisuGUI_InitMeshDlg.h b/src/VISUGUI/VisuGUI_InitMeshDlg.h deleted file mode 100644 index dadf1b8e..00000000 --- a/src/VISUGUI/VisuGUI_InitMeshDlg.h +++ /dev/null @@ -1,117 +0,0 @@ -// 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 -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : VisuGUI_InitMeshDlg.h -// Author : Nicolas REJNERI -// Module : VISU -// $Header$ - -#ifndef DIALOGBOX_INIT_MESH_H -#define DIALOGBOX_INIT_MESH_H - -#include "SALOME_Selection.h" -#include "SALOME_TypeFilter.hxx" - -// QT Includes -#include -#include - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(GEOM_Gen) -//#include CORBA_SERVER_HEADER(GEOM_Shape) - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class VisuGUI; -class SalomeApp_SelectionMgr; - -//================================================================================= -// class : VisuGUI_InitMeshDlg -// purpose : -//================================================================================= -class VisuGUI_InitMeshDlg : public QDialog -{ - Q_OBJECT - -public: - VisuGUI_InitMeshDlg( QWidget* parent = 0, const char* name = 0, SalomeApp_SelectionMgr* = 0, bool modal = FALSE, WFlags fl = 0 ); - ~VisuGUI_InitMeshDlg(); - -private: - - void Init( SalomeApp_SelectionMgr* ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; - - VisuGUI* myVisuGUI ; - SalomeApp_SelectionMgr* myMgr ; - - GEOM::GEOM_Shape_var myGeomShape ; - int myConstructorId ; - QLineEdit* myEditCurrentArgument; - - QString myNameMesh ; - - Handle(SALOME_TypeFilter) myGeomFilter; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QGroupBox* GroupC1; - QLabel* TextLabel_NameMesh ; - QLineEdit* LineEdit_NameMesh ; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void TextChangedInLineEdit(const QString& newText) ; - -protected: - QGridLayout* VisuGUI_InitMeshDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_INIT_MESH_H diff --git a/src/VISUGUI/VisuGUI_PointsResultsDlg.cxx b/src/VISUGUI/VisuGUI_PointsResultsDlg.cxx deleted file mode 100644 index ae4e133f..00000000 --- a/src/VISUGUI/VisuGUI_PointsResultsDlg.cxx +++ /dev/null @@ -1,142 +0,0 @@ -// 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 -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : VisuGUI_PointsResultsDlg.cxx -// Author : Laurent CORNABE & Hubert ROLLAND -// Module : VISU -// $Header$ - -using namespace std; -#include "VisuGUI_PointsResultsDlg.h" -#include - -/*! - Constructor -*/ -VisuGUI_PointsResultsDlg::VisuGUI_PointsResultsDlg (QWidget* parent, const char* name, bool modal, WFlags fl) - : QDialog(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) -{ - if (!name) - setName("VisuGUI_PointsResultsDlg"); - setCaption(tr("DLG_TITLE")); - setSizeGripEnabled(TRUE); - - QGridLayout* TopLayout = new QGridLayout( this ); - TopLayout->setSpacing( 6 ); - TopLayout->setMargin( 11 ); - - GroupLimit = new QGroupBox (this, "GroupLimit"); - GroupLimit->setTitle(tr("RESULTS_GRP")); - GroupLimit->setColumnLayout(0, Qt::Vertical ); - GroupLimit->layout()->setSpacing( 0 ); - GroupLimit->layout()->setMargin( 0 ); - QGridLayout* GroupLimitLayout = new QGridLayout( GroupLimit->layout() ); - GroupLimitLayout->setAlignment( Qt::AlignTop ); - GroupLimitLayout->setSpacing( 6 ); - GroupLimitLayout->setMargin( 11 ); - - IdPoint = new QLabel( tr( "IdPoint" ), GroupLimit, "IdPoint" ); - QFont IdPoint_font = IdPoint->font(); - IdPoint_font.setBold( TRUE ); - IdPoint->setFont( IdPoint_font ); - IdPoint->setAlignment( QLabel::AlignVCenter | QLabel::AlignRight ); - IdPoint->setFrameStyle( QLabel::Box | QLabel::Plain ); - IdPoint->setMargin( 5 ); - QHBoxLayout* IdLayout = new QHBoxLayout; - IdLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ) ); - IdLayout->addWidget( IdPoint ); - GroupLimitLayout->addMultiCellLayout( IdLayout, 0, 0, 0, 2 ); - - CoordPointX = new QLabel( tr( "LBL_X" ), GroupLimit, "CoordPointX" ); - CoordX = new QLineEdit( GroupLimit ); - CoordX->setReadOnly( true ); - - CoordPointY = new QLabel( tr( "LBL_Y" ), GroupLimit, "CoordPointY" ); - CoordY = new QLineEdit( GroupLimit ); - CoordY->setReadOnly( true ); - - CoordPointZ = new QLabel( tr( "LBL_Z" ), GroupLimit, "CoordPointZ" ); - CoordZ = new QLineEdit( GroupLimit ); - CoordZ->setReadOnly( true ); - - QHBoxLayout* XYZLayout = new QHBoxLayout; XYZLayout->setMargin( 0 ); XYZLayout->setSpacing( 6 ); - XYZLayout->addWidget( CoordPointX ); - XYZLayout->addWidget( CoordX ); - XYZLayout->addWidget( CoordPointY ); - XYZLayout->addWidget( CoordY ); - XYZLayout->addWidget( CoordPointZ ); - XYZLayout->addWidget( CoordZ ); - GroupLimitLayout->addMultiCellLayout( XYZLayout, 1, 1, 0, 2 ); - - GroupLimitLayout->addRowSpacing( 2, 10 ); - - Scalar_Results = new QLabel (tr("LBL_SCALAR_RESULT"), GroupLimit, "Scalar_Results"); - GroupLimitLayout->addWidget( Scalar_Results, 3, 0 ); - ScalValue = new QLabel (tr("LBL_SCALAR_VALUE"), GroupLimit, "ScalValue"); - GroupLimitLayout->addWidget( ScalValue, 3, 1 ); - GroupLimitLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 3, 2 ); - - Vector_Results = new QLabel (tr("LBL_VECTOR_RESULT"), GroupLimit, "Vector_Results"); - GroupLimitLayout->addWidget( Vector_Results, 4, 0 ); - VectTxt = new QLabel (tr("LBL_VECTOR_TXT"), GroupLimit, "VectTxt"); - GroupLimitLayout->addWidget( VectTxt, 4, 1 ); - GroupLimitLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 4, 2 ); - - GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); - //GroupButtons->setTitle( tr( "" ) ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - - buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 0 ); - GroupButtonsLayout->addWidget( buttonOk, 0, 1 ); - GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 2 ); - - TopLayout->addWidget( GroupLimit, 0, 0 ); - TopLayout->addWidget( GroupButtons, 1, 0 ); - - // signals and slots connections - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); -} - -/*! - Destructor -*/ -VisuGUI_PointsResultsDlg::~VisuGUI_PointsResultsDlg() -{ -} - - - - - - - diff --git a/src/VISUGUI/VisuGUI_PointsResultsDlg.h b/src/VISUGUI/VisuGUI_PointsResultsDlg.h deleted file mode 100644 index 9adc0f80..00000000 --- a/src/VISUGUI/VisuGUI_PointsResultsDlg.h +++ /dev/null @@ -1,62 +0,0 @@ -// 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 -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : VisuGUI_PointsResultsDlg.h -// Author : Laurent CORNABE & Hubert ROLLAND -// Module : VISU -// $Header$ - -#ifndef VISUGUI_POINTSRESULTSDLG_H -#define VISUGUI_POINTSRESULTSDLG_H - -#include -#include -#include -#include -#include - -class VisuGUI_PointsResultsDlg : public QDialog -{ - Q_OBJECT - -public: - VisuGUI_PointsResultsDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); - ~VisuGUI_PointsResultsDlg(); - - QGroupBox* GroupLimit; - QLabel* IdPoint; - QLabel* Scalar_Results; - QLabel* ScalValue; - QLabel* Vector_Results; - QLabel* VectTxt; - QLabel* CoordPointX; - QLabel* CoordPointY; - QLabel* CoordPointZ; - QLineEdit* CoordX; - QLineEdit* CoordY; - QLineEdit* CoordZ; - QGroupBox* GroupButtons; - QPushButton* buttonOk; -}; - -#endif // VISUGUI_POINTSRESULTSDLG_H diff --git a/src/VISUGUI/VisuGUI_Selection.cxx b/src/VISUGUI/VisuGUI_Selection.cxx index 0980900e..433b6467 100644 --- a/src/VISUGUI/VisuGUI_Selection.cxx +++ b/src/VISUGUI/VisuGUI_Selection.cxx @@ -74,7 +74,6 @@ #include #include #include -#include // VTK Includes #include @@ -99,9 +98,9 @@ VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (QWidget* parent) mySelectionDlg->close(true); setCaption( "Data on elements" ); - setSizeGripEnabled( TRUE ); + setSizeGripEnabled(TRUE); - QGridLayout* TopLayout = new QGridLayout(this); + QGridLayout* TopLayout = new QGridLayout (this); TopLayout->setSpacing(6); TopLayout->setMargin(11); TopLayout->setRowStretch(0, 0); @@ -109,25 +108,26 @@ VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (QWidget* parent) TopLayout->setRowStretch(2, 1); TopLayout->setRowStretch(3, 0); - QHButtonGroup* aTypeBox = new QHButtonGroup("Selection", this); + QHButtonGroup* aTypeBox = new QHButtonGroup ("Selection", this); - QRadioButton* aPointBtn = new QRadioButton("Point", aTypeBox); - QRadioButton* aCellBtn = new QRadioButton("Cell", aTypeBox); - QRadioButton* aActorBtn = new QRadioButton("Actor", aTypeBox); + QRadioButton* aPointBtn = + new QRadioButton ("Point", aTypeBox); + new QRadioButton ("Cell" , aTypeBox); + new QRadioButton ("Actor", aTypeBox); aPointBtn->setChecked(true); connect(aTypeBox, SIGNAL(clicked(int)), this, SLOT(onSelectionChange(int))); TopLayout->addWidget(aTypeBox, 0, 0); - QWidget* aNamePane = new QWidget(this); - QGridLayout* aNameLay = new QGridLayout(aNamePane); + QWidget* aNamePane = new QWidget (this); + QGridLayout* aNameLay = new QGridLayout (aNamePane); - QLabel* aMeshLbl = new QLabel("Mesh name: ", aNamePane); - myMeshName = new QLabel(aNamePane); + QLabel* aMeshLbl = new QLabel ("Mesh name: ", aNamePane); + myMeshName = new QLabel (aNamePane); - QLabel* aFieldLbl = new QLabel("Field name: ", aNamePane); - myFieldName = new QLabel(aNamePane); + QLabel* aFieldLbl = new QLabel ("Field name: ", aNamePane); + myFieldName = new QLabel (aNamePane); aNameLay->addWidget(aMeshLbl, 0, 0); aNameLay->addWidget(myMeshName, 0, 1); @@ -136,62 +136,62 @@ VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (QWidget* parent) TopLayout->addWidget(aNamePane, 1, 0); - myWidgetStack = new QWidgetStack(this); + myWidgetStack = new QWidgetStack (this); // Create Points pane - myPointsPane = new QVBox(myWidgetStack); + myPointsPane = new QVBox (myWidgetStack); myPointsPane->layout()->setSpacing(6); - QGroupBox* aDataGrp = new QGroupBox(2, Qt::Horizontal, "Data of Point", myPointsPane); + QGroupBox* aDataGrp = new QGroupBox (2, Qt::Horizontal, "Data of Point", myPointsPane); aDataGrp->layout()->setSpacing(6); - QLabel* aIDLbl = new QLabel("ID:", aDataGrp); - myIDValLbl = new QLineEdit("", aDataGrp); - QIntValidator* aIntValidator = new QIntValidator(myIDValLbl); + new QLabel ("ID:", aDataGrp); + myIDValLbl = new QLineEdit ("", aDataGrp); + QIntValidator* aIntValidator = new QIntValidator (myIDValLbl); aIntValidator->setBottom(0); myIDValLbl->setValidator(aIntValidator); connect(myIDValLbl, SIGNAL(textChanged(const QString&)), this, SLOT(onPointIdEdit(const QString&))); - QLabel* aValueLbl = new QLabel("Scalar Value:", aDataGrp); - myScalarValLbl = new QLabel("", aDataGrp); - QLabel* aVectorLbl = new QLabel("Vector Value:", aDataGrp); - myVectorValLbl = new QLabel("", aDataGrp); + new QLabel ("Scalar Value:", aDataGrp); + myScalarValLbl = new QLabel ("", aDataGrp); + new QLabel ("Vector Value:", aDataGrp); + myVectorValLbl = new QLabel ("", aDataGrp); myVectorValLbl->setMinimumWidth(150); - QGroupBox* aCoordGrp = new QGroupBox(2, Qt::Horizontal, "Coordinates", myPointsPane); + QGroupBox* aCoordGrp = new QGroupBox (2, Qt::Horizontal, "Coordinates", myPointsPane); aCoordGrp->layout()->setSpacing(6); - QLabel* aXLbl = new QLabel("X:", aCoordGrp); - myXValLbl = new QLabel("", aCoordGrp); - QLabel* aYLbl = new QLabel("Y:", aCoordGrp); - myYValLbl = new QLabel("", aCoordGrp); - QLabel* aZLbl = new QLabel("Z:",aCoordGrp ); - myZValLbl = new QLabel("", aCoordGrp); + new QLabel ("X:", aCoordGrp); + myXValLbl = new QLabel ("", aCoordGrp); + new QLabel ("Y:", aCoordGrp); + myYValLbl = new QLabel ("", aCoordGrp); + new QLabel ("Z:",aCoordGrp ); + myZValLbl = new QLabel ("", aCoordGrp); myWidgetStack->addWidget(myPointsPane, 0); // Create Cells pane - myCellsPane = new QWidget(myWidgetStack); - QGridLayout* aCellLayout = new QGridLayout(myCellsPane); + myCellsPane = new QWidget (myWidgetStack); + QGridLayout* aCellLayout = new QGridLayout (myCellsPane); aCellLayout->setSpacing(6); aCellLayout->setRowStretch(0, 0); aCellLayout->setRowStretch(1, 1); QGroupBox* aCellGrp = new QGroupBox(2, Qt::Horizontal, "Data of Cell", myCellsPane); - QLabel* aCellIDLbl = new QLabel("ID:", aCellGrp); - myCellIDValLbl = new QLineEdit("", aCellGrp); + new QLabel ("ID:", aCellGrp); + myCellIDValLbl = new QLineEdit ("", aCellGrp); myCellIDValLbl->setValidator(aIntValidator); connect(myCellIDValLbl, SIGNAL(textChanged(const QString&)), this, SLOT(onCellIdEdit(const QString&))); - QLabel* aCellValueLbl = new QLabel("Scalar Value:", aCellGrp); - myCellScalarValLbl = new QLabel("", aCellGrp); - QLabel* aCellVectorLbl = new QLabel("Vector Value:", aCellGrp); - myCellVectorValLbl = new QLabel("", aCellGrp); + new QLabel ("Scalar Value:", aCellGrp); + myCellScalarValLbl = new QLabel ("", aCellGrp); + new QLabel ("Vector Value:", aCellGrp); + myCellVectorValLbl = new QLabel ("", aCellGrp); aCellLayout->addWidget(aCellGrp, 0, 0); - myListPoints = new QTable(myCellsPane); + myListPoints = new QTable (myCellsPane); myListPoints->setReadOnly(true); myListPoints->setNumCols(6); myListPoints->setNumRows(0); @@ -213,26 +213,26 @@ VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (QWidget* parent) myWidgetStack->addWidget(myCellsPane, 1); // Actor Pane - myActorsPane = new QVBox(myWidgetStack); + myActorsPane = new QVBox (myWidgetStack); myActorsPane->layout()->setSpacing(6); - QGroupBox* aPosGrp = new QGroupBox(2, Qt::Horizontal, "Position", myActorsPane); + QGroupBox* aPosGrp = new QGroupBox (2, Qt::Horizontal, "Position", myActorsPane); aPosGrp->layout()->setSpacing(6); - QLabel* aXPosLbl = new QLabel("X:", aPosGrp); - myXPosLbl = new QLabel("0", aPosGrp); - QLabel* aYPosLbl = new QLabel("Y:", aPosGrp); - myYPosLbl = new QLabel("0", aPosGrp); - QLabel* aZPosLbl = new QLabel("Z:", aPosGrp); - myZPosLbl = new QLabel("0", aPosGrp); - - QGroupBox* aSizeGrp = new QGroupBox(2, Qt::Horizontal, "Size", myActorsPane); + new QLabel ("X:", aPosGrp); + myXPosLbl = new QLabel ("0", aPosGrp); + new QLabel ("Y:", aPosGrp); + myYPosLbl = new QLabel ("0", aPosGrp); + new QLabel ("Z:", aPosGrp); + myZPosLbl = new QLabel ("0", aPosGrp); + + QGroupBox* aSizeGrp = new QGroupBox (2, Qt::Horizontal, "Size", myActorsPane); aSizeGrp->layout()->setSpacing(6); - QLabel* aXSizeLbl = new QLabel("dX:", aSizeGrp); - myDXLbl = new QLabel("0", aSizeGrp); - QLabel* aYSizeLbl = new QLabel("dY:", aSizeGrp); - myDYLbl = new QLabel("0", aSizeGrp); - QLabel* aZSizeLbl = new QLabel("dZ:",aSizeGrp ); - myDZLbl = new QLabel("0", aSizeGrp); + new QLabel ("dX:", aSizeGrp); + myDXLbl = new QLabel ("0", aSizeGrp); + new QLabel ("dY:", aSizeGrp); + myDYLbl = new QLabel ("0", aSizeGrp); + new QLabel ("dZ:",aSizeGrp ); + myDZLbl = new QLabel ("0", aSizeGrp); myWidgetStack->addWidget(myActorsPane, 2); @@ -240,11 +240,11 @@ VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (QWidget* parent) TopLayout->addWidget(myWidgetStack, 2, 0); // Create buttons group - QHBox* aBtnBox = new QHBox(this); + QHBox* aBtnBox = new QHBox (this); QHBoxLayout* aBtnLayout = (QHBoxLayout*)aBtnBox->layout(); aBtnLayout->addStretch(); - QPushButton* aCloseBtn = new QPushButton(tr("BUT_CLOSE"), aBtnBox); + QPushButton* aCloseBtn = new QPushButton (tr("BUT_CLOSE"), aBtnBox); connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(close())); TopLayout->addWidget(aBtnBox, 3, 0); @@ -258,8 +258,8 @@ VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (QWidget* parent) myFl = false; - SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow(); // Activate Points pane + SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow(); myWidgetStack->raiseWidget(myPointsPane); if (aSVTKVW) aSVTKVW->SetSelectionMode(NodeSelection); @@ -444,7 +444,6 @@ void VisuGUI_SelectionDlg::onSelectionEvent() { float* aCoord; vtkIdList *aPointList = aCell->GetPointIds(); - QListViewItem* anItem = NULL; for (int i = 0; i < aNbOfPoints; i++) { int idCurrent = aPointList->GetId(i); diff --git a/src/VISUGUI/VisuGUI_Selection.h b/src/VISUGUI/VisuGUI_Selection.h index 86c8ddb5..c1976404 100644 --- a/src/VISUGUI/VisuGUI_Selection.h +++ b/src/VISUGUI/VisuGUI_Selection.h @@ -29,12 +29,6 @@ #ifndef VisuGUI_Selection_HeaderFile #define VisuGUI_Selection_HeaderFile -#include "SALOMEconfig.h" -#include "VISU_Actor.h" -#include "SVTK_Selection.h" - -#include - #include class QLabel; diff --git a/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx b/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx index 80ea7956..904f438d 100644 --- a/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx +++ b/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx @@ -31,7 +31,6 @@ #include "SALOME_ListIO.hxx" #include -#include #include #include diff --git a/src/VISUGUI/VisuGUI_StreamLinesDlg.h b/src/VISUGUI/VisuGUI_StreamLinesDlg.h index 59fae6ca..0e949ebd 100644 --- a/src/VISUGUI/VisuGUI_StreamLinesDlg.h +++ b/src/VISUGUI/VisuGUI_StreamLinesDlg.h @@ -18,12 +18,8 @@ #include #include -#include "SALOMEconfig.h" -#include CORBA_CLIENT_HEADER(VISU_Gen) - class SalomeApp_Module; class QtxDblSpinBox; -class SALOMEDSClient_SObject; namespace VISU{ class StreamLines_i; diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index 23b90dc2..671c811d 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -89,18 +89,6 @@ namespace VISU return theStudy->studyDS(); } - SALOMEDS::StudyManager_var - GetStudyManager() - { - static SALOMEDS::StudyManager_var aStudyManager; - if(CORBA::is_nil(aStudyManager)){ - SALOME_NamingService *aNamingService = SalomeApp_Application::namingService(); - CORBA::Object_var anObject = aNamingService->Resolve("/myStudyManager"); - aStudyManager = SALOMEDS::StudyManager::_narrow(anObject); - } - return aStudyManager; - } - bool IsStudyLocked( _PTR(Study) theStudy ) { @@ -149,32 +137,6 @@ namespace VISU return aGen; } - VISU::Storable::TRestoringMap - getMapOfValue(SALOMEDS::SObject_var theSObject) - { - VISU::Storable::TRestoringMap aMap; - if(!theSObject->_is_nil()){ - SALOMEDS::GenericAttribute_var anAttr; - if (theSObject->FindAttribute(anAttr, "AttributeComment")) { - SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr); - CORBA::String_var aValue = aComment->Value(); - QString aString(aValue.in()); - VISU::Storable::StrToMap(aString,aMap); - } - } - return aMap; - } - - QString - getValue(SALOMEDS::SObject_var theSObject, - QString theKey) - { - QString aStr(""); - VISU::Storable::TRestoringMap aMap = getMapOfValue(theSObject); - if(!aMap.empty()) - aStr = VISU::Storable::FindValue(aMap,theKey.latin1()); - return aStr; - } VISU::Storable::TRestoringMap getMapOfValue (_PTR(SObject) theSObject) { @@ -207,20 +169,20 @@ namespace VISU const QString& theEntry, VISU::Storable::TRestoringMap* theMap) { - if ( !theStudy || theEntry.isEmpty() ) + if (!theStudy || theEntry.isEmpty()) return CORBA::Object::_nil(); - SALOMEDS::Study_var aStudy = GetDSStudy(GetCStudy( theStudy )); - SALOMEDS::SObject_var aSObject = aStudy->FindObjectID( theEntry.latin1() ); - if(!aSObject->_is_nil()){ - SALOMEDS::GenericAttribute_var anAttr; - if(theMap && aSObject->FindAttribute(anAttr,"AttributeComment")){ - SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr); + _PTR(Study) aStudy = GetCStudy(theStudy); + _PTR(SObject) aSObject = aStudy->FindObjectID(theEntry.latin1()); + if (aSObject) { + _PTR(GenericAttribute) anAttr; + if (theMap && aSObject->FindAttribute(anAttr,"AttributeComment")) { + _PTR(AttributeComment) aComment (anAttr); std::string aValue = aComment->Value(); - QString aString(aValue.c_str()); - VISU::Storable::StrToMap(aString,*theMap); + QString aString (aValue.c_str()); + VISU::Storable::StrToMap(aString, *theMap); } - return VISU::SObjectToObject(aSObject); + return VISU::ClientSObjectToObject(aSObject); } return CORBA::Object::_nil(); } @@ -407,17 +369,17 @@ namespace VISU void DeleteSObject (SalomeApp_Module* theModule, - SALOMEDS::Study_ptr theStudy, - SALOMEDS::SObject_ptr theSObject) + _PTR(Study) theStudy, + _PTR(SObject) theSObject) { - SALOMEDS::ChildIterator_var aChildIter = theStudy->NewChildIterator(theSObject); + _PTR(ChildIterator) aChildIter = theStudy->NewChildIterator(theSObject); for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) { - SALOMEDS::SObject_var aChildSObject = aChildIter->Value(); - CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject); + _PTR(SObject) aChildSObject = aChildIter->Value(); + CORBA::Object_var aChildObj = VISU::ClientSObjectToObject(aChildSObject); ErasePrs(theModule, aChildObj); } - CORBA::Object_var anObj = VISU::SObjectToObject(theSObject); + CORBA::Object_var anObj = VISU::ClientSObjectToObject(theSObject); if (!CORBA::is_nil(anObj)) { VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(anObj); if (!CORBA::is_nil(aRemovableObject)) { @@ -436,9 +398,9 @@ namespace VISU VISU::Prs3d_i* thePrs, const Handle(SALOME_InteractiveObject)& theIO) { - if(!thePrs) + if (!thePrs) return; - if(CheckLock(GetCStudy(GetAppStudy(theModule)))) + if (CheckLock(GetCStudy(GetAppStudy(theModule)))) return; SALOMEDS::SObject_var aSObject = thePrs->GetSObject(); CORBA::String_var anEntry = aSObject->GetID(); @@ -513,18 +475,18 @@ namespace VISU bool CheckTimeStamp(const SalomeApp_Module* theModule, - SALOMEDS::SObject_var& theSObject, + _PTR(SObject)& theSObject, Handle(SALOME_InteractiveObject)* theIO) { Handle(SALOME_InteractiveObject) anIO; - CORBA::Object_var anObject = GetSelectedObj(theModule,&anIO); - if(theIO) + CORBA::Object_var anObject = GetSelectedObj(theModule, &anIO); + if (theIO) *theIO = anIO; - if(!anIO.IsNull() && anIO->hasEntry()){ - SALOMEDS::Study_var aStudy = GetDSStudy(GetCStudy(GetAppStudy(theModule))); + if (!anIO.IsNull() && anIO->hasEntry()){ + _PTR(Study) aStudy = GetCStudy(GetAppStudy(theModule)); theSObject = aStudy->FindObjectID(anIO->getEntry()); QString aValue = getValue(theSObject,"myType"); - if(aValue.toInt() == int(VISU::TTIMESTAMP)) + if (aValue.toInt() == int(VISU::TTIMESTAMP)) return true; } SUIT_MessageBox::warn1(GetDesktop(theModule), @@ -534,32 +496,29 @@ namespace VISU return false; } - VISU::Result_i* CheckResult(const SalomeApp_Module* theModule, - SALOMEDS::SObject_var theSource, - VISU::Result_var& theResult) + _PTR(SObject) theSource, + VISU::Result_var& theResult) { - SALOMEDS::SObject_var aSObj; - - aSObj = theSource->GetFather(); - if (CORBA::is_nil(aSObj)) + _PTR(SObject) aSObj = theSource->GetFather(); + if (!aSObj) return NULL; aSObj = aSObj->GetFather(); - if (CORBA::is_nil(aSObj)) + if (!aSObj) return NULL; aSObj = aSObj->GetFather(); - if (CORBA::is_nil(aSObj)) + if (!aSObj) return NULL; - CORBA::Object_var anObject = VISU::SObjectToObject(aSObj); + CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObj); if (CORBA::is_nil(anObject)) { aSObj = aSObj->GetFather(); - if (CORBA::is_nil(aSObj)) + if (!aSObj) return NULL; - anObject = VISU::SObjectToObject(aSObj); + anObject = VISU::ClientSObjectToObject(aSObj); } if (CORBA::is_nil(anObject)) @@ -567,7 +526,7 @@ namespace VISU theResult = VISU::Result::_narrow(anObject); VISU::Result_i* pResult = dynamic_cast(VISU::GetServant(anObject).in()); - if(pResult == NULL) + if (pResult == NULL) SUIT_MessageBox::warn1(GetDesktop(theModule), QObject::tr("WRN_VISU"), QObject::tr("WRN_NO_AVAILABLE_DATA"), @@ -1009,14 +968,13 @@ namespace VISU // Others void CreateMesh (const SalomeApp_Module* theModule, - const Handle(SALOME_InteractiveObject)& theIO) + const Handle(SALOME_InteractiveObject)& theIO) { _PTR(Study) aStudy = GetCStudy(GetAppStudy(theModule)); //if (CheckLock(aStudy)) // return; - SALOMEDS::SObject_var aResultSObj = - GetDSStudy(aStudy)->FindObjectID(theIO->getEntry()); + _PTR(SObject) aResultSObj = aStudy->FindObjectID(theIO->getEntry()); // Get VISU::Result VISU::Result_var aResult; @@ -1102,113 +1060,120 @@ namespace VISU std::vector aList; if (!theIO.IsNull() && theIO->hasEntry()) { _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule)); - SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy); - SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(theIO->getEntry()); + _PTR(SObject) aSObject = aCStudy->FindObjectID(theIO->getEntry()); aList = GetPrs3dList(theModule, aSObject); } return aList; } std::vector GetPrs3dList (const SalomeApp_Module* theModule, - SALOMEDS::SObject_ptr theObject) + _PTR(SObject) theObject) { + std::vector aList; int k = 0; + if (!theObject) + return aList; + _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule)); - SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy); - std::vector aList; int k = 0; - if (!theObject->_is_nil()) { - CORBA::Object_var aCORBAObject = VISU::SObjectToObject(theObject); - if (!CORBA::is_nil(aCORBAObject)) { - VISU::Base_var aVisuObj = VISU::Base::_narrow(aCORBAObject); - if (!CORBA::is_nil(aVisuObj)) { - VISU::VISUType aType = aVisuObj->GetType(); - switch (aType) { - case VISU::TSCALARMAP: - case VISU::TISOSURFACE: - case VISU::TDEFORMEDSHAPE: - case VISU::TCUTPLANES: - case VISU::TCUTLINES: - case VISU::TVECTORS: - case VISU::TSTREAMLINES: - case VISU::TPLOT3D: - { - PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject); - if (aServant.in()) { - VISU::Prs3d_i* aPrsObject = dynamic_cast(aServant.in()); - aList.resize(k+1); aList[k] = aPrsObject; k++; - } - } - break; - case VISU::TFIELD: - { - SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(theObject); - SALOMEDS::SObject_var aTimeStamp; - anIter->Next(); // First is reference on support - for(;anIter->More();anIter->Next()) { - aTimeStamp = anIter->Value(); - if (aTimeStamp->_is_nil()) continue; + CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(theObject); + if (!CORBA::is_nil(aCORBAObject)) { + VISU::Base_var aVisuObj = VISU::Base::_narrow(aCORBAObject); + if (!CORBA::is_nil(aVisuObj)) { + VISU::VISUType aType = aVisuObj->GetType(); + switch (aType) { + case VISU::TSCALARMAP: + case VISU::TISOSURFACE: + case VISU::TDEFORMEDSHAPE: + case VISU::TCUTPLANES: + case VISU::TCUTLINES: + case VISU::TVECTORS: + case VISU::TSTREAMLINES: + case VISU::TPLOT3D: + { + PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject); + if (aServant.in()) { + VISU::Prs3d_i* aPrsObject = dynamic_cast(aServant.in()); + aList.resize(k+1); + aList[k] = aPrsObject; + k++; + } + } + break; + case VISU::TFIELD: + { + _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(theObject); + _PTR(SObject) aTimeStamp; + anIter->Next(); // First is reference on support + for (; anIter->More(); anIter->Next()) { + aTimeStamp = anIter->Value(); + if (!aTimeStamp) continue; + std::vector aSubList = GetPrs3dList(theModule, aTimeStamp); + if (!aSubList.empty()) { + int n = aSubList.size(); + aList.resize(k+n); + for (int i = 0; i < n; i++) { + aList[k] = aSubList[i]; + k++; + } + } + } + } + break; + } + } + } else { + _PTR(GenericAttribute) anAttr; + if (theObject->FindAttribute(anAttr, "AttributeComment")) { + _PTR(AttributeComment) aComment (anAttr); + string aComm = aComment->Value(); + QString strIn (aComm.c_str()); + VISU::Storable::TRestoringMap pMap; + VISU::Storable::StrToMap(strIn, pMap); + bool isExist; + VISU::VISUType aType = + (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt(); + if (isExist) { + switch (aType) { + case VISU::TFIELD: + { + _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(theObject); + _PTR(SObject) aTimeStamp; + anIter->Next(); // First is reference on support + for (; anIter->More(); anIter->Next()) { + aTimeStamp = anIter->Value(); + if (!aTimeStamp) continue; std::vector aSubList = GetPrs3dList(theModule, aTimeStamp); if (!aSubList.empty()) { - int n = aSubList.size(); + int n = aSubList.size(); aList.resize(k+n); - for (int i = 0; i < n; i++) - { aList[k] = aSubList[i]; k++; } - } - } - } - break; - } - } - } else { - SALOMEDS::GenericAttribute_var anAttr; - if (theObject->FindAttribute(anAttr, "AttributeComment")) { - SALOMEDS::AttributeComment_var aComment = - SALOMEDS::AttributeComment::_narrow(anAttr); - string aComm = aComment->Value(); - QString strIn( aComm.c_str() ); - VISU::Storable::TRestoringMap pMap; - VISU::Storable::StrToMap( strIn, pMap ); - bool isExist; - VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt(); - if (isExist) { - switch (aType) { - case VISU::TFIELD: - { - SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(theObject); - SALOMEDS::SObject_var aTimeStamp; - anIter->Next(); // First is reference on support - for (;anIter->More();anIter->Next()) { - aTimeStamp = anIter->Value(); - if (aTimeStamp->_is_nil()) continue; - std::vector aSubList = GetPrs3dList(theModule, aTimeStamp); - if (!aSubList.empty()) { - int n = aSubList.size(); - aList.resize(k+n); - for (int i = 0; i < n; i++) - { aList[k] = aSubList[i]; k++; } - } - } - } - break; - case VISU::TTIMESTAMP: - { - SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(theObject); - SALOMEDS::SObject_var aPrs; - for (;anIter->More();anIter->Next()) { - aPrs = anIter->Value(); - if (aPrs->_is_nil()) continue; - std::vector aSubList = GetPrs3dList(theModule, aPrs); - if (!aSubList.empty()) { - int n = aSubList.size(); - aList.resize(k+n); - for (int i = 0; i < n; i++) - { aList[k] = aSubList[i]; k++; } - } - } - } - break; - } - } + for (int i = 0; i < n; i++) { + aList[k] = aSubList[i]; + k++; + } + } + } + } + break; + case VISU::TTIMESTAMP: + { + _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(theObject); + _PTR(SObject) aPrs; + for (; anIter->More(); anIter->Next()) { + aPrs = anIter->Value(); + if (!aPrs) continue; + std::vector aSubList = GetPrs3dList(theModule, aPrs); + if (!aSubList.empty()) { + int n = aSubList.size(); + aList.resize(k+n); + for (int i = 0; i < n; i++) { + aList[k] = aSubList[i]; + k++; + } + } + } + } + break; + } } } } diff --git a/src/VISUGUI/VisuGUI_Tools.h b/src/VISUGUI/VisuGUI_Tools.h index 996776bb..0c2469bf 100644 --- a/src/VISUGUI/VisuGUI_Tools.h +++ b/src/VISUGUI/VisuGUI_Tools.h @@ -35,8 +35,6 @@ #include "SALOMEDSClient_Study.hxx" #include "SALOMEconfig.h" -#include CORBA_SERVER_HEADER(SALOMEDS) -#include CORBA_SERVER_HEADER(VISU_Gen) #include CORBA_SERVER_HEADER(MED_Gen) class SUIT_Desktop; @@ -61,7 +59,6 @@ namespace VISU { SUIT_Desktop* GetDesktop(const CAM_Module* theModule); SalomeApp_Study* GetAppStudy(const CAM_Module* theModule); _PTR(Study) GetCStudy(const SalomeApp_Study* theStudy); - SALOMEDS::StudyManager_var GetStudyManager(); bool IsStudyLocked( _PTR(Study) theStudy ); bool CheckLock( _PTR(Study) theStudy ); @@ -69,9 +66,7 @@ namespace VISU { VISU_Gen_i* GetVisuGen(const CAM_Module* theModule); SALOME_MED::MED_Gen_var GetMEDEngine(); - VISU::Storable::TRestoringMap getMapOfValue(SALOMEDS::SObject_var theSObject); VISU::Storable::TRestoringMap getMapOfValue(_PTR(SObject) theSObject); - QString getValue(SALOMEDS::SObject_var theSObject, QString theKey); QString getValue(_PTR(SObject) theSObject, QString theKey); // Selection @@ -95,8 +90,8 @@ namespace VISU { CORBA::Object_ptr theObject, bool theUpdate = true); void DeleteSObject(SalomeApp_Module* theModule, - SALOMEDS::Study_ptr theStudy, - SALOMEDS::SObject_ptr theSObject); + _PTR(Study) theStudy, + _PTR(SObject) theSObject); void DeletePrs3d(SalomeApp_Module* theModule, VISU::Prs3d_i* thePrs, const Handle(SALOME_InteractiveObject)& theIO); @@ -109,10 +104,10 @@ namespace VISU { // SObject type bool CheckTimeStamp(const SalomeApp_Module* theModule, - SALOMEDS::SObject_var& theSObject, + _PTR(SObject)& theSObject, Handle(SALOME_InteractiveObject)* theIO = NULL); VISU::Result_i* CheckResult(const SalomeApp_Module* theModule, - SALOMEDS::SObject_var theSource, + _PTR(SObject) theSource, VISU::Result_var& theResult); inline bool IsSObjectTable(_PTR(SObject) theSObject); @@ -169,7 +164,7 @@ namespace VISU { std::vector GetPrs3dList (const SalomeApp_Module* theModule, const Handle(SALOME_InteractiveObject)& theIO); std::vector GetPrs3dList (const SalomeApp_Module* theModule, - SALOMEDS::SObject_ptr theObject); + _PTR(SObject) theObject); } bool VISU::IsSObjectTable( _PTR(SObject) theSObject ) diff --git a/src/VISU_I/VISUConfig.cc b/src/VISU_I/VISUConfig.cc index 3d2174ba..30cb7c4f 100644 --- a/src/VISU_I/VISUConfig.cc +++ b/src/VISU_I/VISUConfig.cc @@ -49,7 +49,7 @@ namespace VISU{ { return SUIT_Session::session(); } - + SUIT_ResourceMgr* GetResourceMgr() { @@ -69,7 +69,7 @@ namespace VISU{ Base_i::~Base_i() {} - char* Base_i::GetID(){ + char* Base_i::GetID(){ if(myID == ""){ CORBA::Object_var anObject = _this(); CORBA::String_var anIOR = myOrb->object_to_string(anObject); @@ -84,7 +84,7 @@ namespace VISU{ Mutex::Mutex(QMutex* theMutex): myMutex(&aMutex){ if(MYDEBUG) MESSAGE("Mutex::Mutex : "<lock(); } @@ -103,7 +103,7 @@ namespace VISU{ ToStream(strOut); strOut<> dupliacte registring !!!"); } } - + void Storable::StrToMap(const QString& theStr, VISU::Storable::TRestoringMap& theMap){ if(0 && MYDEBUG) MESSAGE("Storable::StrToMap : string="<second; } - + //=========================================================================== PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject){ @@ -202,7 +202,7 @@ namespace VISU{ PortableServer::Servant aServant = aPOA->reference_to_servant(theObject); return aServant; } catch (...) { - INFOS("GetServant - Unknown exception was occured!!!"); + INFOS("GetServant - Unknown exception was occured!!!"); return NULL; } } @@ -249,7 +249,7 @@ namespace VISU{ string FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, const char* theStartEntry, const char* theComment, int IsAllLevels) { - SALOMEDS::ChildIterator_var anIter = + SALOMEDS::ChildIterator_var anIter = theStudyDocument->NewChildIterator(theStudyDocument->FindObjectID(theStartEntry)); anIter->InitEx(IsAllLevels); SALOMEDS::SObject_var aFieldSO; @@ -270,9 +270,9 @@ namespace VISU{ return ""; } //=========================================================================== - string CreateAttributes(SALOMEDS::Study_ptr theStudyDocument, + string CreateAttributes(SALOMEDS::Study_ptr theStudyDocument, const char* theFatherEntry, const char* theRefFatherEntry, - const char* theIOR, const char* theName, + const char* theIOR, const char* theName, const char* thePersistentRef, const char* theComment, CORBA::Boolean theCreateNew) { @@ -285,17 +285,17 @@ namespace VISU{ if(strcmp(theIOR,"") != 0){ anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - anIOR->SetValue(theIOR); + anIOR->SetValue(theIOR); } if(strcmp(theName,"") != 0){ anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); - aName->SetValue(theName); + aName->SetValue(theName); } if(strcmp(thePersistentRef,"") != 0){ anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePersistentRef"); SALOMEDS::AttributePersistentRef_var aPRef = SALOMEDS::AttributePersistentRef::_narrow(anAttr); - aPRef->SetValue(thePersistentRef); + aPRef->SetValue(thePersistentRef); } if(strcmp(theComment,"") != 0){ anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeComment"); @@ -310,13 +310,13 @@ namespace VISU{ } CORBA::String_var anEntry = newObj->GetID(); string aRet(anEntry); - if(MYDEBUG) + if(MYDEBUG) INFOS("CreateAttributes - StudyId = "<StudyId()<<"; anEntry = "<FindOrCreateAttribute(newObj, "AttributeIOR"); _PTR(AttributeIOR) anIOR (anAttr); - anIOR->SetValue(theIOR); + anIOR->SetValue(theIOR); } if (strcmp(theName, "") != 0) { anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); _PTR(AttributeName) aName (anAttr); - aName->SetValue(theName); + aName->SetValue(theName); } if (strcmp(thePersistentRef, "") != 0) { anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePersistentRef"); _PTR(AttributePersistentRef) aPRef (anAttr); - aPRef->SetValue(thePersistentRef); + aPRef->SetValue(thePersistentRef); } if (strcmp(theComment, "") != 0) { anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeComment"); @@ -356,7 +356,7 @@ namespace VISU{ aStudyBuilder->Addreference(anObj, newObj); } string aRet = newObj->GetID(); - if (MYDEBUG) + if (MYDEBUG) INFOS("CreateAttributes - StudyId = " << theStudyDocument->StudyId() << "; anEntry = " << aRet << "; IOR = '" << theIOR << "'"); return aRet; @@ -406,4 +406,79 @@ namespace VISU{ return study->FindObjectID( obj->GetID() ); } + + + void RemoveFromStudy (SALOMEDS::SObject_ptr theSObject, + bool theIsAttrOnly, + bool theDestroySubObjects) + { + if (theSObject->_is_nil()) return; + + SALOMEDS::Study_var aStudyDocument = theSObject->GetStudy(); + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudyDocument->NewBuilder(); + if (theIsAttrOnly) { + aStudyBuilder->RemoveAttribute(theSObject,"AttributeIOR"); + return; + } + + // Remove possible sub-objects + SALOMEDS::ChildIterator_var aChildIter = aStudyDocument->NewChildIterator(theSObject); + for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) { + SALOMEDS::SObject_var aChildSObject = aChildIter->Value(); + CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject); + if (CORBA::is_nil(aChildObj)) continue; + + VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(aChildObj); + if (CORBA::is_nil(aRemovableObject)) continue; + + aRemovableObject->RemoveFromStudy(); + + // Destroy + if (theDestroySubObjects) { + VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aRemovableObject); + if (CORBA::is_nil(aPrs3d)) continue; + aPrs3d->Destroy(); + } + } + + // Remove the SObject itself + aStudyBuilder->RemoveObjectWithChildren(theSObject); + } + + void RemoveFromStudy (_PTR(SObject) theSObject, + bool theIsAttrOnly, + bool theDestroySubObjects) + { + if (!theSObject) return; + + _PTR(Study) aStudyDocument = theSObject->GetStudy(); + _PTR(StudyBuilder) aStudyBuilder = aStudyDocument->NewBuilder(); + if (theIsAttrOnly) { + aStudyBuilder->RemoveAttribute(theSObject,"AttributeIOR"); + return; + } + + // Remove possible sub-objects + _PTR(ChildIterator) aChildIter = aStudyDocument->NewChildIterator(theSObject); + for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) { + _PTR(SObject) aChildSObject = aChildIter->Value(); + CORBA::Object_var aChildObj = VISU::ClientSObjectToObject(aChildSObject); + if (CORBA::is_nil(aChildObj)) continue; + + VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(aChildObj); + if (CORBA::is_nil(aRemovableObject)) continue; + + aRemovableObject->RemoveFromStudy(); + + // Destroy + if (theDestroySubObjects) { + VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aRemovableObject); + if (CORBA::is_nil(aPrs3d)) continue; + aPrs3d->Destroy(); + } + } + + // Remove the SObject itself + aStudyBuilder->RemoveObjectWithChildren(theSObject); + } } diff --git a/src/VISU_I/VISUConfig.hh b/src/VISU_I/VISUConfig.hh index b5ef6b06..3224f05a 100644 --- a/src/VISU_I/VISUConfig.hh +++ b/src/VISU_I/VISUConfig.hh @@ -27,24 +27,13 @@ #ifndef __VISU_CONFIG_H__ #define __VISU_CONFIG_H__ -// standard C++ headers -#include -#include - -#include -#include - -#include -#include -#include -#include - // IDL headers #include "SALOMEconfig.h" #include CORBA_SERVER_HEADER(VISU_Gen) #include CORBA_SERVER_HEADER(MED) #include CORBA_SERVER_HEADER(SALOMEDS) #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + #include "SALOME_NamingService.hxx" #include "SALOME_LifeCycleCORBA.hxx" #include "Utils_CorbaException.hxx" @@ -53,8 +42,21 @@ #include #include -#include +// QT headers +#include +#include +#include +#include + +// standard C++ headers +#include + +// STL headers +#include +#include #include +#include +#include class SUIT_Session; class SUIT_ResourceMgr; @@ -163,9 +165,17 @@ namespace VISU{ std::string FindEntryWithComment(SALOMEDS::Study_ptr theStudyDocument, const char* theStartEntry, const char* theComment, int IsAllLevels = true); - SALOMEDS::SObject_var GetSObject( _PTR(SObject) ); - _PTR(SObject) GetClientSObject( SALOMEDS::SObject_var, _PTR(Study) ); - SALOMEDS::Study_var GetDSStudy( _PTR(Study) ); + SALOMEDS::SObject_var GetSObject(_PTR(SObject)); + _PTR(SObject) GetClientSObject(SALOMEDS::SObject_var, _PTR(Study)); + + SALOMEDS::Study_var GetDSStudy(_PTR(Study)); + + void RemoveFromStudy(SALOMEDS::SObject_ptr theSObject, + bool theIsAttrOnly = true, + bool theDestroySubObjects = false); + void RemoveFromStudy(_PTR(SObject) theSObject, + bool theIsAttrOnly = true, + bool theDestroySubObjects = false); } #endif diff --git a/src/VISU_I/VISU_Result_i.cc b/src/VISU_I/VISU_Result_i.cc index 9571fcde..29fbda35 100644 --- a/src/VISU_I/VISU_Result_i.cc +++ b/src/VISU_I/VISU_Result_i.cc @@ -87,43 +87,6 @@ VISU::Result_var VISU::FindResult(SALOMEDS::SObject_ptr theSObject){ return aResult; } -void VISU::RemoveFromStudy (SALOMEDS::SObject_ptr theSObject, - bool theIsAttrOnly, - bool theDestroySubObjects) -{ - if (theSObject->_is_nil()) return; - - SALOMEDS::Study_var aStudyDocument = theSObject->GetStudy(); - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudyDocument->NewBuilder(); - if (theIsAttrOnly) { - aStudyBuilder->RemoveAttribute(theSObject,"AttributeIOR"); - return; - } - - // Remove possible sub-objects - SALOMEDS::ChildIterator_var aChildIter = aStudyDocument->NewChildIterator(theSObject); - for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) { - SALOMEDS::SObject_var aChildSObject = aChildIter->Value(); - CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject); - if (CORBA::is_nil(aChildObj)) continue; - - VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(aChildObj); - if (CORBA::is_nil(aRemovableObject)) continue; - - aRemovableObject->RemoveFromStudy(); - - // Destroy - if (theDestroySubObjects) { - VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aRemovableObject); - if (CORBA::is_nil(aPrs3d)) continue; - aPrs3d->Destroy(); - } - } - - // Remove the SObject itself - aStudyBuilder->RemoveObjectWithChildren(theSObject); -} - QString GenerateName(const char* theName){ typedef map TNameMap; static TNameMap aMap; diff --git a/src/VISU_I/VISU_Result_i.hh b/src/VISU_I/VISU_Result_i.hh index 68625ca1..beb1e558 100644 --- a/src/VISU_I/VISU_Result_i.hh +++ b/src/VISU_I/VISU_Result_i.hh @@ -127,9 +127,6 @@ namespace VISU{ }; Result_var FindResult(SALOMEDS::SObject_ptr theSObject); - void RemoveFromStudy(SALOMEDS::SObject_ptr theSObject, - bool theIsAttrOnly = true, - bool theDestroySubObjects = false); } #endif -- 2.39.2