VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkLabeledDataMapper.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 =========================================================================*/ 00048 #ifndef __vtkLabeledDataMapper_h 00049 #define __vtkLabeledDataMapper_h 00050 00051 #include "vtkMapper2D.h" 00052 00053 class vtkDataObject; 00054 class vtkDataSet; 00055 class vtkTextMapper; 00056 class vtkTextProperty; 00057 class vtkTransform; 00058 00059 #define VTK_LABEL_IDS 0 00060 #define VTK_LABEL_SCALARS 1 00061 #define VTK_LABEL_VECTORS 2 00062 #define VTK_LABEL_NORMALS 3 00063 #define VTK_LABEL_TCOORDS 4 00064 #define VTK_LABEL_TENSORS 5 00065 #define VTK_LABEL_FIELD_DATA 6 00066 00067 class VTK_RENDERING_EXPORT vtkLabeledDataMapper : public vtkMapper2D 00068 { 00069 public: 00072 static vtkLabeledDataMapper *New(); 00073 00074 vtkTypeRevisionMacro(vtkLabeledDataMapper,vtkMapper2D); 00075 void PrintSelf(ostream& os, vtkIndent indent); 00076 00078 00086 vtkSetStringMacro(LabelFormat); 00087 vtkGetStringMacro(LabelFormat); 00089 00091 00096 vtkSetMacro(LabeledComponent,int); 00097 vtkGetMacro(LabeledComponent,int); 00099 00101 00104 void SetFieldDataArray(int arrayIndex); 00105 vtkGetMacro(FieldDataArray,int); 00107 00109 00112 void SetFieldDataName(const char *arrayName); 00113 vtkGetStringMacro(FieldDataName); 00115 00118 virtual void SetInput(vtkDataObject*); 00119 00122 vtkDataSet *GetInput(); 00123 00125 00129 vtkSetMacro(LabelMode, int); 00130 vtkGetMacro(LabelMode, int); 00131 void SetLabelModeToLabelIds() {this->SetLabelMode(VTK_LABEL_IDS);}; 00132 void SetLabelModeToLabelScalars() {this->SetLabelMode(VTK_LABEL_SCALARS);}; 00133 void SetLabelModeToLabelVectors() {this->SetLabelMode(VTK_LABEL_VECTORS);}; 00134 void SetLabelModeToLabelNormals() {this->SetLabelMode(VTK_LABEL_NORMALS);}; 00135 void SetLabelModeToLabelTCoords() {this->SetLabelMode(VTK_LABEL_TCOORDS);}; 00136 void SetLabelModeToLabelTensors() {this->SetLabelMode(VTK_LABEL_TENSORS);}; 00137 void SetLabelModeToLabelFieldData() 00138 {this->SetLabelMode(VTK_LABEL_FIELD_DATA);}; 00140 00142 00143 virtual void SetLabelTextProperty(vtkTextProperty *p); 00144 vtkGetObjectMacro(LabelTextProperty,vtkTextProperty); 00146 00148 00149 void RenderOpaqueGeometry(vtkViewport* viewport, vtkActor2D* actor); 00150 void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor); 00152 00154 virtual void ReleaseGraphicsResources(vtkWindow *); 00155 00157 00158 vtkGetObjectMacro(Transform, vtkTransform); 00159 void SetTransform(vtkTransform* t); 00161 00162 protected: 00163 vtkLabeledDataMapper(); 00164 ~vtkLabeledDataMapper(); 00165 00166 vtkDataSet *Input; 00167 vtkTextProperty *LabelTextProperty; 00168 00169 char *LabelFormat; 00170 int LabelMode; 00171 int LabeledComponent; 00172 int FieldDataArray; 00173 char *FieldDataName; 00174 00175 vtkTimeStamp BuildTime; 00176 00177 int NumberOfLabels; 00178 int NumberOfLabelsAllocated; 00179 vtkTextMapper **TextMappers; 00180 double* LabelPositions; 00181 vtkTransform *Transform; 00182 00183 virtual int FillInputPortInformation(int, vtkInformation*); 00184 00185 void AllocateLabels(int numLabels); 00186 void BuildLabels(); 00187 void BuildLabelsInternal(vtkDataSet*); 00188 private: 00189 vtkLabeledDataMapper(const vtkLabeledDataMapper&); // Not implemented. 00190 void operator=(const vtkLabeledDataMapper&); // Not implemented. 00191 }; 00192 00193 #endif 00194