From aea011b5e947079aa966ba835a2e9431cdb426e2 Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 27 Apr 2011 16:23:39 +0000 Subject: [PATCH] IPAL22442: TC6.3.0: Presentations properties of tables are lost after reopening hdf --- src/VISUGUI/VisuGUI_Module.cxx | 177 +++++++++++++++++++-------------- 1 file changed, 104 insertions(+), 73 deletions(-) diff --git a/src/VISUGUI/VisuGUI_Module.cxx b/src/VISUGUI/VisuGUI_Module.cxx index 6eb9146a..3e94408f 100644 --- a/src/VISUGUI/VisuGUI_Module.cxx +++ b/src/VISUGUI/VisuGUI_Module.cxx @@ -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 > vtkActors; // map: entry to map: ViewType_ to actor (SVTK/VVTK) + QMap > vtkActors; // map: entry to map: ViewType_ to actor (SVTK/VVTK) std::vector 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 viewActorMap; + QMap 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 viewActorMap = vtkActors[ entry ]; - if ( viewActorMap.contains( viewerTypeIndex ) ) - vActor = viewActorMap[ viewerTypeIndex ]; - } - if ( !vActor ) - continue; - + QMap 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( 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(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( 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(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 -- 2.39.2