]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Minor changes
authorapo <apo@opencascade.com>
Tue, 23 Aug 2005 09:06:35 +0000 (09:06 +0000)
committerapo <apo@opencascade.com>
Tue, 23 Aug 2005 09:06:35 +0000 (09:06 +0000)
src/SVTK/SVTK_RenderWindow.cxx
src/SVTK/SVTK_RenderWindow.h
src/SVTK/SVTK_RenderWindowInteractor.cxx
src/SVTK/SVTK_RenderWindowInteractor.h
src/SVTK/SVTK_View.cxx
src/SVTK/SVTK_View.h
src/SVTK/SVTK_ViewWindow.cxx
src/SVTK/SVTK_ViewWindow.h

index 470893fdfdc5f39715e2150d3245315b36904301..3cbce7af96cc251574f04ff5474ad38e519a2468 100644 (file)
@@ -270,6 +270,7 @@ SVTK_RenderWindow
                int(aBackgroundColor[2]*255));
 }
 
+
 //----------------------------------------------------------------------------
 void
 SVTK_RenderWindow
@@ -278,7 +279,6 @@ SVTK_RenderWindow
   myRenderer->GetScale( theScale );
 }
 
-//----------------------------------------------------------------------------
 void
 SVTK_RenderWindow
 ::SetScale( double theScale[3] ) 
@@ -287,6 +287,27 @@ SVTK_RenderWindow
   Repaint();
 }
 
+
+//----------------------------------------------------------------------------
+void
+SVTK_RenderWindow
+::AddActor(VTKViewer_Actor* theActor, bool theIsUpdate)
+{
+  myRenderer->AddActor(theActor);
+  if(theIsUpdate) 
+    Repaint();
+}
+
+//----------------------------------------------------------------------------
+void
+SVTK_RenderWindow
+::RemoveActor(VTKViewer_Actor* theActor, bool theIsUpdate)
+{
+  myRenderer->RemoveActor(theActor);
+  if(theIsUpdate) 
+    Repaint();
+}
+
 //----------------------------------------------------------------------------
 bool
 SVTK_RenderWindow
index 9419100b97a8b8ccba48ff02564d9d3d06172126..020f2fceb35545f408651415e9ad8f31fb4deebf 100644 (file)
@@ -38,6 +38,8 @@
 
 class VTKViewer_Trihedron;
 class VTKViewer_Transform;
+class VTKViewer_Actor;
+
 class SVTK_CubeAxesActor2D;
 class SVTK_Renderer;
 
@@ -48,7 +50,7 @@ class vtkRenderWindow;
 
 class SVTK_EXPORT SVTK_RenderWindow : public QMainWindow
 {
-  Q_OBJECT
+  Q_OBJECT;
 
  public:
   SVTK_RenderWindow( QWidget*, const char* );
@@ -79,6 +81,9 @@ class SVTK_EXPORT SVTK_RenderWindow : public QMainWindow
   void SetScale( double theScale[3] );
   void GetScale( double theScale[3] );
 
+  void AddActor(VTKViewer_Actor* theActor, bool theIsUpdate = false);
+  void RemoveActor(VTKViewer_Actor* theActor, bool theIsUpdate = false);
+
  public slots:
   virtual void activateZoom();
   virtual void activateWindowFit();
index 30df0835314425a080cfc18c2fcaa62412529846..af266f13054f6c4774114e5d9b1b7501e0e7adbf 100644 (file)
@@ -126,10 +126,10 @@ QtRenderWindowInteractor
 //----------------------------------------------------------------------------
 SVTK_RenderWindowInteractor
 ::SVTK_RenderWindowInteractor( QWidget* parent, const char* name ) :
-  SVTK_RenderWindow( parent, name )
+  SVTK_RenderWindow( parent, name ),
+  myInteractor(QtRenderWindowInteractor::New())
 {
-  myInteractor = QtRenderWindowInteractor::New();
-
+  myInteractor->Delete();
   myInteractor->SetRenderWindow( getRenderWindow() );
   myDisplayMode = 0;
 }
@@ -144,12 +144,17 @@ SVTK_RenderWindowInteractor
   SVTK_SpaceMouse* sm = SVTK_SpaceMouse::getInstance();
   if ( sm->isSpaceMouseOn() )
     sm->close( x11Display() );
-
-  myInteractor->Delete();
 }
 
 
 //----------------------------------------------------------------------------
