VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkHierarchicalGraphView.h,v $ 00005 00006 ------------------------------------------------------------------------- 00007 Copyright 2008 Sandia Corporation. 00008 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00009 the U.S. Government retains certain rights in this software. 00010 ------------------------------------------------------------------------- 00011 00012 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00013 All rights reserved. 00014 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00015 00016 This software is distributed WITHOUT ANY WARRANTY; without even 00017 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00018 PURPOSE. See the above copyright notice for more information. 00019 00020 =========================================================================*/ 00021 00044 #ifndef __vtkHierarchicalGraphView_h 00045 #define __vtkHierarchicalGraphView_h 00046 00047 #include "vtkSmartPointer.h" // Required for smart pointer internal ivars. 00048 #include "vtkRenderView.h" 00049 00050 class vtkActor; 00051 class vtkActor2D; 00052 class vtkAlgorithmOutput; 00053 class vtkCircularLayoutStrategy; 00054 class vtkCoordinate; 00055 class vtkCosmicTreeLayoutStrategy; 00056 class vtkTreeLayoutStrategy; 00057 class vtkDynamic2DLabelMapper; 00058 class vtkEdgeCenters; 00059 class vtkExtractSelectedGraph; 00060 class vtkGlyph3D; 00061 class vtkGraph; 00062 class vtkGraphHierarchicalBundle; 00063 class vtkGraphLayout; 00064 class vtkGraphLayoutStrategy; 00065 class vtkGraphMapper; 00066 class vtkGraphToPolyData; 00067 class vtkGraphToTree; 00068 class vtkKdTreeSelector; 00069 class vtkLookupTable; 00070 class vtkPassThroughLayoutStrategy; 00071 class vtkPolyDataMapper; 00072 class vtkSelection; 00073 class vtkSelectionLink; 00074 class vtkSplineFilter; 00075 class vtkTexture; 00076 class vtkTree; 00077 class vtkTreeFieldAggregator; 00078 class vtkVertexDegree; 00079 class vtkVertexGlyphFilter; 00080 class vtkViewTheme; 00081 class vtkHardwareSelector; 00082 00083 00084 class VTK_VIEWS_EXPORT vtkHierarchicalGraphView : public vtkRenderView 00085 { 00086 public: 00087 static vtkHierarchicalGraphView *New(); 00088 vtkTypeRevisionMacro(vtkHierarchicalGraphView, vtkRenderView); 00089 void PrintSelf(ostream& os, vtkIndent indent); 00090 00092 00094 vtkDataRepresentation* SetHierarchyFromInputConnection(vtkAlgorithmOutput* conn); 00095 vtkDataRepresentation* SetHierarchyFromInput(vtkDataObject* input); 00096 vtkDataRepresentation* SetGraphFromInputConnection(vtkAlgorithmOutput* conn); 00097 vtkDataRepresentation* SetGraphFromInput(vtkDataObject* input); 00099 00101 00102 void SetVertexLabelArrayName(const char* name); 00103 const char* GetVertexLabelArrayName(); 00105 00107 00108 void SetEdgeLabelArrayName(const char* name); 00109 const char* GetEdgeLabelArrayName(); 00111 00113 00114 void SetVertexLabelVisibility(bool vis); 00115 bool GetVertexLabelVisibility(); 00116 void VertexLabelVisibilityOn(); 00117 void VertexLabelVisibilityOff(); 00119 00121 00122 void SetEdgeLabelVisibility(bool vis); 00123 bool GetEdgeLabelVisibility(); 00124 void EdgeLabelVisibilityOn(); 00125 void EdgeLabelVisibilityOff(); 00127 00129 00130 void SetVertexColorArrayName(const char* name); 00131 const char* GetVertexColorArrayName(); 00133 00135 00136 void SetColorVertices(bool vis); 00137 bool GetColorVertices(); 00138 void ColorVerticesOn(); 00139 void ColorVerticesOff(); 00141 00143 00144 void SetEdgeColorArrayName(const char* name); 00145 const char* GetEdgeColorArrayName(); 00147 00149 void SetEdgeColorToSplineFraction(); 00150 00152 00153 void SetColorEdges(bool vis); 00154 bool GetColorEdges(); 00155 void ColorEdgesOn(); 00156 void ColorEdgesOff(); 00158 00160 void SetRadialLayout(bool radial); 00161 00163 void SetRadialAngle(int angle); 00164 00166 void SetLogSpacingFactor(double spacing); 00167 00169 void SetLeafSpacing(double spacing); 00170 00172 void SetBundlingStrength(double strength); 00173 00177 virtual vtkDataRepresentation* GetTreeVisibilityRepresentation(); 00178 00180 00181 virtual vtkDataRepresentation* GetGraphRepresentation() 00182 { return this->GetRepresentation(1, 0); } 00183 virtual vtkDataRepresentation* GetTreeRepresentation() 00184 { return this->GetRepresentation(0, 0); } 00186 00188 void SetIconTexture(vtkTexture *texture); 00189 00193 void AddIconType(char *type, int index); 00194 00196 void ClearIconTypes(); 00197 00199 void SetIconSize(int *size); 00200 00203 void SetIconAlignment(int alignment); 00204 00206 00207 void SetIconVisibility(bool b); 00208 bool GetIconVisibility(); 00209 vtkBooleanMacro(IconVisibility, bool); 00211 00213 00214 void SetIconArrayName(const char* name); 00215 const char* GetIconArrayName(); 00217 00219 00220 void SetTreeEdgeVisibility(bool b); 00221 bool GetTreeEdgeVisibility(); 00222 void TreeEdgeVisibilityOn(); 00223 void TreeEdgeVisibilityOff(); 00225 00227 00228 void SetScalingArrayName(const char* name); 00229 const char* GetScalingArrayName(); 00231 00233 00234 void SetScaledGlyphs(bool arg); 00235 bool GetScaledGlyphs(); 00236 vtkBooleanMacro(ScaledGlyphs, bool); 00238 00240 00244 void SetLayoutStrategy(const char* name); 00245 void SetLayoutStrategyToTree() { this->SetLayoutStrategy("Tree"); } 00246 void SetLayoutStrategyToCosmicTree() { this->SetLayoutStrategy("CosmicTree"); } 00247 const char* GetLayoutStrategyName() { return this->GetLayoutStrategyNameInternal(); } 00249 00251 00254 vtkGetObjectMacro(LayoutStrategy,vtkGraphLayoutStrategy); 00255 void SetLayoutStrategy(vtkGraphLayoutStrategy *s); 00257 00259 virtual void SetupRenderWindow(vtkRenderWindow* win); 00260 00262 virtual void ApplyViewTheme(vtkViewTheme* theme); 00263 00265 00266 virtual void SetVertexLabelFontSize(const int size); 00267 virtual int GetVertexLabelFontSize(); 00269 00271 00272 virtual void SetEdgeLabelFontSize(const int size); 00273 virtual int GetEdgeLabelFontSize(); 00275 00276 protected: 00277 vtkHierarchicalGraphView(); 00278 ~vtkHierarchicalGraphView(); 00279 00281 00282 virtual void ProcessEvents(vtkObject* caller, unsigned long eventId, 00283 void* callData); 00285 00287 00288 virtual void AddInputConnection( int port, int item, 00289 vtkAlgorithmOutput* conn, vtkAlgorithmOutput* selectConn); 00291 00293 00294 virtual void RemoveInputConnection( int port, int item, 00295 vtkAlgorithmOutput* conn, vtkAlgorithmOutput* selectConn); 00297 00299 virtual void PrepareForRendering(); 00300 00302 void MapToXYPlane(double displayX, double displayY, double &x, double &y); 00303 00305 00306 vtkGetStringMacro(LayoutStrategyNameInternal); 00307 vtkSetStringMacro(LayoutStrategyNameInternal); 00308 char* LayoutStrategyNameInternal; 00310 00312 vtkGraphLayoutStrategy* LayoutStrategy; 00313 00315 00316 vtkGetStringMacro(IconArrayNameInternal); 00317 vtkSetStringMacro(IconArrayNameInternal); 00318 char* IconArrayNameInternal; 00319 //BTX 00321 00322 // Processing objects 00323 vtkSmartPointer<vtkCoordinate> Coordinate; 00324 vtkSmartPointer<vtkGraphLayout> GraphLayout; 00325 vtkSmartPointer<vtkCircularLayoutStrategy> CircularStrategy; 00326 vtkSmartPointer<vtkTreeLayoutStrategy> TreeStrategy; 00327 vtkSmartPointer<vtkCosmicTreeLayoutStrategy> CosmicTreeStrategy; 00328 vtkSmartPointer<vtkPassThroughLayoutStrategy> PassThroughStrategy; 00329 vtkSmartPointer<vtkGraphHierarchicalBundle> HBundle; 00330 vtkSmartPointer<vtkSplineFilter> Spline; 00331 vtkSmartPointer<vtkVertexDegree> VertexDegree; 00332 vtkSmartPointer<vtkEdgeCenters> EdgeCenters; 00333 vtkSmartPointer<vtkTreeFieldAggregator> TreeAggregation; 00334 vtkSmartPointer<vtkExtractSelectedGraph> ExtractSelectedTree; 00335 vtkSmartPointer<vtkGraphMapper> SelectedTreeMapper; 00336 vtkSmartPointer<vtkActor> SelectedTreeActor; 00337 00338 // Representation objects 00339 vtkSmartPointer<vtkActor> TreeActor; 00340 vtkSmartPointer<vtkGraphMapper> TreeMapper; 00341 vtkSmartPointer<vtkDynamic2DLabelMapper> VertexLabelMapper; 00342 vtkSmartPointer<vtkActor2D> VertexLabelActor; 00343 vtkSmartPointer<vtkDynamic2DLabelMapper> EdgeLabelMapper; 00344 vtkSmartPointer<vtkActor2D> EdgeLabelActor; 00345 vtkSmartPointer<vtkPolyDataMapper> GraphEdgeMapper; 00346 vtkSmartPointer<vtkActor> GraphEdgeActor; 00347 vtkSmartPointer<vtkDataRepresentation> TreeVisibilityRepresentation; 00348 00349 // Selection objects 00350 vtkSmartPointer<vtkSelection> EmptySelection; 00351 vtkSmartPointer<vtkKdTreeSelector> KdTreeSelector; 00352 vtkSmartPointer<vtkHardwareSelector> HardwareSelector; 00353 vtkSmartPointer<vtkExtractSelectedGraph> ExtractSelectedGraph; 00354 vtkSmartPointer<vtkGraphHierarchicalBundle> SelectedGraphHBundle; 00355 vtkSmartPointer<vtkSplineFilter> SelectedGraphSpline; 00356 vtkSmartPointer<vtkActor> SelectedGraphActor; 00357 vtkSmartPointer<vtkPolyDataMapper> SelectedGraphMapper; 00358 //ETX 00359 00360 private: 00361 00363 bool Radial; 00364 00366 int Angle; 00367 00369 float LogSpacing; 00370 00373 float LeafSpacing; 00374 00376 float BundlingStrength; 00377 00379 00380 int GraphRepresentationIndex; 00381 int TreeRepresentationIndex; 00383 00384 vtkHierarchicalGraphView(const vtkHierarchicalGraphView&); // Not implemented. 00385 void operator=(const vtkHierarchicalGraphView&); // Not implemented. 00386 }; 00387 00388 #endif