VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkTextRepresentation.h,v $ 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 =========================================================================*/ 00026 #ifndef __vtkTextRepresentation_h 00027 #define __vtkTextRepresentation_h 00028 00029 #include "vtkBorderRepresentation.h" 00030 00031 class vtkRenderer; 00032 class vtkTextActor; 00033 class vtkTextProperty; 00034 class vtkTextRepresentationObserver; 00035 00036 class VTK_WIDGETS_EXPORT vtkTextRepresentation : public vtkBorderRepresentation 00037 { 00038 public: 00040 static vtkTextRepresentation *New(); 00041 00043 00044 vtkTypeRevisionMacro(vtkTextRepresentation,vtkBorderRepresentation); 00045 void PrintSelf(ostream& os, vtkIndent indent); 00047 00049 00051 void SetTextActor(vtkTextActor *textActor); 00052 vtkGetObjectMacro(TextActor,vtkTextActor); 00054 00056 00057 void SetText(const char* text); 00058 const char* GetText(); 00060 00062 00063 virtual void BuildRepresentation(); 00064 virtual void GetSize(double size[2]) 00065 {size[0]=2.0; size[1]=2.0;} 00067 00069 00071 virtual void GetActors2D(vtkPropCollection*); 00072 virtual void ReleaseGraphicsResources(vtkWindow*); 00073 virtual int RenderOverlay(vtkViewport*); 00074 virtual int RenderOpaqueGeometry(vtkViewport*); 00075 virtual int RenderTranslucentPolygonalGeometry(vtkViewport*); 00076 virtual int HasTranslucentPolygonalGeometry(); 00078 00079 //BTX 00080 enum 00081 { 00082 AnyLocation = 0, 00083 LowerLeftCorner, 00084 LowerRightCorner, 00085 LowerCenter, 00086 UpperLeftCorner, 00087 UpperRightCorner, 00088 UpperCenter 00089 }; 00090 //ETX 00091 00093 00096 virtual void SetWindowLocation(int enumLocation); 00097 vtkGetMacro(WindowLocation, int); 00099 00101 00103 virtual void SetPosition(double x, double y); 00104 virtual void SetPosition(double pos[2]) 00105 { this->SetPosition(pos[0], pos[1]);}; 00107 00109 00110 void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p); 00111 void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p); 00113 00114 protected: 00115 vtkTextRepresentation(); 00116 ~vtkTextRepresentation(); 00117 00118 // Initialize text actor 00119 virtual void InitializeTextActor(); 00120 00121 // Check and adjust boundaries according to the size of the text 00122 virtual void CheckTextBoundary(); 00123 00124 // the text to manage 00125 vtkTextActor *TextActor; 00126 vtkTextProperty *TextProperty; 00127 00128 // Window location by enumeration 00129 int WindowLocation; 00130 virtual void UpdateWindowLocation(); 00131 00132 // observer to observe internal TextActor and TextProperty 00133 vtkTextRepresentationObserver *Observer; 00134 00135 private: 00136 vtkTextRepresentation(const vtkTextRepresentation&); //Not implemented 00137 void operator=(const vtkTextRepresentation&); //Not implemented 00138 }; 00139 00140 #endif