int(aBackgroundColor[2]*255));
}
+
//----------------------------------------------------------------------------
void
SVTK_RenderWindow
myRenderer->GetScale( theScale );
}
-//----------------------------------------------------------------------------
void
SVTK_RenderWindow
::SetScale( double theScale[3] )
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
class VTKViewer_Trihedron;
class VTKViewer_Transform;
+class VTKViewer_Actor;
+
class SVTK_CubeAxesActor2D;
class SVTK_Renderer;
class SVTK_EXPORT SVTK_RenderWindow : public QMainWindow
{
- Q_OBJECT
+ Q_OBJECT;
public:
SVTK_RenderWindow( QWidget*, const char* );
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();
//----------------------------------------------------------------------------
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;
}
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()
#include "SALOME_InteractiveObject.hxx"
-// VTK Includes
+#include <vtkSmartPointer.h>
#include <vtkGenericRenderWindowInteractor.h>
class QTimer;
SVTK_RenderWindowInteractor( QWidget*, const char* );
~SVTK_RenderWindowInteractor();
- vtkRenderWindowInteractor* getInteractor() { return myInteractor; }
+ vtkRenderWindowInteractor* getDevice();
// Description:
// Initializes the event handlers without an XtAppContext. This is
vtkRenderer* GetRenderer();
protected:
- vtkGenericRenderWindowInteractor* myInteractor;
+ vtkSmartPointer<vtkGenericRenderWindowInteractor> myInteractor;
virtual void paintEvent( QPaintEvent* );
virtual void resizeEvent( QResizeEvent* );
//----------------------------------------------------------------------------
SVTK_View
::~SVTK_View()
-{
-}
+{}
//----------------------------------------------------------------------------
SVTK_Selector*
}
//----------------------------------------------------------------
-struct THighlightAction{
+struct THighlightAction
+{
bool myIsHighlight;
Selection_Mode myMode;
THighlightAction( bool theIsHighlight, Selection_Mode theMode = ActorSelection )
SVTK_View
::unHighlightAll()
{
- //cout << "SVTK_View::unHighlightAll" << endl;
-
using namespace VTK;
ForEach<SALOME_Actor>( getRenderer()->GetActors(),
THighlightAction( false ) );
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
SVTK_View
::initInteractorStyle( SVTK_InteractorStyle* interactorStyle )
{
- getInteractor()->SetInteractorStyle( interactorStyle );
+ getDevice()->SetInteractorStyle( interactorStyle );
interactorStyle->FindPokedRenderer( 0, 0 );
interactorStyle->SetSelector( GetSelector() );
SVTK_View
::pushInteractorStyle( SVTK_InteractorStyle* interactorStyle )
{
- myInteractorStyles.push( interactorStyle );
+ myInteractorStyles.push( PInteractorStyle(interactorStyle) );
initInteractorStyle( interactorStyle );
}
SVTK_View
::getInteractorStyle()
{
- return myInteractorStyles.empty() ? 0 : myInteractorStyles.top();
+ return myInteractorStyles.empty() ? 0 : myInteractorStyles.top().GetPointer();
}
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 );
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,
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
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
return myView;
}
-SVTK_View*
+SVTK_RenderWindow*
SVTK_ViewWindow
::getRenderWindow()
{
return myView;
}
-SVTK_View*
+SVTK_RenderWindowInteractor*
SVTK_ViewWindow
::getRWInteractor()
{
class SVTK_InteractorStyle;
class SVTK_CubeAxesActor2D;
-class vtkRenderer;
+class SVTK_RenderWindow;
+class SVTK_RenderWindowInteractor;
class SVTK_EXPORT SVTK_ViewWindow : public SUIT_ViewWindow
{
SVTK_Selector* GetSelector();
SVTK_View* getView();
- SVTK_View* getRenderWindow();
- SVTK_View* getRWInteractor();
+ SVTK_RenderWindow* getRenderWindow();
+ SVTK_RenderWindowInteractor* getRWInteractor();
SVTK_InteractorStyle* getInteractorStyle();