equal
deleted
inserted
replaced
55 emit pathChanged(); |
55 emit pathChanged(); |
56 } |
56 } |
57 |
57 |
58 void DrawMapScene::mouseReleaseEvent(QGraphicsSceneMouseEvent * mouseEvent) |
58 void DrawMapScene::mouseReleaseEvent(QGraphicsSceneMouseEvent * mouseEvent) |
59 { |
59 { |
|
60 Q_UNUSED(mouseEvent); |
|
61 |
60 simplifyLast(); |
62 simplifyLast(); |
61 |
63 |
62 m_currPath = 0; |
64 m_currPath = 0; |
63 } |
65 } |
64 |
66 |
69 removeItem(items().first()); |
71 removeItem(items().first()); |
70 paths.removeFirst(); |
72 paths.removeFirst(); |
71 |
73 |
72 emit pathChanged(); |
74 emit pathChanged(); |
73 } |
75 } |
|
76 } |
|
77 |
|
78 void DrawMapScene::clearMap() |
|
79 { |
|
80 clear(); |
|
81 paths.clear(); |
|
82 |
|
83 emit pathChanged(); |
74 } |
84 } |
75 |
85 |
76 QByteArray DrawMapScene::encode() |
86 QByteArray DrawMapScene::encode() |
77 { |
87 { |
78 QByteArray b; |
88 QByteArray b; |
126 } |
136 } |
127 } |
137 } |
128 |
138 |
129 points.append(QPoint(px, py)); |
139 points.append(QPoint(px, py)); |
130 } |
140 } |
|
141 |
|
142 emit pathChanged(); |
131 } |
143 } |
132 |
144 |
133 void DrawMapScene::simplifyLast() |
145 void DrawMapScene::simplifyLast() |
134 { |
146 { |
135 QList<QPoint> points = paths[0]; |
147 if(!paths.size()) return; |
|
148 |
|
149 QList<QPoint> points = paths.at(0); |
136 |
150 |
137 QPoint prevPoint = points.first(); |
151 QPoint prevPoint = points.first(); |
138 int i = 1; |
152 int i = 1; |
139 while(i < points.size()) |
153 while(i < points.size()) |
140 { |
154 { |