Salome HOME
updated copyright message
[modules/gui.git] / src / VTKViewer / VTKViewer_FramedTextActor.h
1 // Copyright (C) 2007-2023  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, or (at your option) any later version.
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 class vtkTextActor;
36
37 class VTKVIEWER_EXPORT VTKViewer_FramedTextActor : public vtkActor2D
38 {
39 public:
40   enum ModePosition { BelowPoint = 0, TopLeft, TopRight, BottomLeft, BottomRight };
41   enum LayoutType { Vertical = 0, Horizontal };
42
43 public:
44   vtkTypeMacro(VTKViewer_FramedTextActor,vtkActor2D)
45   static VTKViewer_FramedTextActor *New();
46
47   virtual int                 RenderOpaqueGeometry(vtkViewport*);
48   virtual int                 RenderTranslucentGeometry(vtkViewport*) { return 0; }
49   virtual int                 RenderOverlay(vtkViewport*);
50   virtual void                ReleaseGraphicsResources(vtkWindow*);
51
52   virtual void                SetVisibility(int);
53   virtual int                 GetVisibility();
54   virtual void                SetPickable(int);
55   virtual int                 GetPickable();
56
57   virtual void                GetSize(vtkRenderer* vport, double theSize[2]) const;
58
59   void                        SetText(const char* theText);
60   char*                       GetText();
61
62   void                        SetModePosition(const int theMode);
63   int                         GetModePosition() const;
64
65   void                        SetLayoutType(const int theType);
66   int                         GetLayoutType() const;
67
68   void                        SetWorldPoint(const double theWorldPoint[4]);
69   const double* GetWorldPoint() const;
70
71   void                        SetDistance(const double theDistance);
72   double        GetDistance() const;
73
74   void                        SetMoveFrameFlag(const int flag);
75   int                         GetMoveFrameFlag() const;
76
77   void                        SetForegroundColor(const double r,
78                                                  const double g,
79                                                  const double b);
80   void                        GetForegroundColor(double& r,
81                                                  double& g,
82                                                  double& b);
83
84   void                        SetBackgroundColor(const double r,
85                                                  const double g,
86                                                  const double b);
87   void                        GetBackgroundColor(double& r,
88                                                  double& g,
89                                                  double& b);
90
91   void                        SetTransparency(const double theTransparency);
92   double        GetTransparency() const;
93
94   void                        SetTextMargin(const int theMargin);
95   int                         GetTextMargin() const;
96
97   void                        SetOffset(const double theOffset[2]);
98
99 protected:
100   VTKViewer_FramedTextActor();
101   ~VTKViewer_FramedTextActor();
102
103 protected:
104   vtkPolyData*                myBar;
105   vtkPolyDataMapper2D*        myBarMapper;
106   vtkActor2D*                 myBarActor;
107
108   vtkTextProperty*            myTextProperty;
109   vtkTextActor*               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