14 #define PI_OVER_2 (M_PI/2) 16 #define TWOPI (2*M_PI) 17 #define HALFPI (M_PI/2.0) 19 #define PI_HALFPI 4.71238898038468985766 20 #define TWOPI_HALFPI 7.85398163397448309610 21 #define ONE_TOL 1.00000000000001 23 #define FORTPI 0.78539816339744833 29 if ((av = fabs(v)) >= 1.)
39 if ((av = fabs(v)) >= 1.)
41 return (v < 0. ?
PI : 0.);
47 return ((v <= 0) ? 0. : sqrt(v));
51 return ((fabs(
n) <
ATOL && fabs(d) <
ATOL) ? 0. : atan2(
n,d));
54 static const char* PATH_KW =
"path";
55 static const char* SATELLITE_TYPE_KW =
"satellite_type";
58 static const char* ANGLE_OF_INCLINATION_KW =
"angle_of_inclination";
59 static const char* REVOLUTION_TIME_KW =
"earth_rev_time";
60 static const char* EARTH_ROTATION_LENGTH_KW =
"earth_rot_length";
61 static const char* LONGITUDE_ASCENDING_NODE_KW =
"lon_ascending_node";
62 static const char* J_COEFFICIENT_KW =
"j_coeff";
63 static const char* W_COEFFICIENT_KW =
"w_coeff";
64 static const char* Q_COEFFICIENT_KW =
"q_coeff";
65 static const char* T_COEFFICIENT_KW =
"t_coeff";
66 static const char* A2_COEFFICIENT_KW =
"a2_coeff";
67 static const char* A4_COEFFICIENT_KW =
"a4_coeff";
68 static const char* B_COEFFICIENT_KW =
"b_coeff";
69 static const char* C1_COEFFICIENT_KW =
"c1_coeff";
70 static const char* C3_COEFFICIENT_KW =
"c3_coeff";
71 static const char* ECCENTRICITY_KW =
"eccentricity";
87 setParameters(type, pathNumber);
144 rlm =
PI * (1. / 248. + .5161290322580645);
148 for (lam = 9.; lam <= 81.0001; lam += 18.)
150 for (lam = 18; lam <= 72.0001; lam += 18.)
168 double sdsq, h, s, fc, sd,
sq, d__1;
173 s =
p22 *
sa * cos(lam) * sqrt((1. +
t * sdsq) / ((
174 1. +
w * sdsq) * (1. +
q * sdsq)));
175 d__1 = 1. +
q * sdsq;
176 h = sqrt((1. +
q * sdsq) / (1. +
w * sdsq)) * ((1. +
177 w * sdsq) / (d__1 * d__1) -
p22 *
ca);
178 sq = sqrt(
xj *
xj + s * s);
179 b += fc = mult * (h *
xj - s * s) /
sq;
180 a2 += fc * cos(lam + lam);
181 a4 += fc * cos(lam * 4.);
182 fc = mult * s * (h +
xj) /
sq;
184 c3 += fc * cos(lam * 3.);
207 double lamt, xlam, sdsq, c, d, s, lamdp, phidp, lampp, tanph,
208 lamtp, cl, sd, sp, fac, sav, tanphi;
209 double phi = gpt.
latr();
221 lamtp = lam +
p22 * lampp;
225 fac = lampp - sin(lampp) * (cl < 0. ? -
HALFPI :
HALFPI);
226 for (l = 50; l; --l) {
227 lamt = lam +
p22 * sav;
228 if (fabs(c = cos(lamt)) <
TOL)
230 xlam = (
one_es * tanphi *
sa + sin(lamt) *
ca) / c;
231 lamdp = atan(xlam) + fac;
232 if (fabs(fabs(sav) - fabs(lamdp)) <
TOL)
236 if (!l || ++nn >= 3 || (lamdp >
rlm && lamdp <
rlm2))
240 else if (lamdp >=
rlm2)
246 sin(lamt)) / sqrt(1. -
es * sp * sp));
247 tanph = log(tan(
FORTPI + .5 * phidp));
250 s =
p22 *
sa * cos(lamdp) * sqrt((1. +
t * sdsq)
251 / ((1. +
w * sdsq) * (1. +
q * sdsq)));
252 d = sqrt(
xj *
xj + s * s);
253 xy.
x =
b * lamdp +
a2 * sin(2. * lamdp) +
a4 *
254 sin(lamdp * 4.) - tanph * s / d;
255 xy.
y =
c1 * sd +
c3 * sin(lamdp * 3.) + tanph *
xj / d;
277 double lamt, sdsq, s, lamdp, phidp, sppsq, dd, sd, sl, fac, scl, sav, spp;
290 s =
p22 *
sa * cos(lamdp) * sqrt((1. +
t * sdsq)
291 / ((1. +
w * sdsq) * (1. +
q * sdsq)));
292 lamdp = xy.
x + xy.
y * s /
xj -
a2 * sin(
293 2. * lamdp) -
a4 * sin(lamdp * 4.) - s /
xj * (
294 c1 * sin(lamdp) +
c3 * sin(lamdp * 3.));
296 }
while (fabs(lamdp - sav) >=
TOL && --nn);
298 fac = exp(sqrt(1. + s * s /
xj /
xj) * (xy.
y -
299 c1 * sl -
c3 * sin(lamdp * 3.)));
300 phidp = 2. * (atan(fac) -
FORTPI);
302 if (fabs(cos(lamdp)) <
TOL)
306 lamt = atan(((1. - sppsq *
rone_es) * tan(lamdp) *
ca -
307 spp *
sa * sqrt((1. +
q * dd) * (1. - sppsq) - sppsq *
u) /
308 cos(lamdp)) / (1. - sppsq * (1. +
u)));
309 sl = lamt >= 0. ? 1. : -1.;
310 scl = cos(lamdp) >= 0. ? 1. : -1;
311 lamt -=
HALFPI * (1. - scl) * sl;
313 lam = lamt -
p22 * lamdp;
317 phi = atan((tan(lamdp) * cos(lamt) -
ca * sin(lamt)) /
341 const char* prefix)
const 363 const char* path = kwl.
find(prefix, PATH_KW);
364 const char* type = kwl.
find(prefix, SATELLITE_TYPE_KW);
402 if (!ossimMapProjection::operator==(proj))
407 if (!p)
return false;
double eccentricity() const
double aatan2(double n, double d)
virtual void setParameters(ossimSatelliteType type, double path)
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
ossimSatelliteType theSatelliteType
Represents serializable keyword/value map.
const char * find(const char *key) const
bool almostEqual(T x, T y, T tolerance=FLT_EPSILON)
virtual const ossimString & code() const
RTTI_DEF1(ossimSpaceObliqueMercatorProjection, "ossimSpaceObliqueMercatorProjection", ossimMapProjection)
ossimSpaceObliqueMercatorProjection(ossimSatelliteType type=SOM_TYPE_LANDSAT_7, double pathNumber=34, const ossimEllipsoid &ellipsoid=ossimEllipsoid())
void changeDatum(const ossimDatum *datum)
This will actually perform a shift.
const ossimDatum * datum() const
datum().
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
os2<< "> n<< " > nendobj n
double lonr() const
Returns the longitude in radian measure.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
virtual bool operator==(const ossimProjection &projection) const
Returns TRUE if principal parameters are within epsilon tolerance.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
virtual ossimDpt forward(const ossimGpt &worldPoint) const
All map projections will convert the world coordinate to an easting northing (Meters).
virtual ossimGpt inverse(const ossimDpt &projectedPoint) const
Will take a point in meters and convert it to ground.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
void seraz0(double lam, double mult)
double latr() const
latr().
ossimEllipsoid theEllipsoid
This method verifies that the projection parameters match the current pcs code.
const ossimDatum * theDatum
This is only set if we want to have built in datum shifting.