diff -r 9ed07a96349d -r 265e5997580e QTfrontend/drawmapscene.cpp --- a/QTfrontend/drawmapscene.cpp Fri Sep 27 21:52:21 2013 -0400 +++ b/QTfrontend/drawmapscene.cpp Mon Sep 30 00:20:58 2013 +0400 @@ -156,7 +156,7 @@ if(m_isCursorShown) return; - if(items().size()) + if(paths.size()) { removeItem(items().first()); paths.removeFirst(); @@ -183,10 +183,11 @@ if(!items().size()) return; + m_specialPoints.clear(); oldItems.clear(); // do this since clear() would _destroy_ all items - while(items().size()) + for(int i = paths.size() - 1; i >= 0; --i) { oldItems.push_front(items().first()); removeItem(items().first()); @@ -211,7 +212,7 @@ QByteArray DrawMapScene::encode() { - QByteArray b; + QByteArray b(m_specialPoints); for(int i = paths.size() - 1; i >= 0; --i) { @@ -247,9 +248,12 @@ oldPaths.clear(); clear(); paths.clear(); + m_specialPoints.clear(); PathParams params; + bool isSpecial = true; + while(data.size() >= 5) { qint16 px = qFromBigEndian(*(qint16 *)data.data()); @@ -258,9 +262,11 @@ data.remove(0, 2); quint8 flags = *(quint8 *)data.data(); data.remove(0, 1); - + qDebug() << px << py; if(flags & 0x80) { + isSpecial = false; + if(params.points.size()) { addPath(pointsToPath(params.points), m_pen); @@ -278,9 +284,23 @@ else m_pen.setBrush(m_brush); params.width = penWidth; - } + } else + if(isSpecial) + { + QPainterPath path; + path.addEllipse(QPointF(px, py), 10, 10); + + addPath(path); - params.points.append(QPoint(px, py)); + qint16 x = qToBigEndian(px); + qint16 y = qToBigEndian(py); + m_specialPoints.append((const char *)&x, 2); + m_specialPoints.append((const char *)&y, 2); + m_specialPoints.append((const char *)&flags, 1); + } + + if(!isSpecial) + params.points.append(QPoint(px, py)); } if(params.points.size())