VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkLabeledDataMapper.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 =========================================================================*/ 00051 #ifndef __vtkLabeledDataMapper_h 00052 #define __vtkLabeledDataMapper_h 00053 00054 #include "vtkMapper2D.h" 00055 00056 class vtkDataObject; 00057 class vtkDataSet; 00058 class vtkTextMapper; 00059 class vtkTextProperty; 00060 class vtkTransform; 00061 00062 #define VTK_LABEL_IDS 0 00063 #define VTK_LABEL_SCALARS 1 00064 #define VTK_LABEL_VECTORS 2 00065 #define VTK_LABEL_NORMALS 3 00066 #define VTK_LABEL_TCOORDS 4 00067 #define VTK_LABEL_TENSORS 5 00068 #define VTK_LABEL_FIELD_DATA 6 00069 00070 class VTK_RENDERING_EXPORT vtkLabeledDataMapper : public vtkMapper2D 00071 { 00072 public: 00075 static vtkLabeledDataMapper *New(); 00076 00077 vtkTypeMacro(vtkLabeledDataMapper,vtkMapper2D); 00078 void PrintSelf(ostream& os, vtkIndent indent); 00079 00081 00089 vtkSetStringMacro(LabelFormat); 00090 vtkGetStringMacro(LabelFormat); 00092 00094 00099 vtkSetMacro(LabeledComponent,int); 00100 vtkGetMacro(LabeledComponent,int); 00102 00104 00107 void SetFieldDataArray(int arrayIndex); 00108 vtkGetMacro(FieldDataArray,int); 00110 00112 00115 void SetFieldDataName(const char *arrayName); 00116 vtkGetStringMacro(FieldDataName); 00118 00121 virtual void SetInput(vtkDataObject*); 00122 00125 vtkDataSet *GetInput(); 00126 00128 00132 vtkSetMacro(LabelMode, int); 00133 vtkGetMacro(LabelMode, int); 00134 void SetLabelModeToLabelIds() {this->SetLabelMode(VTK_LABEL_IDS);}; 00135 void SetLabelModeToLabelScalars() {this->SetLabelMode(VTK_LABEL_SCALARS);}; 00136 void SetLabelModeToLabelVectors() {this->SetLabelMode(VTK_LABEL_VECTORS);}; 00137 void SetLabelModeToLabelNormals() {this->SetLabelMode(VTK_LABEL_NORMALS);}; 00138 void SetLabelModeToLabelTCoords() {this->SetLabelMode(VTK_LABEL_TCOORDS);}; 00139 void SetLabelModeToLabelTensors() {this->SetLabelMode(VTK_LABEL_TENSORS);}; 00140 void SetLabelModeToLabelFieldData() 00141 {this->SetLabelMode(VTK_LABEL_FIELD_DATA);}; 00143 00145 00148 virtual void SetLabelTextProperty(vtkTextProperty *p) 00149 { this->SetLabelTextProperty(p, 0); } 00150 virtual vtkTextProperty* GetLabelTextProperty() 00151 { return this->GetLabelTextProperty(0); } 00152 virtual void SetLabelTextProperty(vtkTextProperty *p, int type); 00153 virtual vtkTextProperty* GetLabelTextProperty(int type); 00155 00157 00158 void RenderOpaqueGeometry(vtkViewport* viewport, vtkActor2D* actor); 00159 void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor); 00161 00163 virtual void ReleaseGraphicsResources(vtkWindow *); 00164 00166 00167 vtkGetObjectMacro(Transform, vtkTransform); 00168 void SetTransform(vtkTransform* t); 00170 00171 //BTX 00173 enum Coordinates 00174 { 00175 WORLD=0, 00176 DISPLAY=1 00177 }; 00178 //ETX 00179 00181 00184 vtkGetMacro(CoordinateSystem,int); 00185 vtkSetClampMacro(CoordinateSystem,int,WORLD,DISPLAY); 00186 void CoordinateSystemWorld() { this->SetCoordinateSystem( vtkLabeledDataMapper::WORLD ); } 00187 void CoordinateSystemDisplay() { this->SetCoordinateSystem( vtkLabeledDataMapper::DISPLAY ); } 00189 00191 virtual unsigned long GetMTime(); 00192 00193 protected: 00194 vtkLabeledDataMapper(); 00195 ~vtkLabeledDataMapper(); 00196 00197 vtkDataSet *Input; 00198 00199 char *LabelFormat; 00200 int LabelMode; 00201 int LabeledComponent; 00202 int FieldDataArray; 00203 char *FieldDataName; 00204 int CoordinateSystem; 00205 00206 vtkTimeStamp BuildTime; 00207 00208 int NumberOfLabels; 00209 int NumberOfLabelsAllocated; 00210 vtkTextMapper **TextMappers; 00211 double* LabelPositions; 00212 vtkTransform *Transform; 00213 00214 virtual int FillInputPortInformation(int, vtkInformation*); 00215 00216 void AllocateLabels(int numLabels); 00217 void BuildLabels(); 00218 void BuildLabelsInternal(vtkDataSet*); 00219 00220 //BTX 00221 class Internals; 00222 Internals* Implementation; 00223 //ETX 00224 00225 private: 00226 vtkLabeledDataMapper(const vtkLabeledDataMapper&); // Not implemented. 00227 void operator=(const vtkLabeledDataMapper&); // Not implemented. 00228 }; 00229 00230 #endif 00231