diff --git a/src/plugins/render/CMakeLists.txt b/src/plugins/render/CMakeLists.txt --- a/src/plugins/render/CMakeLists.txt +++ b/src/plugins/render/CMakeLists.txt @@ -25,7 +25,6 @@ add_subdirectory( atmosphere ) add_subdirectory( stars ) add_subdirectory( sun ) -add_subdirectory( notes ) # Display online information add_subdirectory( earthquake ) diff --git a/src/plugins/render/notes/CMakeLists.txt b/src/plugins/render/notes/CMakeLists.txt deleted file mode 100644 --- a/src/plugins/render/notes/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -PROJECT(Notes) - -INCLUDE_DIRECTORIES( - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} -) - -set( notes_SRCS NotesPlugin.cpp - NotesPlugin.h - NotesModel.cpp - NotesModel.h - NotesItem.cpp - NotesItem.h) - -marble_add_plugin( NotesPlugin ${notes_SRCS} ) - diff --git a/src/plugins/render/notes/NotesItem.h b/src/plugins/render/notes/NotesItem.h deleted file mode 100644 --- a/src/plugins/render/notes/NotesItem.h +++ /dev/null @@ -1,40 +0,0 @@ -// -// 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 2016 Spencer Brown -// - -#ifndef NOTESITEM_H -#define NOTESITEM_H - -#include "AbstractDataPluginItem.h" - -namespace Marble -{ - -class NotesItem : public AbstractDataPluginItem -{ - Q_OBJECT - - public: - explicit NotesItem( QObject *parent ); - - ~NotesItem() override; - - bool initialized() const override; - - void paint( QPainter *painter ) override; - - bool operator<( const AbstractDataPluginItem *other ) const override; - -private: - static const QFont s_font; - static const int s_labelOutlineWidth; -}; - -} -#endif // NOTESITEM_H diff --git a/src/plugins/render/notes/NotesItem.cpp b/src/plugins/render/notes/NotesItem.cpp deleted file mode 100644 --- a/src/plugins/render/notes/NotesItem.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// 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 2016 Spencer Brown -// - -#include "NotesItem.h" - -#include -#include - -using namespace Marble; - -const QFont NotesItem::s_font = QFont( QStringLiteral( "Sans Serif" ), 10, QFont::Bold ); -const int NotesItem::s_labelOutlineWidth = 5; - -NotesItem::NotesItem( QObject *parent ) - : AbstractDataPluginItem( parent ) -{ - setSize( QSize( 0, 0 ) ); - setCacheMode( ItemCoordinateCache ); -} - -NotesItem::~NotesItem() -{ -} - -bool NotesItem::initialized() const -{ - return !id().isEmpty(); -} - -bool NotesItem::operator<( const AbstractDataPluginItem *other ) const -{ - return this->id() < other->id(); -} - -void NotesItem::paint( QPainter *painter ) -{ - painter->save(); - - /*QPen outlinepen( Qt::white ); - outlinepen.setWidthF( s_labelOutlineWidth ); - QBrush outlinebrush( Qt::black ); - const int fontAscent = QFontMetrics( s_font ).ascent(); - - const QPointF baseline( s_labelOutlineWidth / 2.0, fontAscent ); - - QPainterPath outlinepath; - outlinepath.addText( baseline, s_font, "Note" ); - - painter->setRenderHint( QPainter::Antialiasing, true ); - painter->setPen( outlinepen ); - painter->setBrush( outlinebrush ); - painter->drawPath( outlinepath ); - painter->setPen( Qt::NoPen ); - painter->drawPath( outlinepath ); - painter->setRenderHint( QPainter::Antialiasing, false );*/ - painter->drawImage(QRect(), QImage("waypoint.png"), QRect()); //copyed image from data/bitmaps for testing purposes. - - painter->restore(); -} diff --git a/src/plugins/render/notes/NotesModel.h b/src/plugins/render/notes/NotesModel.h deleted file mode 100644 --- a/src/plugins/render/notes/NotesModel.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// 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 2016 Spencer Brown -// - -#ifndef NOTESMODEL_H -#define NOTESMODEL_H - -#include "AbstractDataPluginModel.h" - -namespace Marble { - - class NotesModel : public AbstractDataPluginModel - { - Q_OBJECT - - public: - explicit NotesModel( const MarbleModel *marbleModel, QObject *parent = 0 ); - - protected: - void getAdditionalItems( const GeoDataLatLonAltBox& box, qint32 number = 100 ) override; - void parseFile( const QByteArray& file ) override; - }; -} - -#endif diff --git a/src/plugins/render/notes/NotesModel.cpp b/src/plugins/render/notes/NotesModel.cpp deleted file mode 100644 --- a/src/plugins/render/notes/NotesModel.cpp +++ /dev/null @@ -1,86 +0,0 @@ -// -// 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 2016 Spencer Brown -// - -#include "NotesModel.h" -#include "NotesItem.h" - -#include "MarbleGlobal.h" -#include "MarbleModel.h" -#include "GeoDataCoordinates.h" -#include "GeoDataLatLonAltBox.h" -#include "MarbleDebug.h" -#include "Planet.h" - -#include -#include -#include -#include -#include - -#include - -using namespace Marble; - -NotesModel::NotesModel( const MarbleModel *marbleModel, QObject *parent ) - : AbstractDataPluginModel( "Notes", marbleModel, parent ) -{ -} - -void NotesModel::getAdditionalItems( const GeoDataLatLonAltBox& box, qint32 number ) -{ - double left = box.west( GeoDataCoordinates::Degree ); - double bottom = box.south( GeoDataCoordinates::Degree ); - double right = box.east( GeoDataCoordinates::Degree ); - double top = box.north( GeoDataCoordinates::Degree ); - - QString bboxValue; - bboxValue.append(QString::number( left )).append(",").append(QString::number( bottom )).append(",").append(QString::number( right )).append(",").append(QString::number( top )).append(","); - - QUrl osmNotesApiUrl("http://api.openstreetmap.org/api/0.6/notes.json"); - QUrlQuery urlQuery; - urlQuery.addQueryItem( "bbox", bboxValue ); - urlQuery.addQueryItem ("limit", QString::number( number )); - osmNotesApiUrl.setQuery(urlQuery); - - downloadDescriptionFile( osmNotesApiUrl ); -} - -void NotesModel::parseFile( const QByteArray& file ) -{ - QJsonDocument jsonDoc = QJsonDocument::fromJson(file); - QJsonValue features = jsonDoc.object().value(QStringLiteral("features")); - - if (features.isArray()) { - QList items; - - QJsonArray jsonArray = features.toArray(); - for (auto jsonRef : jsonArray) { - - QJsonObject jsonObj = jsonRef.toObject(); - QJsonObject geometry = jsonObj.value(QStringLiteral("geometry")).toObject(); - QJsonArray coordinates = geometry.value(QStringLiteral("coordinates")).toArray(); - double latitude = coordinates.at(0).toDouble(); - double longitude = coordinates.at(1).toDouble(); - - GeoDataCoordinates coordinateset( longitude, latitude, 0.0, GeoDataCoordinates::Degree ); - QString id = jsonObj.value(QStringLiteral("properties")).toObject().value(QStringLiteral("id")).toString(); - - NotesItem *item = new NotesItem (this); - item->setId( id ); - item->setCoordinate( coordinateset ); - - items << item; - } - - addItemsToList( items ); - } -} - -#include "moc_NotesModel.cpp" diff --git a/src/plugins/render/notes/NotesPlugin.h b/src/plugins/render/notes/NotesPlugin.h deleted file mode 100644 --- a/src/plugins/render/notes/NotesPlugin.h +++ /dev/null @@ -1,51 +0,0 @@ -// -// 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 2016 Spencer Brown -// - -#ifndef NOTESPLUGIN_H -#define NOTESPLUGIN_H - -#include "AbstractDataPlugin.h" - -namespace Marble { - -class NotesPlugin : public AbstractDataPlugin { - - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.kde.marble.NotesPlugin") - Q_INTERFACES( Marble::RenderPluginInterface ) - MARBLE_PLUGIN( NotesPlugin ) - - public: - NotesPlugin(); - - explicit NotesPlugin( const MarbleModel *marbleModel ); - - void initialize() override; - - QString name() const override; - - QString guiString() const override; - - QString nameId() const override; - - QString version() const override; - - QString description() const override; - - QString copyrightYears() const override; - - QVector pluginAuthors() const override; - - QIcon icon() const override; -}; - -} - -#endif // NOTESPLUGIN_H diff --git a/src/plugins/render/notes/NotesPlugin.cpp b/src/plugins/render/notes/NotesPlugin.cpp deleted file mode 100644 --- a/src/plugins/render/notes/NotesPlugin.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// -// 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 2016 Spencer Brown -// - -#include "NotesPlugin.h" -#include "NotesModel.h" - -#include - -using namespace Marble; - -NotesPlugin::NotesPlugin() - : AbstractDataPlugin( 0 ) -{ -} - -NotesPlugin::NotesPlugin( const MarbleModel *marbleModel ) - : AbstractDataPlugin( marbleModel ) -{ - setEnabled( true ); - setVisible( false ); -} - -void NotesPlugin::initialize() -{ - setModel( new NotesModel( marbleModel(), this ) ); - setNumberOfItems( 20 ); -} - -QString NotesPlugin::name() const -{ - return tr( "Notes Plugin" ); -} - -QString NotesPlugin::guiString() const -{ - return tr( "Notes" ); -} - -QString NotesPlugin::nameId() const -{ - return QStringLiteral("notes"); -} - -QString NotesPlugin::version() const -{ - return QStringLiteral("1.0"); -} - -QString NotesPlugin::copyrightYears() const -{ - return QStringLiteral("2016"); -} - -QVector NotesPlugin::pluginAuthors() const -{ - return QVector() - << PluginAuthor(QStringLiteral("Spencer Brown"), QStringLiteral("spencerbrown991@gmail.com")); -} - -QString NotesPlugin::description() const -{ - return tr( "Show placemarks for Open Street Map notes." ); -} - -QIcon NotesPlugin::icon() const -{ - return QIcon(); -} - -#include "moc_NotesPlugin.cpp" diff --git a/src/plugins/render/notes/waypoint.png b/src/plugins/render/notes/waypoint.png deleted file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@