From c838cc34b62b26d290d8fd960e033e6ee5acfe56 Mon Sep 17 00:00:00 2001 From: srn Date: Mon, 20 Mar 2006 14:20:54 +0000 Subject: [PATCH] Implemented an access to IParameters interface through SALOMEDSClient_ClientFactory --- src/VISUGUI/VisuGUI_Module.cxx | 53 +++++++++++++++++----------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/src/VISUGUI/VisuGUI_Module.cxx b/src/VISUGUI/VisuGUI_Module.cxx index 4a441242..743559b5 100644 --- a/src/VISUGUI/VisuGUI_Module.cxx +++ b/src/VISUGUI/VisuGUI_Module.cxx @@ -45,7 +45,8 @@ #include "LightApp_Preferences.h" #include "LightApp_Displayer.h" -#include "SALOMEDS_IParameters.hxx" +#include "SALOMEDSClient_ClientFactory.hxx" +#include "SALOMEDSClient_IParameters.hxx" #include "VVTK_ViewManager.h" #include "VVTK_ViewWindow.h" @@ -1598,7 +1599,7 @@ void VisuGUI_Module::storeVisualParameters(int savePoint) return; _PTR(Study) studyDS = study->studyDS(); _PTR(AttributeParameter) ap = studyDS->GetModuleParameters("Interface Applicative", moduleName().latin1(), savePoint); - SALOMEDS_IParameters ip(ap); + _PTR(IParameters) ip = ClientFactory::getIParameters(ap); // viewers counters are used for storing view_numbers in IParameters int svtkViewers( 0 ), vvtkViewers( 0 ), plotViewers( 0 ); @@ -1612,7 +1613,7 @@ void VisuGUI_Module::storeVisualParameters(int savePoint) // saving VVTK viewer parameters. VVTK (Gauss Viewers) are NOT created by SalomeApp since // VVTK is declared in VISU, so here we store VVTK view window parameters. // VisuGUI_Module::restoreVisualParameters() creates VVTK_Views and restores its parameters. - ip.setProperty( "ActiveGaussViewer", "-1" ); + ip->setProperty( "ActiveGaussViewer", "-1" ); getApp()->viewManagers( VVTK_Viewer::Type(), lst ); for ( QPtrListIterator it( lst ); it.current(); ++it ) { SUIT_ViewManager* vman = it.current(); @@ -1621,10 +1622,10 @@ void VisuGUI_Module::storeVisualParameters(int savePoint) // gauss viewer parameters are retrieved using this "entry" string. // name of parameter = caption of gauss ViewWindow // value of parameter = ViewWindow's visual parameters - ip.setParameter( "GaussViewer", vwin->caption().latin1(), vwin->getVisualParameters().latin1() ); + ip->setParameter( "GaussViewer", vwin->caption().latin1(), vwin->getVisualParameters().latin1() ); if ( application()->desktop()->activeWindow() == vwin ) - ip.setProperty( "ActiveGaussViewer", QString::number( vvtkViewers ).latin1() ); + ip->setProperty( "ActiveGaussViewer", QString::number( vvtkViewers ).latin1() ); vvtkViewers++; } } @@ -1634,7 +1635,7 @@ void VisuGUI_Module::storeVisualParameters(int savePoint) /* lst.clear(); getApp()->viewManagers( SVTK_Viewer::Type(), lst ); - ip.setProperty( "VtkViewersCount", QString::number( lst.count() ).latin1() ); + ip->setProperty( "VtkViewersCount", QString::number( lst.count() ).latin1() ); */ // main cycle to store parameters of displayed objects @@ -1665,38 +1666,38 @@ void VisuGUI_Module::storeVisualParameters(int savePoint) Handle(SALOME_InteractiveObject) io = vActor->getIO(); // entry is "ecoded" = it does NOT contain component adress, since it is a // subject to change on next component loading - std::string entry = ip.encodeEntry( io->getEntry(), componentName ); + std::string entry = ip->encodeEntry( io->getEntry(), componentName ); std::string param, vtkParam = vType.latin1(); vtkParam += gSeparator; vtkParam += QString::number( *viewsCounter ).latin1(); vtkParam += gSeparator; param = vtkParam + "Visibility"; - ip.setParameter( entry, param, "On" ); + ip->setParameter( entry, param, "On" ); param = vtkParam + "Name"; - ip.setParameter( entry, param, vActor->getName() ); + ip->setParameter( entry, param, vActor->getName() ); param = vtkParam + "RepresentationMode"; - ip.setParameter( entry, param, QString::number( vActor->GetRepresentation() ).latin1() ); + ip->setParameter( entry, param, QString::number( vActor->GetRepresentation() ).latin1() ); param = vtkParam + "Opacity"; - ip.setParameter( entry, param, QString::number( vActor->GetOpacity() ).latin1() ); + ip->setParameter( entry, param, QString::number( vActor->GetOpacity() ).latin1() ); float r, g, b; vActor->GetColor(r, g, b); QString colorStr = QString::number( r ); colorStr += gDigitsSep; colorStr += QString::number( g ); colorStr += gDigitsSep; colorStr += QString::number( b ); param = vtkParam + "Color"; - ip.setParameter( entry, param, colorStr.latin1() ); + ip->setParameter( entry, param, colorStr.latin1() ); param = vtkParam + "LineWidth"; - ip.setParameter( entry, param, QString::number( vActor->GetLineWidth() ).latin1() ); + ip->setParameter( entry, param, QString::number( vActor->GetLineWidth() ).latin1() ); if ( vActor->IsShrunkable() && vActor->IsShrunk() ) { param = vtkParam + "ShrinkMode"; - ip.setParameter( entry, param, "On" ); + ip->setParameter( entry, param, "On" ); param = vtkParam + "ShrinkFactor"; - ip.setParameter( entry, param, QString::number( vActor->GetShrinkFactor() ).latin1() ); + ip->setParameter( entry, param, QString::number( vActor->GetShrinkFactor() ).latin1() ); } VISU_ScalarMapAct* scalarMapActor = dynamic_cast( vActor ); if ( scalarMapActor && scalarMapActor->IsShading() ) { param = vtkParam + "Shading"; - ip.setParameter( entry, param, "On" ); + ip->setParameter( entry, param, "On" ); } if ( const VISU::Prs3d_i* vPrs = vActor->GetPrs3d() ) { param = vtkParam + "ClippingPlane_"; @@ -1712,7 +1713,7 @@ void VisuGUI_Module::storeVisualParameters(int savePoint) planeValue += QString::number( origin[1] ).latin1(); planeValue += gDigitsSep; planeValue += QString::number( origin[2] ).latin1(); param += QString::number( p+1 ).latin1(); - ip.setParameter( entry, param, planeValue ); + ip->setParameter( entry, param, planeValue ); } } @@ -1740,13 +1741,13 @@ void VisuGUI_Module::storeVisualParameters(int savePoint) Handle(SALOME_InteractiveObject) io = sCurve->getIO(); // entry is "ecoded" = it does NOT contain component adress, since it is a // subject to change on next component loading - std::string entry = ip.encodeEntry( io->getEntry(), componentName ); + std::string entry = ip->encodeEntry( io->getEntry(), componentName ); std::string param, plotParam = vType.latin1(); plotParam += gSeparator; plotParam += QString::number( *viewsCounter ).latin1(); plotParam += gSeparator; param = plotParam + "Visibility"; - ip.setParameter( entry, param, "On" ); + ip->setParameter( entry, param, "On" ); } } } // for curves @@ -1806,17 +1807,17 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint) return; _PTR(Study) studyDS = study->studyDS(); _PTR(AttributeParameter) ap = studyDS->GetModuleParameters("Interface Applicative", moduleName().latin1(), savePoint); - SALOMEDS_IParameters ip(ap); + _PTR(IParameters) ip = ClientFactory::getIParameters(ap); // actors are stored in a map after displaying of them for quicker access in future QMap > vtkActors; // map: entry to map: ViewType_ to actor (SVTK/VVTK) - std::vector entries = ip.getEntries(); + std::vector entries = ip->getEntries(); for ( std::vector::iterator entIt = entries.begin(); entIt != entries.end(); ++entIt ) { - std::vector paramNames = ip.getAllParameterNames( *entIt ); - std::vector paramValues = ip.getAllParameterValues( *entIt ); + std::vector paramNames = ip->getAllParameterNames( *entIt ); + std::vector paramValues = ip->getAllParameterValues( *entIt ); std::vector::iterator namesIt = paramNames.begin(); std::vector::iterator valuesIt = paramValues.begin(); @@ -1837,7 +1838,7 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint) } // entry is a normal entry - it should be "decoded" (setting base adress of component) - QString entry( ip.decodeEntry( *entIt ).c_str() ); + QString entry( ip->decodeEntry( *entIt ).c_str() ); for ( ; namesIt != paramNames.end(); ++namesIt, ++valuesIt ) { std::string viewerType = ::getParam( *namesIt, ViewerType ); @@ -1984,7 +1985,7 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint) // parameters: it no SVTK view was saved, we need NOT any SVTK on restore. Here we close one // default SVTK if needed. /* - QString openedSvtkViewerStr = ip.getProperty( "VtkViewersCount" ).c_str(); + QString openedSvtkViewerStr = ip->getProperty( "VtkViewersCount" ).c_str(); int openedSvtkViewer = openedSvtkViewerStr.toInt( &ok ); if ( ok && openedSvtkViewer == 0 ) { lst.clear(); @@ -1996,7 +1997,7 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint) // if active Gauss Viewer is set ( != -1) then raise the gauss view window. bool ok; - QString activeGaussViewerStr = ip.getProperty( "ActiveGaussViewer" ).c_str(); + QString activeGaussViewerStr = ip->getProperty( "ActiveGaussViewer" ).c_str(); int activeGaussViewer = activeGaussViewerStr.toInt( &ok ); if ( ok && activeGaussViewer != -1 ) { lst.clear(); -- 2.39.2