14 #include <QTextStream>
16 #include <QXmlStreamWriter>
26 const 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();