Revision 8120 trunk/libraries/libCq CMS for java.old/src/org/cresques/cts/gt2/CoordSys.java
CoordSys.java | ||
---|---|---|
1 | 1 |
/* |
2 | 2 |
* Cresques Mapping Suite. Graphic Library for constructing mapping applications. |
3 | 3 |
* |
4 |
* Copyright (C) 2004-5.
|
|
4 |
* Copyright (C) 2004-6.
|
|
5 | 5 |
* |
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
... | ... | |
31 | 31 |
import org.cresques.cts.ICoordTrans; |
32 | 32 |
import org.cresques.cts.IDatum; |
33 | 33 |
import org.cresques.cts.IProjection; |
34 |
import org.cresques.cts.ProjectionPool; |
|
35 | 34 |
import org.cresques.geo.ViewPortData; |
36 | 35 |
import org.geotools.cs.CoordinateSystem; |
37 | 36 |
import org.geotools.cs.CoordinateSystemFactory; |
38 | 37 |
import org.geotools.cs.GeographicCoordinateSystem; |
39 | 38 |
import org.geotools.cs.ProjectedCoordinateSystem; |
39 |
import org.opengis.referencing.FactoryException; |
|
40 |
import org.opengis.referencing.datum.Datum; |
|
40 | 41 |
|
41 | 42 |
|
42 | 43 |
/** |
... | ... | |
54 | 55 |
|
55 | 56 |
public CoordSys(CSDatum datum) { |
56 | 57 |
this.datum = datum; |
58 |
this.geogCS = new GeographicCoordinateSystem(datum.getName(null), datum.getDatum()); |
|
59 |
} |
|
60 |
|
|
61 |
public CoordSys(String wkt) { |
|
62 |
try { |
|
63 |
//((GeographicCoordinateSystem) |
|
64 |
CoordinateSystem cs = CoordinateSystemFactory.getDefault().createFromWKT(wkt); |
|
65 |
// ).getHorizontalDatum(); |
|
66 |
if (cs instanceof GeographicCoordinateSystem) |
|
67 |
geogCS = (GeographicCoordinateSystem) cs; |
|
68 |
if (cs instanceof ProjectedCoordinateSystem) { |
|
69 |
projCS = (ProjectedCoordinateSystem) cs; |
|
70 |
geogCS = projCS.getGeographicCoordinateSystem(); |
|
71 |
} |
|
72 |
datum = new CSDatum(geogCS.getHorizontalDatum()); |
|
73 |
} catch (FactoryException e) { |
|
74 |
// TODO Auto-generated catch block |
|
75 |
e.printStackTrace(); |
|
76 |
} |
|
57 | 77 |
} |
58 | 78 |
|
59 | 79 |
/** |
... | ... | |
192 | 212 |
} |
193 | 213 |
|
194 | 214 |
public ICoordTrans getCT(IProjection dest) { |
195 |
// TODO Auto-generated method stub |
|
196 | 215 |
return new CoordTrans(this, (CoordSys) dest); |
197 | 216 |
} |
198 | 217 |
} |
Also available in: Unified diff