root / branches / CqCMSDvp / libraries / libCq CMS for java.old / src / org / cresques / px / PxLayerList.java @ 2249
History | View | Annotate | Download (2.33 KB)
1 | 2249 | igbrotru | /*
|
---|---|---|---|
2 | * Created on 21-jun-2004
|
||
3 | *
|
||
4 | * To change the template for this generated file go to
|
||
5 | * Window>Preferences>Java>Code Generation>Code and Comments
|
||
6 | */
|
||
7 | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
||
8 | *
|
||
9 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
10 | *
|
||
11 | * This program is free software; you can redistribute it and/or
|
||
12 | * modify it under the terms of the GNU General Public License
|
||
13 | * as published by the Free Software Foundation; either version 2
|
||
14 | * of the License, or (at your option) any later version.
|
||
15 | *
|
||
16 | * This program is distributed in the hope that it will be useful,
|
||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
19 | * GNU General Public License for more details.
|
||
20 | *
|
||
21 | * You should have received a copy of the GNU General Public License
|
||
22 | * along with this program; if not, write to the Free Software
|
||
23 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
24 | *
|
||
25 | * For more information, contact:
|
||
26 | *
|
||
27 | * Generalitat Valenciana
|
||
28 | * Conselleria d'Infraestructures i Transport
|
||
29 | * Av. Blasco Ib??ez, 50
|
||
30 | * 46010 VALENCIA
|
||
31 | * SPAIN
|
||
32 | *
|
||
33 | * +34 963862235
|
||
34 | * gvsig@gva.es
|
||
35 | * www.gvsig.gva.es
|
||
36 | *
|
||
37 | * or
|
||
38 | *
|
||
39 | * IVER T.I. S.A
|
||
40 | * Salamanca 50
|
||
41 | * 46005 Valencia
|
||
42 | * Spain
|
||
43 | *
|
||
44 | * +34 963163400
|
||
45 | * dac@iver.es
|
||
46 | */
|
||
47 | 2 | luisw | package org.cresques.px; |
48 | |||
49 | import java.util.Iterator; |
||
50 | |||
51 | public class PxLayerList extends PxObjList { |
||
52 | PxLayer current = null;
|
||
53 | public PxLayerList() {
|
||
54 | super();
|
||
55 | } |
||
56 | |||
57 | public void add(PxLayer layer) { |
||
58 | extent.add(layer.extent); |
||
59 | super.add(layer);
|
||
60 | current = layer; |
||
61 | } |
||
62 | |||
63 | public PxLayer getByName(String lName) { |
||
64 | Iterator iter = iterator();
|
||
65 | PxLayer layer; |
||
66 | while (iter.hasNext()) {
|
||
67 | layer = (PxLayer) iter.next(); |
||
68 | if (layer.getName().compareTo(lName) == 0) |
||
69 | return layer;
|
||
70 | } |
||
71 | return null; |
||
72 | } |
||
73 | |||
74 | public boolean isCurrent(PxLayer layer) { |
||
75 | return current.getId() == layer.getId();
|
||
76 | } |
||
77 | public PxLayer getCurrent() {
|
||
78 | return current;
|
||
79 | } |
||
80 | public void setCurrent(PxLayer layer) { |
||
81 | current = layer; |
||
82 | if (!current.isVisible()) current.setVisible(true); |
||
83 | } |
||
84 | |||
85 | public Extent getExtent() {
|
||
86 | Extent ext = new Extent();
|
||
87 | PxLayer layer; |
||
88 | Iterator iter = iterator();
|
||
89 | while (iter.hasNext()) {
|
||
90 | layer = (PxLayer) iter.next(); |
||
91 | if (layer.isVisible()) ext.add(layer.extent);
|
||
92 | } |
||
93 | return ext;
|
||
94 | } |
||
95 | } |