/usr/include/kplotobject.h is in kdelibs5-dev 4:4.14.2-5+deb8u2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | /* -*- C++ -*-
This file is part of the KDE libraries
Copyright (C) 2003 Jason Harris <kstars@30doradus.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KPLOTOBJECT_H
#define KPLOTOBJECT_H
#include <kdeui_export.h>
#include <QtCore/QString>
#include <QtGui/QColor>
class QBrush;
class QPainter;
class QPen;
class QPointF;
class KPlotWidget;
class KPlotPoint;
/**
* @class KPlotObject
* @short Encapsulates a data set to be plotted in a KPlotWidget.
*
* Think of a KPlotObject as a set of data displayed as a group in the plot.
* Each KPlotObject consists of a list of KPlotPoints, a "type" controlling
* how the data points are displayed (some combination of Points, Lines, or
* Bars), a color, and a size. There is also a parameter which controls the
* shape of the points used to display the KPlotObject.
*
* @note KPlotObject will take care of the points added to it, so when clearing
* the points list (eg with clearPoints()) any previous reference to a KPlotPoint
* already added to a KPlotObject will be invalid.
*
* @author Jason Harris
* @version 1.1
*/
class KDEUI_EXPORT KPlotObject{
public:
/**
* The type classification of the KPlotObject.
*
* These are bitmask values that can be OR'd together, so that a set
* of points can be represented in the plot in multiple ways.
*
* @note points should be added in order of increasing x-coordinate
* when using Bars.
*/
enum PlotType
{
UnknownType = 0,
Points = 1, ///< each KPlotPoint is represented with a drawn point
Lines = 2, ///< each KPlotPoint is connected with a line
Bars = 4 ///< each KPlotPoint is shown as a vertical bar
};
Q_DECLARE_FLAGS( PlotTypes, PlotType )
/**
* The available shape styles for plotted points.
*/
enum PointStyle
{
NoPoints = 0,
Circle = 1,
Letter = 2,
Triangle = 3,
Square = 4,
Pentagon = 5,
Hexagon = 6,
Asterisk = 7,
Star = 8,
UnknwonPoint
};
/**
* Constructor.
* @param color The color for plotting this object. By default this sets
* the color for Points, Lines and Bars, but there are functions to
* override any of these.
* @param otype the PlotType for this object (Points, Lines or Bars)
* @param size the size to use for plotted points, in pixels
* @param ps The PointStyle describing the shape for plotted points
*/
explicit KPlotObject( const QColor &color = Qt::white, PlotType otype = Points, double size = 2, PointStyle ps = Circle );
/**
* Destructor.
*/
~KPlotObject();
/**
* @return the plot flags of the object
*/
PlotTypes plotTypes() const;
/**
* Set whether points will be drawn for this object
* @param b if true, points will be drawn
*/
void setShowPoints( bool b );
/**
* Set whether lines will be drawn for this object
* @param b if true, lines will be drawn
*/
void setShowLines( bool b );
/**
* Set whether bars will be drawn for this object
* @param b if true, bars will be drawn
*/
void setShowBars( bool b );
/**
* @return the size of the plotted points in this object, in pixels
*/
double size() const;
/**
* Set the size for plotted points in this object, in pixels
* @param s the new size
*/
void setSize( double s );
/**
* @return the style used for drawing the points in this object
*/
PointStyle pointStyle() const;
/**
* Set a new style for drawing the points in this object
* @param p the new style
*/
void setPointStyle( PointStyle p );
/**
* @return the default pen for this Object.
* If no other pens are set, this pen will be used for
* points, lines, bars and labels (this pen is always used for points).
*/
const QPen& pen() const;
/**
* Set the default pen for this object
* @p The pen to use
*/
void setPen( const QPen &p );
/**
* @return the pen to use for drawing lines for this Object.
*/
const QPen& linePen() const;
/**
* Set the pen to use for drawing lines for this object
* @p The pen to use
*/
void setLinePen( const QPen &p );
/**
* @return the pen to use for drawing bars for this Object.
*/
const QPen& barPen() const;
/**
* Set the pen to use for drawing bars for this object
* @p The pen to use
*/
void setBarPen( const QPen &p );
/**
* @return the pen to use for drawing labels for this Object.
*/
const QPen& labelPen() const;
/**
* Set the pen to use for labels for this object
* @p The pen to use
*/
void setLabelPen( const QPen &p );
/**
* @return the default Brush to use for this Object.
*/
const QBrush brush() const;
/**
* Set the default brush to use for this object
* @b The brush to use
*/
void setBrush( const QBrush &b );
/**
* @return the brush to use for filling bars for this Object.
*/
const QBrush barBrush() const;
/**
* Set the brush to use for drawing bars for this object
* @b The brush to use
*/
void setBarBrush( const QBrush &b );
/**
* @return the list of KPlotPoints that make up this object
*/
QList< KPlotPoint* > points() const;
/**
* Add a point to the object's list of points, using input data to construct a KPlotPoint.
* @param p the QPointF to add.
* @param label the optional text label for this point
* @param barWidth the width of the bar, if this object is to be drawn with bars
* @note if @param barWidth is left at its default value of 0.0, then the width will be
* automatically set to the distance between this point and the one to its right.
*/
void addPoint( const QPointF &p, const QString &label = QString(), double barWidth = 0.0 );
/**
* Add a given KPlotPoint to the object's list of points.
* @overload
* @param p pointer to the KPlotPoint to add.
*/
void addPoint( KPlotPoint *p );
/**
* Add a point to the object's list of points, using input data to construct a KPlotPoint.
* @overload
* @param x the X-coordinate of the point to add.
* @param y the Y-coordinate of the point to add.
* @param label the optional text label
* @param barWidth the width of the bar, if this object is to be drawn with bars
* @note if @param barWidth is left at its default value of 0.0, then the width will be
* automatically set to the distance between this point and the one to its right.
*/
void addPoint( double x, double y, const QString &label = QString(), double barWidth = 0.0 );
/**
* Remove the QPointF at position index from the list of points
* @param index the index of the point to be removed.
*/
void removePoint( int index );
/**
* Remove and destroy the points of this object
*/
void clearPoints();
/**
* Draw this KPlotObject on the given QPainter
* @param p The QPainter to draw on
* @param pw the KPlotWidget to draw on (this is needed
* for the KPlotWidget::mapToWidget() function)
*/
void draw( QPainter *p, KPlotWidget *pw );
private:
class Private;
Private * const d;
Q_DISABLE_COPY( KPlotObject )
};
Q_DECLARE_OPERATORS_FOR_FLAGS( KPlotObject::PlotTypes )
#endif
|