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 00070 //BTX 00072 00075 virtual void ComputeLabelBounds(vtkTextProperty* tprop, vtkStdString label, double bds[4]) 00076 { this->ComputeLabelBounds(tprop, vtkUnicodeString::from_utf8(label.c_str()), bds); } 00077 virtual void ComputeLabelBounds(vtkTextProperty* tprop, vtkUnicodeString label, double bds[4]) = 0; 00079 00081 00088 virtual void RenderLabel(int x[2], vtkTextProperty* tprop, vtkStdString label) 00089 { this->RenderLabel(x, tprop, vtkUnicodeString::from_utf8(label)); } 00090 virtual void RenderLabel(int x[2], vtkTextProperty* tprop, vtkStdString label, int maxWidth) 00091 { this->RenderLabel(x, tprop, vtkUnicodeString::from_utf8(label), maxWidth); } 00092 virtual void RenderLabel(int x[2], vtkTextProperty* tprop, vtkUnicodeString label) = 0; 00093 virtual void RenderLabel(int x[2], vtkTextProperty* tprop, vtkUnicodeString label, int vtkNotUsed(maxWidth)) 00094 { this->RenderLabel(x, tprop, label); } 00095 //ETX 00097 00099 virtual void StartFrame() { } 00100 00102 virtual void EndFrame() { } 00103 00107 virtual void ReleaseGraphicsResources(vtkWindow *) { } 00108 00109 protected: 00110 vtkLabelRenderStrategy(); 00111 ~vtkLabelRenderStrategy(); 00112 00113 vtkRenderer* Renderer; 00114 vtkTextProperty* DefaultTextProperty; 00115 00116 private: 00117 vtkLabelRenderStrategy(const vtkLabelRenderStrategy&); // Not implemented. 00118 void operator=(const vtkLabelRenderStrategy&); // Not implemented. 00119 }; 00120 00121 #endif 00122