File indexing completed on 2024-11-10 03:33:24
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2014 Dennis Nienhüser <nienhueser@kde.org> 0004 // 0005 0006 #ifndef SQUAD_INTERPOLATION 0007 #define SQUAD_INTERPOLATION 0008 0009 #include <marble/MarbleWidget.h> 0010 #include <marble/MarbleMap.h> 0011 #include <marble/MarbleModel.h> 0012 #include <marble/GeoPainter.h> 0013 #include <marble/GeoDataLineString.h> 0014 #include <marble/LayerInterface.h> 0015 0016 #include <QApplication> 0017 0018 namespace Marble { 0019 0020 class MyPaintLayer : public QObject, public LayerInterface 0021 { 0022 Q_OBJECT 0023 0024 public: 0025 // Constructor 0026 explicit MyPaintLayer( MarbleWidget* widget ); 0027 0028 // LayerInterface 0029 QStringList renderPosition() const override; 0030 bool render( GeoPainter *painter, ViewportParams *viewport, 0031 const QString &renderPos, GeoSceneLayer *layer) override; 0032 GeoDataLatLonBox center() const; 0033 0034 private Q_SLOTS: 0035 void addInterpolatedPoint(); 0036 0037 private: 0038 void addRandomCity( double minDistanceKm=500, double maxDistanceKm=1500 ); 0039 static GeoDataCoordinates basePoint( const GeoDataCoordinates &q1, const GeoDataCoordinates &q2, const GeoDataCoordinates &q3 ); 0040 0041 MarbleWidget* m_widget; 0042 GeoDataLineString m_cities; 0043 GeoDataLineString m_interpolated; 0044 double m_fraction; 0045 double m_delta; 0046 int m_index; 0047 }; 0048 0049 } 0050 0051 #endif // SQUAD_INTERPOLATION