Statistics
| Revision:

root / branches / Mobile_Compatible_Hito_1 / libProjectionCresques / src / org / gvsig / projection / cresques / px / PxLayerList.java @ 21932

History | View | Annotate | Download (2.28 KB)

1
/*
2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 *
4
 * Copyright (C) 2004-5.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 * cresques@gmail.com
23
 */
24
package org.gvsig.projection.cresques.px;
25

    
26
import java.util.Iterator;
27

    
28
import org.gvsig.projection.px.Extent;
29

    
30

    
31
public class PxLayerList extends PxObjList {
32
    PxLayer current = null;
33

    
34
    public PxLayerList() {
35
        super();
36
    }
37

    
38
    public void add(PxLayer layer) {
39
        extent.add(layer.extent);
40
        super.add(layer);
41
        current = layer;
42
    }
43

    
44
    public PxLayer getByName(String lName) {
45
        Iterator iter = iterator();
46
        PxLayer layer;
47

    
48
        while (iter.hasNext()) {
49
            layer = (PxLayer) iter.next();
50

    
51
            if (layer.getName().compareTo(lName) == 0) {
52
                return layer;
53
            }
54
        }
55

    
56
        return null;
57
    }
58

    
59
    public boolean isCurrent(PxLayer layer) {
60
        return current.getId() == layer.getId();
61
    }
62

    
63
    public PxLayer getCurrent() {
64
        return current;
65
    }
66

    
67
    public void setCurrent(PxLayer layer) {
68
        current = layer;
69

    
70
        if (!current.isVisible()) {
71
            current.setVisible(true);
72
        }
73
    }
74

    
75
    public Extent getExtent() {
76
        Extent ext = new Extent();
77
        PxLayer layer;
78
        Iterator iter = iterator();
79

    
80
        while (iter.hasNext()) {
81
            layer = (PxLayer) iter.next();
82

    
83
            if (layer.isVisible()) {
84
                ext.add(layer.extent);
85
            }
86
        }
87

    
88
        return ext;
89
    }
90
}