Salome HOME
CMake: minor fix in the PYTHONPATH override when invoking PyQt4 command
[modules/gui.git] / src / SVTK / vtkPVAxesWidget.h
1 /*=========================================================================
2
3    Program: ParaView
4    Module:    $RCSfile$
5
6    Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
7    All rights reserved.
8
9    ParaView is a free software; you can redistribute it and/or modify it
10    under the terms of the ParaView license version 1.2. 
11
12    See License_v1.2.txt for the full ParaView license.
13    A copy of this license can be obtained by contacting
14    Kitware Inc.
15    28 Corporate Drive
16    Clifton Park, NY 12065
17    USA
18
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
23 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31 =========================================================================*/
32 // .NAME vtkPVAxesWidget - A widget to manipulate an axe
33 //
34 // .SECTION Description
35 // This widget creates and manages its own vtkPVAxesActor.
36
37
38 #ifndef __vtkPVAxesWidget_h
39 #define __vtkPVAxesWidget_h
40
41 #include "SVTK.h"
42 #include "vtkInteractorObserver.h"
43
44 class vtkActor2D;
45 class vtkKWApplication;
46 class vtkPolyData;
47 class vtkPVAxesActor;
48 class vtkPVAxesWidgetObserver;
49 class vtkRenderer;
50
51 class SVTK_EXPORT vtkPVAxesWidget : public vtkInteractorObserver
52 {
53 public:
54   static vtkPVAxesWidget* New();
55   vtkTypeMacro(vtkPVAxesWidget, vtkInteractorObserver);
56   void PrintSelf(ostream& os, vtkIndent indent);
57
58   // Description:
59   // Set/get the axes actor to be displayed in this 3D widget.
60   void SetAxesActor(vtkPVAxesActor *actor);
61   vtkGetObjectMacro(AxesActor, vtkPVAxesActor);
62
63   // Description:
64   // Enable the 3D widget.
65   virtual void SetEnabled(int);
66
67   //BTX
68   // Description:
69   // Set the renderer this 3D widget will be contained in.
70   void SetParentRenderer(vtkRenderer *ren);
71   vtkRenderer* GetParentRenderer();
72   //ETX
73   
74   // Description:
75   // Callback to keep the camera for the axes actor up to date with the
76   // camera in the parent renderer
77   void ExecuteEvent(vtkObject *o, unsigned long event, void *calldata);
78
79   // Description:
80   // Set/get whether to allow this 3D widget to be interactively moved/scaled.
81   void SetInteractive(int state);
82   vtkGetMacro(Interactive, int);
83   vtkBooleanMacro(Interactive, int);
84   
85   // Description:
86   // Set/get the color of the outline of this widget.  The outline is visible
87   // when (in interactive mode) the cursor is over this 3D widget.
88   void SetOutlineColor(double r, double g, double b);
89   double *GetOutlineColor();
90   
91   // Description:
92   // Set/get the color of the axis labels of this widget.
93   void SetAxisLabelColor(double r, double g, double b);
94   double *GetAxisLabelColor();
95   
96   // Description:
97   // Set/get the viewport to position/size this 3D widget.
98   void SetViewport(double minX, double minY, double maxX, double maxY);
99   double* GetViewport();
100   
101 protected:
102   vtkPVAxesWidget();
103   ~vtkPVAxesWidget();
104   
105   vtkRenderer *Renderer;
106   vtkRenderer *ParentRenderer;
107   
108   vtkPVAxesActor *AxesActor;
109   vtkPolyData *Outline;
110   vtkActor2D *OutlineActor;
111   
112   static void ProcessEvents(vtkObject *object, unsigned long event,
113                             void *clientdata, void *calldata);
114
115   vtkPVAxesWidgetObserver *Observer;
116   int StartTag;
117   
118   int MouseCursorState;
119   int Moving;
120   int StartPosition[2];
121
122   int Interactive;
123   
124   void UpdateCursorIcon();
125   void SetMouseCursor(int cursorState);
126   
127 //BTX
128   int State;
129   
130   enum AxesWidgetState
131   {
132     Outside = 0,
133     Inside,
134     TopLeft,
135     TopRight,
136     BottomLeft,
137     BottomRight
138   };
139 //ETX
140   
141   void OnButtonPress();
142   void OnMouseMove();
143   void OnButtonRelease();
144
145   void MoveWidget();
146   void ResizeTopLeft();
147   void ResizeTopRight();
148   void ResizeBottomLeft();
149   void ResizeBottomRight();
150   
151   void SquareRenderer();
152
153   unsigned long StartEventObserverId;  
154 private:
155   vtkPVAxesWidget(const vtkPVAxesWidget&);  // Not implemented
156   void operator=(const vtkPVAxesWidget&);  // Not implemented
157 };
158
159 #endif