From: apo Date: Tue, 27 Dec 2005 14:17:21 +0000 (+0000) Subject: Adjust to HEAD modifications X-Git-Tag: TG-D5-38-2003_D2005-29-12~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a767d19d78ea6e57705ac50f870e3fb3dd0410c1;p=modules%2Fvisu.git Adjust to HEAD modifications --- diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 1da83dac..19f17b0b 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -167,7 +167,7 @@ VisuGUI:: OnImportFromFile() { if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()"); - if ( CheckLock(GetCStudy(GetAppStudy(this))) ) + if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) ) return; VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) ); @@ -182,7 +182,7 @@ OnExploreMEDFile() { if(MYDEBUG) MESSAGE("VisuGUI::OnExploreMEDFile()"); _PTR(Study) aStudy = GetCStudy(GetAppStudy(this)); - if ( CheckLock(aStudy) ) + if ( CheckLock(aStudy,GetDesktop(this)) ) return; SALOME_MED::MED_Gen_var aGen = GetMEDEngine(); @@ -223,7 +223,7 @@ VisuGUI:: OnImportTableFromFile() { if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()"); - if ( CheckLock(GetCStudy(GetAppStudy(this))) ) + if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) ) return; QStringList aFilter; @@ -361,7 +361,7 @@ VisuGUI:: OnImportMedField() { _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); - if (CheckLock(aCStudy)) + if (CheckLock(aCStudy,GetDesktop(this))) return; SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy); @@ -459,7 +459,7 @@ VisuGUI:: OnCreateMesh() { _PTR(Study) aStudy = GetCStudy(GetAppStudy(this)); - if (CheckLock(aStudy)) + if (CheckLock(aStudy,GetDesktop(this))) return; // Get selected SObject @@ -479,7 +479,7 @@ VisuGUI:: OnCreateManyMesh() { _PTR(Study) aStudy = GetCStudy(GetAppStudy(this)); - if (CheckLock(aStudy)) + if (CheckLock(aStudy,GetDesktop(this))) return; // create a VTK view window if it does not exist @@ -560,7 +560,7 @@ void VisuGUI:: OnCreatePlot2dView() { - CheckLock(GetCStudy(GetAppStudy(this))); + CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)); GetVisuGen( this )->CreateContainer(); UpdateObjBrowser(this); } @@ -572,9 +572,11 @@ OnDisplayPrs() if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs"); QApplication::setOverrideCursor(Qt::waitCursor); - SALOME_ListIO aList; + SALOME_ListIO aSel, aList; LightApp_SelectionMgr* mgr = GetSelectionMgr(this); - mgr->selectedObjects(aList); + mgr->selectedObjects( aSel ); + + extractContainers( aSel, aList ); Handle(SALOME_InteractiveObject) anIO; for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) { @@ -648,14 +650,18 @@ OnErasePrs() if (vw) vw->unHighlightAll(); - SALOME_ListIO aList; + SALOME_ListIO aList, aSel; LightApp_SelectionMgr* mgr = GetSelectionMgr(this); - mgr->selectedObjects(aList); + mgr->selectedObjects( aSel ); + + extractContainers( aSel, aList ); Handle(SALOME_InteractiveObject) anIO; for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) { anIO = it.Value(); CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() ); + if (!CORBA::is_nil(anObject)) + RemoveScalarBarPosition(this,anObject); ErasePrs( this, anObject, false ); } @@ -791,6 +797,7 @@ OnEraseAll() for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) { if (anActor->GetVisibility() > 0) if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) { + RemoveScalarBarPosition(this,anVISUActor->GetPrs3d()); anVISUActor->VisibilityOff(); } } @@ -1082,7 +1089,7 @@ VisuGUI:: OnDeleteObjects() { _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); - if (CheckLock(aCStudy)) + if (CheckLock(aCStudy,GetDesktop(this))) return; SALOME_ListIO aList; @@ -1320,7 +1327,7 @@ VisuGUI:: OnClearContainer() { _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); - if (CheckLock(aCStudy)) + if (CheckLock(aCStudy,GetDesktop(this))) return; Handle(SALOME_InteractiveObject) anIO; CORBA::Object_var anObject = GetSelectedObj(this, &anIO); @@ -1368,7 +1375,7 @@ VisuGUI:: OnSaveViewParams() { _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); - if (CheckLock(aCStudy)) + if (CheckLock(aCStudy,GetDesktop(this))) return; SUIT_ViewManager* aViewMgr = getApp()->activeViewManager(); @@ -1416,7 +1423,7 @@ VisuGUI:: OnRename() { _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); - if (CheckLock(aCStudy)) + if (CheckLock(aCStudy,GetDesktop(this))) return; Handle(SALOME_InteractiveObject) anIO; @@ -1646,7 +1653,7 @@ VisuGUI:: OnCopyPresentation() { _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); - if (CheckLock(aCStudy)) + if (CheckLock(aCStudy,GetDesktop(this))) return; Handle(SALOME_InteractiveObject) anIO; @@ -2407,16 +2414,17 @@ createPopupMenus() QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")"; QString aPrsVisible = "(($type in {'VISU::TMESH' " + aPrsAll + "}) and isVisible)"; QString aPrsInvisible = "(($type in {'VISU::TMESH' " + aPrsAll + "})" + andInvisible + ")"; + QString aComponent = "( selcount=1 and canBeDisplayed )"; - QString anEraseRule = "selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsVisible + - " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveVisible + ")))"; + QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsVisible + + " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveVisible + "))) ) or " + aComponent; - QString aDisplayRule = "selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsInvisible + - " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveInvisible + ")))"; + QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsInvisible + + " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveInvisible + "))) ) or" + aComponent; - QString aDOnlyRule = "selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' " + aPrsAll + "})" + QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' " + aPrsAll + "})" " or (client='ObjectBrowser' and ((type='VISU::TTABLE' and nbChildren>0) or" - " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'}))))"; + " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'})))) ) or" + aComponent; mgr->setRule( action( VISU_ERASE ), anEraseRule, true ); mgr->setRule( action( VISU_DISPLAY ), aDisplayRule, true ); @@ -2871,6 +2879,9 @@ void VisuGUI::createPreferences() setPreferenceProperty( wh, "max", 1.0 ); setPreferenceProperty( hh, "max", 1.0 ); + int scalarBarGr = addPreference( tr( "Scalar bars default position" ), sbarTab ); + addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" ); + int srangeTab = addPreference( tr( "Sweep, MED import" ) ); int sweepGr = addPreference( tr( "VISU_SWEEPING_PREF" ), srangeTab ); @@ -2907,6 +2918,12 @@ VisuGUI return getApp()->getViewManager(theType,theIsCreate); } +TViewToPrs3d +VisuGUI +::getScalarBarsMap() +{ + return myScalarBarsMap; +} LightApp_Displayer* VisuGUI::displayer() { if( !myDisplayer ) diff --git a/src/VISUGUI/VisuGUI.h b/src/VISUGUI/VisuGUI.h index 30c24e82..411b0bfc 100644 --- a/src/VISUGUI/VisuGUI.h +++ b/src/VISUGUI/VisuGUI.h @@ -31,7 +31,18 @@ #include "SalomeApp_Module.h" +#include +#include + class SUIT_ViewManager; +class SVTK_ViewWindow; +class Prs3d_i; + +namespace VISU{ +typedef std::pair TPrs3dToInd; // prs pointer and default index of scalar bar placement +typedef std::set TSetPrs3d; +typedef std::map TViewToPrs3d; +} class VisuGUI: public SalomeApp_Module { @@ -61,6 +72,9 @@ public: getViewManager(const QString& theType, const bool theIsCreate); + VISU::TViewToPrs3d getScalarBarsMap(); + VISU::TViewToPrs3d myScalarBarsMap; + public slots: virtual bool deactivateModule( SUIT_Study* ); virtual bool activateModule( SUIT_Study* ); diff --git a/src/VISUGUI/VisuGUI_Displayer.cxx b/src/VISUGUI/VisuGUI_Displayer.cxx index 4ea8f642..380ee7f4 100644 --- a/src/VISUGUI/VisuGUI_Displayer.cxx +++ b/src/VISUGUI/VisuGUI_Displayer.cxx @@ -223,6 +223,9 @@ bool VisuGUI_Displayer::canBeDisplayed( const QString& entry, const QString& vie if( CORBA::is_nil( anObj ) ) return false; + if( study->isComponent( entry ) ) + return true; + if( viewer_type==SVTK_Viewer::Type() || viewer_type==VVTK_Viewer::Type()) { VISU::Prs3d_i* thePrs = dynamic_cast( VISU::GetServant( anObj ).in() ); diff --git a/src/VISUGUI/VisuGUI_OffsetDlg.cxx b/src/VISUGUI/VisuGUI_OffsetDlg.cxx index 7465cee5..3fca41a1 100644 --- a/src/VISUGUI/VisuGUI_OffsetDlg.cxx +++ b/src/VISUGUI/VisuGUI_OffsetDlg.cxx @@ -1,3 +1,22 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// #include "VisuGUI_OffsetDlg.h" diff --git a/src/VISUGUI/VisuGUI_Plot3DDlg.cxx b/src/VISUGUI/VisuGUI_Plot3DDlg.cxx index 056a1a93..a7935632 100644 --- a/src/VISUGUI/VisuGUI_Plot3DDlg.cxx +++ b/src/VISUGUI/VisuGUI_Plot3DDlg.cxx @@ -552,7 +552,10 @@ VisuGUI_Plot3DDlg::VisuGUI_Plot3DDlg (SalomeApp_Module* theModule) void VisuGUI_Plot3DDlg::accept() { if (myIsoPane->check() && myScalarPane->check()) - QDialog::accept(); + { + myScalarPane->deletePreview(); + QDialog::accept(); + } } //======================================================================= @@ -562,6 +565,7 @@ void VisuGUI_Plot3DDlg::accept() void VisuGUI_Plot3DDlg::reject() { myIsoPane->check(); // hide preview - + myScalarPane->deletePreview(); + QDialog::reject(); } diff --git a/src/VISUGUI/VisuGUI_Prs3dTools.h b/src/VISUGUI/VisuGUI_Prs3dTools.h index 9af013e1..a832fbb5 100644 --- a/src/VISUGUI/VisuGUI_Prs3dTools.h +++ b/src/VISUGUI/VisuGUI_Prs3dTools.h @@ -138,6 +138,10 @@ namespace VISU QString anEntity = Storable::FindValue(aMap,"myEntityId",&isExist).latin1(); QString aFieldName = Storable::FindValue(aMap,"myFieldName",&isExist).latin1(); QString aTimeStampId = Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1(); + // + int aPos = GetFreePositionOfDefaultScalarBar(theModule); + GetResourceMgr()->setValue("VISU","scalar_bar_position_num",aPos); + // QApplication::setOverrideCursor(Qt::waitCursor); TPrs3d_i* aPrs3d = @@ -175,6 +179,8 @@ namespace VISU } PublishInView(theModule,aPrs3d,true,theIsCreateView); + AddScalarBarPosition(theModule,aPrs3d,aPos); + return true; } @@ -189,7 +195,7 @@ namespace VISU CreatePrs3d(VisuGUI* theModule, const bool theIsCreateView = true) { - if (CheckLock(GetCStudy(GetAppStudy(theModule)))) + if (CheckLock(GetCStudy(GetAppStudy(theModule)),GetDesktop(theModule))) return; _PTR(SObject) aTimeStampSObj; diff --git a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx index 48749127..9e811e47 100644 --- a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx @@ -35,6 +35,8 @@ #include "SVTK_ViewWindow.h" +#include "SVTK_ViewWindow.h" + #include "VISUConfig.hh" #include "VISU_Convertor.hxx" @@ -263,7 +265,6 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane (QWidget * parent, bool SetPref): myBusy = false; } - /** * Initializes dialog box values from resources */ @@ -276,6 +277,12 @@ void VisuGUI_ScalarBarPane::initFromResources() { SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + bool anIsArrangeBar = aResourceMgr->booleanValue("VISU", "scalar_bars_default_position", 0); + int aPlace = 1; + if (anIsArrangeBar){ + aPlace = aResourceMgr->integerValue("VISU", "scalar_bar_position_num",0); + } + int aScalarMode = aResourceMgr->integerValue("VISU", "scalar_bar_mode", 0); myModeCombo->setCurrentItem(aScalarMode); @@ -296,6 +303,11 @@ void VisuGUI_ScalarBarPane::initFromResources() { sbW = aResourceMgr->doubleValue("VISU", propertyName + "width", sbW); sbH = aResourceMgr->doubleValue("VISU", propertyName + "height",sbH); + if(orient){ + sbY1 += sbH*(aPlace-1); + } else { + sbX1 += sbW*(aPlace-1); + } sbCol = aResourceMgr->integerValue("VISU" ,"scalar_bar_num_colors", sbCol); sbLab = aResourceMgr->integerValue("VISU", "scalar_bar_num_labels", sbLab); diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index 075eadd9..b59e97ca 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -61,6 +61,8 @@ #include "SUIT_Session.h" #include "SUIT_MessageBox.h" +#include "VisuGUI.h" + #include #include @@ -102,10 +104,16 @@ namespace VISU } bool - CheckLock( _PTR(Study) theStudy ) + CheckLock( _PTR(Study) theStudy, + QWidget* theWidget ) { - if(IsStudyLocked(theStudy)) - throw std::runtime_error(QObject::tr("WRN_STUDY_LOCKED").latin1()); + if(IsStudyLocked(theStudy)){ + SUIT_MessageBox::warn1(theWidget, + QObject::tr("WRN_VISU_WARNING"), + QObject::tr("WRN_STUDY_LOCKED"), + QObject::tr("BUT_OK")); + return true; + } return false; } @@ -282,7 +290,7 @@ namespace VISU Handle(SALOME_InteractiveObject)* theIO, VISU::Storable::TRestoringMap* theMap) { - if (CheckLock(GetCStudy(GetAppStudy(theModule)))) + if (CheckLock(GetCStudy(GetAppStudy(theModule)),GetDesktop(theModule))) return NULL; CORBA::Object_var anObject = GetSelectedObj(theModule, theIO); @@ -413,7 +421,6 @@ namespace VISU return true; } - //************************************************************ // Display/Erase void @@ -458,22 +465,22 @@ namespace VISU } void - DeleteSObject (SalomeApp_Module* theModule, - _PTR(Study) theStudy, - _PTR(SObject) theSObject) + DeleteSObject(VisuGUI* theModule, + _PTR(Study) theStudy, + _PTR(SObject) theSObject) { - SalomeApp_Study* study = GetAppStudy( theModule ); - _PTR(ChildIterator) aChildIter = theStudy->NewChildIterator(theSObject); for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) { _PTR(SObject) aChildSObject = aChildIter->Value(); CORBA::Object_var aChildObj = VISU::ClientSObjectToObject(aChildSObject); + RemoveScalarBarPosition(theModule,aChildObj); ErasePrs(theModule, aChildObj); } CORBA::Object_var anObj = VISU::ClientSObjectToObject(theSObject); if (!CORBA::is_nil(anObj)) { + RemoveScalarBarPosition(theModule,anObj); ErasePrs(theModule, anObj); VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(anObj); @@ -490,26 +497,16 @@ namespace VISU } void - DeletePrs3d(SalomeApp_Module* theModule, + DeletePrs3d(VisuGUI* theModule, VISU::Prs3d_i* thePrs, const Handle(SALOME_InteractiveObject)& theIO) { if (!thePrs) return; - if (CheckLock(GetCStudy(GetAppStudy(theModule)))) + if (CheckLock(GetCStudy(GetAppStudy(theModule)),GetDesktop(theModule))) return; - SALOMEDS::SObject_var aSObject = thePrs->GetSObject(); - CORBA::String_var anEntry = aSObject->GetID(); - LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule); - Remove(aSelectionMgr,theIO); - TViewWindows aViewWindows = GetViews(theModule); - for(int i = 0, iEnd = aViewWindows.size(); i < iEnd; i++){ - SVTK_ViewWindow* aView = aViewWindows[i]; - if(VISU_Actor* anActor = FindActor(aView,anEntry.in())){ - aView->RemoveActor(anActor); - anActor->Delete(); - } - } + + RemoveScalarBarPosition(theModule,thePrs); thePrs->RemoveFromStudy(); } @@ -518,14 +515,12 @@ namespace VISU VISU::Prs3d_i* thePrs) { if ( SVTK_ViewWindow* vw = GetViewWindow( theModule ) ){ - VISU_Actor* anVISUActor = FindActor( vw, thePrs ); - if (anVISUActor) { + if (VISU_Actor* anVISUActor = FindActor( vw, thePrs )) { anVISUActor->VisibilityOff(); } } } - //************************************************************ // Presentation management void @@ -599,7 +594,6 @@ namespace VISU } } - //************************************************************ // SObject type bool @@ -660,7 +654,6 @@ namespace VISU return dynamic_cast(VISU::GetServant(anObject).in()); } - //************************************************************ // Views SUIT_ViewWindow* GetActiveView(const SalomeApp_Module* theModule, QString theType) @@ -677,7 +670,6 @@ namespace VISU return 0; } - //************************************************************ // VTK View TViewWindows @@ -711,8 +703,8 @@ namespace VISU return wnd; else { - if(SUIT_ViewManager* aViewManager = anApp->getViewManager( SVTK_Viewer::Type(), theCreate )) - return dynamic_cast( aViewManager->getActiveView() ); + SUIT_ViewManager* aViewManager = anApp->getViewManager( SVTK_Viewer::Type(), theCreate ); + return aViewManager ? dynamic_cast( aViewManager->getActiveView() ) : 0; } } return NULL; @@ -786,20 +778,19 @@ namespace VISU vtkRenderer *aRen = vw->getRenderer(); vtkActorCollection *anActColl = aRen->GetActors(); + anActColl->InitTraversal(); vtkActor *anActor; VISU_Actor* anVISUActor = NULL; VISU_Actor* aResActor = NULL; - for(anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ){ - if(!SALOME_Actor::SafeDownCast(anActor)) - continue; - if(anActor->IsA("VISU_Actor")){ - anVISUActor = VISU_Actor::SafeDownCast(anActor); + while(vtkActor *anActor = anActColl->GetNextActor()){ + anVISUActor = VISU_Actor::SafeDownCast(anActor); + if(anVISUActor){ VISU::Prs3d_i* aPrs = anVISUActor->GetPrs3d(); if(aPrs == NULL) continue; if (thePrs == aPrs) { - aResActor = anVISUActor; try { + aResActor = anVISUActor; thePrs->UpdateActor(aResActor); aResActor->VisibilityOn(); } catch (std::runtime_error& ex) { @@ -1418,4 +1409,58 @@ namespace VISU } return aList; } + + int GetFreePositionOfDefaultScalarBar(VisuGUI* theModule){ + int minIndx = 1; + std::set aIndexes; + SVTK_ViewWindow* vw = GetViewWindow(theModule); + TViewToPrs3d aMap = theModule->getScalarBarsMap(); + TViewToPrs3d::const_iterator aViewToPrsIter = aMap.find(vw); + if (aViewToPrsIter != aMap.end()){ + TSetPrs3d::const_iterator aPrsIter = (aViewToPrsIter->second).begin(); + for(;aPrsIter!=(aViewToPrsIter->second).end();aPrsIter++){ + aIndexes.insert((*aPrsIter).second); + } + } + std::set::const_iterator aIter = aIndexes.begin(); + for (int i=1,length=aIndexes.size(); i <= length; i++){ + std::set::const_iterator aIter = aIndexes.find(i); + if(aIter==aIndexes.end()){minIndx = i;break;} + else minIndx = i + 1; + + } + return minIndx; + } + + void AddScalarBarPosition(VisuGUI* theModule,VISU::Prs3d_i* thePrs3d, int pos){ + SVTK_ViewWindow* vw = GetViewWindow(theModule); + TViewToPrs3d& aMap = theModule->myScalarBarsMap; + TPrs3dToInd aPair; aPair.first=thePrs3d; aPair.second=pos; + aMap[vw].insert(aPair); + } + + void RemoveScalarBarPosition(VisuGUI* theModule,SVTK_ViewWindow* vw,VISU::Prs3d_i* thePrs3d){ + TViewToPrs3d& aMap = theModule->myScalarBarsMap; + TSetPrs3d::iterator aIter = aMap[vw].begin(); + for(;aIter!=aMap[vw].end();aIter++) + if((*aIter).first == thePrs3d){ + aMap[vw].erase(*aIter); + return; + } + } + + void RemoveScalarBarPosition(VisuGUI* theModule,VISU::Prs3d_i* thePrs3d){ + SVTK_ViewWindow* vw = GetViewWindow(theModule); + RemoveScalarBarPosition(theModule,vw,thePrs3d); + } + + void RemoveScalarBarPosition(VisuGUI* theModule,CORBA::Object_ptr theObject){ + if (!CORBA::is_nil(theObject)) { + Base_var aBase = Base::_narrow(theObject); + if (CORBA::is_nil(aBase)) return; + if (VISU::Prs3d_i* aPrsObject = dynamic_cast(VISU::GetServant(aBase).in())){ + RemoveScalarBarPosition(theModule,aPrsObject); + } + } + } } diff --git a/src/VISUGUI/VisuGUI_Tools.h b/src/VISUGUI/VisuGUI_Tools.h index 677ecdef..d514b4b3 100644 --- a/src/VISUGUI/VisuGUI_Tools.h +++ b/src/VISUGUI/VisuGUI_Tools.h @@ -37,6 +37,8 @@ #include "SALOMEconfig.h" #include CORBA_SERVER_HEADER(MED_Gen) +class QWidget; + class SUIT_Desktop; class SUIT_ViewWindow; class VISU_Actor; @@ -48,6 +50,7 @@ class CAM_Module; class LightApp_SelectionMgr; class SalomeApp_Module; class SalomeApp_Study; +class VisuGUI; namespace VISU { class Prs3d_i; @@ -63,7 +66,8 @@ namespace VISU { _PTR(Study) GetCStudy(const SalomeApp_Study* theStudy); bool IsStudyLocked( _PTR(Study) theStudy ); - bool CheckLock( _PTR(Study) theStudy ); + bool CheckLock( _PTR(Study) theStudy, + QWidget* theWidget ); void UpdateObjBrowser(SalomeApp_Module* theModule, bool theIsUpdateDataModel = true, @@ -98,10 +102,10 @@ namespace VISU { void ErasePrs(const SalomeApp_Module* theModule, CORBA::Object_ptr theObject, bool theUpdate = true); - void DeleteSObject(SalomeApp_Module* theModule, + void DeleteSObject(VisuGUI* theModule, _PTR(Study) theStudy, _PTR(SObject) theSObject); - void DeletePrs3d(SalomeApp_Module* theModule, + void DeletePrs3d(VisuGUI* theModule, VISU::Prs3d_i* thePrs, const Handle(SALOME_InteractiveObject)& theIO); void ErasePrs3d(const SalomeApp_Module* theModule, @@ -193,6 +197,12 @@ namespace VISU { const Handle(SALOME_InteractiveObject)& theIO); std::vector GetPrs3dList (const SalomeApp_Module* theModule, _PTR(SObject) theObject); + + int GetFreePositionOfDefaultScalarBar(VisuGUI* theModule); + void AddScalarBarPosition(VisuGUI* theModule,VISU::Prs3d_i* thePrs3d, int pos); + void RemoveScalarBarPosition(VisuGUI* theModule,VISU::Prs3d_i* thePrs3d); + void RemoveScalarBarPosition(VisuGUI* theModule,SVTK_ViewWindow* vw,VISU::Prs3d_i* thePrs3d); + void RemoveScalarBarPosition(VisuGUI* theModule,CORBA::Object_ptr theObject); } #endif diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index 8ae44caf..b38c88b2 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -39,6 +39,7 @@ using namespace std; #ifdef _DEBUG_ static int MYDEBUG = 0; +//#define _DEXCEPT_ #else static int MYDEBUG = 0; #endif @@ -462,6 +463,18 @@ VISU::ColoredPrs3d_i myHeight = (myOrientation == VISU::ScalarMap::VERTICAL)? 0.8:0.12; myHeight = aResourceMgr->doubleValue("VISU", propertyName + "height", myHeight); + // scalar bar default position + bool anIsArrangeBar = aResourceMgr->booleanValue("VISU", "scalar_bars_default_position", 0); + int aPlace = 1; + if (anIsArrangeBar){ + aPlace = aResourceMgr->integerValue("VISU", "scalar_bar_position_num",0); + } + if(myOrientation == VISU::ScalarMap::HORIZONTAL){ + myPosition[1] += myHeight*(aPlace-1); + } else { + myPosition[0] += myWidth*(aPlace-1); + } + // Nb of Labels myNumberOfLabels = aResourceMgr->integerValue( "VISU", "scalar_bar_num_labels", 5 ); @@ -625,7 +638,9 @@ VISU::ColoredPrs3d_i SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); if(myAddToStudy) aStudyBuilder->NewCommand(); // There is a transaction +#ifndef _DEXCEPT_ try{ +#endif DoSetInput(myResult); QString aComment; myName = "NoName"; @@ -651,6 +666,7 @@ VISU::ColoredPrs3d_i CreateAttributes(myStudy,anEntry.c_str(),aRefFatherEntry.c_str(),anIOR,myName.c_str(),"",aComment.latin1(),true); mySObject = myStudy->FindObjectIOR(anIOR); } +#ifndef _DEXCEPT_ }catch(std::exception& exc){ INFOS("Follow exception was occured :\n"<CommitCommand(); return this;