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 08-02-2012, 07:21 PM   #1
dparker
Junior Member
 
Join Date: Jun 2012
Posts: 4
dparker is on a distinguished road
Default Developing layer groups - did I break panning?

Hi forum,

For our project I felt that creating a Layer subclass that's really a LayerList would really simplify layer management in our code. So far, it has. We have a set of layers that the users can manage (add, remove, delete, reorder), but also a lot of layers that should be hidden from this management process such as renderable layers for our track data. The user-managed layers all live in a LayerGroup. A LayerGroup is an implementation of Layer that extends LayerList; its rendering methods simply iterate over its contained layers and forward on the method calls. I was a bit surprised something like this didn't already exist, so my first question is: do layer groups already exist? I may have overlooked an existing implementation. Anyway, it works great so far, but I think there's a catch I didn't anticipate.

One difference between my branch of the application that uses LayerGroups and the main development branch is that clicking and dragging on the globe no longer works right away. Keyboard panning works, but to get mouse panning to work requires clicking and dragging off the globe first (in space). After that, mouse panning works fine. Do the World Wind gurus know why this might be the case? Does any of the code involved with panning need to iterate through the model's layer list to find something? Are there any other disasters awaiting me by doing this? I know this is not a World Wind problem per se, but, for us, this is a greatly useful paradigm, and I wonder if it might benefit other applications beyond ours.
dparker is offline   Reply With Quote
Old 08-03-2012, 12:59 AM   #2
nlneilson
Super Moderator
 
Join Date: Nov 2006
Location: Mojave & Oxnard California
Posts: 2,616
nlneilson is on a distinguished road
Default

Quote:
Originally Posted by dparker View Post
I was a bit surprised something like this didn't already exist, so my first question is: do layer groups already exist?

layers that should be hidden

Are there any other disasters awaiting me by doing this? I know this is not a World Wind problem per se, but, for us, this is a greatly useful paradigm, and I wonder if it might benefit other applications beyond ours.
Do "Search" for Layer Manager. I doubt you are trying to do anything that has not been done before.

Just use a few if blocks and a bool to have a group hidden.

The only thing similar to your "disaster" is the mouse does not have scope in your WWJ window. If that is the case just right click on the window.

Other than the display I have switched to C++. This is what I use to control layers. http://www.nlneilson.com/wwposts/EFB_menu.jpg
Just a few are left (10) in WWJ. You can change the opacity so the layer manager is only visible with a mouse over.
http://www.nlneilson.com/wwposts/LayerManager3.jpg
I had it so even the layer manager was turned off and could be toggled with just the small square in the lower left corner.
http://www.nlneilson.com/wwposts/LayerManager2.jpg

It just takes time but you can do almost anything you want.

edit: Welcome to the forum.
__________________
Neil
http://www.nlneilson.com

Last edited by nlneilson; 08-03-2012 at 01:07 AM.
nlneilson is online now   Reply With Quote
Old 08-03-2012, 01:45 AM   #3
pabercrombie
WW Dev. Team
 
Join Date: Sep 2010
Location: Boston, MA, USA
Posts: 325
pabercrombie is on a distinguished road
Default

I would guess that mouse panning is broken because you're not handling picking correctly. Maybe you're rendering the layers in your LayerGroup correctly during normal rendering, but not rendering them during the pick pass, or something like that. (See here if you're not familiar with the picking process.)

Usually people have a flat list of layers in the Model, and then have a separate "view" representation that puts the layers into groups, or puts them into a hierarchy. For example, the LayerTree included in World Wind includes a tree model in which each node represents a layer. When a node in the tree is enabled or disabled, the corresponding layer is made visible or invisible. You could do the same sort of thing, but have multiple layers attached to a node in the tree.
pabercrombie is offline   Reply With Quote
Old 08-03-2012, 02:06 AM   #4
dparker
Junior Member
 
Join Date: Jun 2012
Posts: 4
dparker is on a distinguished road
Default

It turns out that the "one-image" BMNG layer, a SurfaceImage, is pickable and preventing AWTInputHandler from passing on events to OrbitViewInputHandler. I'm looking into exactly why that is...
dparker is offline   Reply With Quote
Old 08-03-2012, 02:19 AM   #5
dparker
Junior Member
 
Join Date: Jun 2012
Posts: 4
dparker is on a distinguished road
Default

Got it: our LayerGroup class didn't check isPickEnabled() before passing pick() onto its child layers. (I had wrongly assumed that layers were responsible for this check instead of the SceneController.) With that fixed, it works like a charm.
dparker is offline   Reply With Quote
Reply

Tags
layer groups, layers, mouse, panning


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
Model Loader toolshed Development Help 233 08-01-2012 12:31 AM
GetCurrentPosition question... ruso Development Help 19 08-24-2011 04:07 PM
Problems displaying a layer from cache jpralle Development Help 0 11-02-2010 01:27 PM
WW1.3.2-Plugin: Layer Edit canosso Add-ons & Scripts 21 02-27-2010 04:37 AM
GPX to Track and Layer, Waypoints to Layer canosso Add-ons & Scripts 14 03-05-2005 06:37 PM


All times are GMT +1. The time now is 02:44 PM.


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