diff --git a/src/apps/marble-maps/TextToSpeechClient.h b/src/apps/marble-maps/TextToSpeechClient.h index 4acb0f573..1b6715bea 100644 --- a/src/apps/marble-maps/TextToSpeechClient.h +++ b/src/apps/marble-maps/TextToSpeechClient.h @@ -1,29 +1,29 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2015 Gábor Péterffy // #ifndef TEXTTOSPEECHCLIENT_H #define TEXTTOSPEECHCLIENT_H #include class TextToSpeechClient : public QObject { Q_OBJECT public: explicit TextToSpeechClient(QObject * parent = 0); - ~TextToSpeechClient(); + ~TextToSpeechClient() override; public Q_SLOTS: Q_INVOKABLE void readText(const QString & text); Q_INVOKABLE void setLocale(const QString & locale); }; #endif diff --git a/src/lib/marble/cloudsync/CloudRouteModel.h b/src/lib/marble/cloudsync/CloudRouteModel.h index 46ddcc304..41013c9dd 100644 --- a/src/lib/marble/cloudsync/CloudRouteModel.h +++ b/src/lib/marble/cloudsync/CloudRouteModel.h @@ -1,113 +1,113 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2013 Utku Aydın // #ifndef CLOUDROUTEMODEL_H #define CLOUDROUTEMODEL_H #include "marble_export.h" #include #include class QNetworkReply; namespace Marble { class RouteItem; class MARBLE_EXPORT CloudRouteModel : public QAbstractListModel { Q_OBJECT public: enum RouteRoles { Timestamp = Qt::UserRole + 1, Name, PreviewUrl, Distance, Duration, IsCached, IsDownloading, IsOnCloud }; explicit CloudRouteModel( QObject *parent = 0 ); - ~CloudRouteModel(); + ~CloudRouteModel() override; QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const override; int rowCount( const QModelIndex& parent = QModelIndex() ) const override; /** Overload of QAbstractListModel */ QHash roleNames() const override; /** * Sets the list of routes that will show up in CloudRoutesDialog. * @param items List of routes. */ void setItems( const QVector &items ); /** * Checks if specified route exists in the local cache. * @param index Index of the route. * @return true, if exists. */ bool isCached( const QModelIndex &index ) const; /** * Getter for the item currently being downloaded. * @return Model for the item currently being downloaded */ QPersistentModelIndex downloadingItem() const; /** * Marks the route at given index as being downloaded. * @param index Index of the route. */ void setDownloadingItem( const QPersistentModelIndex &index ); /** * Checks if route is being downloaded. * @param index Index of the route. * @return true, if downloading. */ bool isDownloading( const QModelIndex &index ) const; /** * Total size of the item currently being downloaded. * @return Total size of the item, -1 if no route is being downloaded */ qint64 totalSize() const; /** * Returns how much of the route are downloaded as bytes * @return Downloaded bytes */ qint64 downloadedSize() const; /** * Checks whether a preview for the route available and * returns or downloads the preview * @param index Index of the item whose preview is requested * @return Route's preview as QIcon */ QIcon preview( const QModelIndex &index ) const; public Q_SLOTS: void updateProgress( qint64 currentSize, qint64 totalSize ); void setPreview( QNetworkReply *reply ); private: class Private; Private *d; }; } #endif // CLOUDROUTEMODEL_H diff --git a/src/lib/marble/geodata/data/GeoDataRelation.h b/src/lib/marble/geodata/data/GeoDataRelation.h index dc7d150eb..2d05ec432 100644 --- a/src/lib/marble/geodata/data/GeoDataRelation.h +++ b/src/lib/marble/geodata/data/GeoDataRelation.h @@ -1,74 +1,74 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2017 Dennis Nienhüser #ifndef MARBLE_GEODATARELATION_H #define MARBLE_GEODATARELATION_H #include "GeoDataCoordinates.h" #include "GeoDataPlacemark.h" #include "geodata_export.h" namespace Marble { class GeoDataRelationPrivate; class GEODATA_EXPORT GeoDataRelation: public GeoDataFeature { public: enum RelationType { UnknownType, RouteRoad, RouteDetour, RouteFerry, RouteTrain, RouteSubway, RouteTram, RouteBus, RouteTrolleyBus, RouteBicycle, RouteMountainbike, RouteFoot, RouteHiking, RouteHorse, RouteInlineSkates, RouteSkiDownhill, RouteSkiNordic, RouteSkitour, RouteSled, }; GeoDataRelation(); - ~GeoDataRelation(); + ~GeoDataRelation() override; GeoDataRelation(const GeoDataRelation &other); GeoDataRelation & operator=(GeoDataRelation other); bool operator<(const GeoDataRelation &other) const; const char* nodeType() const override; GeoDataFeature * clone() const override; void addMember(const GeoDataFeature* feature, qint64 id, const QString &role); QSet members() const; OsmPlacemarkData &osmData(); const OsmPlacemarkData &osmData() const; RelationType relationType() const; QSet memberIds() const; bool containsAnyOf(const QSet &memberIds) const; private: GeoDataRelationPrivate* d_ptr; Q_DECLARE_PRIVATE(GeoDataRelation) }; } #endif diff --git a/src/plugins/positionprovider/gpsd/GpsdConnection.h b/src/plugins/positionprovider/gpsd/GpsdConnection.h index 216b312d3..96af7ef6f 100644 --- a/src/plugins/positionprovider/gpsd/GpsdConnection.h +++ b/src/plugins/positionprovider/gpsd/GpsdConnection.h @@ -1,57 +1,57 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2009 Eckhart Wörner // #ifndef GPSDCONNECTION_H #define GPSDCONNECTION_H #include "PositionProviderPlugin.h" #include #include #include namespace Marble { class GpsdConnection : public QObject { Q_OBJECT public: explicit GpsdConnection( QObject* parent = 0 ); - ~GpsdConnection(); + ~GpsdConnection() override; void initialize(); QString error() const; Q_SIGNALS: void gpsdInfo( gps_data_t data ); void statusChanged( PositionProviderStatus status ) const; private: void open(); gpsmm m_gpsd; QTimer m_timer; PositionProviderStatus m_status; QString m_error; const char* m_oldLocale; private Q_SLOTS: void update(); }; } #endif diff --git a/src/plugins/positionprovider/gpsd/GpsdPositionProviderPlugin.h b/src/plugins/positionprovider/gpsd/GpsdPositionProviderPlugin.h index d0d54b374..cb5cdd612 100644 --- a/src/plugins/positionprovider/gpsd/GpsdPositionProviderPlugin.h +++ b/src/plugins/positionprovider/gpsd/GpsdPositionProviderPlugin.h @@ -1,74 +1,74 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2009 Eckhart Wörner // #ifndef GPSDPOSITIONPROVIDERPLUGIN_H #define GPSDPOSITIONPROVIDERPLUGIN_H #include "PositionProviderPlugin.h" #include "GeoDataCoordinates.h" #include "GeoDataAccuracy.h" #include #include namespace Marble { class GpsdThread; class GpsdPositionProviderPlugin: public PositionProviderPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.kde.marble.GpsdPositionProviderPlugin") Q_INTERFACES( Marble::PositionProviderPluginInterface ) public: GpsdPositionProviderPlugin(); - virtual ~GpsdPositionProviderPlugin(); + ~GpsdPositionProviderPlugin() override; QString name() const override; QString nameId() const override; QString guiString() const override; QString version() const override; QString description() const override; QString copyrightYears() const override; QVector pluginAuthors() const override; QIcon icon() const override; void initialize() override; bool isInitialized() const override; PositionProviderPlugin * newInstance() const override; PositionProviderStatus status() const override; GeoDataCoordinates position() const override; GeoDataAccuracy accuracy() const override; QString error() const override; qreal speed() const override; qreal direction() const override; QDateTime timestamp() const override; private: GpsdThread* m_thread; PositionProviderStatus m_status; GeoDataCoordinates m_position; GeoDataAccuracy m_accuracy; qreal m_speed; qreal m_track; QDateTime m_timestamp; private Q_SLOTS: void update(gps_data_t data); }; } #endif diff --git a/src/plugins/positionprovider/gpsd/GpsdThread.h b/src/plugins/positionprovider/gpsd/GpsdThread.h index 7a749c56f..6ed7f7437 100644 --- a/src/plugins/positionprovider/gpsd/GpsdThread.h +++ b/src/plugins/positionprovider/gpsd/GpsdThread.h @@ -1,52 +1,52 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2009 Eckhart Wörner // #ifndef GPSDTHREAD_H #define GPSDTHREAD_H #include "PositionProviderPlugin.h" #include #include namespace Marble { class GpsdConnection; class GpsdThread: public QThread { Q_OBJECT public: GpsdThread(); - ~GpsdThread(); + ~GpsdThread() override; - virtual void run(); + void run() override; QString error() const; Q_SIGNALS: void statusChanged( PositionProviderStatus status ) const; private: GpsdConnection* m_connection; Q_SIGNALS: void gpsdInfo( gps_data_t data ); }; } #endif diff --git a/src/plugins/positionprovider/qtpositioning/QtPositioningPositionProviderPlugin.h b/src/plugins/positionprovider/qtpositioning/QtPositioningPositionProviderPlugin.h index 7f35cf893..8db0acf56 100644 --- a/src/plugins/positionprovider/qtpositioning/QtPositioningPositionProviderPlugin.h +++ b/src/plugins/positionprovider/qtpositioning/QtPositioningPositionProviderPlugin.h @@ -1,69 +1,69 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2011 Daniel Marth // Copyright 2012 Bernhard Beschow // #ifndef QT_POSITIONING_POSITION_PROVIDER_PLUGIN_H #define QT_POSITIONING_POSITION_PROVIDER_PLUGIN_H #include "PositionProviderPlugin.h" #include namespace Marble { class QtPositioningPositionProviderPluginPrivate; class QtPositioningPositionProviderPlugin: public PositionProviderPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.kde.marble.QtPositioningPositionProviderPlugin") Q_INTERFACES( Marble::PositionProviderPluginInterface ) public: QtPositioningPositionProviderPlugin(); - virtual ~QtPositioningPositionProviderPlugin(); + ~QtPositioningPositionProviderPlugin() override; // Implementing PluginInterface QString name() const override; QString nameId() const override; QString guiString() const override; QString version() const override; QString description() const override; QString copyrightYears() const override; QVector pluginAuthors() const override; QIcon icon() const override; void initialize() override; bool isInitialized() const override; qreal speed() const override; qreal direction() const override; QDateTime timestamp() const override; // Implementing PositionProviderPlugin PositionProviderPlugin * newInstance() const override; // Implementing PositionProviderPluginInterface PositionProviderStatus status() const override; GeoDataCoordinates position() const override; GeoDataAccuracy accuracy() const override; private Q_SLOTS: /** Regular (each second) position and status update */ void update(); void update(QGeoPositionInfo position); private: QtPositioningPositionProviderPluginPrivate* const d; }; } #endif // QT_POSITION_PROVIDER_PLUGIN_H diff --git a/src/plugins/positionprovider/wlocate/WlocatePositionProviderPlugin.h b/src/plugins/positionprovider/wlocate/WlocatePositionProviderPlugin.h index dea13d1a7..f9d459ccd 100644 --- a/src/plugins/positionprovider/wlocate/WlocatePositionProviderPlugin.h +++ b/src/plugins/positionprovider/wlocate/WlocatePositionProviderPlugin.h @@ -1,66 +1,66 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2012 Dennis Nienhüser // #ifndef WLOCATE_POSITION_PROVIDER_PLUGIN_H #define WLOCATE_POSITION_PROVIDER_PLUGIN_H #include "PositionProviderPlugin.h" namespace Marble { class WlocatePositionProviderPluginPrivate; class WlocatePositionProviderPlugin: public PositionProviderPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.kde.marble.WlocatePositionProviderPlugin") Q_INTERFACES( Marble::PositionProviderPluginInterface ) public: WlocatePositionProviderPlugin(); - virtual ~WlocatePositionProviderPlugin(); + ~WlocatePositionProviderPlugin() override; // Implementing PluginInterface - virtual QString name() const; - virtual QString nameId() const; - virtual QString guiString() const; - virtual QString version() const; - virtual QString description() const; - virtual QString copyrightYears() const; + QString name() const override; + QString nameId() const override; + QString guiString() const override; + QString version() const override; + QString description() const override; + QString copyrightYears() const override; QVector pluginAuthors() const override; - virtual QIcon icon() const; - virtual void initialize(); - virtual bool isInitialized() const; + QIcon icon() const override; + void initialize() override; + bool isInitialized() const override; // Implementing PositionProviderPlugin - virtual PositionProviderPlugin * newInstance() const; + PositionProviderPlugin * newInstance() const override; // Implementing PositionProviderPluginInterface - virtual PositionProviderStatus status() const; - virtual GeoDataCoordinates position() const; - virtual qreal speed() const; - virtual qreal direction() const; - virtual GeoDataAccuracy accuracy() const; - virtual QDateTime timestamp() const; + PositionProviderStatus status() const override; + GeoDataCoordinates position() const override; + qreal speed() const override; + qreal direction() const override; + GeoDataAccuracy accuracy() const override; + QDateTime timestamp() const override; private Q_SLOTS: void update(); void handleWlocateResult(); private: WlocatePositionProviderPluginPrivate* const d; }; } #endif // WLOCATE_POSITION_PROVIDER_PLUGIN_H diff --git a/src/plugins/runner/shp/ShpRunner.h b/src/plugins/runner/shp/ShpRunner.h index ce8ecb99d..61ffa4ff4 100644 --- a/src/plugins/runner/shp/ShpRunner.h +++ b/src/plugins/runner/shp/ShpRunner.h @@ -1,28 +1,28 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2011 Thibaut Gridel #ifndef MARBLESHPRUNNER_H #define MARBLESHPRUNNER_H #include "ParsingRunner.h" namespace Marble { class ShpRunner : public ParsingRunner { Q_OBJECT public: explicit ShpRunner(QObject *parent = 0); - ~ShpRunner(); - GeoDataDocument* parseFile( const QString &fileName, DocumentRole role, QString& error ); + ~ShpRunner() override; + GeoDataDocument* parseFile( const QString &fileName, DocumentRole role, QString& error ) override; }; } #endif // MARBLESHPRUNNER_H diff --git a/tools/mapreproject/BilinearInterpolation.h b/tools/mapreproject/BilinearInterpolation.h index 3fa119266..ba774e2cb 100644 --- a/tools/mapreproject/BilinearInterpolation.h +++ b/tools/mapreproject/BilinearInterpolation.h @@ -1,16 +1,16 @@ #ifndef BILINEARINTERPOLATION_H #define BILINEARINTERPOLATION_H #include "InterpolationMethod.h" class ReadOnlyMapImage; class BilinearInterpolation: public InterpolationMethod { public: explicit BilinearInterpolation( ReadOnlyMapImage * const mapImage = NULL ); - virtual QRgb interpolate( double const x, double const y ); + QRgb interpolate( double const x, double const y ) override; }; #endif diff --git a/tools/mapreproject/IntegerInterpolation.h b/tools/mapreproject/IntegerInterpolation.h index 67a80bc6d..8058878af 100644 --- a/tools/mapreproject/IntegerInterpolation.h +++ b/tools/mapreproject/IntegerInterpolation.h @@ -1,16 +1,16 @@ #ifndef INTEGERINTERPOLATION_H #define INTEGERINTERPOLATION_H #include "InterpolationMethod.h" class ReadOnlyMapImage; class IntegerInterpolation: public InterpolationMethod { public: explicit IntegerInterpolation( ReadOnlyMapImage * const mapImage = NULL ); - virtual QRgb interpolate( double const x, double const y ); + QRgb interpolate( double const x, double const y ) override; }; #endif diff --git a/tools/mapreproject/NearestNeighborInterpolation.h b/tools/mapreproject/NearestNeighborInterpolation.h index 424cfdd8c..5015634f0 100644 --- a/tools/mapreproject/NearestNeighborInterpolation.h +++ b/tools/mapreproject/NearestNeighborInterpolation.h @@ -1,16 +1,16 @@ #ifndef NEARESTNEIGHBORINTERPOLATION_H #define NEARESTNEIGHBORINTERPOLATION_H #include "InterpolationMethod.h" class ReadOnlyMapImage; class NearestNeighborInterpolation: public InterpolationMethod { public: explicit NearestNeighborInterpolation( ReadOnlyMapImage * const mapImage = NULL ); - virtual QRgb interpolate( double const x, double const y ); + QRgb interpolate( double const x, double const y ) override; }; #endif diff --git a/tools/mapreproject/NwwMapImage.h b/tools/mapreproject/NwwMapImage.h index b5a6cebb6..5c57af1d6 100644 --- a/tools/mapreproject/NwwMapImage.h +++ b/tools/mapreproject/NwwMapImage.h @@ -1,58 +1,58 @@ #ifndef NWWMAPIMAGE_H #define NWWMAPIMAGE_H #include "mapreproject.h" #include "ReadOnlyMapImage.h" #include #include #include #include #include #include class InterpolationMethod; class NwwMapImage: public ReadOnlyMapImage { public: NwwMapImage( QDir const & baseDirectory, int const tileLevel ); - virtual QRgb pixel( double const lonRad, double const latRad ); - virtual QRgb pixel( int const x, int const y ); + QRgb pixel( double const lonRad, double const latRad ) override; + QRgb pixel( int const x, int const y ) override; void setBaseDirectory( QDir const & baseDirectory ); void setCacheSizeBytes( int const cacheSizeBytes ); - void setInterpolationMethod( InterpolationMethod * const method ); + void setInterpolationMethod( InterpolationMethod * const method ) override; void setTileLevel( int const level ); private: enum { DefaultCacheSizeBytes = 32 * 1024 * 1024 }; static int tileId( int const tileX, int const tileY ); QPair tile( int const tileX, int const tileY ); double lonRadToPixelX( double const lonRad ) const; double latRadToPixelY( double const latRad ) const; // Interpolation methods QRgb nearestNeighbor( double const x, double const y ); QRgb bilinearInterpolation( double const x, double const y ); int const m_tileEdgeLengthPixel; QRgb const m_emptyPixel; QDir m_baseDirectory; int m_tileLevel; int m_mapWidthTiles; int m_mapHeightTiles; int m_mapWidthPixel; int m_mapHeightPixel; InterpolationMethod * m_interpolationMethod; QSet m_tileMissing; QCache m_tileCache; }; #endif diff --git a/tools/mapreproject/SimpleMapImage.h b/tools/mapreproject/SimpleMapImage.h index 2e5c4eca4..00df5eb26 100644 --- a/tools/mapreproject/SimpleMapImage.h +++ b/tools/mapreproject/SimpleMapImage.h @@ -1,31 +1,31 @@ #ifndef SIMPLEMAPIMAGE_H #define SIMPLEMAPIMAGE_H #include "ReadOnlyMapImage.h" #include #include #include class InterpolationMethod; class SimpleMapImage: public ReadOnlyMapImage { public: explicit SimpleMapImage( QString const & fileName ); - virtual QRgb pixel( double const lonRad, double const latRad ); - virtual QRgb pixel( int const x, int const y ); - virtual void setInterpolationMethod( InterpolationMethod * const interpolationMethod ); + QRgb pixel( double const lonRad, double const latRad ) override; + QRgb pixel( int const x, int const y ) override; + void setInterpolationMethod( InterpolationMethod * const interpolationMethod ) override; private: double lonRadToPixelX( double const lonRad ) const; double latRadToPixelY( double const latRad ) const; QImage m_image; int m_mapWidthPixel; int m_mapHeightPixel; InterpolationMethod * m_interpolationMethod; }; #endif diff --git a/tools/mapreproject/Thread.h b/tools/mapreproject/Thread.h index 141b36502..c3b319902 100644 --- a/tools/mapreproject/Thread.h +++ b/tools/mapreproject/Thread.h @@ -1,75 +1,75 @@ /**************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor ** the names of its contributors may be used to endorse or promote ** products derived from this software without specific prior written ** permission. ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef THREAD_H #define THREAD_H #include #include #include class QSignalMapper; class Thread: public QThread { Q_OBJECT public: explicit Thread( QObject * const parent = NULL ); - ~Thread(); + ~Thread() override; void launchWorker( QObject * const worker ); void stop(); Q_SIGNALS: void aboutToStop(); private Q_SLOTS: void stopExecutor(); void setReadyStatus(); private: QObject * m_worker; QSignalMapper * m_shutDownHelper; QWaitCondition m_waitCondition; QMutex m_mutex; }; #endif diff --git a/tools/osm-addresses/SqlWriter.h b/tools/osm-addresses/SqlWriter.h index f8ce76480..32bd85a4d 100644 --- a/tools/osm-addresses/SqlWriter.h +++ b/tools/osm-addresses/SqlWriter.h @@ -1,50 +1,50 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2011 Dennis Nienhüser // #ifndef SQLWRITER_H #define SQLWRITER_H #include "Writer.h" #include #include #include namespace Marble { class SqlWriter : public Writer { public: explicit SqlWriter( const QString &filename, QObject* parent = 0 ); - ~SqlWriter(); + ~SqlWriter() override; - void addOsmRegion( const OsmRegion ®ion ); + void addOsmRegion( const OsmRegion ®ion ) override; - void addOsmPlacemark( const OsmPlacemark &placemark ); + void addOsmPlacemark( const OsmPlacemark &placemark ) override; void saveDatabase( const QString &filename ) const; private: void execQuery( QSqlQuery &query ) const; void execQuery( const QString &query ) const; QHash m_placemarks; QPair m_lastPlacemark; int m_placemarkId; }; } #endif // SQLWRITER_H diff --git a/tools/osm-addresses/pbf/PbfParser.h b/tools/osm-addresses/pbf/PbfParser.h index 38229f2f0..508bfb371 100644 --- a/tools/osm-addresses/pbf/PbfParser.h +++ b/tools/osm-addresses/pbf/PbfParser.h @@ -1,92 +1,92 @@ // // This file is part of the Marble Virtual Globe. // // This file is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Copyright 2011 Dennis Nienhüser // // This file originates from the MoNav project where it was named pbfreader.h and // Copyright 2010 Christian Vetter veaac.fdirct@gmail.com // #ifndef PBFPARSER_H #define PBFPARSER_H #include "fileformat.pb.h" #include "osmformat.pb.h" #include "../OsmParser.h" #include #include #include #include class PbfParser : public Marble::OsmParser { public: PbfParser(); - virtual bool parse( const QFileInfo &file, int pass, bool &needAnotherPass ); + bool parse( const QFileInfo &file, int pass, bool &needAnotherPass ) override; private: enum Mode { ModeNode, ModeWay, ModeRelation, ModeDense }; bool parseBlobHeader(); bool parseBlob(); bool parseData(); bool readNext(); void loadBlock(); void loadGroup(); void parseNode(); void parseWay(); void parseRelation(); void parseDense(); QByteArray m_buffer; QDataStream m_stream; OSMPBF::BlobHeader m_blobHeader; OSMPBF::Blob m_blob; OSMPBF::HeaderBlock m_headerBlock; OSMPBF::PrimitiveBlock m_primitiveBlock; Mode m_mode; int m_currentGroup; int m_currentEntity; bool m_loadBlock; long long m_lastDenseID; long long m_lastDenseLatitude; long long m_lastDenseLongitude; int m_lastDenseTag; int m_pass; QSet m_referencedWays; QSet m_referencedNodes; }; #endif // PBFPARSER_H diff --git a/tools/osm-addresses/xml/XmlParser.h b/tools/osm-addresses/xml/XmlParser.h index 4f43eb8bd..ba964abee 100644 --- a/tools/osm-addresses/xml/XmlParser.h +++ b/tools/osm-addresses/xml/XmlParser.h @@ -1,55 +1,55 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2011 Dennis Nienhüser // #ifndef MARBLE_XMLPARSER_H #define MARBLE_XMLPARSER_H #include "../OsmParser.h" #include "Writer.h" #include "OsmRegion.h" #include "OsmPlacemark.h" #include "OsmRegionTree.h" #include #include namespace Marble { class XmlParser : public OsmParser, private QXmlDefaultHandler { Q_OBJECT public: explicit XmlParser( QObject *parent = 0 ); protected: - virtual bool parse( const QFileInfo &file, int pass, bool &needAnotherPass ); + bool parse( const QFileInfo &file, int pass, bool &needAnotherPass ) override; private: - virtual bool startElement ( const QString & namespaceURI, const QString & localName, const QString & qName, const QXmlAttributes & atts ); + bool startElement ( const QString & namespaceURI, const QString & localName, const QString & qName, const QXmlAttributes & atts ) override; - virtual bool endElement ( const QString & namespaceURI, const QString & localName, const QString & qName ); + bool endElement ( const QString & namespaceURI, const QString & localName, const QString & qName ) override; Node m_node; Way m_way; Relation m_relation; int m_id; ElementType m_element; }; } #endif // MARBLE_XMLPARSER_H diff --git a/tools/osm-sisyphus/job.h b/tools/osm-sisyphus/job.h index 43939deb9..bd1ddfb00 100644 --- a/tools/osm-sisyphus/job.h +++ b/tools/osm-sisyphus/job.h @@ -1,97 +1,97 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2011 Dennis Nienhüser // #ifndef JOB_H #define JOB_H #include "jobparameters.h" #include "region.h" #include #include #include class Job : public QObject, public QRunnable { Q_OBJECT public: enum Status { Waiting, Downloading, Routing, Search, Packaging, Uploading, Finished, Error }; explicit Job(const Region ®ion, const JobParameters ¶meters, QObject *parent = 0); Status status() const; QString statusMessage() const; Region region() const; void setTransport(const QString &transport); QString transport() const; void setProfile(const QString &profile); void setMonavSettings(const QString &filename); bool operator==(const Job &other) const; - virtual void run(); + void run() override; Q_SIGNALS: void finished(Job* job); private: void changeStatus(Status status, const QString &message); bool download(); bool monav(); bool search(); bool package(); bool upload(); bool cleanup(); QFileInfo osmFile(); QFileInfo monavDir(); QFileInfo targetFile(); QFileInfo searchFile(); Status m_status; Region m_region; JobParameters m_parameters; QString m_statusMessage; QString m_transport; QString m_profile; QString m_monavSettings; }; #endif // JOB_H diff --git a/tools/osm-sisyphus/logger.h b/tools/osm-sisyphus/logger.h index 87409cb5d..6467ca50b 100644 --- a/tools/osm-sisyphus/logger.h +++ b/tools/osm-sisyphus/logger.h @@ -1,36 +1,36 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2011 Dennis Nienhüser // #ifndef LOGGER_H #define LOGGER_H #include class LoggerPrivate; class Logger : public QObject { Q_OBJECT public: static Logger& instance(); void setFilename(const QString &filename); void setStatus(const QString &id, const QString &name, const QString &status, const QString &message); private: explicit Logger(QObject *parent = 0); - ~Logger(); + ~Logger() override; LoggerPrivate* const d; }; #endif // LOGGER_H diff --git a/tools/pntreplace/svgxmlhandler.h b/tools/pntreplace/svgxmlhandler.h index 0f6d9984f..3af822a9a 100644 --- a/tools/pntreplace/svgxmlhandler.h +++ b/tools/pntreplace/svgxmlhandler.h @@ -1,39 +1,39 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2006-2007 Torsten Rahn // Copyright 2007 Inge Wallin // #ifndef SVGXMLHANDLER_H #define SVGXMLHANDLER_H #include #include #include class SVGXmlHandler : public QXmlDefaultHandler { public: SVGXmlHandler( QDataStream * out, const QString & path, int header ); // virtual bool startDocument(); // virtual bool endDocument(); - virtual bool startElement(const QString&, const QString&, const QString&, - const QXmlAttributes&); + bool startElement(const QString&, const QString&, const QString&, + const QXmlAttributes&) override; // virtual bool endElement(); private: QDataStream * m_stream; int m_header; QString m_path; }; #endif // SVGXMLHANDLER_H diff --git a/tools/svg2pnt/svgxmlhandler.h b/tools/svg2pnt/svgxmlhandler.h index c783fe40a..35c75c0a5 100644 --- a/tools/svg2pnt/svgxmlhandler.h +++ b/tools/svg2pnt/svgxmlhandler.h @@ -1,38 +1,38 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2006-2007 Torsten Rahn // Copyright 2007 Inge Wallin // #ifndef SVGXMLHANDLER_H #define SVGXMLHANDLER_H #include class SVGXmlHandler : public QXmlDefaultHandler { public: explicit SVGXmlHandler(const QString&); // virtual bool startDocument(); // virtual bool endDocument(); - virtual bool startElement(const QString&, const QString&, const QString&, - const QXmlAttributes&); + bool startElement(const QString&, const QString&, const QString&, + const QXmlAttributes&) override; // virtual bool endElement(); private: int m_header; int m_pointnum; bool m_initialized; QString m_targetfile; }; #endif // SEARCHCOMBOBOX_H diff --git a/tools/tilecreator-srtm2/tccore.cpp b/tools/tilecreator-srtm2/tccore.cpp index 3d7cf5621..8fcc80448 100644 --- a/tools/tilecreator-srtm2/tccore.cpp +++ b/tools/tilecreator-srtm2/tccore.cpp @@ -1,220 +1,220 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2011 Niko Sams // #include "tccore.h" #include #include #include #include #include #include #include #include #include using namespace Marble; class TileCreatorSourceSrtm : public TileCreatorSource { public: TileCreatorSourceSrtm( const QString &sourceDir ) : m_sourceDir( sourceDir ) { } - virtual QSize fullImageSize() const + QSize fullImageSize() const override { return QSize( 512*c_defaultTileSize*2, 512*c_defaultTileSize ); //512: 2**9 (9 zoom levels) } - virtual QImage tile( int n, int m, int maxTileLevel ) + QImage tile( int n, int m, int maxTileLevel ) override { Q_ASSERT( maxTileLevel == 9 ); int nmax = TileLoaderHelper::levelToRow( defaultLevelZeroRows, maxTileLevel ); Q_ASSERT( nmax == 512 ); int mmax = TileLoaderHelper::levelToColumn( defaultLevelZeroColumns, maxTileLevel ); qreal startLat = ( ( ( (qreal)n * 180 ) / nmax ) - 90 ) * -1; qreal startLng = ( ( (qreal)m * 360 ) / mmax ) - 180; int startLngPxResized = c_defaultTileSize * m; int startLatPxResized = c_defaultTileSize * n; if (hgtFileName(std::floor(startLng), std::floor(startLat)).isNull() && hgtFileName(std::floor(startLng)+1, std::floor(startLat)).isNull() && hgtFileName(std::floor(startLng), std::floor(startLat)-1).isNull() && hgtFileName(std::floor(startLng)+1, std::floor(startLat)-1).isNull() ) { QImage ret( c_defaultTileSize, c_defaultTileSize, QImage::Format_ARGB32 ); QPainter painter( &ret ); painter.fillRect( 0, 0, c_defaultTileSize, c_defaultTileSize, QColor( Qt::black ) ); return ret; } QImage image( 2400, 2400, QImage::Format_ARGB32 ); { QPainter painter( &image ); painter.fillRect( 0, 0, 2400, 2400, QColor( Qt::black ) ); QImage i = readHgt(std::floor(startLng), std::floor(startLat)); painter.drawImage( 0, 0, i ); painter.drawImage( 1200, 0, readHgt( std::floor(startLng)+1, std::floor(startLat) ) ); painter.drawImage( 0, 1200, readHgt( std::floor(startLng), std::floor(startLat)-1 ) ); painter.drawImage( 1200, 1200, readHgt( std::floor(startLng)+1, std::floor(startLat)-1 ) ); } int imageSizeResized = 2400 * (512 * c_defaultTileSize) / (1200 * 180); // Pick the current row and smooth scale it // to make it match the expected size image = image.scaled( QSize(imageSizeResized, imageSizeResized), Qt::IgnoreAspectRatio ); //startL??Px: position in px of what we are looking for int startLngPx = startLng * 1200; startLngPx = ( 180 * 1200 ) + startLngPx; //qDebug() << "startLngPx(/1200)" << (qreal)startLngPx / 1200; int startLatPx = startLat * 1200; startLatPx = ( 90 * 1200 ) - startLatPx; //qDebug() << "startLatPx(/1200)" << (qreal)startLatPx / 1200; //imageL??Px: position in px of image int imageLngPx = std::floor(startLng); imageLngPx = 180 + imageLngPx; //qDebug() << "imageLngPx(/1200)" << imageLngPx << "*1200" << imageLngPx*1200; imageLngPx *= 1200; int imageLatPx = std::floor(90 - startLat); //qDebug() << "imageLatPx(/1200)" << imageLatPx; imageLatPx *= 1200; //qDebug() << "lng" << imageLngPx << startLngPx << "offset" << startLngPx - imageLngPx; //qDebug() << "lat" << imageLatPx << startLatPx << "offset" << startLatPx - imageLatPx; Q_ASSERT(1200*2 - (startLngPx - imageLngPx) >= 675); Q_ASSERT(1200*2 - (startLatPx - imageLatPx) >= 675); Q_ASSERT(startLngPx - imageLngPx >= 0); Q_ASSERT(startLatPx - imageLatPx >= 0); int imageLngPxResized = imageLngPx * 1.6; //(512 * c_defaultTileSize) / (1200 * 180); int imageLatPxResized = imageLatPx * 1.6; //(512 * c_defaultTileSize) / (1200 * 180); //qDebug() << "lng(m)" << startLngPxResized << imageLngPxResized << "diff" << startLngPxResized - imageLngPxResized; //qDebug() << "lat(n)" << startLatPxResized << imageLngPxResized << "diff" << startLatPxResized - imageLatPxResized; Q_ASSERT(startLngPxResized - imageLngPxResized < imageSizeResized); Q_ASSERT(startLatPxResized - imageLatPxResized < imageSizeResized); Q_ASSERT(startLngPxResized - imageLngPxResized >= 0); Q_ASSERT(startLatPxResized - imageLatPxResized >= 0); QImage croppedImage = image.copy(startLngPx - imageLngPx, startLatPx - imageLatPx, 675, 675); QImage ret = image.copy(startLngPxResized - imageLngPxResized, startLatPxResized - imageLatPxResized, c_defaultTileSize, c_defaultTileSize); //qDebug() << image.size() << ret.size(); return ret; } private: QString hgtFileName( int lng, int lat ) const { QChar EW(QLatin1Char(lng >= 0 ? 'E' : 'W')); QChar NS(QLatin1Char(lat >= 0 ? 'N' : 'S')); QStringList dirs; dirs << "Africa" << "Australia" << "Eurasia" << "Silands" << "North_America" << "South_America"; for( const QString &dir: dirs) { QString fileName = m_sourceDir + QLatin1Char('/') + dir + QLatin1Char('/'); if ( lat < 0 ) lat *= -1; fileName += QString( "%1%2%3%4.hgt" ).arg( NS ).arg( lat<0 ? lat*-1 : lat, 2, 10, QLatin1Char('0') ) .arg( EW ).arg( lng<0 ? lng*-1 : lng, 3, 10, QLatin1Char('0' ) ); //qDebug() << fileName; if (!QFile::exists(fileName) && QFile::exists(fileName + QLatin1String(".zip"))) { qDebug() << "zip found, unzipping"; QProcess p; p.execute("unzip", QStringList() << fileName + QLatin1String(".zip")); p.waitForFinished(); QFile(QDir::currentPath() + QLatin1Char('/') + QFileInfo(fileName).fileName()).rename(fileName); } if ( QFile::exists( fileName ) ) { return fileName; } } return QString(); } QImage readHgt( int lng, int lat ) { static QCache, QImage > cache( 10 ); if ( cache.contains( qMakePair( lng, lat ) ) ) { return *cache[ qMakePair( lng, lat ) ]; } QString fileName = hgtFileName( lng, lat ); if ( fileName.isNull() ) { //qDebug() << lng << lat << "hgt file does not exist, returing null image"; return QImage(); } else { //qDebug() << lng << lat << "reading hgt file" << fileName; } QFile file( fileName ); file.open( QIODevice::ReadOnly ); int iLat = 0; int iLng = 0; //hgt file is 1201px large, but the last px is overlapping QImage image( 1200, 1200, QImage::Format_ARGB32 ); while(true) { QByteArray data = file.read( 2 ); if ( iLng < 1200 ) { unsigned short height = *(unsigned short*)data.data(); height = ( height << 8 | height >> 8 ); unsigned int pixel; pixel = height; pixel += 0xFF000000; //fully opaque image.setPixel( iLng, iLat, pixel ); } if ( iLat >= 1199 && iLng >= 1199 ) break; iLng++; if ( iLng > 1200 ) { //here not 1199 but one more, because of overlapping px at the end of the line iLng = 0; iLat++; } } file.close(); cache.insert( qMakePair( lng, lat ), new QImage( image ) ); return image; } QString m_sourceDir; }; TCCoreApplication::TCCoreApplication( int argc, char ** argv ) : QCoreApplication( argc, argv ) { if( !(argc < 2) ) { TileCreatorSource *source = new TileCreatorSourceSrtm( argv[1] ); m_tilecreator = new TileCreator( source, "false", argv[2] ); m_tilecreator->setTileFormat( "png" ); m_tilecreator->setTileQuality( 25 ); m_tilecreator->setResume( true ); m_tilecreator->setVerifyExactResult( true ); connect( m_tilecreator, SIGNAL(finished()), this, SLOT(quit()) ); m_tilecreator->start(); } } diff --git a/tools/vectorosm-tilecreator/clipper/clipper.hpp b/tools/vectorosm-tilecreator/clipper/clipper.hpp index 7b06844ae..f6ff625c4 100644 --- a/tools/vectorosm-tilecreator/clipper/clipper.hpp +++ b/tools/vectorosm-tilecreator/clipper/clipper.hpp @@ -1,414 +1,414 @@ /******************************************************************************* * * * Author : Angus Johnson * * Version : 6.4.0 * * Date : 2 July 2015 * * Website : http://www.angusj.com * * Copyright : Angus Johnson 2010-2015 * * * * License: * * Use, modification & distribution is subject to Boost Software License Ver 1. * * http://www.boost.org/LICENSE_1_0.txt * * * * Attributions: * * The code in this library is an extension of Bala Vatti's clipping algorithm: * * "A generic solution to polygon clipping" * * Communications of the ACM, Vol 35, Issue 7 (July 1992) pp 56-63. * * http://portal.acm.org/citation.cfm?id=129906 * * * * Computer graphics and geometric modeling: implementation and algorithms * * By Max K. Agoston * * Springer; 1 edition (January 4, 2005) * * http://books.google.com/books?q=vatti+clipping+agoston * * * * See also: * * "Polygon Offsetting by Computing Winding Numbers" * * Paper no. DETC2005-85513 pp. 565-575 * * ASME 2005 International Design Engineering Technical Conferences * * and Computers and Information in Engineering Conference (IDETC/CIE2005) * * September 24-28, 2005 , Long Beach, California, USA * * http://www.me.berkeley.edu/~mcmains/pubs/DAC05OffsetPolygon.pdf * * * *******************************************************************************/ #ifndef clipper_hpp #define clipper_hpp #define CLIPPER_VERSION "6.2.6" //use_int32: When enabled 32bit ints are used instead of 64bit ints. This //improve performance but coordinate values are limited to the range +/- 46340 //#define use_int32 //use_xyz: adds a Z member to IntPoint. Adds a minor cost to performance. //#define use_xyz //use_lines: Enables line clipping. Adds a very minor cost to performance. #define use_lines //use_deprecated: Enables temporary support for the obsolete functions //#define use_deprecated #include #include #include #include #include #include #include #include #include #include namespace ClipperLib { enum ClipType { ctIntersection, ctUnion, ctDifference, ctXor }; enum PolyType { ptSubject, ptClip }; //By far the most widely used winding rules for polygon filling are //EvenOdd & NonZero (GDI, GDI+, XLib, OpenGL, Cairo, AGG, Quartz, SVG, Gr32) //Others rules include Positive, Negative and ABS_GTR_EQ_TWO (only in OpenGL) //see http://glprogramming.com/red/chapter11.html enum PolyFillType { pftEvenOdd, pftNonZero, pftPositive, pftNegative }; #ifdef use_int32 typedef int cInt; static cInt const loRange = 0x7FFF; static cInt const hiRange = 0x7FFF; #else typedef signed long long cInt; static cInt const loRange = 0x3FFFFFFF; static cInt const hiRange = 0x3FFFFFFFFFFFFFFFLL; typedef signed long long long64; //used by Int128 class typedef unsigned long long ulong64; #endif struct IntPoint { cInt X; cInt Y; constexpr static qint64 const scale = 10000000; #ifdef use_xyz cInt Z; IntPoint(cInt x = 0, cInt y = 0, cInt z = 0): X(x), Y(y), Z(z) {}; #else IntPoint(cInt x = 0, cInt y = 0): X(x), Y(y) {} IntPoint(const Marble::GeoDataCoordinates* coordinates); #endif friend inline bool operator== (const IntPoint& a, const IntPoint& b) { return a.X == b.X && a.Y == b.Y; } friend inline bool operator!= (const IntPoint& a, const IntPoint& b) { return a.X != b.X || a.Y != b.Y; } Marble::GeoDataCoordinates coordinates() const; bool isInside(const cInt &minX, const cInt &maxX, const cInt &minY, const cInt &maxY) const; private: const Marble::GeoDataCoordinates * m_coordinates = nullptr; }; //------------------------------------------------------------------------------ typedef std::vector< IntPoint > Path; typedef std::vector< Path > Paths; inline Path& operator <<(Path& poly, const IntPoint& p) {poly.push_back(p); return poly;} inline Paths& operator <<(Paths& polys, const Path& p) {polys.push_back(p); return polys;} std::ostream& operator <<(std::ostream &s, const IntPoint &p); std::ostream& operator <<(std::ostream &s, const Path &p); std::ostream& operator <<(std::ostream &s, const Paths &p); struct DoublePoint { double X; double Y; DoublePoint(double x = 0, double y = 0) : X(x), Y(y) {} DoublePoint(const IntPoint &ip) : X((double)ip.X), Y((double)ip.Y) {} }; //------------------------------------------------------------------------------ #ifdef use_xyz typedef void (*ZFillCallback)(IntPoint& e1bot, IntPoint& e1top, IntPoint& e2bot, IntPoint& e2top, IntPoint& pt); #endif enum InitOptions {ioReverseSolution = 1, ioStrictlySimple = 2, ioPreserveCollinear = 4}; enum JoinType {jtSquare, jtRound, jtMiter}; enum EndType {etClosedPolygon, etClosedLine, etOpenButt, etOpenSquare, etOpenRound}; class PolyNode; typedef std::vector< PolyNode* > PolyNodes; class PolyNode { public: PolyNode(); virtual ~PolyNode(){}; Path Contour; PolyNodes Childs; PolyNode* Parent; PolyNode* GetNext() const; bool IsHole() const; bool IsOpen() const; int ChildCount() const; private: unsigned Index; //node index in Parent.Childs bool m_IsOpen; JoinType m_jointype; EndType m_endtype; PolyNode* GetNextSiblingUp() const; void AddChild(PolyNode& child); friend class Clipper; //to access Index friend class ClipperOffset; }; class PolyTree: public PolyNode { public: - ~PolyTree(){Clear();}; + ~PolyTree() override{Clear();}; PolyNode* GetFirst() const; void Clear(); int Total() const; private: PolyNodes AllNodes; friend class Clipper; //to access AllNodes }; bool Orientation(const Path &poly); double Area(const Path &poly); int PointInPolygon(const IntPoint &pt, const Path &path); void SimplifyPolygon(const Path &in_poly, Paths &out_polys, PolyFillType fillType = pftEvenOdd); void SimplifyPolygons(const Paths &in_polys, Paths &out_polys, PolyFillType fillType = pftEvenOdd); void SimplifyPolygons(Paths &polys, PolyFillType fillType = pftEvenOdd); void CleanPolygon(const Path& in_poly, Path& out_poly, double distance = 1.415); void CleanPolygon(Path& poly, double distance = 1.415); void CleanPolygons(const Paths& in_polys, Paths& out_polys, double distance = 1.415); void CleanPolygons(Paths& polys, double distance = 1.415); void MinkowskiSum(const Path& pattern, const Path& path, Paths& solution, bool pathIsClosed); void MinkowskiSum(const Path& pattern, const Paths& paths, Paths& solution, bool pathIsClosed); void MinkowskiDiff(const Path& poly1, const Path& poly2, Paths& solution); void PolyTreeToPaths(const PolyTree& polytree, Paths& paths); void ClosedPathsFromPolyTree(const PolyTree& polytree, Paths& paths); void OpenPathsFromPolyTree(PolyTree& polytree, Paths& paths); void ReversePath(Path& p); void ReversePaths(Paths& p); struct IntRect { cInt left; cInt top; cInt right; cInt bottom; }; //enums that are used internally ... enum EdgeSide { esLeft = 1, esRight = 2}; //forward declarations (for stuff used internally) ... struct TEdge; struct IntersectNode; struct LocalMinimum; struct OutPt; struct OutRec; struct Join; typedef std::vector < OutRec* > PolyOutList; typedef std::vector < TEdge* > EdgeList; typedef std::vector < Join* > JoinList; typedef std::vector < IntersectNode* > IntersectList; //------------------------------------------------------------------------------ //ClipperBase is the ancestor to the Clipper class. It should not be //instantiated directly. This class simply abstracts the conversion of sets of //polygon coordinates into edge objects that are stored in a LocalMinima list. class ClipperBase { public: ClipperBase(); virtual ~ClipperBase(); virtual bool AddPath(const Path &pg, PolyType PolyTyp, bool Closed); bool AddPaths(const Paths &ppg, PolyType PolyTyp, bool Closed); virtual void Clear(); IntRect GetBounds(); bool PreserveCollinear() {return m_PreserveCollinear;}; void PreserveCollinear(bool value) {m_PreserveCollinear = value;}; protected: void DisposeLocalMinimaList(); TEdge* AddBoundsToLML(TEdge *e, bool IsClosed); virtual void Reset(); TEdge* ProcessBound(TEdge* E, bool IsClockwise); void InsertScanbeam(const cInt Y); bool PopScanbeam(cInt &Y); bool LocalMinimaPending(); bool PopLocalMinima(cInt Y, const LocalMinimum *&locMin); OutRec* CreateOutRec(); void DisposeAllOutRecs(); void DisposeOutRec(PolyOutList::size_type index); void SwapPositionsInAEL(TEdge *edge1, TEdge *edge2); void DeleteFromAEL(TEdge *e); void UpdateEdgeIntoAEL(TEdge *&e); typedef std::vector MinimaList; MinimaList::iterator m_CurrentLM; MinimaList m_MinimaList; bool m_UseFullRange; EdgeList m_edges; bool m_PreserveCollinear; bool m_HasOpenPaths; PolyOutList m_PolyOuts; TEdge *m_ActiveEdges; typedef std::priority_queue ScanbeamList; ScanbeamList m_Scanbeam; }; //------------------------------------------------------------------------------ class Clipper : public virtual ClipperBase { public: Clipper(int initOptions = 0); bool Execute(ClipType clipType, Paths &solution, PolyFillType fillType = pftEvenOdd); bool Execute(ClipType clipType, Paths &solution, PolyFillType subjFillType, PolyFillType clipFillType); bool Execute(ClipType clipType, PolyTree &polytree, PolyFillType fillType = pftEvenOdd); bool Execute(ClipType clipType, PolyTree &polytree, PolyFillType subjFillType, PolyFillType clipFillType); bool ReverseSolution() { return m_ReverseOutput; }; void ReverseSolution(bool value) {m_ReverseOutput = value;}; bool StrictlySimple() {return m_StrictSimple;}; void StrictlySimple(bool value) {m_StrictSimple = value;}; //set the callback function for z value filling on intersections (otherwise Z is 0) #ifdef use_xyz void ZFillFunction(ZFillCallback zFillFunc); #endif protected: virtual bool ExecuteInternal(); private: JoinList m_Joins; JoinList m_GhostJoins; IntersectList m_IntersectList; ClipType m_ClipType; typedef std::list MaximaList; MaximaList m_Maxima; TEdge *m_SortedEdges; bool m_ExecuteLocked; PolyFillType m_ClipFillType; PolyFillType m_SubjFillType; bool m_ReverseOutput; bool m_UsingPolyTree; bool m_StrictSimple; #ifdef use_xyz ZFillCallback m_ZFill; //custom callback #endif void SetWindingCount(TEdge& edge); bool IsEvenOddFillType(const TEdge& edge) const; bool IsEvenOddAltFillType(const TEdge& edge) const; void InsertLocalMinimaIntoAEL(const cInt botY); void InsertEdgeIntoAEL(TEdge *edge, TEdge* startEdge); void AddEdgeToSEL(TEdge *edge); bool PopEdgeFromSEL(TEdge *&edge); void CopyAELToSEL(); void DeleteFromSEL(TEdge *e); void SwapPositionsInSEL(TEdge *edge1, TEdge *edge2); bool IsContributing(const TEdge& edge) const; bool IsTopHorz(const cInt XPos); void DoMaxima(TEdge *e); void ProcessHorizontals(); void ProcessHorizontal(TEdge *horzEdge); void AddLocalMaxPoly(TEdge *e1, TEdge *e2, const IntPoint &pt); OutPt* AddLocalMinPoly(TEdge *e1, TEdge *e2, const IntPoint &pt); OutRec* GetOutRec(int idx); void AppendPolygon(TEdge *e1, TEdge *e2); void IntersectEdges(TEdge *e1, TEdge *e2, IntPoint &pt); OutPt* AddOutPt(TEdge *e, const IntPoint &pt); OutPt* GetLastOutPt(TEdge *e); bool ProcessIntersections(const cInt topY); void BuildIntersectList(const cInt topY); void ProcessIntersectList(); void ProcessEdgesAtTopOfScanbeam(const cInt topY); void BuildResult(Paths& polys); void BuildResult2(PolyTree& polytree); void SetHoleState(TEdge *e, OutRec *outrec); void DisposeIntersectNodes(); bool FixupIntersectionOrder(); void FixupOutPolygon(OutRec &outrec); void FixupOutPolyline(OutRec &outrec); bool IsHole(TEdge *e); bool FindOwnerFromSplitRecs(OutRec &outRec, OutRec *&currOrfl); void FixHoleLinkage(OutRec &outrec); void AddJoin(OutPt *op1, OutPt *op2, const IntPoint &offPt); void ClearJoins(); void ClearGhostJoins(); void AddGhostJoin(OutPt *op, const IntPoint &offPt); bool JoinPoints(Join *j, OutRec* outRec1, OutRec* outRec2); void JoinCommonEdges(); void DoSimplePolygons(); void FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec); void FixupFirstLefts2(OutRec* InnerOutRec, OutRec* OuterOutRec); void FixupFirstLefts3(OutRec* OldOutRec, OutRec* NewOutRec); #ifdef use_xyz void SetZ(IntPoint& pt, TEdge& e1, TEdge& e2); #endif }; //------------------------------------------------------------------------------ class ClipperOffset { public: ClipperOffset(double miterLimit = 2.0, double roundPrecision = 0.25); ~ClipperOffset(); void AddPath(const Path& path, JoinType joinType, EndType endType); void AddPaths(const Paths& paths, JoinType joinType, EndType endType); void Execute(Paths& solution, double delta); void Execute(PolyTree& solution, double delta); void Clear(); double MiterLimit; double ArcTolerance; private: Paths m_destPolys; Path m_srcPoly; Path m_destPoly; std::vector m_normals; double m_delta, m_sinA, m_sin, m_cos; double m_miterLim, m_StepsPerRad; IntPoint m_lowest; PolyNode m_polyNodes; void FixOrientations(); void DoOffset(double delta); void OffsetPoint(int j, int& k, JoinType jointype); void DoSquare(int j, int k); void DoMiter(int j, int k, double r); void DoRound(int j, int k); }; //------------------------------------------------------------------------------ class clipperException : public std::exception { public: clipperException(const char* description): m_descr(description) {} - virtual ~clipperException() throw() {} - virtual const char* what() const throw() {return m_descr.c_str();} + ~clipperException() throw() override {} + const char* what() const throw() override {return m_descr.c_str();} private: std::string m_descr; }; //------------------------------------------------------------------------------ } //ClipperLib namespace #endif //clipper_hpp