• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • plugins
  • render
  • panoramio
PanoramioWidget.cpp
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2009 Bastian Holst <bastianholst@gmx.de>
9 //
10 
11 // Self
12 #include "PanoramioWidget.h"
13 
14 // Marble
15 #include "MarbleDebug.h"
16 #include "GeoPainter.h"
17 #include "ViewportParams.h"
18 #include "GeoSceneLayer.h"
19 
20 using namespace Marble;
21 
22 PanoramioWidget::PanoramioWidget( QObject *parent )
23  : AbstractDataPluginItem( parent )
24 {
25 }
26 
27 bool PanoramioWidget::initialized() const
28 {
29  return !smallImage.isNull();
30 }
31 
32 void PanoramioWidget::addDownloadedFile( const QString &url, const QString &type )
33 {
34  if( standardImageSize == type ) {
35  // Loading original image
36  QImage largeImage;
37  largeImage.load( url );
38 
39  // Scaling the image to the half of the original size
40  smallImage = largeImage.scaled( largeImage.size() / 2,
41  Qt::IgnoreAspectRatio,
42  Qt::SmoothTransformation );
43  update();
44  }
45  else {
46  mDebug() << "PanoramioWidget: addDownloadFile can't handle type " << type;
47  }
48 }
49 
50 QDate PanoramioWidget::uploadDate() const
51 {
52  return m_uploadDate;
53 }
54 
55 void PanoramioWidget::setUploadDate( QDate uploadDate )
56 {
57  m_uploadDate = uploadDate;
58 }
59 
60 bool PanoramioWidget::operator<( const AbstractDataPluginItem *other ) const
61 {
62  Q_ASSERT( dynamic_cast<const PanoramioWidget *>( other ) != 0 );
63 
64  return uploadDate() > static_cast<const PanoramioWidget *>( other )->uploadDate();
65 }
66 
67 void PanoramioWidget::paint( QPainter *painter )
68 {
69  painter->drawImage( 0, 0, smallImage );
70 }
71 
72 #include "PanoramioWidget.moc"
Marble::PanoramioWidget::setUploadDate
void setUploadDate(QDate uploadDate)
Definition: PanoramioWidget.cpp:55
QImage::load
bool load(QIODevice *device, const char *format)
Marble::AbstractDataPluginItem
Definition: AbstractDataPluginItem.h:28
Marble::standardImageSize
const QString standardImageSize
Definition: PanoramioWidget.h:22
Marble::PanoramioWidget::initialized
bool initialized() const
Definition: PanoramioWidget.cpp:27
QImage::isNull
bool isNull() const
MarbleDebug.h
Marble::PanoramioWidget::paint
void paint(QPainter *painter)
Paints the item in item coordinates.
Definition: PanoramioWidget.cpp:67
Marble::PanoramioWidget::uploadDate
QDate uploadDate() const
Definition: PanoramioWidget.cpp:50
QObject
QPainter
QDate
Marble::PanoramioWidget::addDownloadedFile
void addDownloadedFile(const QString &url, const QString &type)
Definition: PanoramioWidget.cpp:32
QString
GeoPainter.h
PanoramioWidget.h
ViewportParams.h
This file contains the headers for ViewportParams.
QImage
QPainter::drawImage
void drawImage(const QRectF &target, const QImage &image, const QRectF &source, QFlags< Qt::ImageConversionFlag > flags)
Marble::PanoramioWidget
Definition: PanoramioWidget.h:24
Marble::PanoramioWidget::PanoramioWidget
PanoramioWidget(QObject *parent)
Definition: PanoramioWidget.cpp:22
QImage::size
QSize size() const
Marble::MarbleGraphicsItem::update
void update()
Marks the item and all parent items as invalid.
Definition: MarbleGraphicsItem.cpp:167
Marble::mDebug
QDebug mDebug()
a function to replace qDebug() in Marble library code
Definition: MarbleDebug.cpp:36
Marble::PanoramioWidget::operator<
bool operator<(const AbstractDataPluginItem *other) const
Definition: PanoramioWidget.cpp:60
QImage::scaled
QImage scaled(int width, int height, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformMode) const
GeoSceneLayer.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:41 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal