-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPolygonElements.cpp
More file actions
140 lines (116 loc) · 2.53 KB
/
PolygonElements.cpp
File metadata and controls
140 lines (116 loc) · 2.53 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#include "stdafx.h"
#include "PolygonElements.h"
PolygonPoint::PolygonPoint()
{
cord = CPoint(-1, -1);
kind = UNKNOWN;
CliCycle = CliEdge = OriCycle = OriEdge = LaterCliEdge = LaterOriEdge = -1;
CrossPointID = -1;
OriInserted = CliInserted = FALSE;
}
PolygonPoint::PolygonPoint(CPoint Coordinate, PointKind PointKind)
{
cord = Coordinate;
kind = PointKind;
CliCycle = CliEdge = OriCycle = OriEdge = LaterCliEdge = LaterOriEdge = -1;
CrossPointID = -1;
OriInserted = CliInserted = FALSE;
}
PolygonPoint::PolygonPoint(int x, int y, PointKind PointKind)
{
cord = CPoint(x, y);
kind = PointKind;
CliCycle = CliEdge = OriCycle = OriEdge = LaterCliEdge = LaterOriEdge = -1;
CrossPointID = -1;
OriInserted = CliInserted = FALSE;
}
PolygonCycle::PolygonCycle()
{
Reversed = FALSE;
LineColor = RGB(0, 0, 0);
}
int PolygonCycle::GetCount()
{
return points.GetCount();
}
PolygonPoint* PolygonCycle::GetPoint(int index)
{
return points.GetAt(points.FindIndex(index));
}
PolygonPoint* PolygonCycle::GetTail()
{
return points.GetTail();
}
PolygonPoint* PolygonCycle::GetHead()
{
return points.GetHead();
}
void PolygonCycle::InsertAfter(int index, PolygonPoint* p)
{
points.InsertAfter(points.FindIndex(index), p);
}
void PolygonCycle::InsertToTail(PolygonPoint* p)
{
points.AddTail(p);
}
void PolygonCycle::SetPoint(int index, PolygonPoint* p)
{
points.SetAt(points.FindIndex(index), p);
}
void PolygonCycle::Remove(int index)
{
points.RemoveAt(points.FindIndex(index));
}
ComplexPolygon::ComplexPolygon()
{
Filled = FALSE;
FilledColor = RGB(0, 0, 0);
visible = TRUE;
}
int ComplexPolygon::GetCount()
{
return cycles.GetCount();
}
PolygonCycle* ComplexPolygon::GetCycle(int index)
{
return cycles.GetAt(cycles.FindIndex(index));
}
PolygonCycle* ComplexPolygon::GetTail()
{
return cycles.GetTail();
}
void ComplexPolygon::InsertAfter(int index, PolygonCycle* c)
{
cycles.InsertAfter(cycles.FindIndex(index), c);
}
void ComplexPolygon::InsertToTail(PolygonCycle* c)
{
cycles.AddTail(c);
}
void ComplexPolygon::SetCycle(int index, PolygonCycle* c)
{
cycles.SetAt(cycles.FindIndex(index), c);
}
void ComplexPolygon::Remove(int index)
{
cycles.RemoveAt(cycles.FindIndex(index));
}
void ComplexPolygon::CreateMatrix(int Width, int Height)
{
Matrix = new byte*[Width];
for(int i = 0; i < Width; i++)
{
Matrix[i] = new byte[Height];
memset(Matrix[i], 0, Height * sizeof(byte));
}
}
byte** ComplexPolygon::GetMatrix()
{
return Matrix;
}
void ComplexPolygon::DeleteMatrix()
{
for(int i = 0; i < width; i++)
delete[] Matrix[i];
delete[] Matrix;
}