VTK
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
vtkGraphItem Class Reference

A 2D graphics item for rendering a graph. More...

#include <vtkGraphItem.h>

Inherits vtkContextItem.

Public Types

typedef vtkContextItem Superclass
 

Public Member Functions

virtual int IsA (const char *type)
 
vtkGraphItemNewInstance () const
 
virtual void PrintSelf (ostream &os, vtkIndent indent)
 
virtual vtkIncrementalForceLayout * GetLayout ()
 
virtual void UpdateLayout ()
 
virtual void SetGraph (vtkGraph *graph)
 
virtual vtkGraph * GetGraph ()
 
virtual void StartLayoutAnimation (vtkRenderWindowInteractor *interactor)
 
virtual void StopLayoutAnimation ()
 

Static Public Member Functions

static vtkGraphItemNew ()
 
static int IsTypeOf (const char *type)
 
static vtkGraphItemSafeDownCast (vtkObjectBase *o)
 

Protected Member Functions

virtual vtkObjectBase * NewInstanceInternal () const
 
 vtkGraphItem ()
 
 ~vtkGraphItem ()
 
virtual bool Paint (vtkContext2D *painter)
 
virtual void RebuildBuffers ()
 
virtual void PaintBuffers (vtkContext2D *painter)
 
virtual bool IsDirty ()
 
virtual vtkIdType NumberOfVertices ()
 
virtual vtkIdType NumberOfEdges ()
 
virtual vtkIdType NumberOfEdgePoints (vtkIdType edge)
 
virtual float EdgeWidth (vtkIdType edge, vtkIdType point)
 
virtual vtkColor4ub EdgeColor (vtkIdType edge, vtkIdType point)
 
virtual vtkVector2f EdgePosition (vtkIdType edge, vtkIdType point)
 
virtual float VertexSize (vtkIdType vertex)
 
virtual vtkColor4ub VertexColor (vtkIdType vertex)
 
virtual int VertexMarker (vtkIdType vertex)
 
virtual vtkVector2f VertexPosition (vtkIdType vertex)
 
virtual vtkStdString VertexTooltip (vtkIdType vertex)
 
virtual vtkIdType HitVertex (const vtkVector2f &pos)
 
virtual bool Hit (const vtkContextMouseEvent &event)
 
virtual void PlaceTooltip (vtkIdType v)
 
virtual bool MouseMoveEvent (const vtkContextMouseEvent &event)
 
virtual bool MouseLeaveEvent (const vtkContextMouseEvent &event)
 
virtual bool MouseEnterEvent (const vtkContextMouseEvent &event)
 
virtual bool MouseButtonPressEvent (const vtkContextMouseEvent &event)
 
virtual bool MouseButtonReleaseEvent (const vtkContextMouseEvent &event)
 
virtual bool MouseWheelEvent (const vtkContextMouseEvent &event, int delta)
 

Static Protected Member Functions

static void ProcessEvents (vtkObject *caller, unsigned long event, void *clientData, void *callerData)
 

Detailed Description

A 2D graphics item for rendering a graph.

This item draws a graph as a part of a vtkContextScene. This simple class has minimal state and delegates the determination of visual vertex and edge properties like color, size, width, etc. to a set of virtual functions. To influence the rendering of the graph, subclass this item and override the property functions you wish to customize.

Examples:
vtkGraphItem (Examples)
Tests:
vtkGraphItem (Tests)

Definition at line 49 of file vtkGraphItem.h.

Member Typedef Documentation

typedef vtkContextItem vtkGraphItem::Superclass

Definition at line 53 of file vtkGraphItem.h.

Constructor & Destructor Documentation

vtkGraphItem::vtkGraphItem ( )
protected
vtkGraphItem::~vtkGraphItem ( )
protected

Member Function Documentation

static vtkGraphItem* vtkGraphItem::New ( )
static
static int vtkGraphItem::IsTypeOf ( const char *  type)
static
virtual int vtkGraphItem::IsA ( const char *  type)
virtual
static vtkGraphItem* vtkGraphItem::SafeDownCast ( vtkObjectBase *  o)
static
virtual vtkObjectBase* vtkGraphItem::NewInstanceInternal ( ) const
protectedvirtual
vtkGraphItem* vtkGraphItem::NewInstance ( ) const
virtual void vtkGraphItem::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
virtual
virtual void vtkGraphItem::SetGraph ( vtkGraph *  graph)
virtual

The graph that this item draws.

virtual vtkGraph* vtkGraphItem::GetGraph ( )
virtual

The graph that this item draws.

virtual vtkIncrementalForceLayout* vtkGraphItem::GetLayout ( )
virtual

Exposes the incremental graph layout for updating parameters.

virtual void vtkGraphItem::StartLayoutAnimation ( vtkRenderWindowInteractor *  interactor)
virtual

Begins or ends the layout animation.

virtual void vtkGraphItem::StopLayoutAnimation ( )
virtual

Begins or ends the layout animation.

virtual void vtkGraphItem::UpdateLayout ( )
virtual

Incrementally updates the graph layout.

virtual bool vtkGraphItem::Paint ( vtkContext2D *  painter)
protectedvirtual

Paints the graph. This method will call RebuildBuffers() if the graph is dirty, then call PaintBuffers().

virtual void vtkGraphItem::RebuildBuffers ( )
protectedvirtual

