]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for the Bug GVIEW10975
authorapo <apo@opencascade.com>
Wed, 21 Dec 2005 14:38:44 +0000 (14:38 +0000)
committerapo <apo@opencascade.com>
Wed, 21 Dec 2005 14:38:44 +0000 (14:38 +0000)
   opacity forgotten

src/OBJECT/VISU_Actor.cxx
src/OBJECT/VISU_GaussPtsAct.cxx
src/OBJECT/VISU_MeshAct.cxx
src/OBJECT/VISU_MeshAct.h

index 7cfc003b5090a7e737e2d907cc8cbc137e2ac2a9..f7dada76f087df1102a04f6aaf8a74cd3914313e 100644 (file)
@@ -413,7 +413,7 @@ VISU_Actor
   if(myIsVTKMapping)
     return Superclass::GetInput();
 
-  return GetCurrentPL()->GetInput();
+  return GetCurrentPL()->GetMapper()->GetInput();
 }
 
 //----------------------------------------------------------------------------
index b0716f9ee8c073a9f005a3f711d4b5ea1c1528e4..f5da6b217c6bb31871737f08c43289fa42e62107 100644 (file)
@@ -241,7 +241,7 @@ VISU_GaussPtsAct
   myDeviceActor->AddToRender(theRenderer);
 
   theRenderer->AddActor(myTextActor.GetPointer());
-  myCellActor->AddToRender(theRenderer);
+  theRenderer->AddActor(myCellActor.GetPointer());
 
   myCursorPyramid->AddToRender(theRenderer);
   myCursorPyramidSelected->AddToRender(theRenderer);
@@ -259,7 +259,7 @@ VISU_GaussPtsAct
   myDeviceActor->RemoveFromRender(theRenderer);
   
   theRenderer->RemoveActor(myTextActor.GetPointer());
-  myCellActor->RemoveFromRender(theRenderer);
+  theRenderer->RemoveActor(myCellActor.GetPointer());
   
   myCursorPyramid->RemoveFromRender(theRenderer);
   myCursorPyramidSelected->RemoveFromRender(theRenderer);
index b078270e071994ef6c048524073d4ae418920eae..bbdb2c9d5c4d9674c83e0f6e3680b71c358c94d2 100644 (file)
 //
 //
 //  File   : VISU_MeshAct.cxx
-//  Author : Laurent CORNABE with the help of Nicolas REJNERI
+//  Author : 
 //  Module : VISU
 //  $Header$
 
 #include "VISU_MeshAct.h"
-#include "VTKViewer_PassThroughFilter.h"
+#include "SVTK_DeviceActor.h"
 
 #include <vtkObjectFactory.h>
 #include <vtkRenderer.h>
 #include <vtkMatrix4x4.h>
 #include <vtkMapperCollection.h>
 
+
+//----------------------------------------------------------------------------
 vtkStandardNewMacro(VISU_MeshAct);
 
