1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/
19 #ifndef SVTK_VIEWWINDOW_H
20 #define SVTK_VIEWWINDOW_H
23 #pragma warning( disable:4251 )
27 #include "SUIT_ViewWindow.h"
29 #include "SVTK_Selection.h"
30 #include "SALOME_InteractiveObject.hxx"
37 class VTKViewer_Trihedron;
38 class VTKViewer_Transform;
44 class SVTK_CubeAxesActor2D;
46 class SVTK_RenderWindow;
47 class SVTK_InteractorStyle;
48 class SVTK_RenderWindowInteractor;
50 class SVTK_EXPORT SVTK_ViewWindow : public SUIT_ViewWindow
55 SVTK_ViewWindow( SUIT_Desktop*, SVTK_Viewer* );
56 virtual ~SVTK_ViewWindow();
58 QToolBar* getToolBar() { return myToolBar; }
60 void setBackgroundColor( const QColor& );
61 QColor backgroundColor() const;
63 vtkRenderer* getRenderer() {return myRenderer;}
64 SVTK_Selector* GetSelector() {return mySelector;}
65 SVTK_RenderWindow* getRenderWindow() {return myRenderWindow;}
66 SVTK_RenderWindowInteractor* getRWInteractor() {return myRWInteractor;}
67 Selection_Mode SelectionMode() const;
68 void SetSelectionMode(Selection_Mode theMode);
70 bool isTrihedronDisplayed();
71 bool isCubeAxesDisplayed();
73 /* interactive object management */
74 void highlight( const Handle(SALOME_InteractiveObject)& IObject,
75 bool highlight, bool immediatly = true );
76 void unHighlightAll();
77 bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
78 bool isVisible( const Handle(SALOME_InteractiveObject)& IObject );
81 Handle(SALOME_InteractiveObject) FindIObject(const char* Entry);
84 void Display( const Handle(SALOME_InteractiveObject)& IObject,
85 bool immediatly = true );
86 void DisplayOnly( const Handle(SALOME_InteractiveObject)& IObject );
87 void Erase( const Handle(SALOME_InteractiveObject)& IObject,
88 bool immediatly = true );
91 void Repaint( bool theUpdateTrihedron );
92 void Repaint() { Repaint(true); }
94 //apply existing transformation on adding SALOME_Actor
95 void SetScale( double theScale[3] );
96 void GetScale( double theScale[3] );
97 void AddActor( SALOME_Actor*, bool update = false );
98 void RemoveActor(SALOME_Actor*, bool update = false);
100 void AdjustTrihedrons( const bool forced );
101 //merge with V2_2_0_VISU_improvements:bool ComputeTrihedronSize( double& theNewSize,
102 //merge with V2_2_0_VISU_improvements: double& theOldSize );
104 int GetTrihedronSize() const;
105 void SetTrihedronSize( const int );
107 VTKViewer_Trihedron* GetTrihedron() {return this->myTrihedron;};
108 SVTK_CubeAxesActor2D* GetCubeAxes() {return this->myCubeAxes;};
111 void onSelectionChanged();
114 void selectionChanged();
127 void onViewTrihedron();
128 void onViewCubeAxes();
130 void onAdjustTrihedron();
131 void onAdjustCubeAxes();
140 void onRotateRight();
145 void activateWindowFit();
146 void activateRotation();
147 void activatePanning();
148 void activateGlobalPanning();
152 virtual void action( const int );
155 void onKeyPressed(QKeyEvent* event);
156 void onKeyReleased(QKeyEvent* event);
157 void onMousePressed(QMouseEvent* event);
158 void onMouseDoubleClicked(QMouseEvent* event);
159 void onMouseReleased(QMouseEvent* event);
160 void onMouseMoving(QMouseEvent* event);
164 void InsertActor( SALOME_Actor* theActor,
165 bool theMoveInternalActors = false );
166 void MoveActor( SALOME_Actor* theActor );
169 enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId,
170 FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, ViewTrihedronId };
171 typedef QMap<int, QtxAction*> ActionsMap;
173 void createActions();
174 void createToolBar();
176 vtkRenderer* myRenderer;
178 SVTK_Viewer* myModel;
179 SVTK_Selector* mySelector;
181 SVTK_RenderWindow* myRenderWindow;
182 SVTK_RenderWindowInteractor* myRWInteractor;
184 VTKViewer_Transform* myTransform;
185 VTKViewer_Trihedron* myTrihedron;
187 SVTK_CubeAxesActor2D* myCubeAxes;
190 ActionsMap myActionsMap;
194 friend class SVTK_RenderWindowInteractor;
198 #pragma warning( default:4251 )