Back to index

salome-gui  6.5.0
VTKViewer_FramedTextActor.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef VTKVIEWER_FRAMEDTEXTACTOR_H
00021 #define VTKVIEWER_FRAMEDTEXTACTOR_H
00022 
00023 #include "VTKViewer.h"
00024 
00025 #include <vtkActor2D.h>
00026 
00027 class vtkPolyData;
00028 class vtkPolyDataMapper2D;
00029 class vtkRenderer;
00030 class vtkTimeStamp;
00031 class vtkTextMapper;
00032 class vtkTextProperty;
00033 class vtkViewport;
00034 class vtkWindow;
00035 
00036 class VTKVIEWER_EXPORT VTKViewer_FramedTextActor : public vtkActor2D
00037 {
00038 public:
00039   enum ModePosition { BelowPoint = 0, TopLeft, TopRight, BottomLeft, BottomRight };
00040   enum LayoutType { Vertical = 0, Horizontal };
00041 
00042 public:
00043   vtkTypeRevisionMacro(VTKViewer_FramedTextActor,vtkActor2D);
00044   static VTKViewer_FramedTextActor *New();
00045 
00046   virtual int                 RenderOpaqueGeometry(vtkViewport*);
00047   virtual int                 RenderTranslucentGeometry(vtkViewport*) { return 0; }
00048   virtual int                 RenderOverlay(vtkViewport*);
00049   virtual void                ReleaseGraphicsResources(vtkWindow*);
00050 
00051   virtual void                SetVisibility(int);
00052   virtual int                 GetVisibility();
00053   virtual void                SetPickable(int);
00054   virtual int                 GetPickable();
00055 
00056   virtual void                GetSize(vtkRenderer* theRenderer, int theSize[2]) const;
00057 
00058   void                        SetText(const char* theText);
00059   char*                       GetText();
00060 
00061   void                        SetModePosition(const int theMode);
00062   int                         GetModePosition() const;
00063 
00064   void                        SetLayoutType(const int theType);
00065   int                         GetLayoutType() const;
00066 
00067   void                        SetWorldPoint(const vtkFloatingPointType theWorldPoint[4]);
00068   const vtkFloatingPointType* GetWorldPoint() const;
00069 
00070   void                        SetDistance(const vtkFloatingPointType theDistance);
00071   vtkFloatingPointType        GetDistance() const;
00072 
00073   void                        SetMoveFrameFlag(const int flag);
00074   int                         GetMoveFrameFlag() const;
00075 
00076   void                        SetForegroundColor(const vtkFloatingPointType r,
00077                                                  const vtkFloatingPointType g,
00078                                                  const vtkFloatingPointType b);
00079   void                        GetForegroundColor(vtkFloatingPointType& r,
00080                                                  vtkFloatingPointType& g,
00081                                                  vtkFloatingPointType& b);
00082 
00083   void                        SetBackgroundColor(const vtkFloatingPointType r,
00084                                                  const vtkFloatingPointType g,
00085                                                  const vtkFloatingPointType b);
00086   void                        GetBackgroundColor(vtkFloatingPointType& r,
00087                                                  vtkFloatingPointType& g,
00088                                                  vtkFloatingPointType& b);
00089 
00090   void                        SetTransparency(const vtkFloatingPointType theTransparency);
00091   vtkFloatingPointType        GetTransparency() const;
00092 
00093   void                        SetTextMargin(const int theMargin);
00094   int                         GetTextMargin() const;
00095 
00096   void                        SetOffset(const int theOffset[2]);
00097 
00098 protected:
00099   VTKViewer_FramedTextActor();
00100   ~VTKViewer_FramedTextActor();
00101 
00102 protected:
00103   vtkPolyData*                myBar;
00104   vtkPolyDataMapper2D*        myBarMapper;
00105   vtkActor2D*                 myBarActor;
00106 
00107   vtkTextProperty*            myTextProperty;
00108   vtkTextMapper*              myTextMapper;
00109   vtkActor2D*                 myTextActor;
00110 
00111   vtkTimeStamp                myBuildTime;
00112 
00113   int                         myModePosition;
00114   int                         myLayoutType;
00115   int                         myMoveFrameFlag;
00116 
00117   vtkFloatingPointType        myWorldPoint[4];
00118   vtkFloatingPointType        myDistance;
00119   vtkFloatingPointType        myTransparency;
00120 
00121   int                         myTextMargin;
00122 
00123   int                         myHorizontalOffset;
00124   int                         myVerticalOffset;
00125 
00126 private:
00127   VTKViewer_FramedTextActor(const VTKViewer_FramedTextActor&);  // Not implemented.
00128   void operator=(const VTKViewer_FramedTextActor&);  // Not implemented.
00129 };
00130 
00131 #endif