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 "vtkRenderingLabelModule.h" // For export macro 00026 #include "vtkObject.h" 00027 00028 #include "vtkStdString.h" // For string support 00029 #include "vtkUnicodeString.h" // For unicode string support 00030 00031 class vtkRenderer; 00032 class vtkWindow; 00033 class vtkTextProperty; 00034 00035 class VTKRENDERINGLABEL_EXPORT vtkLabelRenderStrategy : public vtkObject 00036 { 00037 public: 00038 void PrintSelf(ostream& os, vtkIndent indent); 00039 vtkTypeMacro(vtkLabelRenderStrategy, vtkObject); 00040 00042 00045 virtual bool SupportsRotation() 00046 { return true; } 00048 00050 00055 virtual bool SupportsBoundedSize() 00056 { return true; } 00058 00060 00061 virtual void SetRenderer(vtkRenderer* ren); 00062 vtkGetObjectMacro(Renderer, vtkRenderer); 00064 00066 00067 virtual void SetDefaultTextProperty(vtkTextProperty* tprop); 00068 vtkGetObjectMacro(DefaultTextProperty, vtkTextProperty); 00070 00072 00075 virtual void ComputeLabelBounds(vtkTextProperty* tprop, vtkStdString label, 00076 double bds[4]) 00077 { this->ComputeLabelBounds(tprop, vtkUnicodeString::from_utf8(label.c_str()), 00078 bds); } 00079 virtual void ComputeLabelBounds(vtkTextProperty* tprop, vtkUnicodeString label, 00080 double bds[4]) = 0; 00082 00084 00091 virtual void RenderLabel(int x[2], vtkTextProperty* tprop, vtkStdString label) 00092 { this->RenderLabel(x, tprop, vtkUnicodeString::from_utf8(label)); } 00093 virtual void RenderLabel(int x[2], vtkTextProperty* tprop, vtkStdString label, 00094 int maxWidth) 00095 { this->RenderLabel(x, tprop, vtkUnicodeString::from_utf8(label), maxWidth); } 00096 virtual void RenderLabel(int x[2], vtkTextProperty* tprop, 00097 vtkUnicodeString label) = 0; 00098 virtual void RenderLabel(int x[2], vtkTextProperty* tprop, 00099 vtkUnicodeString label, int vtkNotUsed(maxWidth)) 00100 { this->RenderLabel(x, tprop, label); } 00102 00104 virtual void StartFrame() { } 00105 00107 virtual void EndFrame() { } 00108 00112 virtual void ReleaseGraphicsResources(vtkWindow *) { } 00113 00114 protected: 00115 vtkLabelRenderStrategy(); 00116 ~vtkLabelRenderStrategy(); 00117 00118 vtkRenderer* Renderer; 00119 vtkTextProperty* DefaultTextProperty; 00120 00121 private: 00122 vtkLabelRenderStrategy(const vtkLabelRenderStrategy&); // Not implemented. 00123 void operator=(const vtkLabelRenderStrategy&); // Not implemented. 00124 }; 00125 00126 #endif 00127