File indexing completed on 2024-07-14 07:23:10

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2012 Cezar Mocan <mocancezar@gmail.com>
0004 
0005 #ifndef MARBLEPN2RUNNER_H
0006 #define MARBLEPN2RUNNER_H
0007 
0008 #include "ParsingRunner.h"
0009 
0010 #include <QDataStream>
0011 
0012 
0013 namespace Marble
0014 {
0015 
0016 class GeoDataLineString;
0017 
0018 class Pn2Runner : public ParsingRunner
0019 {
0020     Q_OBJECT
0021 public:
0022     explicit Pn2Runner(QObject *parent = nullptr);
0023     ~Pn2Runner() override;
0024     GeoDataDocument* parseFile( const QString &fileName, DocumentRole role, QString& error ) override;
0025 
0026 private:
0027     static bool errorCheckLat( qint16 lat );
0028     static bool errorCheckLon( qint16 lon );
0029     static bool importPolygon( QDataStream &stream, GeoDataLineString* linestring, quint32 nrAbsoluteNodes );
0030 
0031     GeoDataDocument* parseForVersion1( const QString &fileName, DocumentRole role );
0032     GeoDataDocument* parseForVersion2( const QString &fileName, DocumentRole role );
0033 
0034     QDataStream m_stream;
0035     quint8 m_fileHeaderVersion;
0036     quint32 m_fileHeaderPolygons;
0037     bool m_isMapColorField;       // Whether the file contains color indexes
0038 };
0039 
0040 }
0041 #endif // MARBLEPN2RUNNER_H