OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
Path2D.h
Go to the documentation of this file.
1
5// ###########################################################################################################################################################################################################################################################################################################################
6
7#pragma once
8
9// OpenTwin header
10#include "OTCore/Point2D.h"
11#include "OTCore/Serializable.h"
13
14// std header
15#include <list>
16
17#pragma warning(disable:4251)
18
19namespace ot {
20
24 public:
28 BerzierType
29 };
30
39
41 Path2D();
42
45 Path2D(const Point2D& _startPos);
46
48 Path2D(const Path2D& _other);
49
51 virtual ~Path2D();
52
54 Path2D& operator = (const Path2D& _other);
55
59 virtual void addToJsonObject(ot::JsonValue& _object, ot::JsonAllocator& _allocator) const override;
60
64 virtual void setFromJsonObject(const ot::ConstJsonObject& _object) override;
65
67 bool isClosed(void);
68
72 void moveTo(const Point2D& _pos) { m_pos = _pos; };
73
76 void moveBy(const Point2D& _d) { m_pos += _d; };
77
81 void lineTo(const Point2D& _dest);
82
88 void berzierTo(const Point2D& _ct1, const Point2D& _ct2, const Point2D& _dest);
89
92 void clear(void);
93
95 const std::list<PathEntry>& getEntries(void) const { return m_entries; };
96
97 private:
98 Point2D m_pos;
99 std::list<PathEntry> m_entries;
100
102 static std::string toString(PathEntryType _type);
103
105 static PathEntryType toPathEntryType(const std::string& _type);
106 };
107
108 // ###########################################################################################################################################################################################################################################################################################################################
109
110 // ###########################################################################################################################################################################################################################################################################################################################
111
112 // ###########################################################################################################################################################################################################################################################################################################################
113
117 public:
121 BerzierType
122 };
123
132
134 Path2DF();
135
138 Path2DF(const Point2DD& _startPos);
139
141 Path2DF(const Path2DF& _other);
142
144 virtual ~Path2DF();
145
147 Path2DF& operator = (const Path2DF& _other);
148
152 virtual void addToJsonObject(ot::JsonValue& _object, ot::JsonAllocator& _allocator) const override;
153
157 virtual void setFromJsonObject(const ot::ConstJsonObject& _object) override;
158
160 bool isClosed(void);
161
165 void moveTo(const Point2DD& _pos) { m_pos = _pos; };
166
169 void moveBy(const Point2DD& _d) { m_pos += _d; };
170
174 void lineTo(const Point2DD& _dest);
175
181 void berzierTo(const Point2DD& _ct1, const Point2DD& _ct2, const Point2DD& _dest);
182
185 void clear(void);
186
188 const std::list<PathEntry>& getEntries(void) const { return m_entries; };
189
190 private:
191 Point2DD m_pos;
192 std::list<PathEntry> m_entries;
193
195 static std::string toString(PathEntryType _type);
196
198 static PathEntryType toPathEntryType(const std::string& _type);
199 };
200
201}
#define OT_GUI_API_EXPORT
Definition OTGuiAPIExport.h:9
The Path2DF class describes a path consisting of different types of lines.
Definition Path2D.h:116
PathEntryType
The type of a path entry.
Definition Path2D.h:119
@ LineType
Definition Path2D.h:120
const std::list< PathEntry > & getEntries(void) const
Returns the current entries.
Definition Path2D.h:188
void moveBy(const Point2DD &_d)
Moves the current position by the delta.
Definition Path2D.h:169
void moveTo(const Point2DD &_pos)
Moves the current position. No line will be added.
Definition Path2D.h:165
The Path2D class describes a path consisting of different types of lines.
Definition Path2D.h:23
PathEntryType
The type of a path entry.
Definition Path2D.h:26
@ LineType
Definition Path2D.h:27
void moveBy(const Point2D &_d)
Moves the current position by the delta.
Definition Path2D.h:76
void moveTo(const Point2D &_pos)
Moves the current position. No line will be added.
Definition Path2D.h:72
const std::list< PathEntry > & getEntries(void) const
Returns the current entries.
Definition Path2D.h:95
2D Point with double values
Definition Point2D.h:144
2D Point with integer values
Definition Point2D.h:20
The Serializable class is the default interface of serializable objects.
Definition Serializable.h:17
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
OT_GUI_API_EXPORT std::string toString(ColorStyleName _colorStyleName)
Definition ColorStyleTypes.cpp:10
rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > JsonAllocator
Allocator used for writing to JSON values.
Definition JSON.h:30
A path entry contains the.
Definition Path2D.h:32
Point2D stop
Start position.
Definition Path2D.h:35
Point2D control1
!
Definition Path2D.h:36
Point2D control2
Control point 1.
Definition Path2D.h:37
Point2D start
Entry type.
Definition Path2D.h:34
PathEntryType type
Definition Path2D.h:33
A path entry contains the.
Definition Path2D.h:125
PathEntryType type
Definition Path2D.h:126
Point2DD stop
Start position.
Definition Path2D.h:128
Point2DD control2
Control point 1.
Definition Path2D.h:130
Point2DD control1
!
Definition Path2D.h:129
Point2DD start
Entry type.
Definition Path2D.h:127