OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
GraphicsArcItemCfg.h
Go to the documentation of this file.
1
5// ###########################################################################################################################################################################################################################################################################################################################
6
7#pragma once
8
9// OpenTwin header
10#include "OTCore/Rect.h"
12#include "OTGui/Outline.h"
14
15#define OT_FactoryKey_GraphicsArcItem "OT_GIArc"
16
17namespace ot {
18
19 class Painter2D;
20
23 public:
25 virtual ~GraphicsArcItemCfg();
26
27 // ###########################################################################################################################################################################################################################################################################################################################
28
29 // Base class functions
30
32 virtual GraphicsItemCfg* createCopy(void) const override;
33
37 virtual void addToJsonObject(JsonValue& _object, JsonAllocator& _allocator) const override;
38
42 virtual void setFromJsonObject(const ConstJsonObject& _object) override;
43
45 virtual std::string getFactoryKey(void) const override { return std::string(OT_FactoryKey_GraphicsArcItem); };
46
47 // ###########################################################################################################################################################################################################################################################################################################################
48
49 // Setter / Getter
50
51 void setRect(const Point2DD& _topLeft, const Point2DD& _bottomRight) { this->setRect(RectD(_topLeft, _bottomRight)); };
52 void setRect(const Point2DD& _topLeft, const Size2DD& _size) { this->setRect(RectD(_topLeft, _size)); };
53 void setRect(const RectD& _rect) { m_rect = _rect; };
54 const RectD& getRect(void) const { return m_rect; };
55
56 void setStartAngle(double _startAngle) { m_startAngle = _startAngle; };
57 double getStartAngle(void) const { return m_startAngle; };
58
59 void setSpanAngle(double _spanAngle) { m_spanAngle = _spanAngle; };
60 double getSpanAngle(void) const { return m_spanAngle; };
61
62 void setLineWidth(double _width) { m_lineStyle.setWidth(_width); };
63 double getLineWidth(void) const { return m_lineStyle.width(); };
64
68 void setPainter(Painter2D* _painter) { m_lineStyle.setPainter(_painter); };
69
71 const Painter2D* getPainter(void) const { return m_lineStyle.painter(); };
72
73 void setLineStyle(const OutlineF& _style) { m_lineStyle = _style; };
74 const OutlineF& getLineStyle(void) const { return m_lineStyle; };
75
76 private:
77 RectD m_rect;
78 double m_startAngle;
79 double m_spanAngle;
80 OutlineF m_lineStyle;
81 };
82
83}
#define OT_FactoryKey_GraphicsArcItem
Definition GraphicsArcItemCfg.h:15
This file contains defines that may be used simplyfy class creation.
#define OT_DECL_NOCOPY(___class)
Removes the default copy constructor and assignment operator.
Definition OTClassHelper.h:14
#define OT_GUI_API_EXPORT
Definition OTGuiAPIExport.h:9
Definition GraphicsArcItemCfg.h:21
void setLineWidth(double _width)
Definition GraphicsArcItemCfg.h:62
double getLineWidth(void) const
Definition GraphicsArcItemCfg.h:63
void setRect(const Point2DD &_topLeft, const Point2DD &_bottomRight)
Definition GraphicsArcItemCfg.h:51
void setRect(const RectD &_rect)
Definition GraphicsArcItemCfg.h:53
double getSpanAngle(void) const
Definition GraphicsArcItemCfg.h:60
virtual std::string getFactoryKey(void) const override
Returns the key that is used to create an instance of this class in the simple factory.
Definition GraphicsArcItemCfg.h:45
const Painter2D * getPainter(void) const
Background painter.
Definition GraphicsArcItemCfg.h:71
const OutlineF & getLineStyle(void) const
Definition GraphicsArcItemCfg.h:74
void setLineStyle(const OutlineF &_style)
Definition GraphicsArcItemCfg.h:73
void setPainter(Painter2D *_painter)
Set the background painter. The item takes ownership of the painter.
Definition GraphicsArcItemCfg.h:68
void setSpanAngle(double _spanAngle)
Definition GraphicsArcItemCfg.h:59
double getStartAngle(void) const
Definition GraphicsArcItemCfg.h:57
const RectD & getRect(void) const
Definition GraphicsArcItemCfg.h:54
void setRect(const Point2DD &_topLeft, const Size2DD &_size)
Definition GraphicsArcItemCfg.h:52
void setStartAngle(double _startAngle)
Definition GraphicsArcItemCfg.h:56
The GraphicsItemCfg is the base class for all graphics item configurations.
Definition GraphicsItemCfg.h:33
The OutlineF class is used to describe how a outline should look like.
Definition Outline.h:161
Definition Painter2D.h:17
2D Point with double values
Definition Point2D.h:144
Rectangle that holds the top left and bottom right corner in double values.
Definition Rect.h:234
2D Size with double values
Definition Size2D.h:115
Definition Connector.h:8
rapidjson::Value JsonValue
Writable JSON value.
Definition JSON.h:27
rapidjson::GenericObject< true, rapidjson::GenericValue< rapidjson::UTF8<>, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > > > ConstJsonObject
Read only JSON Object.
Definition JSON.h:35
rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > JsonAllocator
Allocator used for writing to JSON values.
Definition JSON.h:30