-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSegmentedPath.h
55 lines (41 loc) · 1.63 KB
/
SegmentedPath.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#pragma once
#include "Path.h"
namespace dawn
{
class BezierCurveToSegment : public Object
{
public:
BezierCurveToSegment(vec2farray points) : m_points(points) { }
vec2farray points() const { return m_points; }
void points(vec2farray points) { setChanged(); m_points = points; }
private:
vec2farray m_points;
};
typedef std::vector<BezierCurveToSegment *> SegmentList;
class SegmentedPath : public Path
{
public:
SegmentedPath(vec2f start, SegmentList segments, bool finish) : m_start(start), m_segments(segments), m_finish(finish) { }
virtual ~SegmentedPath() { }
virtual CONSTANTS::PathType type() const { return CONSTANTS::PathType::SegmentedPath; }
vec2f start() const { return m_start; }
void start(vec2f start) { setChanged(m_start != start); m_start = start; }
SegmentList segments() const { return m_segments; }
void segments(SegmentList segments) { setChanged(); m_segments = segments; }
bool finish() const { return m_finish; }
void finish(bool finish) { setChanged(m_finish != finish); m_finish = finish; }
virtual bool isChanged(etag_t *etag, bool recursive) {
bool changed = Path::isChanged(etag, recursive);
if (recursive) {
for (SegmentList::const_iterator itr = m_segments.begin(); itr != m_segments.end(); itr++) {
changed |= (*itr)->isChanged(etag, recursive);
}
}
return changed;
}
private:
vec2f m_start;
SegmentList m_segments;
bool m_finish;
};
}