![]() |
|
|||||||
| Development Help Help for building applications or diagnosing problems with WWJ |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi all,
I have a WorldWindowGLJPanel and I would like to fly on a given Sector (gov.nasa.worldwind.geom.Sector). I have created a Sector like that: Sector sector = new Sector(minlat, maxlat, minlon, maxlon); with (minlat, maxlat, minlon, maxlon) --> Angle. And I use the FlyToOrbitViewStateIterator like that: SloshData sdta = new SloshData(browse, _parent); OrbitView view = (OrbitView) _parent.get_map().get_earth().getView(); Globe globe = _parent.get_map().get_earth().getModel() .getGlobe(); // Use a PanToIterator to go back to initial view postion view.applyStateIterator(FlyToOrbitViewSt ateIterator.createPanToIterator( // The elevation component of 'targetPos' here is not the surface elevation, // so we ignore it when specifying the view center position. view, globe, new Position(sector.getCentroid(), 0), Angle.ZERO, Angle.ZERO, 180000)); But I don't want to use the value 180000 anymore, I would like to automatically compute the elevation to see my whole sector. I tried to search in the JAVA doc of World Wind but I didn't understand how to do that. Could you help me? Thanks a lot!! Last edited by patmurris; 12-16-2008 at 09:51 AM. Reason: Solved |
|
|
|
#2 |
|
WWJ Consultant
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
![]() |
That is a geometry problem you can solve by drawing a circle for the globe and a point outside the circle for the eye. From the eye position you can 'see' a portion of the globe - from one horizon to the opposite one. The farther away the eye is, the larger is the sector you can see - it can grow up to 180 degrees, measured from the globe center.
The half angle of the visible sector is acos(globe radius / (globe radius + eye altitude)). So given an angle, you should be able to figure at what altitude to place the eye... Sorry for the convoluted answer, but this is the kind of 'simple' math you have to deal with when using virtual globes ![]() |
|
|
|
|
|
#3 |
|
Member
Join Date: Jun 2008
Posts: 34
![]() |
http://forum.worldwindcentral.com/sh...ht=zoom+extent
I think it might be usable for you. This thread mentions about how to zoom to a specific extent. You can imagine extent as a sector and also altitude is automatically computed within current sector. Last edited by patmurris; 12-16-2008 at 09:45 AM. Reason: Activated html link |
|
|
|
|
|
#4 |
|
WWJ Consultant
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
![]() |
Thanks merkt, i forgot remleduff did post ready to use code there... right to the point
![]() |
|
|
|
![]() |
| Tags |
| fly, sector, zoom |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| FlyToViewStateIterator.PanToIterator erratic behavior with zoom | maemigh | Development Help | 1 | 02-19-2008 10:52 PM |
| icon visible or not depending on the zoom position | think | Development Help | 2 | 11-21-2007 11:46 AM |
| zoom and latitude change | haddazi | Development Help | 1 | 11-14-2007 04:04 AM |
| How to compute Distance from pixel size | hikme | Development Help | 0 | 08-29-2007 04:40 AM |
| Plugin: Zoom like in Google Earth | 5of0 | Add-on & Script Development | 11 | 05-07-2007 06:38 AM |