1 /*=========================================================================
6 Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
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.
12 See License_v1.2.txt for the full ParaView license.
13 A copy of this license can be obtained by contacting
16 Clifton Park, NY 12065
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.
31 =========================================================================*/
32 // .NAME vtkPVAxesWidget - A widget to manipulate an axe
34 // .SECTION Description
35 // This widget creates and manages its own vtkPVAxesActor.
38 #ifndef __vtkPVAxesWidget_h
39 #define __vtkPVAxesWidget_h
42 #include "vtkInteractorObserver.h"
45 class vtkKWApplication;
48 class vtkPVAxesWidgetObserver;
51 class SVTK_EXPORT vtkPVAxesWidget : public vtkInteractorObserver
54 static vtkPVAxesWidget* New();
55 vtkTypeMacro(vtkPVAxesWidget, vtkInteractorObserver);
56 void PrintSelf(ostream& os, vtkIndent indent);
59 // Set/get the axes actor to be displayed in this 3D widget.
60 void SetAxesActor(vtkPVAxesActor *actor);
61 vtkGetObjectMacro(AxesActor, vtkPVAxesActor);
64 // Enable the 3D widget.
65 virtual void SetEnabled(int);
69 // Set the renderer this 3D widget will be contained in.
70 void SetParentRenderer(vtkRenderer *ren);
71 vtkRenderer* GetParentRenderer();
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);
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);
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();
92 // Set/get the color of the axis labels of this widget.
93 void SetAxisLabelColor(double r, double g, double b);
94 double *GetAxisLabelColor();
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();
105 vtkRenderer *Renderer;
106 vtkRenderer *ParentRenderer;
108 vtkPVAxesActor *AxesActor;
109 vtkPolyData *Outline;
110 vtkActor2D *OutlineActor;
112 static void ProcessEvents(vtkObject *object, unsigned long event,
113 void *clientdata, void *calldata);
115 vtkPVAxesWidgetObserver *Observer;
118 int MouseCursorState;
120 int StartPosition[2];
124 void UpdateCursorIcon();
125 void SetMouseCursor(int cursorState);
141 void OnButtonPress();
143 void OnButtonRelease();
146 void ResizeTopLeft();
147 void ResizeTopRight();
148 void ResizeBottomLeft();
149 void ResizeBottomRight();
151 void SquareRenderer();
153 unsigned long StartEventObserverId;
155 vtkPVAxesWidget(const vtkPVAxesWidget&); // Not implemented
156 void operator=(const vtkPVAxesWidget&); // Not implemented