OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
GraphicsShapeItemCfg.h
Go to the documentation of this file.
1
5// ###########################################################################################################################################################################################################################################################################################################################
6
7#pragma once
8
9// OpenTwin header
10#include "OTGui/Path2D.h"
11#include "OTGui/Outline.h"
14
15#define OT_FactoryKey_GraphicsShapeItem "OT_GIShape"
16
17namespace ot {
18
19 class Painter2D;
20
23 public:
25 virtual ~GraphicsShapeItemCfg();
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_GraphicsShapeItem); };
46
47 // ###########################################################################################################################################################################################################################################################################################################################
48
49 // Setter / Getter
50
53 void setOutlinePath(const Path2DF& _path) { m_path = _path; };
54
56 Path2DF& getOutlinePath(void) { return m_path; };
57
59 const Path2DF& getOutlinePath(void) const { return m_path; };
60
64 void setBackgroundPainter(Painter2D* _painter);
65
67 const Painter2D* getBackgroundPainter(void) const { return m_backgroundPainter; };
68
71 Painter2D* takeBackgroundPainter(void);
72
75 void setOutline(const OutlineF& _outline) { m_outline = _outline; };
76
78 const OutlineF& getOutline(void) const { return m_outline; };
79
82 void setOutlinePainter(Painter2D* _painter) { m_outline.setPainter(_painter); };
83
85 const Painter2D* getOutlinePainter(void) const { return m_outline.painter(); };
86
89 void setOutlineWidth(double _w) { m_outline.setWidth(_w); };
90
92 double getOutlineWidth(void) const { return m_outline.width(); };
93
96 void setFillShape(bool _fill) { m_fillShape = _fill; };
97
99 bool getFillShape(void) const { return m_fillShape; };
100
101 private:
102 Path2DF m_path;
103 Painter2D* m_backgroundPainter;
104 OutlineF m_outline;
105 bool m_fillShape;
106 };
107
108}
#define OT_FactoryKey_GraphicsShapeItem
Definition GraphicsShapeItemCfg.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
The GraphicsItemCfg is the base class for all graphics item configurations.
Definition GraphicsItemCfg.h:33
Definition GraphicsShapeItemCfg.h:21
const Painter2D * getBackgroundPainter(void) const
Background painter.
Definition GraphicsShapeItemCfg.h:67
bool getFillShape(void) const
If fill shape is enabled the shape will be filled, otherwise only the outline will be drawn.
Definition GraphicsShapeItemCfg.h:99
void setFillShape(bool _fill)
Sets the fill shape.
Definition GraphicsShapeItemCfg.h:96
double getOutlineWidth(void) const
Outline width.
Definition GraphicsShapeItemCfg.h:92
Path2DF & getOutlinePath(void)
Outline path reference.
Definition GraphicsShapeItemCfg.h:56
void setOutline(const OutlineF &_outline)
Set the outline.
Definition GraphicsShapeItemCfg.h:75
void setOutlineWidth(double _w)
Set the outline width.
Definition GraphicsShapeItemCfg.h:89
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 GraphicsShapeItemCfg.h:45
const Path2DF & getOutlinePath(void) const
Outline path const reference.
Definition GraphicsShapeItemCfg.h:59
void setOutlinePainter(Painter2D *_painter)
Set the outline painter. The item takes ownership of the painter.
Definition GraphicsShapeItemCfg.h:82
const Painter2D * getOutlinePainter(void) const
Outline painter.
Definition GraphicsShapeItemCfg.h:85
const OutlineF & getOutline(void) const
Outlin.
Definition GraphicsShapeItemCfg.h:78
void setOutlinePath(const Path2DF &_path)
Set the outline path.
Definition GraphicsShapeItemCfg.h:53
The OutlineF class is used to describe how a outline should look like.
Definition Outline.h:161
Definition Painter2D.h:17
The Path2DF class describes a path consisting of different types of lines.
Definition Path2D.h:116
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