Revision 38681

View differences:

tags/v2_0_0_Build_2050/libraries/libProjection/src-test/org/cresques/cts/AllTests.java
1
package org.cresques.cts;
2

  
3
import junit.framework.Test;
4
import junit.framework.TestSuite;
5

  
6
public class AllTests {
7

  
8
	public static Test suite() {
9
		TestSuite suite = new TestSuite("Test for org.cresques.cts");
10
		//$JUnit-BEGIN$
11

  
12
		//$JUnit-END$
13
		return suite;
14
	}
15

  
16
}
0 17

  
tags/v2_0_0_Build_2050/libraries/libProjection/config/org/cresques/resources/i18n/text_it.properties
1
#Translations for language [it]
2
#Tue Nov 07 12:30:01 CET 2006
3
Aceptar=Accetta
4
Aplicar=Applica
5
Block_Size_=Dimensioni blocco\:
6
Cancelar=Cancella
7
Compression_=Compressione
8
datum=Datum
9
Generate_Tfw_=Genera Tfw\:
10
Interleave_=Interlacciato\:
11
Photometric_=Fotometrica\:
12
Progressive_=Progressivo\:
13
projection=Proiezione
14
reference_system=Sistema di riferimento
15
zone=Fuso
0 16

  
tags/v2_0_0_Build_2050/libraries/libProjection/config/org/cresques/resources/i18n/text.properties
1
#Translations for language [es]
2
#Mon Oct 30 09:38:21 CET 2006
3
Aceptar=Aceptar
4
Aplicar=Aplicar
5
Block_Size_=Tama\u00f1o de bloque\:
6
Cancelar=Cancelar
7
Compression_=Compresi\u00f3n\:
8
datum=Datum
9
Generate_Tfw_=Generar Tfw\:
10
Interleave_=Entrelazado\:
11
Photometric_=Fotom\u00e9trica\:
12
Progressive_=Progresivo\:
13
projection=Proyecci\u00f3n
14
reference_system=Sistema de Referencia
15
zone=Huso
0 16

  
tags/v2_0_0_Build_2050/libraries/libProjection/config/org/cresques/resources/i18n/text_en.properties
1
#Translations for language [en]
2
#Mon Oct 30 09:38:21 CET 2006
3
Aceptar=Accept
4
Aplicar=Apply
5
Block_Size_=Block Size\:
6
Cancelar=Cancel
7
Compression_=Compression\:
8
datum=Datum
9
Generate_Tfw_=Generate Tfw\:
10
Interleave_=Interleave\:
11
Photometric_=Photometric\:
12
Progressive_=Progressive\:
13
projection=Projection
14
reference_system=Reference System
15
zone=Zone
0 16

  
tags/v2_0_0_Build_2050/libraries/libProjection/config/org/cresques/resources/i18n/text_gl.properties
1
#Translations for language [gl]
2
#Mon Oct 30 09:38:21 CET 2006
3
Aceptar=Aceptar
4
Aplicar=Aplicar
5
Block_Size_=
6
Cancelar=Cancelar
7
Compression_=
8
datum=
9
Generate_Tfw_=
10
Interleave_=
11
Photometric_=
12
Progressive_=
13
projection=
14
reference_system=
15
zone=
0 16

  
tags/v2_0_0_Build_2050/libraries/libProjection/config/org/cresques/resources/i18n/text_ca.properties
1
#Translations for language [ca]
2
#Mon Oct 30 09:38:21 CET 2006
3
Aceptar=Acceptar
4
Aplicar=Aplicar
5
Block_Size_=
6
Cancelar=Cancel\u00b7lar
7
Compression_=
8
datum=
9
Generate_Tfw_=
10
Interleave_=
11
Photometric_=
12
Progressive_=
13
projection=Projecci\u00f3
14
reference_system=Sistema de refer\u00e8ncia
15
zone=
0 16

  
tags/v2_0_0_Build_2050/libraries/libProjection/config/org/cresques/resources/i18n/text_pt.properties
1
#Translations for language [pt]
2
#Mon Oct 30 09:38:21 CET 2006
3
Aceptar=Aceitar
4
Aplicar=Aplicar
5
Block_Size_=
6
Cancelar=Cancelar
7
Compression_=
8
datum=
9
Generate_Tfw_=
10
Interleave_=
11
Photometric_=
12
Progressive_=
13
projection=
14
reference_system=
15
zone=
0 16

  
tags/v2_0_0_Build_2050/libraries/libProjection/config/org/cresques/resources/i18n/text_cs.properties
1
#Translations for language [cs]
2
#Mon Nov 06 09:04:31 CET 2006
3
Aceptar=Budi\u017e
4
Aplicar=Pou\u017e\u00edt
5
Block_Size_=
6
Cancelar=Zru\u0161it
7
Compression_=
8
datum=Datum
9
Generate_Tfw_=
10
Interleave_=
11
Photometric_=
12
Progressive_=
13
projection=Projekce
14
reference_system=Prostorov\u00fd referen\u010dn\u00ed syst\u00e9m
15
zone=Z\u00f3na
0 16

  
tags/v2_0_0_Build_2050/libraries/libProjection/config/org/cresques/resources/i18n/text_fr.properties
1
#Translations for language [fr]
2
#Mon Oct 30 09:38:21 CET 2006
3
Aceptar=Accepter
4
Aplicar=Appliquer
5
Block_Size_=
6
Cancelar=Annuler
7
Compression_=
8
datum=
9
Generate_Tfw_=
10
Interleave_=
11
Photometric_=
12
Progressive_=
13
projection=
14
reference_system=
15
zone=
0 16

  
tags/v2_0_0_Build_2050/libraries/libProjection/config/org/cresques/resources/i18n/text_de.properties
1
#Translations for language [de]
2
#Mon Oct 30 09:38:21 CET 2006
3
Aceptar=OK
4
Aplicar=Anwenden
5
Block_Size_=
6
Cancelar=Abbrechen
7
Compression_=
8
datum=
9
Generate_Tfw_=
10
Interleave_=
11
Photometric_=
12
Progressive_=
13
projection=
14
reference_system=
15
zone=
0 16

  
tags/v2_0_0_Build_2050/libraries/libProjection/config/org/cresques/resources/i18n/text_eu.properties
1
#Translations for language [eu]
2
#Mon Oct 30 09:38:21 CET 2006
3
Aceptar=Ados
4
Aplicar=Aplikatu
5
Block_Size_=
6
Cancelar=Utzi
7
Compression_=
8
datum=
9
Generate_Tfw_=
10
Interleave_=
11
Photometric_=
12
Progressive_=
13
projection=
14
reference_system=
15
zone=
0 16

  
tags/v2_0_0_Build_2050/libraries/libProjection/resources-test/log4j.xml
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
3

  
4
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
5

  
6
	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
