16#include <QXmlStreamWriter>
26const double PI = 3.1415926535;
44 m_lineWidth (lineWidth),
45 m_paletteColor (paletteColor)
50 m_shape (other.shape()),
51 m_radius (other.radius ()),
52 m_lineWidth (other.lineWidth ()),
53 m_paletteColor (other.paletteColor ())
59 m_shape = other.
shape ();
60 m_radius = other.
radius ();
96 shape = pointShapes [index % 4];
99 int indexOneBased = index + 1;
104 settings.beginGroup (groupName);
111 settings.endGroup ();
133 QXmlStreamAttributes attributes = reader.attributes();
146 while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
151 reader.raiseError (QObject::tr (
"Cannot read point style data"));
157 return m_paletteColor;
162 const int NUM_XY = 60;
163 QVector<QPointF> points;
169 int xyWidth = signed (m_radius);
170 for (
int i = 0; i <= NUM_XY; i++) {
171 double angle =
TWO_PI * double (i) / double (NUM_XY);
172 double x = xyWidth * cos (angle);
173 double y = xyWidth * sin (angle);
174 points.append (QPointF (x, y));
181 int xyWidth = signed (m_radius);
183 points.append (QPointF (-1 * xyWidth, 0));
184 points.append (QPointF (xyWidth, 0));
185 points.append (QPointF (0, 0));
186 points.append (QPointF (0, xyWidth));
187 points.append (QPointF (0, -1 * xyWidth));
188 points.append (QPointF (0, 0));
194 int xyWidth = signed (m_radius);
196 points.append (QPointF (0, -1 * xyWidth));
197 points.append (QPointF (-1 * xyWidth, 0));
198 points.append (QPointF (0, xyWidth));
199 points.append (QPointF (xyWidth, 0));
205 int xyWidth = signed (m_radius);
207 points.append (QPointF (-1 * xyWidth, -1 * xyWidth));
208 points.append (QPointF (xyWidth, -1 * xyWidth));
209 points.append (QPointF (-1 * xyWidth, xyWidth));
210 points.append (QPointF (xyWidth, xyWidth));
216 int xyWidth = signed (m_radius);
218 points.append (QPointF (-1 * xyWidth, -1 * xyWidth));
219 points.append (QPointF (-1 * xyWidth, xyWidth));
220 points.append (QPointF (xyWidth, xyWidth));
221 points.append (QPointF (xyWidth, -1 * xyWidth));
227 int xyWidth = signed (m_radius);
229 points.append (QPointF (-1 * xyWidth, -1 * xyWidth));
230 points.append (QPointF (0, xyWidth));
231 points.append (QPointF (xyWidth, -1 * xyWidth));
237 int xyWidth = signed (m_radius);
239 points.append (QPointF (-1 * xyWidth, xyWidth));
240 points.append (QPointF (0, -1 * xyWidth));
241 points.append (QPointF (xyWidth, xyWidth));
247 int xyWidth = qFloor (m_radius * qSqrt (0.5));
249 points.append (QPointF (-1 * xyWidth, -1 * xyWidth));
250 points.append (QPointF (xyWidth, xyWidth));
251 points.append (QPointF (0, 0));
252 points.append (QPointF (-1 * xyWidth, xyWidth));
253 points.append (QPointF (xyWidth, -1 * xyWidth));
254 points.append (QPointF (0, 0));
264 QTextStream &str)
const
266 str << indentation <<
"PointStyle\n";
271 str << indentation <<
"radius=" << m_radius <<
"\n";
272 str << indentation <<
"lineWidth=" << m_lineWidth <<
"\n";
292 writer.writeEndElement();
QString colorPaletteToString(ColorPalette colorPalette)
const QString DOCUMENT_SERIALIZE_POINT_STYLE_RADIUS
const QString DOCUMENT_SERIALIZE_POINT_STYLE_SHAPE_STRING
const QString DOCUMENT_SERIALIZE_POINT_STYLE_LINE_WIDTH
const QString DOCUMENT_SERIALIZE_POINT_STYLE_COLOR
const QString DOCUMENT_SERIALIZE_POINT_STYLE
const QString DOCUMENT_SERIALIZE_POINT_STYLE_COLOR_STRING
const QString DOCUMENT_SERIALIZE_POINT_STYLE_SHAPE
log4cpp::Category * mainCat
const QString INDENTATION_DELTA
QString pointShapeToString(PointShape pointShape)
const int DEFAULT_POINT_LINE_WIDTH
const PointShape DEFAULT_POINT_SHAPE_AXIS
const int DEFAULT_POINT_RADIUS
const ColorPalette DEFAULT_POINT_COLOR_AXES
const ColorPalette DEFAULT_POINT_COLOR_GRAPH
const QString SETTINGS_ENGAUGE
const QString SETTINGS_GROUP_CURVE_AXES
const QString SETTINGS_CURVE_POINT_COLOR
const QString SETTINGS_CURVE_POINT_LINE_WIDTH
const QString SETTINGS_CURVE_POINT_SHAPE
const QString SETTINGS_CURVE_POINT_RADIUS
const QString SETTINGS_DIGITIZER
QXmlStreamReader::TokenType loadNextFromReader(QXmlStreamReader &reader)
Load next token from xml reader.
Details for a specific Point.
unsigned int radius() const
Radius of point. For a circle this is all that is needed to draw a circle. For a polygon,...
PointStyle & operator=(const PointStyle &other)
Assignment constructor.
QPolygonF polygon() const
Return the polygon for creating a QGraphicsPolygonItem. The size is determined by the radius.
void loadXml(QXmlStreamReader &reader)
Load model from serialized xml. Returns the curve name.
void setPaletteColor(ColorPalette paletteColor)
Set method for point color.
bool isCircle() const
Return true if point is a circle, otherwise it is a polygon. For a circle, the radius is important an...
void setShape(PointShape shape)
Set method for point shape.
PointShape shape() const
Get method for point shape.
static PointStyle defaultGraphCurve(int index)
Initial default for index'th graph curve.
void setLineWidth(int width)
Set method for line width.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
static PointStyle defaultAxesCurve()
Initial default for axes curve.
ColorPalette paletteColor() const
Get method for point color.
void setRadius(unsigned int radius)
Set method for point radius.
void saveXml(QXmlStreamWriter &writer) const
Serialize to stream.
int lineWidth() const
Get method for line width.
PointStyle()
Default constructor only for use when this class is being stored by a container that requires the def...
Manage storage and retrieval of the settings for the curves.
QString groupNameForNthCurve(int indexOneBased) const
Return the group name, that appears in the settings file/registry, for the specified curve index.
#define LOG4CPP_INFO_S(logger)