1 package gov
.nasa
.worldwind
;
4 Copyright (C) 2001, 2006 United States Government
5 as represented by the Administrator of the
6 National Aeronautics and Space Administration.
12 * @version $Id: LayerList.java 1467 2007-04-14 01:24:51Z tgaskins $
14 public class LayerList
extends WWObjectImpl
implements Iterable
<Layer
>
16 private java
.util
.List
<Layer
> layerList
= new java
.util
.ArrayList
<Layer
>();
22 public LayerList(Layer
[] layers
)
26 String message
= WorldWind
.retrieveErrMsg("nullValue.LayersIsNull");
27 WorldWind
.logger().log(java
.util
.logging
.Level
.FINE
, message
);
28 throw new IllegalArgumentException(message
);
30 for (Layer layer
: layers
)
36 public void add(Layer layer
)
40 String message
= WorldWind
.retrieveErrMsg("nullValue.LayerIsNull");
41 WorldWind
.logger().log(java
.util
.logging
.Level
.FINE
, message
);
42 throw new IllegalArgumentException(message
);
45 if (this.layerList
.contains(layer
))
48 this.layerList
.add(layer
);
49 layer
.addPropertyChangeListener(this);
50 this.firePropertyChange(AVKey
.LAYERS
, null, this.layerList
); // TODO: send old layer list content
53 public void remove(Layer layer
)
57 String msg
= WorldWind
.retrieveErrMsg("nullValue.LayerIsNull");
58 WorldWind
.logger().log(java
.util
.logging
.Level
.FINE
, msg
);
59 throw new IllegalArgumentException(msg
);
62 if (!this.layerList
.contains(layer
))
65 layer
.removePropertyChangeListener(this);
66 this.layerList
.remove(layer
);
67 this.firePropertyChange(AVKey
.LAYERS
, null, this.layerList
); // TODO: send old layer list content
70 public java
.util
.Iterator
<Layer
> iterator()
72 return this.layerList
.iterator();
77 return this.layerList
.size();
81 public String
toString()
84 for (Layer l
: this.layerList
)
86 r
+= l
.toString() + ", ";