VTK
dox/Rendering/Label/vtkLabeledDataMapper.h
Go to the documentation of this file.
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 "vtkRenderingLabelModule.h" // For export macro
00055 #include "vtkMapper2D.h"
00056 
00057 class vtkDataObject;
00058 class vtkDataSet;
00059 class vtkTextMapper;
00060 class vtkTextProperty;
00061 class vtkTransform;
00062 
00063 #define VTK_LABEL_IDS        0
00064 #define VTK_LABEL_SCALARS    1
00065 #define VTK_LABEL_VECTORS    2
00066 #define VTK_LABEL_NORMALS    3
00067 #define VTK_LABEL_TCOORDS    4
00068 #define VTK_LABEL_TENSORS    5
00069 #define VTK_LABEL_FIELD_DATA 6
00070 
00071 class VTKRENDERINGLABEL_EXPORT vtkLabeledDataMapper : public vtkMapper2D
00072 {
00073 public:
00076   static vtkLabeledDataMapper *New();
00077 
00078   vtkTypeMacro(vtkLabeledDataMapper,vtkMapper2D);
00079   void PrintSelf(ostream& os, vtkIndent indent);
00080 
00082 
00090   vtkSetStringMacro(LabelFormat);
00091   vtkGetStringMacro(LabelFormat);
00093 
00095 
00100   vtkSetMacro(LabeledComponent,int);
00101   vtkGetMacro(LabeledComponent,int);
00103 
00105 
00108   void SetFieldDataArray(int arrayIndex);
00109   vtkGetMacro(FieldDataArray,int);
00111 
00113 
00116   void SetFieldDataName(const char *arrayName);
00117   vtkGetStringMacro(FieldDataName);
00119 
00122   virtual void SetInputData(vtkDataObject*);
00123 
00126   vtkDataSet *GetInput();
00127 
00129 
00133   vtkSetMacro(LabelMode, int);
00134   vtkGetMacro(LabelMode, int);
00135   void SetLabelModeToLabelIds() {this->SetLabelMode(VTK_LABEL_IDS);};
00136   void SetLabelModeToLabelScalars() {this->SetLabelMode(VTK_LABEL_SCALARS);};
00137   void SetLabelModeToLabelVectors() {this->SetLabelMode(VTK_LABEL_VECTORS);};
00138   void SetLabelModeToLabelNormals() {this->SetLabelMode(VTK_LABEL_NORMALS);};
00139   void SetLabelModeToLabelTCoords() {this->SetLabelMode(VTK_LABEL_TCOORDS);};
00140   void SetLabelModeToLabelTensors() {this->SetLabelMode(VTK_LABEL_TENSORS);};
00141   void SetLabelModeToLabelFieldData()
00142             {this->SetLabelMode(VTK_LABEL_FIELD_DATA);};
00144 
00146 
00149   virtual void SetLabelTextProperty(vtkTextProperty *p)
00150     { this->SetLabelTextProperty(p, 0); }
00151   virtual vtkTextProperty* GetLabelTextProperty()
00152     { return this->GetLabelTextProperty(0); }
00153   virtual void SetLabelTextProperty(vtkTextProperty *p, int type);
00154   virtual vtkTextProperty* GetLabelTextProperty(int type);
00156 
00158 
00159   void RenderOpaqueGeometry(vtkViewport* viewport, vtkActor2D* actor);
00160   void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor);
00162 
00164   virtual void ReleaseGraphicsResources(vtkWindow *);
00165 
00167 
00168   vtkGetObjectMacro(Transform, vtkTransform);
00169   void SetTransform(vtkTransform* t);
00171 
00172   //BTX
00174   enum Coordinates
00175     {
00176     WORLD=0,           
00177     DISPLAY=1          
00178     };
00179   //ETX
00180 
00182 
00185   vtkGetMacro(CoordinateSystem,int);
00186   vtkSetClampMacro(CoordinateSystem,int,WORLD,DISPLAY);
00187   void CoordinateSystemWorld() { this->SetCoordinateSystem( vtkLabeledDataMapper::WORLD ); }
00188   void CoordinateSystemDisplay() { this->SetCoordinateSystem( vtkLabeledDataMapper::DISPLAY ); }
00190 
00192   virtual unsigned long GetMTime();
00193 
00194 protected:
00195   vtkLabeledDataMapper();
00196   ~vtkLabeledDataMapper();
00197 
00198   vtkDataSet *Input;
00199 
00200   char  *LabelFormat;
00201   int   LabelMode;
00202   int   LabeledComponent;
00203   int   FieldDataArray;
00204   char  *FieldDataName;
00205   int CoordinateSystem;
00206 
00207   vtkTimeStamp BuildTime;
00208 
00209   int NumberOfLabels;
00210   int NumberOfLabelsAllocated;
00211   vtkTextMapper **TextMappers;
00212   double* LabelPositions;
00213   vtkTransform *Transform;
00214 
00215   virtual int FillInputPortInformation(int, vtkInformation*);
00216 
00217   void AllocateLabels(int numLabels);
00218   void BuildLabels();
00219   void BuildLabelsInternal(vtkDataSet*);
00220 
00221   //BTX
00222   class Internals;
00223   Internals* Implementation;
00224   //ETX
00225 
00226 private:
00227   vtkLabeledDataMapper(const vtkLabeledDataMapper&);  // Not implemented.
00228   void operator=(const vtkLabeledDataMapper&);  // Not implemented.
00229 };
00230 
00231 #endif
00232