]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Added transformation fixed bug with incorrect transformation
authorenk <enk@opencascade.com>
Mon, 30 May 2005 10:12:25 +0000 (10:12 +0000)
committerenk <enk@opencascade.com>
Mon, 30 May 2005 10:12:25 +0000 (10:12 +0000)
src/VTKFilter/SALOME_CubeAxesActor2D.cxx
src/VTKFilter/SALOME_Transform.cxx
src/VTKFilter/SALOME_Transform.h

index 43f153411bccd0a0672fc32dae71e1b8b38972c9..0d047aa3217369bb60a8cd7b9f8e8b2c8a6d995e 100644 (file)
@@ -100,6 +100,27 @@ SALOME_CubeAxesActor2D::SALOME_CubeAxesActor2D()
   this->XAxis->SetProperty(this->GetProperty());
   this->YAxis->SetProperty(this->GetProperty());
   this->ZAxis->SetProperty(this->GetProperty());
+
+  if (this->AxisLabelTextProperty)
+    {
+      if (this->XAxis->GetLabelTextProperty())
+       this->XAxis->GetLabelTextProperty()->ShallowCopy(this->AxisLabelTextProperty);
+      if (this->YAxis->GetLabelTextProperty())
+       this->YAxis->GetLabelTextProperty()->ShallowCopy(this->AxisLabelTextProperty);
+      if (this->ZAxis->GetLabelTextProperty())
+       this->ZAxis->GetLabelTextProperty()->ShallowCopy(this->AxisLabelTextProperty);
+    }
+  
+  if (this->AxisTitleTextProperty)
+    {
+      if (this->XAxis->GetLabelTextProperty())
+         this->XAxis->GetTitleTextProperty()->ShallowCopy(this->AxisTitleTextProperty);
+      if (this->YAxis->GetLabelTextProperty())
+       this->YAxis->GetTitleTextProperty()->ShallowCopy(this->AxisTitleTextProperty);
+      if (this->ZAxis->GetLabelTextProperty())
+       this->ZAxis->GetTitleTextProperty()->ShallowCopy(this->AxisTitleTextProperty);
+    }
+  
 }
 
 //----------------------------------------------------------------------------
@@ -390,7 +411,7 @@ int SALOME_CubeAxesActor2D::RenderOpaqueGeometry(vtkViewport *viewport)
 
   double aTScale[3];
   if(m_Transform.GetPointer() != NULL)
-    m_Transform->GetScale(aTScale);
+    m_Transform->GetMatrixScale(aTScale);
 
   this->XAxis->GetPositionCoordinate()->SetValue(xCoords[0], xCoords[1]);
   this->XAxis->GetPosition2Coordinate()->SetValue(xCoords[2], xCoords[3]);
@@ -515,6 +536,7 @@ int SALOME_CubeAxesActor2D::RenderOpaqueGeometry(vtkViewport *viewport)
   this->wireActorYZ->GetProperty()->SetColor(color);
   this->wireActorXZ->GetProperty()->SetColor(color);
   
+  /*
   // Rebuid text props
   // Perform shallow copy here since each individual axis can be
   // accessed through the class API (i.e. each individual axis text prop
@@ -560,7 +582,7 @@ int SALOME_CubeAxesActor2D::RenderOpaqueGeometry(vtkViewport *viewport)
         this->AxisTitleTextProperty);
       }
     }
-  
+  */  
   this->BuildTime.Modified();
 
   //Render the axes
index 7700215d11c58fc684436c659a081e1dff0ade3a..3ca3b485e481d121cc2d71d9d3708529804d5252 100644 (file)
 #include <vtkObjectFactory.h>
 #include <vtkMatrix4x4.h>
 
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
 using namespace std;
 
 vtkStandardNewMacro(SALOME_Transform);
 
-void SALOME_Transform::SetScale(float theScaleX, float theScaleY, float theScaleZ){ 
+void SALOME_Transform::SetMatrixScale(double theScaleX, double theScaleY, double theScaleZ){ 
   double aMatrix[16] = {theScaleX,0,0,0, 
                         0,theScaleY,0,0, 
                         0,0,theScaleZ,0, 
                         0,0,0,1.0000000};
-  vtkTransform::SetMatrix(aMatrix);
+  this->SetMatrix(aMatrix);
+  if(MYDEBUG)
+    cout << __FILE__ << "[" << __LINE__ << "]:" << endl
+        << "SetMatrixSize" << endl
+        << "\t theScaleX=" << theScaleX << " theScaleY=" << theScaleY << " theScaleZ=" << theScaleZ << endl;
+}
+
+void SALOME_Transform::GetMatrixScale(double theScale[3]){
+  vtkMatrix4x4 *aTMatrix=this->GetMatrix();
+  const double aScaleX = aTMatrix->GetElement(0,0);
+  const double aScaleY = aTMatrix->GetElement(1,1);
+  const double aScaleZ = aTMatrix->GetElement(2,2);
+  theScale[0] = aScaleX;
+  theScale[1] = aScaleY;
+  theScale[2] = aScaleZ;
+  if(MYDEBUG)
+    cout << __FILE__ << "[" << __LINE__ << "]:" << endl
+        << "GetMatrixSize" << endl
+        << "\t theScaleX=" << theScale[0] << " theScaleY=" << theScale[1] << " theScaleZ=" << theScale[2] << endl;
 }
 
 int SALOME_Transform::IsIdentity(){ 
-  float* aScale = GetScale();
+  double aScale[3];
+  this->GetMatrixScale(aScale);
   return (aScale[0] == 1.0 && aScale[1] == 1.0 && aScale[2] == 1.0);
 }
index fe9231a1313aa305f419c38459d9d9651f8f13c9..a6c1b6f8c1e8d41c38d361711e5091b0fefc5545 100644 (file)
@@ -36,7 +36,9 @@ class VTK_EXPORT SALOME_Transform : public vtkTransform{
   static SALOME_Transform *New();
   vtkTypeMacro(SALOME_Transform,vtkTransform);
 
-  void SetScale(float theScaleX, float theScaleY, float theScaleZ);
+  //void SetScale(float theScaleX, float theScaleY, float theScaleZ);
+  void SetMatrixScale(double theScaleX, double theScaleY, double theScaleZ);
+  void GetMatrixScale(double theScale[3]);
   int IsIdentity();
 
 protected: