Monday, November 26, 2007

A note on LayerSet

Unfortunately I must recognize I am a newbie with my own code :P
Using LayerSet in the Balloon project I get a little headache I want to comment here.
LayerSet extends LayerList class and also implements the Layer interface (in the same way as AbstractLayer).
Take very into account, that if you create a LayerSet an adds a LayerList object, all contained layers in LayerList are copied into the LayerSet, and that's all. If later you modify the LayerList, adding or removing layers, the changes are not propagated to the LayerSet.

6 comments:

Thomas said...

Antonio,

It's me again. In order to run your example program for Temporality, I need to add your LayerSet. When I recompiled WWJ, I got the following error:

compile:
[javac] Compiling 1 source file to C:\worldwind-java-0-6-51\classes
[javac] C:\worldwind-java-0-6-51\src\gov\nasa\worldwind\layers\LayerSet.java:24: gov.nasa.worldwind.layers.LayerSet is not abstract and does not override abstract method setNetworkRetrievalEnabled(boolean) in gov.nasa.worldwind.layers.Layer
[javac] public class LayerSet extends LayerList implements Layer {
[javac] ^
[javac] 1 error

As the creator of the LayerSet, do you have any recommendations on how to get around this. I could put in an implementation of setNetworkRetrievalEnabled that does nothing. I tried this with both 0.5 and 0.6.51 with the same result.

Antonio Santiago said...

Hi Thomas, and thanks to use my code.
The problem is LayerSet extends the WWJ LayerList class and the last release of WWJ has some modifications respect my implementation.

Lately I have no much time, so I stop my Balloon project. Maybe I would start it again :)

Thomas said...

Antonio,

Since my curiousity has gotten the better of me, I will take a crack at solving the problem. I will let you know what I find.

Antonio Santiago said...

Ok, I wait for your news.
My email is: asantiagop(at)gmail(dot)com

Anonymous said...

I'm a user as well, thanks Antonio.

Trick to handle the new version is that you can acquire the unimplemented methods from AbstractLayer if your too lazy to implement them. :)

Antonio Santiago said...

Thank Anonimous ;)