File indexing completed on 2025-01-05 03:59:30

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