QTfrontend/drawmapscene.cpp
changeset 4560 5d6c7f88db73
parent 4520 e7882bd1a894
child 4657 3cd5bd943b94
--- a/QTfrontend/drawmapscene.cpp	Sat Dec 18 21:19:26 2010 +0300
+++ b/QTfrontend/drawmapscene.cpp	Sat Dec 18 23:02:39 2010 +0300
@@ -57,6 +57,8 @@
 
 void DrawMapScene::mouseReleaseEvent(QGraphicsSceneMouseEvent * mouseEvent)
 {
+    Q_UNUSED(mouseEvent);
+
     simplifyLast();
 
     m_currPath = 0;
@@ -73,6 +75,14 @@
     }
 }
 
+void DrawMapScene::clearMap()
+{
+    clear();
+    paths.clear();
+
+    emit pathChanged();
+}
+
 QByteArray DrawMapScene::encode()
 {
     QByteArray b;
@@ -128,11 +138,15 @@
 
         points.append(QPoint(px, py));
     }
+
+    emit pathChanged();
 }
 
 void DrawMapScene::simplifyLast()
 {
-    QList<QPoint> points = paths[0];
+    if(!paths.size()) return;
+
+    QList<QPoint> points = paths.at(0);
 
     QPoint prevPoint = points.first();
     int i = 1;