• 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
  • sun
SunPlugin.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 2008 Torsten Rahn <tackat@kde.org>
9 // Copyright 2011 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
10 //
11 
12 #include "SunPlugin.h"
13 
14 #include "GeoDataCoordinates.h"
15 #include "MarbleDirs.h"
16 #include "MarbleModel.h"
17 #include "GeoPainter.h"
18 #include "SunLocator.h"
19 
20 namespace Marble
21 {
22 
23 SunPlugin::SunPlugin()
24  : RenderPlugin( 0 )
25 {
26 }
27 
28 SunPlugin::SunPlugin( const MarbleModel *marbleModel )
29  : RenderPlugin( marbleModel )
30 {
31  setVisible( false );
32 }
33 
34 QStringList SunPlugin::backendTypes() const
35 {
36  return QStringList( "stars" );
37 }
38 
39 QString SunPlugin::renderPolicy() const
40 {
41  return QString( "SPECIFIED_ALWAYS" );
42 }
43 
44 QStringList SunPlugin::renderPosition() const
45 {
46  QStringList layers = QStringList() << "ALWAYS_ON_TOP";
47  return layers;
48 }
49 
50 QString SunPlugin::name() const
51 {
52  return tr( "Sun" );
53 }
54 
55 QString SunPlugin::guiString() const
56 {
57  return tr( "Sun" );
58 }
59 
60 QString SunPlugin::nameId() const
61 {
62  return QString( "sun" );
63 }
64 
65 QString SunPlugin::version() const
66 {
67  return "1.0";
68 }
69 
70 QString SunPlugin::description() const
71 {
72  return tr( "A plugin that shows the Sun." );
73 }
74 
75 QString SunPlugin::copyrightYears() const
76 {
77  return "2011";
78 }
79 
80 QList<PluginAuthor> SunPlugin::pluginAuthors() const
81 {
82  return QList<PluginAuthor>()
83  << PluginAuthor( "Torsten Rahn", "tackat@kde.org" )
84  << PluginAuthor( "Bernhard Beschow", "bbeschow@cs.tu-berlin.de")
85  << PluginAuthor( "Harshit Jain", "hjain.itbhu@gmail.com" );
86 }
87 
88 QIcon SunPlugin::icon () const
89 {
90  return QIcon( MarbleDirs::path( "svg/sunshine.png" ) );
91 }
92 
93 
94 void SunPlugin::initialize ()
95 {
96  m_pixmap = QPixmap( MarbleDirs::path( "svg/sunshine.png" ) ).scaled( QSize(22,22) );
97 }
98 
99 bool SunPlugin::isInitialized () const
100 {
101  return !m_pixmap.isNull();
102 }
103 
104 bool SunPlugin::render( GeoPainter *painter, ViewportParams *viewport,
105  const QString& renderPos, GeoSceneLayer * layer )
106 {
107  Q_UNUSED( viewport )
108  Q_UNUSED( renderPos )
109  Q_UNUSED( layer )
110 
111  if( visible() )
112  {
113  const qreal lon = marbleModel()->sunLocator()->getLon();
114  const qreal lat = marbleModel()->sunLocator()->getLat();
115  const GeoDataCoordinates coordinates( lon, lat, 0, GeoDataCoordinates::Degree );
116  painter->drawPixmap( coordinates, m_pixmap );
117  }
118 
119  return true;
120 }
121 
122 }
123 
124 Q_EXPORT_PLUGIN2( SunPlugin, Marble::SunPlugin )
125 
126 #include "SunPlugin.moc"
GeoDataCoordinates.h
Marble::RenderPlugin::visible
bool visible() const
is visible
Marble::GeoDataCoordinates
A 3d point representation.
Definition: GeoDataCoordinates.h:52
Marble::MarbleDirs::path
static QString path(const QString &relativePath)
Definition: MarbleDirs.cpp:59
Marble::SunPlugin::renderPosition
QStringList renderPosition() const
Preferred level in the layer stack for the rendering.
Definition: SunPlugin.cpp:44
Marble::SunPlugin::version
QString version() const
Definition: SunPlugin.cpp:65
Marble::GeoPainter
A painter that allows to draw geometric primitives on the map.
Definition: GeoPainter.h:98
Marble::SunPlugin::guiString
QString guiString() const
String that should be displayed in GUI.
Definition: SunPlugin.cpp:55
MarbleModel.h
This file contains the headers for MarbleModel.
SunPlugin.h
Marble::MarbleModel::sunLocator
SunLocator * sunLocator()
Definition: MarbleModel.cpp:547
Marble::PluginAuthor
Definition: PluginInterface.h:28
Marble::SunPlugin::backendTypes
QStringList backendTypes() const
Returns the name(s) of the backend that the plugin can render This method should return the name of t...
Definition: SunPlugin.cpp:34
SunLocator.h
Marble::SunPlugin::copyrightYears
QString copyrightYears() const
Definition: SunPlugin.cpp:75
Marble::SunPlugin::nameId
QString nameId() const
Returns the unique name of the plugin.
Definition: SunPlugin.cpp:60
QObject::tr
QString tr(const char *sourceText, const char *disambiguation, int n)
Marble::GeoDataCoordinates::Degree
Definition: GeoDataCoordinates.h:66
Marble::SunPlugin::description
QString description() const
Returns a user description of the plugin.
Definition: SunPlugin.cpp:70
Marble::GeoSceneLayer
Layer of a GeoScene document.
Definition: GeoSceneLayer.h:43
Marble::SunLocator::getLat
qreal getLat() const
Definition: SunLocator.cpp:218
MarbleDirs.h
Marble::SunPlugin::isInitialized
bool isInitialized() const
Definition: SunPlugin.cpp:99
Marble::SunPlugin
The class that specifies the Marble layer interface of a plugin.
Definition: SunPlugin.h:27
Marble::SunPlugin::icon
QIcon icon() const
Returns an icon for the plugin.
Definition: SunPlugin.cpp:88
Marble::SunPlugin::name
QString name() const
Returns the user-visible name of the plugin.
Definition: SunPlugin.cpp:50
QPixmap::scaled
QPixmap scaled(int width, int height, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformMode) const
Marble::RenderPlugin::setVisible
void setVisible(bool visible)
settting visible
Definition: RenderPlugin.cpp:151
QString
QList
GeoPainter.h
QStringList
Marble::ViewportParams
A public class that controls what is visible in the viewport of a Marble map.
Definition: ViewportParams.h:44
QPixmap
Q_EXPORT_PLUGIN2
#define Q_EXPORT_PLUGIN2(a, b)
Definition: marble_export.h:34
Marble::SunPlugin::renderPolicy
QString renderPolicy() const
Return how the plugin settings should be used.
Definition: SunPlugin.cpp:39
QPixmap::isNull
bool isNull() const
QSize
Marble::SunPlugin::pluginAuthors
QList< PluginAuthor > pluginAuthors() const
Definition: SunPlugin.cpp:80
Marble::SunPlugin::SunPlugin
SunPlugin()
Definition: SunPlugin.cpp:23
Marble::SunLocator::getLon
qreal getLon() const
Definition: SunLocator.cpp:213
Marble::MarbleModel
The data model (not based on QAbstractModel) for a MarbleWidget.
Definition: MarbleModel.h:97
Marble::SunPlugin::render
bool render(GeoPainter *painter, ViewportParams *viewport, const QString &renderPos, GeoSceneLayer *layer=0)
Renders the content provided by the layer on the viewport.
Definition: SunPlugin.cpp:104
Marble::SunPlugin::initialize
void initialize()
Definition: SunPlugin.cpp:94
Marble::RenderPlugin::marbleModel
const MarbleModel * marbleModel() const
Access to the MarbleModel.
Definition: RenderPlugin.cpp:83
Marble::GeoPainter::drawPixmap
void drawPixmap(const GeoDataCoordinates &centerPosition, const QPixmap &pixmap)
Draws a pixmap at the given position. The pixmap is placed with its center located at the given cente...
Definition: GeoPainter.cpp:452
Marble::RenderPlugin
The abstract class that creates a renderable item.
Definition: RenderPlugin.h:43
QIcon
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:42 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