![]() |
|
|||||||
| Development Help Help for building applications or diagnosing problems with WWJ |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Jun 2012
Posts: 4
![]() |
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. |
|
|
|
|
|
#2 | |
|
Super Moderator
Join Date: Nov 2006
Location: Mojave & Oxnard California
Posts: 2,616
![]() |
Quote:
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. Last edited by nlneilson; 08-03-2012 at 01:07 AM. |
|
|
|
|
|
|
#3 |
|
WW Dev. Team
Join Date: Sep 2010
Location: Boston, MA, USA
Posts: 325
![]() |
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. |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Jun 2012
Posts: 4
![]() |
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...
|
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Jun 2012
Posts: 4
![]() |
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.
|
|
|
|
![]() |
| Tags |
| layer groups, layers, mouse, panning |
| 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 |
| 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 |