X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FDisplayGUI%2FDisplayGUI.cxx;h=44a14839c10d3371d9f31d662ed6484b8cbc8658;hb=d2046800b5f3ab6a56c3b9a72766f5d317a235e7;hp=3cfa07c76d5159e2156b86ea82819d638fbc2e2e;hpb=68a6e5ca4b8f36aabaf23089cc335da4afb4fb55;p=modules%2Fgeom.git diff --git a/src/DisplayGUI/DisplayGUI.cxx b/src/DisplayGUI/DisplayGUI.cxx index 3cfa07c76..44a14839c 100644 --- a/src/DisplayGUI/DisplayGUI.cxx +++ b/src/DisplayGUI/DisplayGUI.cxx @@ -469,6 +469,16 @@ int DisplayGUI::GetVectorMode( SUIT_ViewWindow* viewWindow ) return viewWindow->getCustomData( "VectorsMode" ).toBool(); } +//===================================================================================== +// function : DisplayGUI::InvertDisplayMode() +// purpose : Invert display mode ( shadin <-> wireframe ) for the viewer +// (current viewer if = 0 ) +//===================================================================================== +void DisplayGUI::InvertDisplayMode( SUIT_ViewWindow* viewWindow ) +{ + SetDisplayMode( 1 - GetDisplayMode( viewWindow ) ); +} + //===================================================================================== // function : DisplayGUI::ChangeDisplayMode() // purpose : Set display mode for selected objects in the viewer given @@ -501,18 +511,18 @@ void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow SVTK_Prs* vtkPrs = stvkViewer ? dynamic_cast( stvkViewer->CreatePrs( It.Value()->getEntry() ) ) : 0; if ( vtkPrs && !vtkPrs->IsNull() ) { - if ( mode == 0 ) - aView->ChangeRepresentationToWireframe( vtkPrs->GetObjects() ); - else if ( mode == 1 ) - aView->ChangeRepresentationToSurface( vtkPrs->GetObjects() ); - else if ( mode == 2 ) { - vtkActorCollection* anActors = vtkPrs->GetObjects(); - anActors->InitTraversal(); - while (vtkActor* anAct = anActors->GetNextActor()) { - GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(anAct); - aGeomActor->SetVectorMode(!aGeomActor->GetVectorMode()); - } - } + if ( mode == 0 ) + aView->ChangeRepresentationToWireframe( vtkPrs->GetObjects() ); + else if ( mode == 1 ) + aView->ChangeRepresentationToSurface( vtkPrs->GetObjects() ); + else if ( mode == 2 ) { + vtkActorCollection* anActors = vtkPrs->GetObjects(); + anActors->InitTraversal(); + while (vtkActor* anAct = anActors->GetNextActor()) { + GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(anAct); + aGeomActor->SetVectorMode(!aGeomActor->GetVectorMode()); + } + } } } aView->Repaint(); @@ -528,19 +538,21 @@ void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow SOCC_Viewer* soccViewer = (SOCC_Viewer*)(viewWindow->getViewManager()->getViewModel()); SOCC_Prs* occPrs = dynamic_cast( soccViewer->CreatePrs( It.Value()->getEntry() ) ); if ( occPrs && !occPrs->IsNull() ) { - AIS_ListOfInteractive shapes; occPrs->GetObjects( shapes ); - AIS_ListIteratorOfListOfInteractive interIter( shapes ); - for ( ; interIter.More(); interIter.Next() ) { - if ( mode == 0 ) - ic->SetDisplayMode( interIter.Value(), AIS_WireFrame, false ); - else if ( mode == 1 ) - ic->SetDisplayMode( interIter.Value(), AIS_Shaded, false ); - if (mode == 2 ) { - Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( interIter.Value() ); - aSh->SetDisplayVectors(!aSh->isShowVectors()); - ic->RecomputePrsOnly(interIter.Value()); - } - } + AIS_ListOfInteractive shapes; occPrs->GetObjects( shapes ); + AIS_ListIteratorOfListOfInteractive interIter( shapes ); + for ( ; interIter.More(); interIter.Next() ) { + if ( mode == 0 ) + ic->SetDisplayMode( interIter.Value(), AIS_WireFrame, false ); + else if ( mode == 1 ) + ic->SetDisplayMode( interIter.Value(), AIS_Shaded, false ); + if (mode == 2 ) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( interIter.Value() ); + if ( !aSh.IsNull() ) { + aSh->SetDisplayVectors(!aSh->isShowVectors()); + ic->RecomputePrsOnly(interIter.Value()); + } + } + } } } ic->UpdateCurrentViewer();