root / branches / v02_desarrollo / libraries / libCq CMS for java.old / src / org / cresques / cts / gt2 / CSUTM.java @ 406
History | View | Annotate | Download (1.79 KB)
1 |
/*
|
---|---|
2 |
* Creado el 05-ago-2004
|
3 |
*/
|
4 |
package org.cresques.cts.gt2; |
5 |
|
6 |
import org.geotools.cs.AxisInfo; |
7 |
import org.geotools.cs.GeographicCoordinateSystem; |
8 |
import org.geotools.cs.Projection; |
9 |
import org.geotools.units.Unit; |
10 |
import org.opengis.referencing.FactoryException; |
11 |
|
12 |
/**
|
13 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es>
|
14 |
*/
|
15 |
public class CSUTM extends CoordSys { |
16 |
public CSUTM(CSDatum datum, int zone) { |
17 |
super(datum);
|
18 |
geogCS = new GeographicCoordinateSystem(
|
19 |
datum.getName(null),
|
20 |
datum.getDatum()); |
21 |
Unit linearUnit = Unit.METRE; |
22 |
|
23 |
javax.media.jai.ParameterList params = |
24 |
csFactory.createProjectionParameterList("Transverse_Mercator");
|
25 |
params.setParameter("semi_major", datum.getDatum().getEllipsoid().getSemiMajorAxis());
|
26 |
params.setParameter("semi_minor", datum.getDatum().getEllipsoid().getSemiMinorAxis());
|
27 |
params.setParameter("central_meridian", (double) (zone*6-183)); |
28 |
params.setParameter("latitude_of_origin", 0.0); |
29 |
params.setParameter("scale_factor", 0.9996); |
30 |
params.setParameter("false_easting", 500000.0); |
31 |
params.setParameter("false_northing", 0.0); |
32 |
try {
|
33 |
Projection projection = |
34 |
csFactory.createProjection("UTM"+zone, "Transverse_Mercator", params); |
35 |
projCS = csFactory.createProjectedCoordinateSystem( |
36 |
projection.getName().toString(), geogCS, projection, linearUnit, AxisInfo.X, AxisInfo.Y); |
37 |
} catch (FactoryException e) {
|
38 |
// TODO Bloque catch generado autom?ticamente
|
39 |
e.printStackTrace(); |
40 |
} |
41 |
} |
42 |
public double getScale(double minX, double maxX, double w, double dpi) { |
43 |
double scale = super.getScale(minX, maxX, w, dpi); |
44 |
if (projCS != null) { // Es geogr?fico; calcula la escala. |
45 |
scale = (maxX-minX)* // metros
|
46 |
(dpi / 2.54 * 100.0)/ // px / metro |
47 |
w; // pixels
|
48 |
} |
49 |
return scale;
|
50 |
} |
51 |
public String toString() { |
52 |
return projCS.toString();
|
53 |
} |
54 |
} |