root / org.gvsig.sis.proj / trunk / org.gvsig.sis.proj / org.gvsig.sis.proj.lib.impl / src / main / java / org / gvsig / sis / proj / lib / SisCoordinateReferenceSystemManager.java @ 818
History | View | Annotate | Download (2.07 KB)
1 |
package org.gvsig.sis.proj.lib; |
---|---|
2 |
|
3 |
import java.text.ParseException; |
4 |
|
5 |
import org.gvsig.proj.CoordinateOperationNotFoundException; |
6 |
import org.gvsig.proj.CoordinateReferenceSystem; |
7 |
import org.gvsig.proj.CoordinateReferenceSystemException; |
8 |
import org.gvsig.proj.CoordinateReferenceSystemManager; |
9 |
import org.gvsig.proj.CoordinateTransformation; |
10 |
import org.gvsig.proj.catalog.CRSCatalogLocator; |
11 |
import org.gvsig.proj.catalog.CRSCatalogManager; |
12 |
import org.gvsig.proj.catalog.CRSDefinition; |
13 |
import org.gvsig.proj.catalog.TransformationDefinition; |
14 |
import org.gvsig.sis.proj.catalog.DefaultCRS; |
15 |
import org.gvsig.sis.proj.catalog.DefaultTransformation; |
16 |
|
17 |
public class SisCoordinateReferenceSystemManager implements CoordinateReferenceSystemManager { |
18 |
private CRSCatalogManager catalogManager = null; |
19 |
|
20 |
public SisCoordinateReferenceSystemManager() {
|
21 |
} |
22 |
|
23 |
@Override
|
24 |
public CoordinateReferenceSystem getCoordinateReferenceSystem(String wkt) |
25 |
throws CoordinateReferenceSystemException {
|
26 |
return new DefaultCRS(wkt); |
27 |
} |
28 |
|
29 |
@Override
|
30 |
public CoordinateReferenceSystem getCoordinateReferenceSystem(CRSDefinition definition)
|
31 |
throws CoordinateReferenceSystemException {
|
32 |
if (definition instanceof DefaultCRS) { |
33 |
return (DefaultCRS) definition;
|
34 |
} |
35 |
else {
|
36 |
return new DefaultCRS(definition.toWKT()); |
37 |
} |
38 |
} |
39 |
|
40 |
@Override
|
41 |
public CoordinateTransformation getCoordinateTransformation(String wkt) |
42 |
throws CoordinateOperationNotFoundException, ParseException { |
43 |
return new DefaultTransformation(wkt); |
44 |
} |
45 |
|
46 |
@Override
|
47 |
public CoordinateTransformation getCoordinateTransformation(TransformationDefinition definition)
|
48 |
throws CoordinateReferenceSystemException, ParseException { |
49 |
if (definition instanceof DefaultTransformation) { |
50 |
return (CoordinateTransformation) definition;
|
51 |
} |
52 |
return new DefaultTransformation(definition.toWKT()); |
53 |
} |
54 |
|
55 |
@Override
|
56 |
public void setCatalogManager(CRSCatalogManager manager) { |
57 |
this.catalogManager = manager;
|
58 |
} |
59 |
|
60 |
public CRSCatalogManager getCatalogManager() {
|
61 |
if( this.catalogManager == null ) { |
62 |
this.catalogManager = CRSCatalogLocator.getManager();
|
63 |
} |
64 |
return this.catalogManager; |
65 |
} |
66 |
|
67 |
} |