]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
IPAL22442: TC6.3.0: Presentations properties of tables are lost after reopening hdf
authorvsr <vsr@opencascade.com>
Wed, 27 Apr 2011 16:23:39 +0000 (16:23 +0000)
committervsr <vsr@opencascade.com>
Wed, 27 Apr 2011 16:23:39 +0000 (16:23 +0000)
src/VISUGUI/VisuGUI_Module.cxx

index 6eb9146aa8e2fcd0bc430aac5cc5f2ff372e0869..3e94408f02ab8c6ac1d2ce2a3cfb0c281e330718 100644 (file)
@@ -1804,7 +1804,7 @@ void VisuGUI_Module::storeVisualParameters(int savePoint)
                     ip->setParameter( entry, param, QString::number( vActor->GetShrinkFactor() ).toLatin1().data() );
                   }
                 }
-                } // salome actor is downcasted to the VISU_PointMap3dActor
+             } // salome actor is downcasted to the VISU_PointMap3dActor
             } // isVisible
           } // end of ..while.. actors traversal
         } // if ( vtkView )
@@ -1879,7 +1879,7 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint)
   _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
 
   // actors are stored in a map after displaying of them for quicker access in future
-  QMap<QString, QMap<QString, VISU_Actor*> > vtkActors; // map: entry to map: ViewType_<ID> to actor (SVTK/VVTK)
+  QMap<QString, QMap<QString, VISU_ActorBase*> > vtkActors; // map: entry to map: ViewType_<ID> to actor (SVTK/VVTK)
 
   std::vector<std::string> entries = ip->getEntries();
 
@@ -1947,86 +1947,117 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint)
 
             // store displayed actor in a temporary map for quicker access later when restoring other parameters
             SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) vman->getActiveView();
-            QMap<QString, VISU_Actor*> viewActorMap;
+            QMap<QString, VISU_ActorBase*> viewActorMap;
             if ( vtkActors.contains( entry ) )
               viewActorMap = vtkActors[ entry ];
-            viewActorMap[ viewerTypeIndex ] = FindActor( GetAppStudy(this), vtkView, entry );
+            viewActorMap[ viewerTypeIndex ] = FindActorBase( GetAppStudy(this), vtkView, entry );
             vtkActors[ entry ] = viewActorMap;
           }
         }
         else { // the rest properties "work" with VISU_Actor, so we initialize it at first
           VISU_Actor* vActor = 0;
+          VISU_PointMap3dActor* vP3dActor = 0;
           if ( vtkActors.contains( entry ) ) {
-            QMap<QString, VISU_Actor*> viewActorMap = vtkActors[ entry ];
-            if ( viewActorMap.contains( viewerTypeIndex ) )
-              vActor = viewActorMap[ viewerTypeIndex ];
-          }
-          if ( !vActor )
-            continue;
-
+            QMap<QString, VISU_ActorBase*> viewActorMap = vtkActors[ entry ];
+            if ( viewActorMap.contains( viewerTypeIndex ) ) {
+              vActor = VISU_Actor::SafeDownCast( viewActorMap[ viewerTypeIndex ] );
+             vP3dActor = VISU_PointMap3dActor::SafeDownCast( viewActorMap[ viewerTypeIndex ] );
+           }
+         }
           QString val( (*valuesIt).c_str() );
