VTK
|
A 2D graphics item for rendering a graph. More...
#include <vtkGraphItem.h>
Public Types | |
typedef vtkContextItem | Superclass |
Public Member Functions | |
virtual int | IsA (const char *type) |
vtkGraphItem * | NewInstance () 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 vtkGraphItem * | New () |
static int | IsTypeOf (const char *type) |
static vtkGraphItem * | SafeDownCast (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) |
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.
Definition at line 49 of file vtkGraphItem.h.
Reimplemented from vtkContextItem.
Definition at line 53 of file vtkGraphItem.h.
vtkGraphItem::vtkGraphItem | ( | ) | [protected] |
vtkGraphItem::~vtkGraphItem | ( | ) | [protected] |
static vtkGraphItem* vtkGraphItem::New | ( | ) | [static] |
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
Reimplemented from vtkObject.
static int vtkGraphItem::IsTypeOf | ( | const char * | name | ) | [static] |
Return 1 if this class type 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.
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] |
Reimplemented from vtkContextItem.
virtual vtkObjectBase* vtkGraphItem::NewInstanceInternal | ( | ) | const [protected, virtual] |
Reimplemented from vtkContextItem.
vtkGraphItem* vtkGraphItem::NewInstance | ( | ) | const |
Reimplemented from vtkContextItem.
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 | ) | [protected, virtual] |
Paints the graph. This method will call RebuildBuffers() if the graph is dirty, then call PaintBuffers().
Reimplemented from vtkAbstractContextItem.
virtual void vtkGraphItem::RebuildBuffers | ( | ) | [protected, virtual] |
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 | ) | [protected, virtual] |
Efficiently draws the contents of the buffers built in RebuildBuffers. This occurs once per frame.
virtual bool vtkGraphItem::IsDirty | ( | ) | [protected, virtual] |
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 | ( | ) | [protected, virtual] |
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 | ( | ) | [protected, virtual] |
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 | ) | [protected, virtual] |
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 | ||
) | [protected, virtual] |
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 | ||
) | [protected, virtual] |
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 | ||
) | [protected, virtual] |
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 | ) | [protected, virtual] |
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 | ) | [protected, virtual] |
Returns the color of each vertex. Override in a subclass to change the graph vertex colors.
virtual int vtkGraphItem::VertexMarker | ( | vtkIdType | vertex | ) | [protected, virtual] |
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 | ) | [protected, virtual] |
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 | ) | [protected, virtual] |
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 | ||
) | [static, protected] |
Process events and dispatch to the appropriate member functions.
virtual vtkIdType vtkGraphItem::HitVertex | ( | const vtkVector2f & | pos | ) | [protected, virtual] |
Return index of hit vertex, or -1 if no hit.
virtual bool vtkGraphItem::MouseMoveEvent | ( | const vtkContextMouseEvent & | event | ) | [protected, virtual] |
Handle mouse events.
Reimplemented from vtkAbstractContextItem.
virtual bool vtkGraphItem::MouseLeaveEvent | ( | const vtkContextMouseEvent & | event | ) | [protected, virtual] |
Handle mouse events.
Reimplemented from vtkAbstractContextItem.
virtual bool vtkGraphItem::MouseEnterEvent | ( | const vtkContextMouseEvent & | event | ) | [protected, virtual] |
Handle mouse events.
Reimplemented from vtkAbstractContextItem.
virtual bool vtkGraphItem::MouseButtonPressEvent | ( | const vtkContextMouseEvent & | event | ) | [protected, virtual] |
Handle mouse events.
Reimplemented from vtkAbstractContextItem.
virtual bool vtkGraphItem::MouseButtonReleaseEvent | ( | const vtkContextMouseEvent & | event | ) | [protected, virtual] |
Handle mouse events.
Reimplemented from vtkAbstractContextItem.
virtual bool vtkGraphItem::MouseWheelEvent | ( | const vtkContextMouseEvent & | event, |
int | delta | ||
) | [protected, virtual] |
Handle mouse events.
Reimplemented from vtkAbstractContextItem.
virtual bool vtkGraphItem::Hit | ( | const vtkContextMouseEvent & | event | ) | [protected, virtual] |
Whether this graph item is hit.
Reimplemented from vtkAbstractContextItem.
virtual void vtkGraphItem::PlaceTooltip | ( | vtkIdType | v | ) | [protected, virtual] |
Change the position of the tooltip based on the vertex hovered.