void StarObject::updateCoords( KSNumbers *num, bool , const dms*, const dms*, bool ) {
    //Correct for proper motion of stars.  Determine RA and Dec offsets.
    //Proper motion is given im milliarcsec per year by the pmRA() and pmDec() functions.
    //That is numerically identical to the number of arcsec per millenium, so multiply by
    //KSNumbers::julianMillenia() to find the offsets in arcsec.

    // Correction:  The method below computes the proper motion before the
    // precession.  If we precessed first then the direction of the proper
    // motion correction would depend on how far we've precessed.  -jbb
    double saveRA = ra0().Hours();
    double saveDec = dec0().Degrees();

    double newRA, newDec;

    getIndexCoords( num, &newRA, &newDec );
    newRA /= 15.0;                           // getIndexCoords returns in Degrees, while we want the RA in Hours
    setRA0( newRA );
    setDec0( newDec );

    SkyPoint::updateCoords( num );
    setRA0( saveRA );
    setDec0( saveDec );
}
Beispiel #2
0
void Editor::run()
{
		//temporary//
		gridAmount.x = 6;
		gridAmount.y = 9;
		gridSize.x = 200;
		gridSize.y = 200;
		name = "ValtioValta";
		bool keyPressed = 0;
		mousePressed = 0;
		//temporary//
	while (window.isOpen())
	{
		mousePos  = window.mapPixelToCoords(sf::Vector2i(sf::Mouse::getPosition(window)));
		window.clear();
		draw();
		window.display();
		sf::Event event;
		while (window.pollEvent(event))
		{
			if (event.type == sf::Event::Closed)
			{
				window.close();
			}	
			if (sf::Keyboard::isKeyPressed(sf::Keyboard::A))
			{
				if (keyPressed == 0 )
				{
					setImage(name);
					setGrid();
					int endVal = gridAmount.x*gridAmount.y-cardAmounts.size();
					for (int i = 0; i <endVal; i++)
						{
							cardAmounts.push_back(0);
						}
					keyPressed = 1;
				}
			}
			else if (sf::Keyboard::isKeyPressed(sf::Keyboard::S))
			{
				if(keyPressed == 0)
				{
					save();
				}
			}
			else if (sf::Keyboard::isKeyPressed(sf::Keyboard::L))
			{
				if(keyPressed == 0)
				{
					load();
				}
			}
			else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Add))
			{
				if(keyPressed == 0)
				{
					drawMultiplier+= 0.01;
					resizeImage(drawMultiplier);
					setGrid();
				}
			}
			else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Num0))
			{
				if(keyPressed == 0)
				{
					if (drawMultiplier > 0)
					{
						drawMultiplier-= 0.01;
						resizeImage(drawMultiplier);
						setGrid();
					}
				}
			}
			else
			keyPressed = 0;

			if (sf::Mouse::isButtonPressed(sf::Mouse::Left))
			{
				bool hits = 0;
				for (int i = 0; i < buttons.size(); i++)
				{
					if(mousePressed == 0)
					{
						if (buttons[i].getGlobalBounds().contains(mousePos))
						{
							input.clear();
							inputOn = 1;
							inputTarget = i;
							hits = 1;
						}
					}
				}
				if (!hits)
				{
					inputOn = 0;
					input.clear();
				}
				if (checkCoords() && cardAmounts.size() != 0)
				{
					cardAmounts[getIndexCoords()]++;
				}
				mousePressed = 1;
			}
			else if (sf::Mouse::isButtonPressed(sf::Mouse::Right))
			{
				if (checkCoords() && cardAmounts.size() != 0)
				{
					cardAmounts[getIndexCoords()]--;
				}
				mousePressed = 1;
			}
			else
				mousePressed = 0;
			if (sf::Keyboard::isKeyPressed(sf::Keyboard::Return))
			{
				inputOn = 0;
				input.clear();
			}

			if (event.type == sf::Event::TextEntered && inputOn == 1)
			{
				if (event.text.unicode < 128)
					{
						input.push_back(static_cast<char>(event.text.unicode));
					}
			}


		if (inputOn == 1  && oldInputSize != input.size())
		{
			std::istringstream buffer(input);
			if (inputTarget == 0)
			{
				buffer >> gridAmount.x;
			}
			if (inputTarget == 1)
			{
				buffer >> gridAmount.y;
			}
			if (inputTarget == 2)
			{
				buffer >> gridSize.x;
			}