From 3bab77bbc50b4a41320bec08f63d6495ff413775 Mon Sep 17 00:00:00 2001 From: apo Date: Mon, 19 Sep 2005 06:01:33 +0000 Subject: [PATCH] 1. To implement callback mechanism for Model & VTK Actor interaction 2. To remove VISU_Actor::GetParent method --- src/OBJECT/Makefile.in | 21 +++-- src/OBJECT/VISU_Actor.cxx | 52 +++++++----- src/OBJECT/VISU_Actor.h | 28 +++--- src/OBJECT/VISU_ActorFactory.h | 6 +- src/OBJECT/VISU_MeshAct.cxx | 32 ++++--- src/OBJECT/VISU_ScalarMapAct.cxx | 41 ++++++--- src/VISUGUI/VisuGUI.cxx | 1 - src/VISUGUI/VisuGUI_Prs3dTools.h | 12 +-- src/VISUGUI/VisuGUI_TimeAnimation.cxx | 2 +- src/VISUGUI/VisuGUI_Tools.cxx | 6 +- src/VISUGUI/VisuGUI_ViewTools.h | 9 +- src/VISU_I/Makefile.in | 118 ++++++++++++++++++++------ src/VISU_I/VISUConfig.hh | 8 +- src/VISU_I/VISU_GaussPoints_i.cc | 23 +++-- src/VISU_I/VISU_GaussPoints_i.hh | 6 ++ src/VISU_I/VISU_Gen_i.cc | 10 +-- src/VISU_I/VISU_I.cxx | 54 ++++++++++++ src/VISU_I/VISU_Prs3d_i.cc | 29 ++++++- src/VISU_I/VISU_Prs3d_i.hh | 12 +++ src/VISU_I/VISU_ViewManager_i.cc | 6 +- src/VVTK/VVTK_Renderer.cxx | 6 ++ src/VVTK/VVTK_ViewWindow.cxx | 11 ++- src/VVTK/VVTK_ViewWindow.h | 6 +- 23 files changed, 369 insertions(+), 130 deletions(-) create mode 100644 src/VISU_I/VISU_I.cxx diff --git a/src/OBJECT/Makefile.in b/src/OBJECT/Makefile.in index 07df18eb..a6854974 100644 --- a/src/OBJECT/Makefile.in +++ b/src/OBJECT/Makefile.in @@ -56,13 +56,24 @@ LIB_CLIENT_IDL = BIN = BIN_SRC = -CPPFLAGS+= $(OCC_INCLUDES) $(VTK_INCLUDES) \ - -I${KERNEL_ROOT_DIR}/include/salome \ +CPPFLAGS+= \ + $(OCC_INCLUDES) \ + $(VTK_INCLUDES) \ + $(BOOST_CPPFLAGS) \ -I${MED_ROOT_DIR}/include/salome \ -I${GUI_ROOT_DIR}/include/salome \ - $(BOOST_CPPFLAGS) + -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS+= $(VTK_LIBS) -lSalomeObject -lSVTK -lVisuPipeLine \ - -L${KERNEL_ROOT_DIR}/lib/salome -L${GUI_ROOT_DIR}/lib/salome +LDFLAGS+= \ + $(VTK_LIBS) \ + $(BOOST_LIBS) \ + -L${GUI_ROOT_DIR}/lib/salome \ + -L${KERNEL_ROOT_DIR}/lib/salome + +LIBS+= \ + -lboost_signals-mt \ + -lSalomeObject \ + -lVisuPipeLine \ + -lSVTK @CONCLUDE@ diff --git a/src/OBJECT/VISU_Actor.cxx b/src/OBJECT/VISU_Actor.cxx index eb5fee39..c0c85f0c 100644 --- a/src/OBJECT/VISU_Actor.cxx +++ b/src/OBJECT/VISU_Actor.cxx @@ -21,8 +21,8 @@ // // // -// File : VISU_Actor.cxx -// Author : Laurent CORNABE with help of Nicolas REJNERI +// File : +// Author : // Module : VISU // $Header$ @@ -57,6 +57,8 @@ #include #include +#include + #include "utilities.h" using namespace std; @@ -74,9 +76,9 @@ static int MYDEBUG = 0; vtkStandardNewMacro(VISU_Actor); //---------------------------------------------------------------------------- -VISU_Actor::VISU_Actor(): +VISU_Actor +::VISU_Actor(): myIsVTKMapping(false), - myParent(this), myPrs3d(NULL), myActorFactory(NULL), myMapper(vtkDataSetMapper::New()), @@ -86,6 +88,7 @@ VISU_Actor::VISU_Actor(): myAnnotationMapper(vtkTextMapper::New()), myAnnotationActor(vtkTextActor::New()) { + if(MYDEBUG) MESSAGE("VISU_Actor() - this = "<Delete(); @@ -119,6 +122,7 @@ VISU_Actor VISU_Actor ::~VISU_Actor() { + if(MYDEBUG) MESSAGE("~VISU_Actor() - this = "<UpdateActor(this); + SALOME_Actor::Update(); +} + + //---------------------------------------------------------------------------- void VISU_Actor @@ -206,21 +226,6 @@ VISU_Actor return myPipeLine.GetPointer(); } -//---------------------------------------------------------------------------- -void -VISU_Actor -::SetParent(VISU_Actor* theParent) -{ - myParent = theParent; -} - -VISU_Actor* -VISU_Actor -::GetParent() -{ - return myParent; -} - //---------------------------------------------------------------------------- void @@ -228,6 +233,7 @@ VISU_Actor ::SetVisibility(int theMode) { SALOME_Actor::SetVisibility(theMode); + mySetVisibilitySignal(GetVisibility()); } int diff --git a/src/OBJECT/VISU_Actor.h b/src/OBJECT/VISU_Actor.h index ba04ea28..0d1a5df1 100644 --- a/src/OBJECT/VISU_Actor.h +++ b/src/OBJECT/VISU_Actor.h @@ -21,8 +21,8 @@ // // // -// File : VISU_Actor.h -// Author : Laurent CORNABE with the help of Nicolas REJNERI +// File : +// Author : // Module : VISU // $Header$ @@ -34,6 +34,7 @@ #include #include +#include class vtkProp; class vtkProperty; @@ -67,6 +68,7 @@ class VTKOCC_EXPORT VISU_Actor : public SALOME_Actor void setIO(const Handle(SALOME_InteractiveObject)& theIO); + //---------------------------------------------------------------------------- VISU::Prs3d_i* GetPrs3d(); @@ -74,6 +76,7 @@ class VTKOCC_EXPORT VISU_Actor : public SALOME_Actor void SetPrs3d(VISU::Prs3d_i* thePrs3d); + //---------------------------------------------------------------------------- VISU::TActorFactory* GetFactory(); @@ -81,6 +84,15 @@ class VTKOCC_EXPORT VISU_Actor : public SALOME_Actor void SetFactory(VISU::TActorFactory* theActorFactory); + virtual + void + Connect(VISU_Actor* theActor); + + virtual + void + Update(); + + //---------------------------------------------------------------------------- virtual VISU_PipeLine* GetPipeLine(); @@ -89,13 +101,6 @@ class VTKOCC_EXPORT VISU_Actor : public SALOME_Actor void SetPipeLine(VISU_PipeLine* thePipeLine) ; - VISU_Actor* - GetParent(); - - virtual - void - SetParent(VISU_Actor* theParent); - //---------------------------------------------------------------------------- virtual void @@ -210,6 +215,7 @@ class VTKOCC_EXPORT VISU_Actor : public SALOME_Actor protected: VISU_Actor(); + virtual ~VISU_Actor(); @@ -218,15 +224,17 @@ class VTKOCC_EXPORT VISU_Actor : public SALOME_Actor SetMapperInput(vtkDataSet* theDataSet); bool myIsVTKMapping; - VISU_Actor* myParent; VISU::Prs3d_i* myPrs3d; vtkSmartPointer myPipeLine; vtkSmartPointer myMapper; + VISU::TActorFactory* myActorFactory; + boost::signal1 mySetVisibilitySignal; vtkSmartPointer myShrinkFilter; bool myIsShrinkable; bool myIsShrunk; + vtkSmartPointer myAnnotationMapper; vtkSmartPointer myAnnotationActor; }; diff --git a/src/OBJECT/VISU_ActorFactory.h b/src/OBJECT/VISU_ActorFactory.h index 9a0c2198..a41cbfed 100644 --- a/src/OBJECT/VISU_ActorFactory.h +++ b/src/OBJECT/VISU_ActorFactory.h @@ -42,7 +42,11 @@ namespace VISU { virtual VISU_Actor* - CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL) = 0; + CloneActor(VISU_Actor* theActor) = 0; + + virtual + void + UpdateActor(VISU_Actor* theActor) = 0; virtual void diff --git a/src/OBJECT/VISU_MeshAct.cxx b/src/OBJECT/VISU_MeshAct.cxx index 68f7446a..b078270e 100644 --- a/src/OBJECT/VISU_MeshAct.cxx +++ b/src/OBJECT/VISU_MeshAct.cxx @@ -47,14 +47,12 @@ VISU_MeshAct::VISU_MeshAct(){ m = vtkMatrix4x4::New(); mySurfaceActor = VISU_Actor::New(); - mySurfaceActor->SetParent(this); mySurfaceActor->GetProperty()->FrontfaceCullingOff(); mySurfaceActor->GetProperty()->BackfaceCullingOff(); mySurfaceActor->SetUserMatrix(m); mySurfaceActor->SetRepresentation(2); //SURFACE myEdgeActor = VISU_Actor::New(); - myEdgeActor->SetParent(this); myEdgeActor->PickableOff(); myEdgeActor->GetProperty()->FrontfaceCullingOff(); myEdgeActor->GetProperty()->BackfaceCullingOff(); @@ -62,7 +60,6 @@ VISU_MeshAct::VISU_MeshAct(){ myEdgeActor->SetRepresentation(1); //WIREFRAME myNodeActor = VISU_Actor::New(); - myNodeActor->SetParent(this); myNodeActor->PickableOff(); myNodeActor->GetProperty()->SetPointSize(SALOME_POINT_SIZE); myNodeActor->GetProperty()->FrontfaceCullingOff(); @@ -98,12 +95,12 @@ void VISU_MeshAct::SetPrs3d(VISU::Prs3d_i* thePrs3d){ void VISU_MeshAct::AddToRender(vtkRenderer* theRenderer){ VISU_Actor::AddToRender(theRenderer); - theRenderer->AddActor(myEdgeActor); + //theRenderer->AddActor(myEdgeActor); } void VISU_MeshAct::RemoveFromRender(vtkRenderer* theRenderer){ VISU_Actor::RemoveFromRender(theRenderer); - theRenderer->RemoveActor(myEdgeActor); + //theRenderer->RemoveActor(myEdgeActor); } void VISU_MeshAct::SetPipeLine(VISU_PipeLine* thePipeLine) { @@ -316,17 +313,20 @@ void VISU_MeshAct::Render(vtkRenderer *ren, vtkMapper *vtkNotUsed(m)) myNodeActor->GetProperty()->Render(this, ren); break; case 1: //WIREFRAME - //PAL5268: myEdgeActor->GetProperty()->Render(this, ren); + //PAL5268: + myEdgeActor->GetProperty()->Render(this, ren); break; case 2: //SURFACE mySurfaceActor->GetProperty()->Render(this, ren); break; case 3: //INSIDEFRAME - //PAL5268: myEdgeActor->GetProperty()->Render(this, ren); + //PAL5268: + myEdgeActor->GetProperty()->Render(this, ren); break; case 4: //SURFACEFRAME - //PAL5268: myEdgeActor->GetProperty()->Render(this, ren); + //PAL5268: mySurfaceActor->GetProperty()->Render(this, ren); + myEdgeActor->GetProperty()->Render(this, ren); break; } @@ -350,9 +350,9 @@ void VISU_MeshAct::Render(vtkRenderer *ren, vtkMapper *vtkNotUsed(m)) matrix = myEdgeActor->GetUserMatrix(); break; case 4: //SURFACEFRAME - matrix = myEdgeActor->GetUserMatrix(); - this->GetMatrix(matrix); matrix = mySurfaceActor->GetUserMatrix(); + this->GetMatrix(matrix); + matrix = myEdgeActor->GetUserMatrix(); break; } this->GetMatrix(matrix); @@ -362,17 +362,20 @@ void VISU_MeshAct::Render(vtkRenderer *ren, vtkMapper *vtkNotUsed(m)) myNodeActor->Render(ren,bestMapper); break; case 1: //WIREFRAME - //PAL5268: myEdgeActor->Render(ren,bestMapper); + //PAL5268: + myEdgeActor->Render(ren,bestMapper); break; case 2: //SURFACE mySurfaceActor->Render(ren,bestMapper); break; case 3: //INSIDEFRAME - //PAL5268: myEdgeActor->Render(ren,bestMapper); + //PAL5268: + myEdgeActor->Render(ren,bestMapper); break; case 4: //SURFACEFRAME - //PAL5268: myEdgeActor->Render(ren,bestMapper); + //PAL5268: mySurfaceActor->Render(ren,bestMapper); + myEdgeActor->Render(ren,bestMapper); break; } @@ -383,7 +386,8 @@ void VISU_MeshAct::Render(vtkRenderer *ren, vtkMapper *vtkNotUsed(m)) void VISU_MeshAct::Modified() { myNodeActor->Modified(); - //PAL5268: myEdgeActor->Modified(); + //PAL5268: + myEdgeActor->Modified(); mySurfaceActor->Modified(); this->vtkActor::Modified(); } diff --git a/src/OBJECT/VISU_ScalarMapAct.cxx b/src/OBJECT/VISU_ScalarMapAct.cxx index 01449f79..391ec412 100644 --- a/src/OBJECT/VISU_ScalarMapAct.cxx +++ b/src/OBJECT/VISU_ScalarMapAct.cxx @@ -35,7 +35,9 @@ vtkStandardNewMacro(VISU_ScalarMapAct); -VISU_ScalarMapAct::VISU_ScalarMapAct(){ +VISU_ScalarMapAct +::VISU_ScalarMapAct() +{ myScalarBar = VISU_ScalarBarActor::New(); vtkProperty* aProperty = GetProperty(); @@ -49,32 +51,49 @@ VISU_ScalarMapAct::VISU_ScalarMapAct(){ myProperty->DeepCopy(aProperty); } -VISU_ScalarMapAct::~VISU_ScalarMapAct(){ +VISU_ScalarMapAct +::~VISU_ScalarMapAct() +{ myScalarBar->Delete(); } -void VISU_ScalarMapAct::AddToRender(vtkRenderer* theRenderer){ - SALOME_Actor::AddToRender(theRenderer); +void +VISU_ScalarMapAct +::AddToRender(vtkRenderer* theRenderer) +{ + VISU_Actor::AddToRender(theRenderer); if(myScalarBar) theRenderer->AddActor2D(myScalarBar); } -void VISU_ScalarMapAct::RemoveFromRender(vtkRenderer* theRenderer){ - SALOME_Actor::RemoveFromRender(theRenderer); +void +VISU_ScalarMapAct +::RemoveFromRender(vtkRenderer* theRenderer) +{ + VISU_Actor::RemoveFromRender(theRenderer); if(myScalarBar) theRenderer->RemoveActor(myScalarBar); } -void VISU_ScalarMapAct::SetVisibility(int theMode){ - SALOME_Actor::SetVisibility(theMode); +void +VISU_ScalarMapAct +::SetVisibility(int theMode) +{ + VISU_Actor::SetVisibility(theMode); if(myScalarBar) myScalarBar->SetVisibility(myBarVisibility && theMode); } -int VISU_ScalarMapAct::GetVisibility(){ - return SALOME_Actor::GetVisibility(); +int +VISU_ScalarMapAct +::GetVisibility() +{ + return VISU_Actor::GetVisibility(); } -void VISU_ScalarMapAct::SetBarVisibility(bool theMode){ +void +VISU_ScalarMapAct +::SetBarVisibility(bool theMode) +{ myBarVisibility = theMode; if(myScalarBar) myScalarBar->SetVisibility(myBarVisibility); } diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 38f90691..5d67cbe3 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -814,7 +814,6 @@ OnEraseAll() for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) { if (anActor->GetVisibility() > 0) if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) { - anVISUActor = anVISUActor->GetParent(); anVISUActor->VisibilityOff(); } } diff --git a/src/VISUGUI/VisuGUI_Prs3dTools.h b/src/VISUGUI/VisuGUI_Prs3dTools.h index 63444a99..aef3c0a1 100644 --- a/src/VISUGUI/VisuGUI_Prs3dTools.h +++ b/src/VISUGUI/VisuGUI_Prs3dTools.h @@ -44,24 +44,24 @@ namespace VISU EditPrs3d(VisuGUI* theModule, VISU::Prs3d_i* thePrs3d) { - if(TPrs3d_i* aPrsObject = dynamic_cast(thePrs3d)){ + if(TPrs3d_i* aPrs3d = dynamic_cast(thePrs3d)){ TDlg* aDlg = new TDlg (theModule); - aDlg->initFromPrsObject(aPrsObject); + aDlg->initFromPrsObject(aPrs3d); if (aDlg->exec()) { - if (!(aDlg->storeToPrsObject(aPrsObject))) { + if (!(aDlg->storeToPrsObject(aPrs3d))) { delete aDlg; return; } - RecreateActor(theModule,aPrsObject); + aPrs3d->UpdateActors(); typedef typename TViewer::TViewWindow TViewWindow; - if(TViewWindow* aViewWindow = GetViewWindow(theModule,true)){ + if(TViewWindow* aViewWindow = GetViewWindow(theModule)){ aViewWindow->getRenderer()->ResetCameraClippingRange(); aViewWindow->Repaint(); } // Optionally, create table and curves for cut lines QApplication::setOverrideCursor(Qt::waitCursor); CreateCurves( theModule, - dynamic_cast( aPrsObject ), + dynamic_cast( aPrs3d ), aDlg, false ); // in edition mode QApplication::restoreOverrideCursor(); diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.cxx b/src/VISUGUI/VisuGUI_TimeAnimation.cxx index 0598764e..8ff2718a 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.cxx +++ b/src/VISUGUI/VisuGUI_TimeAnimation.cxx @@ -94,7 +94,7 @@ ArrangeDlg::ArrangeDlg(QWidget* theParent, SVTK_ViewWindow* theViewWindow) VISU_Actor* anVISUActor = dynamic_cast(anActor); if (anVISUActor) if (anVISUActor->GetVisibility() != 0) { - VISU::Prs3d_i* aPrs = anVISUActor->GetParent()->GetPrs3d(); + VISU::Prs3d_i* aPrs = anVISUActor->GetPrs3d(); if (aPrs) { if (!myPrsMap.contains(aPrs)) { SALOMEDS::SObject_var aSObject = aPrs->GetSObject(); diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index a4f91d61..85a6db88 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -671,12 +671,12 @@ namespace VISU VISU::Prs3d_i* aPrs = anVISUActor->GetPrs3d(); if(aPrs == NULL) continue; if (thePrs == aPrs) { - aResActor = anVISUActor->GetParent(); + aResActor = anVISUActor; thePrs->UpdateActor(aResActor); aResActor->VisibilityOn(); } else if (theDispOnly) { - anVISUActor->GetParent()->VisibilityOff(); + anVISUActor->VisibilityOff(); } else { } } else if (theDispOnly && anActor->GetVisibility()) { @@ -726,7 +726,7 @@ namespace VISU if(vtkRenderer* aRenderer = theViewWindow->getRenderer()){ if(vtkActorCollection* aCollection = aRenderer->GetActors()){ if(VISU_Actor* anActor = Find(aCollection,TIsSameEntry(theEntry))){ - return anActor->GetParent(); + return anActor; } } } diff --git a/src/VISUGUI/VisuGUI_ViewTools.h b/src/VISUGUI/VisuGUI_ViewTools.h index fb288f78..8a12e3c7 100644 --- a/src/VISUGUI/VisuGUI_ViewTools.h +++ b/src/VISUGUI/VisuGUI_ViewTools.h @@ -139,11 +139,11 @@ namespace VISU if(VISU_Actor* anActor = dynamic_cast(anAct)){ if(VISU::Prs3d_i* aPrs3d = anActor->GetPrs3d()){ if(thePrs == aPrs3d){ - aResActor = anActor->GetParent(); - thePrs->UpdateActor(aResActor); + aResActor = anActor; + thePrs->UpdateActors(); aResActor->VisibilityOn(); }else if(theDispOnly){ - anActor->GetParent()->VisibilityOff(); + anActor->VisibilityOff(); } }else if(theDispOnly && anActor->GetVisibility()){ anActor->VisibilityOff(); @@ -178,7 +178,6 @@ namespace VISU while(vtkActor *anAct = aCollection->GetNextActor()){ if(anAct->GetVisibility() > 0) if(VISU_Actor* anActor = dynamic_cast(anAct)){ - anActor = anActor->GetParent(); anActor->VisibilityOff(); } } @@ -208,7 +207,7 @@ namespace VISU if(vtkRenderer* aRenderer = theViewWindow->getRenderer()){ if(vtkActorCollection* aCollection = aRenderer->GetActors()){ if(VISU_Actor* anActor = Find(aCollection,TIsSameEntry(theEntry))){ - return anActor->GetParent(); + return anActor; } } } diff --git a/src/VISU_I/Makefile.in b/src/VISU_I/Makefile.in index d8631a47..af558c6f 100644 --- a/src/VISU_I/Makefile.in +++ b/src/VISU_I/Makefile.in @@ -18,53 +18,115 @@ VPATH=.:@srcdir@:@top_srcdir@/idl # Libraries targets LIB = libVISUEngineImpl.la -LIB_SRC = VISUConfig.cc VISU_Gen_i.cc \ - VISU_Result_i.cc VISU_PrsObject_i.cc VISU_Table_i.cc \ - VISU_Prs3d_i.cc VISU_Mesh_i.cc VISU_ScalarMap_i.cc \ - VISU_IsoSurfaces_i.cc VISU_DeformedShape_i.cc \ - VISU_Plot3D_i.cc VISU_CutPlanes_i.cc VISU_CutLines_i.cc \ - VISU_Vectors_i.cc VISU_StreamLines_i.cc VISU_GaussPoints_i.cc \ - VISU_ViewManager_i.cc VISU_View_i.cc \ - VISU_TimeAnimation.cxx VISU_CorbaMedConvertor.cxx \ +LIB_SRC = \ + VISUConfig.cc \ + VISU_Gen_i.cc \ + VISU_Result_i.cc \ + VISU_PrsObject_i.cc \ + VISU_Table_i.cc \ + VISU_Prs3d_i.cc \ + VISU_Mesh_i.cc \ + VISU_ScalarMap_i.cc \ + VISU_IsoSurfaces_i.cc \ + VISU_DeformedShape_i.cc \ + VISU_Plot3D_i.cc \ + VISU_CutPlanes_i.cc \ + VISU_CutLines_i.cc \ + VISU_Vectors_i.cc \ + VISU_StreamLines_i.cc \ + VISU_GaussPoints_i.cc \ + VISU_ViewManager_i.cc \ + VISU_View_i.cc \ + VISU_TimeAnimation.cxx \ + VISU_CorbaMedConvertor.cxx \ VISU_DumpPython.cc -LIB_MOC = VISU_TimeAnimation.h +LIB_MOC = \ + VISU_TimeAnimation.h -LIB_SERVER_IDL = VISU_Gen.idl SALOME_Component.idl \ - SALOME_Exception.idl SALOME_GenericObj.idl MED.idl +LIB_SERVER_IDL = \ + MED.idl \ + VISU_Gen.idl \ + SALOME_Component.idl \ + SALOME_Exception.idl \ + SALOME_GenericObj.idl -LIB_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Comm.idl +LIB_CLIENT_IDL = \ + SALOMEDS.idl \ + SALOMEDS_Attributes.idl \ + SALOME_Comm.idl # Executables targets -BIN = +BIN = VISU_I BIN_SRC = BIN_CLIENT_IDL = BIN_SERVER_IDL = -EXPORT_HEADERS = VISUConfig.hh VISU_Gen_i.hh \ - VISU_Result_i.hh VISU_PrsObject_i.hh VISU_Table_i.hh \ - VISU_Prs3d_i.hh VISU_Mesh_i.hh VISU_ScalarMap_i.hh \ - VISU_IsoSurfaces_i.hh VISU_DeformedShape_i.hh \ - VISU_Plot3D_i.hh VISU_CutPlanes_i.hh VISU_CutLines_i.hh \ - VISU_Vectors_i.hh VISU_StreamLines_i.hh VISU_GaussPoints_i.hh \ - VISU_ViewManager_i.hh VISU_View_i.hh \ +EXPORT_HEADERS = \ + VISUConfig.hh \ + VISU_Gen_i.hh \ + VISU_Result_i.hh \ + VISU_PrsObject_i.hh \ + VISU_Table_i.hh \ + VISU_Prs3d_i.hh \ + VISU_Mesh_i.hh \ + VISU_ScalarMap_i.hh \ + VISU_IsoSurfaces_i.hh \ + VISU_DeformedShape_i.hh \ + VISU_Plot3D_i.hh \ + VISU_CutPlanes_i.hh \ + VISU_CutLines_i.hh \ + VISU_Vectors_i.hh \ + VISU_StreamLines_i.hh \ + VISU_GaussPoints_i.hh \ + VISU_ViewManager_i.hh \ + VISU_View_i.hh \ VISU_TimeAnimation.h # additionnal information to compil and link file -CPPFLAGS += -ftemplate-depth-32 $(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) \ - $(HDF5_INCLUDES) $(QWT_INCLUDES) $(BOOST_CPPFLAGS)\ +CPPFLAGS += \ + -ftemplate-depth-32 \ + $(QT_INCLUDES) \ + $(PYTHON_INCLUDES) \ + $(OCC_INCLUDES) \ + $(VTK_INCLUDES) \ + $(HDF5_INCLUDES) \ + $(QWT_INCLUDES) \ + $(BOOST_CPPFLAGS)\ -I${KERNEL_ROOT_DIR}/include/salome \ -I${MED_ROOT_DIR}/include/salome \ -I${GUI_ROOT_DIR}/include/salome -LDFLAGS += $(PYTHON_LIBS) $(QT_MT_LIBS) $(VTK_LIBS) $(QWT_LIBS) -lSalomeNS -lTOOLSDS \ - -lSalomeContainer -lOpUtil -lSalomeApp -lVTKViewer -lSVTK -lSPlot2d -lSalomeHDFPersist \ - -lSalomeGenericObj -lVisuConvertor -lVisuPipeLine -lVisuObject -lVISUGUITOOLS \ +LDFLAGS += \ + $(PYTHON_LIBS) \ + $(QT_MT_LIBS) \ + $(VTK_LIBS) \ + $(QWT_LIBS) \ + $(BOOST_LIBS) \ -L${KERNEL_ROOT_DIR}/lib/salome \ - -L${GUI_ROOT_DIR}/lib/salome -lEvent - -LIBS+= -lPlot2d -L${KERNEL_ROOT_DIR}/lib/salome + -L${GUI_ROOT_DIR}/lib/salome + +LIBS+= -lboost_signals-mt \ + -lSalomeHDFPersist \ + -lSalomeGenericObj \ + -lSalomeContainer \ + -lSalomeNS \ + -lTOOLSDS \ + -lOpUtil \ + -lEvent \ + -lCASCatch \ + -lSalomeApp \ + -lSalomeSession \ + -lVTKViewer \ + -lSVTK \ + -lSPlot2d \ + -lVisuConvertor \ + -lVisuPipeLine \ + -lVisuObject \ + -lVISUGUITOOLS + +LDFLAGSFORBIN=$(LDFLAGS) $(LIBS) # additional file to be cleaned MOSTLYCLEAN = diff --git a/src/VISU_I/VISUConfig.hh b/src/VISU_I/VISUConfig.hh index 3224f05a..6ec9a2d0 100644 --- a/src/VISU_I/VISUConfig.hh +++ b/src/VISU_I/VISUConfig.hh @@ -39,8 +39,8 @@ #include "Utils_CorbaException.hxx" #include "utilities.h" -#include -#include +#include "SALOMEDSClient_SObject.hxx" +#include "SALOMEDSClient_Study.hxx" // QT headers #include @@ -61,8 +61,8 @@ class SUIT_Session; class SUIT_ResourceMgr; - -namespace VISU{ +namespace VISU +{ SUIT_Session *GetSession(); SUIT_ResourceMgr *GetResourceMgr(); diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index 198e30cd..0c903097 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -41,8 +41,12 @@ static int MYDEBUG = 0; //---------------------------------------------------------------------------- int VISU::GaussPoints_i -::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, int theIteration, int isMemoryCheck) +::IsPossible(Result_i* theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + int theIteration, + int isMemoryCheck) { try{ if(theEntity != VISU::NODE) @@ -110,7 +114,7 @@ VISU::GaussPoints_i ::Create(const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, int theIteration) { - return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration); + return VISU::ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration); } @@ -120,7 +124,7 @@ VISU::GaussPoints_i ::Restore(const Storable::TRestoringMap& theMap) { DoHook(); - return ScalarMap_i::Restore(theMap); + return VISU::ScalarMap_i::Restore(theMap); } @@ -129,7 +133,7 @@ void VISU::GaussPoints_i ::ToStream(std::ostringstream& theStr) { - ScalarMap_i::ToStream(theStr); + VISU::ScalarMap_i::ToStream(theStr); } @@ -217,6 +221,15 @@ VISU::GaussPoints_i } +//---------------------------------------------------------------------------- +VISU_Actor* +VISU::GaussPoints_i +::CloneActor(VISU_Actor* theActor) +{ + VISU::ScalarMap_i::CloneActor(theActor); +} + + //---------------------------------------------------------------------------- void VISU::GaussPoints_i diff --git a/src/VISU_I/VISU_GaussPoints_i.hh b/src/VISU_I/VISU_GaussPoints_i.hh index 1d12e509..81737c2a 100644 --- a/src/VISU_I/VISU_GaussPoints_i.hh +++ b/src/VISU_I/VISU_GaussPoints_i.hh @@ -99,6 +99,7 @@ namespace VISU Storable* Restore(const Storable::TRestoringMap& theMap); + //---------------------------------------------------------------------------- virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); @@ -107,6 +108,11 @@ namespace VISU void UpdateActor(VISU_Actor* theActor); + virtual + VISU_Actor* + CloneActor(VISU_Actor* theActor); + + //---------------------------------------------------------------------------- virtual void SetImplicitFunction(VISU_Actor* theActor, diff --git a/src/VISU_I/VISU_Gen_i.cc b/src/VISU_I/VISU_Gen_i.cc index a6f437c1..58c7a2dd 100644 --- a/src/VISU_I/VISU_Gen_i.cc +++ b/src/VISU_I/VISU_Gen_i.cc @@ -90,7 +90,7 @@ using namespace std; static QFileInfo aFileInfo; #ifdef _DEBUG_ -static int MYDEBUG = 1; +static int MYDEBUG = 0; #else static int MYDEBUG = 0; #endif @@ -427,8 +427,8 @@ namespace VISU{ if (SUIT_Study* aSStudy = anApp->activeStudy()) { if (SalomeApp_Study* aStudy = dynamic_cast(aSStudy)) { if (_PTR(Study) aCStudy = aStudy->studyDS()) { - MESSAGE("There is an application with active study : StudyId = " - << aCStudy->StudyId() << "; Name = '" << aCStudy->Name() << "'"); + if(MYDEBUG) MESSAGE("There is an application with active study : StudyId = " + << aCStudy->StudyId() << "; Name = '" << aCStudy->Name() << "'"); if (myStudyName == aCStudy->Name()) { isActive = true; break; @@ -450,12 +450,12 @@ namespace VISU{ { CORBA::String_var aName = theStudy->Name(); std::string aStudyName (aName.in()); - MESSAGE("StudyId = " << theStudy->StudyId() << "; Name = '" << aName.in() << "'"); + if(MYDEBUG) MESSAGE("StudyId = " << theStudy->StudyId() << "; Name = '" << aName.in() << "'"); myStudyDocument = SALOMEDS::Study::_duplicate(theStudy); ProcessVoidEvent(new TEvent(aStudyName)); } else { - MESSAGE("CORBA::is_nil(theStudy)"); + INFOS("CORBA::is_nil(theStudy)"); } } diff --git a/src/VISU_I/VISU_I.cxx b/src/VISU_I/VISU_I.cxx new file mode 100644 index 00000000..a3a39f28 --- /dev/null +++ b/src/VISU_I/VISU_I.cxx @@ -0,0 +1,54 @@ +// SALOME VTKViewer : build VTK viewer into Salome desktop +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : +// Author : +// Module : +// $Header$ + +#include "VISUConfig.hh" +#include "VISU_Gen_i.hh" +#include "VISU_Result_i.hh" +#include "VISU_PrsObject_i.hh" +#include "VISU_Table_i.hh" +#include "VISU_Prs3d_i.hh" +#include "VISU_Mesh_i.hh" +#include "VISU_ScalarMap_i.hh" +#include "VISU_IsoSurfaces_i.hh" +#include "VISU_DeformedShape_i.hh" +#include "VISU_DeformedShape_i.hh" +#include "VISU_Plot3D_i.hh" +#include "VISU_CutPlanes_i.hh" +#include "VISU_CutLines_i.hh" +#include "VISU_Vectors_i.hh" +#include "VISU_StreamLines_i.hh" +#include "VISU_GaussPoints_i.hh" +#include "VISU_ViewManager_i.hh" +#include "VISU_View_i.hh" +#include "VISU_TimeAnimation.h" + +int +main(int argc, char** argv) +{ + return 0; +} diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index 7f100536..f59c88d3 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -25,18 +25,21 @@ // Module : VISU #include "VISU_PipeLine.hxx" -#include "VISU_Result_i.hh" #include "VISU_Prs3d_i.hh" + +#include "VISU_Result_i.hh" #include "VISU_Actor.h" #include #include +#include + using namespace VISU; using namespace std; #ifdef _DEBUG_ -static int MYDEBUG = 0; +static int MYDEBUG = 1; #else static int MYDEBUG = 0; #endif @@ -187,8 +190,10 @@ VISU::Prs3d_i anIO = new SALOME_InteractiveObject(mySObject->GetID(),"VISU",GetName()); theActor->setIO(anIO); } - theActor->SetPipeLine(GetPipeLine()); theActor->SetFactory(this); + myUpdateActorsSignal.connect(boost::bind(&VISU_Actor::Update,theActor)); + + theActor->SetPipeLine(GetPipeLine()); theActor->SetPrs3d(this); theActor->SetPosition(myOffset); }catch(std::bad_alloc& ex){ @@ -211,6 +216,24 @@ VISU::Prs3d_i theActor->Modified(); } +VISU_Actor* +VISU::Prs3d_i +::CloneActor(VISU_Actor* theActor) +{ + VISU_Actor* anActor = CreateActor(); + theActor->Connect(anActor); + return anActor; +} + +void +VISU::Prs3d_i +::UpdateActors() +{ + if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActors() - this = "< +#include class VISU_PipeLine; class VISU_Actor; @@ -98,6 +100,8 @@ namespace VISU SALOMEDS::SObject_var mySObject; std::string myMeshName; + boost::signal0 myUpdateActorsSignal; + void CreateActor(VISU_Actor* theActor, const Handle(SALOME_InteractiveObject)& theIO = NULL); @@ -138,6 +142,14 @@ namespace VISU void UpdateActor(VISU_Actor* theActor); + virtual + VISU_Actor* + CloneActor(VISU_Actor* theActor); + + virtual + void + UpdateActors(); + //---------------------------------------------------------------------------- virtual void diff --git a/src/VISU_I/VISU_ViewManager_i.cc b/src/VISU_I/VISU_ViewManager_i.cc index b3b88b49..2db4d2a3 100644 --- a/src/VISU_I/VISU_ViewManager_i.cc +++ b/src/VISU_I/VISU_ViewManager_i.cc @@ -295,7 +295,7 @@ namespace VISU { if(anActor->IsA("VISU_Actor")){ anVISUActor = VISU_Actor::SafeDownCast(anActor); if (thePrs == anVISUActor->GetPrs3d()) { - aResActor = anVISUActor->GetParent(); + aResActor = anVISUActor; if(theDisplaing < eErase) aResActor->VisibilityOn(); else @@ -456,7 +456,7 @@ namespace VISU { while (vtkActor *anActor = anActColl->GetNextActor()) if (VISU_Actor* anVISUActor = dynamic_cast(anActor)) if (thePrs3d == anVISUActor->GetPrs3d()) - return anVISUActor->GetParent(); + return anVISUActor; return NULL; } @@ -688,7 +688,7 @@ namespace VISU { for (; !anActor && aVTKActor; aVTKActor = anActColl->GetNextActor()) { if (VISU_Actor* anVISUActor = dynamic_cast(aVTKActor)) { if (thePrs == anVISUActor->GetPrs3d()) { - anActor = anVISUActor->GetParent(); + anActor = anVISUActor; } } } diff --git a/src/VVTK/VVTK_Renderer.cxx b/src/VVTK/VVTK_Renderer.cxx index 6cf390b7..0c8fec25 100644 --- a/src/VVTK/VVTK_Renderer.cxx +++ b/src/VVTK/VVTK_Renderer.cxx @@ -140,6 +140,12 @@ VVTK_Renderer2 myImplicitFunctionWidget1->AddObserver(vtkCommand::EndInteractionEvent, myEventCallbackCommand.GetPointer(), myPriority); + myImplicitFunctionWidget1->AddObserver(vtkCommand::EnableEvent, + myEventCallbackCommand.GetPointer(), + myPriority); + myImplicitFunctionWidget1->AddObserver(vtkCommand::DisableEvent, + myEventCallbackCommand.GetPointer(), + myPriority); myImplicitFunction = myImplicitFunctionWidget1->ImplicitFunction(); } diff --git a/src/VVTK/VVTK_ViewWindow.cxx b/src/VVTK/VVTK_ViewWindow.cxx index 17452337..5d1801e4 100755 --- a/src/VVTK/VVTK_ViewWindow.cxx +++ b/src/VVTK/VVTK_ViewWindow.cxx @@ -94,7 +94,7 @@ VVTK_ViewWindow SVTK_ViewWindow::AddActor(theActor,theIsUpdate); if(VISU_Actor* anAct = dynamic_cast(theActor)) if(VISU::TActorFactory* aFactory = anAct->GetFactory()) - if(VISU_Actor* anActor = aFactory->CreateActor()) + if(VISU_Actor* anActor = aFactory->CloneActor(anAct)) myMainWindow2->AddActor(anActor,theIsUpdate); } @@ -108,6 +108,15 @@ VVTK_ViewWindow myMainWindow2->RemoveActor(theActor,theIsUpdate); } +//---------------------------------------------------------------------------- +void +VVTK_ViewWindow +::Repaint(bool theUpdateTrihedron) +{ + myMainWindow->Repaint(theUpdateTrihedron); + myMainWindow2->Repaint(theUpdateTrihedron); +} + //---------------------------------------------------------------------------- void VVTK_ViewWindow diff --git a/src/VVTK/VVTK_ViewWindow.h b/src/VVTK/VVTK_ViewWindow.h index 0aacd4c9..b60b095d 100755 --- a/src/VVTK/VVTK_ViewWindow.h +++ b/src/VVTK/VVTK_ViewWindow.h @@ -22,6 +22,10 @@ public: virtual ~VVTK_ViewWindow(); + virtual + void + Initialize(SVTK_ViewModelBase* theModel); + virtual void AddActor(VTKViewer_Actor* theActor, @@ -34,7 +38,7 @@ public: virtual void - Initialize(SVTK_ViewModelBase* theModel); + Repaint(bool theUpdateTrihedron = true); public slots: virtual -- 2.39.2