Advertisement
Guest User

marblemanager.cpp

a guest
May 23rd, 2012
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. #include "marblemanager.h"
  2.  
  3. #include <MarbleClock.h>
  4. #include <MarbleModel.h>
  5. #include <RenderPlugin.h>
  6. #include <QDebug>
  7. #include <QtGui/QTreeView>
  8.  
  9. MarbleManager::MarbleManager(QWidget* parent) : MarbleWidget(parent)
  10. {
  11. }
  12.  
  13. void MarbleManager::initialize()
  14. {
  15. // Sets free camera
  16. setShowSunInZenith(false);
  17. // Loads the OpenStreetMap map
  18. setMapThemeId("earth/bluemarble/bluemarble.dgml");
  19. // Sets the camera fixed by default
  20. // setShowSunInZenith(true);
  21. // Sets default distance
  22. setDistance(12000);
  23. // Sets default zoom
  24. zoomView(800);
  25. // Sets default simulation speed
  26. int speed(1000);
  27. model()->clock()->setSpeed(speed);
  28. // Sets initial time
  29. Qt::DateFormat format = Qt::ISODate;
  30. QString dateString("2000-01-01T00:00:00");
  31. QDateTime dateTime = QDateTime::fromString(dateString, format);
  32. model()->clock()->setDateTime(dateTime);
  33. // Sets update interval
  34. int updateInterval(20);
  35. model()->clock()->setUpdateInterval(updateInterval);
  36. // Filters the default plugins: satellites, stars and sun
  37. for (int i = 0; i < renderPlugins().count(); i++){
  38. if ("stars" == renderPlugins().at(i)->nameId().toAscii() ||
  39. "sun" == renderPlugins().at(i)->nameId().toAscii() ) {
  40. renderPlugins().at(i)->setVisible(true);
  41. renderPlugins().at(i)->setEnabled(true);
  42. }
  43. else {
  44. renderPlugins().at(i)->setVisible(false);
  45. renderPlugins().at(i)->setEnabled(false);
  46. }
  47. }
  48. show();
  49. connect(model()->clock(), SIGNAL(timeChanged()), this, SLOT(update()));
  50. satItem = new SatItem(model()->clock(), model()->treeModel());
  51. }
  52.  
  53. void MarbleManager::update()
  54. {
  55. satItem->update();
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement