2
#include "Command/DocumentCommands.h"
3
#include "Map/MapDocument.h"
4
#include "Map/TrackPoint.h"
5
#include "Map/TrackSegment.h"
7
#include <QtCore/QFile>
8
#include <QtCore/QStringList>
9
#include <QtCore/QTextStream>
13
bool importNGT(QWidget* /* aParent */, const QString& aFilename, MapDocument* theDocument, MapLayer* theLayer)
16
if (f.open(QIODevice::ReadOnly))
19
CommandList* theList = new CommandList(MainWindow::tr("Import NGT"), NULL);
20
TrackSegment* theSegment = new TrackSegment;
23
QString Line(f.readLine());
24
QStringList Items(Line.split('|'));
25
if (Items.count() >= 5)
27
TrackPoint* Pt = new TrackPoint(Coord(int(Items[4].toDouble()*INT_MAX), int(Items[3].toDouble()*INT_MAX)));
28
Pt->setLastUpdated(MapFeature::Log);
29
theList->add(new AddFeatureCommand(theLayer,Pt, true));
40
theList->add(new AddFeatureCommand(theLayer,theSegment,true));
41
theDocument->addHistory(theList);