Zoom to an object [MovementMgr]

Asked by Mouhcine on 2017-03-18

Hello there,

When you open the search (crtl+F) then select let's say HIP34, the dialog will close then you'll be able to see the star but is there a way to trigger an auto-zoom ?

I am trying to do it using StelApp::getInstance().getCore()->getMovementMgr() ... is it the right way to do it and I just didn't get anyluck yet finding the key ingredient?

or is there a simple more proper way to do it ?

Thank you all !

Question information

Language:
English Edit question
Status:
Solved
For:
Stellarium Edit question
Assignee:
No assignee Edit question
Solved by:
gzotti
Solved:
2017-03-20
Last query:
2017-03-20
Last reply:
2017-03-19
Alexander Wolf (alexwolf) said : #1

No possible auto zoom for Search Tool. But you can use shortcuts for auto zoom after using a Search Tool or use auto zoom in scripts.

What exactly you tried to get?

Mouhcine (mbenchek) said : #2

Hello there, I found a work around:

//I save the maximum FOV;
double max_fov = StelApp::getInstance().getCore()->getMovementMgr()->getMaxFov();

//I set the maximum FOV to Minimum FOV + 0.0001;
StelApp::getInstance().getCore()->getMovementMgr()->setMaxFov(StelApp::getInstance().getCore()->getMovementMgr()->getMinFov()+0.0001);

//I set the maximum FOV back again to previous value
StelApp::getInstance().getCore()->getMovementMgr()->setMaxFov(max_fov);

By setting the maximum fov, the the function setMaxFov will call the private function set FOV and will set it to the new maximum if it is less then the current which allows the auto-zoom.

this allow when I select an object to directly zoom to it.

Best gzotti (georg-zotti) said : #3

Is this really easier than StelMovementMgr::getCurrentFov() (to save for later restoring) and StelMovementMgr::zoomTo()?

Alexander Wolf (alexwolf) said : #4

Just for info - autoZoomIn()/autoZoomOut() are methods especially created for automatic zomming...

Mouhcine (mbenchek) said : #5

Thanks gzotti, that solved my question.