00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkTreeMapViewer.h,v $ 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 -------------------------------------------------------------------------*/ 00044 #ifndef __vtkTreeMapViewer_h 00045 #define __vtkTreeMapViewer_h 00046 00047 #include "vtkObject.h" 00048 #include "vtkSmartPointer.h" // Required for smart pointer internal ivars. 00049 00050 class vtkTree; 00051 class vtkTreeLevelsFilter; 00052 class vtkTreeFieldAggregator; 00053 class vtkTreeMapLayout; 00054 class vtkTreeMapLayoutStrategy; 00055 class vtkTreeMapToPolyData; 00056 class vtkPolyDataMapper; 00057 class vtkAlgorithmOutput; 00058 class vtkActor; 00059 class vtkActor2D; 00060 class vtkRenderWindowInteractor; 00061 class vtkInteractorStyleTreeMapHover; 00062 class vtkRenderWindow; 00063 class vtkRenderer; 00064 class vtkRenderWindowInteractor; 00065 class vtkLookupTable; 00066 class vtkThreshold; 00067 class vtkLabeledDataMapper; 00068 class vtkLabeledTreeMapDataMapper; 00069 00070 class VTK_INFOVIS_EXPORT vtkTreeMapViewer : public vtkObject 00071 { 00072 public: 00073 static vtkTreeMapViewer *New(); 00074 vtkTypeRevisionMacro(vtkTreeMapViewer,vtkObject); 00075 void PrintSelf(ostream& os, vtkIndent indent); 00076 00078 virtual void SetInput(vtkTree *arg); 00079 00081 00082 virtual void SetRenderWindow(vtkRenderWindow *arg); 00083 vtkGetObjectMacro(RenderWindow, vtkRenderWindow); 00085 00087 00088 virtual void SetAggregationFieldName(const char *field); 00089 virtual char* GetAggregationFieldName(); 00091 00093 00094 vtkGetObjectMacro(InteractorStyle, vtkInteractorStyleTreeMapHover); 00096 00097 00098 //BTX 00099 enum { 00100 BOX_LAYOUT, 00101 SLICE_AND_DICE_LAYOUT, 00102 SQUARIFY_LAYOUT, 00103 NUMBER_OF_LAYOUTS 00104 }; 00105 //ETX 00106 00108 00109 virtual void SetLayoutStrategy(int strategy); 00110 void SetLayoutStrategyToBox() { this->SetLayoutStrategy(BOX_LAYOUT); } 00111 void SetLayoutStrategyToSliceAndDice() { 00112 this->SetLayoutStrategy(SLICE_AND_DICE_LAYOUT); 00113 } 00114 void SetLayoutStrategyToSquarify() { 00115 this->SetLayoutStrategy(SQUARIFY_LAYOUT); 00116 } 00117 virtual int GetLayoutStrategy(); 00119 00121 00122 void SetBorderPercentage(double pcent); 00123 double GetBorderPercentage(); 00125 00127 00128 virtual void SetLayoutStrategy(const char *layoutType); 00129 static const char *GetLayoutStrategyName(int strategy); 00131 00133 00134 virtual void SetColorFieldName(const char *field); 00135 virtual char* GetColorFieldName(); 00137 00139 00140 virtual void SetLabelFieldName(const char *field); 00141 virtual char* GetLabelFieldName(); 00143 00145 virtual void SetFontSizeRange(const int maxSize, const int minSize); 00146 00148 00149 bool GetLogScale(); 00150 void SetLogScale(bool value); 00152 00154 void HighLightItem(vtkIdType id); 00155 00157 00159 void SetLabelLevelRange(int start, int end); 00160 void GetLabelLevelRange(int range[2]); 00162 00164 00165 void SetDynamicLabelLevel(int level); 00166 int GetDynamicLabelLevel(); 00168 00170 00171 void SetChildLabelMotion(int mode); 00172 int GetChildLabelMotion(); 00174 00176 00179 void SetLabelClipMode(int mode); 00180 int GetLabelClipMode(); 00182 00183 protected: 00184 vtkTreeMapViewer(); 00185 ~vtkTreeMapViewer(); 00186 00187 // Protected methods that may be called by inherited classes 00188 00190 virtual void SetupPipeline(); 00191 00192 vtkTree* Input; 00193 vtkRenderWindow* RenderWindow; 00194 vtkInteractorStyleTreeMapHover* InteractorStyle; 00195 //BTX 00196 vtkSmartPointer<vtkTreeLevelsFilter> TreeLevelsFilter; 00197 vtkSmartPointer<vtkTreeFieldAggregator> TreeFieldAggregator; 00198 vtkSmartPointer<vtkTreeMapLayout> TreeMapLayout; 00199 vtkSmartPointer<vtkTreeMapToPolyData> TreeMapToPolyData; 00200 vtkSmartPointer<vtkPolyDataMapper> PolyDataMapper; 00201 vtkSmartPointer<vtkRenderer> Renderer; 00202 vtkSmartPointer<vtkActor> Actor; 00203 vtkSmartPointer<vtkActor2D> LabelActor; 00204 vtkSmartPointer<vtkLookupTable> ColorLUT; 00205 vtkSmartPointer<vtkLabeledTreeMapDataMapper> LabeledDataMapper; 00206 //ETX 00207 00208 private: 00209 00210 // Internally used methods 00211 00214 void InputInitialize(); 00215 00216 vtkTreeMapViewer(const vtkTreeMapViewer&); // Not implemented. 00217 void operator=(const vtkTreeMapViewer&); // Not implemented. 00218 }; 00219 00220 #endif 00221 00222