svn-gvsig-desktop / trunk / libraries / libCq CMS for java.old / src / org / cresques / px / PxLayerList.java @ 2
History | View | Annotate | Download (1005 Bytes)
1 |
package org.cresques.px; |
---|---|
2 |
|
3 |
import java.util.Iterator; |
4 |
|
5 |
public class PxLayerList extends PxObjList { |
6 |
PxLayer current = null;
|
7 |
public PxLayerList() {
|
8 |
super();
|
9 |
} |
10 |
|
11 |
public void add(PxLayer layer) { |
12 |
extent.add(layer.extent); |
13 |
super.add(layer);
|
14 |
current = layer; |
15 |
} |
16 |
|
17 |
public PxLayer getByName(String lName) { |
18 |
Iterator iter = iterator();
|
19 |
PxLayer layer; |
20 |
while (iter.hasNext()) {
|
21 |
layer = (PxLayer) iter.next(); |
22 |
if (layer.getName().compareTo(lName) == 0) |
23 |
return layer;
|
24 |
} |
25 |
return null; |
26 |
} |
27 |
|
28 |
public boolean isCurrent(PxLayer layer) { |
29 |
return current.getId() == layer.getId();
|
30 |
} |
31 |
public PxLayer getCurrent() {
|
32 |
return current;
|
33 |
} |
34 |
public void setCurrent(PxLayer layer) { |
35 |
current = layer; |
36 |
if (!current.isVisible()) current.setVisible(true); |
37 |
} |
38 |
|
39 |
public Extent getExtent() {
|
40 |
Extent ext = new Extent();
|
41 |
PxLayer layer; |
42 |
Iterator iter = iterator();
|
43 |
while (iter.hasNext()) {
|
44 |
layer = (PxLayer) iter.next(); |
45 |
if (layer.isVisible()) ext.add(layer.extent);
|
46 |
} |
47 |
return ext;
|
48 |
} |
49 |
} |