1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkHierarchicalGraphPipeline.h
5 
6   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7   All rights reserved.
8   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10      This software is distributed WITHOUT ANY WARRANTY; without even
11      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12      PURPOSE.  See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*-------------------------------------------------------------------------
16   Copyright 2008 Sandia Corporation.
17   Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18   the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
20 // .NAME vtkHierarchicalGraphPipeline - helper class for rendering graphs superimposed on a tree.
21 //
22 // .SECTION Description
23 // vtkHierarchicalGraphPipeline renders bundled edges that are meant to be
24 // viewed as an overlay on a tree. This class is not for general use, but
25 // is used in the internals of vtkRenderedHierarchyRepresentation and
26 // vtkRenderedTreeAreaRepresentation.
27 
28 #include "vtkViewsInfovisModule.h" // For export macro
29 #include "vtkObject.h"
30 
31 class vtkActor;
32 class vtkActor2D;
33 class vtkAlgorithmOutput;
34 class vtkApplyColors;
35 class vtkDataRepresentation;
36 class vtkDynamic2DLabelMapper;
37 class vtkEdgeCenters;
38 class vtkGraphHierarchicalBundleEdges;
39 class vtkGraphToPolyData;
40 class vtkPolyDataMapper;
41 class vtkRenderView;
42 class vtkSplineGraphEdges;
43 class vtkSelection;
44 class vtkTextProperty;
45 class vtkViewTheme;
46 
47 class VTKVIEWSINFOVIS_EXPORT vtkHierarchicalGraphPipeline : public vtkObject
48 {
49 public:
50   static vtkHierarchicalGraphPipeline* New();
51   vtkTypeMacro(vtkHierarchicalGraphPipeline, vtkObject);
52   void PrintSelf(ostream& os, vtkIndent indent);
53 
54   // Description:
55   // The actor associated with the hierarchical graph.
56   vtkGetObjectMacro(Actor, vtkActor);
57 
58   // Description:
59   // The actor associated with the hierarchical graph.
60   vtkGetObjectMacro(LabelActor, vtkActor2D);
61 
62   // Description:
63   // The bundling strength for the bundled edges.
64   virtual void SetBundlingStrength(double strength);
65   virtual double GetBundlingStrength();
66 
67   // Description:
68   // The edge label array name.
69   virtual void SetLabelArrayName(const char* name);
70   virtual const char* GetLabelArrayName();
71 
72   // Description:
73   // The edge label visibility.
74   virtual void SetLabelVisibility(bool vis);
75   virtual bool GetLabelVisibility();
76   vtkBooleanMacro(LabelVisibility, bool);
77 
78   // Description:
79   // The edge label text property.
80   virtual void SetLabelTextProperty(vtkTextProperty* prop);
81   virtual vtkTextProperty* GetLabelTextProperty();
82 
83   // Description:
84   // The edge color array.
85   virtual void SetColorArrayName(const char* name);
86   virtual const char* GetColorArrayName();
87 
88   // Description:
89   // Whether to color the edges by an array.
90   virtual void SetColorEdgesByArray(bool vis);
91   virtual bool GetColorEdgesByArray();
92   vtkBooleanMacro(ColorEdgesByArray, bool);
93 
94   // Description:
95   // The visibility of this graph.
96   virtual void SetVisibility(bool vis);
97   virtual bool GetVisibility();
98   vtkBooleanMacro(Visibility, bool);
99 
100   // Description:
101   // Returns a new selection relevant to this graph based on an input
102   // selection and the view that this graph is contained in.
103   virtual vtkSelection* ConvertSelection(vtkDataRepresentation* rep, vtkSelection* sel);
104 
105   // Description:
106   // Sets the input connections for this graph.
107   // graphConn is the input graph connection.
108   // treeConn is the input tree connection.
109   // annConn is the annotation link connection.
110   virtual void PrepareInputConnections(
111     vtkAlgorithmOutput* graphConn,
112     vtkAlgorithmOutput* treeConn,
113     vtkAlgorithmOutput* annConn);
114 
115   // Description:
116   // Applies the view theme to this graph.
117   virtual void ApplyViewTheme(vtkViewTheme* theme);
118 
119   // Description:
120   // The array to use while hovering over an edge.
121   vtkSetStringMacro(HoverArrayName);
122   vtkGetStringMacro(HoverArrayName);
123 
124   // Description:
125   // The spline mode to use in vtkSplineGraphEdges.
126   // vtkSplineGraphEdges::CUSTOM uses a vtkCardinalSpline.
127   // vtkSplineGraphEdges::BSPLINE uses a b-spline.
128   // The default is BSPLINE.
129   virtual void SetSplineType(int type);
130   virtual int GetSplineType();
131 
132   // Description:
133   // Register progress with a view.
134   void RegisterProgress(vtkRenderView* view);
135 
136 protected:
137   vtkHierarchicalGraphPipeline();
138   ~vtkHierarchicalGraphPipeline();
139 
140   vtkApplyColors*                  ApplyColors;
141   vtkGraphHierarchicalBundleEdges* Bundle;
142   vtkGraphToPolyData*              GraphToPoly;
143   vtkSplineGraphEdges*             Spline;
144   vtkPolyDataMapper*               Mapper;
145   vtkActor*                        Actor;
146   vtkTextProperty*                 TextProperty;
147   vtkEdgeCenters*                  EdgeCenters;
148   vtkDynamic2DLabelMapper*         LabelMapper;
149   vtkActor2D*                      LabelActor;
150 
151   char* HoverArrayName;
152 
153   vtkSetStringMacro(ColorArrayNameInternal);
154   vtkGetStringMacro(ColorArrayNameInternal);
155   char* ColorArrayNameInternal;
156 
157   vtkSetStringMacro(LabelArrayNameInternal);
158   vtkGetStringMacro(LabelArrayNameInternal);
159   char* LabelArrayNameInternal;
160 
161 private:
162   vtkHierarchicalGraphPipeline(const vtkHierarchicalGraphPipeline&); // Not implemented
163   void operator=(const vtkHierarchicalGraphPipeline&); // Not implemented
164 };
165 
166