VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkQtPolylineItem.h 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 =========================================================================*/ 00015 /*------------------------------------------------------------------------- 00016 Copyright 2008 Sandia Corporation. 00017 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00018 the U.S. Government retains certain rights in this software. 00019 -------------------------------------------------------------------------*/ 00020 00023 00024 #ifndef _vtkQtPolylineItem_h 00025 #define _vtkQtPolylineItem_h 00026 00027 #include "vtkQtChartExport.h" 00028 #include <QGraphicsItem> 00029 00030 #include "vtkQtChartGraphicsItemTypes.h" // needed for enum 00031 00032 class QPen; 00033 class QPolygonF; 00034 00035 00036 class VTKQTCHART_EXPORT vtkQtPolylineItem : public QGraphicsItem 00037 { 00038 public: 00039 enum {Type = vtkQtChart_PolylineItemType}; 00040 00041 public: 00042 vtkQtPolylineItem(QGraphicsItem *parent=0, QGraphicsScene *scene=0); 00043 virtual ~vtkQtPolylineItem(); 00044 00045 const QPen& pen() const; 00046 void setPen(const QPen& p); 00047 00048 void setPolyline(const QPolygonF& line); 00049 const QPolygonF& polyline() const; 00050 00051 virtual int type() const {return vtkQtPolylineItem::Type;} 00052 virtual QRectF boundingRect() const; 00053 virtual QPainterPath shape() const; 00054 virtual bool contains(const QPointF &point) const; 00055 00056 virtual void paint(QPainter* p, const QStyleOptionGraphicsItem* option, 00057 QWidget* widget); 00058 00059 private: 00060 bool doesLineCrossBox(const QPointF &point1, const QPointF &point2, 00061 const QRectF &box) const; 00062 00063 protected: 00064 QPen* Pen; 00065 QPolygonF* Polyline; 00066 }; 00067 00068 #endif 00069