+vtkRenderWindowInteractor* 
+SVTK_RenderWindowInteractor
+::getDevice()
+{
+  return myInteractor.GetPointer();
+}
+
 void
 SVTK_RenderWindowInteractor
 ::Initialize() 
index c3d6e7241961235afb810b47277ea0aafc0a1823..ecfc972fece580c417c7d488a47dc2e459628635 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "SALOME_InteractiveObject.hxx"
 
-// VTK Includes
+#include <vtkSmartPointer.h>
 #include <vtkGenericRenderWindowInteractor.h>
 
 class QTimer;
@@ -88,7 +88,7 @@ class SVTK_EXPORT SVTK_RenderWindowInteractor: public SVTK_RenderWindow
   SVTK_RenderWindowInteractor( QWidget*, const char* );
   ~SVTK_RenderWindowInteractor();
 
-  vtkRenderWindowInteractor* getInteractor() { return myInteractor; }
+  vtkRenderWindowInteractor* getDevice();
 
   // Description:
   // Initializes the event handlers without an XtAppContext.  This is
@@ -107,7 +107,7 @@ class SVTK_EXPORT SVTK_RenderWindowInteractor: public SVTK_RenderWindow
   vtkRenderer* GetRenderer();
 
  protected:
-  vtkGenericRenderWindowInteractor* myInteractor;
+  vtkSmartPointer<vtkGenericRenderWindowInteractor> myInteractor;
 
   virtual void paintEvent( QPaintEvent* );
   virtual void resizeEvent( QResizeEvent* );
index fd2751d4716d493f85de2d01dcf69e9ff65bf55c..f886bbf92a7e3704da97dfedb194f4222021c846 100644 (file)
@@ -56,8 +56,7 @@ SVTK_View
 //----------------------------------------------------------------------------
 SVTK_View
 ::~SVTK_View()
-{
-}
+{}
 
 //----------------------------------------------------------------------------
 SVTK_Selector* 
@@ -140,7 +139,8 @@ SVTK_View
 }
 
 //----------------------------------------------------------------
