root / branches / CqCMSDvp / libraries / libCq CMS for java.old / src / org / cresques / geo / Ellipsoid.java @ 2249
History | View | Annotate | Download (3.57 KB)
1 |
/*
|
---|---|
2 |
* Created on 21-jun-2005
|
3 |
*
|
4 |
* To change the template for this generated file go to
|
5 |
* Window>Preferences>Java>Code Generation>Code and Comments
|
6 |
*/
|
7 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
8 |
*
|
9 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
10 |
*
|
11 |
* This program is free software; you can redistribute it and/or
|
12 |
* modify it under the terms of the GNU General Public License
|
13 |
* as published by the Free Software Foundation; either version 2
|
14 |
* of the License, or (at your option) any later version.
|
15 |
*
|
16 |
* This program is distributed in the hope that it will be useful,
|
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
* GNU General Public License for more details.
|
20 |
*
|
21 |
* You should have received a copy of the GNU General Public License
|
22 |
* along with this program; if not, write to the Free Software
|
23 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
24 |
*
|
25 |
* For more information, contact:
|
26 |
*
|
27 |
* Generalitat Valenciana
|
28 |
* Conselleria d'Infraestructures i Transport
|
29 |
* Av. Blasco Ib??ez, 50
|
30 |
* 46010 VALENCIA
|
31 |
* SPAIN
|
32 |
*
|
33 |
* +34 963862235
|
34 |
* gvsig@gva.es
|
35 |
* www.gvsig.gva.es
|
36 |
*
|
37 |
* or
|
38 |
*
|
39 |
* IVER T.I. S.A
|
40 |
* Salamanca 50
|
41 |
* 46005 Valencia
|
42 |
* Spain
|
43 |
*
|
44 |
* +34 963163400
|
45 |
* dac@iver.es
|
46 |
*/
|
47 |
package org.cresques.geo; |
48 |
|
49 |
import org.cresques.cts.IDatum; |
50 |
|
51 |
public class Ellipsoid implements IDatum { |
52 |
//'WGS72': (6378135.0, 298.26, 1972),
|
53 |
public static final Ellipsoid wgs72 = new Ellipsoid("WGS72", 6378135.0, 298.26); |
54 |
//'WGS84': (6378137.0, 298.257223563, 1984),
|
55 |
public static final Ellipsoid wgs84 = new Ellipsoid("WGS84", 6378137.0, 298.257223563); |
56 |
//'GRS80': (6378137.0, 298.257222101, 1980), // , 6356752.314
|
57 |
public static final Ellipsoid grs80 = new Ellipsoid("GRS80", 6378137.0, 298.257222101); |
58 |
//'Hayford': (6378388.0, 297.0, 1909),
|
59 |
public static final Ellipsoid hayford = new Ellipsoid("Hayford", 6378388.0, 297.0); |
60 |
//'Struve': (6378298.0, 299.73, 1860),
|
61 |
public static final Ellipsoid struve = new Ellipsoid("Struve", 6378298.0, 299.73); |
62 |
// ed50 ... ?hayford?
|
63 |
public static final Ellipsoid ed50 = new Ellipsoid("ED50", 6378388.0, 297.0); |
64 |
// Clarcke 1866 a = 6378206.4; f = 294.9786982;
|
65 |
public static final Ellipsoid clarke66 = new Ellipsoid("CLARKE 1866", 6378206.4, 294.9786982); |
66 |
|
67 |
|
68 |
private String pName = null; |
69 |
private double pMajor = 0.0; |
70 |
private double pFlat = 0.0; |
71 |
public double a, b, f, e, e2, ep, ep2; |
72 |
public Ellipsoid(String name, double major, double flat) { |
73 |
pName = name; |
74 |
pMajor = major; |
75 |
pFlat = flat; |
76 |
a = pMajor; |
77 |
f = pFlat; |
78 |
ainvto(); |
79 |
} |
80 |
public String getName() { return pName; } |
81 |
private void ainvto() |
82 |
{ |
83 |
b = (a * (pFlat - 1.0D)) / pFlat;
|
84 |
e2 = (2D * pFlat - 1.0D) / (pFlat * pFlat); |
85 |
e = Math.sqrt(e2);
|
86 |
ep2 = e2 / (1.0D - e2);
|
87 |
ep = Math.sqrt(ep2);
|
88 |
} |
89 |
|
90 |
private void abto() |
91 |
{ |
92 |
if(Math.abs(a - b) < 9.9999999999999995E-021D) |
93 |
{ |
94 |
pFlat = 0.0D;
|
95 |
e2 = 0.0D;
|
96 |
} else
|
97 |
{ |
98 |
pFlat = a / (a - b); |
99 |
e2 = (2D * pFlat - 1.0D) / (pFlat * pFlat); |
100 |
} |
101 |
e = Math.sqrt(e2);
|
102 |
ep2 = e2 / (1.0D - e2);
|
103 |
ep = Math.sqrt(ep2);
|
104 |
} |
105 |
|
106 |
public double [] getParam() { |
107 |
double [] elipar = new double[8]; |
108 |
elipar[1] = pMajor;
|
109 |
elipar[2] = pFlat;
|
110 |
elipar[3] = b;
|
111 |
elipar[4] = e;
|
112 |
elipar[5] = e2;
|
113 |
elipar[6] = ep;
|
114 |
elipar[7] = ep2;
|
115 |
return elipar;
|
116 |
} |
117 |
/* (non-Javadoc)
|
118 |
* @see org.cresques.cts.IDatum#getSemiMajorAxis()
|
119 |
*/
|
120 |
public double getESemiMajorAxis() { |
121 |
return pMajor;
|
122 |
} |
123 |
/* (non-Javadoc)
|
124 |
* @see org.cresques.cts.IDatum#getEIFlattening()
|
125 |
*/
|
126 |
public double getEIFlattening() { |
127 |
return pFlat;
|
128 |
} |
129 |
} |