From: asv Date: Fri, 10 Feb 2006 11:41:54 +0000 (+0000) Subject: implementing save/restore visual parameters.. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9b09aa6f971cb413ea514ee018eb8532bdc8ada5;p=modules%2Fvisu.git implementing save/restore visual parameters.. --- diff --git a/src/VISUGUI/VisuGUI_Module.cxx b/src/VISUGUI/VisuGUI_Module.cxx index 79f71258..46bbe5fb 100644 --- a/src/VISUGUI/VisuGUI_Module.cxx +++ b/src/VISUGUI/VisuGUI_Module.cxx @@ -1710,6 +1710,9 @@ void VisuGUI_Module::storeVisualParameters(int savePoint) float opacity = salomeActor->GetOpacity(); float r, g, b; salomeActor->GetColor(r, g, b); + QString colorStr = QString::number( r ); colorStr += ","; + colorStr += QString::number( g ); colorStr += ","; + colorStr += QString::number( b ); int repMode = salomeActor->GetRepresentation(); int disMode = salomeActor->getDisplayMode(); bool isInf = salomeActor->IsInfinitive(); @@ -1726,17 +1729,13 @@ void VisuGUI_Module::storeVisualParameters(int savePoint) ip.setParameter( entry, param.latin1(), aName ); param = vtkParam + "Opacity"; ip.setParameter( entry, param.latin1(), QString::number( opacity ).latin1() ); - param = vtkParam + "ColorRed"; - ip.setParameter( entry, param.latin1(), QString::number( r ).latin1() ); - param = vtkParam + "ColorGreen"; - ip.setParameter( entry, param.latin1(), QString::number( g ).latin1() ); - param = vtkParam + "ColorBlue"; - ip.setParameter( entry, param.latin1(), QString::number( b ).latin1() ); + param = vtkParam + "Color"; + ip.setParameter( entry, param.latin1(), colorStr.latin1() ); param = vtkParam + "RepresentationMode"; ip.setParameter( entry, param.latin1(), QString::number( repMode ).latin1() ); param = vtkParam + "DisplayMode"; ip.setParameter( entry, param.latin1(), QString::number( disMode ).latin1() ); - param = vtkParam + "IsInfitine"; + param = vtkParam + "IsInfinitive"; ip.setParameter( entry, param.latin1(), QString::number( isInf ).latin1() ); param = vtkParam + "IsShrunk"; ip.setParameter( entry, param.latin1(), QString::number( isShrunk ).latin1() ); @@ -1849,7 +1848,44 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint) viewActorMap[ viewIndex ] = getActor( *entIt, vtkView ); vtkActors[ entry ] = viewActorMap; } - } // if view index less then VTK view managers size + } + else { // the rest properties "work" with SALOME_Actor, so we initialize it at first + SALOME_Actor* actor = 0; + if ( vtkActors.contains( entry ) ) { + QMap viewActorMap = vtkActors[ entry ]; + if ( viewActorMap.contains( viewIndex ) ) + actor = viewActorMap[ viewIndex ]; + } + if ( !actor ) + continue; + + QString val( (*valuesIt).c_str() ); + + if ( paramName == "Name" ) + actor->setName( val.latin1() ); + + else if ( paramName == "Opacity" ) + actor->SetOpacity( val.toFloat() ); + + else if ( paramName == "Color" ) { + QStringList colors = QStringList::split( ',', val ); + if ( colors.count() == 3 ) + actor->SetColor( colors[0].toFloat(), colors[1].toFloat(), colors[2].toFloat() ); + } + + else if ( paramName == "RepresentationMode" ) + actor->SetRepresentation( val.toInt() ); + + else if ( paramName == "DisplayMode" ) + actor->setDisplayMode( val.toInt() ); + + else if ( paramName == "IsInfinitive" ) + actor->SetInfinitive( (bool)val.toInt() ); + + else if ( paramName == "IsShrunk" ) + actor->SetShrink(); + } // else .. + } // if SVTK } // for names/parameters iterator } // for entries iterator