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.
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
40 #ifndef __salomevtkPVAxesWidget_h
41 #define __salomevtkPVAxesWidget_h
43 #include "SVTK.h" // added by SALOME
44 #include "vtkInteractorObserver.h"
47 class vtkKWApplication;
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
56 class vtkPVAxesWidgetObserver;
59 class SVTK_EXPORT vtkPVAxesWidget : public vtkInteractorObserver
62 static vtkPVAxesWidget* New();
63 vtkTypeMacro(vtkPVAxesWidget, vtkInteractorObserver);
64 void PrintSelf(ostream& os, vtkIndent indent);
67 // Set/get the axes actor to be displayed in this 3D widget.
68 void SetAxesActor(vtkPVAxesActor *actor);
69 vtkGetObjectMacro(AxesActor, vtkPVAxesActor);
72 // Enable the 3D widget.
73 virtual void SetEnabled(int);
77 // Set the renderer this 3D widget will be contained in.
78 void SetParentRenderer(vtkRenderer *ren);
79 vtkRenderer* GetParentRenderer();
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);
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);
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();
100 // Set/get the color of the axis labels of this widget.
101 void SetAxisLabelColor(double r, double g, double b);
102 double *GetAxisLabelColor();
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();
113 vtkRenderer *Renderer;
114 vtkRenderer *ParentRenderer;
116 vtkPVAxesActor *AxesActor;
117 vtkPolyData *Outline;
118 vtkActor2D *OutlineActor;
120 static void ProcessEvents(vtkObject *object, unsigned long event,
121 void *clientdata, void *calldata);
123 vtkPVAxesWidgetObserver *Observer;
126 int MouseCursorState;
128 int StartPosition[2];
132 void UpdateCursorIcon();
133 void SetMouseCursor(int cursorState);
149 void OnButtonPress();
151 void OnButtonRelease();
154 void ResizeTopLeft();
155 void ResizeTopRight();
156 void ResizeBottomLeft();
157 void ResizeBottomRight();
159 void SquareRenderer();
161 unsigned long StartEventObserverId;
163 vtkPVAxesWidget(const vtkPVAxesWidget&); // Not implemented
164 void operator=(const vtkPVAxesWidget&); // Not implemented
167 } // end of salomevtk namespace