World Wind Forums

Go Back   World Wind Forums > WorldWind JAVA forums > Development Help

Development Help Help for building applications or diagnosing problems with WWJ

Reply
 
Thread Tools Display Modes
Old 12-15-2008, 10:17 PM   #1
Unregistered
Guest
 
Posts: n/a
Default [Solved] To compute the zoom in FlyToOrbitViewStateIterator class

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
  Reply With Quote
Old 12-16-2008, 03:27 AM   #2
patmurris
WWJ Consultant
 
patmurris's Avatar
 
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
patmurris is an unknown quantity at this point
Default

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
__________________
My World Wind Java Blog & WW.net Plugins page
patmurris is offline   Reply With Quote
Old 12-16-2008, 09:07 AM   #3
mertk
Member
 
Join Date: Jun 2008
Posts: 34
mertk is on a distinguished road
Default

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
mertk is offline   Reply With Quote
Old 12-16-2008, 09:49 AM   #4
patmurris
WWJ Consultant
 
patmurris's Avatar
 
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
patmurris is an unknown quantity at this point
Default

Thanks merkt, i forgot remleduff did post ready to use code there... right to the point
__________________
My World Wind Java Blog & WW.net Plugins page
patmurris is offline   Reply With Quote
Reply

Tags
fly, sector, zoom


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT +1. The time now is 04:59 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.