forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkMutableGraphHelper.h
103 lines (82 loc) · 3.23 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
/*=========================================================================
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.
----------------------------------------------------------------------------*/
// .NAME vtkMutableGraphHelper - Helper class for building a directed or
// directed graph
//
// .SECTION Description
// 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.
//
// .SECTION See Also
// 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);
// Description:
// 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();
//BTX
// Description:
// Add an edge to the underlying mutable graph.
vtkEdgeType AddEdge(vtkIdType u, vtkIdType v);
//ETX
vtkGraphEdge* AddGraphEdge(vtkIdType u, vtkIdType v);
// Description:
// Add a vertex to the underlying mutable graph.
vtkIdType AddVertex();
// Description:
// Remove a vertex from the underlying mutable graph.
void RemoveVertex(vtkIdType v);
// Description:
// Remove a collection of vertices from the underlying mutable graph.
void RemoveVertices(vtkIdTypeArray* verts);
// Description:
// Remove an edge from the underlying mutable graph.
void RemoveEdge(vtkIdType e);
// Description:
// Remove a collection of edges from the underlying mutable graph.
void RemoveEdges(vtkIdTypeArray* edges);
protected:
vtkMutableGraphHelper();
~vtkMutableGraphHelper();
vtkGetObjectMacro(InternalGraph, vtkGraph);
void SetInternalGraph(vtkGraph* g);
vtkGraph* InternalGraph;
vtkGraphEdge* GraphEdge;
vtkMutableDirectedGraph* DirectedGraph;
vtkMutableUndirectedGraph* UndirectedGraph;
private:
vtkMutableGraphHelper(const vtkMutableGraphHelper&); // Not implemented.
void operator=(const vtkMutableGraphHelper&); // Not implemented.
};
#endif