]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Fix for '#17888 [CEA 17919] VTK Viewer - Scaling'.
authorrnv <rnv@opencascade.com>
Mon, 13 Jul 2020 11:45:26 +0000 (14:45 +0300)
committerrnv <rnv@opencascade.com>
Mon, 13 Jul 2020 11:45:26 +0000 (14:45 +0300)
src/OBJECT/GEOM_Actor.cxx
src/OBJECT/GEOM_Actor.h
src/OBJECT/GEOM_DeviceActor.cxx
src/OBJECT/GEOM_DeviceActor.h

index ce8b852a4bb2ab28e5cd8fe54a93a633e411f680..1b782df454dde93cfb363471e59dfbcaffd2be9b 100644 (file)
@@ -1166,3 +1166,19 @@ void GEOM_Actor::SetWidth(const int width) {
 int GEOM_Actor::GetWidth() const {
   return (int)myIsolatedEdgeActor->GetProperty()->GetLineWidth();
 }
+
+void GEOM_Actor::SetTransform(VTKViewer_Transform* theTransform)
+{
+  Superclass::SetTransform(theTransform);
+
+  myStandaloneVertexActor->SetTransform(theTransform);
+  myStandaloneVertexActor->SetTransform(theTransform);
+  myIsolatedEdgeActor->SetTransform(theTransform);
+  myOneFaceEdgeActor->SetTransform(theTransform);
+  mySharedEdgeActor->SetTransform(theTransform);
+  myWireframeFaceActor->SetTransform(theTransform);
+  myShadingFaceActor->SetTransform(theTransform);
+  myHighlightActor->SetTransform(theTransform);
+
+  Modified();
+}
index 48ec07bb5da2cf91e0a06d94925d76ebe89aad0d..810483a45467f1d30388b0904a275465aa194705 100644 (file)
@@ -222,6 +222,11 @@ public:
   bool
   GetNameMode();
 
+  virtual 
+  void 
+  SetTransform(VTKViewer_Transform* theTransform);
+
+
 protected:
   void SetModified();
 
index b23eb04bc414a50580cdd44b2cb4c89c248bab43..72a65ae5d774c78459464ea65aa3ec3a67ca46bb 100644 (file)
 #include <vtkStripper.h>  
 #include <vtkPolyDataMapper.h>  
 #include <vtkPolyDataNormals.h>  
-#include <vtkActor.h> 
-#include <VTKViewer_Actor.h>
+#include <vtkActor.h>
 #include <vtkRenderer.h> 
+
+#include <VTKViewer_Actor.h>
+#include <VTKViewer_Transform.h>
+#include <VTKViewer_TransformFilter.h>
+
  
 vtkStandardNewMacro(GEOM_DeviceActor);
  
-GEOM_DeviceActor::GEOM_DeviceActor(): 
-  myStripper(vtkStripper::New(),true), 
-  myPolyDataMapper(vtkPolyDataMapper::New(),true), 
-  myPolyDataNormals(vtkPolyDataNormals::New(),true), 
-  myActor(VTKViewer_Actor::New(),true) 
+GEOM_DeviceActor::GEOM_DeviceActor() :
+  myStripper(vtkStripper::New(), true),
+  myPolyDataMapper(vtkPolyDataMapper::New(), true),
+  myPolyDataNormals(vtkPolyDataNormals::New(), true),
+  myActor(VTKViewer_Actor::New(), true),
+  myTransformFilter(VTKViewer_TransformFilter::New())
 { 
-  myStripper->SetInputConnection(myPolyDataNormals->GetOutputPort()); 
-  myPolyDataMapper->SetInputConnection(myStripper->GetOutputPort()); 
+  myStripper->SetInputConnection(myPolyDataNormals->GetOutputPort());
+  myTransformFilter->SetInputConnection(myStripper->GetOutputPort());
+  myPolyDataMapper->SetInputConnection(myTransformFilter->GetOutputPort());
  
   myActor->SetMapper(myPolyDataMapper.Get()); 
   myActor->PickableOff(); 
@@ -56,11 +62,13 @@ SetInput(vtkAlgorithmOutput* thePolyData, bool theUseStripper)
   if(theUseStripper)
   {
     myPolyDataNormals->SetInputConnection(thePolyData); 
-    myStripper->SetInputConnection(myPolyDataNormals->GetOutputPort()); 
-    myPolyDataMapper->SetInputConnection(myStripper->GetOutputPort()); 
+    myStripper->SetInputConnection(myPolyDataNormals->GetOutputPort());
+    myTransformFilter->SetInputConnection(myStripper->GetOutputPort());
+    myPolyDataMapper->SetInputConnection(myTransformFilter->GetOutputPort());
   }
-  else 
-    myPolyDataMapper->SetInputConnection(thePolyData); 
+  else
+    myTransformFilter->SetInputConnection(thePolyData);
+    myPolyDataMapper->SetInputConnection(myTransformFilter->GetOutputPort());
 }
  
 void 
@@ -118,3 +126,10 @@ RemoveFromRender(vtkRenderer* theRenderer)
 {
   theRenderer->RemoveActor(myActor.GetPointer());
 }
+
+void
+GEOM_DeviceActor
+::SetTransform(VTKViewer_Transform* theTransform)
+{
+  myTransformFilter->SetTransform(theTransform);
+}
index a5562421ae902a9e8c47fa64672bba3f95b70435..6d576c825420c4d489d273d013c39f3e6e899f97 100644 (file)
@@ -36,7 +36,10 @@ typedef GEOM_SmartPtr<vtkPolyDataNormals> PPolyDataNormals;
  
 //class vtkActor;
 class VTKViewer_Actor;
+class VTKViewer_Transform;
+class VTKViewer_TransformFilter;
 typedef GEOM_SmartPtr<VTKViewer_Actor> PActor;
+typedef GEOM_SmartPtr<VTKViewer_TransformFilter> PTransformFilter;
  
 class vtkProperty; 
 class vtkRenderer; 
@@ -66,12 +69,15 @@ public:
   void RemoveFromRender(vtkRenderer* theRenderer);
   
   PActor GetDeviceActor() {return myActor;}
+
+  virtual void SetTransform(VTKViewer_Transform* theTransform);
  
 protected: 
   PPolyDataNormals myPolyDataNormals; 
   PPolyDataMapper myPolyDataMapper; 
   PStripper myStripper; 
-  PActor myActor; 
+  PActor myActor;
+  PTransformFilter myTransformFilter;
  
   GEOM_DeviceActor(); 
   ~GEOM_DeviceActor();