OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
GraphicsTriangleItemCfg.h
Go to the documentation of this file.
1
5// ###########################################################################################################################################################################################################################################################################################################################
6
7#pragma once
8
9// OpenTwin header
10#include "OTGui/Outline.h"
13
14#define OT_FactoryKey_GraphicsTriangleItem "OT_GITria"
15
16namespace ot {
17
18 class Painter2D;
19
22 public:
29
33 IceCone
34 };
35
36 static std::string triangleDirectionToString(TriangleDirection _direction);
37 static TriangleDirection stringToTriangleDirection(const std::string& _str);
38
39 static std::string triangleShapeToString(TriangleShape _shape);
40 static TriangleShape stringToTriangleShape(const std::string& _shape);
41
42 GraphicsTriangleItemCfg(TriangleDirection _direction = Right, TriangleShape _shape = Triangle);
44
46 virtual GraphicsItemCfg* createCopy(void) const override;
47
51 virtual void addToJsonObject(JsonValue& _object, JsonAllocator& _allocator) const override;
52
56 virtual void setFromJsonObject(const ConstJsonObject& _object) override;
57
59 virtual std::string getFactoryKey(void) const override { return std::string(OT_FactoryKey_GraphicsTriangleItem); };
60
61 void setOutline(const ot::OutlineF& _outline) { m_outline = _outline; };
62 const OutlineF& getOutline(void) const { return m_outline; };
63
64 void setBackgroundPainer(ot::Painter2D* _painter);
65 const ot::Painter2D* getBackgroundPainter(void) const { return m_backgroundPainter; };
66
67 void setSize(const ot::Size2DD& _size) { m_size = _size; };
68 const ot::Size2DD& getSize(void) const { return m_size; };
69
70 void setTriangleShape(TriangleShape _shape) { m_shape = _shape; };
71 TriangleShape getTriangleShape(void) const { return m_shape; };
72
73 void setTriangleDirection(TriangleDirection _direction) { m_direction = _direction; };
74 TriangleDirection getTriangleDirection(void) const { return m_direction; };
75
76 private:
77 ot::OutlineF m_outline;
78 ot::Size2DD m_size;
79 ot::Painter2D* m_backgroundPainter;
80 TriangleDirection m_direction;
81 TriangleShape m_shape;
82 };
83
84}
#define OT_FactoryKey_GraphicsTriangleItem
Definition GraphicsTriangleItemCfg.h:14
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 GraphicsTriangleItemCfg.h:20
void setSize(const ot::Size2DD &_size)
Definition GraphicsTriangleItemCfg.h:67
void setTriangleShape(TriangleShape _shape)
Definition GraphicsTriangleItemCfg.h:70
TriangleShape getTriangleShape(void) const
Definition GraphicsTriangleItemCfg.h:71
const ot::Painter2D * getBackgroundPainter(void) const
Definition GraphicsTriangleItemCfg.h:65
void setOutline(const ot::OutlineF &_outline)
Definition GraphicsTriangleItemCfg.h:61
void setTriangleDirection(TriangleDirection _direction)
Definition GraphicsTriangleItemCfg.h:73
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 GraphicsTriangleItemCfg.h:59
TriangleDirection getTriangleDirection(void) const
Definition GraphicsTriangleItemCfg.h:74
const ot::Size2DD & getSize(void) const
Definition GraphicsTriangleItemCfg.h:68
TriangleShape
Definition GraphicsTriangleItemCfg.h:30
@ Kite
Definition GraphicsTriangleItemCfg.h:32
@ Triangle
Definition GraphicsTriangleItemCfg.h:31
const OutlineF & getOutline(void) const
Definition GraphicsTriangleItemCfg.h:62
TriangleDirection
Definition GraphicsTriangleItemCfg.h:23
@ Up
Definition GraphicsTriangleItemCfg.h:25
@ Right
Definition GraphicsTriangleItemCfg.h:26
@ Left
Definition GraphicsTriangleItemCfg.h:24
The OutlineF class is used to describe how a outline should look like.
Definition Outline.h:161
Definition Painter2D.h:17
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