pywwt
pywwt copied to clipboard
Automatically zoom on planet when using set_track_object
At the moment, when using set_track_object
in solar system mode, one still has to zoom in manually to the planet. I believe there is a function gotoTarget
that we may be able to use to do this, but this requires a Place
object and I haven't had a chance to find out how to get such an object for a given planet.
You can construct a place object and fill in the planet name and use gotoTarget. Play around with the options to get what you like.
public static Place Create(string name, double lat, double lng, Classification classification, string constellation, ImageSetType type, double zoomFactor) place.Classification = Classification.SolarSystem
ZoomFactor set to what you are looking for
Name = planet name or moon name
ImageSetType = ImageSetType.SolarSystem (or number 4 as numeric)
Thanks @astrojonathan! I'll re-open this until we implement support for it in PyWWT
@astrojonathan Thank you for the assist; I nearly have this fixed. One more question:
The Place.create
+ gotoTarget
method works for all expected bodies except Earth. When I feed the string Earth
to gotoTarget
, I get this error: TypeError: undefined is not an object (evaluating 'raDec.RA') (line_number=35853, source_id=https://worldwidetelescope.github.io/pywwt/wwtsdk.js)
.
This is in the get_params
method of Place
, which calls Planets.getPlanetLocation
, which in turn calls Planets.getPlanetIDFromName
.
Earth
is one of the entries in the switch
/case
statement of getPlanetIDFromName
, so this method returns 19
.
That value is passed back to getPlanetLocation
to use as an argument when calling AstroCalc.getPlanet
. In the latter method, I see that there's no case
for when the planet ID is 19 (corresponding with Earth).
Is that intentional, and if so, how can I work around it?
@astrojonathan This comment is lower priority than the previous one, but gotoTarget(place, noZoom, instant, trackObject)
is also not working as expected -- I would like a smooth scroll to the planet, but the view changes instantly whether instant
is true or false.
I tried using the .aspx
version of the SDK and got the desired scrolling zoom, so is this something that doesn't work normally with WebGL?