VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkLabelRenderStrategy.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 =========================================================================*/ 00022 #ifndef __vtkLabelRenderStrategy_h 00023 #define __vtkLabelRenderStrategy_h 00024 00025 #include "vtkObject.h" 00026 00027 #include "vtkStdString.h" // For string support 00028 #include "vtkUnicodeString.h" // For unicode string support 00029 00030 class vtkRenderer; 00031 class vtkWindow; 00032 class vtkTextProperty; 00033 00034 class VTK_RENDERING_EXPORT vtkLabelRenderStrategy : public vtkObject 00035 { 00036 public: 00037 void PrintSelf(ostream& os, vtkIndent indent); 00038 vtkTypeMacro(vtkLabelRenderStrategy, vtkObject); 00039 00041 00044 virtual bool SupportsRotation() 00045 { return true; } 00047 00049 00054 virtual bool SupportsBoundedSize() 00055 { return true; } 00057 00059 00060 virtual void SetRenderer(vtkRenderer* ren); 00061 vtkGetObjectMacro(Renderer, vtkRenderer); 00063 00065 00066 virtual void SetDefaultTextProperty(vtkTextProperty* tprop); 00067 vtkGetObjectMacro(DefaultTextProperty, vtkTextProperty); 00069 00071 00074 virtual void ComputeLabelBounds(vtkTextProperty* tprop, vtkStdString label, 00075 double bds[4]) 00076 { this->ComputeLabelBounds(tprop, vtkUnicodeString::from_utf8(label.c_str()), 00077 bds); } 00078 virtual void ComputeLabelBounds(vtkTextProperty* tprop, vtkUnicodeString label, 00079 double bds[4]) = 0; 00081 00083 00090 virtual void RenderLabel(int x[2], vtkTextProperty* tprop, vtkStdString label) 00091 { this->RenderLabel(x, tprop, vtkUnicodeString::from_utf8(label)); } 00092 virtual void RenderLabel(int x[2], vtkTextProperty* tprop, vtkStdString label, 00093 int maxWidth) 00094 { this->RenderLabel(x, tprop, vtkUnicodeString::from_utf8(label), maxWidth); } 00095 virtual void RenderLabel(int x[2], vtkTextProperty* tprop, 00096 vtkUnicodeString label) = 0; 00097 virtual void RenderLabel(int x[2], vtkTextProperty* tprop, 00098 vtkUnicodeString label, int vtkNotUsed(maxWidth)) 00099 { this->RenderLabel(x, tprop, label); } 00101 00103 virtual void StartFrame() { } 00104 00106 virtual void EndFrame() { } 00107 00111 virtual void ReleaseGraphicsResources(vtkWindow *) { } 00112 00113 protected: 00114 vtkLabelRenderStrategy(); 00115 ~vtkLabelRenderStrategy(); 00116 00117 vtkRenderer* Renderer; 00118 vtkTextProperty* DefaultTextProperty; 00119 00120 private: 00121 vtkLabelRenderStrategy(const vtkLabelRenderStrategy&); // Not implemented. 00122 void operator=(const vtkLabelRenderStrategy&); // Not implemented. 00123 }; 00124 00125 #endif 00126