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=========================================================================*/
34#ifndef vtkGraphItem_h
35#define vtkGraphItem_h
36
37#include "vtkViewsInfovisModule.h" // For export macro
38#include "vtkContextItem.h"
39
40#include "vtkVector.h" // For vector types in API
41#include "vtkColor.h" // For color types in API
42#include "vtkNew.h" // For vtkNew ivars
43
44class vtkGraph;
45class vtkImageData;
48class vtkTooltipItem;
49
50class VTKVIEWSINFOVIS_EXPORT vtkGraphItem : public vtkContextItem
51{
52public:
53 static vtkGraphItem *New();
55 virtual void PrintSelf(ostream &os, vtkIndent indent);
56
58
61 virtual void SetGraph(vtkGraph *graph);
62 vtkGetObjectMacro(Graph, vtkGraph);
64
69
71
75 virtual void StopLayoutAnimation();
77
81 virtual void UpdateLayout();
82
83protected:
86
91 virtual bool Paint(vtkContext2D *painter);
92
98 virtual void RebuildBuffers();
99
104 virtual void PaintBuffers(vtkContext2D *painter);
105
114 virtual bool IsDirty();
115
121
127
135
140 virtual float EdgeWidth(vtkIdType edge, vtkIdType point);
141
148
156
162 virtual float VertexSize(vtkIdType vertex);
163
169
176 virtual int VertexMarker(vtkIdType vertex);
177
184
190
194 static void ProcessEvents(vtkObject *caller, unsigned long event,
195 void *clientData, void *callerData);
196
200 virtual vtkIdType HitVertex(const vtkVector2f &pos);
201
203
206 virtual bool MouseMoveEvent(const vtkContextMouseEvent &event);
207 virtual bool MouseLeaveEvent(const vtkContextMouseEvent &event);
208 virtual bool MouseEnterEvent(const vtkContextMouseEvent &event);
209 virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &event);
211 virtual bool MouseWheelEvent(const vtkContextMouseEvent &event, int delta);
213
217 virtual bool Hit(const vtkContextMouseEvent &event);
218
222 virtual void PlaceTooltip(vtkIdType v);
223
224private:
225 vtkGraphItem(const vtkGraphItem&) VTK_DELETE_FUNCTION;
226 void operator=(const vtkGraphItem&) VTK_DELETE_FUNCTION;
227
228 struct Internals;
229 Internals *Internal;
230
231 vtkGraph *Graph;
232 vtkMTimeType GraphBuildTime;
236};
237
238#endif
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:58
base class for items that are part of a vtkContextScene.
data structure to represent mouse events.
A 2D graphics item for rendering a graph.
Definition: vtkGraphItem.h:51
virtual void RebuildBuffers()
Builds a cache of data from the graph by calling the virtual functions such as VertexColor(),...
virtual void PlaceTooltip(vtkIdType v)
Change the position of the tooltip based on the vertex hovered.
virtual void UpdateLayout()
Incrementally updates the graph layout.
virtual bool MouseEnterEvent(const vtkContextMouseEvent &event)
Mouse enter event.
static vtkGraphItem * New()
virtual vtkIdType HitVertex(const vtkVector2f &pos)
Return index of hit vertex, or -1 if no hit.
virtual vtkIdType NumberOfEdges()
Returns the number of edges in the graph.
virtual float EdgeWidth(vtkIdType edge, vtkIdType point)
Returns the edge width.
virtual void SetGraph(vtkGraph *graph)
The graph that this item draws.
virtual void StopLayoutAnimation()
virtual bool Paint(vtkContext2D *painter)
Paints the graph.
virtual vtkColor4ub EdgeColor(vtkIdType edge, vtkIdType point)
Returns the edge color.
virtual float VertexSize(vtkIdType vertex)
Returns the vertex size in pixels, which is remains the same at any zoom level.
virtual bool MouseWheelEvent(const vtkContextMouseEvent &event, int delta)
Mouse wheel event, positive delta indicates forward movement of the wheel.
static void ProcessEvents(vtkObject *caller, unsigned long event, void *clientData, void *callerData)
Process events and dispatch to the appropriate member functions.
virtual void StartLayoutAnimation(vtkRenderWindowInteractor *interactor)
Begins or ends the layout animation.
virtual bool MouseLeaveEvent(const vtkContextMouseEvent &event)
Mouse leave event.
virtual vtkIncrementalForceLayout * GetLayout()
Exposes the incremental graph layout for updating parameters.
virtual vtkIdType NumberOfVertices()
Returns the number of vertices in the graph.
virtual void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
virtual void PaintBuffers(vtkContext2D *painter)
Efficiently draws the contents of the buffers built in RebuildBuffers.
virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &event)
Mouse button down event Return true if the item holds the event, false if the event can be propagated...
virtual bool MouseMoveEvent(const vtkContextMouseEvent &event)
Handle mouse events.
virtual bool IsDirty()
Returns true if the underlying vtkGraph has been modified since the last RebuildBuffers,...
virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &event)
Mouse button release event.
virtual vtkIdType NumberOfEdgePoints(vtkIdType edge)
Returns the number of edge control points for a particular edge.
virtual bool Hit(const vtkContextMouseEvent &event)
Whether this graph item is hit.
virtual int VertexMarker(vtkIdType vertex)
Returns the marker type for each vertex, as defined in vtkMarkerUtilities.
virtual vtkVector2f EdgePosition(vtkIdType edge, vtkIdType point)
Returns the edge control point positions.
virtual vtkStdString VertexTooltip(vtkIdType vertex)
Returns the tooltip for each vertex.
virtual vtkVector2f VertexPosition(vtkIdType vertex)
Returns the position of each vertex.
virtual vtkColor4ub VertexColor(vtkIdType vertex)
Returns the color of each vertex.
Base class for graph data types.
Definition: vtkGraph.h:288
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
incremental force-directed layout.
a simple class to control print indentation
Definition: vtkIndent.h:40
abstract base class for most VTK objects
Definition: vtkObject.h:60
platform-independent render window interaction including picking and frame rate control.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:49
takes care of drawing 2D axes
@ point
Definition: vtkX3D.h:236
int vtkIdType
Definition: vtkType.h:287
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248