Builds a cache of data from the graph by calling the virtual functions such as VertexColor(), EdgeColor(), etc. This will only get called when the item is dirty (i.e. IsDirty() returns true).

virtual void vtkGraphItem::PaintBuffers ( vtkContext2D *  painter)
protectedvirtual

Efficiently draws the contents of the buffers built in RebuildBuffers. This occurs once per frame.

virtual bool vtkGraphItem::IsDirty ( )
protectedvirtual

Returns true if the underlying vtkGraph has been modified since the last RebuildBuffers, signalling a new RebuildBuffers is needed. When the graph was modified, it assumes the buffers will be rebuilt, so it updates the modified time of the last build. Override this function if you have a subclass that uses any information in addition to the vtkGraph to determine visual propeties that may be dynamic.

virtual vtkIdType vtkGraphItem::NumberOfVertices ( )
protectedvirtual

Returns the number of vertices in the graph. Generally you do not need to override this method as it simply queries the underlying vtkGraph.

virtual vtkIdType vtkGraphItem::NumberOfEdges ( )
protectedvirtual

Returns the number of edges in the graph. Generally you do not need to override this method as it simply queries the underlying vtkGraph.

virtual vtkIdType vtkGraphItem::NumberOfEdgePoints ( vtkIdType  edge)
protectedvirtual

Returns the number of edge control points for a particular edge. The implementation returns GetNumberOfEdgePoints(edge) + 2 for the specified edge to incorporate the source and target vertex positions as intial and final edge points.

virtual float vtkGraphItem::EdgeWidth ( vtkIdType  edge,
vtkIdType  point 
)
protectedvirtual

Returns the edge width. Override in a subclass to change the edge width. Note: The item currently supports one width per edge, queried on the first point.

virtual vtkColor4ub vtkGraphItem::EdgeColor ( vtkIdType  edge,
vtkIdType  point 
)
protectedvirtual

Returns the edge color. Override in a subclass to change the edge color. Each edge control point may be rendered with a separate color with interpolation on line segments between points.

virtual vtkVector2f vtkGraphItem::EdgePosition ( vtkIdType  edge,
vtkIdType  point 
)
protectedvirtual

Returns the edge control point positions. You generally do not need to override this method, instead change the edge control points on the underlying vtkGraph with SetEdgePoint(), AddEdgePoint(), etc., then call Modified() on the vtkGraph and re-render the scene.

virtual float vtkGraphItem::VertexSize ( vtkIdType  vertex)
protectedvirtual

Returns the vertex size in pixels, which is remains the same at any zoom level. Override in a subclass to change the graph vertex size. Note: The item currently supports one size per graph, queried on the first vertex.

virtual vtkColor4ub vtkGraphItem::VertexColor ( vtkIdType  vertex)
protectedvirtual

Returns the color of each vertex. Override in a subclass to change the graph vertex colors.

virtual int vtkGraphItem::VertexMarker ( vtkIdType  vertex)
protectedvirtual

Returns the marker type for each vertex, as defined in vtkMarkerUtilities. Override in a subclass to change the graph marker type. Note: The item currently supports one marker type for all vertices, queried on the first vertex.

virtual vtkVector2f vtkGraphItem::VertexPosition ( vtkIdType  vertex)
protectedvirtual

Returns the position of each vertex. You generally do not need to override this method. Instead, change the vertex positions with vtkGraph's SetPoint(), then call Modified() on the graph and re-render the scene.

virtual vtkStdString vtkGraphItem::VertexTooltip ( vtkIdType  vertex)
protectedvirtual

Returns the tooltip for each vertex. Override in a subclass to change the tooltip text.

static void vtkGraphItem::ProcessEvents ( vtkObject *  caller,
unsigned long  event,
void *  clientData,
void *  callerData 
)
staticprotected

Process events and dispatch to the appropriate member functions.

virtual vtkIdType vtkGraphItem::HitVertex ( const vtkVector2f &  pos)
protectedvirtual

Return index of hit vertex, or -1 if no hit.

virtual bool vtkGraphItem::MouseMoveEvent ( const vtkContextMouseEvent &  event)
protectedvirtual

Handle mouse events.

virtual bool vtkGraphItem::MouseLeaveEvent ( const vtkContextMouseEvent &  event)
protectedvirtual

Handle mouse events.

virtual bool vtkGraphItem::MouseEnterEvent ( const vtkContextMouseEvent &  event)
protectedvirtual

Handle mouse events.

virtual bool vtkGraphItem::MouseButtonPressEvent ( const vtkContextMouseEvent &  event)
protectedvirtual

Handle mouse events.

virtual bool vtkGraphItem::MouseButtonReleaseEvent ( const vtkContextMouseEvent &  event)
protectedvirtual

Handle mouse events.

virtual bool vtkGraphItem::MouseWheelEvent ( const vtkContextMouseEvent &  event,
int  delta 
)
protectedvirtual

Handle mouse events.

virtual bool vtkGraphItem::Hit ( const vtkContextMouseEvent &  event)
protectedvirtual

Whether this graph item is hit.

virtual void vtkGraphItem::PlaceTooltip ( vtkIdType  v)
protectedvirtual

Change the position of the tooltip based on the vertex hovered.


The documentation for this class was generated from the following file: