//////////////////////////////////////////////////////////////////////////////// // Increment time void StelCore::updateTime(double deltaTime) { JDay+=timeSpeed*deltaTime; // Fix time limits to -100000 to +100000 to prevent bugs if (JDay>38245309.499988) JDay = 38245309.499988; if (JDay<-34803211.500012) JDay = -34803211.500012; if (position->isObserverLifeOver()) { // Unselect if the new home planet is the previously selected object StelObjectMgr* objmgr = GETSTELMODULE(StelObjectMgr); Q_ASSERT(objmgr); if (objmgr->getWasSelected() && objmgr->getSelectedObject()[0].data()==position->getHomePlanet()) { objmgr->unSelect(); } StelObserver* newObs = position->getNextObserver(); delete position; position = newObs; } position->update(deltaTime); // Position of sun and all the satellites (ie planets) SolarSystem* solsystem = (SolarSystem*)StelApp::getInstance().getModuleMgr().getModule("SolarSystem"); solsystem->computePositions(getJDay(), position->getHomePlanet()->getHeliocentricEclipticPos()); }
void ConstellationMgr::selectedObjectChange(StelModule::StelModuleSelectAction action) { StelObjectMgr* omgr = GETSTELMODULE(StelObjectMgr); Q_ASSERT(omgr); const QList<StelObjectP> newSelected = omgr->getSelectedObject(); if (newSelected.empty()) { // Even if do not have anything selected, KEEP constellation selection intact // (allows viewing constellations without distraction from star pointer animation) // setSelected(NULL); return; } const QList<StelObjectP> newSelectedConst = omgr->getSelectedObject("Constellation"); if (!newSelectedConst.empty()) { // If removing this selection if(action == StelModule::RemoveFromSelection) { unsetSelectedConst((Constellation *)newSelectedConst[0].data()); } else { // Add constellation to selected list (do not select a star, just the constellation) setSelectedConst((Constellation *)newSelectedConst[0].data()); } } else { const QList<StelObjectP> newSelectedStar = omgr->getSelectedObject("Star"); if (!newSelectedStar.empty()) { // if (!added) // setSelected(NULL); setSelected(newSelectedStar[0].data()); } else { // if (!added) setSelected(NULL); } } }
void ConstellationMgr::deselectConstellations(void) { selected.clear(); StelObjectMgr* omgr = GETSTELMODULE(StelObjectMgr); Q_ASSERT(omgr); const QList<StelObjectP> currSelection = omgr->getSelectedObject(); if (currSelection.empty()) { return; } QList<StelObjectP> newSelection; foreach(const StelObjectP& obj, currSelection) { if (obj->getType() != "Constellation") { newSelection.push_back(obj); } } omgr->setSelectedObject(newSelection, StelModule::ReplaceSelection); }
void Pulsars::reloadCatalog(void) { bool hasSelection = false; StelObjectMgr* objMgr = GETSTELMODULE(StelObjectMgr); // Whether any pulsar are selected? Save the current selection... const QList<StelObjectP> selectedObject = objMgr->getSelectedObject("Pulsar"); if (!selectedObject.isEmpty()) { // ... unselect current pulsar. hasSelection = true; objMgr->unSelect(); } readJsonFile(); if (hasSelection) { // Restore selection... objMgr->setSelectedObject(selectedObject); } }
void StelCore::moveObserverToSelected() { StelObjectMgr* objmgr = GETSTELMODULE(StelObjectMgr); Q_ASSERT(objmgr); if (objmgr->getWasSelected()) { Planet* pl = dynamic_cast<Planet*>(objmgr->getSelectedObject()[0].data()); if (pl) { // We need to move to the selected planet. Try to generate a location from the current one StelLocation loc = getCurrentLocation(); if (loc.planetName != pl->getEnglishName()) { loc.planetName = pl->getEnglishName(); loc.name = "-"; loc.state = ""; moveObserverTo(loc); LandscapeMgr* landscapeMgr = GETSTELMODULE(LandscapeMgr); if (pl->getEnglishName() == "Solar System Observer") { landscapeMgr->setFlagAtmosphere(false); landscapeMgr->setFlagFog(false); landscapeMgr->setFlagLandscape(false); } else { landscapeMgr->setFlagAtmosphere(pl->hasAtmosphere()); landscapeMgr->setFlagFog(pl->hasAtmosphere()); landscapeMgr->setFlagLandscape(true); } } } } StelMovementMgr* mmgr = GETSTELMODULE(StelMovementMgr); Q_ASSERT(mmgr); mmgr->setFlagTracking(false); }