Revision 8433

View differences:

trunk/libraries/libJCRS/.classpath
5 5
	<classpathentry combineaccessrules="false" kind="src" path="/libCq CMS for java"/>
6 6
	<classpathentry combineaccessrules="false" kind="src" path="/_fwAndami"/>
7 7
	<classpathentry combineaccessrules="false" kind="src" path="/appgvSIG"/>
8
	<classpathentry sourcepath="/libUI/src" kind="lib" path="/_fwAndami/lib/beans.jar"/>
8
	<classpathentry kind="lib" path="/_fwAndami/lib/beans.jar" sourcepath="/libUI/src"/>
9 9
	<classpathentry combineaccessrules="false" kind="src" path="/libFMap"/>
10 10
	<classpathentry kind="lib" path="/libCq CMS for java/lib/jogr.jar"/>
11
	<classpathentry sourcepath="/Utiles/src" kind="lib" path="/_fwAndami/lib/iver-utiles.jar"/>
11
	<classpathentry kind="lib" path="/_fwAndami/lib/iver-utiles.jar" sourcepath="/Utiles/src"/>
12 12
	<classpathentry kind="output" path="bin"/>
13 13
</classpath>
trunk/libraries/libJCRS/src-test/org/gvsig/crs/repository/db_epsg.properties
1
#HSQL database
2
#Mon Oct 30 12:39:12 CET 2006
3
hsqldb.cache_file_scale=1
4
runtime.gc_interval=0
5
hsqldb.first_identity=0
6
version=1.7.3
7
modified=yes
8
hsqldb.script_format=0
9
sql.enforce_size=false
10
hsqldb.cache_size_scale=10
11
hsqldb.cache_scale=14
12
hsqldb.version=1.7.3
13
hsqldb.log_size=200
14
sql.enforce_strict_size=false
15
readonly=false
16
hsqldb.compatible_version=1.7.2
17
hsqldb.original_version=1.7.3
18
sql.compare_in_locale=false
19
hsqldb.nio_data_file=true
20
hsqldb.cache_version=1.7.0
0 21

  
trunk/libraries/libJCRS/src-test/org/gvsig/crs/repository/RepositoryTest.java
1
package org.gvsig.crs.repository;
2

  
3
import org.gvsig.crs.Crs;
4

  
5

  
6
public class RepositoryTest {
7
	public static void main(String[] args){
8
		EpsgRepository epsgRep= new EpsgRepository();
9
		Crs crs = (Crs)epsgRep.getCrs("23030");
10
		String abrev = crs.getAbrev();
11
		System.out.println(abrev);
12
	}
13
}
0 14

  
trunk/libraries/libJCRS/src-test/org/gvsig/crs/repository/db_iau2000.properties
1
#HSQL database
2
#Mon Oct 30 13:00:11 CET 2006
3
hsqldb.cache_file_scale=1
4
runtime.gc_interval=0
5
hsqldb.first_identity=0
6
version=1.7.3
7
modified=no
8
hsqldb.script_format=0
9
sql.enforce_size=false
10
hsqldb.cache_size_scale=10
11
hsqldb.cache_scale=14
12
hsqldb.version=1.7.3
13
hsqldb.log_size=200
14
sql.enforce_strict_size=false
15
readonly=false
16
hsqldb.compatible_version=1.7.2
17
hsqldb.original_version=1.7.3
18
sql.compare_in_locale=false
19
hsqldb.nio_data_file=true
20
hsqldb.cache_version=1.7.0
0 21

  
trunk/libraries/libJCRS/src/org/gvsig/crs/repository/EpsgRepository.java
40 40

  
41 41
package org.gvsig.crs.repository;
42 42

  
43
import java.sql.ResultSet;
44
import java.sql.SQLException;
45

  
46
import org.gvsig.crs.Crs;
47
import org.gvsig.crs.CrsException;
48
import org.gvsig.crs.EpsgConnection;
43 49
import org.gvsig.crs.ICrs;
50
import org.gvsig.crs.Query;
51
import org.gvsig.crs.ogr.Epsg2wkt;
52
import org.gvsig.crs.ogr.GetCRSepsg;
44 53

  
45 54
/**
46 55
 * Repositorio de CRSs de EPSG
......
49 58
 *
50 59
 */
