X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSVTK%2FSVTK_View.cxx;h=9ee31b1803a78f48ecd3696248ec22f6d7a4e0a3;hb=91cc8846bfa36302f7ade6cb8aa380f03e90423e;hp=03a9070fef207b3991dc4ada76c3cb8ff6b5a4f5;hpb=e07448c48ea5b2127e34fc7b8c3427d01c7ce17b;p=modules%2Fgui.git diff --git a/src/SVTK/SVTK_View.cxx b/src/SVTK/SVTK_View.cxx index 03a9070fe..9ee31b180 100644 --- a/src/SVTK/SVTK_View.cxx +++ b/src/SVTK/SVTK_View.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -30,7 +30,7 @@ #include "SVTK_Renderer.h" #include "SVTK_ViewWindow.h" #include "SVTK_RenderWindowInteractor.h" -#include "SALOME_ListIteratorOfListIO.hxx" +#include "SALOME_ListIO.hxx" #include "VTKViewer_Algorithm.h" #include "SVTK_Functor.h" @@ -691,12 +691,12 @@ SVTK_View ::SetTransparency(const Handle(SALOME_InteractiveObject)& theIObject, float theTrans) { - vtkFloatingPointType anOpacity = 1.0 - theTrans; + double anOpacity = 1.0 - theTrans; using namespace SVTK; VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors()); ForEachIf(aCopy.GetActors(), TIsSameIObject(theIObject), - TSetFunction + TSetFunction (&SALOME_Actor::SetOpacity,anOpacity)); } @@ -710,13 +710,13 @@ SVTK_View ::SetColor(const Handle(SALOME_InteractiveObject)& theIObject, const QColor& theColor) { - vtkFloatingPointType aColor[3] = {theColor.red()/255., theColor.green()/255., theColor.blue()/255.}; + double aColor[3] = {theColor.red()/255., theColor.green()/255., theColor.blue()/255.}; using namespace SVTK; VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors()); ForEachIf(aCopy.GetActors(), TIsSameIObject(theIObject), - TSetFunction + TSetFunction (&SALOME_Actor::SetColor,aColor)); } @@ -735,7 +735,7 @@ SVTK_View Find(aCopy.GetActors(), TIsSameIObject(theIObject)); if(anActor){ - vtkFloatingPointType r,g,b; + double r,g,b; anActor->GetColor(r,g,b); return QColor(int(r*255),int(g*255),int(b*255)); } @@ -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; }