VTK
vtkGraphItem.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: TestDiagram.cxx
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 =========================================================================*/
28 #ifndef vtkGraphItem_h
29 #define vtkGraphItem_h
30 
31 #include "vtkViewsInfovisModule.h" // For export macro
32 #include "vtkContextItem.h"
33 
34 #include "vtkVector.h" // For vector types in API
35 #include "vtkColor.h" // For color types in API
36 #include "vtkNew.h" // For vtkNew ivars
37 
38 class vtkGraph;
39 class vtkImageData;
42 class vtkTooltipItem;
43 
44 class VTKVIEWSINFOVIS_EXPORT vtkGraphItem : public vtkContextItem
45 {
46 public:
47  static vtkGraphItem *New();
48  vtkTypeMacro(vtkGraphItem, vtkContextItem);
49  void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE;
50 
52 
55  virtual void SetGraph(vtkGraph *graph);
56  vtkGetObjectMacro(Graph, vtkGraph);
58 
62  virtual vtkIncrementalForceLayout *GetLayout();
63 
65 
68  virtual void StartLayoutAnimation(vtkRenderWindowInteractor *interactor);
69  virtual void StopLayoutAnimation();
71 
75  virtual void UpdateLayout();
76 
77 protected:
78  vtkGraphItem();
79  ~vtkGraphItem() VTK_OVERRIDE;
80 
85  bool Paint(vtkContext2D *painter) VTK_OVERRIDE;
86 
92  virtual void RebuildBuffers();
93 
98  virtual void PaintBuffers(vtkContext2D *painter);
99 
108  virtual bool IsDirty();
109 
114  virtual vtkIdType NumberOfVertices();
115 
120  virtual vtkIdType NumberOfEdges();
121 
128  virtual vtkIdType NumberOfEdgePoints(vtkIdType edge);
129 
134  virtual float EdgeWidth(vtkIdType edge, vtkIdType point);
135 
141  virtual vtkColor4ub EdgeColor(vtkIdType edge, vtkIdType point);
142 
149  virtual vtkVector2f EdgePosition(vtkIdType edge, vtkIdType point);
150 
156  virtual float VertexSize(vtkIdType vertex);
157 
162  virtual vtkColor4ub VertexColor(vtkIdType vertex);
163 
170  virtual int VertexMarker(vtkIdType vertex);
171 
177  virtual vtkVector2f VertexPosition(vtkIdType vertex);
178 
183  virtual vtkStdString VertexTooltip(vtkIdType vertex);
184 
188  static void ProcessEvents(vtkObject *caller, unsigned long event,
189  void *clientData, void *callerData);
190 
194  virtual vtkIdType HitVertex(const vtkVector2f &pos);
195 
197 
200  bool MouseMoveEvent(const vtkContextMouseEvent &event) VTK_OVERRIDE;
201  bool MouseLeaveEvent(const vtkContextMouseEvent &event) VTK_OVERRIDE;
202  bool MouseEnterEvent(const vtkContextMouseEvent &event) VTK_OVERRIDE;
203  bool MouseButtonPressEvent(const vtkContextMouseEvent &event) VTK_OVERRIDE;
204  bool MouseButtonReleaseEvent(const vtkContextMouseEvent &event) VTK_OVERRIDE;
205  bool MouseWheelEvent(const vtkContextMouseEvent &event, int delta) VTK_OVERRIDE;
207 
211  bool Hit(const vtkContextMouseEvent &event) VTK_OVERRIDE;
212 
216  virtual void PlaceTooltip(vtkIdType v);
217 
218 private:
219  vtkGraphItem(const vtkGraphItem&) VTK_DELETE_FUNCTION;
220  void operator=(const vtkGraphItem&) VTK_DELETE_FUNCTION;
221 
222  struct Internals;
223  Internals *Internal;
224 
225  vtkGraph *Graph;
226  vtkMTimeType GraphBuildTime;
227  vtkNew<vtkImageData> Sprite;
229  vtkNew<vtkTooltipItem> Tooltip;
230 };
231 
232 #endif
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:41
abstract base class for most VTK objects
Definition: vtkObject.h:53
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:300
base class for items that are part of a vtkContextScene.
int vtkIdType
Definition: vtkType.h:345
Base class for graph data types.
Definition: vtkGraph.h:281
platform-independent render window interaction including picking and frame rate control.
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:52
data structure to represent mouse events.
a simple class to control print indentation
Definition: vtkIndent.h:33
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
A 2D graphics item for rendering a graph.
Definition: vtkGraphItem.h:44
Allocate and hold a VTK object.
Definition: vtkNew.h:61
takes care of drawing 2D axes
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
incremental force-directed layout.