Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
salomevtkPVAxesWidget.h
Go to the documentation of this file.
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 // VSR 03/12/2014: the original file vtkPVAxesWidget.h has been renamed to salomevtkPVAxesWidget.h
37 // to avoid collisions with native VTK/ParaView classes
38 
39 
40 #ifndef __salomevtkPVAxesWidget_h
41 #define __salomevtkPVAxesWidget_h
42 
43 #include "SVTK.h" // added by SALOME
44 #include "vtkInteractorObserver.h"
45 
46 class vtkActor2D;
47 class vtkKWApplication;
48 class vtkPolyData;
49 class vtkRenderer;
50 
51 // VSR 03/12/2014: we put classes copied from VTK/ParaView to the specific namespace
52 // to avoid collisions with native VTK/ParaView classes
53 namespace salomevtk
54 {
55 
56 class vtkPVAxesWidgetObserver;
57 class vtkPVAxesActor;
58 
60 {
61 public:
62  static vtkPVAxesWidget* New();
64  void PrintSelf(ostream& os, vtkIndent indent);
65 
66  // Description:
67  // Set/get the axes actor to be displayed in this 3D widget.
68  void SetAxesActor(vtkPVAxesActor *actor);
69  vtkGetObjectMacro(AxesActor, vtkPVAxesActor);
70 
71  // Description:
72  // Enable the 3D widget.
73  virtual void SetEnabled(int);
74 
75  //BTX
76  // Description:
77  // Set the renderer this 3D widget will be contained in.
78  void SetParentRenderer(vtkRenderer *ren);
79  vtkRenderer* GetParentRenderer();
80  //ETX
81 
82  // Description:
83  // Callback to keep the camera for the axes actor up to date with the
84  // camera in the parent renderer
85  void ExecuteEvent(vtkObject *o, unsigned long event, void *calldata);
86 
87  // Description:
88  // Set/get whether to allow this 3D widget to be interactively moved/scaled.
89  void SetInteractive(int state);
90  vtkGetMacro(Interactive, int);
91  vtkBooleanMacro(Interactive, int);
92 
93  // Description:
94  // Set/get the color of the outline of this widget. The outline is visible
95  // when (in interactive mode) the cursor is over this 3D widget.
96  void SetOutlineColor(double r, double g, double b);
97  double *GetOutlineColor();
98 
99  // Description:
100  // Set/get the color of the axis labels of this widget.
101  void SetAxisLabelColor(double r, double g, double b);
102  double *GetAxisLabelColor();
103 
104  // Description:
105  // Set/get the viewport to position/size this 3D widget.
106  void SetViewport(double minX, double minY, double maxX, double maxY);
107  double* GetViewport();
108 
109 protected:
110  vtkPVAxesWidget();
111  ~vtkPVAxesWidget();
112 
113  vtkRenderer *Renderer;
114  vtkRenderer *ParentRenderer;
115 
117  vtkPolyData *Outline;
119 
120  static void ProcessEvents(vtkObject *object, unsigned long event,
121  void *clientdata, void *calldata);
122 
124  int StartTag;
125 
127  int Moving;
128  int StartPosition[2];
129 
131 
132  void UpdateCursorIcon();
133  void SetMouseCursor(int cursorState);
134 
135 //BTX
136  int State;
137 
139  {
140  Outside = 0,
145  BottomRight
146  };
147 //ETX
148 
149  void OnButtonPress();
150  void OnMouseMove();
151  void OnButtonRelease();
152 
153  void MoveWidget();
154  void ResizeTopLeft();
155  void ResizeTopRight();
156  void ResizeBottomLeft();
157  void ResizeBottomRight();
158 
159  void SquareRenderer();
160 
161  unsigned long StartEventObserverId;
162 private:
163  vtkPVAxesWidget(const vtkPVAxesWidget&); // Not implemented
164  void operator=(const vtkPVAxesWidget&); // Not implemented
165 };
166 
167 } // end of salomevtk namespace
168 
169 #endif