VTK
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>

Inheritance diagram for vtkGraphItem:
[legend]
Collaboration diagram for vtkGraphItem:
[legend]

Public Types

typedef vtkContextItem Superclass
 
- Public Types inherited from vtkContextItem
typedef vtkAbstractContextItem Superclass
 
- Public Types inherited from vtkAbstractContextItem
typedef vtkObject Superclass
 
- Public Types inherited from vtkObject
typedef vtkObjectBase Superclass
 

Public Member Functions

virtual int IsA (const char *type)
 
vtkGraphItemNewInstance () const
 
virtual void PrintSelf (ostream &os, vtkIndent indent)
 
virtual vtkIncrementalForceLayoutGetLayout ()
 
virtual void UpdateLayout ()
 
virtual void SetGraph (vtkGraph *graph)
 
virtual vtkGraphGetGraph ()
 
virtual void StartLayoutAnimation (vtkRenderWindowInteractor *interactor)
 
virtual void StopLayoutAnimation ()
 
- Public Member Functions inherited from vtkContextItem
vtkContextItemNewInstance () const
 
virtual double GetOpacity ()
 
virtual void SetOpacity (double)
 
- Public Member Functions inherited from vtkAbstractContextItem
vtkAbstractContextItemNewInstance () const
 
virtual void Update ()
 
virtual bool PaintChildren (vtkContext2D *painter)
 
virtual void ReleaseGraphicsResources ()
 
unsigned int AddItem (vtkAbstractContextItem *item)
 
bool RemoveItem (vtkAbstractContextItem *item)
 
bool RemoveItem (unsigned int index)
 
vtkAbstractContextItemGetItem (unsigned int index)
 
unsigned int GetItemIndex (vtkAbstractContextItem *item)
 
unsigned int GetNumberOfItems ()
 
void ClearItems ()
 
unsigned int Raise (unsigned int index)
 
unsigned int Lower (unsigned int index)
 
virtual vtkAbstractContextItemGetPickedItem (const vtkContextMouseEvent &mouse)
 
virtual bool MouseDoubleClickEvent (const vtkContextMouseEvent &mouse)
 
virtual bool KeyPressEvent (const vtkContextKeyEvent &key)
 
virtual void SetScene (vtkContextScene *scene)
 
virtual void SetParent (vtkAbstractContextItem *parent)
 
virtual vtkVector2f MapToParent (const vtkVector2f &point)
 
virtual vtkVector2f MapFromParent (const vtkVector2f &point)
 
virtual vtkVector2f MapToScene (const vtkVector2f &point)
 
virtual vtkVector2f MapFromScene (const vtkVector2f &point)
 
virtual unsigned int StackAbove (unsigned int index, unsigned int under)
 
virtual unsigned int StackUnder (unsigned int child, unsigned int above)
 
virtual bool KeyReleaseEvent (const vtkContextKeyEvent &key)
 
vtkContextSceneGetScene ()
 
vtkAbstractContextItemGetParent ()
 
virtual bool GetVisible ()
 
virtual void SetVisible (bool)
 
virtual bool GetInteractive ()
 
virtual void SetInteractive (bool)
 
- Public Member Functions inherited from vtkObject
vtkObjectNewInstance () const
 
virtual void DebugOn ()
 
virtual void DebugOff ()
 
bool GetDebug ()
 
void SetDebug (bool debugFlag)
 
virtual void Modified ()
 
virtual unsigned long GetMTime ()
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 
vtkCommandGetCommand (unsigned long tag)
 
void RemoveObserver (vtkCommand *)
 
void RemoveObservers (unsigned long event, vtkCommand *)
 
void RemoveObservers (const char *event, vtkCommand *)
 
int HasObserver (unsigned long event, vtkCommand *)
 
int HasObserver (const char *event, vtkCommand *)
 
void RemoveObserver (unsigned long tag)
 
void RemoveObservers (unsigned long event)
 
void RemoveObservers (const char *event)
 
void RemoveAllObservers ()
 
int HasObserver (unsigned long event)
 
int HasObserver (const char *event)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
int InvokeEvent (unsigned long event, void *callData)
 
int InvokeEvent (const char *event, void *callData)
 