51 60
public class EpsgRepository implements ICrsRepository {
61
	
62
	public EpsgRepository() {
63
		connect = new EpsgConnection();
64
		connect.setConnectionEPSG();
65
	}
52 66

  
67
	public EpsgConnection connect = null;
68

  
53 69
	/**
54 70
	 * Obtiene un CRS a partir de su c?digo EPSG.
55 71
	 * 
......
57 73
	 * @return ICrs 
58 74
	 */
59 75
	public ICrs getCrs(String code) {
60
		return null;
76
		int epsg_code  = Integer.parseInt(code);
77
		boolean source_yn = false;
78
		int source_cod = 0;
79
		int datum_code = 0;
80
		int projection_conv_code = 0;
81
		String crs_kind = null;
82
		
83
		Epsg2wkt wkt = null;
84
		
85
		Crs crs = null;
86
		
87
		ResultSet result = null;
88
		String sentence = "SELECT source_geogcrs_code, projection_conv_code, "
89
			+ "coord_ref_sys_kind, datum_code "
90
			+ "FROM epsg_coordinatereferencesystem "
91
			+ "WHERE coord_ref_sys_code = " + code;
92
						
93
		result = Query.select(sentence,connect.getConnection());	
94
		
95
		try {
96
			result.next();
97
			source_cod = result.getInt("source_geogcrs_code");
98
			projection_conv_code = result.getInt("projection_conv_code");
99
			crs_kind = result.getString("coord_ref_sys_kind");
100
			datum_code = result.getInt("datum_code");
101
		} catch (SQLException e1) {
102
			e1.printStackTrace();
103
		}
104
		
105
		if (datum_code != 0){
106
			source_yn = true;
107
			GetCRSepsg ep = new GetCRSepsg(epsg_code, source_yn, source_cod, projection_conv_code, connect);
108
			ep.Getepsgdata();
109
		}
110
		else if (source_cod != 0){
111
			source_yn = false;
112
		}
113
		else source_yn = true;
114
		
115
		GetCRSepsg ep = new GetCRSepsg(epsg_code, source_yn, source_cod, projection_conv_code, connect);
116
		ep.Getepsgdata();
117
		
118
		if (crs_kind.equals("geographic 2D") || crs_kind.equals("geographic 3D")){
119
			wkt = new Epsg2wkt(ep , "geog");			
120
		}
121
		else if (crs_kind.equals("projected")){
122
			wkt = new Epsg2wkt(ep, "proj");
123
		}
124
		else if (crs_kind.equals("compound")){
125
			wkt = new Epsg2wkt(ep,"comp");
126
		}
127
		else if (crs_kind.equals("geocentric")){
128
			wkt = new Epsg2wkt(ep,"geoc");
129
		}
130
		
131
		try {
132
			crs = new Crs(Integer.parseInt(code),wkt.getWKT());
133
		} catch (CrsException e) {
134
			// TODO Auto-generated catch block
135
			e.printStackTrace();
136
		}
137
		
138
		return crs;
61 139
	}
62 140

  
63 141
}
trunk/libraries/libJCRS/src/org/gvsig/crs/ogr/GetCRSepsg.java
6 6
import org.gvsig.crs.EpsgConnection;
7 7
import org.gvsig.crs.Query;
8 8

  
9
import org.gvsig.crs.gui.panels.ProjChooserPanel;
10 9

  
11

  
12 10
public class GetCRSepsg {
13 11
	
14 12
	int epsg_code;
trunk/libraries/libJCRS/src/org/gvsig/crs/CrsFactory.java
4 4

  
5 5
import org.cresques.cts.ICRSFactory;
6 6
import org.cresques.cts.IProjection;
7
import org.gvsig.crs.repository.EpsgRepository;
7 8

  
8 9
public class CrsFactory implements ICRSFactory {
9 10
	static TreeMap data = new TreeMap();
......
17 18
	 * @throws CrsException
18 19
	 */
19 20
	public ICrs getCRS(String code) throws CrsException {
21
		
20 22
		if (data.containsKey(code))
21 23
			return (Crs) data.get(code);
22 24

  
trunk/libraries/libJCRS/src/org/gvsig/crs/Crs.java
88 88
	    		proj4 =CrsOgr.exportToProj4(oSRSSource);
89 89
				crsProj4 = new CrsProj(proj4);
90 90
	    		setName(fullCode);
91
	    		setAbrev(crsWkt.getName());
91
	    		//setAbrev(crsWkt.getName());
92
	    		setAbrev(crsWkt.getAuthority()[0]+":"+crsWkt.getAuthority()[1]);
92 93
	    	} catch (OGRException e) {
93 94
				throw new CrsException(e);
94 95
			} catch (crsgdalException e) {
......
245 246
	    		proj4 =CrsOgr.exportToProj4(oSRSSource)+params+" ";
246 247
				crsProj4 = new CrsProj(proj4);
247 248
	    		setName(fullCode);
248
	    		setAbrev(crsWkt.getName());
249
	    		//setAbrev(crsWkt.getName());
250
	    		setAbrev(crsWkt.getAuthority()[0]+":"+crsWkt.getAuthority()[1]);
249 251
	    	} catch (OGRException e) {
250 252
				throw new CrsException(e);
251 253
			} catch (crsgdalException e) {
trunk/extensions/extJCRS/.classpath
1 1
<?xml version="1.0" encoding="UTF-8"?>
2 2
<classpath>
3 3
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
4
	<classpathentry kind="lib" path="C:/gvSIGHead/libFMap/lib/jcrs.jar"/>
5 4
	<classpathentry combineaccessrules="false" kind="src" path="/appgvSIG"/>
6 5
	<classpathentry combineaccessrules="false" kind="src" path="/libFMap"/>
7 6
	<classpathentry combineaccessrules="false" kind="src" path="/_fwAndami"/>
8
	<classpathentry sourcepath="/jCMS" kind="lib" path="/libFMap/lib/cms.jar"/>
7
	<classpathentry kind="lib" path="/libFMap/lib/cms.jar" sourcepath="/jCMS"/>
9 8
	<classpathentry kind="src" path="src"/>
9
	<classpathentry kind="lib" path="/libFMap/lib/jcrs.jar" sourcepath="/libJCRS/src"/>
10 10
	<classpathentry kind="output" path="bin"/>
11 11
</classpath>

Also available in: Unified diff