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 "GraphicsItemType.h"
10#include "GraphicsPoint.h"
11#include "GraphicsPointFactory.h"
12#include "PointStyle.h"
13#include <QColor>
14#include <QGraphicsScene>
15#include <QPointF>
16#include <QPolygonF>
17
19{
20}
21
23 const QString &identifier,
24 const QPointF &posScreen,
25 const PointStyle &pointStyle)
26{
27 GraphicsPoint *item = 0;
28
29 switch (pointStyle.shape ())
30 {
31 case POINT_SHAPE_CIRCLE:
32 {
33 item = new GraphicsPoint (scene,
34 identifier,
35 posScreen,
36 ColorPaletteToQColor (pointStyle.paletteColor ()),
37 pointStyle.radius (),
38 pointStyle.lineWidth());
39 }
40 break;
41
42 default:
43 {
44 item = new GraphicsPoint (scene,
45 identifier,
46 posScreen,
47 ColorPaletteToQColor (pointStyle.paletteColor ()),
48 pointStyle.polygon (),
49 pointStyle.lineWidth());
50 }
51 break;
52 }
53
54 return item;
55}
GraphicsPointFactory()
Single constructor.
GraphicsPoint * createPoint(QGraphicsScene &scene, const QString &identifier, const QPointF &posScreen, const PointStyle &pointStyle)
Create circle or polygon point according to the PointStyle.
Graphics item for drawing a circular or polygonal Point.
Definition: GraphicsPoint.h:40
Details for a specific Point.
Definition: PointStyle.h:21
int radius() const
Radius of point. For a circle this is all that is needed to draw a circle. For a polygon,...
Definition: PointStyle.cpp:253
QPolygonF polygon() const
Return the polygon for creating a QGraphicsPolygonItem. The size is determined by the radius.
Definition: PointStyle.cpp:155
PointShape shape() const
Get method for point shape.
Definition: PointStyle.cpp:292
ColorPalette paletteColor() const
Get method for point color.
Definition: PointStyle.cpp:150
int lineWidth() const
Get method for line width.
Definition: PointStyle.cpp:119