Exemplo n.º 1
0
void ramPresetTab::disableAllScene()
{
	for (int i=0; i<ramSceneManager::instance().getNumScenes(); i++)
	{
		setEnableScene(i, false);
	}
}
Exemplo n.º 2
0
void ramPresetTab::callPreset(size_t preset_id)
{
	disableAllScene();
	
	static const size_t id_line = ramSceneManager::instance().findtSceneIndex("Line");
	static const size_t id_hasty = ramSceneManager::instance().findtSceneIndex("Hasty Chase");
	static const size_t id_stamp = ramSceneManager::instance().findtSceneIndex("Stamp");
	static const size_t id_future = ramSceneManager::instance().findtSceneIndex("Future");
	static const size_t id_particles = ramSceneManager::instance().findtSceneIndex("Particles");
	
	switch (preset_id)
	{
		case 0: // Line
			setEnableScene(id_line, true);
			ramSceneManager::instance().getScene(id_line)->loadPresetXML( ramToResourcePath("Settings/presets/preset.lines.xml") );
			break;
			
		case 1: // Hasty Chase
			setEnableScene(id_hasty, true);
			ramSceneManager::instance().getScene(id_hasty)->loadPreset(0);
			break;
			
		case 2: // HC + Stamp
			setEnableScene(id_hasty, true);
			setEnableScene(id_stamp, true);
			ramSceneManager::instance().getScene(id_hasty)->loadPreset(0);
			ramSceneManager::instance().getScene(id_stamp)->loadPreset();
			break;
			
		case 3: // HC + Stamp + Natto
			setEnableScene(id_hasty, true);
			setEnableScene(id_stamp, true);
			ramSceneManager::instance().getScene(id_hasty)->loadPreset(1);
			ramSceneManager::instance().getScene(id_stamp)->loadPreset();
			break;
			
		case 4: // HC + Future
			setEnableScene(id_hasty, true);
			setEnableScene(id_future, true);
			ramSceneManager::instance().getScene(id_hasty)->loadPreset(0);
			ramSceneManager::instance().getScene(id_future)->loadPreset();
			break;
			
		case 5: // Line + Future
			setEnableScene(id_line, true);
			setEnableScene(id_future, true);
			ramSceneManager::instance().getScene(id_line)->loadPresetXML( ramToResourcePath("Settings/presets/preset.lines.xml") );
			ramSceneManager::instance().getScene(id_future)->loadPreset();
			break;
			
		case 6: // Particles + Future
			setEnableScene(id_particles, true);
			setEnableScene(id_future, true);
			ramSceneManager::instance().getScene(id_particles)->loadPreset();
			ramSceneManager::instance().getScene(id_future)->loadPreset();
			break;
			
		case 7: // Particles
			setEnableScene(id_particles, true);
			ramSceneManager::instance().getScene(id_particles)->loadPreset();
			break;
	}
}
Exemplo n.º 3
0
void Scenery3d::loadSceneCompleted()
{
	S3DScene* result = currentLoadFuture.result();

	progressBar->setValue(100);
	StelApp::getInstance().removeProgressBar(progressBar);
	progressBar=Q_NULLPTR;

	if(!result)
	{
		showMessage(q_("Could not load scene, please check log for error messages!"));
		return;
	}
	else
		showMessage(q_("Scene successfully loaded."));

	//do stuff that requires the main thread
	const SceneInfo& info = result->getSceneInfo();

	//move to the location specified by the scene
	LandscapeMgr* lmgr = GETSTELMODULE(LandscapeMgr);
	bool landscapeSetsLocation=lmgr->getFlagLandscapeSetsLocation();
	lmgr->setFlagLandscapeSetsLocation(true);
	lmgr->setCurrentLandscapeName(info.landscapeName, 0.); // took a second, implicitly.
	// Switched to immediate landscape loading: Else,
	// Landscape and Navigator at this time have old coordinates! But it should be possible to
	// delay rot_z computation up to this point and live without an own location section even
	// with meridian_convergence=from_grid.
	lmgr->setFlagLandscapeSetsLocation(landscapeSetsLocation); // restore


	if (info.hasLocation())
	{
		qCDebug(scenery3d) << "Setting location to given coordinates";
		StelApp::getInstance().getCore()->moveObserverTo(*info.location, 0., 0.);
	}
	else qCDebug(scenery3d) << "No coordinates given in scenery3d.ini";

	if (info.hasLookAtFOV())
	{
		qCDebug(scenery3d) << "Setting orientation";
		Vec3f lookat=currentLoadScene.lookAt_fov;
		// This vector is (az_deg, alt_deg, fov_deg)
		Vec3d v;
		StelUtils::spheToRect(lookat[0]*M_PI/180.0, lookat[1]*M_PI/180.0, v);
		mvMgr->setViewDirectionJ2000(StelApp::getInstance().getCore()->altAzToJ2000(v, StelCore::RefractionOff));
		mvMgr->zoomTo(lookat[2]);
	} else qCDebug(scenery3d) << "No orientation given in scenery3d.ini";

	//clear loading scene
	currentLoadScene = SceneInfo();
	emit loadingSceneIDChanged(QString());

	//switch scenes
	delete currentScene;
	currentScene = result;

	//show the scene
	setEnableScene(true);

	emit currentSceneChanged(info);
	emit currentSceneIDChanged(info.id);
}