VTK
dox/Views/Infovis/vtkTanglegramItem.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    TestDiagram.cxx
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 =========================================================================*/
00031 #ifndef __vtkTanglegramItem_h
00032 #define __vtkTanglegramItem_h
00033 
00034 #include "vtkViewsInfovisModule.h" // For export macro
00035 
00036 #include "vtkContextItem.h"
00037 #include "vtkSmartPointer.h"       // For SmartPointer ivars
00038 #include "vtkTable.h"  // For get/set
00039 
00040 class vtkDendrogramItem;
00041 class vtkLookupTable;
00042 class vtkStringArray;
00043 class vtkTree;
00044 
00045 class VTKVIEWSINFOVIS_EXPORT vtkTanglegramItem : public vtkContextItem
00046 {
00047 public:
00048   static vtkTanglegramItem *New();
00049   vtkTypeMacro(vtkTanglegramItem, vtkContextItem);
00050   virtual void PrintSelf(ostream &os, vtkIndent indent);
00051 
00053   virtual void SetTree1(vtkTree *tree);
00054 
00056   virtual void SetTree2(vtkTree *tree);
00057 
00059 
00065   vtkTable * GetTable();
00066   void SetTable(vtkTable *table);
00068 
00070 
00071   vtkGetStringMacro(Tree1Label);
00072   vtkSetStringMacro(Tree1Label);
00074 
00076 
00077   vtkGetStringMacro(Tree2Label);
00078   vtkSetStringMacro(Tree2Label);
00080 
00083   void SetOrientation(int orientation);
00084 
00086   int GetOrientation();
00087 
00089 
00093   vtkGetMacro(MinimumVisibleFontSize, int);
00094   vtkSetMacro(MinimumVisibleFontSize, int);
00096 
00098 
00102   vtkGetMacro(LabelSizeDifference, int);
00103   vtkSetMacro(LabelSizeDifference, int);
00105 
00107 
00109   vtkGetMacro(CorrespondenceLineWidth, float);
00110   vtkSetMacro(CorrespondenceLineWidth, float);
00112 
00114 
00116   float GetTreeLineWidth();
00117   void SetTreeLineWidth(float width);
00119 
00120   // BTX
00121 
00123   virtual bool Hit(const vtkContextMouseEvent &mouse);
00124 
00127   virtual bool MouseDoubleClickEvent(const vtkContextMouseEvent &event);
00128 
00129   //ETX
00130 
00131 protected:
00132   vtkTanglegramItem();
00133   ~vtkTanglegramItem();
00134 
00136   void RefreshBuffers(vtkContext2D *painter);
00137 
00139   void PositionTree2();
00140 
00143   void PaintCorrespondenceLines(vtkContext2D *painter);
00144 
00146   void PaintTreeLabels(vtkContext2D *painter);
00147 
00150   void ReorderTree();
00151 
00154   void ReorderTreeAtVertex(vtkIdType parent, vtkTree *tree);
00155 
00160   double GetPositionScoreForVertex(vtkIdType vertex, vtkTree *tree);
00161 
00164   void GenerateLookupTable();
00165 
00167   virtual bool Paint(vtkContext2D *painter);
00168 
00169 private:
00170   vtkSmartPointer<vtkDendrogramItem> Dendrogram1;
00171   vtkSmartPointer<vtkDendrogramItem> Dendrogram2;
00172   vtkSmartPointer<vtkLookupTable> LookupTable;
00173   vtkSmartPointer<vtkTable> Table;
00174   vtkStringArray *Tree1Names;
00175   vtkStringArray *Tree2Names;
00176   vtkStringArray *SourceNames;
00177   double Tree1Bounds[4];
00178   double Tree2Bounds[4];
00179   double Spacing;
00180   double LabelWidth1;
00181   double LabelWidth2;
00182   bool PositionSet;
00183   bool TreeReordered;
00184   char* Tree1Label;
00185   char* Tree2Label;
00186   int Orientation;
00187   int MinimumVisibleFontSize;
00188   int LabelSizeDifference;
00189   float CorrespondenceLineWidth;
00190 
00191   vtkTanglegramItem(const vtkTanglegramItem&); // Not implemented
00192   void operator=(const vtkTanglegramItem&); // Not implemented
00193 
00194 };
00195 
00196 #endif