ip->setParameter( entry, param, "On" );
}
if ( const VISU::Prs3d_i* vPrs = vActor->GetPrs3d() ) {
- param = vtkParam + "ClippingPlane_";
- for ( int p = 0, nPlanes = vPrs->GetNumberOfClippingPlanes(); p < nPlanes; p++ ) {
+ param = vtkParam + "ClippingPlane";
+ int nPlanes = vPrs->GetNumberOfClippingPlanes();
+ if ( !nPlanes )
+ ip->setParameter( entry, param, "Off" );
+ for ( int p = 0; p < nPlanes; p++ ) {
vtkPlane* plane = vPrs->GetClippingPlane( p );
float normal[3], origin[3];
plane->GetNormal( normal );
planeValue += QString::number( origin[0] ).latin1(); planeValue += gDigitsSep;
planeValue += QString::number( origin[1] ).latin1(); planeValue += gDigitsSep;
planeValue += QString::number( origin[2] ).latin1();
- param += QString::number( p+1 ).latin1();
+ param = QString( "%1ClippingPlane_%2" ).arg( vtkParam.c_str() ).arg( p+1 ).latin1();
ip->setParameter( entry, param, planeValue );
}
}
if ( viewIndex >= 0 && viewIndex < lst.count() ) {
SUIT_ViewManager* vman = lst.at( viewIndex );
SUIT_ViewModel* vmodel = vman->getViewModel();
- // SVTK and VVTK view models can be casted to SALOME_View
- displayer()->Display( entry, true, dynamic_cast<SALOME_View*>( vmodel ) );
- SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) vman->getActiveView();
- // vtkView->getRenderer()->ResetCameraClippingRange();
- // vtkView->Repaint();
+ // both SVTK and VVTK view models can be casted to SALOME_View
+ displayer()->Display( entry, true, dynamic_cast<SALOME_View*>( vmodel ) );
- // store displayed actor so setting of color, opacity, etc. will be much faster
+ // 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;
if ( vtkActors.contains( entry ) )
viewActorMap = vtkActors[ entry ];
}
else if ( paramName.find( "ClippingPlane" ) != std::string::npos ) {
- QStringList vals = QStringList::split( gDigitsSep, val );
- if ( vals.count() == 6 && vActor->GetPrs3d() ) {
- float normal[3], origin[3];
- for (int x = 0; x < 3; x++ ) {
- normal[x] = vals[x].toFloat();
- origin[x] = vals[x+3].toFloat();
+ VISU::Prs3d_i* prs = vActor->GetPrs3d();
+ if ( !prs )
+ continue;
+ if ( val == "Off" ) {
+ prs->RemoveAllClippingPlanes();
+ }
+ else {
+ QStringList vals = QStringList::split( gDigitsSep, val );
+ if ( vals.count() == 6 ) { // format check: 6 float values
+ float normal[3], origin[3];
+ for (int x = 0; x < 3; x++ ) {
+ normal[x] = vals[x].toFloat();
+ origin[x] = vals[x+3].toFloat();
+ }
+ vtkPlane* plane = vtkPlane::New();
+ plane->SetNormal( normal );
+ plane->SetOrigin( origin );
+ prs->AddClippingPlane( plane );
}
- vtkPlane* plane = vtkPlane::New();
- plane->SetNormal( normal );
- plane->SetOrigin( origin );
- vActor->GetPrs3d()->AddClippingPlane( plane );
}
}
} // else ..