Engauge Digitizer 2
Loading...
Searching...
No Matches
GraphicsPointFactory.cpp
Go to the documentation of this file.
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"
13#include "PointStyle.h"
14#include <QColor>
15#include <QGraphicsScene>
16#include <QPointF>
17#include <QPolygonF>
18
22
24 const QString &identifier,
25 const QPointF &posScreen,
26 const PointStyle &pointStyle,
28{
29 GraphicsPoint *item = nullptr;
30
31 switch (pointStyle.shape ())
32 {
34 {
35 item = new GraphicsPoint (scene,
36 identifier,
37 posScreen,
38 ColorPaletteToQColor (pointStyle.paletteColor ()),
39 unsigned (pointStyle.radius ()),
40 pointStyle.lineWidth(),
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(),
54 }
55 break;
56 }
57
58 return item;
59}
const int INNER_RADIUS_MIN
QColor ColorPaletteToQColor(ColorPalette color)
Definition EnumsToQt.cpp:15
@ POINT_SHAPE_CIRCLE
Definition PointShape.h:13
Window that displays the geometry information, as a table, for the current curve.
GraphicsPointFactory()
Single constructor.
GraphicsPoint * createPoint(QGraphicsScene &scene, const QString &identifier, const QPointF &posScreen, const PointStyle &pointStyle, GeometryWindow *geometryWindow)
Create circle or polygon point according to the PointStyle.
Graphics item for drawing a circular or polygonal Point.
Details for a specific Point.
Definition PointStyle.h:21
unsigned int radius() const
Radius of point. For a circle this is all that is needed to draw a circle. For a polygon,...
QPolygonF polygon() const
Return the polygon for creating a QGraphicsPolygonItem. The size is determined by the radius.
PointShape shape() const
Get method for point shape.
ColorPalette paletteColor() const
Get method for point color.
int lineWidth() const
Get method for line width.