1 #ifndef SVTK_VIEWWINDOW_H
2 #define SVTK_VIEWWINDOW_H
5 #pragma warning( disable:4251 )
9 #include "SUIT_ViewWindow.h"
11 #include "SVTK_Selection.h"
12 #include "SALOME_InteractiveObject.hxx"
19 class VTKViewer_Trihedron;
20 class VTKViewer_Transform;
26 class SVTK_CubeAxesActor2D;
28 class SVTK_RenderWindow;
29 class SVTK_InteractorStyle;
30 class SVTK_RenderWindowInteractor;
32 class SVTK_EXPORT SVTK_ViewWindow : public SUIT_ViewWindow
37 SVTK_ViewWindow( SUIT_Desktop*, SVTK_Viewer* );
38 virtual ~SVTK_ViewWindow();
40 QToolBar* getToolBar() { return myToolBar; }
42 void setBackgroundColor( const QColor& );
43 QColor backgroundColor() const;
45 vtkRenderer* getRenderer() {return myRenderer;}
46 SVTK_Selector* GetSelector() {return mySelector;}
47 SVTK_RenderWindow* getRenderWindow() {return myRenderWindow;}
48 SVTK_RenderWindowInteractor* getRWInteractor() {return myRWInteractor;}
49 Selection_Mode SelectionMode() const;
50 void SetSelectionMode(Selection_Mode theMode);
52 bool isTrihedronDisplayed();
53 bool isCubeAxesDisplayed();
55 /* interactive object management */
56 void highlight( const Handle(SALOME_InteractiveObject)& IObject,
57 bool highlight, bool immediatly = true );
58 void unHighlightAll();
59 bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
60 bool isVisible( const Handle(SALOME_InteractiveObject)& IObject );
63 Handle(SALOME_InteractiveObject) FindIObject(const char* Entry);
66 void Display( const Handle(SALOME_InteractiveObject)& IObject,
67 bool immediatly = true );
68 void DisplayOnly( const Handle(SALOME_InteractiveObject)& IObject );
69 void Erase( const Handle(SALOME_InteractiveObject)& IObject,
70 bool immediatly = true );
73 void Repaint( bool theUpdateTrihedron );
74 void Repaint() { Repaint(true); }
76 //apply existing transformation on adding SALOME_Actor
77 void SetScale( double theScale[3] );
78 void GetScale( double theScale[3] );
79 void AddActor( SALOME_Actor*, bool update = false );
80 void RemoveActor(SALOME_Actor*, bool update = false);
82 void AdjustTrihedrons( const bool forced );
83 //merge with V2_2_0_VISU_improvements:bool ComputeTrihedronSize( double& theNewSize,
84 //merge with V2_2_0_VISU_improvements: double& theOldSize );
86 int GetTrihedronSize() const;
87 void SetTrihedronSize( const int );
89 VTKViewer_Trihedron* GetTrihedron() {return this->myTrihedron;};
90 SVTK_CubeAxesActor2D* GetCubeAxes() {return this->myCubeAxes;};
93 void onSelectionChanged();
96 void selectionChanged();
109 void onViewTrihedron();
110 void onViewCubeAxes();
112 void onAdjustTrihedron();
113 void onAdjustCubeAxes();
122 void onRotateRight();
127 void activateWindowFit();
128 void activateRotation();
129 void activatePanning();
130 void activateGlobalPanning();
136 void onKeyPressed(QKeyEvent* event);
137 void onKeyReleased(QKeyEvent* event);
138 void onMousePressed(QMouseEvent* event);
139 void onMouseDoubleClicked(QMouseEvent* event);
140 void onMouseReleased(QMouseEvent* event);
141 void onMouseMoving(QMouseEvent* event);
145 void InsertActor( SALOME_Actor* theActor,
146 bool theMoveInternalActors = false );
147 void MoveActor( SALOME_Actor* theActor );
150 enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId,
151 FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, ViewTrihedronId };
152 typedef QMap<int, QtxAction*> ActionsMap;
154 void createActions();
155 void createToolBar();
157 vtkRenderer* myRenderer;
159 SVTK_Viewer* myModel;
160 SVTK_Selector* mySelector;
162 SVTK_RenderWindow* myRenderWindow;
163 SVTK_RenderWindowInteractor* myRWInteractor;
165 VTKViewer_Transform* myTransform;
166 VTKViewer_Trihedron* myTrihedron;
168 SVTK_CubeAxesActor2D* myCubeAxes;
171 ActionsMap myActionsMap;
175 friend class SVTK_RenderWindowInteractor;
179 #pragma warning( default:4251 )