Engauge Digitizer  2
GraphicsPointFactory.cpp
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 #include "DataKey.h"
8 #include "EnumsToQt.h"
9 #include "GeometryWindow.h"
10 #include "GraphicsItemType.h"
11 #include "GraphicsPoint.h"
12 #include "GraphicsPointFactory.h"
13 #include "PointStyle.h"
14 #include <QColor>
15 #include <QGraphicsScene>
16 #include <QPointF>
17 #include <QPolygonF>
18 
20 {
21 }
22 
24  const QString &identifier,
25  const QPointF &posScreen,
26  const PointStyle &pointStyle,
27  GeometryWindow *geometryWindow)
28 {
29  GraphicsPoint *item = 0;
30 
31  switch (pointStyle.shape ())
32  {
33  case POINT_SHAPE_CIRCLE:
34  {
35  item = new GraphicsPoint (scene,
36  identifier,
37  posScreen,
38  ColorPaletteToQColor (pointStyle.paletteColor ()),
39  pointStyle.radius (),
40  pointStyle.lineWidth(),
41  geometryWindow);
42  }
43  break;
44 
45  default:
46  {
47  item = new GraphicsPoint (scene,
48  identifier,
49  posScreen,
50  ColorPaletteToQColor (pointStyle.paletteColor ()),
51  pointStyle.polygon (),
52  pointStyle.lineWidth(),
53  geometryWindow);
54  }
55  break;
56  }
57 
58  return item;
59 }
GraphicsPointFactory()
Single constructor.
Window that displays the geometry information, as a table, for the current curve. ...
QPolygonF polygon() const
Return the polygon for creating a QGraphicsPolygonItem. The size is determined by the radius...
Definition: PointStyle.cpp:155
GraphicsPoint * createPoint(QGraphicsScene &scene, const QString &identifier, const QPointF &posScreen, const PointStyle &pointStyle, GeometryWindow *geometryWindow)
Create circle or polygon point according to the PointStyle.
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
PointShape shape() const
Get method for point shape.
Definition: PointStyle.cpp:292
Graphics item for drawing a circular or polygonal Point.
Definition: GraphicsPoint.h:43
ColorPalette paletteColor() const
Get method for point color.
Definition: PointStyle.cpp:150
int lineWidth() const
Get method for line width.
Definition: PointStyle.cpp:119