File indexing completed on 2024-04-28 03:50:26

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2008 Shashank Singh <shashank.personal@gmail.com>
0004 //
0005 
0006 //
0007 // This class is a test plugin.
0008 //
0009 
0010 #ifndef MARBLETWITTERPLUGIN_H
0011 #define MARBLETWITTERPLUGIN_H
0012 #define RADIANSTODEGREES 57.2957795
0013 
0014 #include "../lib/HttpDownloadManager.h"
0015 #include "../lib/CacheStoragePolicy.h"
0016 #include "jsonparser.h"
0017 #include "RenderPlugin.h"
0018 #include "MarbleDirs.h"
0019 #include "GeoPainter.h"
0020 #include "GeoDataCoordinates.h"
0021 
0022 namespace Marble
0023 {
0024 
0025 /**
0026  * @short The class that specifies the a simple panormaio plugin
0027  *
0028  */
0029 struct twitterStructure
0030 {
0031     QString twit ;
0032     GeoDataCoordinates location;
0033 };
0034 
0035 class twitterPlugin : public RenderPlugin
0036 {
0037     Q_OBJECT
0038     Q_PLUGIN_METADATA(IID "org.kde.marble.twitterPlugin")
0039     Q_INTERFACES(Marble::RenderPluginInterface)
0040     MARBLE_PLUGIN(twitterPlugin)
0041 
0042 public:
0043     QStringList backendTypes() const;
0044 
0045     QString renderPolicy() const;
0046 
0047     QStringList renderPosition() const;
0048 
0049     QString name() const;
0050 
0051     QString guiString() const;
0052 
0053     QString nameId() const;
0054 
0055     QString description() const;
0056 
0057     QIcon icon() const;
0058 
0059 
0060     void initialize();
0061 
0062     bool isInitialized() const;
0063 
0064     bool render(GeoPainter *painter, ViewportParams *viewport, const QString& renderPos, GeoSceneLayer * layer = 0);
0065 
0066     ~twitterPlugin();
0067 
0068 public Q_SLOTS:
0069     void slotJsonDownloadComplete(QString , QString);   //completed download of json reply fom panoramio
0070     void slotGeoCodingReplyRecieved(QString , QString);   //completed download of image
0071 
0072 Q_SIGNALS:
0073     void statusMessageForImageDownloadingProcess(const QString&);
0074 private:
0075     CacheStoragePolicy *m_storagePolicy;
0076     HttpDownloadManager *m_downloadManager;
0077     jsonParser twitterJsonParser;
0078     void downloadtwitter(int, int, qreal, qreal, qreal, qreal);
0079     QList <twitterStructure > twitsWithLocation;//this list will hold pointers to TWITT we have downloaded successfully figured out :)
0080     QList <twitterDataStructure> parsedData;
0081    void findLatLonOfStreetAddress(QString streetAddress);
0082     int privateFlagForRenderingTwitts;//this flag is one when globe has an Image  (downloaded or already there in cache)
0083 
0084 };
0085 
0086 }
0087 
0088 #endif