-
-          if ( paramName == "Name" )
-            vActor->setName( val.toLatin1().data() );
-
-          else if ( paramName == "RepresentationMode" )
-            vActor->SetRepresentation( val.toInt() );
-
-          else if (paramName == "Quadratic2DRepresentation")
-            vActor->SetQuadratic2DRepresentation(VISU_Actor::EQuadratic2DRepresentation(val.toInt()));
-
-          else if ( paramName == "Opacity" )
-            vActor->SetOpacity( val.toFloat() );
-
-          else if ( paramName == "Color" ) {
-            QStringList colors = val.split( gDigitsSep, QString::SkipEmptyParts );
-            if ( colors.count() == 3 )
-              vActor->SetColor( colors[0].toFloat(), colors[1].toFloat(), colors[2].toFloat() );
-          }
-
-          else if ( paramName == "LineWidth" )
-            vActor->SetLineWidth( val.toFloat() );
-
-          else if ( paramName == "ShrinkMode" ) {
-            vActor->SetShrinkable( true );
-            vActor->SetShrink();
-          }
-
-          else if ( paramName == "ShrunkFactor" )
-            vActor->SetShrinkFactor( val.toFloat() );
-
-          else if ( paramName == "Shading" ) {
-            if ( VISU_ScalarMapAct* scalarMapActor = dynamic_cast<VISU_ScalarMapAct*>( vActor ) )
-              scalarMapActor->SetShading();
-          }
-
-          else if ( paramName.find( "ClippingPlane" ) != std::string::npos ) {
-            VISU::Prs3d_i* prs = vActor->GetPrs3d();
-            if ( !prs )
-              continue;
-
-            //prs->RemoveAllClippingPlanes();
-            for (int i = prs->GetNumberOfClippingPlanes() - 1; i >= 0 ; i--) {
-              OrientedPlane* aPlane = dynamic_cast<OrientedPlane*>(prs->GetClippingPlane(i));
-              if (aPlane) 
-                prs->RemoveClippingPlane(i);
-            }
-            if ( val != "Off" ) {
-              QStringList vals = val.split( gDigitsSep, QString::SkipEmptyParts );
-              if ( vals.count() == 6 ) { // format check: 6 float values
-                vtkFloatingPointType normal[3], origin[3];
-                for (int x = 0; x < 3; x++ ) {
-                  normal[x] = vals[x].toFloat();
-                  origin[x] = vals[x+3].toFloat();
-                }
-                OrientedPlane* plane = OrientedPlane::New();
-                plane->SetNormal( normal );
-                plane->SetOrigin( origin );
-                prs->AddClippingPlane( plane );
-                plane->Delete();
-              }
-            }
-          }
+          if ( vActor ) {
+           // salome_actor successfull downcast to the VISU_Actor
+           if ( paramName == "Name" )
+             vActor->setName( val.toLatin1().data() );
+
+           else if ( paramName == "RepresentationMode" )
+             vActor->SetRepresentation( val.toInt() );
+
+           else if (paramName == "Quadratic2DRepresentation")
+             vActor->SetQuadratic2DRepresentation(VISU_Actor::EQuadratic2DRepresentation(val.toInt()));
+
+           else if ( paramName == "Opacity" )
+             vActor->SetOpacity( val.toFloat() );
+           
+           else if ( paramName == "Color" ) {
+             QStringList colors = val.split( gDigitsSep, QString::SkipEmptyParts );
+             if ( colors.count() == 3 )
+               vActor->SetColor( colors[0].toFloat(), colors[1].toFloat(), colors[2].toFloat() );
+           }
+
+           else if ( paramName == "LineWidth" )
+             vActor->SetLineWidth( val.toFloat() );
+
+           else if ( paramName == "ShrinkMode" ) {
+             vActor->SetShrinkable( true );
+             vActor->SetShrink();
+           }
+
+           else if ( paramName == "ShrinkFactor" )
+             vActor->SetShrinkFactor( val.toFloat() );
+
+           else if ( paramName == "Shading" ) {
+             if ( VISU_ScalarMapAct* scalarMapActor = dynamic_cast<VISU_ScalarMapAct*>( vActor ) )
+               scalarMapActor->SetShading();
+           }
+
+           else if ( paramName.find( "ClippingPlane" ) != std::string::npos ) {
+             VISU::Prs3d_i* prs = vActor->GetPrs3d();
+             if ( !prs )
+               continue;
+             
+             //prs->RemoveAllClippingPlanes();
+             for (int i = prs->GetNumberOfClippingPlanes() - 1; i >= 0 ; i--) {
+               OrientedPlane* aPlane = dynamic_cast<OrientedPlane*>(prs->GetClippingPlane(i));
+               if (aPlane) 
+                 prs->RemoveClippingPlane(i);
+             }
+             if ( val != "Off" ) {
+               QStringList vals = val.split( gDigitsSep, QString::SkipEmptyParts );
+               if ( vals.count() == 6 ) { // format check: 6 float values
+                 vtkFloatingPointType normal[3], origin[3];
+                 for (int x = 0; x < 3; x++ ) {
+                   normal[x] = vals[x].toFloat();
+                   origin[x] = vals[x+3].toFloat();
+                 }
+                 OrientedPlane* plane = OrientedPlane::New();
+                 plane->SetNormal( normal );
+                 plane->SetOrigin( origin );
+                 prs->AddClippingPlane( plane );
+                 plane->Delete();
+               }
+             }
+           }
+         } // if ( vActor ) --> salome_actor successfull downcast to the VISU_Actor
+         else if ( vP3dActor ) {
+           // salome actor is downcasted to the VISU_PointMap3dActor
+           if ( paramName == "Name" )
+             vP3dActor->setName( val.toLatin1().data() );
+
+           else if ( paramName == "RepresentationMode" )
+             vP3dActor->SetRepresentation( val.toInt() );
+
+           else if ( paramName == "Opacity" )
+             vP3dActor->SetOpacity( val.toFloat() );
+
+           else if ( paramName == "Color" ) {
+             QStringList colors = val.split( gDigitsSep, QString::SkipEmptyParts );
+             if ( colors.count() == 3 )
+               vP3dActor->SetColor( colors[0].toFloat(), colors[1].toFloat(), colors[2].toFloat() );
+           }
+
+           else if ( paramName == "LineWidth" )
+             vP3dActor->SetLineWidth( val.toFloat() );
+
+           else if ( paramName == "ShrinkMode" ) {
+             vP3dActor->SetShrinkable( true );
+             vP3dActor->SetShrink();
+           }
+
+           else if ( paramName == "ShrinkFactor" )
+             vP3dActor->SetShrinkFactor( val.toFloat() );
+
+         } // else if ( vP3dActor ) --> salome actor is downcasted to the VISU_PointMap3dActor
         } // else ..
       } // if SVTK