VTK
dox/Views/Infovis/vtkGraphItem.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    TestDiagram.cxx
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00033 #ifndef __vtkMultiLineItem_h
00034 #define __vtkMultiLineItem_h
00035 
00036 #include "vtkViewsInfovisModule.h" // For export macro
00037 #include "vtkContextItem.h"
00038 
00039 #include "vtkVector.h" // For vector types in API
00040 #include "vtkColor.h" // For color types in API
00041 #include "vtkNew.h" // For vtkNew ivars
00042 
00043 class vtkGraph;
00044 class vtkImageData;
00045 class vtkIncrementalForceLayout;
00046 class vtkRenderWindowInteractor;
00047 class vtkTooltipItem;
00048 
00049 class VTKVIEWSINFOVIS_EXPORT vtkGraphItem : public vtkContextItem
00050 {
00051 public:
00052   static vtkGraphItem *New();
00053   vtkTypeMacro(vtkGraphItem, vtkContextItem);
00054   virtual void PrintSelf(ostream &os, vtkIndent indent);
00055 
00057 
00058   virtual void SetGraph(vtkGraph *graph);
00059   vtkGetObjectMacro(Graph, vtkGraph);
00061 
00063   virtual vtkIncrementalForceLayout *GetLayout();
00064 
00066 
00067   virtual void StartLayoutAnimation(vtkRenderWindowInteractor *interactor);
00068   virtual void StopLayoutAnimation();
00070 
00072   virtual void UpdateLayout();
00073 
00074 protected:
00075   vtkGraphItem();
00076   ~vtkGraphItem();
00077 
00080   virtual bool Paint(vtkContext2D *painter);
00081 
00085   virtual void RebuildBuffers();
00086 
00089   virtual void PaintBuffers(vtkContext2D *painter);
00090 
00097   virtual bool IsDirty();
00098 
00102   virtual vtkIdType NumberOfVertices();
00103 
00106   virtual vtkIdType NumberOfEdges();
00107 
00112   virtual vtkIdType NumberOfEdgePoints(vtkIdType edge);
00113 
00117   virtual float EdgeWidth(vtkIdType edge, vtkIdType point);
00118 
00122   virtual vtkColor4ub EdgeColor(vtkIdType edge, vtkIdType point);
00123 
00128   virtual vtkVector2f EdgePosition(vtkIdType edge, vtkIdType point);
00129 
00134   virtual float VertexSize(vtkIdType vertex);
00135 
00138   virtual vtkColor4ub VertexColor(vtkIdType vertex);
00139 
00144   virtual int VertexMarker(vtkIdType vertex);
00145 
00150   virtual vtkVector2f VertexPosition(vtkIdType vertex);
00151 
00154   virtual vtkStdString VertexTooltip(vtkIdType vertex);
00155 
00157 
00158   static void ProcessEvents(vtkObject *caller, unsigned long event,
00159                             void *clientData, void *callerData);
00161 
00163   virtual vtkIdType HitVertex(const vtkVector2f &pos);
00164 
00166 
00167   virtual bool MouseMoveEvent(const vtkContextMouseEvent &event);
00168   virtual bool MouseLeaveEvent(const vtkContextMouseEvent &event);
00169   virtual bool MouseEnterEvent(const vtkContextMouseEvent &event);
00170   virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &event);
00171   virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &event);
00172   virtual bool MouseWheelEvent(const vtkContextMouseEvent &event, int delta);
00174 
00176   virtual bool Hit(const vtkContextMouseEvent &event);
00177 
00179   virtual void PlaceTooltip(vtkIdType v);
00180 
00181 private:
00182   vtkGraphItem(const vtkGraphItem&); // Not implemented
00183   void operator=(const vtkGraphItem&); // Not implemented
00184 
00185   struct Internals;
00186   Internals *Internal;
00187 
00188   vtkGraph *Graph;
00189   unsigned long GraphBuildTime;
00190   vtkNew<vtkImageData> Sprite;
00191   vtkNew<vtkIncrementalForceLayout> Layout;
00192   vtkNew<vtkTooltipItem> Tooltip;
00193 };
00194 
00195 #endif