VTK
dox/Rendering/Label/vtkLabeledTreeMapDataMapper.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkLabeledTreeMapDataMapper.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 =========================================================================*/
00015 /*-------------------------------------------------------------------------
00016   Copyright 2008 Sandia Corporation.
00017   Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00018   the U.S. Government retains certain rights in this software.
00019 -------------------------------------------------------------------------*/
00043 #ifndef __vtkLabeledTreeMapDataMapper_h
00044 #define __vtkLabeledTreeMapDataMapper_h
00045 
00046 #include "vtkRenderingLabelModule.h" // For export macro
00047 #include "vtkLabeledDataMapper.h"
00048 
00049 class vtkTree;
00050 class vtkPoints;
00051 class vtkCoordinate;
00052 class vtkFloatArray;
00053 class vtkStringArray;
00054 class vtkIdList;
00055 
00056 class VTKRENDERINGLABEL_EXPORT vtkLabeledTreeMapDataMapper : public vtkLabeledDataMapper
00057 {
00058 public:
00059   static vtkLabeledTreeMapDataMapper *New();
00060   vtkTypeMacro(vtkLabeledTreeMapDataMapper,vtkLabeledDataMapper);
00061   void PrintSelf(ostream& os, vtkIndent indent);
00062 
00064 
00065   virtual void RenderOpaqueGeometry(vtkViewport* viewport, vtkActor2D* actor);
00066   virtual void RenderOverlay(vtkViewport *viewport, vtkActor2D *actor);
00068 
00070   virtual vtkTree *GetInputTree();
00071 
00073   virtual void SetRectanglesArrayName(const char* name);
00074 
00076 
00079   vtkGetMacro(ClipTextMode, int);
00080   vtkSetMacro(ClipTextMode, int);
00082 
00084 
00085   vtkGetMacro(ChildMotion, int);
00086   vtkSetMacro(ChildMotion, int);
00088 
00090 
00091   vtkGetMacro(DynamicLevel, int);
00092   vtkSetMacro(DynamicLevel, int);
00094 
00096   virtual void ReleaseGraphicsResources(vtkWindow *);
00097 
00099 
00100   void SetFontSizeRange(int maxSize, int minSize, int delta=4);
00101   void GetFontSizeRange(int range[3]);
00103 
00105 
00107   void SetLevelRange(int startLevel, int endLevel);
00108   void GetLevelRange(int range[2]);
00110 
00111 protected:
00112   vtkLabeledTreeMapDataMapper();
00113   ~vtkLabeledTreeMapDataMapper();
00114   void LabelTree(vtkTree *tree, vtkFloatArray *boxInfo,
00115                  vtkDataArray *numericData, vtkStringArray *stringData,
00116                  int activeComp, int numComps);
00117   void GetVertexLabel(vtkIdType vertex, vtkDataArray *numericData,
00118                     vtkStringArray *stringData, int activeComp, int numComps,
00119                     char *string);
00120   void UpdateFontSizes();
00121   int UpdateWindowInfo(vtkViewport *viewport);
00122   int GetStringSize(char *string, int level);
00123   // Returns 1 if the transformed box is off screen
00124   int ConvertToDC(float *origBoxInfo, float *newBoxInfo);
00125   // Returns 1 if the label will not fit in box - 2 if the text could
00126   // not be placed due to other labels
00127   int AnalyseLabel(char * string, int level, float *blimitsDC,
00128                    float *textPosWC,
00129                    vtkTextProperty **tprop);
00130   int ApplyMasks(int level, float flimits[4], float blimits[4]);
00131   vtkViewport *CurrentViewPort;
00132   int *FontHeights;
00133   int **FontWidths;
00134   int MaxFontLevel;
00135   int *ChildrenCount;
00136   int MaxTreeLevels;
00137   double BoxTrans[2][2];
00138   double WindowLimits[2][2];
00139   //BTX
00140   float (*LabelMasks)[4];
00141   //ETX
00142   vtkIdList *VertexList;
00143   vtkPoints *TextPoints;
00144   vtkCoordinate *VCoord;
00145   int ClipTextMode;
00146   int ChildMotion;
00147   int StartLevel;
00148   int EndLevel;
00149   int DynamicLevel;
00150   vtkTextProperty *VerticalLabelProperty;
00151   vtkTextProperty **HLabelProperties;
00152 
00153 private:
00154   vtkLabeledTreeMapDataMapper(const vtkLabeledTreeMapDataMapper&);  // Not implemented.
00155   void operator=(const vtkLabeledTreeMapDataMapper&);  // Not implemented.
00156 };
00157 
00158 
00159 #endif