From d4063f82e8509b0de78450ebda6cb0c82fce031a Mon Sep 17 00:00:00 2001 From: ana Date: Fri, 28 Dec 2012 15:51:47 +0000 Subject: [PATCH] 0021719: EDF 1654 : Materials --- src/SVTK/SVTK_View.cxx | 57 +++++++++++++++++++++---------- src/SVTK/SVTK_View.h | 10 ++++-- src/VTKViewer/VTKViewer_Actor.cxx | 24 +++++++++---- src/VTKViewer/VTKViewer_Actor.h | 19 +++++++---- 4 files changed, 75 insertions(+), 35 deletions(-) diff --git a/src/SVTK/SVTK_View.cxx b/src/SVTK/SVTK_View.cxx index 03a9070fe..5f52ea604 100644 --- a/src/SVTK/SVTK_View.cxx +++ b/src/SVTK/SVTK_View.cxx @@ -746,39 +746,60 @@ SVTK_View /*! Change material \param theIObject - object - \param thePropF - property contained new properties of material + \param thePropF - property contained new properties of front material + \param thePropB - property contained new properties of back material */ void SVTK_View ::SetMaterial(const Handle(SALOME_InteractiveObject)& theIObject, - vtkProperty* thePropF) + vtkProperty* thePropF, vtkProperty* thePropB) { using namespace SVTK; VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors()); std::vector aProps; aProps.push_back( thePropF ); + aProps.push_back( thePropB ); ForEachIf(aCopy.GetActors(), TIsSameIObject(theIObject), TSetFunction > (&SALOME_Actor::SetMaterial,aProps)); } -/*! - Get current front material - \param theIObject - object - \return property contained material properties of the given object -*/ -vtkProperty* -SVTK_View -::GetMaterial(const Handle(SALOME_InteractiveObject)& theIObject) -{ - using namespace SVTK; - VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors()); - SALOME_Actor* anActor = - Find(aCopy.GetActors(), - TIsSameIObject(theIObject)); - if(anActor) - return anActor->GetMaterial(); +/*! + Get current front material + \param theIObject - object + \return property contained front material properties of the given object +*/ +vtkProperty* +SVTK_View +::GetFrontMaterial(const Handle(SALOME_InteractiveObject)& theIObject) +{ + using namespace SVTK; + VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors()); + SALOME_Actor* anActor = + Find(aCopy.GetActors(), + TIsSameIObject(theIObject)); + if(anActor) + return anActor->GetFrontMaterial(); + return NULL; +} + +/*! + Get current back material + \param theIObject - object + \return property contained back material properties of the given object +*/ +vtkProperty* +SVTK_View +::GetBackMaterial(const Handle(SALOME_InteractiveObject)& theIObject) +{ + using namespace SVTK; + VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors()); + SALOME_Actor* anActor = + Find(aCopy.GetActors(), + TIsSameIObject(theIObject)); + if(anActor) + return anActor->GetBackMaterial(); return NULL; } diff --git a/src/SVTK/SVTK_View.h b/src/SVTK/SVTK_View.h index 0542c24f9..1ad3037df 100644 --- a/src/SVTK/SVTK_View.h +++ b/src/SVTK/SVTK_View.h @@ -212,11 +212,15 @@ public: //! Change material void SetMaterial(const Handle(SALOME_InteractiveObject)& theIObject, - vtkProperty* thePropF); + vtkProperty* thePropF, vtkProperty* thePropB); - //! Get current material + //! Get current front material vtkProperty* - GetMaterial(const Handle(SALOME_InteractiveObject)& theIObject); + GetFrontMaterial(const Handle(SALOME_InteractiveObject)& theIObject); + + //! Get current back material + vtkProperty* + GetBackMaterial(const Handle(SALOME_InteractiveObject)& theIObject); //---------------------------------------------------------------------------- // Erase Display functions diff --git a/src/VTKViewer/VTKViewer_Actor.cxx b/src/VTKViewer/VTKViewer_Actor.cxx index 624ed1deb..fc8eda9a2 100755 --- a/src/VTKViewer/VTKViewer_Actor.cxx +++ b/src/VTKViewer/VTKViewer_Actor.cxx @@ -621,13 +621,23 @@ VTKViewer_Actor } /*! - Get current material -*/ -vtkProperty* -VTKViewer_Actor -::GetMaterial() -{ - return NULL; + Get current front material +*/ +vtkProperty* +VTKViewer_Actor +::GetFrontMaterial() +{ + return NULL; +} + +/*! + Get current back material +*/ +vtkProperty* +VTKViewer_Actor +::GetBackMaterial() +{ + return NULL; } /*! diff --git a/src/VTKViewer/VTKViewer_Actor.h b/src/VTKViewer/VTKViewer_Actor.h index 5a385e56c..5225cd6b4 100755 --- a/src/VTKViewer/VTKViewer_Actor.h +++ b/src/VTKViewer/VTKViewer_Actor.h @@ -119,15 +119,20 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor void SetColor(const vtkFloatingPointType theRGB[3]); - //! Change material - virtual - void + //! Change material + virtual + void SetMaterial(std::vector theProps); - //! Get current material - virtual - vtkProperty* - GetMaterial(); + //! Get current front material + virtual + vtkProperty* + GetFrontMaterial(); + + //! Get current back material + virtual + vtkProperty* + GetBackMaterial(); //---------------------------------------------------------------------------- // For selection mapping purpose -- 2.39.2