From 4c81d5b72619513e53ce3f2ae64dbfce6aa0d932 Mon Sep 17 00:00:00 2001 From: enk Date: Fri, 27 May 2005 08:44:06 +0000 Subject: [PATCH] Added transformation T1.5: Graduated scale isn't moved after translate a presentation on Y --- src/VTKFilter/SALOME_CubeAxesActor2D.cxx | 22 +++++++++++++++++++--- src/VTKFilter/SALOME_CubeAxesActor2D.h | 8 +++++++- src/VTKViewer/VTKViewer_ViewFrame.cxx | 11 +++++++++-- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/VTKFilter/SALOME_CubeAxesActor2D.cxx b/src/VTKFilter/SALOME_CubeAxesActor2D.cxx index 8465effc0..43f153411 100644 --- a/src/VTKFilter/SALOME_CubeAxesActor2D.cxx +++ b/src/VTKFilter/SALOME_CubeAxesActor2D.cxx @@ -27,6 +27,7 @@ // $Header$ #include "SALOME_CubeAxesActor2D.h" +#include "SALOME_Transform.h" #include #include @@ -387,17 +388,24 @@ int SALOME_CubeAxesActor2D::RenderOpaqueGeometry(vtkViewport *viewport) xAxes,yAxes,zAxes); + double aTScale[3]; + if(m_Transform.GetPointer() != NULL) + m_Transform->GetScale(aTScale); + this->XAxis->GetPositionCoordinate()->SetValue(xCoords[0], xCoords[1]); this->XAxis->GetPosition2Coordinate()->SetValue(xCoords[2], xCoords[3]); - this->XAxis->SetRange(xRange[0], xRange[1]); + if(m_Transform.GetPointer() != NULL) this->XAxis->SetRange(xRange[0]/aTScale[0], xRange[1]/aTScale[0]); + else this->XAxis->SetRange(xRange[0], xRange[1]); this->YAxis->GetPositionCoordinate()->SetValue(yCoords[2], yCoords[3]); this->YAxis->GetPosition2Coordinate()->SetValue(yCoords[0], yCoords[1]); - this->YAxis->SetRange(yRange[1], yRange[0]); + if(m_Transform.GetPointer() != NULL) this->YAxis->SetRange(yRange[1]/aTScale[1], yRange[0]/aTScale[1]); + else this->YAxis->SetRange(yRange[1], yRange[0]); this->ZAxis->GetPositionCoordinate()->SetValue(zCoords[0], zCoords[1]); this->ZAxis->GetPosition2Coordinate()->SetValue(zCoords[2], zCoords[3]); - this->ZAxis->SetRange(zRange[0], zRange[1]); + if(m_Transform.GetPointer() != NULL) this->ZAxis->SetRange(zRange[0]/aTScale[2], zRange[1]/aTScale[2]); + else this->ZAxis->SetRange(zRange[0], zRange[1]); int numOfLabelsX = this->XAxis->GetNumberOfLabels(); int numOfLabelsY = this->YAxis->GetNumberOfLabels(); @@ -605,3 +613,11 @@ void SALOME_CubeAxesActor2D::ReleaseGraphicsResources(vtkWindow *win) this->wireActorXZ->ReleaseGraphicsResources(win); } + +void SALOME_CubeAxesActor2D::SetTransform(SALOME_Transform* theTransform){ + this->m_Transform = theTransform; +} + +SALOME_Transform* SALOME_CubeAxesActor2D::GetTransform(){ + return (this->m_Transform.GetPointer()); +} diff --git a/src/VTKFilter/SALOME_CubeAxesActor2D.h b/src/VTKFilter/SALOME_CubeAxesActor2D.h index 0f7ef969e..9bb577956 100644 --- a/src/VTKFilter/SALOME_CubeAxesActor2D.h +++ b/src/VTKFilter/SALOME_CubeAxesActor2D.h @@ -29,7 +29,8 @@ #ifndef __SALOME_CubeAxesActor2D_h #define __SALOME_CubeAxesActor2D_h -#include "vtkCubeAxesActor2D.h" +#include +#include class vtkActor; class vtkAxisActor2D; @@ -38,6 +39,7 @@ class vtkDataSet; class vtkTextProperty; class vtkPolyDataMapper; class vtkRectilinearGridGeometryFilter; +class SALOME_Transform; class VTK_HYBRID_EXPORT SALOME_CubeAxesActor2D : public vtkCubeAxesActor2D { @@ -66,6 +68,9 @@ public: vtkActor* GetWireActorXY(){return this->wireActorXY;} vtkActor* GetWireActorYZ(){return this->wireActorYZ;} vtkActor* GetWireActorXZ(){return this->wireActorXZ;} + + void SetTransform(SALOME_Transform* theTransform); + SALOME_Transform* GetTransform(); protected: SALOME_CubeAxesActor2D(); @@ -88,6 +93,7 @@ private: vtkRectilinearGridGeometryFilter *planeXZ; // rectilinear grid XZ vtkPolyDataMapper *rgridMapperXZ; + vtkSmartPointer m_Transform; private: SALOME_CubeAxesActor2D(const SALOME_CubeAxesActor2D&); // Not implemented. void operator=(const SALOME_CubeAxesActor2D&); // Not implemented. diff --git a/src/VTKViewer/VTKViewer_ViewFrame.cxx b/src/VTKViewer/VTKViewer_ViewFrame.cxx index be5019eb9..88fbac9b2 100644 --- a/src/VTKViewer/VTKViewer_ViewFrame.cxx +++ b/src/VTKViewer/VTKViewer_ViewFrame.cxx @@ -152,6 +152,7 @@ void VTKViewer_ViewFrame::InitialSetup() { m_CubeAxes->SetScaling(0); m_CubeAxes->SetNumberOfLabels(5); m_CubeAxes->VisibilityOff(); + m_CubeAxes->SetTransform(m_Transform); tprop->Delete(); setCentralWidget( m_RW ); @@ -227,8 +228,6 @@ void VTKViewer_ViewFrame::AdjustTrihedrons(const bool forced) if ( !aSetting.isEmpty() ) aSizeInPercents = aSetting.toFloat(); bool isComputeTrihedronSize = ::ComputeTrihedronSize(m_Renderer, aNewSize, anOldSize, aSizeInPercents); - if(aTDisplayed) m_Triedron->VisibilityOn(); - if(aCDisplayed) m_CubeAxes->VisibilityOn(); m_Triedron->SetSize( aNewSize ); // itearte throuh displayed objects and set size if necessary @@ -260,7 +259,15 @@ void VTKViewer_ViewFrame::AdjustTrihedrons(const bool forced) } } } + if(aTDisplayed) m_Triedron->VisibilityOn(); + if(aCDisplayed) m_CubeAxes->VisibilityOn(); + + } else { + double aSize = m_Triedron->GetSize(); + newbnd[0] = newbnd[2] = newbnd[4] = 0; + newbnd[1] = newbnd[3] = newbnd[5] = aSize; } + if( newbnd[0]-VTK_LARGE_FLOAT && newbnd[3]>-VTK_LARGE_FLOAT && newbnd[5]>-VTK_LARGE_FLOAT){ for(int i=0;i<6;i++) bnd[i] = newbnd[i]; -- 2.39.2