7
		<layout class="org.apache.log4j.PatternLayout">
8
			<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n  %m%n" />
9
		</layout>
10
	</appender>
11

  
12
	<category name="org.gvsig.tools">
13
		<priority value="DEBUG" />
14
	</category>
15
	<category name="org.cresques">
16
		<priority value="DEBUG" /> 
17
	</category>
18
	<category name="org.gvsig.fmap.crs">
19
		<priority value="DEBUG" /> 
20
	</category>
21

  
22
	<root>
23
		<priority value="INFO" />
24
		<appender-ref ref="CONSOLE" />
25
	</root>
26
</log4j:configuration>
tags/v2_0_0_Build_2050/libraries/libProjection/src/org/cresques/coerce/CoerceToString.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.cresques.coerce;
23

  
24
import org.cresques.cts.IProjection;
25
import org.gvsig.tools.dataTypes.CoercionException;
26
import org.gvsig.tools.dataTypes.DataTypesManager.Coercion;
27

  
28
/**
29
 * Convert a Projection to String.
30
 * 
31
 * Support convert:
32
 * - Projection to String (do nothing)
33
 * 
34
 * @author gvSIG Team
35
 * @version $Id$
36
 * 
37
 */
38
public class CoerceToString implements Coercion {
39

  
40
	Coercion previous = null;
41
	
42
	public CoerceToString() {
43
		// Do nothing
44
	}
45
	
46
	public CoerceToString(Coercion previous) {
47
		this.previous = previous;
48
	}
49
	
50
	
51
	public Object coerce(Object value) throws CoercionException {
52
		try {
53
			if( value == null || value instanceof String ) {
54
				return value;
55
			}
56
			if( value instanceof IProjection ) {
57
				return ((IProjection)value).getFullCode();
58
			}
59
			if( previous != null ) {
60
				return previous.coerce(value);
61
			}
62
		} catch (Exception e) {
63
			throw new CoercionException(e);
64
		}
65
		throw new CoercionException();
66
	}
67

  
68
}
0 69

  
tags/v2_0_0_Build_2050/libraries/libProjection/src/org/cresques/coerce/CoerceToCRS.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.cresques.coerce;
23

  
24
import org.cresques.cts.IProjection;
25
import org.gvsig.fmap.crs.CRSFactory;
26
import org.gvsig.tools.dataTypes.CoercionException;
27
import org.gvsig.tools.dataTypes.DataTypesManager.Coercion;
28

  
29
/**
30
 * Convert a string value of projection code to IProjection
31
 * 
32
 * @author gvSIG Team
33
 * @version $Id$
34
 * 
35
 */
