VTK
vtkQtPolylineItem.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkQtPolylineItem.h
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 =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright 2008 Sandia Corporation.
17  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18  the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
20 
23 
24 #ifndef _vtkQtPolylineItem_h
25 #define _vtkQtPolylineItem_h
26 
27 #include "vtkQtChartExport.h"
28 #include <QGraphicsItem>
29 
30 #include "vtkQtChartGraphicsItemTypes.h" // needed for enum
31 
32 class QPen;
33 class QPolygonF;
34 
35 
36 class VTKQTCHART_EXPORT vtkQtPolylineItem : public QGraphicsItem
37 {
38 public:
40 
41 public:
42  vtkQtPolylineItem(QGraphicsItem *parent=0, QGraphicsScene *scene=0);
43  virtual ~vtkQtPolylineItem();
44 
45  const QPen& pen() const;
46  void setPen(const QPen& p);
47 
48  void setPolyline(const QPolygonF& line);
49  const QPolygonF& polyline() const;
50 
51  virtual int type() const {return vtkQtPolylineItem::Type;}
52  virtual QRectF boundingRect() const;
53  virtual QPainterPath shape() const;
54  virtual bool contains(const QPointF &point) const;
55 
56  virtual void paint(QPainter* p, const QStyleOptionGraphicsItem* option,
57  QWidget* widget);
58 
59 private:
60  bool doesLineCrossBox(const QPointF &point1, const QPointF &point2,
61  const QRectF &box) const;
62 
63 protected:
64  QPen* Pen;
65  QPolygonF* Polyline;
66 };
67 
68 #endif
69 
virtual int type() const