VTK
|
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 "vtkBorderRepresentation.h" 00033 00034 class vtkRenderer; 00035 class vtkTextActor; 00036 class vtkTextProperty; 00037 class vtkTextRepresentationObserver; 00038 00039 class VTK_WIDGETS_EXPORT vtkTextRepresentation : public vtkBorderRepresentation 00040 { 00041 public: 00043 static vtkTextRepresentation *New(); 00044 00046 00047 vtkTypeMacro(vtkTextRepresentation,vtkBorderRepresentation); 00048 void PrintSelf(ostream& os, vtkIndent indent); 00050 00052 00054 void SetTextActor(vtkTextActor *textActor); 00055 vtkGetObjectMacro(TextActor,vtkTextActor); 00057 00059 00060 void SetText(const char* text); 00061 const char* GetText(); 00063 00065 00066 virtual void BuildRepresentation(); 00067 virtual void GetSize(double size[2]) 00068 {size[0]=2.0; size[1]=2.0;} 00070 00072 00074 virtual void GetActors2D(vtkPropCollection*); 00075 virtual void ReleaseGraphicsResources(vtkWindow*); 00076 virtual int RenderOverlay(vtkViewport*); 00077 virtual int RenderOpaqueGeometry(vtkViewport*); 00078 virtual int RenderTranslucentPolygonalGeometry(vtkViewport*); 00079 virtual int HasTranslucentPolygonalGeometry(); 00081 00082 //BTX 00083 enum 00084 { 00085 AnyLocation = 0, 00086 LowerLeftCorner, 00087 LowerRightCorner, 00088 LowerCenter, 00089 UpperLeftCorner, 00090 UpperRightCorner, 00091 UpperCenter 00092 }; 00093 //ETX 00094 00096 00099 virtual void SetWindowLocation(int enumLocation); 00100 vtkGetMacro(WindowLocation, int); 00102 00104 00106 virtual void SetPosition(double x, double y); 00107 virtual void SetPosition(double pos[2]) 00108 { this->SetPosition(pos[0], pos[1]);}; 00110 00112 00113 void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p); 00114 void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p); 00116 00117 protected: 00118 vtkTextRepresentation(); 00119 ~vtkTextRepresentation(); 00120 00121 // Initialize text actor 00122 virtual void InitializeTextActor(); 00123 00124 // Check and adjust boundaries according to the size of the text 00125 virtual void CheckTextBoundary(); 00126 00127 // the text to manage 00128 vtkTextActor *TextActor; 00129 vtkTextProperty *TextProperty; 00130 00131 // Window location by enumeration 00132 int WindowLocation; 00133 virtual void UpdateWindowLocation(); 00134 00135 // observer to observe internal TextActor and TextProperty 00136 vtkTextRepresentationObserver *Observer; 00137 00138 private: 00139 vtkTextRepresentation(const vtkTextRepresentation&); //Not implemented 00140 void operator=(const vtkTextRepresentation&); //Not implemented 00141 }; 00142 00143 #endif