VTK
dox/Rendering/Annotation/vtkScalarBarActorInternal.h
Go to the documentation of this file.
00001 #ifndef __vtkScalarBarActorInternal_h
00002 #define __vtkScalarBarActorInternal_h
00003 // VTK-HeaderTest-Exclude: vtkScalarBarActorInternal.h
00004 
00005 #include "vtkColor.h" // for AnnotationColors, LabelColorMap, and tuples
00006 #include "vtkFreeTypeUtilities.h" // for bounding box calculations
00007 #include "vtkSmartPointer.h" // for "smart vectors"
00008 #include "vtkStdString.h" // for LabelMap
00009 
00010 #include <map>
00011 #include <vector>
00012 
00013 class vtkActor2D;
00014 class vtkCellArray;
00015 class vtkTextActor;
00016 class vtkPoints;
00017 class vtkPolyData;
00018 class vtkPolyDataMapper2D;
00019 class vtkUnsignedCharArray;
00020 
00022 template<class T>
00023 class vtkSmartVector : public std::vector<vtkSmartPointer<T> >
00024 {
00025 public:
00029   T** PointerArray()
00030     {
00031     // NB: This is relatively evil. But much cheaper than copying the array.
00032     // It assumes the compiler won't pad the class.
00033     return reinterpret_cast<T**>(&((*this)[0]));
00034     }
00035 };
00036 
00038 struct vtkScalarBarBox
00039 {
00041   vtkTuple<int,2> Posn;
00042 
00050   vtkTuple<int,2> Size;
00051 };
00052 
00054 class vtkScalarBarActorInternal
00055 {
00056 public:
00057   vtkScalarBarActorInternal()
00058     {
00059     this->Viewport = 0;
00060     this->SwatchColors = 0;
00061     this->SwatchPts = 0;
00062     this->Polys = 0;
00063     this->AnnotationBoxes = 0;
00064     this->AnnotationBoxesMapper = 0;
00065     this->AnnotationBoxesActor = 0;
00066     this->AnnotationLeaders = 0;
00067     this->AnnotationLeadersMapper = 0;
00068     this->AnnotationLeadersActor = 0;
00069     this->NanSwatch = 0;
00070     this->NanSwatchMapper = 0;
00071     this->NanSwatchActor = 0;
00072     }
00073 
00074   // Define types for smart vectors containing various base classes.
00075   typedef vtkSmartVector<vtkTextActor> ActorVec;
00076   typedef vtkSmartVector<vtkTextActor> MathActorVec;
00077 
00078   // Other vector container types.
00079   typedef std::vector<double> DoubleVec;
00080   typedef std::vector<vtkColor3ub> ColorVec;
00081 
00087   vtkViewport* Viewport;
00089   float DPI;
00091   double NanSwatchSize;
00093   double SwatchPad;
00095   int NumNotes;
00097   int NumColors;
00099   int NumSwatches;
00101   int TL[2]; // VERTICAL => TL={0,1}, HORIZONTAL => TL={1,0}, Size[TL[0]] == width, Size[TL[1]] == height
00103   vtkPoints* SwatchPts;
00105   vtkCellArray* Polys;
00107   vtkUnsignedCharArray* SwatchColors;
00109   vtkScalarBarBox Frame;
00111   vtkScalarBarBox ScalarBarBox;
00113   vtkScalarBarBox NanBox;
00115   vtkScalarBarBox TickBox;
00117   vtkScalarBarBox TitleBox;
00119   std::map<double,vtkStdString> Labels;
00121   std::map<double,vtkColor3ub> LabelColors;
00123 
00125 
00126   ActorVec TextActors;
00127   vtkPolyData*         AnnotationBoxes;
00128   vtkPolyDataMapper2D* AnnotationBoxesMapper;
00129   vtkActor2D*          AnnotationBoxesActor;
00130   vtkPolyData*         AnnotationLeaders;
00131   vtkPolyDataMapper2D* AnnotationLeadersMapper;
00132   vtkActor2D*          AnnotationLeadersActor;
00133   ActorVec             AnnotationLabels;
00134   std::vector<double>  AnnotationAnchors;
00135   std::vector<vtkColor3ub> AnnotationColors;
00136   vtkPolyData*         NanSwatch;
00137   vtkPolyDataMapper2D* NanSwatchMapper;
00138   vtkActor2D*          NanSwatchActor;
00140 };
00141 
00142 #endif // __vtkScalarBarActorInternal_h