]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Added transformation
authorenk <enk@opencascade.com>
Fri, 27 May 2005 08:44:06 +0000 (08:44 +0000)
committerenk <enk@opencascade.com>
Fri, 27 May 2005 08:44:06 +0000 (08:44 +0000)
  T1.5: Graduated scale isn't moved after translate a presentation on Y

src/VTKFilter/SALOME_CubeAxesActor2D.cxx
src/VTKFilter/SALOME_CubeAxesActor2D.h
src/VTKViewer/VTKViewer_ViewFrame.cxx

index 8465effc0d2be1446826eb190bf901e977676938..43f153411bccd0a0672fc32dae71e1b8b38972c9 100644 (file)
@@ -27,6 +27,7 @@
 //  $Header$
 
 #include "SALOME_CubeAxesActor2D.h"
+#include "SALOME_Transform.h"
 
 #include <vtkPolyDataMapper.h>
 #include <vtkRectilinearGridGeometryFilter.h>
@@ -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());
+}
index 0f7ef969e2f431c5c4993239b33982d5fd20ec19..9bb5779561c714ed8ddf9fa2dc4559f1a1de3fee 100644 (file)
@@ -29,7 +29,8 @@
 #ifndef __SALOME_CubeAxesActor2D_h
 #define __SALOME_CubeAxesActor2D_h
 
-#include "vtkCubeAxesActor2D.h"
+#include <vtkCubeAxesActor2D.h>
+#include <vtkSmartPointer.h>
 
 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<SALOME_Transform> m_Transform;
 private:
   SALOME_CubeAxesActor2D(const SALOME_CubeAxesActor2D&);  // Not implemented.
   void operator=(const SALOME_CubeAxesActor2D&);  // Not implemented.
index be5019eb9acfb63967bfad940769d66ac8504f14..88fbac9b274ed1548a611f3190e79d5e21fc92d6 100644 (file)
@@ -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[2]<VTK_LARGE_FLOAT && newbnd[4]<VTK_LARGE_FLOAT &&
       newbnd[1]>-VTK_LARGE_FLOAT && newbnd[3]>-VTK_LARGE_FLOAT && newbnd[5]>-VTK_LARGE_FLOAT){
     for(int i=0;i<6;i++) bnd[i] = newbnd[i];