VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 =========================================================================*/
33 #ifndef __vtkMultiLineItem_h
34 #define __vtkMultiLineItem_h
35 
36 #include "vtkViewsInfovisModule.h" // For export macro
37 #include "vtkContextItem.h"
38 
39 #include "vtkVector.h" // For vector types in API
40 #include "vtkColor.h" // For color types in API
41 #include "vtkNew.h" // For vtkNew ivars
42 
43 class vtkGraph;
44 class vtkImageData;
46 class vtkRenderWindowInteractor;
47 class vtkTooltipItem;
48 
49 class VTKVIEWSINFOVIS_EXPORT vtkGraphItem : public vtkContextItem
50 {
51 public:
52  static vtkGraphItem *New();
53  vtkTypeMacro(vtkGraphItem, vtkContextItem);
54  virtual void PrintSelf(ostream &os, vtkIndent indent);
55 
57 
58  virtual void SetGraph(vtkGraph *graph);
59  vtkGetObjectMacro(Graph, vtkGraph);
61 
63  virtual vtkIncrementalForceLayout *GetLayout();
64 
66 
67  virtual void StartLayoutAnimation(vtkRenderWindowInteractor *interactor);
68  virtual void StopLayoutAnimation();
70 
72  virtual void UpdateLayout();
73 
74 protected:
75  vtkGraphItem();
76  ~vtkGraphItem();
77 
80  virtual bool Paint(vtkContext2D *painter);
81 
85  virtual void RebuildBuffers();
86 
89  virtual void PaintBuffers(vtkContext2D *painter);
90 
97  virtual bool IsDirty();
98 
102  virtual vtkIdType NumberOfVertices();
103 
106  virtual vtkIdType NumberOfEdges();
107 
112  virtual vtkIdType NumberOfEdgePoints(vtkIdType edge);
113 
117  virtual float EdgeWidth(vtkIdType edge, vtkIdType point);
118 
122  virtual vtkColor4ub EdgeColor(vtkIdType edge, vtkIdType point);
123 
128  virtual vtkVector2f EdgePosition(vtkIdType edge, vtkIdType point);
129 
134  virtual float VertexSize(vtkIdType vertex);
135 
138  virtual vtkColor4ub VertexColor(vtkIdType vertex);
139 
144  virtual int VertexMarker(vtkIdType vertex);
145 
150  virtual vtkVector2f VertexPosition(vtkIdType vertex);
151 
154  virtual vtkStdString VertexTooltip(vtkIdType vertex);
155 
157 
158  static void ProcessEvents(vtkObject *caller, unsigned long event,
159  void *clientData, void *callerData);
161 
163  virtual vtkIdType HitVertex(const vtkVector2f &pos);
164 
166 
167  virtual bool MouseMoveEvent(const vtkContextMouseEvent &event);
168  virtual bool MouseLeaveEvent(const vtkContextMouseEvent &event);
169  virtual bool MouseEnterEvent(const vtkContextMouseEvent &event);
170  virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &event);
171  virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &event);
172  virtual bool MouseWheelEvent(const vtkContextMouseEvent &event, int delta);
174 
176  virtual bool Hit(const vtkContextMouseEvent &event);
177 
179  virtual void PlaceTooltip(vtkIdType v);
180 
181 private:
182  vtkGraphItem(const vtkGraphItem&); // Not implemented
183  void operator=(const vtkGraphItem&); // Not implemented
184 
185  struct Internals;
186  Internals *Internal;
187 
188  vtkGraph *Graph;
189  unsigned long GraphBuildTime;
190  vtkNew<vtkImageData> Sprite;
191  vtkNew<vtkIncrementalForceLayout> Layout;
192  vtkNew<vtkTooltipItem> Tooltip;
193 };
194 
195 #endif
A 2D graphics item for rendering a graph.
Definition: vtkGraphItem.h:49
incremental force-directed layout.