-VISU_MeshAct::VISU_MeshAct(){
 
+//----------------------------------------------------------------------------
+VISU_MeshAct
+::VISU_MeshAct()
+{
   vtkMatrix4x4 *m;
   m = vtkMatrix4x4::New();
 
-  mySurfaceActor = VISU_Actor::New();
-  mySurfaceActor->GetProperty()->FrontfaceCullingOff();
-  mySurfaceActor->GetProperty()->BackfaceCullingOff();
+  mySurfaceActor = SVTK_DeviceActor::New();
+  mySurfaceActor->SetRepresentation(SVTK::Representation::Surface);
   mySurfaceActor->SetUserMatrix(m);
-  mySurfaceActor->SetRepresentation(2); //SURFACE
 
-  myEdgeActor = VISU_Actor::New();
-  myEdgeActor->PickableOff();
-  myEdgeActor->GetProperty()->FrontfaceCullingOff();
-  myEdgeActor->GetProperty()->BackfaceCullingOff();
+  myEdgeActor = SVTK_DeviceActor::New();
+  myEdgeActor->SetRepresentation(SVTK::Representation::Wireframe);
   myEdgeActor->SetUserMatrix(m);
-  myEdgeActor->SetRepresentation(1); //WIREFRAME
 
-  myNodeActor = VISU_Actor::New();
-  myNodeActor->PickableOff();
-  myNodeActor->GetProperty()->SetPointSize(SALOME_POINT_SIZE);
-  myNodeActor->GetProperty()->FrontfaceCullingOff();
-  myNodeActor->GetProperty()->BackfaceCullingOff();
+  myNodeActor = SVTK_DeviceActor::New();
+  myNodeActor->SetRepresentation(SVTK::Representation::Points);
   myNodeActor->SetUserMatrix(m);
-  myNodeActor->SetRepresentation(0); //POINT
 
   m->Delete();
-  SetRepresentation(2); //SURFACE
+  SetRepresentation(SVTK::Representation::Surface);
 }
 
-VISU_MeshAct::~VISU_MeshAct(){
+VISU_MeshAct
+::~VISU_MeshAct()
+{
   mySurfaceActor->Delete();
   myEdgeActor->Delete();
   myNodeActor->Delete();
 }
 
-void VISU_MeshAct::setIO(const Handle(SALOME_InteractiveObject)& theIO){
-  VISU_Actor::setIO(theIO);
-  mySurfaceActor->setIO(theIO);
-  myEdgeActor->setIO(theIO);
-  myNodeActor->setIO(theIO);
-}
 
-void VISU_MeshAct::SetPrs3d(VISU::Prs3d_i* thePrs3d){
-  if(thePrs3d){
-    VISU_Actor::SetPrs3d(thePrs3d);
-    mySurfaceActor->SetPrs3d(thePrs3d);
-    myEdgeActor->SetPrs3d(thePrs3d);
-    myNodeActor->SetPrs3d(thePrs3d);
-  }
-}
+//----------------------------------------------------------------------------
+void
+VISU_MeshAct
+::SetMapperInput(vtkDataSet* theDataSet)
+{
+  Superclass::SetMapperInput(theDataSet);
 
-void VISU_MeshAct::AddToRender(vtkRenderer* theRenderer){
-  VISU_Actor::AddToRender(theRenderer);
-  //theRenderer->AddActor(myEdgeActor);
+  mySurfaceActor->SetInput(theDataSet);
+  myEdgeActor->SetInput(theDataSet);
+  myNodeActor->SetInput(theDataSet);
 }
 
-void VISU_MeshAct::RemoveFromRender(vtkRenderer* theRenderer){
-  VISU_Actor::RemoveFromRender(theRenderer);
-  //theRenderer->RemoveActor(myEdgeActor);
-}
 
-void VISU_MeshAct::SetPipeLine(VISU_PipeLine* thePipeLine) {
-  VISU_Actor::SetPipeLine(thePipeLine);
-  mySurfaceActor->SetPipeLine(thePipeLine);
-  myEdgeActor->SetPipeLine(thePipeLine);
-  myNodeActor->SetPipeLine(thePipeLine);
-}
+//----------------------------------------------------------------------------
+void
+VISU_MeshAct
+::SetTransform(VTKViewer_Transform* theTransform)
+{
+  Superclass::SetTransform(theTransform);
 
-void VISU_MeshAct::SetTransform(VTKViewer_Transform* theTransform){
-  VISU_Actor::SetTransform(theTransform);
   mySurfaceActor->SetTransform(theTransform);
   myEdgeActor->SetTransform(theTransform);
   myNodeActor->SetTransform(theTransform);
 }
 
-void VISU_MeshAct::SetShrinkable(bool theIsShrinkable){
-  VISU_Actor::SetShrinkable(theIsShrinkable);
+
+//----------------------------------------------------------------------------
+void
+VISU_MeshAct
+::SetShrinkable(bool theIsShrinkable)
+{
+  Superclass::SetShrinkable(theIsShrinkable);
+
   mySurfaceActor->SetShrinkable(theIsShrinkable);
   myEdgeActor->SetShrinkable(theIsShrinkable);
-  myNodeActor->SetShrinkable(theIsShrinkable);
 }
 
-void VISU_MeshAct::SetShrinkFactor(float theValue){
-  VISU_Actor::SetShrinkFactor(theValue);
+void
+VISU_MeshAct
+::SetShrinkFactor(float theValue)
+{
+  Superclass::SetShrinkFactor(theValue);
+
   mySurfaceActor->SetShrinkFactor(theValue);
   myEdgeActor->SetShrinkFactor(theValue);
 }
 
-vtkProperty* VISU_MeshAct::GetSurfaceProperty(){
-  return mySurfaceActor->GetProperty();
-}
 
-void VISU_MeshAct::SetSurfaceProperty(vtkProperty* theProperty){
-  mySurfaceActor->SetProperty(theProperty);
+//----------------------------------------------------------------------------
+vtkProperty* 
+VISU_MeshAct
+::GetSurfaceProperty()
+{
+  return mySurfaceActor->GetProperty();
 }
 
-vtkProperty* VISU_MeshAct::GetEdgeProperty(){
+vtkProperty* 
+VISU_MeshAct
+::GetEdgeProperty()
+{
   return myEdgeActor->GetProperty();
 }
 
-void VISU_MeshAct::SetEdgeProperty(vtkProperty* theProperty){
-  myEdgeActor->SetProperty(theProperty);
-}
-
-vtkProperty* VISU_MeshAct::GetNodeProperty(){
+vtkProperty* 
+VISU_MeshAct
+::GetNodeProperty()
+{
   return myNodeActor->GetProperty();
 }
 
-void VISU_MeshAct::SetNodeProperty(vtkProperty* theProperty){
-  myNodeActor->SetProperty(theProperty);
-}
-
-void VISU_MeshAct::SetOpacity(float theValue){
+//----------------------------------------------------------------------------
+void
+VISU_MeshAct
+::SetOpacity(float theValue)
+{
   GetSurfaceProperty()->SetOpacity(theValue);
 }
 
-float VISU_MeshAct::GetOpacity(){
+float
+VISU_MeshAct
+::GetOpacity()
+{
   return GetSurfaceProperty()->GetOpacity();
 }
 
-void VISU_MeshAct::SetLineWidth(float theLineWidth){
+//----------------------------------------------------------------------------
+void
+VISU_MeshAct
+::SetLineWidth(float theLineWidth)
+{
   GetEdgeProperty()->SetLineWidth(theLineWidth);
 }
 
-float VISU_MeshAct::GetLineWidth(){
+float
+VISU_MeshAct::GetLineWidth()
+{
   return GetEdgeProperty()->GetLineWidth();
 }
 
-void VISU_MeshAct::SetShrink(){
+//----------------------------------------------------------------------------
+void
+VISU_MeshAct
+::SetShrink()
+{
   if(myRepresentation == VTK_POINTS)
     return;
-  VISU_Actor::SetShrink();
+
+  Superclass::SetShrink();
+
   mySurfaceActor->SetShrink();
   myEdgeActor->SetShrink();
-  //SetRepresentation(GetRepresentation());
 }
 
-void VISU_MeshAct::UnShrink(){
-  VISU_Actor::UnShrink();
+void
+VISU_MeshAct
+::UnShrink()
+{
+  Superclass::UnShrink();
+
   mySurfaceActor->UnShrink();
   myEdgeActor->UnShrink();
-  //SetRepresentation(GetRepresentation());
 }
 
-void VISU_MeshAct::SetRepresentation(int theMode)
+
+//----------------------------------------------------------------------------
+void 
+VISU_MeshAct
+::SetRepresentation(int theMode)
 {
-  SALOME_Actor::SetRepresentation(theMode);
-
-  if (!GetVisibility()) return; // Fix IPAL9555
-
-  mySurfaceActor->VisibilityOff();
-  myEdgeActor->VisibilityOff();
-  myNodeActor->VisibilityOff();
-  myEdgeActor->PickableOff();
-  myNodeActor->PickableOff();
-  switch (theMode) {
-  case VTK_POINTS:
-    myNodeActor->VisibilityOn();
-    myNodeActor->PickableOn();
-    break;
-  case VTK_WIREFRAME:
-    myEdgeActor->VisibilityOn();
-    myEdgeActor->SetRepresentation(1);
-    myEdgeActor->PickableOn();
-    break;
-  case VTK_SURFACE:
-    mySurfaceActor->VisibilityOn();
-    break;
-  case 3: //INSIDEFRAME
-    myEdgeActor->VisibilityOn();
-    myEdgeActor->SetRepresentation(3);
-    myEdgeActor->PickableOn();
-    break;
-  case 4: //SURFACEFRAME
-    myEdgeActor->VisibilityOn();
-    myEdgeActor->SetRepresentation(1);
-    mySurfaceActor->VisibilityOn();
-    break;
-  }
-  if (myRepresentation == VTK_POINTS)
-    UnShrink();
-}
+  Superclass::SetRepresentation(theMode);
 
-void VISU_MeshAct::SetVisibility(int theMode){
-  VISU_Actor::SetVisibility(theMode);
-  if(GetVisibility())
-    SetRepresentation(GetRepresentation());
-  else{
-    myNodeActor->VisibilityOff();
-    myEdgeActor->VisibilityOff();
-    mySurfaceActor->VisibilityOff();
-  }
+  if(theMode == SVTK::Representation::Insideframe)
+    myEdgeActor->SetRepresentation(SVTK::Representation::Insideframe);
+  else
+    myEdgeActor->SetRepresentation(SVTK::Representation::Wireframe);
 }
 
-// From vtkLODActor
-void VISU_MeshAct::Render(vtkRenderer *ren, vtkMapper *vtkNotUsed(m))
+//----------------------------------------------------------------------------
+int
+VISU_MeshAct
+::RenderOpaqueGeometry(vtkViewport *ren)
 {
-  float myTime, bestTime, tempTime;
-  vtkMatrix4x4 *matrix;
-  vtkMapper *mapper, *bestMapper;
-
-  if (this->Mapper == NULL)
-    {
-    vtkErrorMacro("No mapper for actor.");
-    return;
-    }
-
-  // first time through create lods if non have been added
-  if (this->LODMappers->GetNumberOfItems() == 0)
-    {
-    this->CreateOwnLODs();
-    }
-
-  // If the actor has changed or the primary mapper has changed ...
-  // Is this the correct test?
-  if (this->MediumMapper)
-    {
-    if (this->GetMTime() > this->BuildTime ||
-        this->Mapper->GetMTime() > this->BuildTime)
-      {
-      this->UpdateOwnLODs();
-      }
-    }
-
-  // figure out how much time we have to render
-  myTime = this->AllocatedRenderTime;
-
-  // Figure out which resolution to use
-  // none is a valid resolution. Do we want to have a lowest:
-  // bbox, single point, ...
-  // There is no order to the list, so it is assumed that mappers that take
-  // longer to render are better quality.
-  // Timings might become out of date, but we rely on
-
-  bestMapper = this->Mapper;
-  bestTime = bestMapper->GetTimeToDraw();
-  if (bestTime > myTime)
-    {
-    this->LODMappers->InitTraversal();
-    while ((mapper = this->LODMappers->GetNextItem()) != NULL &&
-           bestTime != 0.0)
-      {
-      tempTime = mapper->GetTimeToDraw();
-
-      // If the LOD has never been rendered, select it!
-      if (tempTime == 0.0)
-        {
-        bestMapper = mapper;
-        bestTime = 0.0;
-        }
-      else
-        {
-        if (bestTime > myTime && tempTime < bestTime)
-          {
-          bestMapper = mapper;
-          bestTime = tempTime;
-          }
-        if (tempTime > bestTime && tempTime < myTime)
-          {
-          bestMapper = mapper;
-          bestTime = tempTime;
-          }
-        }
-      }
-    }
-
+  using namespace SVTK::Representation;
   switch(GetRepresentation()){
-  case 0: //POINTS
-    myNodeActor->GetProperty()->Render(this, ren);
+  case Points : 
+    myNodeActor->RenderOpaqueGeometry(ren);
     break;
-  case 1: //WIREFRAME
-    //PAL5268
-    myEdgeActor->GetProperty()->Render(this, ren);
+  case Wireframe : 
+  case Insideframe 
+    myEdgeActor->RenderOpaqueGeometry(ren);
     break;
-  case 2: //SURFACE
-    mySurfaceActor->GetProperty()->Render(this, ren);
+  case Surface : 
+    mySurfaceActor->RenderOpaqueGeometry(ren);
     break;
-  case 3: //INSIDEFRAME
-    //PAL5268: 
-    myEdgeActor->GetProperty()->Render(this, ren);
-    break;
-  case 4: //SURFACEFRAME
-    //PAL5268: 
-    mySurfaceActor->GetProperty()->Render(this, ren);
-    myEdgeActor->GetProperty()->Render(this, ren);
+  case Surfaceframe : 
+    mySurfaceActor->RenderOpaqueGeometry(ren);
+    myEdgeActor->RenderOpaqueGeometry(ren);
     break;
   }
+  return 1;
+}
 
-  // render the texture
-  if (this->Texture)
-    {
-    this->Texture->Render(ren);
-    }
-
-  switch(GetRepresentation()){
-  case 0: //POINTS
-    matrix = myNodeActor->GetUserMatrix();
-    break;
-  case 1: //WIREFRAME
-    matrix = myEdgeActor->GetUserMatrix();
-    break;
-  case 2: //SURFACE
-    matrix = mySurfaceActor->GetUserMatrix();
-    break;
-  case 3: //INSIDEFRAME
-    matrix = myEdgeActor->GetUserMatrix();
-    break;
-  case 4: //SURFACEFRAME
-    matrix = mySurfaceActor->GetUserMatrix();
-    this->GetMatrix(matrix);
-    matrix = myEdgeActor->GetUserMatrix();
-    break;
-  }
-  this->GetMatrix(matrix);
-
+int
+VISU_MeshAct
+::RenderTranslucentGeometry(vtkViewport *ren)
+{
+  using namespace SVTK::Representation;
   switch(GetRepresentation()){
-  case 0: //POINTS
-    myNodeActor->Render(ren,bestMapper);
+  case Points : 
+    myNodeActor->RenderTranslucentGeometry(ren);
     break;
-  case 1: //WIREFRAME
-    //PAL5268
-    myEdgeActor->Render(ren,bestMapper);
+  case Wireframe : 
+  case Insideframe 
+    myEdgeActor->RenderTranslucentGeometry(ren);
     break;
-  case 2: //SURFACE
-    mySurfaceActor->Render(ren,bestMapper);
+  case Surface : 
+    mySurfaceActor->RenderTranslucentGeometry(ren);
     break;
-  case 3: //INSIDEFRAME
-    //PAL5268: 
-    myEdgeActor->Render(ren,bestMapper);
-    break;
-  case 4: //SURFACEFRAME
-    //PAL5268: 
-    mySurfaceActor->Render(ren,bestMapper);
-    myEdgeActor->Render(ren,bestMapper);
+  case Surfaceframe : 
+    mySurfaceActor->RenderTranslucentGeometry(ren);
+    myEdgeActor->RenderTranslucentGeometry(ren);
     break;
   }
-
-  this->EstimatedRenderTime = bestMapper->GetTimeToDraw();
-}
-
-// From vtkLODActor
-void VISU_MeshAct::Modified()
-{
-  myNodeActor->Modified();
-  //PAL5268: 
-  myEdgeActor->Modified();
-  mySurfaceActor->Modified();
-  this->vtkActor::Modified();
+  return 1;
 }
index bacc15c37448be9b192529fb377ba1b7afa8986a..9dafb348faf38f225a112168c77ffe3c31e63f5e 100644 (file)
 #define VISU_MeshAct_HeaderFile
 
 #include "VISU_Actor.h"
-class vtkDataSetMapper;
-
-class VTKOCC_EXPORT VISU_MeshAct : public VISU_Actor {
+#include "SVTK_DeviceActor.h"
+
+namespace SVTK
+{
+  namespace Representation
+  {
+    const Type Surfaceframe = Insideframe + 1;
+  }
+}
+
+class VTKOCC_EXPORT VISU_MeshAct : public VISU_Actor 
+{
  public:
   vtkTypeMacro(VISU_MeshAct,VISU_Actor);
   static VISU_MeshAct* New();
-  ~VISU_MeshAct();
 
-  virtual void setIO(const Handle(SALOME_InteractiveObject)& theIO);
-  virtual void SetPrs3d(VISU::Prs3d_i* thePrs3d);
+  //! Apply view transformation
+  virtual
+  void
+  SetTransform(VTKViewer_Transform* theTransform); 
+
+  virtual
+  vtkProperty* 
+  GetSurfaceProperty(); 
+
+  virtual
+  vtkProperty* 
+  GetEdgeProperty(); 
 
-  virtual void AddToRender(vtkRenderer* theRenderer); 
-  virtual void RemoveFromRender(vtkRenderer* theRenderer);
+  virtual
+  vtkProperty* 
+  GetNodeProperty(); 
 
-  virtual void SetPipeLine(VISU_PipeLine* thePipeLine) ;
-  virtual void SetTransform(VTKViewer_Transform* theTransform); 
+  virtual
+  void
+  SetOpacity(float theValue);
 
-  virtual vtkProperty* GetSurfaceProperty(); 
-  virtual void SetSurfaceProperty(vtkProperty* theProperty);
+  virtual
+  float
+  GetOpacity();
 
-  virtual vtkProperty* GetEdgeProperty(); 
-  virtual void SetEdgeProperty(vtkProperty* theProperty);
+  virtual
+  void
+  SetLineWidth(float theLineWidth);
 
-  virtual vtkProperty* GetNodeProperty(); 
-  virtual void SetNodeProperty(vtkProperty* theProperty);
+  virtual
+  float
+  GetLineWidth();
 
-  virtual void SetOpacity(float theValue);
-  virtual float GetOpacity();
+  virtual
+  void
+  SetRepresentation(int theMode);
 
-  virtual void SetLineWidth(float theLineWidth);
-  virtual float GetLineWidth();
+  virtual
+  void
+  SetShrinkable(bool theIsShrinkable);
 
-  virtual void SetRepresentation(int theMode);
+  virtual
+  void
+  SetShrinkFactor(float theFactor = 0.8); 
 
-  virtual void SetVisibility(int theMode);
+  virtual
+  void
+  SetShrink(); 
 
-  virtual void SetShrinkable(bool theIsShrinkable);
-  virtual void SetShrinkFactor(float theFactor = 0.8); 
+  virtual
+  void
+  UnShrink(); 
 
-  virtual void SetShrink(); 
-  virtual void UnShrink(); 
+  virtual
+  int
+  RenderOpaqueGeometry(vtkViewport *ren);
 
-  virtual void Render(vtkRenderer *, vtkMapper *);
-  void Modified();
+  virtual
+  int
+  RenderTranslucentGeometry(vtkViewport *ren);
 
  protected:
   VISU_MeshAct();
-  VISU_Actor *mySurfaceActor, *myEdgeActor, *myNodeActor;
+  ~VISU_MeshAct();
+
+  virtual 
+  void
+  SetMapperInput(vtkDataSet* theDataSet);
+
+  SVTK_DeviceActor *mySurfaceActor;
+  SVTK_DeviceActor *myEdgeActor;
+  SVTK_DeviceActor *myNodeActor;
 };
 
 #endif