int InvokeEvent (unsigned long event)
 
int InvokeEvent (const char *event)
 
- Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 
virtual void Delete ()
 
virtual void FastDelete ()
 
void Print (ostream &os)
 
virtual void Register (vtkObjectBase *o)
 
virtual void UnRegister (vtkObjectBase *o)
 
void SetReferenceCount (int)
 
void PrintRevisions (ostream &)
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 
int GetReferenceCount ()
 

Static Public Member Functions

static vtkGraphItemNew ()
 
static int IsTypeOf (const char *type)
 
static vtkGraphItemSafeDownCast (vtkObjectBase *o)
 
- Static Public Member Functions inherited from vtkContextItem
static int IsTypeOf (const char *type)
 
static vtkContextItemSafeDownCast (vtkObjectBase *o)
 
- Static Public Member Functions inherited from vtkAbstractContextItem
static int IsTypeOf (const char *type)
 
static vtkAbstractContextItemSafeDownCast (vtkObjectBase *o)
 
- Static Public Member Functions inherited from vtkObject
static int IsTypeOf (const char *type)
 
static vtkObjectSafeDownCast (vtkObjectBase *o)
 
static vtkObjectNew ()
 
static void BreakOnError ()
 
static void SetGlobalWarningDisplay (int val)
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 
static int GetGlobalWarningDisplay ()
 
- Static Public Member Functions inherited from vtkObjectBase
static int IsTypeOf (const char *name)
 
static vtkObjectBaseNew ()
 

Protected Member Functions

virtual vtkObjectBaseNewInstanceInternal () 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)
 
- Protected Member Functions inherited from vtkContextItem
 vtkContextItem ()
 
 ~vtkContextItem ()
 
- Protected Member Functions inherited from vtkAbstractContextItem
 vtkAbstractContextItem ()
 
 ~vtkAbstractContextItem ()
 
- Protected Member Functions inherited from vtkObject
 vtkObject ()
 
virtual ~vtkObject ()
 
virtual void RegisterInternal (vtkObjectBase *, int check)
 
virtual void UnRegisterInternal (vtkObjectBase *, int check)
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL)
 
void InternalReleaseFocus ()
 
- Protected Member Functions inherited from vtkObjectBase
 vtkObjectBase ()
 
virtual ~vtkObjectBase ()
 
virtual void CollectRevisions (ostream &)
 
virtual void ReportReferences (vtkGarbageCollector *)
 
 vtkObjectBase (const vtkObjectBase &)
 
void operator= (const vtkObjectBase &)
 

Static Protected Member Functions

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

Additional Inherited Members

- Protected Attributes inherited from vtkContextItem
double Opacity
 
- Protected Attributes inherited from vtkAbstractContextItem
vtkContextSceneScene
 
vtkAbstractContextItemParent
 
vtkContextScenePrivateChildren
 
bool Visible
 
bool Interactive
 
- Protected Attributes inherited from vtkObject
bool Debug
 
vtkTimeStamp MTime
 
vtkSubjectHelper * SubjectHelper
 
- Protected Attributes inherited from vtkObjectBase
vtkAtomicInt32 ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 

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

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 *  name)
virtual

Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkContextItem.

static vtkGraphItem* vtkGraphItem::SafeDownCast ( vtkObjectBase o)
static
virtual vtkObjectBase* vtkGraphItem::NewInstanceInternal ( ) const
protectedvirtual

Reimplemented from vtkContextItem.

vtkGraphItem* vtkGraphItem::NewInstance ( ) const
virtual void vtkGraphItem::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
virtual

Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkContextItem.

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().

Reimplemented from vtkAbstractContextItem.

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.

Reimplemented from vtkAbstractContextItem.

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

Handle mouse events.

Reimplemented from vtkAbstractContextItem.

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

Handle mouse events.

Reimplemented from vtkAbstractContextItem.

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

Handle mouse events.

Reimplemented from vtkAbstractContextItem.

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

Handle mouse events.

Reimplemented from vtkAbstractContextItem.

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

Handle mouse events.

Reimplemented from vtkAbstractContextItem.

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

Whether this graph item is hit.

Reimplemented from vtkAbstractContextItem.

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: