Engauge Digitizer  2
PointStyle.h
1 /******************************************************************************************************
2  * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5  ******************************************************************************************************/
6 
7 #ifndef POINT_STYLE_H
8 #define POINT_STYLE_H
9 
10 #include "ColorPalette.h"
11 #include "PointShape.h"
12 #include <QColor>
13 #include <QPolygonF>
14 
15 class QTextStream;
16 class QXmlStreamReader;
17 class QXmlStreamWriter;
18 
21 {
22 public:
24  PointStyle ();
25 
27  PointStyle(PointShape pointShape,
28  unsigned int radius,
29  int lineWidth,
30  ColorPalette paletteColor);
31 
33  PointStyle (const PointStyle &other);
34 
36  PointStyle &operator=(const PointStyle &other);
37 
39  static PointStyle defaultAxesCurve ();
40 
42  static PointStyle defaultGraphCurve (int index);
43 
45  bool isCircle () const;
46 
48  int lineWidth () const;
49 
51  void loadXml(QXmlStreamReader &reader);
52 
54  ColorPalette paletteColor () const;
55 
57  QPolygonF polygon () const;
58 
60  void printStream (QString indentation,
61  QTextStream &str) const;
62 
64  int radius () const;
65 
67  void saveXml(QXmlStreamWriter &writer) const;
68 
70  void setLineWidth (int width);
71 
73  void setPaletteColor (ColorPalette paletteColor);
74 
76  void setRadius (int radius);
77 
79  void setShape (PointShape shape);
80 
82  PointShape shape () const;
83 
84 private:
85 
86  PointShape m_shape;
87  unsigned int m_radius;
88  int m_lineWidth;
89  ColorPalette m_paletteColor;
90 };
91 
92 #endif // POINT_STYLE_H
static PointStyle defaultAxesCurve()
Initial default for axes curve.
Definition: PointStyle.cpp:62
PointStyle()
Default constructor only for use when this class is being stored by a container that requires the def...
Definition: PointStyle.cpp:29
void loadXml(QXmlStreamReader &reader)
Load model from serialized xml. Returns the curve name.
Definition: PointStyle.cpp:124
QPolygonF polygon() const
Return the polygon for creating a QGraphicsPolygonItem. The size is determined by the radius...
Definition: PointStyle.cpp:155
void saveXml(QXmlStreamWriter &writer) const
Serialize to stream.
Definition: PointStyle.cpp:258
void setShape(PointShape shape)
Set method for point shape.
Definition: PointStyle.cpp:287
int radius() const
Radius of point. For a circle this is all that is needed to draw a circle. For a polygon, the radius determines the size of the polygon.
Definition: PointStyle.cpp:253
Details for a specific Point.
Definition: PointStyle.h:20
void setPaletteColor(ColorPalette paletteColor)
Set method for point color.
Definition: PointStyle.cpp:277
PointShape shape() const
Get method for point shape.
Definition: PointStyle.cpp:292
PointStyle & operator=(const PointStyle &other)
Assignment constructor.
Definition: PointStyle.cpp:52
ColorPalette paletteColor() const
Get method for point color.
Definition: PointStyle.cpp:150
bool isCircle() const
Return true if point is a circle, otherwise it is a polygon. For a circle, the radius is important an...
Definition: PointStyle.cpp:114
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
Definition: PointStyle.cpp:240
int lineWidth() const
Get method for line width.
Definition: PointStyle.cpp:119
static PointStyle defaultGraphCurve(int index)
Initial default for index&#39;th graph curve.
Definition: PointStyle.cpp:83
void setLineWidth(int width)
Set method for line width.
Definition: PointStyle.cpp:272
void setRadius(int radius)
Set method for point radius.
Definition: PointStyle.cpp:282