VTK
dox/Rendering/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 "vtkLabeledDataMapper.h"
00047 
00048 class vtkTree;
00049 class vtkPoints;
00050 class vtkCoordinate;
00051 class vtkFloatArray;
00052 class vtkStringArray;
00053 class vtkIdList;
00054 
00055 class VTK_RENDERING_EXPORT vtkLabeledTreeMapDataMapper : public vtkLabeledDataMapper
00056 {
00057 public:
00058   static vtkLabeledTreeMapDataMapper *New();
00059   vtkTypeMacro(vtkLabeledTreeMapDataMapper,vtkLabeledDataMapper);
00060   void PrintSelf(ostream& os, vtkIndent indent);
00061 
00063 
00064   virtual void RenderOpaqueGeometry(vtkViewport* viewport, vtkActor2D* actor);
00065   virtual void RenderOverlay(vtkViewport *viewport, vtkActor2D *actor);
00067 
00069   virtual vtkTree *GetInputTree();
00070 
00072   virtual void SetRectanglesArrayName(const char* name);
00073 
00075 
00078   vtkGetMacro(ClipTextMode, int);
00079   vtkSetMacro(ClipTextMode, int);
00081 
00083 
00084   vtkGetMacro(ChildMotion, int);
00085   vtkSetMacro(ChildMotion, int);
00087 
00089 
00090   vtkGetMacro(DynamicLevel, int);
00091   vtkSetMacro(DynamicLevel, int);
00093 
00095   virtual void ReleaseGraphicsResources(vtkWindow *);
00096 
00098 
00099   void SetFontSizeRange(int maxSize, int minSize, int delta=4);
00100   void GetFontSizeRange(int range[3]);
00102 
00104 
00106   void SetLevelRange(int startLevel, int endLevel);
00107   void GetLevelRange(int range[2]);
00109 
00110 protected:
00111   vtkLabeledTreeMapDataMapper();
00112   ~vtkLabeledTreeMapDataMapper();
00113   void LabelTree(vtkTree *tree, vtkFloatArray *boxInfo,
00114                  vtkDataArray *numericData, vtkStringArray *stringData, 
00115                  int activeComp, int numComps);
00116   void GetVertexLabel(vtkIdType vertex, vtkDataArray *numericData, 
00117                     vtkStringArray *stringData, int activeComp, int numComps, 
00118                     char *string);
00119   void UpdateFontSizes();
00120   int UpdateWindowInfo(vtkViewport *viewport);
00121   int GetStringSize(char *string, int level);
00122   // Returns 1 if the transformed box is off screen
00123   int ConvertToDC(float *origBoxInfo, float *newBoxInfo);
00124   // Returns 1 if the label will not fit in box - 2 if the text could 
00125   // not be placed due to other labels
00126   int AnalyseLabel(char * string, int level, float *blimitsDC,
00127                    float *textPosWC,
00128                    vtkTextProperty **tprop);
00129   int ApplyMasks(int level, float flimits[4], float blimits[4]);
00130   vtkViewport *CurrentViewPort;
00131   int *FontHeights;
00132   int **FontWidths;
00133   int MaxFontLevel;
00134   int *ChildrenCount;
00135   int MaxTreeLevels;
00136   double BoxTrans[2][2];
00137   double WindowLimits[2][2];
00138   //BTX
00139   float (*LabelMasks)[4];
00140   //ETX
00141   vtkIdList *VertexList;
00142   vtkPoints *TextPoints;
00143   vtkCoordinate *VCoord;
00144   int ClipTextMode;
00145   int ChildMotion;
00146   int StartLevel;
00147   int EndLevel;
00148   int DynamicLevel;
00149   vtkTextProperty *VerticalLabelProperty;
00150   vtkTextProperty **HLabelProperties;
00151 
00152 private:
00153   vtkLabeledTreeMapDataMapper(const vtkLabeledTreeMapDataMapper&);  // Not implemented.
00154   void operator=(const vtkLabeledTreeMapDataMapper&);  // Not implemented.
00155 };
00156 
00157 
00158 #endif