Statistics
| Revision:

root / org.gvsig.jcrs / trunk / libJCRS / src / org / gvsig / crs / repository / UsrRepositoryGT.java @ 65

History | View | Annotate | Download (957 Bytes)

1
package org.gvsig.crs.repository;
2

    
3
import org.geotools.referencing.CRS;
4
import org.opengis.referencing.FactoryException;
5
import org.opengis.referencing.NoSuchAuthorityCodeException;
6
import org.opengis.referencing.crs.CoordinateReferenceSystem;
7
import org.slf4j.Logger;
8
import org.slf4j.LoggerFactory;
9

    
10
import org.gvsig.crs.CrsGT;
11
import org.gvsig.crs.ICrs;
12

    
13
public class UsrRepositoryGT implements ICrsRepository {
14
    private static final Logger LOG =
15
        LoggerFactory.getLogger(UsrRepositoryGT.class);
16
    
17
        public ICrs getCrs(String code) {
18
                CrsGT crsGT = null;
19
                try {
20
                        CoordinateReferenceSystem crs = CRS.decode("USR:"+code);
21
                        crsGT = new CrsGT(crs);
22
                } catch (NoSuchAuthorityCodeException e) {
23
                    LOG.info("Impossible to get the CRS from Geotools.");
24
                        return null;                        
25
                } catch (FactoryException e) {
26
                    LOG.info("Impossible to get the CRS from Geotools.");
27
                        return null;
28
                }
29
                return crsGT;
30
        }
31

    
32
}