Statistics
| Revision:

svn-gvsig-desktop / branches / v02_desarrollo / libraries / libCq CMS for java.old / src / org / cresques / cts / ProjectionPool.java @ 909

History | View | Annotate | Download (3.16 KB)

1
/*
2
 * Created on 24-jul-2004
3
 */
4
package org.cresques.cts;
5

    
6
import java.util.ArrayList;
7
import java.util.Iterator;
8
import java.util.Map;
9
import java.util.TreeMap;
10

    
11
import org.cresques.cts.gt2.CSDatum;
12
import org.cresques.cts.gt2.CSGaussPt;
13
import org.cresques.cts.gt2.CSLambertCC;
14
import org.cresques.cts.gt2.CSUTM;
15
import org.cresques.cts.gt2.CoordSys;
16

    
17
/**
18
 * Pool de proyeccions (cs+datum) conocidas.
19
 * @author "Luis W. Sevilla" <sevilla_lui@gva.es>
20
 */
21
public class ProjectionPool {
22
        static TreeMap data = null;
23
        
24
        static {
25
                CoordSys cs = null;
26
                data = new TreeMap();
27
                
28
                cs = (new CSUTM(CSDatum.ed50, 30)).toGeo();
29
                cs.setAbrev("ed50geo");
30
                data.put(cs.getAbrev(), cs);
31
                
32
                cs = new CSUTM(CSDatum.ed50, 30);
33
                cs.setAbrev("23030");
34
                data.put(cs.getAbrev(), cs);
35
                data.put("gt2utm30", cs);
36
                data.put("ed50utm30", cs);
37
                
38
                cs = new CSUTM(CSDatum.ed50, 29);
39
                cs.setAbrev("23029");
40
                data.put(cs.getAbrev(), cs);
41
                data.put("gt2utm29", cs);
42
                data.put("ed50utm29", cs);
43
                
44
                cs = new CSUTM(CSDatum.ed50, 31);
45
                cs.setAbrev("23031");
46
                data.put(cs.getAbrev(), cs);
47
                data.put("gt2utm31", cs);
48
                data.put("ed50utm31", cs);
49

    
50
                cs = (new CSUTM(CSDatum.wgs84, 30)).toGeo();
51
                cs.setAbrev("4326");
52
                data.put(cs.getAbrev(), cs);
53
                data.put("wgs84geo", cs);
54
                
55
                cs = new CSUTM(CSDatum.wgs84, 28);
56
                cs.setAbrev("2054");
57
                data.put(cs.getAbrev(), cs);
58
                data.put("wgs84utm28", cs);
59
                
60
                cs = new CSUTM(CSDatum.wgs84, 29);
61
                cs.setAbrev("2056");
62
                data.put(cs.getAbrev(), cs);
63
                data.put("wgs84utm29", cs);
64
                
65
                cs = new CSUTM(CSDatum.wgs84, 30);
66
                cs.setAbrev("2058");
67
                data.put(cs.getAbrev(), cs);
68
                data.put("wgs84utm30", cs);
69
                
70
                cs = new CSUTM(CSDatum.wgs84, 31);
71
                cs.setAbrev("2060");
72
                data.put(cs.getAbrev(), cs);
73
                data.put("wgs84utm31", cs);
74
                
75
                cs = new CSUTM(CSDatum.wgs84, 32);
76
                cs.setAbrev("2062");
77
                data.put(cs.getAbrev(), cs);
78
                data.put("wgs84utm32", cs);
79
                
80
                cs = CSGaussPt.hgd73;
81
                cs.setAbrev("GT2hgd73");
82
                data.put(cs.getAbrev(), cs);
83
                
84
                cs = new CSLambertCC(CSDatum.nad27, -105D, 49D, 49D, 77D);
85
                cs.setAbrev("LCCCan");
86
                data.put(cs.getAbrev(), cs);
87
        }
88
        
89
        /**
90
         * Mete una nueva proyeccion en la Pool.
91
         * @param name abreviatura de la proyecccion (i.e. ed50utm30)
92
         * @param proj Proyeccion
93
         */
94
        public static void add(String name, IProjection proj) {
95
                data.put(name, proj);
96
        }
97
        
98
        /**
99
         * Devuelve una proyeccion a partir de una cadena.
100
         * @param name abreviatura de la proyecccion (i.e. ed50utm30)
101
         * @return Proyeccion si existe
102
         */
103
        public static IProjection get(String name) {
104
                IProjection proj = null;
105
                if (ProjectionPool.data.containsKey(name))
106
                        proj = (IProjection) ProjectionPool.data.get(name);
107
                else
108
                        System.err.println("ProjectionPool: Key '"+name+"' not set.");
109
                return proj;
110
        }
111
        
112
        public static Iterator iterator() {
113
                ArrayList projs = new ArrayList();
114
                
115
                Iterator iter = data.entrySet().iterator();
116
                while (iter.hasNext()) {
117
                        projs.add(((Map.Entry) iter.next()).getValue());
118
                }
119
                return projs.iterator();
120
        }
121
        
122
        /**
123
         * Devuelve una proyeccion a partir de un codig epsg.
124
         * @param name codigo de la proyecccion (i.e. 23030)
125
         * @return Proyeccion si existe
126
         */
127
        private static IProjection getByEpsg(String name) {
128
                IProjection proj = null;
129
                return proj;
130
        }
131
}