From 5ce415581c3fd29dbf52d32fccf80ef232c5d520 Mon Sep 17 00:00:00 2001 From: dmv Date: Thu, 19 Jun 2008 10:07:20 +0000 Subject: [PATCH] 0019882: EDF 453 GEOM: Impossible to change the iso values in the VTK window --- src/GEOMToolsGUI/GEOMToolsGUI_1.cxx | 48 ++++++++++++++--------- src/OBJECT/GEOM_Actor.cxx | 59 +++++++++++++++-------------- src/OBJECT/GEOM_WireframeFace.cxx | 46 +++++++++++++++------- src/OBJECT/GEOM_WireframeFace.h | 20 ++++++---- 4 files changed, 106 insertions(+), 67 deletions(-) diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx index 7aa1df339..714ccc3f5 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx @@ -469,31 +469,42 @@ void GEOMToolsGUI::OnNbIsos() aSelMgr->selectedObjects( selected ); if ( selected.IsEmpty() ) return; - - Handle(SALOME_InteractiveObject) FirstIOS = selected.First(); - if ( FirstIOS.IsNull() ) - return; - + SVTK_ViewWindow* vtkVW = dynamic_cast( window ); if ( !vtkVW ) return; + + SALOME_View* view = GEOM_Displayer::GetActiveView(); + + vtkActorCollection* aCollection = vtkActorCollection::New(); - SVTK_View* aView = vtkVW->getView(); - vtkActorCollection* aCollection = aView->getRenderer()->GetActors(); - + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + Handle(SALOME_InteractiveObject) anIObject = It.Value(); + SALOME_Prs* aPrs = view->CreatePrs( anIObject->getEntry() ); + SVTK_Prs* vtkPrs = dynamic_cast( aPrs ); + if ( vtkPrs ) { + vtkActorCollection* anActors = vtkPrs->GetObjects(); + anActors->InitTraversal(); + vtkActor* anAct = anActors->GetNextActor(); + aCollection->AddItem(anAct); + } + } + + if(aCollection) + aCollection->InitTraversal(); + else + return; + int UIso = 0; int VIso = 0; - if(aCollection){ - aCollection->InitTraversal(); - } - vtkActor *anAct = aCollection->GetNextActor(); - if(GEOM_Actor *anActor = dynamic_cast(anAct)){ + vtkActor* anAct = aCollection->GetNextActor(); + if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) anActor->GetNbIsos(UIso,VIso); - } - + else + return; - GEOMToolsGUI_NbIsosDlg * NbIsosDlg = + GEOMToolsGUI_NbIsosDlg* NbIsosDlg = new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() ); NbIsosDlg->setU( UIso ); @@ -502,14 +513,15 @@ void GEOMToolsGUI::OnNbIsos() if ( NbIsosDlg->exec() ) { SUIT_OverrideCursor(); - while(anAct = aCollection->GetNextActor()) { - if(GEOM_Actor *anActor = dynamic_cast(anAct)){ + while( anAct!=NULL ) { + if(GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)){ // There are no casting to needed actor. UIso = NbIsosDlg->getU(); VIso = NbIsosDlg->getV(); int aIsos[2]={UIso,VIso}; anActor->SetNbIsos(aIsos); } + anAct = aCollection->GetNextActor(); } } } // end vtkviewer diff --git a/src/OBJECT/GEOM_Actor.cxx b/src/OBJECT/GEOM_Actor.cxx index 54c88608e..4bc733201 100644 --- a/src/OBJECT/GEOM_Actor.cxx +++ b/src/OBJECT/GEOM_Actor.cxx @@ -67,6 +67,8 @@ #include #include +#include "utilities.h" + //vtkStandardNewMacro(GEOM_Actor); #ifndef MYDEBUG @@ -105,7 +107,7 @@ GEOM_Actor::GEOM_Actor(): { #ifdef MYDEBUG - cout <SetInput(myAppendFilter->GetOutput()); @@ -180,7 +182,7 @@ GEOM_Actor::GEOM_Actor(): GEOM_Actor::~GEOM_Actor() { #ifdef MYDEBUG - cout <Delete(); myPreHighlightProp->Delete(); @@ -199,7 +201,7 @@ New() void Write(vtkPolyData* theDataSet, const char* theFileName){ vtkPolyDataWriter* aWriter = vtkPolyDataWriter::New(); - cout<<"Write - "<GetNumberOfPoints()<<"; "<GetNumberOfCells()<GetNumberOfPoints()<<"; "<GetNumberOfCells()); aWriter->SetInput(theDataSet); aWriter->SetFileName(theFileName); //aWriter->Write(); @@ -275,7 +277,7 @@ GEOM_Actor:: setDisplayMode(int theMode) { #ifdef MYDEBUG - cout << "GEOM_Actor::SetDisplayMode = "<myHighlightActor->GetProperty()->DeepCopy(Prop); @@ -488,7 +489,7 @@ void GEOM_Actor::SetHighlightProperty(vtkProperty* Prop) void GEOM_Actor::SetWireframeProperty(vtkProperty* Prop) { #ifdef MYDEBUG - cout << this << " GEOM_Actor::SetWireframeProperty"<SetProperty(Prop); @@ -497,7 +498,7 @@ void GEOM_Actor::SetWireframeProperty(vtkProperty* Prop) void GEOM_Actor::SetShadingProperty(vtkProperty* Prop) { #ifdef MYDEBUG - cout << "GEOM_Actor::SetShadingProperty"<DeepCopy(Prop); } @@ -506,7 +507,7 @@ void GEOM_Actor::SetShadingProperty(vtkProperty* Prop) void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *theMapper) { #ifdef MYDEBUG - cout << "GEOM_Actor::Render"<