36
public class CoerceToCRS implements Coercion {
37

  
38
	public Object coerce(Object value) throws CoercionException {
39
		try {
40
			if( value == null || value instanceof IProjection) {
41
				return value;
42
			}
43
			Object proj = CRSFactory.getCRS(value.toString());
44
			if( proj == null ) {
45
				throw new CoercionException("Can't convert value '"+value.toString()+"' to Projection.");
46
			}
47
			return proj;
48
		} catch (Exception e) {
49
			throw new CoercionException(e);
50
		}
51

  
52
	}
53

  
54
}
0 55

  
tags/v2_0_0_Build_2050/libraries/libProjection/src/org/cresques/ProjectionLibrary.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
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., 51 Franklin Street, Fifth Floor, Boston,
19
* MA  02110-1301, USA.
20
*
21
*/
22
package org.cresques;
23

  
24
import org.cresques.coerce.CoerceToCRS;
25
import org.cresques.coerce.CoerceToString;
26
import org.cresques.cts.IProjection;
27

  
28
import org.gvsig.fmap.crs.CRSFactory;
29
import org.gvsig.fmap.crs.persistence.CoordTransPersistenceFactory;
30
import org.gvsig.fmap.crs.persistence.ProjectionPersistenceFactory;
31
import org.gvsig.tools.ToolsLibrary;
32
import org.gvsig.tools.ToolsLocator;
33
import org.gvsig.tools.dataTypes.DataTypesManager;
34
import org.gvsig.tools.library.AbstractLibrary;
35
import org.gvsig.tools.library.LibraryException;
36

  
37
public class ProjectionLibrary extends AbstractLibrary {
38

  
39
    @Override
40
    public void doRegistration() {
41
        registerAsAPI(ProjectionLibrary.class);
42
        require(ToolsLibrary.class);
43
    }
44

  
45
	protected void doInitialize() throws LibraryException {
46
	}
47

  
48
	protected void doPostInitialize() throws LibraryException {
49
		if (CRSFactory.cp==null) {
50
			throw new CRSFactoryNotRegisteredException();
51
		}
52

  
53
		DataTypesManager dataTypesManager = ToolsLocator.getDataTypesManager();
54
        dataTypesManager.addtype(DataTypes.CRS, "CRS", "CRS",
55
            IProjection.class, new CoerceToCRS());
56
        dataTypesManager.setCoercion(DataTypes.STRING, new CoerceToString(
57
            dataTypesManager.getCoercion(DataTypes.STRING)));
58

  
59
		// Register the PersistenceFactory to be able to persist 
60
		// IProjection objects
61
		ToolsLocator.getPersistenceManager().registerFactory(
62
				new ProjectionPersistenceFactory());
63
		ToolsLocator.getPersistenceManager().registerFactory(
64
            new CoordTransPersistenceFactory());
65
	}
66

  
67
}
0 68

  
tags/v2_0_0_Build_2050/libraries/libProjection/src/org/cresques/impl/CresquesCtsLibrary.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.cresques.impl;
23

  
24
import org.cresques.ProjectionLibrary;
25
import org.cresques.impl.cts.ProjectionPool;
26

  
27
import org.gvsig.fmap.crs.CRSFactory;
28
import org.gvsig.tools.library.AbstractLibrary;
29
import org.gvsig.tools.library.LibraryException;
30

  
31
public class CresquesCtsLibrary extends AbstractLibrary {
32

  
33
    @Override
34
    public void doRegistration() {
35
        registerAsImplementationOf(ProjectionLibrary.class);
36
    }
37

  
38
    protected void doInitialize() throws LibraryException {
39
        CRSFactory.cp = new ProjectionPool();
40
    }
41

  
42
    protected void doPostInitialize() throws LibraryException {
43
        // Nothing to do
44
    }
45
}
0 46

  
tags/v2_0_0_Build_2050/libraries/libProjection/src/org/cresques/impl/cts/wkt/WKT.java
1
package org.cresques.impl.cts.wkt;
2

  
3
import java.util.ArrayList;
4

  
5
/**
6
 * Generates a WKT from CRS parameters.
7
 * as, for example in
8
 * "GEOGCS[\"ETRS89\","+
9
        "DATUM[\"European_Terrestrial_Reference_System_1989\","+
10
            "SPHEROID[\"GRS 1980\",6378137,298.257222101,"+
11
                "AUTHORITY[\"EPSG\",\"7019\"]],"+
12
            "AUTHORITY[\"EPSG\",\"6258\"]," +
13
            "TOWGS84[0,0,0,0,0,0,0]],"+
14
        "PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],"+
15
        "UNIT[\"degree\",0.01745329251994328, AUTHORITY[\"EPSG\",\"9122\"]],"+
16
        "AUTHORITY[\"EPSG\",\"4258\"]]";
17
    
18
 * @author Luis W. Sevilla <sevilla_lui@gva.es>
19
 *
20
 */
21
public abstract class WKT {
22

  
23
	static class Authority {
24
		String name;
25
		String code;
26
		public Authority(String n, String c) {
27
			name = n;
28
			code = c;
29
		}
30
		public String toWKT() {
31
			return "AUTHORITY[\""+name+"\",\""+code+"\"]";
32
		}
33
	}
34

  
35
	static class Parameter {
36
		protected String name;
37
		private String value;
38
		protected Authority authority; // optional
39
		
40
		public Parameter(String n) {
41
			name = n;
42
		}
43
		
44
		public Parameter(String n, String v) {
45
			name = n;
46
			value = v;
47
		}
48
		public Parameter(String n, Authority a) {
49
			name = n;
50
			authority = a;
51
		}
52
		
53
		public String toWKT() {
54
			String txt = "PARAMETER[\""+name+"\","+value;
55
			if (authority != null)
56
				txt += ","+authority.toWKT();
57
			return txt + "]";
58
		}
59
	}
60

  
61
	static class Spheroid {
62
		String name;
63
		double semiMajor;
64
		double inverseFlattening;
65
		Authority authority = null; // optional
66
		
67
		public Spheroid(String n, double s, double f) {
68
			name = n;
69
			semiMajor = s;
70
			inverseFlattening = f;
71
		}
72
		public Spheroid(String n, double s, double f, Authority a) {
73
			name = n;
74
			semiMajor = s;
75
			inverseFlattening = f;
76
			authority = a;
77
		}
78
		public String toWKT() {
79
			String txt = "SPHEROID[\""+name+"\","+
80
				semiMajor+","+inverseFlattening;
81
			if (authority != null)
82
				txt += ","+authority.toWKT();
83
			return txt + "]";
84
		}
85
	}
86

  
87
	static class ToWGS84 {
88
		double dx = 0;
89
		double dy = 0;
90
		double dz = 0;
91
		double ex = 0;
92
		double ey = 0;
93
		double ez = 0;
94
		double ppm = 0;
95
		public ToWGS84() {
96
		}
97
		public ToWGS84(double dx, double dy, double dz, double ex, double ey, double ez, double ppm) {
98
			this.dx = dx;
99
			this.dy = dy;
100
			this.dz = dz;
101
			this.ex = ex;
102
			this.ey = ey;
103
			this.ez = ez;
104
			this.ppm = ppm;
105
		}
106
		public String toWKT() {
107
			return "TOWGS84["+dx+","+dy+","+dz+","+ex+","+ey+","+ez+","+ppm+"]";
108
		}
109
	}
110

  
111
	static class Datum {
112
		String name;
113
		Spheroid spheroid;
114
		ToWGS84 towgs84 = new ToWGS84(); // optional
115
		Authority authority; // optional
116
		public Datum(String n, Spheroid s) {
117
			init (n, s, new ToWGS84(), null);
118
		}
119
		public Datum(String n, Spheroid s, ToWGS84 t) {
120
			init (n, s, t, null);
121
		}
122
		public Datum(String n, Spheroid s, Authority a) {
123
			init (n, s, new ToWGS84(), a);
124
		}
125
		public Datum(String n, Spheroid s, ToWGS84 t, Authority a) {
126
			init (n, s, t, a);
127
		}
128
		private void init(String n, Spheroid s,
129
			ToWGS84 t, Authority a) {
130
			name = n;
131
			spheroid = s;
132
			towgs84 = t;
133
			authority = a;
134
		}
135
		public String toWKT() {
136
			String txt = "DATUM[\""+name+"\","+spheroid.toWKT();
137
			if (towgs84 != null)
138
				txt += ","+towgs84.toWKT();
139
			if (authority != null)
140
				txt += ","+authority.toWKT();
141
			return txt+"]";
142
		}
143
	}
144

  
145
	static class PrimeM {
146
		String name;
147
		double longitude;
148
		Authority authority = null; // optional
149
		
150
		public PrimeM(String n, double l) {
151
			name = n;
152
			longitude = l;
153
		}
154
		
155
		public PrimeM(String n, double l, Authority a) {
156
			name = n;
157
			longitude = l;
158
			authority = a;
159
		}
160
		
161
		public String toWKT() {
162
			String txt = "PRIMEM[\""+name+"\","+longitude;
163
			if (authority != null)
164
				txt += ","+authority.toWKT();
165
			return txt + "]";
166
		}
167
	}
168

  
169
	static class Unit {
170
		String name;
171
		double conversionFactor;
172
		Authority authority; // optional
173
		
174
		public Unit(String n, double l) {
175
			name = n;
176
			conversionFactor = l;
177
		}
178
		
179
		public Unit(String n, double l, Authority a) {
180
			name = n;
181
			conversionFactor = l;
182
			authority = a;
183
		}
184
		
185
		public String toWKT() {
186
			String txt = "UNIT[\""+name+"\","+conversionFactor;
187
			if (authority != null)
188
				txt += ","+authority.toWKT();
189
			return txt + "]";
190
		}
191
	}
192
	
193
	static class Orientation {
194
		public final static int NORTH = 0;
195
		public final static int SOUTH = 1;
196
		public final static int EAST = 2;
197
		public final static int WEST = 3;
198
		public final static int UP = 4;
199
		public final static int DOWN = 5;
200
		public final static int OTHER = 6;
201
		protected final String [] txt = {
202
			"NORTH","SOUTH","EAST","WEST","UP","DOWN","OTHER"
203
		};
204
		protected int to = -1;
205
		
206
		public Orientation(int to) {
207
			this.to = to;
208
		}
209
	}
210
	
211
	static class Axis extends Orientation {
212
		String name;
213
		
214
		public Axis(String name, int to) {
215
			super(to);
216
			this.name = name;
217
		}
218
		
219
		public String toWKT() {
220
			return "AXIS[\""+name+"\","+txt[to]+ "]";
221
		}
222
	}
223
	
224
	static class TwinAxes {
225
		Axis axe1;
226
		Axis axe2;
227
		
228
		public TwinAxes(Axis a1, Axis a2) {
229
			axe1 = a1;
230
			axe2 = a2;
231
		}
232

  
233
		public String toWKT() {
234
			return axe1.toWKT()+","+axe2.toWKT();
235
		}
236

  
237
	}
238

  
239
	static class GeogCS extends WKT {
240
		String name;
241
		Datum datum;
242
		PrimeM primeMeridian;
243
		Unit unit;
244
		TwinAxes axes = null; // optional
245
		Authority authority = null; // optional
246
		
247
		public GeogCS(String n, Datum d, PrimeM p, Unit u) {
248
			init(n, d, p, u, null, null);
249
		}
250
		
251
		public GeogCS(String n, Datum d, PrimeM p, Unit u,
252
				Authority a) {
253
			init(n, d, p, u, null, a);
254
		}
255
		
256
		public GeogCS(String n, Datum d, PrimeM p, Unit u,
257
				TwinAxes t) {
258
			init(n, d, p, u, t, null);
259
		}
260
		
261
		public GeogCS(String n, Datum d, PrimeM p, Unit u,
262
				TwinAxes t, Authority a) {
263
			init(n, d, p, u, t, a);
264
		}
265
		
266
		private void init(String n, Datum d, PrimeM p, Unit u,
267
			TwinAxes t, Authority a) {
268
			name = n;
269
			datum = d;
270
			primeMeridian = p;
271
			unit = u;
272
			axes = t;
273
			authority = a;
274
		}
275
		
276
		public String toWKT() {
277
			String txt = "GEOGCS[\""+name+"\","+datum.toWKT()+
278
				","+primeMeridian.toWKT()+","+unit.toWKT();
279
			if (axes != null)
280
				txt += ","+axes.toWKT();
281
			if (authority != null)
282
				txt += ","+authority.toWKT();
283
			return txt+"]";
284
		}
285
	}
286

  
287
	static class Projection extends Parameter {
288
		public Projection(String n) {
289
			super(n);
290
		}
291
		
292
		public Projection(String n, Authority a) {
293
			super(n,a);
294
		}
295
		
296
		public String toWKT() {
297
			String txt = "PROJECTION[\""+name+"\"";
298
			if (authority != null)
299
				txt += ","+authority.toWKT();
300
			return txt + "]";
301
		}
302
	}
303

  
304
	static class ProjCS extends Parameter {
305
		GeogCS geogcs;
306
		Projection proj;
307
		ArrayList params = new ArrayList();
308
		Unit unit;
309
		TwinAxes axes = null; // optional
310

  
311
		public ProjCS(String n, GeogCS cs, Projection prj, Unit u ) {
312
			super(n);
313
			Parameter [] p = {};
314
			init(n, cs, prj, p, u, null);
315
		}
316
		
317
		public ProjCS(String n, GeogCS cs, Projection prj,
318
				Parameter [] p, Unit u ) {
319
			super(n);
320
			init(n, cs, prj, p, u, null);
321
		}
322
		
323
		public ProjCS(String n, GeogCS cs, Projection prj,
324
				Unit u, TwinAxes t, Authority a ) {
325
			super(n, a);
326
			Parameter [] p = {};
327
			init(n, cs, prj, p, u, t);
328
		}
329
		
330
		public ProjCS(String n, GeogCS cs, Projection prj,
331
				Parameter [] p, Unit u, TwinAxes t, Authority a ) {
332
			super(n, a);
333
			init(n, cs, prj, p, u, t);
334
		}
335
		
336
		private void init(String n, GeogCS cs, Projection prj,
337
			Parameter [] p, Unit u, TwinAxes t) {
338
			geogcs = cs;
339
			proj = prj;
340
			for (int i=0; i<p.length; i++)
341
				params.add(p[i]);
342
			unit = u;
343
			axes = t;
344
		}
345

  
346
		public void add(Parameter p) {
347
			params.add(p);
348
		}
349
		
350
		public String toWKT() {
351
			String txt = "PROJCS[\""+name+"\","+geogcs.toWKT()+
352
				","+proj.toWKT();
353
			for (int i=0; i<params.size();i++)
354
				txt += ","+((Parameter)params.get(i)).toWKT();
355
			txt += ","+unit.toWKT();
356
			if (axes != null)
357
				txt += ","+axes.toWKT();
358
			if (authority != null)
359
				txt += ","+authority.toWKT();
360
			return txt+"]";
361
		}
362
	}
363

  
364
	abstract public String toWKT();
365
}
0 366

  
tags/v2_0_0_Build_2050/libraries/libProjection/src/org/cresques/impl/cts/ProjectionPool.java
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.cresques.impl.cts;
25

  
26
import java.util.ArrayList;
27
import java.util.Iterator;
28
import java.util.Map;
29
import java.util.TreeMap;
30

  
31
import org.cresques.cts.ICRSFactory;
32
import org.cresques.cts.IProjection;
33
import org.cresques.impl.cts.gt2.CSDatum;
34
import org.cresques.impl.cts.gt2.CSGaussPt;
35
import org.cresques.impl.cts.gt2.CSLambertCC;
36
import org.cresques.impl.cts.gt2.CSMercator;
37
import org.cresques.impl.cts.gt2.CSUTM;
38
import org.cresques.impl.cts.gt2.CoordSys;
39

  
40

  
41
/**
42
 * Pool de proyeccions (cs+datum) conocidas.
43
 * @author "Luis W. Sevilla" <sevilla_lui@gva.es>
44
 */
