Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "marblemanager.h"
- #include <MarbleClock.h>
- #include <MarbleModel.h>
- #include <RenderPlugin.h>
- #include <QDebug>
- #include <QtGui/QTreeView>
- MarbleManager::MarbleManager(QWidget* parent) : MarbleWidget(parent)
- {
- }
- void MarbleManager::initialize()
- {
- // Sets free camera
- setShowSunInZenith(false);
- // Loads the OpenStreetMap map
- setMapThemeId("earth/bluemarble/bluemarble.dgml");
- // Sets the camera fixed by default
- // setShowSunInZenith(true);
- // Sets default distance
- setDistance(12000);
- // Sets default zoom
- zoomView(800);
- // Sets default simulation speed
- int speed(1000);
- model()->clock()->setSpeed(speed);
- // Sets initial time
- Qt::DateFormat format = Qt::ISODate;
- QString dateString("2000-01-01T00:00:00");
- QDateTime dateTime = QDateTime::fromString(dateString, format);
- model()->clock()->setDateTime(dateTime);
- // Sets update interval
- int updateInterval(20);
- model()->clock()->setUpdateInterval(updateInterval);
- // Filters the default plugins: satellites, stars and sun
- for (int i = 0; i < renderPlugins().count(); i++){
- if ("stars" == renderPlugins().at(i)->nameId().toAscii() ||
- "sun" == renderPlugins().at(i)->nameId().toAscii() ) {
- renderPlugins().at(i)->setVisible(true);
- renderPlugins().at(i)->setEnabled(true);
- }
- else {
- renderPlugins().at(i)->setVisible(false);
- renderPlugins().at(i)->setEnabled(false);
- }
- }
- show();
- connect(model()->clock(), SIGNAL(timeChanged()), this, SLOT(update()));
- satItem = new SatItem(model()->clock(), model()->treeModel());
- }
- void MarbleManager::update()
- {
- satItem->update();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement