VTK
dox/Interaction/Widgets/vtkTextRepresentation.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkTextRepresentation.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00029 #ifndef __vtkTextRepresentation_h
00030 #define __vtkTextRepresentation_h
00031 
00032 #include "vtkInteractionWidgetsModule.h" // For export macro
00033 #include "vtkBorderRepresentation.h"
00034 
00035 class vtkRenderer;
00036 class vtkTextActor;
00037 class vtkTextProperty;
00038 class vtkTextRepresentationObserver;
00039 
00040 class VTKINTERACTIONWIDGETS_EXPORT vtkTextRepresentation : public vtkBorderRepresentation
00041 {
00042 public:
00044   static vtkTextRepresentation *New();
00045 
00047 
00048   vtkTypeMacro(vtkTextRepresentation,vtkBorderRepresentation);
00049   void PrintSelf(ostream& os, vtkIndent indent);
00051 
00053 
00055   void SetTextActor(vtkTextActor *textActor);
00056   vtkGetObjectMacro(TextActor,vtkTextActor);
00058 
00060 
00061   void SetText(const char* text);
00062   const char* GetText();
00064 
00066 
00067   virtual void BuildRepresentation();
00068   virtual void GetSize(double size[2])
00069     {size[0]=2.0; size[1]=2.0;}
00071 
00073 
00075   virtual void GetActors2D(vtkPropCollection*);
00076   virtual void ReleaseGraphicsResources(vtkWindow*);
00077   virtual int RenderOverlay(vtkViewport*);
00078   virtual int RenderOpaqueGeometry(vtkViewport*);
00079   virtual int RenderTranslucentPolygonalGeometry(vtkViewport*);
00080   virtual int HasTranslucentPolygonalGeometry();
00082 
00083   //BTX
00084   enum
00085     {
00086     AnyLocation = 0,
00087     LowerLeftCorner,
00088     LowerRightCorner,
00089     LowerCenter,
00090     UpperLeftCorner,
00091     UpperRightCorner,
00092     UpperCenter
00093     };
00094   //ETX
00095 
00097 
00100   virtual void SetWindowLocation(int enumLocation);
00101   vtkGetMacro(WindowLocation, int);
00103 
00105 
00107   virtual void SetPosition(double x, double y);
00108   virtual void SetPosition(double pos[2])
00109     { this->SetPosition(pos[0], pos[1]);};
00111 
00113 
00114   void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
00115   void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
00117 
00118 protected:
00119   vtkTextRepresentation();
00120   ~vtkTextRepresentation();
00121 
00122   // Initialize text actor
00123   virtual void InitializeTextActor();
00124 
00125   // Check and adjust boundaries according to the size of the text
00126   virtual void CheckTextBoundary();
00127 
00128   // the text to manage
00129   vtkTextActor  *TextActor;
00130   vtkTextProperty *TextProperty;
00131 
00132   // Window location by enumeration
00133   int WindowLocation;
00134   virtual void UpdateWindowLocation();
00135 
00136   // observer to observe internal TextActor and TextProperty
00137   vtkTextRepresentationObserver *Observer;
00138 
00139 private:
00140   vtkTextRepresentation(const vtkTextRepresentation&);  //Not implemented
00141   void operator=(const vtkTextRepresentation&);  //Not implemented
00142 };
00143 
00144 #endif