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

marble

  • sources
  • kde-4.12
  • kdeedu
  • marble
  • src
  • plugins
  • render
  • stars
StarsPlugin.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-2013 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
10 //
11 
12 #include "StarsPlugin.h"
13 
14 #include "ui_StarsConfigWidget.h"
15 #include <QRectF>
16 #include <QSize>
17 #include <QDateTime>
18 #include <QRegion>
19 #include <QContextMenuEvent>
20 #include <QMenu>
21 #include <QColorDialog>
22 
23 #include "MarbleClock.h"
24 #include "MarbleDebug.h"
25 #include "MarbleDirs.h"
26 #include "MarbleModel.h"
27 #include "MarbleWidget.h"
28 #include "AbstractFloatItem.h"
29 #include "GeoPainter.h"
30 #include "Planet.h"
31 #include "SunLocator.h"
32 #include "ViewportParams.h"
33 
34 namespace Marble
35 {
36 
37 StarsPlugin::StarsPlugin( const MarbleModel *marbleModel )
38  : RenderPlugin( marbleModel ),
39  m_nameIndex( 0 ),
40  m_configDialog( 0 ),
41  ui_configWidget( 0 ),
42  m_renderStars( true ),
43  m_renderConstellationLines( true ),
44  m_renderConstellationLabels( true ),
45  m_renderDsos( true ),
46  m_renderDsoLabels( true ),
47  m_renderSun( true ),
48  m_renderEcliptic( true ),
49  m_renderCelestialEquator( true ),
50  m_renderCelestialPole( true ),
51  m_starsLoaded( false ),
52  m_constellationsLoaded( false ),
53  m_dsosLoaded( false ),
54  m_magnitudeLimit( 100 ),
55  m_constellationBrush( Marble::Oxygen::aluminumGray5 ),
56  m_constellationLabelBrush( Marble::Oxygen::aluminumGray5 ),
57  m_dsoLabelBrush( Marble::Oxygen::aluminumGray5 ),
58  m_eclipticBrush( Marble::Oxygen::aluminumGray5 ),
59  m_celestialEquatorBrush( Marble::Oxygen::aluminumGray5 ),
60  m_celestialPoleBrush( Marble::Oxygen::aluminumGray5 ),
61  m_doRender( false )
62 {
63  prepareNames();
64 }
65 
66 QStringList StarsPlugin::backendTypes() const
67 {
68  return QStringList( "stars" );
69 }
70 
71 QString StarsPlugin::renderPolicy() const
72 {
73  return QString( "SPECIFIED_ALWAYS" );
74 }
75 
76 QStringList StarsPlugin::renderPosition() const
77 {
78  return QStringList() << "STARS";
79 }
80 
81 RenderPlugin::RenderType StarsPlugin::renderType() const
82 {
83  return RenderPlugin::ThemeRenderType;
84 }
85 
86 QString StarsPlugin::name() const
87 {
88  return tr( "Stars" );
89 }
90 
91 QString StarsPlugin::guiString() const
92 {
93  return tr( "&Stars" );
94 }
95 
96 QString StarsPlugin::nameId() const
97 {
98  return QString( "stars" );
99 }
100 
101 QString StarsPlugin::version() const
102 {
103  return "1.2";
104 }
105 
106 QString StarsPlugin::description() const
107 {
108  return tr( "A plugin that shows the Starry Sky and the Sun." );
109 }
110 
111 QString StarsPlugin::copyrightYears() const
112 {
113  return "2008-2012";
114 }
115 
116 QList<PluginAuthor> StarsPlugin::pluginAuthors() const
117 {
118  return QList<PluginAuthor>()
119  << PluginAuthor( "Torsten Rahn", "tackat@kde.org" )
120  << PluginAuthor( "Rene Kuettner", "rene@bitkanal.net" )
121  << PluginAuthor( "Timothy Lanzi", "trlanzi@gmail.com" );
122 }
123 
124 QIcon StarsPlugin::icon() const
125 {
126  return QIcon(":/icons/stars.png");
127 }
128 
129 void StarsPlugin::initialize()
130 {
131 }
132 
133 bool StarsPlugin::isInitialized() const
134 {
135  return true;
136 }
137 
138 QDialog *StarsPlugin::configDialog()
139 {
140  if ( !m_configDialog ) {
141  // Initializing configuration dialog
142  m_configDialog = new QDialog();
143  ui_configWidget = new Ui::StarsConfigWidget;
144  ui_configWidget->setupUi( m_configDialog );
145 
146  readSettings();
147 
148  connect( ui_configWidget->m_buttonBox, SIGNAL(accepted()), SLOT(writeSettings()) );
149  connect( ui_configWidget->m_buttonBox, SIGNAL(rejected()), SLOT(readSettings()) );
150 
151  connect( ui_configWidget->m_constellationColorButton, SIGNAL(clicked()), this,
152  SLOT(constellationGetColor()) );
153 
154  connect( ui_configWidget->m_constellationLabelColorButton, SIGNAL(clicked()), this,
155  SLOT(constellationLabelGetColor()) );
156 
157  connect( ui_configWidget->m_dsoLabelColorButton, SIGNAL(clicked()), this,
158  SLOT(dsoLabelGetColor()) );
159 
160  connect( ui_configWidget->m_eclipticColorButton, SIGNAL(clicked()), this,
161  SLOT(eclipticGetColor()) );
162 
163  connect( ui_configWidget->m_celestialEquatorColorButton, SIGNAL(clicked()), this,
164  SLOT(celestialEquatorGetColor()) );
165 
166  connect( ui_configWidget->m_celestialPoleColorButton, SIGNAL(clicked()), this,
167  SLOT(celestialPoleGetColor()) );
168 
169 
170 // FIXME: Could Not Make Apply Button Work.
171 // QPushButton *applyButton = ui_configWidget->m_buttonBox->button( QDialogButtonBox::Apply );
172 // connect( applyButton, SIGNAL(clicked()), this, SLOT(writeSettings()) );
173  }
174  return m_configDialog;
175 }
176 
177 QHash<QString, QVariant> StarsPlugin::settings() const
178 {
179  QHash<QString, QVariant> settings = RenderPlugin::settings();
180 
181  settings["nameIndex"] = m_nameIndex;
182  settings["renderStars"] = m_renderStars;
183  settings["renderConstellationLines"] = m_renderConstellationLines;
184  settings["renderConstellationLabels"] = m_renderConstellationLabels;
185  settings["renderDsos"] = m_renderDsos;
186  settings["renderDsoLabels"] = m_renderDsoLabels;
187  settings["renderSun"] = m_renderSun;
188  settings["renderEcliptic"] = m_renderEcliptic;
189  settings["renderCelestialEquator"] = m_renderCelestialEquator;
190  settings["renderCelestialPole"] = m_renderCelestialPole;
191  settings["magnitudeLimit"] = m_magnitudeLimit;
192  settings["constellationBrush"] = m_constellationBrush.color().rgb();
193  settings["constellationLabelBrush"] = m_constellationLabelBrush.color().rgb();
194  settings["dsoLabelBrush"] = m_dsoLabelBrush.color().rgb();
195  settings["eclipticBrush"] = m_eclipticBrush.color().rgb();
196  settings["celestialEaquatorBrush"] = m_celestialEquatorBrush.color().rgb();
197  settings["celestialPoleBrush"] = m_celestialPoleBrush.color().rgb();
198 
199  return settings;
200 }
201 
202 void StarsPlugin::setSettings( const QHash<QString, QVariant> &settings )
203 {
204  RenderPlugin::setSettings( settings );
205 
206  m_nameIndex = readSetting<int>( settings, "nameIndex", 0 );
207  m_renderStars = readSetting<bool>( settings, "renderStars", true );
208  m_renderConstellationLines = readSetting<bool>( settings, "renderConstellationLines", true );
209  m_renderConstellationLabels = readSetting<bool>( settings, "renderConstellationLabels", true );
210  m_renderDsos = readSetting<bool>( settings, "renderDsos", true );
211  m_renderDsoLabels = readSetting<bool>( settings, "renderDsoLabels", true);
212  m_renderSun = readSetting<bool>( settings, "renderSun", true );
213  m_renderEcliptic = readSetting<bool>( settings, "renderEcliptic", true );
214  m_renderCelestialEquator = readSetting<bool>( settings, "renderCelestialEquator", true );
215  m_renderCelestialPole = readSetting<bool>( settings, "renderCelestialPole", true );
216  m_magnitudeLimit = readSetting<int>( settings, "magnitudeLimit", 100 );
217  QColor const defaultColor = Marble::Oxygen::aluminumGray5;
218  m_constellationBrush = QColor( readSetting<QRgb>( settings, "constellationBrush", defaultColor.rgb() ) );
219  m_constellationLabelBrush = QColor( readSetting<QRgb>( settings, "constellationLabelBrush", defaultColor.rgb()) );
220  m_dsoLabelBrush = QColor( readSetting<QRgb>( settings, "dsoLabelBrush", defaultColor.rgb() ) );
221  m_eclipticBrush = QColor( readSetting<QRgb>( settings, "eclipticBrush", defaultColor.rgb() ) );
222  m_celestialEquatorBrush = QColor( readSetting<QRgb>( settings, "celestialEquatorBrush", defaultColor.rgb() ) );
223  m_celestialPoleBrush = QColor( readSetting<QRgb>( settings, "celestialPoleBrush", defaultColor.rgb() ) );
224 }
225 
226 void StarsPlugin::prepareNames()
227 {
228  // Andromeda
229  m_nativeHash["Andromeda"] = tr("Andromeda");
230  m_abbrHash["Andromeda"] = "And";
231 
232  // Antlia
233  m_nativeHash["Antlia"] = tr("Antlia");
234  m_abbrHash["Antlia"] = "Ant";
235 
236  // Apus
237  m_nativeHash["Apus"] = tr("Apus");
238  m_abbrHash["Apus"] = "Aps";
239 
240  // Aquarius
241  m_nativeHash["Aquarius"] = tr("Aquarius");
242  m_abbrHash["Aquarius"] = "Aqr";
243 
244  // Aquila
245  m_nativeHash["Aquila"] = tr("Aquila");
246  m_abbrHash["Aquila"] = "Aql";
247 
248  // Ara
249  m_nativeHash["Ara"] = tr("Ara");
250  m_abbrHash["Ara"] = "Ara";
251 
252  // Aries
253  m_nativeHash["Aries"] = tr("Aries");
254  m_abbrHash["Aries"] = "Ari";
255 
256  // Auriga
257  m_nativeHash["Auriga"] = tr("Auriga");
258  m_abbrHash["Auriga"] = "Aur";
259 
260  // Boötes
261  m_nativeHash["Boötes"] = tr("Boötes");
262  m_abbrHash["Boötes"] = "Boo";
263 
264  // Caelum
265  m_nativeHash["Caelum"] = tr("Caelum");
266  m_abbrHash["Caelum"] = "Cae";
267 
268  // Camelopardalis
269  m_nativeHash["Camelopardalis"] = tr("Camelopardalis");
270  m_abbrHash["Camelopardalis"] = "Cam";
271 
272  // Cancer
273  m_nativeHash["Cancer"] = tr("Cancer");
274  m_abbrHash["Cancer"] = "Cnc";
275 
276  // Canes Venatici
277  m_nativeHash["Canes Venatici"] = tr("Canes Venatici");
278  m_abbrHash["Canes Venatici"] = "CVn";
279 
280  // Canis Major
281  m_nativeHash["Canis Major"] = tr("Canis Major");
282  m_abbrHash["Canis Major"] = "CMa";
283 
284  // Canis Minor
285  m_nativeHash["Canis Minor"] = tr("Canis Minor");
286  m_abbrHash["Canis Minor"] = "CMi";
287 
288  // Capricornus
289  m_nativeHash["Capricornus"] = tr("Capricornus");
290  m_abbrHash["Capricornus"] = "Cap";
291 
292  // Carina
293  m_nativeHash["Carina"] = tr("Carina");
294  m_abbrHash["Carina"] = "Car";
295 
296  // Cassiopeia
297  m_nativeHash["Cassiopeia"] = tr("Cassiopeia");
298  m_abbrHash["Cassiopeia"] = "Cas";
299 
300  // Centaurus
301  m_nativeHash["Centaurus"] = tr("Centaurus");
302  m_abbrHash["Centaurus"] = "Cen";
303 
304  // Cepheus
305  m_nativeHash["Cepheus"] = tr("Cepheus");
306  m_abbrHash["Cepheus"] = "Cep";
307 
308  // Cetus
309  m_nativeHash["Cetus"] = tr("Cetus");
310  m_abbrHash["Cetus"] = "Cet";
311 
312  // Chamaeleon
313  m_nativeHash["Chamaeleon"] = tr("Chamaeleon");
314  m_abbrHash["Chamaeleon"] = "Cha";
315 
316  // Circinus
317  m_nativeHash["Circinus"] = tr("Circinus");
318  m_abbrHash["Circinus"] = "Cir";
319 
320  // Columba
321  m_nativeHash["Columba"] = tr("Columba");
322  m_abbrHash["Columba"] = "Col";
323 
324  // Coma Berenices
325  m_nativeHash["Coma Berenices"] = tr("Coma Berenices");
326  m_abbrHash["Coma Berenices"] = "Com";
327 
328  // Corona Australis
329  m_nativeHash["Corona Australis"] = tr("Corona Australis");
330  m_abbrHash["Corona Australis"] = "CrA";
331 
332  // Corona Borealis
333  m_nativeHash["Corona Borealis"] = tr("Corona Borealis");
334  m_abbrHash["Corona Borealis"] = "CrB";
335 
336  // Corvus
337  m_nativeHash["Corvus"] = tr("Corvus");
338  m_abbrHash["Corvus"] = "Crv";
339 
340  // Crater
341  m_nativeHash["Crater"] = tr("Crater");
342  m_abbrHash["Crater"] = "Crt";
343 
344  // Crux
345  m_nativeHash["Crux"] = tr("Crux");
346  m_abbrHash["Crux"] = "Cru";
347 
348  // Cygnus
349  m_nativeHash["Cygnus"] = tr("Cygnus");
350  m_abbrHash["Cygnus"] = "Cyg";
351 
352  // Delphinus
353  m_nativeHash["Delphinus"] = tr("Delphinus");
354  m_abbrHash["Delphinus"] = "Del";
355 
356  // Dorado
357  m_nativeHash["Dorado"] = tr("Dorado");
358  m_abbrHash["Dorado"] = "Dor";
359 
360  // Draco
361  m_nativeHash["Draco"] = tr("Draco");
362  m_abbrHash["Draco"] = "Dra";
363 
364  // Equuleus
365  m_nativeHash["Equuleus"] = tr("Equuleus");
366  m_abbrHash["Equuleus"] = "Equ";
367 
368  // Eridanus
369  m_nativeHash["Eridanus"] = tr("Eridanus");
370  m_abbrHash["Eridanus"] = "Eri";
371 
372  // Fornax
373  m_nativeHash["Fornax"] = tr("Fornax");
374  m_abbrHash["Fornax"] = "For";
375 
376  // Gemini
377  m_nativeHash["Gemini"] = tr("Gemini");
378  m_abbrHash["Gemini"] = "Gem";
379 
380  // Grus
381  m_nativeHash["Grus"] = tr("Grus");
382  m_abbrHash["Grus"] = "Gru";
383 
384  // Hercules
385  m_nativeHash["Hercules"] = tr("Hercules");
386  m_abbrHash["Hercules"] = "Her";
387 
388  // Horologium
389  m_nativeHash["Horologium"] = tr("Horologium");
390  m_abbrHash["Horologium"] = "Hor";
391 
392  // Hydra
393  m_nativeHash["Hydra"] = tr("Hydra");
394  m_abbrHash["Hydra"] = "Hya";
395 
396  // Hydrus
397  m_nativeHash["Hydrus"] = tr("Hydrus");
398  m_abbrHash["Hydrus"] = "Hyi";
399 
400  // Indus
401  m_nativeHash["Indus"] = tr("Indus");
402  m_abbrHash["Indus"] = "Ind";
403 
404  // Lacert
405  m_nativeHash["Lacerta"] = tr("Lacerta");
406  m_abbrHash["Lacerta"] = "Lac";
407 
408  // Leo
409  m_nativeHash["Leo"] = tr("Leo");
410  m_abbrHash["Leo"] = "Leo";
411 
412  // Leo Minor
413  m_nativeHash["Leo Minor"] = tr("Leo Minor");
414  m_abbrHash["Leo Minor"] = "LMi";
415 
416  // Lepus
417  m_nativeHash["Lepus"] = tr("Lepus");
418  m_abbrHash["Lepus"] = "Lep";
419 
420  // Libra
421  m_nativeHash["Libra"] = tr("Libra");
422  m_abbrHash["Libra"] = "Lib";
423 
424  // Lupus
425  m_nativeHash["Lupus"] = tr("Lupus");
426  m_abbrHash["Lupus"] = "Lup";
427 
428  // Lynx
429  m_nativeHash["Lynx"] = tr("Lynx");
430  m_abbrHash["Lynx"] = "Lyn";
431 
432  // Lyra
433  m_nativeHash["Lyra"] = tr("Lyra");
434  m_abbrHash["Lyra"] = "Lyr";
435 
436  // Mensa
437  m_nativeHash["Mensa"] = tr("Mensa");
438  m_abbrHash["Mensa"] = "Men";
439 
440  // Microscopium
441  m_nativeHash["Microscopium"] = tr("Microscopium");
442  m_abbrHash["Microscopium"] = "Mic";
443 
444  // Monoceros
445  m_nativeHash["Monoceros"] = tr("Monoceros");
446  m_abbrHash["Monoceros"] = "Mon";
447 
448  // Musca
449  m_nativeHash["Musca"] = tr("Musca");
450  m_abbrHash["Musca"] = "Mus";
451 
452  // Norma
453  m_nativeHash["Norma"] = tr("Norma");
454  m_abbrHash["Norma"] = "Nor";
455 
456  // Octans
457  m_nativeHash["Octans"] = tr("Octans");
458  m_abbrHash["Octans"] = "Oct";
459 
460  // Ophiuchus
461  m_nativeHash["Ophiuchus"] = tr("Ophiuchus");
462  m_abbrHash["Ophiuchus"] = "Oph";
463 
464  // Orion
465  m_nativeHash["Orion"] = tr("Orion");
466  m_abbrHash["Orion"] = "Ori";
467 
468  // Pavo
469  m_nativeHash["Pavo"] = tr("Pavo");
470  m_abbrHash["Pavo"] = "Pav";
471 
472  // Pegasus
473  m_nativeHash["Pegasus"] = tr("Pegasus");
474  m_abbrHash["Pegasus"] = "Peg";
475 
476  // Perseus
477  m_nativeHash["Perseus"] = tr("Perseus");
478  m_abbrHash["Perseus"] = "Per";
479 
480  // Phoenix
481  m_nativeHash["Phoenix"] = tr("Phoenix");
482  m_abbrHash["Phoenix"] = "Phe";
483 
484  // Pictor
485  m_nativeHash["Pictor"] = tr("Pictor");
486  m_abbrHash["Pictor"] = "Pic";
487 
488  // Pisces
489  m_nativeHash["Pisces"] = tr("Pisces");
490  m_abbrHash["Pisces"] = "Psc";
491 
492  // Piscis Austrinus
493  m_nativeHash["Piscis Austrinus"] = tr("Piscis Austrinus");
494  m_abbrHash["Piscis Austrinus"] = "PsA";
495 
496  // Puppis
497  m_nativeHash["Puppis"] = tr("Puppis");
498  m_abbrHash["Puppis"] = "Pup";
499 
500  // Pyxis
501  m_nativeHash["Pyxis"] = tr("Pyxis");
502  m_abbrHash["Pyxis"] = "Pyx";
503 
504  // Reticulum
505  m_nativeHash["Reticulum"] = tr("Reticulum");
506  m_abbrHash["Reticulum"] = "Ret";
507 
508  // Sagitta
509  m_nativeHash["Sagitta"] = tr("Sagitta");
510  m_abbrHash["Sagitta"] = "Sge";
511 
512  // Sagittarius
513  m_nativeHash["Sagittarius"] = tr("Sagittarius");
514  m_abbrHash["Sagittarius"] = "Sgr";
515 
516  // Scorpius
517  m_nativeHash["Scorpius"] = tr("Scorpius");
518  m_abbrHash["Scorpius"] = "Sco";
519 
520  // Sculptor
521  m_nativeHash["Sculptor"] = tr("Sculptor");
522  m_abbrHash["Sculptor"] = "Scl";
523 
524  // Scutum
525  m_nativeHash["Scutum"] = tr("Scutum");
526  m_abbrHash["Scutum"] = "Sct";
527 
528  // Serpens
529  m_nativeHash["Serpens"] = tr("Serpens");
530  m_abbrHash["Serpens"] = "Ser";
531 
532  // Sextans
533  m_nativeHash["Sextans"] = tr("Sextans");
534  m_abbrHash["Sextans"] = "Sex";
535 
536  // Taurus
537  m_nativeHash["Taurus"] = tr("Taurus");
538  m_abbrHash["Taurus"] = "Tau";
539 
540  // Telescopium
541  m_nativeHash["Telescopium"] = tr("Telescopium");
542  m_abbrHash["Telescopium"] = "Tel";
543 
544  // Triangulum
545  m_nativeHash["Triangulum"] = tr("Triangulum");
546  m_abbrHash["Triangulum"] = "Tri";
547 
548  // Triangulum Australe
549  m_nativeHash["Triangulum Australe"] = tr("Triangulum Australe");
550  m_abbrHash["Triangulum Australe"] = "TrA";
551 
552  // Tucana
553  m_nativeHash["Tucana"] = tr("Tucana");
554  m_abbrHash["Tucana"] = "Tuc";
555 
556  // Ursa Major
557  m_nativeHash["Ursa Major"] = tr("Ursa Major");
558  m_abbrHash["Ursa Major"] = "UMa";
559 
560  // Ursa Minor
561  m_nativeHash["Ursa Minor"] = tr("Ursa Minor");
562  m_abbrHash["Ursa Minor"] = "UMi";
563 
564  // Vela
565  m_nativeHash["Vela"] = tr("Vela");
566  m_abbrHash["Vela"] = "Vel";
567 
568  // Virgo
569  m_nativeHash["Virgo"] = tr("Virgo");
570  m_abbrHash["Virgo"] = "Vir";
571 
572  // Volans
573  m_nativeHash["Volans"] = tr("Volans");
574  m_abbrHash["Volans"] = "Vol";
575 
576  // Vulpecula
577  m_nativeHash["Vulpecula"] = tr("Vulpecula");
578  m_abbrHash["Vulpecula"] = "Vul";
579 }
580 
581 QString StarsPlugin::assembledConstellation(const QString &name)
582 {
583  switch (m_nameIndex) {
584  case 0:
585  return name;
586  case 1:
587  return m_nativeHash[name];
588  case 2:
589  return m_abbrHash[name];
590  default:
591  return name;
592  }
593 }
594 
595 void StarsPlugin::readSettings()
596 {
597  if ( !m_configDialog ) {
598  return;
599  }
600 
601  ui_configWidget->constellationNamesComboBox->setCurrentIndex(m_nameIndex);
602 
603  Qt::CheckState const constellationLineState = m_renderConstellationLines ? Qt::Checked : Qt::Unchecked;
604  ui_configWidget->m_viewConstellationLinesCheckbox->setCheckState( constellationLineState );
605 
606  Qt::CheckState const constellationLabelState = m_renderConstellationLabels ? Qt::Checked : Qt::Unchecked;
607  ui_configWidget->m_viewConstellationLabelsCheckbox->setCheckState( constellationLabelState );
608 
609  Qt::CheckState const dsoState = m_renderDsos ? Qt::Checked : Qt::Unchecked;
610  ui_configWidget->m_viewDsosCheckbox->setCheckState( dsoState );
611 
612  Qt::CheckState const dsoLabelState = m_renderDsoLabels ? Qt::Checked : Qt::Unchecked;
613  ui_configWidget->m_viewDsoLabelCheckbox->setCheckState( dsoLabelState );
614 
615  Qt::CheckState const sunState = m_renderSun ? Qt::Checked : Qt::Unchecked;
616  ui_configWidget->m_viewSunCheckbox->setCheckState( sunState );
617 
618  Qt::CheckState const eclipticState = m_renderEcliptic ? Qt::Checked : Qt::Unchecked;
619  ui_configWidget->m_viewEclipticCheckbox->setCheckState( eclipticState );
620 
621  Qt::CheckState const celestialEquatorState = m_renderCelestialEquator ? Qt::Checked : Qt::Unchecked;
622  ui_configWidget->m_viewCelestialEquatorCheckbox->setCheckState( celestialEquatorState );
623 
624  Qt::CheckState const celestialPoleState = m_renderCelestialPole ? Qt::Checked : Qt::Unchecked;
625  ui_configWidget->m_viewCelestialPoleCheckbox->setCheckState( celestialPoleState );
626 
627 
628  int magState = m_magnitudeLimit;
629  if ( magState < ui_configWidget->m_magnitudeSlider->minimum() ) {
630  magState = ui_configWidget->m_magnitudeSlider->minimum();
631  }
632  else if ( magState > ui_configWidget->m_magnitudeSlider->maximum() ) {
633  magState = ui_configWidget->m_magnitudeSlider->maximum();
634  }
635 
636  ui_configWidget->m_magnitudeSlider->setValue(magState);
637 
638  QPalette constellationPalette;
639  constellationPalette.setColor( QPalette::Button, m_constellationBrush.color() );
640  ui_configWidget->m_constellationColorButton->setPalette( constellationPalette );
641 
642  QPalette constellationLabelPalette;
643  constellationLabelPalette.setColor( QPalette::Button, m_constellationLabelBrush.color() );
644  ui_configWidget->m_constellationLabelColorButton->setPalette( constellationLabelPalette );
645 
646  QPalette dsoLabelPalette;
647  dsoLabelPalette.setColor( QPalette::Button, m_dsoLabelBrush.color() );
648  ui_configWidget->m_dsoLabelColorButton->setPalette( dsoLabelPalette );
649 
650  QPalette eclipticPalette;
651  eclipticPalette.setColor( QPalette::Button, m_eclipticBrush.color() );
652  ui_configWidget->m_eclipticColorButton->setPalette( eclipticPalette );
653 
654  QPalette celestialEquatorPalette;
655  celestialEquatorPalette.setColor( QPalette::Button, m_celestialEquatorBrush.color() );
656  ui_configWidget->m_celestialEquatorColorButton->setPalette( celestialEquatorPalette );
657 
658  QPalette celestialPolePalette;
659  celestialPolePalette.setColor( QPalette::Button, m_celestialPoleBrush.color() );
660  ui_configWidget->m_celestialPoleColorButton->setPalette( celestialPolePalette );
661 
662 
663 }
664 
665 void StarsPlugin::writeSettings()
666 {
667  m_nameIndex = ui_configWidget->constellationNamesComboBox->currentIndex();
668  m_renderConstellationLines = ui_configWidget->m_viewConstellationLinesCheckbox->checkState() == Qt::Checked;
669  m_renderConstellationLabels = ui_configWidget->m_viewConstellationLabelsCheckbox->checkState() == Qt::Checked;
670  m_renderDsos = ui_configWidget->m_viewDsosCheckbox->checkState() == Qt::Checked;
671  m_renderDsoLabels = ui_configWidget->m_viewDsoLabelCheckbox->checkState() == Qt::Checked;
672  m_renderSun = ui_configWidget->m_viewSunCheckbox->checkState() == Qt::Checked;
673  m_renderEcliptic = ui_configWidget->m_viewEclipticCheckbox->checkState() == Qt::Checked;
674  m_renderCelestialEquator = ui_configWidget->m_viewCelestialEquatorCheckbox->checkState() == Qt::Checked;
675  m_renderCelestialPole = ui_configWidget->m_viewCelestialPoleCheckbox->checkState() == Qt::Checked;
676  m_magnitudeLimit = ui_configWidget->m_magnitudeSlider->value();
677  m_constellationBrush = QBrush( ui_configWidget->m_constellationColorButton->palette().color( QPalette::Button) );
678  m_constellationLabelBrush = QBrush( ui_configWidget->m_constellationLabelColorButton->palette().color( QPalette::Button) );
679  m_dsoLabelBrush = QBrush( ui_configWidget->m_dsoLabelColorButton->palette().color( QPalette::Button) );
680  m_eclipticBrush = QBrush( ui_configWidget->m_eclipticColorButton->palette().color( QPalette::Button) );
681  m_celestialEquatorBrush = QBrush( ui_configWidget->m_celestialEquatorColorButton->palette().color( QPalette::Button) );
682  m_celestialPoleBrush = QBrush( ui_configWidget->m_celestialPoleColorButton->palette().color( QPalette::Button) );
683  emit settingsChanged( nameId() );
684 }
685 
686 void StarsPlugin::constellationGetColor()
687 {
688  const QColor c = QColorDialog::getColor( m_constellationBrush.color(), 0, tr("Please choose the color for the constellation lines.") );
689 
690  if ( c.isValid() ) {
691  QPalette palette = ui_configWidget->m_constellationColorButton->palette();
692  palette.setColor( QPalette::Button, c );
693  ui_configWidget->m_constellationColorButton->setPalette( palette );
694  }
695 }
696 
697 void StarsPlugin::constellationLabelGetColor()
698 {
699  const QColor c = QColorDialog::getColor( m_constellationLabelBrush.color(), 0, tr("Please choose the color for the constellation labels.") );
700 
701  if ( c.isValid() ) {
702  QPalette palette = ui_configWidget->m_constellationLabelColorButton->palette();
703  palette.setColor( QPalette::Button, c );
704  ui_configWidget->m_constellationLabelColorButton->setPalette( palette );
705  }
706 }
707 
708 void StarsPlugin::dsoLabelGetColor()
709 {
710  const QColor c = QColorDialog::getColor( m_dsoLabelBrush.color(), 0, tr("Please choose the color for the dso labels.") );
711 
712  if ( c.isValid() ) {
713  QPalette palette = ui_configWidget->m_dsoLabelColorButton->palette();
714  palette.setColor( QPalette::Button, c );
715  ui_configWidget->m_dsoLabelColorButton->setPalette( palette );
716  }
717 }
718 
719 void StarsPlugin::eclipticGetColor()
720 {
721  const QColor c = QColorDialog::getColor( m_eclipticBrush.color(), 0, tr("Please choose the color for the ecliptic.") );
722 
723  if ( c.isValid() ) {
724  QPalette palette = ui_configWidget->m_eclipticColorButton->palette();
725  palette.setColor( QPalette::Button, c );
726  ui_configWidget->m_eclipticColorButton->setPalette( palette );
727  }
728 }
729 
730 void StarsPlugin::celestialEquatorGetColor()
731 {
732  const QColor c = QColorDialog::getColor( m_celestialEquatorBrush.color(), 0, tr("Please choose the color for the celestial equator.") );
733 
734  if ( c.isValid() ) {
735  QPalette palette = ui_configWidget->m_celestialEquatorColorButton->palette();
736  palette.setColor( QPalette::Button, c );
737  ui_configWidget->m_celestialEquatorColorButton->setPalette( palette );
738  }
739 }
740 
741 void StarsPlugin::celestialPoleGetColor()
742 {
743  const QColor c = QColorDialog::getColor( m_celestialPoleBrush.color(), 0, tr("Please choose the color for the celestial equator.") );
744 
745  if ( c.isValid() ) {
746  QPalette palette = ui_configWidget->m_celestialPoleColorButton->palette();
747  palette.setColor( QPalette::Button, c );
748  ui_configWidget->m_celestialPoleColorButton->setPalette( palette );
749  }
750 }
751 
752 void StarsPlugin::loadStars()
753 {
754  //mDebug() << Q_FUNC_INFO;
755  // Load star data
756  m_stars.clear();
757 
758  QFile starFile( MarbleDirs::path( "stars/stars.dat" ) );
759  starFile.open( QIODevice::ReadOnly );
760  QDataStream in( &starFile );
761 
762  // Read and check the header
763  quint32 magic;
764  in >> magic;
765  if ( magic != 0x73746172 ) {
766  return;
767  }
768 
769  // Read the version
770  qint32 version;
771  in >> version;
772  if ( version > 004 ) {
773  mDebug() << "stars.dat: file too new.";
774  return;
775  }
776 
777  if ( version == 003 ) {
778  mDebug() << "stars.dat: file version no longer supported.";
779  return;
780  }
781 
782  int maxid = 0;
783  int id = 0;
784  int starIndex = 0;
785  double ra;
786  double de;
787  double mag;
788  int colorId = 2;
789 
790  mDebug() << "Star Catalog Version " << version;
791 
792  while ( !in.atEnd() ) {
793  if ( version >= 2 ) {
794  in >> id;
795  }
796  if ( id > maxid ) {
797  maxid = id;
798  }
799  in >> ra;
800  in >> de;
801  in >> mag;
802 
803  if ( version >= 4 ) {
804  in >> colorId;
805  }
806 
807  StarPoint star( id, ( qreal )( ra ), ( qreal )( de ), ( qreal )( mag ), colorId );
808  // Create entry in stars database
809  m_stars << star;
810  // Create key,value pair in idHash table to map from star id to
811  // index in star database vector
812  m_idHash[id] = starIndex;
813  // Increment Index for use in hash
814  ++starIndex;
815  }
816 
817  // load the Sun pixmap
818  // TODO: adjust pixmap size according to distance
819  m_pixmapSun.load( MarbleDirs::path( "svg/sun.png" ) );
820 
821  // Load star pixmaps
822  QVector<QPixmap> m_pixBigStars;
823  m_pixBigStars.clear();
824  m_pixBigStars.append(QPixmap(MarbleDirs::path("bitmaps/stars/star_0_blue.png")));
825  m_pixBigStars.append(QPixmap(MarbleDirs::path("bitmaps/stars/star_0_bluewhite.png")));
826  m_pixBigStars.append(QPixmap(MarbleDirs::path("bitmaps/stars/star_0_white.png")));
827  m_pixBigStars.append(QPixmap(MarbleDirs::path("bitmaps/stars/star_0_yellow.png")));
828  m_pixBigStars.append(QPixmap(MarbleDirs::path("bitmaps/stars/star_0_orange.png")));
829  m_pixBigStars.append(QPixmap(MarbleDirs::path("bitmaps/stars/star_0_red.png")));
830  m_pixBigStars.append(QPixmap(MarbleDirs::path("bitmaps/stars/star_0_garnetred.png")));
831 
832  QVector<QPixmap> m_pixSmallStars;
833  m_pixSmallStars.clear();
834  m_pixSmallStars.append(QPixmap(MarbleDirs::path("bitmaps/stars/star_3_blue.png")));
835  m_pixSmallStars.append(QPixmap(MarbleDirs::path("bitmaps/stars/star_3_bluewhite.png")));
836  m_pixSmallStars.append(QPixmap(MarbleDirs::path("bitmaps/stars/star_3_white.png")));
837  m_pixSmallStars.append(QPixmap(MarbleDirs::path("bitmaps/stars/star_3_yellow.png")));
838  m_pixSmallStars.append(QPixmap(MarbleDirs::path("bitmaps/stars/star_3_orange.png")));
839  m_pixSmallStars.append(QPixmap(MarbleDirs::path("bitmaps/stars/star_3_red.png")));
840  m_pixSmallStars.append(QPixmap(MarbleDirs::path("bitmaps/stars/star_3_garnetred.png")));
841 
842 
843  // Pre-Scale Star Pixmaps
844  m_pixN1Stars.clear();
845  for ( int p=0; p < m_pixBigStars.size(); ++p) {
846  int width = 1.0*m_pixBigStars.at(p).width();
847  m_pixN1Stars.append(m_pixBigStars.at(p).scaledToWidth(width,Qt::SmoothTransformation));
848  }
849 
850  m_pixP0Stars.clear();
851  for ( int p=0; p < m_pixBigStars.size(); ++p) {
852  int width = 0.90*m_pixBigStars.at(p).width();
853  m_pixP0Stars.append(m_pixBigStars.at(p).scaledToWidth(width,Qt::SmoothTransformation));
854  }
855 
856  m_pixP1Stars.clear();
857  for ( int p=0; p < m_pixBigStars.size(); ++p) {
858  int width = 0.80*m_pixBigStars.at(p).width();
859  m_pixP1Stars.append(m_pixBigStars.at(p).scaledToWidth(width,Qt::SmoothTransformation));
860  }
861 
862  m_pixP2Stars.clear();
863  for ( int p=0; p < m_pixBigStars.size(); ++p) {
864  int width = 0.70*m_pixBigStars.at(p).width();
865  m_pixP2Stars.append(m_pixBigStars.at(p).scaledToWidth(width,Qt::SmoothTransformation));
866  }
867 
868  m_pixP3Stars.clear();
869  for ( int p=0; p < m_pixSmallStars.size(); ++p) {
870  int width = 14;
871  m_pixP3Stars.append(m_pixSmallStars.at(p).scaledToWidth(width,Qt::SmoothTransformation));
872  }
873 
874  m_pixP4Stars.clear();
875  for ( int p=0; p < m_pixSmallStars.size(); ++p) {
876  int width = 10;
877  m_pixP4Stars.append(m_pixSmallStars.at(p).scaledToWidth(width,Qt::SmoothTransformation));
878  }
879 
880  m_pixP5Stars.clear();
881  for ( int p=0; p < m_pixSmallStars.size(); ++p) {
882  int width = 6;
883  m_pixP5Stars.append(m_pixSmallStars.at(p).scaledToWidth(width,Qt::SmoothTransformation));
884  }
885 
886  m_pixP6Stars.clear();
887  for ( int p=0; p < m_pixSmallStars.size(); ++p) {
888  int width = 4;
889  m_pixP6Stars.append(m_pixSmallStars.at(p).scaledToWidth(width,Qt::SmoothTransformation));
890  }
891 
892  m_pixP7Stars.clear();
893  for ( int p=0; p < m_pixSmallStars.size(); ++p) {
894  int width = 1;
895  m_pixP7Stars.append(m_pixSmallStars.at(p).scaledToWidth(width,Qt::SmoothTransformation));
896  }
897 
898  m_starsLoaded = true;
899 }
900 
901 
902 void StarsPlugin::loadConstellations()
903 {
904  // Load star data
905  m_constellations.clear();
906 
907  QFile constellationFile( MarbleDirs::path( "stars/constellations.dat" ) );
908  constellationFile.open( QIODevice::ReadOnly );
909  QTextStream in( &constellationFile );
910  QString line;
911  QString indexList;
912 
913  while ( !in.atEnd() ) {
914  line = in.readLine();
915 
916  // Check for null line at end of file
917  if ( line.isNull() ) {
918  continue;
919  }
920 
921  // Ignore Comment lines in header and
922  // between constellation entries
923  if ( line.startsWith( '#' ) ) {
924  continue;
925  }
926 
927  indexList = in.readLine();
928 
929  // Make sure we have a valid label and indexList
930  if ( indexList.isNull() ) {
931  break;
932  }
933 
934  Constellation constellation( this, line, indexList );
935  m_constellations << constellation;
936 
937  }
938  m_constellationsLoaded = true;
939 
940 }
941 
942 void StarsPlugin::loadDsos()
943 {
944  // Load star data
945  m_dsos.clear();
946 
947  QFile dsoFile( MarbleDirs::path( "stars/dso.dat" ) );
948  dsoFile.open( QIODevice::ReadOnly );
949  QTextStream in( &dsoFile );
950  QString line;
951 
952  while ( !in.atEnd() ) {
953  line = in.readLine();
954 
955  // Check for null line at end of file
956  if ( line.isNull() ) {
957  continue;
958  }
959 
960  // Ignore Comment lines in header and
961  // between dso entries
962  if ( line.startsWith( '#' ) ) {
963  continue;
964  }
965 
966  QStringList entries = line.split( QLatin1Char( ',' ) );
967 
968  QString id = entries.at( 0 );
969 
970  double raH = entries.at( 1 ).toDouble();
971  double raM = entries.at( 2 ).toDouble();
972  double raS = entries.at( 3 ).toDouble();
973  double decD = entries.at( 4 ).toDouble();
974  double decM = entries.at( 5 ).toDouble();
975  double decS = entries.at( 6 ).toDouble();
976 
977  double raRad = ( raH+raM/60.0+raS/3600.0 )*15.0*M_PI/180.0;
978  double decRad;
979 
980  if ( decD >= 0.0 ) {
981  decRad = ( decD+decM/60.0+decS/3600.0 )*M_PI/180.0;
982  }
983  else {
984  decRad = ( decD-decM/60.0-decS/3600.0 )*M_PI/180.0;
985  }
986 
987  DsoPoint dso( id, ( qreal )( raRad ), ( qreal )( decRad ) );
988  // Create entry in stars database
989  m_dsos << dso;
990  }
991 
992  m_dsoImage.load( MarbleDirs::path( "stars/deepsky.png" ) );
993  m_dsosLoaded = true;
994 }
995 
996 bool StarsPlugin::render( GeoPainter *painter, ViewportParams *viewport,
997  const QString& renderPos, GeoSceneLayer * layer )
998 {
999  Q_UNUSED( renderPos )
1000  Q_UNUSED( layer )
1001 
1002  const bool doRender = !viewport->mapCoversViewport() &&
1003  viewport->projection() == Spherical &&
1004  marbleModel()->planetId() == "earth"; // So far displaying stars is only supported on earth.
1005 
1006  if ( doRender != m_doRender ) {
1007  if ( doRender ) {
1008  connect( marbleModel()->clock(), SIGNAL(timeChanged()),
1009  this, SLOT(requestRepaint()) );
1010  } else {
1011  disconnect( marbleModel()->clock(), SIGNAL(timeChanged()),
1012  this, SLOT(requestRepaint()) );
1013  }
1014 
1015  m_doRender = doRender;
1016  }
1017 
1018  painter->save();
1019 
1020  QDateTime currentDateTime = marbleModel()->clockDateTime();
1021 
1022  qreal gmst = siderealTime( currentDateTime );
1023  qreal skyRotationAngle = gmst / 12.0 * M_PI;
1024 
1025  const qreal centerLon = viewport->centerLongitude();
1026  const qreal centerLat = viewport->centerLatitude();
1027 
1028  const qreal skyRadius = 0.6 * sqrt( ( qreal )viewport->width() * viewport->width() + viewport->height() * viewport->height() );
1029 
1030  if ( doRender ) {
1031 
1032  // Delayed initialization:
1033  // Load the star database only if the sky is actually being painted...
1034  if ( !m_starsLoaded ) {
1035  loadStars();
1036  m_starsLoaded = true;
1037  }
1038 
1039  if ( !m_constellationsLoaded ) {
1040  loadConstellations();
1041  m_constellationsLoaded = true;
1042  }
1043 
1044  if ( !m_dsosLoaded ) {
1045  loadDsos();
1046  m_dsosLoaded = true;
1047  }
1048 
1049  const qreal earthRadius = viewport->radius();
1050 
1051  // List of Pens used to draw the sky
1052  QPen polesPen( m_celestialPoleBrush, 2, Qt::SolidLine );
1053  QPen constellationPenSolid( m_constellationBrush, 1, Qt::SolidLine );
1054  QPen constellationPenDash( m_constellationBrush, 1, Qt::DashLine );
1055  QPen constellationLabelPen( m_constellationLabelBrush, 1, Qt::SolidLine );
1056  QPen eclipticPen( m_eclipticBrush, 1, Qt::DotLine );
1057  QPen equatorPen( m_celestialEquatorBrush, 1, Qt::DotLine );
1058  QPen dsoLabelPen (m_dsoLabelBrush, 1, Qt::SolidLine);
1059 
1060 
1061  const Quaternion skyAxis = Quaternion::fromEuler( -centerLat , centerLon + skyRotationAngle, 0.0 );
1062  matrix skyAxisMatrix;
1063  skyAxis.inverse().toMatrix( skyAxisMatrix );
1064 
1065  if ( m_renderCelestialPole ) {
1066 
1067  polesPen.setWidth( 2 );
1068  painter->setPen( polesPen );
1069 
1070  Quaternion qpos1;
1071  qpos1 = Quaternion::fromSpherical( 0, 90 * DEG2RAD );
1072  qpos1.rotateAroundAxis( skyAxisMatrix );
1073 
1074  if ( qpos1.v[Q_Z] < 0 ) {
1075  const int x1 = ( int )( viewport->width() / 2 + skyRadius * qpos1.v[Q_X] );
1076  const int y1 = ( int )( viewport->height() / 2 - skyRadius * qpos1.v[Q_Y] );
1077  painter->drawLine( x1, y1, x1+10, y1 );
1078  painter->drawLine( x1+5, y1-5, x1+5, y1+5 );
1079  painter->drawText( x1+8, y1+12, "NP" );
1080  }
1081 
1082  Quaternion qpos2;
1083  qpos2 = Quaternion::fromSpherical( 0, -90 * DEG2RAD );
1084  qpos2.rotateAroundAxis( skyAxisMatrix );
1085  if ( qpos2.v[Q_Z] < 0 ) {
1086  const int x1 = ( int )( viewport->width() / 2 + skyRadius * qpos2.v[Q_X] );
1087  const int y1 = ( int )( viewport->height() / 2 - skyRadius * qpos2.v[Q_Y] );
1088  painter->drawLine( x1, y1, x1+10, y1 );
1089  painter->drawLine( x1+5, y1-5, x1+5, y1+5 );
1090  painter->drawText( x1+8, y1+12, "SP" );
1091  }
1092  }
1093 
1094  if( m_renderEcliptic ) {
1095  const Quaternion eclipticAxis = Quaternion::fromEuler( 0.0, 0.0, -marbleModel()->planet()->epsilon() );
1096  matrix eclipticAxisMatrix;
1097  (eclipticAxis * skyAxis).inverse().toMatrix( eclipticAxisMatrix );
1098 
1099  painter->setPen(eclipticPen);
1100 
1101  int previousX = -1;
1102  int previousY = -1;
1103  for ( int i = 0; i <= 36; ++i) {
1104  Quaternion qpos;
1105  qpos = Quaternion::fromSpherical( i * 10 * DEG2RAD, 0 );
1106  qpos.rotateAroundAxis( eclipticAxisMatrix );
1107 
1108  int x = ( int )( viewport->width() / 2 + skyRadius * qpos.v[Q_X] );
1109  int y = ( int )( viewport->height() / 2 - skyRadius * qpos.v[Q_Y] );
1110 
1111  if ( qpos.v[Q_Z] < 0 && previousX >= 0 ) painter->drawLine(previousX, previousY, x, y);
1112 
1113  previousX = x;
1114  previousY = y;
1115  }
1116  }
1117 
1118  if( m_renderCelestialEquator ) {
1119  painter->setPen(equatorPen);
1120 
1121  int previousX = -1;
1122  int previousY = -1;
1123  for ( int i = 0; i <= 36; ++i) {
1124  Quaternion qpos;
1125  qpos = Quaternion::fromSpherical( i * 10 * DEG2RAD, 0 );
1126  qpos.rotateAroundAxis( skyAxisMatrix );
1127 
1128  int x = ( int )( viewport->width() / 2 + skyRadius * qpos.v[Q_X] );
1129  int y = ( int )( viewport->height() / 2 - skyRadius * qpos.v[Q_Y] );
1130 
1131  if ( qpos.v[Q_Z] < 0 && previousX > 0 ) painter->drawLine(previousX, previousY, x, y);
1132 
1133  previousX = x;
1134  previousY = y;
1135  }
1136  }
1137 
1138  if ( m_renderDsos ) {
1139  painter->setPen(dsoLabelPen);
1140  // Render Deep Space Objects
1141  for ( int d = 0; d < m_dsos.size(); ++d ) {
1142  Quaternion qpos = m_dsos.at( d ).quaternion();
1143  qpos.rotateAroundAxis( skyAxisMatrix );
1144 
1145  if ( qpos.v[Q_Z] > 0 ) {
1146  continue;
1147  }
1148 
1149  qreal earthCenteredX = qpos.v[Q_X] * skyRadius;
1150  qreal earthCenteredY = qpos.v[Q_Y] * skyRadius;
1151 
1152  // Don't draw high placemarks (e.g. satellites) that aren't visible.
1153  if ( qpos.v[Q_Z] < 0
1154  && ( ( earthCenteredX * earthCenteredX
1155  + earthCenteredY * earthCenteredY )
1156  < earthRadius * earthRadius ) ) {
1157  continue;
1158  }
1159 
1160  // Let (x, y) be the position on the screen of the placemark..
1161  const int x = ( int )( viewport->width() / 2 + skyRadius * qpos.v[Q_X] );
1162  const int y = ( int )( viewport->height() / 2 - skyRadius * qpos.v[Q_Y] );
1163 
1164  // Skip placemarks that are outside the screen area
1165  if ( x < 0 || x >= viewport->width() ||
1166  y < 0 || y >= viewport->height() ) {
1167  continue;
1168  }
1169 
1170  // Hard Code DSO Size for now
1171  qreal size = 20;
1172 
1173  // Center Image on x,y location
1174  painter->drawImage( QRectF( x-size/2, y-size/2, size, size ),m_dsoImage );
1175  if (m_renderDsoLabels) {
1176  painter->drawText( x+8, y+12, m_dsos.at( d ).id() );
1177  }
1178  }
1179  }
1180 
1181  if ( m_renderConstellationLines || m_renderConstellationLabels )
1182  {
1183  // Render Constellations
1184  for ( int c = 0; c < m_constellations.size(); ++c ) {
1185  int xMean = 0;
1186  int yMean = 0;
1187  int endptCount = 0;
1188  painter->setPen( constellationPenSolid );
1189 
1190  for ( int s = 0; s < ( m_constellations.at( c ).size() - 1 ); ++s ) {
1191  int starId1 = m_constellations.at( c ).at( s );
1192  int starId2 = m_constellations.at( c ).at( s + 1 );
1193 
1194  if ( starId1 == -1 || starId2 == -1 ) {
1195  // starId == -1 means we don't draw this segment
1196  continue;
1197  } else if ( starId1 == -2 || starId2 == -2 ) {
1198  painter->setPen( constellationPenDash );
1199  } else if ( starId1 == -3 || starId2 == -3 ) {
1200  painter->setPen( constellationPenSolid );
1201  }
1202 
1203  int idx1 = m_idHash.value( starId1,-1 );
1204  int idx2 = m_idHash.value( starId2,-1 );
1205 
1206 
1207  if ( idx1 < 0 ) {
1208  mDebug() << "unknown star, "
1209  << starId1 << ", in constellation "
1210  << m_constellations.at( c ).name();
1211  continue;
1212  }
1213 
1214  if ( idx2 < 0 ) {
1215  mDebug() << "unknown star, "
1216  << starId1 << ", in constellation "
1217  << m_constellations.at( c ).name();
1218  continue;
1219  }
1220  // Fetch quaternion from star s in constellation c
1221  Quaternion q1 = m_stars.at( idx1 ).quaternion();
1222  // Fetch quaternion from star s+1 in constellation c
1223  Quaternion q2 = m_stars.at( idx2 ).quaternion();
1224 
1225  q1.rotateAroundAxis( skyAxisMatrix );
1226  q2.rotateAroundAxis( skyAxisMatrix );
1227 
1228  if ( q1.v[Q_Z] > 0 || q2.v[Q_Z] > 0 ) {
1229  continue;
1230  }
1231 
1232 
1233  // Let (x, y) be the position on the screen of the placemark..
1234  int x1 = ( int )( viewport->width() / 2 + skyRadius * q1.v[Q_X] );
1235  int y1 = ( int )( viewport->height() / 2 - skyRadius * q1.v[Q_Y] );
1236  int x2 = ( int )( viewport->width() / 2 + skyRadius * q2.v[Q_X] );
1237  int y2 = ( int )( viewport->height() / 2 - skyRadius * q2.v[Q_Y] );
1238 
1239 
1240  xMean = xMean + x1 + x2;
1241  yMean = yMean + y1 + y2;
1242  endptCount = endptCount + 2;
1243 
1244  if ( m_renderConstellationLines ) {
1245  painter->drawLine( x1, y1, x2, y2 );
1246  }
1247 
1248  }
1249 
1250  // Skip constellation labels that are outside the screen area
1251  if ( endptCount > 0 ) {
1252  xMean = xMean / endptCount;
1253  yMean = yMean / endptCount;
1254  }
1255 
1256  if ( endptCount < 1 || xMean < 0 || xMean >= viewport->width()
1257  || yMean < 0 || yMean >= viewport->height() )
1258  continue;
1259 
1260  painter->setPen( constellationLabelPen );
1261  if ( m_renderConstellationLabels ) {
1262  painter->drawText( xMean, yMean, m_constellations.at( c ).name() );
1263  }
1264 
1265  }
1266  }
1267 
1268  // Render Stars
1269 
1270  for ( int s = 0; s < m_stars.size(); ++s ) {
1271  Quaternion qpos = m_stars.at(s).quaternion();
1272 
1273  qpos.rotateAroundAxis( skyAxisMatrix );
1274 
1275  if ( qpos.v[Q_Z] > 0 ) {
1276  continue;
1277  }
1278 
1279  qreal earthCenteredX = qpos.v[Q_X] * skyRadius;
1280  qreal earthCenteredY = qpos.v[Q_Y] * skyRadius;
1281 
1282  // Don't draw high placemarks (e.g. satellites) that aren't visible.
1283  if ( qpos.v[Q_Z] < 0
1284  && ( ( earthCenteredX * earthCenteredX
1285  + earthCenteredY * earthCenteredY )
1286  < earthRadius * earthRadius ) ) {
1287  continue;
1288  }
1289 
1290  // Let (x, y) be the position on the screen of the placemark..
1291  const int x = ( int )( viewport->width() / 2 + skyRadius * qpos.v[Q_X] );
1292  const int y = ( int )( viewport->height() / 2 - skyRadius * qpos.v[Q_Y] );
1293 
1294  // Skip placemarks that are outside the screen area
1295  if ( x < 0 || x >= viewport->width()
1296  || y < 0 || y >= viewport->height() )
1297  continue;
1298 
1299  // Show star if it is brighter than magnitude threshold
1300  if ( m_stars.at(s).magnitude() < m_magnitudeLimit ) {
1301 
1302  // colorId is used to select which pixmap in vector to display
1303  int colorId = m_stars.at(s).colorId();
1304  QPixmap s_pixmap;
1305 
1306  // Magnitude is used to select which pixmap vector (size) to use
1307  if ( m_stars.at(s).magnitude() < -1 ) {
1308  s_pixmap = m_pixN1Stars.at(colorId);
1309  }
1310  else if ( m_stars.at(s).magnitude() < 0 ) {
1311  s_pixmap = m_pixP0Stars.at(colorId);
1312  }
1313  else if ( m_stars.at(s).magnitude() < 1 ) {
1314  s_pixmap = m_pixP1Stars.at(colorId);
1315  }
1316  else if ( m_stars.at(s).magnitude() < 2 ) {
1317  s_pixmap = m_pixP2Stars.at(colorId);
1318  }
1319  else if ( m_stars.at(s).magnitude() < 3 ) {
1320  s_pixmap = m_pixP3Stars.at(colorId);
1321  }
1322  else if ( m_stars.at(s).magnitude() < 4 ) {
1323  s_pixmap = m_pixP4Stars.at(colorId);
1324  }
1325  else if ( m_stars.at(s).magnitude() < 5 ) {
1326  s_pixmap = m_pixP5Stars.at(colorId);
1327  }
1328  else if ( m_stars.at(s).magnitude() < 6 ) {
1329  s_pixmap = m_pixP6Stars.at(colorId);
1330  }
1331  else {
1332  s_pixmap = m_pixP7Stars.at(colorId);
1333  }
1334 
1335  int sizeX = s_pixmap.width();
1336  int sizeY = s_pixmap.height();
1337  painter->drawPixmap( x-sizeX/2, y-sizeY/2 ,s_pixmap );
1338  }
1339  }
1340 
1341 
1342  if ( m_renderSun ) {
1343  // sun
1344  const SunLocator *sun = marbleModel()->sunLocator();
1345  Quaternion::fromEuler( -centerLat , centerLon, 0.0 ).inverse().toMatrix( skyAxisMatrix );
1346  Quaternion qpos = Quaternion::fromSpherical( sun->getLon() * DEG2RAD,
1347  sun->getLat() * DEG2RAD );
1348  qpos.rotateAroundAxis( skyAxisMatrix );
1349 
1350  if ( qpos.v[Q_Z] <= 0 ) {
1351  qreal deltaX = m_pixmapSun.width() / 2.;
1352  qreal deltaY = m_pixmapSun.height() / 2.;
1353  const int x = (int)(viewport->width() / 2 + skyRadius * qpos.v[Q_X]);
1354  const int y = (int)(viewport->height() / 2 - skyRadius * qpos.v[Q_Y]);
1355  painter->drawPixmap( x - deltaX, y - deltaY, m_pixmapSun );
1356  }
1357  }
1358  }
1359 
1360  painter->restore();
1361 
1362  return true;
1363 }
1364 
1365 qreal StarsPlugin::siderealTime( const QDateTime& localDateTime )
1366 {
1367  QDateTime utcDateTime = localDateTime.toTimeSpec( Qt::UTC );
1368  qreal mjdUtc = ( qreal )( utcDateTime.date().toJulianDay() );
1369 
1370  qreal offsetUtcSecs = -utcDateTime.time().secsTo( QTime( 00, 00 ) );
1371  qreal d_days = mjdUtc - 2451545.5;
1372  qreal d = d_days + ( offsetUtcSecs / ( 24.0 * 3600 ) );
1373 
1374  // Appendix A of USNO Circular No. 163 (1981):
1375  // Approximate value for Greenwich mean sidereal time in hours:
1376  // (Loss of precision: 0.1 secs per century)
1377  qreal gmst = 18.697374558 + 24.06570982441908 * d;
1378 
1379  // Range (0..24) for gmst:
1380  return gmst - ( int )( gmst / 24.0 ) * 24.0;
1381 }
1382 
1383 void StarsPlugin::requestRepaint()
1384 {
1385  emit repaintNeeded( QRegion() );
1386 }
1387 
1388 void StarsPlugin::toggleSun()
1389 {
1390  m_renderSun = !m_renderSun;
1391  if ( m_configDialog ) {
1392  ui_configWidget->m_viewSunCheckbox->setChecked( m_renderSun );
1393  }
1394  emit settingsChanged( nameId() );
1395  requestRepaint();
1396 }
1397 
1398 void StarsPlugin::toggleDsos()
1399 {
1400  m_renderDsos = !m_renderDsos;
1401  if ( m_configDialog ) {
1402  ui_configWidget->m_viewDsosCheckbox->setChecked( m_renderDsos );
1403  }
1404  emit settingsChanged( nameId() );
1405  requestRepaint();
1406 }
1407 
1408 void StarsPlugin::toggleDsoLabels()
1409 {
1410  m_renderDsoLabels = !m_renderDsoLabels;
1411  if ( m_configDialog ) {
1412  ui_configWidget->m_viewDsoLabelCheckbox->setChecked( m_renderDsoLabels );
1413  }
1414  emit settingsChanged( nameId() );
1415  requestRepaint();
1416 }
1417 
1418 
1419 void StarsPlugin::toggleConstellationLines()
1420 {
1421  m_renderConstellationLines = !m_renderConstellationLines;
1422  if ( m_configDialog ) {
1423  ui_configWidget->m_viewConstellationLinesCheckbox->setChecked( m_renderConstellationLines );
1424  }
1425  emit settingsChanged( nameId() );
1426  requestRepaint();
1427 }
1428 
1429 void StarsPlugin::toggleConstellationLabels()
1430 {
1431  m_renderConstellationLabels = !m_renderConstellationLabels;
1432  if ( m_configDialog ) {
1433  ui_configWidget->m_viewConstellationLabelsCheckbox->setChecked( m_renderConstellationLabels );
1434  }
1435  emit settingsChanged( nameId() );
1436  requestRepaint();
1437 }
1438 
1439 bool StarsPlugin::eventFilter( QObject *object, QEvent *e )
1440 {
1441  if ( !enabled() || !visible() ) {
1442  return false;
1443  }
1444 
1445  if( e->type() == QEvent::ContextMenu )
1446  {
1447  MarbleWidget *widget = dynamic_cast<MarbleWidget *>( object );
1448  QContextMenuEvent *menuEvent = dynamic_cast<QContextMenuEvent *> ( e );
1449  if( widget && menuEvent )
1450  {
1451  qreal mouseLon, mouseLat;
1452  const bool aboveMap = widget->geoCoordinates( menuEvent->x(), menuEvent->y(),
1453  mouseLon, mouseLat, GeoDataCoordinates::Radian );
1454  if ( aboveMap ) {
1455  return false;
1456  }
1457 
1458  foreach ( AbstractFloatItem *floatItem, widget->floatItems() ) {
1459  if ( floatItem->enabled() && floatItem->visible()
1460  && floatItem->contains( menuEvent->pos() ) )
1461  {
1462  return false;
1463  }
1464  }
1465 
1466  QMenu menu;
1467  QAction *constellationLinesAction = menu.addAction( tr("Show &Constellation Lines"), this, SLOT(toggleConstellationLines()) );
1468  constellationLinesAction->setCheckable( true );
1469  constellationLinesAction->setChecked( m_renderConstellationLines );
1470 
1471  QAction *constellationLabelsAction = menu.addAction( tr("Show Constellation &Labels"), this, SLOT(toggleConstellationLabels()) );
1472  constellationLabelsAction->setCheckable( true );
1473  constellationLabelsAction->setChecked( m_renderConstellationLabels );
1474 
1475  QAction *dsoAction = menu.addAction( tr("Show &Deep Sky Objects"), this, SLOT(toggleDsos()) );
1476  dsoAction->setCheckable( true );
1477  dsoAction->setChecked( m_renderDsos );
1478 
1479  QAction *dsoLabelAction = menu.addAction( tr("Show Deep Sky Object Labels"), this, SLOT(toggleDsoLabels()) );
1480  dsoLabelAction->setCheckable( true );
1481  dsoLabelAction->setChecked( m_renderDsoLabels );
1482 
1483 
1484  QAction *sunAction = menu.addAction( tr("Show &Sun"), this, SLOT(toggleSun()) );
1485  sunAction->setCheckable( true );
1486  sunAction->setChecked( m_renderSun );
1487 
1488  QDialog *dialog = configDialog();
1489  Q_ASSERT( dialog );
1490  menu.addSeparator();
1491  QAction *configAction = menu.addAction( tr( "&Configure..." ) );
1492  connect( configAction, SIGNAL(triggered()), dialog, SLOT(exec()) );
1493 
1494  menu.exec(widget->mapToGlobal(menuEvent->pos()));
1495  return true;
1496  }
1497  return false;
1498  } else {
1499  return RenderPlugin::eventFilter( object, e );
1500  }
1501 }
1502 
1503 }
1504 
1505 Q_EXPORT_PLUGIN2( StarsPlugin, Marble::StarsPlugin )
1506 
1507 #include "StarsPlugin.moc"
Marble::Quaternion::toMatrix
void toMatrix(matrix &m) const
Definition: Quaternion.cpp:222
Marble::StarsPlugin::isInitialized
bool isInitialized() const
Definition: StarsPlugin.cpp:133
Marble::RenderPlugin::enabled
bool enabled
Definition: RenderPlugin.h:51
Marble::RenderPlugin::visible
bool visible() const
is visible
Marble::matrix
xmmfloat matrix[3]
Definition: Quaternion.h:40
Marble::StarsPlugin::writeSettings
void writeSettings()
Definition: StarsPlugin.cpp:665
Marble::AbstractFloatItem::visible
bool visible() const
Check visibility of the float item.
Definition: AbstractFloatItem.cpp:135
Marble::StarsPlugin::description
QString description() const
Returns a user description of the plugin.
Definition: StarsPlugin.cpp:106
Marble::GeoDataCoordinates::Radian
Definition: GeoDataCoordinates.h:65
Marble::MarbleDirs::path
static QString path(const QString &relativePath)
Definition: MarbleDirs.cpp:53
Marble::StarsPlugin::eventFilter
bool eventFilter(QObject *object, QEvent *e)
Definition: StarsPlugin.cpp:1439
Marble::StarsPlugin::render
bool render(GeoPainter *painter, ViewportParams *viewport, const QString &renderPos, GeoSceneLayer *layer=0)
Renders the content provided by the layer on the viewport.
Definition: StarsPlugin.cpp:996
Marble::RenderPlugin::repaintNeeded
void repaintNeeded(QRegion dirtyRegion=QRegion())
This signal is emitted if an update of the view is needed.
QDialog
Marble::StarsPlugin
Definition: StarsPlugin.h:120
Marble::GeoPainter
A painter that allows to draw geometric primitives on the map.
Definition: GeoPainter.h:98
Marble::StarsPlugin::renderPosition
QStringList renderPosition() const
Preferred level in the layer stack for the rendering.
Definition: StarsPlugin.cpp:76
Marble::RenderPlugin::eventFilter
bool eventFilter(QObject *, QEvent *)
Definition: RenderPlugin.cpp:209
MarbleModel.h
This file contains the headers for MarbleModel.
Marble::StarsPlugin::configDialog
QDialog * configDialog()
Returns a pointer to the configuration dialog of the plugin.
Definition: StarsPlugin.cpp:138
AbstractFloatItem.h
Marble::MarbleModel::sunLocator
SunLocator * sunLocator()
Definition: MarbleModel.cpp:477
Marble::MarbleModel::planetId
QString planetId() const
Definition: MarbleModel.cpp:462
Marble::StarsPlugin::celestialPoleGetColor
void celestialPoleGetColor()
Definition: StarsPlugin.cpp:741
Marble::PluginAuthor
Definition: PluginInterface.h:28
Marble::StarsPlugin::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: StarsPlugin.cpp:66
Marble::StarsPlugin::renderPolicy
QString renderPolicy() const
Return how the plugin settings should be used.
Definition: StarsPlugin.cpp:71
Marble::StarsPlugin::dsoLabelGetColor
void dsoLabelGetColor()
Definition: StarsPlugin.cpp:708
Marble::ViewportParams::projection
Projection projection() const
Definition: ViewportParams.cpp:129
SunLocator.h
Planet.h
QObject
MarbleDebug.h
Marble::ViewportParams::height
int height() const
Definition: ViewportParams.cpp:255
Marble::Quaternion::rotateAroundAxis
void rotateAroundAxis(const Quaternion &q)
Definition: Quaternion.cpp:167
Marble::MarbleWidget
A widget class that displays a view of the earth.
Definition: MarbleWidget.h:102
Marble::SunLocator
Definition: SunLocator.h:33
Marble::MarbleGraphicsItem::contains
bool contains(const QPointF &point) const
Returns true if the Item contains point in parent coordinates.
Definition: MarbleGraphicsItem.cpp:110
Marble::GeoSceneLayer
Layer of a GeoScene document.
Definition: GeoSceneLayer.h:43
Marble::ViewportParams::width
int width() const
Definition: ViewportParams.cpp:250
Marble::SunLocator::getLat
qreal getLat() const
Definition: SunLocator.cpp:264
Marble::StarsPlugin::eclipticGetColor
void eclipticGetColor()
Definition: StarsPlugin.cpp:719
Marble::RenderPlugin::settingsChanged
void settingsChanged(QString nameId)
This signal is emitted if the settings of the RenderPlugin changed.
Marble::AbstractFloatItem
The abstract class for float item plugins.
Definition: AbstractFloatItem.h:48
Marble::ViewportParams::mapCoversViewport
bool mapCoversViewport() const
Definition: ViewportParams.cpp:398
MarbleDirs.h
Marble::StarsPlugin::icon
QIcon icon() const
Returns an icon for the plugin.
Definition: StarsPlugin.cpp:124
Marble::StarsPlugin::renderType
virtual RenderType renderType() const
Render type of the plugin.
Definition: StarsPlugin.cpp:81
Marble::StarsPlugin::settings
QHash< QString, QVariant > settings() const
Settings of the plugin.
Definition: StarsPlugin.cpp:177
StarsPlugin.h
Marble::Q_Z
Definition: Quaternion.h:34
GeoPainter.h
Marble::DEG2RAD
const qreal DEG2RAD
Definition: MarbleGlobal.h:200
Marble::ViewportParams
A public class that controls what is visible in the viewport of a Marble map.
Definition: ViewportParams.h:44
epsilon
qreal epsilon
Definition: shp2pn2.cpp:59
Q_EXPORT_PLUGIN2
#define Q_EXPORT_PLUGIN2(a, b)
Definition: marble_export.h:34
Marble::Q_Y
Definition: Quaternion.h:33
Marble::GeoPainter::drawImage
void drawImage(const GeoDataCoordinates &centerPosition, const QImage &image)
Draws an image at the given position. The image is placed with its center located at the given center...
Definition: GeoPainter.cpp:428
Marble::StarsPlugin::version
QString version() const
Definition: StarsPlugin.cpp:101
Marble::StarsPlugin::constellationLabelGetColor
void constellationLabelGetColor()
Definition: StarsPlugin.cpp:697
Marble::Q_X
Definition: Quaternion.h:32
MarbleClock.h
Marble::MarbleModel::clockDateTime
QDateTime clockDateTime() const
Definition: MarbleModel.cpp:620
ViewportParams.h
This file contains the headers for ViewportParams.
Marble::StarsPlugin::guiString
QString guiString() const
String that should be displayed in GUI.
Definition: StarsPlugin.cpp:91
Marble::StarsPlugin::constellationGetColor
void constellationGetColor()
Definition: StarsPlugin.cpp:686
Marble::SunLocator::getLon
qreal getLon() const
Definition: SunLocator.cpp:259
Marble::ViewportParams::centerLatitude
qreal centerLatitude() const
Definition: ViewportParams.cpp:294
Marble::StarsPlugin::celestialEquatorGetColor
void celestialEquatorGetColor()
Definition: StarsPlugin.cpp:730
Marble::GeoPainter::drawText
void drawText(const GeoDataCoordinates &position, const QString &text)
Draws the given text at a given geographic position. The text is drawn starting at the given position...
Definition: GeoPainter.cpp:264
Marble::MarbleModel
The data model (not based on QAbstractModel) for a MarbleWidget.
Definition: MarbleModel.h:96
Marble::StarsPlugin::nameId
QString nameId() const
Returns the unique name of the plugin.
Definition: StarsPlugin.cpp:96
Marble::StarsPlugin::copyrightYears
QString copyrightYears() const
Definition: StarsPlugin.cpp:111
Marble::Quaternion::inverse
Quaternion inverse() const
Definition: Quaternion.cpp:81
Marble::Oxygen::aluminumGray5
QColor const aluminumGray5
Definition: MarbleColors.h:91
Marble::ViewportParams::radius
int radius() const
Definition: ViewportParams.cpp:195
Marble::ViewportParams::centerLongitude
qreal centerLongitude() const
Definition: ViewportParams.cpp:289
Marble::StarsPlugin::initialize
void initialize()
Definition: StarsPlugin.cpp:129
Marble::StarsPlugin::setSettings
void setSettings(const QHash< QString, QVariant > &settings)
Set the settings of the plugin.
Definition: StarsPlugin.cpp:202
Marble::MarbleWidget::geoCoordinates
bool geoCoordinates(int x, int y, qreal &lon, qreal &lat, GeoDataCoordinates::Unit=GeoDataCoordinates::Degree) const
Get the earth coordinates corresponding to a pixel in the widget.
Definition: MarbleWidget.cpp:764
Marble::Quaternion
Definition: Quaternion.h:43
Marble::StarsPlugin::assembledConstellation
QString assembledConstellation(const QString &name)
Definition: StarsPlugin.cpp:581
M_PI
#define M_PI
Definition: GeoDataCoordinates.h:26
Marble::Quaternion::v
xmmfloat v
Definition: Quaternion.h:86
MarbleWidget.h
This file contains the headers for MarbleWidget.
Marble::StarsPlugin::name
QString name() const
Returns the user-visible name of the plugin.
Definition: StarsPlugin.cpp:86
Marble::RenderPlugin::enabled
bool enabled() const
is enabled
mag
double mag(double x[3])
Definition: sgp4ext.cpp:68
Marble::RenderPlugin::ThemeRenderType
Definition: RenderPlugin.h:64
Marble::StarsPlugin::readSettings
void readSettings()
Definition: StarsPlugin.cpp:595
Marble::StarsPlugin::StarsPlugin
StarsPlugin(const MarbleModel *marbleModel=0)
Definition: StarsPlugin.cpp:37
Marble::Spherical
Spherical projection.
Definition: MarbleGlobal.h:45
Marble::RenderPlugin::marbleModel
const MarbleModel * marbleModel() const
Access to the MarbleModel.
Definition: RenderPlugin.cpp:81
Marble::RenderPlugin::settings
virtual QHash< QString, QVariant > settings() const
Settings of the plugin.
Definition: RenderPlugin.cpp:183
Marble::RenderPlugin::RenderType
RenderType
A Type of plugin.
Definition: RenderPlugin.h:59
Marble::mDebug
QDebug mDebug()
a function to replace qDebug() in Marble library code
Definition: MarbleDebug.cpp:31
Marble::MarbleWidget::floatItems
QList< AbstractFloatItem * > floatItems() const
Returns a list of all FloatItems on the widget.
Definition: MarbleWidget.cpp:1290
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
Marble::RenderPlugin::setSettings
virtual void setSettings(const QHash< QString, QVariant > &settings)
Set the settings of the plugin.
Definition: RenderPlugin.cpp:193
Marble::Quaternion::fromEuler
static Quaternion fromEuler(qreal pitch, qreal yaw, qreal roll)
Definition: Quaternion.cpp:89
Marble::StarsPlugin::pluginAuthors
QList< PluginAuthor > pluginAuthors() const
Definition: StarsPlugin.cpp:116
Marble::Quaternion::fromSpherical
static Quaternion fromSpherical(qreal lon, qreal lat)
used to generate Quaternion from longitude and latitude
Definition: Quaternion.cpp:38
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:53 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
  • kstars
  • libkdeedu
  •   keduvocdocument
  • 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