45
public class ProjectionPool implements ICRSFactory {
46
    static TreeMap data = null;
47

  
48
    static {
49
        CoordSys cs = null;
50
        data = new TreeMap();
51

  
52
        cs = (new CSUTM(CSDatum.wgs84, 30)).toGeo();
53
        cs.setAbrev("EPSG:4326"); // WGS84 (World Geodesic Datum)
54
        data.put(cs.getAbrev(), cs);
55
        data.put("CRS:84", cs); // CRS:84 = EPSG:4326
56

  
57
        cs = (new CSUTM(CSDatum.ed50, 30)).toGeo();
58
        cs.setAbrev("EPSG:4230"); // Datum Europeu Internacional ED50
59
        data.put(cs.getAbrev(), cs);
60

  
61
        cs = (new CSUTM(CSDatum.d73, 30)).toGeo();
62
        cs.setAbrev("EPSG:4274"); // Datum 73 de Lisboa
63
        data.put(cs.getAbrev(), cs);
64

  
65
        cs = (new CSUTM(CSDatum.nad27, 30)).toGeo();
66
        cs.setAbrev("EPSG:4267"); // NAD 27
67
        data.put(cs.getAbrev(), cs);
68

  
69
        cs = (new CSUTM(CSDatum.nad83, 30)).toGeo();
70
        cs.setAbrev("EPSG:4269"); // NAD 83
71
        data.put(cs.getAbrev(), cs);
72

  
73
        cs = (new CSUTM(CSDatum.lomaQuintana, 30)).toGeo();
74
        cs.setAbrev("EPSG:4288"); // PSAD 56 'Loma Quintana'
75
        data.put(cs.getAbrev(), cs);
76

  
77
        cs = (new CSUTM(CSDatum.laCanoa, 30)).toGeo();
78
        cs.setAbrev("EPSG:4247"); // PSAD 56 'Loma Quintana'
79
        data.put(cs.getAbrev(), cs);
80

  
81
        cs = (new CSUTM(CSDatum.ntfParis, 30)).toGeo();
82
        cs.setAbrev("EPSG:4807"); // NTF Paris
83
        data.put(cs.getAbrev(), cs);
84

  
85
        cs = (new CSUTM(CSDatum.etrs89, 30)).toGeo();
86
        cs.setAbrev("EPSG:4258"); // ETRS 89
87
        data.put(cs.getAbrev(), cs);
88
        for (int i = 1; i <= 60; i++) {
89
            String huso = Integer.toString(i);
90

  
91
            if (i < 10) {
92
                huso = "0" + huso;
93
            }
94

  
95
            cs = new CSUTM(CSDatum.wgs84, i);
96
            cs.setAbrev("EPSG:326" + huso);
97
            data.put(cs.getAbrev(), cs);
98

  
99
            cs = new CSUTM(CSDatum.ed50, i);
100
            cs.setAbrev("EPSG:230" + huso);
101
            data.put(cs.getAbrev(), cs);
102
            if (i>2 && i<=23) {
103
                cs = new CSUTM(CSDatum.nad27, i);
104
                cs.setAbrev("EPSG:267" + huso);
105
                data.put(cs.getAbrev(), cs);
106

  
107
                cs = new CSUTM(CSDatum.nad83, i);
108
                cs.setAbrev("EPSG:269" + huso);
109
                data.put(cs.getAbrev(), cs);
110
            }
111
            if (i>27 && i<39) {
112
                cs = new CSUTM(CSDatum.etrs89, i);
113
                cs.setAbrev("EPSG:258" + huso);
114
                data.put(cs.getAbrev(), cs);
115
            }
116
        }
117

  
118
        cs = CSGaussPt.hgd73;
119
        cs.setAbrev("EPSG:27492"); // Projec??o Gauss do Datum 73 de Lisboa (no EPSG found)
120
        data.put(cs.getAbrev(), cs);
121

  
122
        cs = new CSUTM(CSDatum.d73, 29);
123
        cs.setAbrev("EPSG:27429"); // Projec??o Gauss do Datum 73 de Lisboa (no EPSG found)
124
        data.put(cs.getAbrev(), cs);
125

  
126
        for (int i = 18; i <= 21; i++) {
127
            String huso = Integer.toString(i);
128

  
129
            if (i < 10) {
130
                huso = "0" + huso;
131
            }
132

  
133
            cs = new CSUTM(CSDatum.laCanoa, i);
134
            cs.setAbrev("EPSG:247" + huso);
135
            data.put(cs.getAbrev(), cs);
136
        }
137

  
138
        for (int i = 16; i <= 22; i++) {
139
            String huso = Integer.toString(i);
140
            // Psad56 Ecuador
141
            cs = new CSUTM(CSDatum.lomaQuintana, i);
142
            cs.setAbrev("EPSG:288" + huso);
143
            data.put(cs.getAbrev(), cs);
144
            cs = new CSUTM(CSDatum.lomaQuintana, i, "S");
145
            cs.setAbrev("EPSG:288" + (i+60) );
146
            data.put(cs.getAbrev(), cs);
147
        }
148

  
149
        //		cs = new CSLambertCC(CSDatum.nad27, -105D, 49D, 49D, 77D, 0, 0);
150
        //		cs.setAbrev("LCCCan");
151
        //		data.put(cs.getAbrev(), cs);
152
        /* Para el server WMS de canad?:
153
         * EPSG:42101
154
         * EPSG:42304
155
         * EPSG:4269
156
         */
157
        /*
158
         * 42101,PROJCS["WGS 84 / LCC Canada",
159
         * GEOGCS["WGS 84",DATUM["WGS_1984",
160
         * SPHEROID["WGS_1984",6378137,298.257223563]],
161
         * PRIMEM["Greenwich",0],UNIT["Decimal_Degree",0.0174532925199433]],
162
         *
163
         * PROJECTION["Lambert_Conformal_Conic_2SP"],
164
         * PARAMETER["central_meridian",-95.0],
165
         * PARAMETER["latitude_of_origin",0],
166
         * PARAMETER["standard_parallel_1",49.0],
167
         * PARAMETER["standard_parallel_2",77.0],
168
         * PARAMETER["false_easting",0.0],
169
         * PARAMETER["false_northing",-8000000.0],
170
         * UNIT["Meter",1],AUTHORITY["EPSG","42101"]]
171
         */
172
        cs = new CSLambertCC(CSDatum.wgs84, -95, 0, 49, 77, 0, -8000000.0);
173
        cs.setAbrev("EPSG:42101");
174
        data.put(cs.getAbrev(), cs);
175

  
176
        /* 42304,PROJCS["NAD83 / NRCan LCC Canada",
177
         * GEOGCS["NAD83",DATUM["North_American_Datum_1983",
178
         * SPHEROID["GRS_1980",6378137,298.257222101]],
179
         * PRIMEM["Greenwich",0],
180
         * UNIT["Decimal_Degree",0.0174532925199433]],
181
         *
182
         * PROJECTION["Lambert_Conformal_Conic_2SP"],
183
         * PARAMETER["central_meridian",-95.0],
184
         * PARAMETER["latitude_of_origin",49.0],
185
         * PARAMETER["standard_parallel_1",49.0],
186
         * PARAMETER["standard_parallel_2",77.0],
187
         * PARAMETER["false_easting",0.0],
188
         * PARAMETER["false_northing",0.0],
189
         * UNIT["Meter",1],AUTHORITY["EPSG","42304"]]
190
         */
191
        cs = new CSLambertCC(CSDatum.nad83, -95, 49, 49, 77, 0, 0);
192
        cs.setAbrev("EPSG:42304");
193
        data.put(cs.getAbrev(), cs);
194

  
195
        /*
196
         * EPSG:26915 - NAD83 / UTM zone 15N
197
         * EPSG:31466 - Gau?-Kr?ger band 2
198
         * EPSG:31467 - Gau?-Kr?ger band 3
199
         * EPSG:4314  - DHDN
200
         */
201
        /*
202
         * 27572=PROJCS["NTF (Paris) / Lambert zone II",
203
             GEOGCS["NTF (Paris)",
204
                    DATUM["Nouvelle_Triangulation_Francaise_Paris",
205
                          SPHEROID["Clarke 1880 (IGN)",6378249.2,293.4660212936269,
206
                                   AUTHORITY["EPSG","7011"]],
207
                          TOWGS84[-168,-60,320,0,0,0,0],
208
                          AUTHORITY["EPSG","6807"]],
209
                    PRIMEM["Paris",2.33722917,AUTHORITY["EPSG","8903"]],
210
                    UNIT["grad",0.01570796326794897,AUTHORITY["EPSG","9105"]],
211
                    AUTHORITY["EPSG","4807"]],
212
             PROJECTION["Lambert_Conformal_Conic_1SP"],
213
                        PARAMETER["latitude_of_origin",52],
214
                        PARAMETER["central_meridian",0],
215
                        PARAMETER["scale_factor",0.99987742],
216
                        PARAMETER["false_easting",600000],
217
                        PARAMETER["false_northing",2200000],
218
                        UNIT["metre",1,AUTHORITY["EPSG","9001"]],
219
                        AUTHORITY["EPSG","27572"]]
220
         */
221

  
222
        cs = new CSLambertCC(CSDatum.ntfParis, 0, 46.79999999999995, 0.99987742, 600000, 2200000);
223
        cs.setAbrev("EPSG:27572");
224
        data.put(cs.getAbrev(), cs);
225
        
226
        cs = new CSLambertCC(CSDatum.ntfParis, 0, 52, 0.99987742, 600000, 2200000);
227
        cs.setAbrev("EPSG:27582");
228
        data.put(cs.getAbrev(), cs);
229
        /*
230
         * # RGF93
231
         * <4171> +proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs  <>
232
         * # RGF93 / Lambert-93
233
         */
234
        cs = (new CSUTM(CSDatum.rgf93, 30)).toGeo();
235
        cs.setAbrev("EPSG:4171"); // NTF Paris
236
        data.put(cs.getAbrev(), cs);
237
        /*
238
         *  <2154> +proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3
239
         *  +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0
240
         *  +units=m +no_defs  <>
241
         */
242
        cs = new CSLambertCC(CSDatum.rgf93, 3.0, 46.5, 49.0, 44.0, 700000.0, 6600000.0);
243
        cs.setAbrev("EPSG:2154");
244
        data.put(cs.getAbrev(), cs);
245

  
246
        cs = new CSMercator(CSDatum.wgs84);
247
        cs.setAbrev("EPSG:54004");
248
        data.put(cs.getAbrev(), cs);
249
        cs.setAbrev("EPSG:9804");
250
        data.put(cs.getAbrev(), cs);
251
        
252
        // Lo que faltaba: ?planetas!
253
        cs = (new CSUTM(CSDatum.moon, 30)).toGeo();
254
        cs.setAbrev("IAU2000:30100"); // Moon
255
        data.put(cs.getAbrev(), cs);
256

  
257
        cs = (new CSUTM(CSDatum.mars, 30)).toGeo();
258
        cs.setAbrev("IAU2000:49900"); // Mars
259
        data.put(cs.getAbrev(), cs);
260
        
261
        /*
262
         * CRSs argentinos.
263
         * coordenadas geograficas
264
			PosGAr 4172 
265
			PosGAr98 4190
266
			
267
			coordenadas proyectadas
268
			POSGAR 94/Argentina 1 22191 
269
			POSGAR 94/Argentina 2 22192
270
			POSGAR 94/Argentina 3 22193
271
			POSGAR 94/Argentina 4 22194
272
			POSGAR 94/Argentina 5 22195
273
			POSGAR 94/Argentina 6 22196
274
			POSGAR 94/Argentina 7 22197
275
			
276
			POSGAR 98/Argentina 1 22181
277
			POSGAR 98/Argentina 2 22182
278
			POSGAR 98/Argentina 3 22183
279
			POSGAR 98/Argentina 4 22184
280
			POSGAR 98/Argentina 5 22185
281
			POSGAR 98/Argentina 6 22186
282
			POSGAR 98/Argentina 7 22187
283
			
284
			4221 GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
285
			
286
			22191	EPSG	22191	PROJCS["Argentina_Zone_1",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",1500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-72],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]]	+proj=tmerc +lat_0=-90 +lon_0=-72 +k=1.000000 +x_0=1500000 +y_0=0 +ellps=intl +units=m
287
			22192	EPSG	22192	PROJCS["Argentina_Zone_2",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",2500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-69],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]]	+proj=tmerc +lat_0=-90 +lon_0=-69 +k=1.000000 +x_0=2500000 +y_0=0 +ellps=intl +units=m
288
			22193	EPSG	22193	PROJCS["Argentina_Zone_3",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",3500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-66],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]]	+proj=tmerc +lat_0=-90 +lon_0=-66 +k=1.000000 +x_0=3500000 +y_0=0 +ellps=intl +units=m
289
			22194	EPSG	22194	PROJCS["Argentina_Zone_4",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",4500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-63],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]]	+proj=tmerc +lat_0=-90 +lon_0=-63 +k=1.000000 +x_0=4500000 +y_0=0 +ellps=intl +units=m
290
			22195	EPSG	22195	PROJCS["Argentina_Zone_5",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",5500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-60],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]]	+proj=tmerc +lat_0=-90 +lon_0=-60 +k=1.000000 +x_0=5500000 +y_0=0 +ellps=intl +units=m
291
			22196	EPSG	22196	PROJCS["Argentina_Zone_6",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",6500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-57],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]]	+proj=tmerc +lat_0=-90 +lon_0=-57 +k=1.000000 +x_0=6500000 +y_0=0 +ellps=intl +units=m
292
			22197	EPSG	22197	PROJCS["Argentina_Zone_7",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",7500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-54],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]]	+proj=tmerc +lat_0=-90 +lon_0=-54 +k=1.000000 +x_0=7500000 +y_0=0 +ellps=intl +units=m
293

  
294
         */
295
        cs = new CoordSys(CSDatum.posgar);
296
        cs.setAbrev("EPSG:4172"); // Posgar
297
        data.put(cs.getAbrev(), cs);
298
        
299
        cs = new CoordSys(
300
			"GEOGCS[\"GCS_Campo_Inchauspe\"," +
301
				"DATUM[\"D_Campo_Inchauspe\"," +
302
					"SPHEROID[\"International_1924\",6378388,297],"+
303
					"TOWGS84[0,0,0,0,0,0,0]]," +
304
				"PRIMEM[\"Greenwich\",0]," +
305
				"UNIT[\"Degree\",0.017453292519943295]]");
306
        cs.setAbrev("EPSG:4221"); // Campo Inchauspe
307
        data.put(cs.getAbrev(), cs);
308
        
309
       for (int i=1; i<=7; i++) {
310
	        cs = new CoordSys(
311
	        	"PROJCS[\"Argentina_Zone_"+i+"\"," +
312
	        		"GEOGCS[\"GCS_Campo_Inchauspe\"," +
313
	        			"DATUM[\"D_Campo_Inchauspe\"," +
314
		        			"SPHEROID[\"International_1924\",6378388,297],"+
315
		        			"TOWGS84[0,0,0,0,0,0,0]]," +
316
		        		"PRIMEM[\"Greenwich\",0]," +
317
		        		"UNIT[\"Degree\",0.017453292519943295]]," +
318
		        	"PROJECTION[\"Transverse_Mercator\"]," +
319
		        	"PARAMETER[\"False_Easting\",1500000]," +
320
		        	"PARAMETER[\"False_Northing\",0]," +
321
		        	"PARAMETER[\"Central_Meridian\","+(-75+3*i)+"]," +
322
		        	"PARAMETER[\"Scale_Factor\",1]," +
323
		        	"PARAMETER[\"Latitude_Of_Origin\",-90]," +
324
		        	"UNIT[\"Meter\",1]]");
325
	        cs.setAbrev("EPSG:2219"+i); // Posgar
326
	        data.put(cs.getAbrev(), cs);
327
        }
328
       
329
       /*
330
        * pendiente de a?adir:
331
        * 
332
        * EPSG 3003: Montemario / Italy Zone 1 - Pendiente de a?adir
333
      	* EPSG 4149: CH1903 - Pendiente de a?adir
334
      	* Ecuador:
335
      	*   PSAD56, Geo, UTM 16/17S,16/17N
336
      	*/
337
    }
338

  
339
    /**
340
     * Mete una nueva proyeccion en la Pool.
341
     * @param name abreviatura de la proyecccion (i.e. EPSG:23030)
342
     * @param proj Proyeccion
343
     */
344
    public static void add(String name, IProjection proj) {
345
        data.put(name, proj);
346
    }
347

  
348
    /**
349
     * Devuelve una proyeccion a partir de una cadena.
350
     * @param name abreviatura de la proyecccion (i.e. EPSG:23030)
351
     * @return Proyeccion si existe
352
     */
353
    public IProjection get(String name) {
354
        IProjection proj = null;
355

  
356
        if (ProjectionPool.data.containsKey(name)) {
357
            proj = (IProjection) ProjectionPool.data.get(name);
358
        } else {
359
        	// Consultation to remote EPSG database
360
        	// if (right)
361
        	//    buil new IProjection from GML
362
        	// else
363
            System.err.println("ProjectionPool: Key '" + name + "' not set.");
364
        }
365

  
366
        return proj;
367
    }
368

  
369
    public static Iterator iterator() {
370
        ArrayList projs = new ArrayList();
371

  
372
        Iterator iter = data.entrySet().iterator();
373

  
374
        while (iter.hasNext()) {
375
            projs.add(((Map.Entry) iter.next()).getValue());
376
        }
377

  
378
        return projs.iterator();
379
    }
380

  
381
	public boolean doesRigurousTransformations() {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff