Salome HOME
Merge from V6_main 01/04/2013
[modules/gui.git] / src / VTKViewer / VTKViewer_FramedTextActor.h
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef VTKVIEWER_FRAMEDTEXTACTOR_H
21 #define VTKVIEWER_FRAMEDTEXTACTOR_H
22
23 #include "VTKViewer.h"
24
25 #include <vtkActor2D.h>
26
27 class vtkPolyData;
28 class vtkPolyDataMapper2D;
29 class vtkRenderer;
30 class vtkTimeStamp;
31 class vtkTextMapper;
32 class vtkTextProperty;
33 class vtkViewport;
34 class vtkWindow;
35
36 class VTKVIEWER_EXPORT VTKViewer_FramedTextActor : public vtkActor2D
37 {
38 public:
39   enum ModePosition { BelowPoint = 0, TopLeft, TopRight, BottomLeft, BottomRight };
40   enum LayoutType { Vertical = 0, Horizontal };
41
42 public:
43   vtkTypeMacro(VTKViewer_FramedTextActor,vtkActor2D);
44   static VTKViewer_FramedTextActor *New();
45
46   virtual int                 RenderOpaqueGeometry(vtkViewport*);
47   virtual int                 RenderTranslucentGeometry(vtkViewport*) { return 0; }
48   virtual int                 RenderOverlay(vtkViewport*);
49   virtual void                ReleaseGraphicsResources(vtkWindow*);
50
51   virtual void                SetVisibility(int);
52   virtual int                 GetVisibility();
53   virtual void                SetPickable(int);
54   virtual int                 GetPickable();
55
56   virtual void                GetSize(vtkRenderer* theRenderer, int theSize[2]) const;
57
58   void                        SetText(const char* theText);
59   char*                       GetText();
60
61   void                        SetModePosition(const int theMode);
62   int                         GetModePosition() const;
63
64   void                        SetLayoutType(const int theType);
65   int                         GetLayoutType() const;
66
67   void                        SetWorldPoint(const double theWorldPoint[4]);
68   const double* GetWorldPoint() const;
69
70   void                        SetDistance(const double theDistance);
71   double        GetDistance() const;
72
73   void                        SetMoveFrameFlag(const int flag);
74   int                         GetMoveFrameFlag() const;
75
76   void                        SetForegroundColor(const double r,
77                                                  const double g,
78                                                  const double b);
79   void                        GetForegroundColor(double& r,
80                                                  double& g,
81                                                  double& b);
82
83   void                        SetBackgroundColor(const double r,
84                                                  const double g,
85                                                  const double b);
86   void                        GetBackgroundColor(double& r,
87                                                  double& g,
88                                                  double& b);
89
90   void                        SetTransparency(const double theTransparency);
91   double        GetTransparency() const;
92
93   void                        SetTextMargin(const int theMargin);
94   int                         GetTextMargin() const;
95
96   void                        SetOffset(const int theOffset[2]);
97
98 protected:
99   VTKViewer_FramedTextActor();
100   ~VTKViewer_FramedTextActor();
101
102 protected:
103   vtkPolyData*                myBar;
104   vtkPolyDataMapper2D*        myBarMapper;
105   vtkActor2D*                 myBarActor;
106
107   vtkTextProperty*            myTextProperty;
108   vtkTextMapper*              myTextMapper;
109   vtkActor2D*                 myTextActor;
110
111   vtkTimeStamp                myBuildTime;
112
113   int                         myModePosition;
114   int                         myLayoutType;
115   int                         myMoveFrameFlag;
116
117   double        myWorldPoint[4];
118   double        myDistance;
119   double        myTransparency;
120
121   int                         myTextMargin;
122
123   int                         myHorizontalOffset;
124   int                         myVerticalOffset;
125
126 private:
127   VTKViewer_FramedTextActor(const VTKViewer_FramedTextActor&);  // Not implemented.
128   void operator=(const VTKViewer_FramedTextActor&);  // Not implemented.
129 };
130
131 #endif