Engauge Digitizer  2
GraphicsPointFactory.cpp
1 #include "DataKey.h"
2 #include "EnumsToQt.h"
3 #include "GraphicsItemType.h"
4 #include "GraphicsPoint.h"
5 #include "GraphicsPointFactory.h"
6 #include "PointStyle.h"
7 #include <QColor>
8 #include <QGraphicsScene>
9 #include <QPointF>
10 #include <QPolygonF>
11 
13 {
14 }
15 
17  const QString &identifier,
18  const QPointF &posScreen,
19  const PointStyle &pointStyle)
20 {
21  GraphicsPoint *item = 0;
22 
23  switch (pointStyle.shape ())
24  {
25  case POINT_SHAPE_CIRCLE:
26  {
27  item = new GraphicsPoint (scene,
28  identifier,
29  posScreen,
30  ColorPaletteToQColor (pointStyle.paletteColor ()),
31  pointStyle.radius (),
32  pointStyle.lineWidth());
33  }
34  break;
35 
36  default:
37  {
38  item = new GraphicsPoint (scene,
39  identifier,
40  posScreen,
41  ColorPaletteToQColor (pointStyle.paletteColor ()),
42  pointStyle.polygon (),
43  pointStyle.lineWidth());
44  }
45  break;
46  }
47 
48  return item;
49 }
int lineWidth() const
Get method for line width.
Definition: PointStyle.cpp:112
GraphicsPoint * createPoint(QGraphicsScene &scene, const QString &identifier, const QPointF &posScreen, const PointStyle &pointStyle)
Create circle or polygon point according to the PointStyle.
GraphicsPointFactory()
Single constructor.
QPolygonF polygon() const
Return the polygon for creating a QGraphicsPolygonItem. The size is determined by the radius...
Definition: PointStyle.cpp:148
Details for a specific Point.
Definition: PointStyle.h:14
ColorPalette paletteColor() const
Get method for point color.
Definition: PointStyle.cpp:143
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:246
Graphics item for drawing a circular or polygonal Point.
Definition: GraphicsPoint.h:33
PointShape shape() const
Get method for point shape.
Definition: PointStyle.cpp:285