forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkMutableGraphHelper.h
114 lines (92 loc) · 3.2 KB
/
vtkMutableGraphHelper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*=========================================================================
Program: Visualization Toolkit
Module: vtkMutableGraphHelper.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*----------------------------------------------------------------------------
Copyright (c) Sandia Corporation
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
----------------------------------------------------------------------------*/
/**
* @class vtkMutableGraphHelper
* @brief Helper class for building a directed or
* directed graph
*
*
* vtkMutableGraphHelper has helper methods AddVertex and AddEdge which
* add vertices/edges to the underlying mutable graph. This is helpful in
* filters which need to (re)construct graphs which may be either directed
* or undirected.
*
* @sa
* vtkGraph vtkMutableDirectedGraph vtkMutableUndirectedGraph
*/
#ifndef vtkMutableGraphHelper_h
#define vtkMutableGraphHelper_h
#include "vtkInfovisCoreModule.h" // For export macro
#include "vtkObject.h"
#include "vtkGraph.h" // For vtkEdgeType
class vtkDataSetAttributes;
class vtkGraph;
class vtkGraphEdge;
class vtkMutableDirectedGraph;
class vtkMutableUndirectedGraph;
class VTKINFOVISCORE_EXPORT vtkMutableGraphHelper : public vtkObject
{
public:
static vtkMutableGraphHelper *New();
vtkTypeMacro(vtkMutableGraphHelper, vtkObject);
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
//@{
/**
* Set the underlying graph that you want to modify with this helper.
* The graph must be an instance of vtkMutableDirectedGraph or
* vtkMutableUndirectedGraph.
*/
void SetGraph(vtkGraph* g);
vtkGraph* GetGraph();
//@}
/**
* Add an edge to the underlying mutable graph.
*/
vtkEdgeType AddEdge(vtkIdType u, vtkIdType v);
vtkGraphEdge* AddGraphEdge(vtkIdType u, vtkIdType v);
/**
* Add a vertex to the underlying mutable graph.
*/
vtkIdType AddVertex();
/**
* Remove a vertex from the underlying mutable graph.
*/
void RemoveVertex(vtkIdType v);
/**
* Remove a collection of vertices from the underlying mutable graph.
*/
void RemoveVertices(vtkIdTypeArray* verts);
/**
* Remove an edge from the underlying mutable graph.
*/
void RemoveEdge(vtkIdType e);
/**
* Remove a collection of edges from the underlying mutable graph.
*/
void RemoveEdges(vtkIdTypeArray* edges);
protected:
vtkMutableGraphHelper();
~vtkMutableGraphHelper() VTK_OVERRIDE;
vtkGetObjectMacro(InternalGraph, vtkGraph);
void SetInternalGraph(vtkGraph* g);
vtkGraph* InternalGraph;
vtkGraphEdge* GraphEdge;
vtkMutableDirectedGraph* DirectedGraph;
vtkMutableUndirectedGraph* UndirectedGraph;
private:
vtkMutableGraphHelper(const vtkMutableGraphHelper&) VTK_DELETE_FUNCTION;
void operator=(const vtkMutableGraphHelper&) VTK_DELETE_FUNCTION;
};
#endif