From 4e2dc7b82b1a210bed5cb10a3e152a1e75159d38 Mon Sep 17 00:00:00 2001 From: apo Date: Mon, 26 Sep 2005 14:25:37 +0000 Subject: [PATCH] To implement inside/outside Gauss Points representation --- src/VISU_I/VISU_GaussPoints_i.cc | 68 ++++++++++++++++++++++++++------ src/VISU_I/VISU_GaussPoints_i.hh | 34 +++++++++------- src/VISU_I/VISU_Prs3d_i.cc | 4 +- src/VVTK/VVTK_Renderer.cxx | 36 ++++++++++++----- src/VVTK/VVTK_Renderer.h | 10 ++++- src/VVTK/VVTK_View.cxx | 22 ++++++++++- src/VVTK/VVTK_View.h | 6 ++- src/VVTK/VVTK_ViewModel.cxx | 3 +- src/VVTK/VVTK_ViewWindow.cxx | 12 ++++++ src/VVTK/VVTK_ViewWindow.h | 4 ++ 10 files changed, 156 insertions(+), 43 deletions(-) diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index 2743288e..aad5a8bc 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -188,6 +188,38 @@ VISU::GaussPoints_i myIsColored = theColored; } +bool +VISU::GaussPoints_i +::SetMainTexture( const QString& theMainTexture ) +{ + bool update = myMainTexture != theMainTexture; + myMainTexture = theMainTexture; + return update; +} + +const QString& +VISU::GaussPoints_i +::GetMainTexture() +{ + return myMainTexture; +} + +bool +VISU::GaussPoints_i +::SetAlphaTexture( const QString& theAlphaTexture ) +{ + bool update = myAlphaTexture != theAlphaTexture; + myAlphaTexture = theAlphaTexture; + return update; +} + +const QString& +VISU::GaussPoints_i +::GetAlphaTexture() +{ + return myAlphaTexture; +} + //---------------------------------------------------------------------------- void @@ -234,8 +266,8 @@ VISU_PipeLine* VISU::GaussPoints_i ::GetPipeLine() { - // We create a new PipeLine instamce in order to provide - // different representation for different actors (basic and segmented) + // We create a new PipeLine instance in order to provide + // different representations for different actors (basic and segmented) VISU_GaussPointsPL* aPipeLine = VISU_GaussPointsPL::New(); aPipeLine->ShallowCopy(myPipeLine); aPipeLine->Update(); @@ -244,13 +276,15 @@ VISU::GaussPoints_i //---------------------------------------------------------------------------- -VISU_Actor* +VISU_GaussPtsAct* VISU::GaussPoints_i -::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +::OnCreateActor(bool theIsSegmented, + const Handle(SALOME_InteractiveObject)& theIO) { - VISU_GaussPtsAct* anActor = VISU_GaussPtsAct::New(); + VISU_GaussPtsAct* anActor = VISU_GaussPtsAct::New(theIsSegmented); try{ VISU::Prs3d_i::CreateActor(anActor,theIO); + anActor->GetPipeLine()->Delete(); anActor->SetRepresentation(VTK_POINTS); UpdateActor(anActor); }catch(...){ @@ -260,12 +294,20 @@ VISU::GaussPoints_i return anActor; } +VISU_Actor* +VISU::GaussPoints_i +::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +{ + return OnCreateActor(false,theIO); +} + //---------------------------------------------------------------------------- VISU_GaussPtsAct* VISU::GaussPoints_i ::CloneActor(VISU_GaussPtsAct* theActor) { - if(VISU_GaussPtsAct* anActor = dynamic_cast(CreateActor())){ + if(MYDEBUG) MESSAGE("GaussPoints_i::CloneActor - this = "<Connect(anActor); return anActor; } @@ -290,7 +332,6 @@ VISU::GaussPoints_i myColor.blue() / 255.0); } VISU::ScalarMap_i::UpdateActor(theActor); - anActor->GetPSMapper()->ShallowCopy(myGaussPointsPL->GetPSMapper()); } } @@ -299,9 +340,8 @@ void VISU::GaussPoints_i ::UpdateFromActor(VISU_GaussPtsAct* theActor) { - bool aChangeMagnification = theActor->ChangeMagnification(); if(MYDEBUG) MESSAGE("GaussPoints_i::UpdateFromActor - this = "<ChangeMagnification(aChangeMagnification); + myGaussPointsPL->ChangeMagnification(theActor->ChangeMagnification()); UpdateActors(); } @@ -331,8 +371,12 @@ VISU::GaussPoints_i //cout << command2.latin1() << endl; bool convertAlphaTexture = system( command2.latin1() ) == 0; - if( convertMainTexture && convertAlphaTexture ) - myGaussPointsPL->SetImageData( VISU_GaussPointsPL::MakeTexture( mainTextureVTI.latin1(), - alphaTextureVTI.latin1() ) ); + if( convertMainTexture && convertAlphaTexture ){ + vtkImageData* anImageData = + VISU_GaussPointsPL::MakeTexture( mainTextureVTI.latin1(), + alphaTextureVTI.latin1()); + myGaussPointsPL->SetImageData( anImageData ); + anImageData->Delete(); + } } diff --git a/src/VISU_I/VISU_GaussPoints_i.hh b/src/VISU_I/VISU_GaussPoints_i.hh index 59ba0d05..b0daf2b5 100644 --- a/src/VISU_I/VISU_GaussPoints_i.hh +++ b/src/VISU_I/VISU_GaussPoints_i.hh @@ -49,9 +49,16 @@ namespace VISU explicit GaussPoints_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject); - virtual ~GaussPoints_i(); - virtual VISU::VISUType GetType() { return VISU::TGAUSSPOINTS;}; + virtual + ~GaussPoints_i(); + + virtual + VISU::VISUType + GetType() + { + return VISU::TGAUSSPOINTS; + } typedef VISU::GaussPoints TInterface; @@ -71,23 +78,16 @@ namespace VISU ShowColored( bool theColored ); bool - SetMainTexture( const QString& theMainTexture ) { - bool update = myMainTexture != theMainTexture; - myMainTexture = theMainTexture; - return update; - } + SetMainTexture( const QString& theMainTexture ); - QString GetMainTexture() { return myMainTexture; } + const QString& + GetMainTexture(); bool - SetAlphaTexture( const QString& theAlphaTexture ) { - bool update = myAlphaTexture != theAlphaTexture; - myAlphaTexture = theAlphaTexture; - return update; - } + SetAlphaTexture( const QString& theAlphaTexture ); - QString - GetAlphaTexture() { return myAlphaTexture; } + const QString& + GetAlphaTexture(); void SetTextures( const QString& theMainTexture, @@ -106,6 +106,10 @@ namespace VISU VISU_PipeLine* GetPipeLine(); + VISU_GaussPtsAct* + OnCreateActor(bool theIsSegmented, + const Handle(SALOME_InteractiveObject)& theIO = NULL); + VISU_GaussPointsPL *myGaussPointsPL; bool myIsColored; diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index 4ef9bfde..3d6fea4d 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -40,7 +40,7 @@ using namespace VISU; using namespace std; #ifdef _DEBUG_ -static int MYDEBUG = 0; +static int MYDEBUG = 1; #else static int MYDEBUG = 0; #endif @@ -233,7 +233,7 @@ VISU::Prs3d_i ::UpdateActor(VISU_Actor* theActor) { if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor - this = "< @@ -50,12 +51,13 @@ VVTK_MainWindowBase { myInteractorStyle->Delete(); - this->moveDockWindow(myToolBar,Qt::DockLeft); + moveDockWindow(myToolBar,Qt::DockLeft); + myActionsMap[NonIsometric]->removeFrom(myToolBar); myPtsToolBar = new QToolBar(this); myPtsToolBar->setCloseMode(QDockWindow::Undocked); myPtsToolBar->setLabel(tr("LBL_TOOLBAR_LABEL")); - this->moveDockWindow(myPtsToolBar,Qt::DockLeft); + moveDockWindow(myPtsToolBar,Qt::DockLeft); QPixmap aPixmap; QtxAction* anAction; @@ -119,6 +121,22 @@ VVTK_MainWindowBase SetSelectionMode(theIsSelectionOn? NodeSelection: ActorSelection); } +//---------------------------------------------------------------------------- +int +convertAction( const int accelAction ); + +void +VVTK_MainWindowBase +::action( const int accelAction ) +{ + if ( accelAction == SUIT_Accel::ZoomFit ) + onFitAll(); + else { + int anEvent = convertAction( accelAction ); + InvokeEvent( anEvent, 0 ); + } +} + //---------------------------------------------------------------------------- VVTK_MainWindow1 diff --git a/src/VVTK/VVTK_View.h b/src/VVTK/VVTK_View.h index 8802bebd..22993d4b 100644 --- a/src/VVTK/VVTK_View.h +++ b/src/VVTK/VVTK_View.h @@ -6,7 +6,7 @@ #endif #include "VVTK.h" -#include "SVTK_View.h" +#include "SVTK_MainWindow.h" class VVTK_Renderer1; class VVTK_Renderer2; @@ -34,6 +34,10 @@ public: void OnInteractorStyleSwitch(bool theIsGaussStyleOn); void OnSelectionModeSwitch(bool theIsSelectionOn); + virtual + void + action( const int ); + protected: QToolBar* myPtsToolBar; vtkSmartPointer myInteractorStyle; diff --git a/src/VVTK/VVTK_ViewModel.cxx b/src/VVTK/VVTK_ViewModel.cxx index cb58635a..e9dd5855 100644 --- a/src/VVTK/VVTK_ViewModel.cxx +++ b/src/VVTK/VVTK_ViewModel.cxx @@ -4,8 +4,9 @@ #include "VVTK_ViewModel.h" #include "VVTK_ViewWindow.h" -#include "SVTK_RenderWindowInteractor.h" #include "SVTK_View.h" +#include "SVTK_MainWindow.h" +#include "SVTK_RenderWindowInteractor.h" #include "VTKViewer_ViewModel.h" diff --git a/src/VVTK/VVTK_ViewWindow.cxx b/src/VVTK/VVTK_ViewWindow.cxx index e27caf23..4ec356c8 100755 --- a/src/VVTK/VVTK_ViewWindow.cxx +++ b/src/VVTK/VVTK_ViewWindow.cxx @@ -29,6 +29,7 @@ #include "VVTK_ViewWindow.h" #include "VVTK_ViewModel.h" #include "VVTK_View.h" +#include "SVTK_View.h" #include "SUIT_Session.h" @@ -210,3 +211,14 @@ VVTK_ViewWindow myMainWindow1->onFitAll(); myMainWindow2->onFitAll(); } + +//---------------------------------------------------------------------------- +void +VVTK_ViewWindow +::action( const int accelAction ) +{ + if(myMainWindow1->hasFocus()) + myMainWindow1->action(accelAction); + if(myMainWindow2->hasFocus()) + myMainWindow2->action(accelAction); +} diff --git a/src/VVTK/VVTK_ViewWindow.h b/src/VVTK/VVTK_ViewWindow.h index 472420f8..bbfb50c1 100755 --- a/src/VVTK/VVTK_ViewWindow.h +++ b/src/VVTK/VVTK_ViewWindow.h @@ -64,6 +64,10 @@ public slots: onFitAll(); protected: + virtual + void + action( const int ); + VVTK_MainWindow1* myMainWindow1; SVTK_View* myView1; -- 2.39.2