Back to index

salome-gui  6.5.0
vtkPVAxesWidget.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003    Program: ParaView
00004    Module:    $RCSfile: vtkPVAxesWidget.h,v $
00005 
00006    Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
00007    All rights reserved.
00008 
00009    ParaView is a free software; you can redistribute it and/or modify it
00010    under the terms of the ParaView license version 1.2. 
00011 
00012    See License_v1.2.txt for the full ParaView license.
00013    A copy of this license can be obtained by contacting
00014    Kitware Inc.
00015    28 Corporate Drive
00016    Clifton Park, NY 12065
00017    USA
00018 
00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00020 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00021 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00022 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
00023 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00024 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00025 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00026 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00027 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00028 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00029 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00030 
00031 =========================================================================*/
00032 // .NAME vtkPVAxesWidget - A widget to manipulate an axe
00033 //
00034 // .SECTION Description
00035 // This widget creates and manages its own vtkPVAxesActor.
00036 
00037 
00038 #ifndef __vtkPVAxesWidget_h
00039 #define __vtkPVAxesWidget_h
00040 
00041 #include "SVTK.h"
00042 #include "vtkInteractorObserver.h"
00043 
00044 class vtkActor2D;
00045 class vtkKWApplication;
00046 class vtkPolyData;
00047 class vtkPVAxesActor;
00048 class vtkPVAxesWidgetObserver;
00049 class vtkRenderer;
00050 
00051 class SVTK_EXPORT vtkPVAxesWidget : public vtkInteractorObserver
00052 {
00053 public:
00054   static vtkPVAxesWidget* New();
00055   vtkTypeRevisionMacro(vtkPVAxesWidget, vtkInteractorObserver);
00056   void PrintSelf(ostream& os, vtkIndent indent);
00057 
00058   // Description:
00059   // Set/get the axes actor to be displayed in this 3D widget.
00060   void SetAxesActor(vtkPVAxesActor *actor);
00061   vtkGetObjectMacro(AxesActor, vtkPVAxesActor);
00062 
00063   // Description:
00064   // Enable the 3D widget.
00065   virtual void SetEnabled(int);
00066 
00067   //BTX
00068   // Description:
00069   // Set the renderer this 3D widget will be contained in.
00070   void SetParentRenderer(vtkRenderer *ren);
00071   vtkRenderer* GetParentRenderer();
00072   //ETX
00073   
00074   // Description:
00075   // Callback to keep the camera for the axes actor up to date with the
00076   // camera in the parent renderer
00077   void ExecuteEvent(vtkObject *o, unsigned long event, void *calldata);
00078 
00079   // Description:
00080   // Set/get whether to allow this 3D widget to be interactively moved/scaled.
00081   void SetInteractive(int state);
00082   vtkGetMacro(Interactive, int);
00083   vtkBooleanMacro(Interactive, int);
00084   
00085   // Description:
00086   // Set/get the color of the outline of this widget.  The outline is visible
00087   // when (in interactive mode) the cursor is over this 3D widget.
00088   void SetOutlineColor(double r, double g, double b);
00089   double *GetOutlineColor();
00090   
00091   // Description:
00092   // Set/get the color of the axis labels of this widget.
00093   void SetAxisLabelColor(double r, double g, double b);
00094   double *GetAxisLabelColor();
00095   
00096   // Description:
00097   // Set/get the viewport to position/size this 3D widget.
00098   void SetViewport(double minX, double minY, double maxX, double maxY);
00099   double* GetViewport();
00100   
00101 protected:
00102   vtkPVAxesWidget();
00103   ~vtkPVAxesWidget();
00104   
00105   vtkRenderer *Renderer;
00106   vtkRenderer *ParentRenderer;
00107   
00108   vtkPVAxesActor *AxesActor;
00109   vtkPolyData *Outline;
00110   vtkActor2D *OutlineActor;
00111   
00112   static void ProcessEvents(vtkObject *object, unsigned long event,
00113                             void *clientdata, void *calldata);
00114 
00115   vtkPVAxesWidgetObserver *Observer;
00116   int StartTag;
00117   
00118   int MouseCursorState;
00119   int Moving;
00120   int StartPosition[2];
00121 
00122   int Interactive;
00123   
00124   void UpdateCursorIcon();
00125   void SetMouseCursor(int cursorState);
00126   
00127 //BTX
00128   int State;
00129   
00130   enum AxesWidgetState
00131   {
00132     Outside = 0,
00133     Inside,
00134     TopLeft,
00135     TopRight,
00136     BottomLeft,
00137     BottomRight
00138   };
00139 //ETX
00140   
00141   void OnButtonPress();
00142   void OnMouseMove();
00143   void OnButtonRelease();
00144 
00145   void MoveWidget();
00146   void ResizeTopLeft();
00147   void ResizeTopRight();
00148   void ResizeBottomLeft();
00149   void ResizeBottomRight();
00150   
00151   void SquareRenderer();
00152 
00153   unsigned long StartEventObserverId;  
00154 private:
00155   vtkPVAxesWidget(const vtkPVAxesWidget&);  // Not implemented
00156   void operator=(const vtkPVAxesWidget&);  // Not implemented
00157 };
00158 
00159 #endif