]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
implementing save/restore visual parameters..
authorasv <asv@opencascade.com>
Fri, 10 Feb 2006 11:41:54 +0000 (11:41 +0000)
committerasv <asv@opencascade.com>
Fri, 10 Feb 2006 11:41:54 +0000 (11:41 +0000)
src/VISUGUI/VisuGUI_Module.cxx

index 79f71258d7100d5c8ef463a8da1b1f1e93da3c83..46bbe5fbb9cd6e2192156af442ce4b0185d00660 100644 (file)
@@ -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<int, SALOME_Actor*> 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