-struct THighlightAction{
+struct THighlightAction
+{
   bool myIsHighlight;
   Selection_Mode myMode;
   THighlightAction( bool theIsHighlight, Selection_Mode theMode = ActorSelection )
@@ -196,8 +196,6 @@ void
 SVTK_View
 ::unHighlightAll() 
 {
-  //cout << "SVTK_View::unHighlightAll" << endl;
-
   using namespace VTK;
   ForEach<SALOME_Actor>( getRenderer()->GetActors(),
                         THighlightAction( false ) );
@@ -220,48 +218,6 @@ SVTK_View
   update();
 }
 
-//----------------------------------------------------------------------------
-void
-SVTK_View
-::InsertActor( VTKViewer_Actor* theActor, bool theMoveInternalActors )
-{
-  theActor->AddToRender( getRenderer() );
-
-  //theActor->SetTransform(myTransform);
-  //if(theMoveInternalActors) 
-  //  myRWInteractor->MoveInternalActors();
-}
-
-//----------------------------------------------------------------------------
-void
-SVTK_View
-::AddActor( VTKViewer_Actor* theActor, bool theUpdate )
-{
-  InsertActor(theActor);
-  if(theUpdate) 
-    Repaint();
-}
-
-//----------------------------------------------------------------------------
-void
-SVTK_View
-::RemoveActor( VTKViewer_Actor* theActor, bool theUpdate )
-{
-  theActor->RemoveFromRender( getRenderer() );
-
-  if(theUpdate) 
-    Repaint();
-}
-
-//----------------------------------------------------------------------------
-void
-SVTK_View
-::MoveActor( VTKViewer_Actor* theActor)
-{
-  RemoveActor(theActor);
-  InsertActor(theActor,true);
-}
-
 //----------------------------------------------------------------------------
 void
 SVTK_View
@@ -312,7 +268,7 @@ void
 SVTK_View
 ::initInteractorStyle( SVTK_InteractorStyle* interactorStyle )
 {
-  getInteractor()->SetInteractorStyle( interactorStyle ); 
+  getDevice()->SetInteractorStyle( interactorStyle ); 
   interactorStyle->FindPokedRenderer( 0, 0 );
 
   interactorStyle->SetSelector( GetSelector() );
@@ -324,7 +280,7 @@ void
 SVTK_View
 ::pushInteractorStyle( SVTK_InteractorStyle* interactorStyle )
 {
-  myInteractorStyles.push( interactorStyle );
+  myInteractorStyles.push( PInteractorStyle(interactorStyle) );
   initInteractorStyle( interactorStyle );
 }
 
@@ -345,5 +301,5 @@ SVTK_InteractorStyle*
 SVTK_View
 ::getInteractorStyle()
 {
-  return myInteractorStyles.empty() ? 0 : myInteractorStyles.top();
+  return myInteractorStyles.empty() ? 0 : myInteractorStyles.top().GetPointer();
 }
index 56c2f6ba34c6c4b989f7d5f9c578019e717f3067..76079a6a9a6c095f2e4b4541c604945749343fcf 100644 (file)
@@ -39,14 +39,6 @@ public:
   void pushInteractorStyle( SVTK_InteractorStyle* );
   void popInteractorStyle();
 
-  // Main process VTK event method
-  static
-  void
-  ProcessEvents(vtkObject* theObject, 
-               unsigned long theEvent,
-               void* theClientData, 
-               void* theCallData);
-
   Selection_Mode SelectionMode() const;
   void SetSelectionMode( Selection_Mode );
 
@@ -69,10 +61,6 @@ public:
   void DisplayAll();
   void EraseAll();
 
-  //apply existing transformation on adding SALOME_Actor
-  void AddActor( VTKViewer_Actor*, bool update = false );
-  void RemoveActor(VTKViewer_Actor*, bool update = false);
-
   void AdjustTrihedrons( const bool forced );
 
   void SetSelectionProp(const double& theRed = 1, 
@@ -96,13 +84,15 @@ public slots:
   virtual void activatePanning(); 
   virtual void activateGlobalPanning(); 
 
-protected:
-  void InitialSetup();
-  void InsertActor( VTKViewer_Actor* theActor,
-                    bool theMoveInternalActors = false );
-  void MoveActor( VTKViewer_Actor* theActor );
+protected:  
+  // Main process VTK event method
+  static
+  void
+  ProcessEvents(vtkObject* theObject, 
+               unsigned long theEvent,
+               void* theClientData, 
+               void* theCallData);
 
-private:  
   SVTK_Viewer* myModel;
 
   // Used to process VTK events
@@ -113,9 +103,9 @@ private:
   vtkSmartPointer<SVTK_Selector> mySelector;
 
   void initInteractorStyle( SVTK_InteractorStyle* );
-  std::stack<SVTK_InteractorStyle*> myInteractorStyles;
 
-  double myCurScale;
+  typedef vtkSmartPointer<SVTK_InteractorStyle> PInteractorStyle;
+  std::stack<PInteractorStyle> myInteractorStyles;
 };
 
 #ifdef WIN32
index 2854b4cec9ad34d14205218a967e3c503a437773..a42b6b7b9d1d950b9d5f16dc22880e83c1b8ed41 100755 (executable)
@@ -120,14 +120,14 @@ SVTK_ViewWindow
   return myView; 
 }
 
-SVTK_View* 
+SVTK_RenderWindow* 
 SVTK_ViewWindow
 ::getRenderWindow() 
 { 
   return myView; 
 }
 
-SVTK_View
+SVTK_RenderWindowInteractor
 SVTK_ViewWindow
 ::getRWInteractor() 
 { 
index ff747772d9c8e574e1efcda57662b7dd85c46dee..94ef0663724c4064c546d97001efb0d76ba03a45 100755 (executable)
@@ -24,7 +24,8 @@ class SVTK_Selector;
 class SVTK_InteractorStyle;
 class SVTK_CubeAxesActor2D;
 
-class vtkRenderer;
+class SVTK_RenderWindow;
+class SVTK_RenderWindowInteractor;
 
 class SVTK_EXPORT SVTK_ViewWindow : public SUIT_ViewWindow
 {
@@ -41,8 +42,8 @@ public:
   SVTK_Selector* GetSelector();
   
   SVTK_View* getView();
-  SVTK_View* getRenderWindow();
-  SVTK_View* getRWInteractor();
+  SVTK_RenderWindow* getRenderWindow();
+  SVTK_RenderWindowInteractor* getRWInteractor();
 
   SVTK_InteractorStyle* getInteractorStyle();