![]() |
|
|||||||
| Development Help Help for building applications or diagnosing problems with WWJ |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Member
Join Date: Jan 2012
Posts: 94
![]() |
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! |
|
|
|
|
|
#2 |
|
Emxsys
Join Date: Dec 2007
Location: Ventura, CA
Posts: 129
![]() |
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. |
|
|
|
|
|
#3 |
|
Member
Join Date: Jan 2012
Posts: 94
![]() |
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. |
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Feb 2008
Location: Melbourne, FL, USA
Posts: 675
![]() |
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. |
|
|
|
|
|
#5 |
|
Member
Join Date: Jan 2012
Posts: 94
![]() |
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? |
|
|
|
|
|
#6 | ||
|
Senior Member
Join Date: Feb 2008
Location: Melbourne, FL, USA
Posts: 675
![]() |
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
Join Date: Dec 2007
Location: Ventura, CA
Posts: 129
![]() |
Quote:
|
|
|
|
|
|
|
#8 |
|
WW Dev. Team
Join Date: Sep 2010
Location: Boston, MA, USA
Posts: 325
![]() |
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. |
|
|
|
|
|
#9 |
|
Member
Join Date: Jan 2012
Posts: 94
![]() |
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! |
|
|
|
|
|
#10 |
|
Member
Join Date: Mar 2009
Posts: 56
![]() |
Could you create additional light sources so that the unexplored areas would be in the shadow?
|
|
|
|
![]() |
| Tags |
| explored, layer, layer mask, mask |
| 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 |
| 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 |