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 -------------------------------------------------------------------------*/ 00041 #ifndef __vtkTreeMapViewer_h 00042 #define __vtkTreeMapViewer_h 00043 00044 #include "vtkObject.h" 00045 #include "vtkSmartPointer.h" // Required for smart pointer internal ivars. 00046 00047 class vtkTree; 00048 class vtkTreeLevelsFilter; 00049 class vtkTreeFieldAggregator; 00050 class vtkTreeMapLayout; 00051 class vtkTreeMapLayoutStrategy; 00052 class vtkTreeMapToPolyData; 00053 class vtkPolyDataMapper; 00054 class vtkAlgorithmOutput; 00055 class vtkActor; 00056 class vtkActor2D; 00057 class vtkRenderWindowInteractor; 00058 class vtkInteractorStyleTreeMapHover; 00059 class vtkRenderWindow; 00060 class vtkRenderer; 00061 class vtkRenderWindowInteractor; 00062 class vtkLookupTable; 00063 class vtkThreshold; 00064 class vtkLabeledDataMapper; 00065 class vtkLabeledTreeMapDataMapper; 00066 00067 class VTK_INFOVIS_EXPORT vtkTreeMapViewer : public vtkObject 00068 { 00069 public: 00070 static vtkTreeMapViewer *New(); 00071 vtkTypeRevisionMacro(vtkTreeMapViewer,vtkObject); 00072 void PrintSelf(ostream& os, vtkIndent indent); 00073 00075 virtual void SetInput(vtkTree *arg); 00076 00078 00079 virtual void SetRenderWindow(vtkRenderWindow *arg); 00080 vtkGetObjectMacro(RenderWindow, vtkRenderWindow); 00082 00084 00085 virtual void SetAggregationFieldName(const char *field); 00086 virtual char* GetAggregationFieldName(); 00088 00090 00091 vtkGetObjectMacro(InteractorStyle, vtkInteractorStyleTreeMapHover); 00093 00094 00095 //BTX 00096 enum { 00097 BOX_LAYOUT, 00098 SLICE_AND_DICE_LAYOUT, 00099 SQUARIFY_LAYOUT, 00100 NUMBER_OF_LAYOUTS 00101 }; 00102 //ETX 00103 00105 00106 virtual void SetLayoutStrategy(int strategy); 00107 void SetLayoutStrategyToBox() { this->SetLayoutStrategy(BOX_LAYOUT); } 00108 void SetLayoutStrategyToSliceAndDice() { 00109 this->SetLayoutStrategy(SLICE_AND_DICE_LAYOUT); 00110 } 00111 void SetLayoutStrategyToSquarify() { 00112 this->SetLayoutStrategy(SQUARIFY_LAYOUT); 00113 } 00114 virtual int GetLayoutStrategy(); 00116 00118 00119 void SetBorderPercentage(double pcent); 00120 double GetBorderPercentage(); 00122 00124 00125 virtual void SetLayoutStrategy(const char *layoutType); 00126 static const char *GetLayoutStrategyName(int strategy); 00128 00130 00131 virtual void SetColorFieldName(const char *field); 00132 virtual char* GetColorFieldName(); 00134 00136 00137 virtual void SetLabelFieldName(const char *field); 00138 virtual char* GetLabelFieldName(); 00140 00142 virtual void SetFontSizeRange(const int maxSize, const int minSize); 00143 00145 00146 bool GetLogScale(); 00147 void SetLogScale(bool value); 00149 00151 void HighLightItem(vtkIdType id); 00152 00154 00156 void SetLabelLevelRange(int start, int end); 00157 void GetLabelLevelRange(int range[2]); 00159 00161 00162 void SetDynamicLabelLevel(int level); 00163 int GetDynamicLabelLevel(); 00165 00167 00168 void SetChildLabelMotion(int mode); 00169 int GetChildLabelMotion(); 00171 00173 00176 void SetLabelClipMode(int mode); 00177 int GetLabelClipMode(); 00179 00180 protected: 00181 vtkTreeMapViewer(); 00182 ~vtkTreeMapViewer(); 00183 00184 // Protected methods that may be called by inherited classes 00185 00187 virtual void SetupPipeline(); 00188 00189 vtkTree* Input; 00190 vtkRenderWindow* RenderWindow; 00191 vtkInteractorStyleTreeMapHover* InteractorStyle; 00192 //BTX 00193 vtkSmartPointer<vtkTreeLevelsFilter> TreeLevelsFilter; 00194 vtkSmartPointer<vtkTreeFieldAggregator> TreeFieldAggregator; 00195 vtkSmartPointer<vtkTreeMapLayout> TreeMapLayout; 00196 vtkSmartPointer<vtkTreeMapToPolyData> TreeMapToPolyData; 00197 vtkSmartPointer<vtkPolyDataMapper> PolyDataMapper; 00198 vtkSmartPointer<vtkRenderer> Renderer; 00199 vtkSmartPointer<vtkActor> Actor; 00200 vtkSmartPointer<vtkActor2D> LabelActor; 00201 vtkSmartPointer<vtkLookupTable> ColorLUT; 00202 vtkSmartPointer<vtkLabeledTreeMapDataMapper> LabeledDataMapper; 00203 //ETX 00204 00205 private: 00206 00207 // Internally used methods 00208 00211 void InputInitialize(); 00212 00213 vtkTreeMapViewer(const vtkTreeMapViewer&); // Not implemented. 00214 void operator=(const vtkTreeMapViewer&); // Not implemented. 00215 }; 00216 00217 #endif 00218 00219