OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
GraphicsLineItemCfg.h
Go to the documentation of this file.
1
5// ###########################################################################################################################################################################################################################################################################################################################
6
7#pragma once
8
9// OpenTwin header
10#include "OTCore/Point2D.h"
12#include "OTGui/Outline.h"
14
15#define OT_FactoryKey_GraphicsLineItem "OT_GILine"
16
17namespace ot {
18
19 class Painter2D;
20
23 public:
25 virtual ~GraphicsLineItemCfg();
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_GraphicsLineItem); };
46
47 // ###########################################################################################################################################################################################################################################################################################################################
48
49 // Setter / Getter
50
53 void setFrom(double _x, double _y) { this->setFrom(Point2DD(_x, _y)); };
54
57 void setFrom(const Point2DD& _pt) { m_from = _pt; };
58
60 const Point2DD& getFrom(void) const { return m_from; };
61
64 void setTo(double _x, double _y) { this->setTo(Point2DD(_x, _y)); };
65
68 void setTo(const Point2DD& _pt) { m_to = _pt; };
69
71 const Point2DD& getTo(void) const { return m_to; };
72
75 void setWidth(double _width) { m_lineStyle.setWidth(_width); };
76 double getWidth(void) const { return m_lineStyle.width(); };
77
81 void setPainter(Painter2D* _painter) { m_lineStyle.setPainter(_painter); };
82
84 const Painter2D* getPainter(void) const { return m_lineStyle.painter(); };
85
86 void setLineStyle(const OutlineF& _style) { m_lineStyle = _style; };
87 const OutlineF& getLineStyle(void) const { return m_lineStyle; };
88
89 private:
90 Point2DD m_from;
91 Point2DD m_to;
92 OutlineF m_lineStyle;
93 };
94
95}
#define OT_FactoryKey_GraphicsLineItem
Definition GraphicsLineItemCfg.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 GraphicsLineItemCfg.h:21
const OutlineF & getLineStyle(void) const
Definition GraphicsLineItemCfg.h:87
void setFrom(double _x, double _y)
Set the line origin relative to the item's position. The coordinates must be greater or equal 0.
Definition GraphicsLineItemCfg.h:53
const Point2DD & getTo(void) const
Line destination relative to the item's position.
Definition GraphicsLineItemCfg.h:71
double getWidth(void) const
Definition GraphicsLineItemCfg.h:76
void setPainter(Painter2D *_painter)
Set the background painter. The item takes ownership of the painter.
Definition GraphicsLineItemCfg.h:81
const Point2DD & getFrom(void) const
Line origin relative to the item's position.
Definition GraphicsLineItemCfg.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 GraphicsLineItemCfg.h:45
void setTo(const Point2DD &_pt)
Set the line destination relative to the item's position. The coordinates must be greater or equal 0.
Definition GraphicsLineItemCfg.h:68
void setLineStyle(const OutlineF &_style)
Definition GraphicsLineItemCfg.h:86
void setTo(double _x, double _y)
Set the line destination relative to the item's position. The coordinates must be greater or equal 0.
Definition GraphicsLineItemCfg.h:64
void setFrom(const Point2DD &_pt)
Set the line origin relative to the item's position. The coordinates must be greater or equal 0.
Definition GraphicsLineItemCfg.h:57
void setWidth(double _width)
Set the line width. The value must be greater or equal to 0.
Definition GraphicsLineItemCfg.h:75
const Painter2D * getPainter(void) const
Background painter.
Definition GraphicsLineItemCfg.h:84
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
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