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 02-23-2011, 05:50 AM   #1
fatman
Junior Member
 
Join Date: Feb 2011
Posts: 6
fatman is on a distinguished road
Default Lock Axis, No tilt

Hello,

How can I programmatically lock the axis so that the user cannot use the right button to tilt the globe in my application?

Thanks,
Matt
fatman is offline   Reply With Quote
Old 02-23-2011, 08:26 PM   #2
nlneilson
Super Moderator
 
Join Date: Nov 2006
Location: Mojave & Oxnard California
Posts: 2,617
nlneilson is on a distinguished road
Default

Do a search in the SDK for:
RIGHT_PRESS
DragSelectEvent
pitch

../doc/gov/nasa/worldwind/event/DragSelectEvent.html

..\src\gov\nasa\worldwind\View.java
void setPitch(Angle pitch);

gov.nasa.worldwind.animation.Animator;
gov.nasa.worldwind.awt.ViewInputHandler;

I set my pitch (from horizontal) like this:
view.setPitch(Angle.fromDegrees(90 - dPitch));

There should several ways to disable the user from changing the pitch.
I have never done that but at least gave you places to look.
nlneilson is offline   Reply With Quote
Old 02-24-2011, 01:11 PM   #3
Straider
Guest
 
Posts: n/a
Default

the easiest way is probably to add this line in your worldwind canvas:


getView().getViewPropertyLimits().setPit chLimits(Angle.ZERO, Angle.ZERO);

limits the pitch to look straight down onto the earth. but you can set it to any Angle you want.
  Reply With Quote
Old 02-25-2011, 09:20 PM   #4
tag
WWJ Technical Manager
 
Join Date: May 2007
Location: Seattle
Posts: 1,027
tag is on a distinguished road
Default

Register a mouse handler with WW's input handler and mark consumed the events you don't want handled. Look at the LineBuilder example to see how to install your mouse handler.
tag is offline   Reply With Quote
Old 03-24-2011, 04:17 PM   #5
fatman
Junior Member
 
Join Date: Feb 2011
Posts: 6
fatman is on a distinguished road
Default

Quote:
Originally Posted by Straider View Post
the easiest way is probably to add this line in your worldwind canvas:


getView().getViewPropertyLimits().setPit chLimits(Angle.ZERO, Angle.ZERO);

limits the pitch to look straight down onto the earth. but you can set it to any Angle you want.

Worked like a charm! Thank you all for your replies!
fatman is offline   Reply With Quote
Old 04-01-2011, 05:36 AM   #6
bluefooz
Junior Member
 
Join Date: Mar 2011
Posts: 4
bluefooz is on a distinguished road
Default

Cool, what a timely thread - I'm using this solution also. Thanks Matt, thanks Straider.
bluefooz is offline   Reply With Quote
Old 04-05-2011, 09:57 PM   #7
fatman
Junior Member
 
Join Date: Feb 2011
Posts: 6
fatman is on a distinguished road
Default

Quote:
Originally Posted by tag View Post
Register a mouse handler with WW's input handler and mark consumed the events you don't want handled. Look at the LineBuilder example to see how to install your mouse handler.

Double thanks! While I took the quick and lazy solution to my original problem, this bit of direction pushed me in the right direction for another task - how to use a button to toggle mouse navigation on and off!
fatman is offline   Reply With Quote
Old 07-06-2012, 04:52 PM   #8
KBub
Junior Member
 
Join Date: Jun 2012
Posts: 10
KBub is on a distinguished road
Default

I am trying to create a button that toggles a generic view. (For example profile view or top down view.) I get a 'getView() is undefined' error when I try the command line above.

help please? I've tried setView() too. I'm really just stabbing in the dark now cuz none of the commands from the library I found seem to work anymore.

WS: MAC OS X 10.7
KBub is offline   Reply With Quote
Old 07-06-2012, 06:01 PM   #9
KBub
Junior Member
 
Join Date: Jun 2012
Posts: 10
KBub is on a distinguished road
Default

Figured it out!

BasicOrbitView view = (BasicOrbitView) wwjPanel.getWwd().getView();
view.setZoom(8e4);
view.setPitch(Angle.fromDegrees(0));
KBub is offline   Reply With Quote
Old 07-06-2012, 06:29 PM   #10
nlneilson
Super Moderator
 
Join Date: Nov 2006
Location: Mojave & Oxnard California
Posts: 2,617
nlneilson is on a distinguished road
Default

Quote:
Originally Posted by KBub View Post
Figured it out!

BasicOrbitView view = (BasicOrbitView) wwjPanel.getWwd().getView();
view.setZoom(8e4);
view.setPitch(Angle.fromDegrees(0));
Good you got the code to set the pitch.
From post #2:
I set my pitch (from horizontal) like this:
view.setPitch(Angle.fromDegrees(90 - dPitch));

I should have put this line in also for those that are not familiar:
BasicOrbitView view = (BasicOrbitView) wwjPanel.getWwd().getView();
__________________
Neil
http://www.nlneilson.com
nlneilson is offline   Reply With Quote
Reply


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
tilt and animation question fabio.portieri Development Help 2 01-22-2010 05:50 PM
DirectX Screen Lock Issue beaker Bug Reports 13 08-02-2009 02:58 PM
Tilt and angle on status bar guerreiro.nma Development Help 1 06-18-2009 01:23 PM
Tilt View: Add Distance movement in the Interface canosso Suggestion Box 0 08-23-2005 04:04 PM
Only one part of planet axis visible? Thomas Risan Bug Reports 1 11-27-2004 01:44 PM


All times are GMT +1. The time now is 07:41 PM.


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