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 03-09-2012, 09:45 AM   #1
BuM
Member
 
Join Date: Jan 2012
Posts: 94
BuM is on a distinguished road
Question Layer mask for unexplored area

Hi everyone,

I would like to have a layer mask, which determines which parts of the other layers are visible and which are not. Basically I only want to show those parts of the map, that are already known or "explored" by someone on the globe.

Is this functionality already somewhere available? Haven't seen it anywhere.
If not, what would be the easiest way to implement this?

Thanks and cheers!
BuM is offline   Reply With Quote
Old 03-09-2012, 01:38 PM   #2
bdschubert
Emxsys
 
bdschubert's Avatar
 
Join Date: Dec 2007
Location: Ventura, CA
Posts: 129
bdschubert is on a distinguished road
Default

I've pondered this a little myself. I think you'd want to specify an 'altitude threshold' so that the mask can be built for the layer levels that are visible at or below the given altitude.

Regarding implementation, I'd take a look at gov.nasa.worldwindx.examples.util.cachec leaner.DataCacheViewer and gov.nasa.worldwindx.examples.util.FileSt oreDataSet, which tally up a layer's file size based on age. Perhaps, instead of tallying up the file size, you could build Renderable shapes that outline the extents of the level sets that are within the altitude threshold.
__________________
--Bruce
www.emxsys.com

bdschubert is offline   Reply With Quote
Old 03-13-2012, 09:44 AM   #3
BuM
Member
 
Join Date: Jan 2012
Posts: 94
BuM is on a distinguished road
Default

I think we talk about different things, my problem is not altitude related. Imagine someone going over the globe, seeing the area around him up to a certain distance. Moving over the globe, the areas that he visited and thus knows, gets larger. Pretty much like in many computer games.
Also, this has nothing to do with files, because the mask layer should be built during run time.
BuM is offline   Reply With Quote
Old 03-13-2012, 08:59 PM   #4
heidtmare
Senior Member
 
heidtmare's Avatar
 
Join Date: Feb 2008
Location: Melbourne, FL, USA
Posts: 675
heidtmare is on a distinguished road
Default

Your definitely going to have to create a custom world map that keeps track of your visited sectors and acts accordingly. It world be easier to create an external view, but extending the WorldMap layer is a possibility.

Last edited by heidtmare; 03-14-2012 at 03:07 AM.
heidtmare is offline   Reply With Quote
Old 03-14-2012, 01:31 PM   #5
BuM
Member
 
Join Date: Jan 2012
Posts: 94
BuM is on a distinguished road
Exclamation

WorldMapLayer is responsible for the little world map overview in the upper left corner of the viewport. How is that supposed to help, I suppose you mean something else?
What do you mean by "external view"? Not the view that deals with the camera?

Anyway, in the meantime I tried a few approaches, but to no great avail:

1. I laid a black SurfacePolygon the size of the whole globe over the world and successively enlarged a hole inside it as an innerBoundary, which opens the view to the underlying layers. Actually, I had to extend SurfacePolygon to get easy access to the innerBoundary.
This looks pretty good at first sight, but yields strange effects once the hole covers big parts of the world. Near the poles it fails completely. Also with this approach it would take rather elaborate computations to have several "exploring instances" on the world whose visible parts (holes in the mask) start to overlap. Having different masks for different earth explorers does not work with this approach as one mask would cover the visible parts of the other one and vice versa.

2. I created a SurfaceImageLayer with a black BufferedImage covering the whole world. During exploration I draw transparent pixels into this mask image. Unfortunately, reloading this image takes up to several seconds even at a rather low resolution like 1000x500 pixels, so this is not real time suitable. Part of this long reloading time is the fact that each time the BufferedImage gets written to the hard disk and reloaded from there as a SurfaceImage.

3. I created a RenderableLayer with my own SurfaceImage, which has an underlying black BufferedImage covering the whole world. Similar to the 2nd approach, just avoiding the hard disk writing by handling the SurfaceImage by myself. This is signicantly faster, but still way too slow.
Unfortunately, I could not figure out a way to write directly into the image buffer / cache, so that only the changed parts of the mask have to updated, and not the whole image each time. This limits the feasible size of the SurfaceImage significantly, thus reducing the resolution of the mask to a jagged monster.

Ideal would be a bitmask that could be assigned to each layer or even the whole globe. 1 = visible, 0 = invisible. Are there any plans to implement such a thing?
BuM is offline   Reply With Quote
Old 03-14-2012, 06:58 PM   #6
heidtmare
Senior Member
 
heidtmare's Avatar
 
Join Date: Feb 2008
Location: Melbourne, FL, USA
Posts: 675
heidtmare is on a distinguished road
Default

ok, you are using the globe as your navigation map, i was thinking that the globe was your universe and you could shade the WorldMapLayer to show where you have been.
I just was visualizing it differently.
__________________
Emxsys
 
bdschubert's Avatar
 
Join Date: Dec 2007
Location: Ventura, CA
Posts: 129
bdschubert is on a distinguished road
Default

Quote:
...you could shade the WorldMapLayer to show where you have been
It might be interesting to implement what you've explored as a heatmap on the WorldMapLayer.
__________________
--Bruce
www.emxsys.com

bdschubert is offline   Reply With Quote
Old 03-17-2012, 12:30 AM   #8
pabercrombie
WW Dev. Team
 
Join Date: Sep 2010
Location: Boston, MA, USA
Posts: 325
pabercrombie is on a distinguished road
Default

One way to go about this would be to extend the TiledLayer implementation so that tiles were only visible if they met some criteria specific to your app. To do this you could extend BasicTiledImageLayer and override isTileVisible. A limitation of this approach is that it might be difficult to show or hide only parts of a tile.

Take a look at the DimGlobeSurface example, if you haven't already. This example draws a surface image over the entire globe. It sounds like the challenge that you ran into with your surface image approach is that your image was too large to update frequently. You might consider drawing a surface image over only the part of the earth that is visible, and adjust the resolution as a the eye zooms in and out.
pabercrombie is offline   Reply With Quote
Old 03-20-2012, 09:51 AM   #9
BuM
Member
 
Join Date: Jan 2012
Posts: 94
BuM is on a distinguished road
Default

Hi pabercrombie,

showing/hiding tiles would be really jaggy on a big scale, and the visible area would depend on the zoom, which affects the tile size. Not really suitable.

The DimGlobeSurface example is a nice one, but only works if the whole world shall be covered evenly, thus making the use of a very small SurfaceImage feasible. As soon as you would like to have some structure/unregularities on the surface (such as my visible areas), you need much bigger images, which makes a constant image exchange unuseful.

Anyway, I will have to do without for now. Thanks for your support!
BuM is offline   Reply With Quote
Old 04-11-2012, 05:05 PM   #10
danzig70
Member
 
Join Date: Mar 2009
Posts: 56
danzig70 is on a distinguished road
Default

Could you create additional light sources so that the unexplored areas would be in the shadow?
danzig70 is offline   Reply With Quote
Reply

Tags
explored, layer, layer mask, mask


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
GetCurrentPosition question... ruso Development Help 19 08-24-2011 04:07 PM
How to bound rendering area of the tiled image layer Nebulus Development Help 7 01-30-2011 04:44 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 11:24 PM.


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