mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +01:00
Variables with underscores followed by a capital letter are prohibited by the C++ standard
Fixes #266
This commit is contained in:
parent
2ff2195116
commit
d035a307d8
@ -451,11 +451,11 @@ void GUI::createActions()
|
|||||||
_degreesMinutesAction->setActionGroup(ag);
|
_degreesMinutesAction->setActionGroup(ag);
|
||||||
connect(_degreesMinutesAction, SIGNAL(triggered()), this,
|
connect(_degreesMinutesAction, SIGNAL(triggered()), this,
|
||||||
SLOT(setDegreesMinutes()));
|
SLOT(setDegreesMinutes()));
|
||||||
_DMSAction = new QAction(tr("Degrees, minutes, seconds (DMS)"), this);
|
_dmsAction = new QAction(tr("Degrees, minutes, seconds (DMS)"), this);
|
||||||
_DMSAction->setMenuRole(QAction::NoRole);
|
_dmsAction->setMenuRole(QAction::NoRole);
|
||||||
_DMSAction->setCheckable(true);
|
_dmsAction->setCheckable(true);
|
||||||
_DMSAction->setActionGroup(ag);
|
_dmsAction->setActionGroup(ag);
|
||||||
connect(_DMSAction, SIGNAL(triggered()), this, SLOT(setDMS()));
|
connect(_dmsAction, SIGNAL(triggered()), this, SLOT(setDMS()));
|
||||||
_fullscreenAction = new QAction(QIcon(FULLSCREEN_ICON),
|
_fullscreenAction = new QAction(QIcon(FULLSCREEN_ICON),
|
||||||
tr("Fullscreen mode"), this);
|
tr("Fullscreen mode"), this);
|
||||||
_fullscreenAction->setMenuRole(QAction::NoRole);
|
_fullscreenAction->setMenuRole(QAction::NoRole);
|
||||||
@ -559,7 +559,7 @@ void GUI::createMenus()
|
|||||||
QMenu *coordinatesMenu = settingsMenu->addMenu(tr("Coordinates format"));
|
QMenu *coordinatesMenu = settingsMenu->addMenu(tr("Coordinates format"));
|
||||||
coordinatesMenu->addAction(_decimalDegreesAction);
|
coordinatesMenu->addAction(_decimalDegreesAction);
|
||||||
coordinatesMenu->addAction(_degreesMinutesAction);
|
coordinatesMenu->addAction(_degreesMinutesAction);
|
||||||
coordinatesMenu->addAction(_DMSAction);
|
coordinatesMenu->addAction(_dmsAction);
|
||||||
settingsMenu->addSeparator();
|
settingsMenu->addSeparator();
|
||||||
settingsMenu->addAction(_showToolbarsAction);
|
settingsMenu->addAction(_showToolbarsAction);
|
||||||
settingsMenu->addAction(_fullscreenAction);
|
settingsMenu->addAction(_fullscreenAction);
|
||||||
@ -1655,7 +1655,7 @@ void GUI::writeSettings()
|
|||||||
: _nauticalUnitsAction->isChecked() ? Nautical : Metric;
|
: _nauticalUnitsAction->isChecked() ? Nautical : Metric;
|
||||||
if (units != UNITS_DEFAULT)
|
if (units != UNITS_DEFAULT)
|
||||||
settings.setValue(UNITS_SETTING, units);
|
settings.setValue(UNITS_SETTING, units);
|
||||||
CoordinatesFormat format = _DMSAction->isChecked() ? DMS
|
CoordinatesFormat format = _dmsAction->isChecked() ? DMS
|
||||||
: _degreesMinutesAction->isChecked() ? DegreesMinutes : DecimalDegrees;
|
: _degreesMinutesAction->isChecked() ? DegreesMinutes : DecimalDegrees;
|
||||||
if (format != COORDINATES_DEFAULT)
|
if (format != COORDINATES_DEFAULT)
|
||||||
settings.setValue(COORDINATES_SETTING, format);
|
settings.setValue(COORDINATES_SETTING, format);
|
||||||
@ -1879,7 +1879,7 @@ void GUI::readSettings()
|
|||||||
|
|
||||||
value = settings.value(COORDINATES_SETTING, COORDINATES_DEFAULT).toInt();
|
value = settings.value(COORDINATES_SETTING, COORDINATES_DEFAULT).toInt();
|
||||||
if (value == DMS)
|
if (value == DMS)
|
||||||
_DMSAction->trigger();
|
_dmsAction->trigger();
|
||||||
else if (value == DegreesMinutes)
|
else if (value == DegreesMinutes)
|
||||||
_degreesMinutesAction->trigger();
|
_degreesMinutesAction->trigger();
|
||||||
else
|
else
|
||||||
|
@ -180,7 +180,7 @@ private:
|
|||||||
QAction *_nauticalUnitsAction;
|
QAction *_nauticalUnitsAction;
|
||||||
QAction *_decimalDegreesAction;
|
QAction *_decimalDegreesAction;
|
||||||
QAction *_degreesMinutesAction;
|
QAction *_degreesMinutesAction;
|
||||||
QAction *_DMSAction;
|
QAction *_dmsAction;
|
||||||
QAction *_totalTimeAction;
|
QAction *_totalTimeAction;
|
||||||
QAction *_movingTimeAction;
|
QAction *_movingTimeAction;
|
||||||
QAction *_nextMapAction;
|
QAction *_nextMapAction;
|
||||||
|
@ -7,15 +7,15 @@ class Link {
|
|||||||
public:
|
public:
|
||||||
Link() {}
|
Link() {}
|
||||||
Link(const QString &URL, const QString &text = QString())
|
Link(const QString &URL, const QString &text = QString())
|
||||||
: _URL(URL), _text(text) {}
|
: _url(URL), _text(text) {}
|
||||||
|
|
||||||
void setURL(const QString &URL) {_URL = URL;}
|
void setURL(const QString &URL) {_url = URL;}
|
||||||
void setText(const QString &text) {_text = text;}
|
void setText(const QString &text) {_text = text;}
|
||||||
const QString &URL() const {return _URL;}
|
const QString &URL() const {return _url;}
|
||||||
const QString &text() const {return _text;}
|
const QString &text() const {return _text;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString _URL;
|
QString _url;
|
||||||
QString _text;
|
QString _text;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -227,7 +227,8 @@ bool NMEAParser::readEW(const char *data, int len, qreal &lon)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NMEAParser::readRMC(SegmentData &segment, const char *line, int len)
|
bool NMEAParser::readRMC(CTX &ctx, const char *line, int len,
|
||||||
|
SegmentData &segment)
|
||||||
{
|
{
|
||||||
int col = 1;
|
int col = 1;
|
||||||
const char *vp = line;
|
const char *vp = line;
|
||||||
@ -280,23 +281,24 @@ bool NMEAParser::readRMC(SegmentData &segment, const char *line, int len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!date.isNull()) {
|
if (!date.isNull()) {
|
||||||
if (_date.isNull() && !_time.isNull() && !segment.isEmpty())
|
if (ctx.date.isNull() && !ctx.time.isNull() && !segment.isEmpty())
|
||||||
segment.last().setTimestamp(QDateTime(date, _time, Qt::UTC));
|
segment.last().setTimestamp(QDateTime(date, ctx.time, Qt::UTC));
|
||||||
_date = date;
|
ctx.date = date;
|
||||||
}
|
}
|
||||||
|
|
||||||
Coordinates c(lon, lat);
|
Coordinates c(lon, lat);
|
||||||
if (valid && !_GGA && c.isValid()) {
|
if (valid && !ctx.GGA && c.isValid()) {
|
||||||
Trackpoint t(c);
|
Trackpoint t(c);
|
||||||
if (!_date.isNull() && !time.isNull())
|
if (!ctx.date.isNull() && !time.isNull())
|
||||||
t.setTimestamp(QDateTime(_date, time, Qt::UTC));
|
t.setTimestamp(QDateTime(ctx.date, time, Qt::UTC));
|
||||||
segment.append(t);
|
segment.append(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NMEAParser::readGGA(SegmentData &segment, const char *line, int len)
|
bool NMEAParser::readGGA(CTX &ctx, const char *line, int len,
|
||||||
|
SegmentData &segment)
|
||||||
{
|
{
|
||||||
int col = 1;
|
int col = 1;
|
||||||
const char *vp = line;
|
const char *vp = line;
|
||||||
@ -306,7 +308,7 @@ bool NMEAParser::readGGA(SegmentData &segment, const char *line, int len)
|
|||||||
if (*lp == ',' || *lp == '*') {
|
if (*lp == ',' || *lp == '*') {
|
||||||
switch (col) {
|
switch (col) {
|
||||||
case 1:
|
case 1:
|
||||||
if (!readTime(vp, lp - vp, _time))
|
if (!readTime(vp, lp - vp, ctx.time))
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
@ -360,19 +362,19 @@ bool NMEAParser::readGGA(SegmentData &segment, const char *line, int len)
|
|||||||
Coordinates c(lon, lat);
|
Coordinates c(lon, lat);
|
||||||
if (c.isValid()) {
|
if (c.isValid()) {
|
||||||
Trackpoint t(c);
|
Trackpoint t(c);
|
||||||
if (!(_time.isNull() || _date.isNull()))
|
if (!(ctx.time.isNull() || ctx.date.isNull()))
|
||||||
t.setTimestamp(QDateTime(_date, _time, Qt::UTC));
|
t.setTimestamp(QDateTime(ctx.date, ctx.time, Qt::UTC));
|
||||||
if (!std::isnan(ele))
|
if (!std::isnan(ele))
|
||||||
t.setElevation(ele - gh);
|
t.setElevation(ele - gh);
|
||||||
segment.append(t);
|
segment.append(t);
|
||||||
|
|
||||||
_GGA = true;
|
ctx.GGA = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NMEAParser::readWPL(QVector<Waypoint> &waypoints, const char *line, int len)
|
bool NMEAParser::readWPL(const char *line, int len, QVector<Waypoint> &waypoints)
|
||||||
{
|
{
|
||||||
int col = 1;
|
int col = 1;
|
||||||
const char *vp = line;
|
const char *vp = line;
|
||||||
@ -423,7 +425,7 @@ bool NMEAParser::readWPL(QVector<Waypoint> &waypoints, const char *line, int len
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NMEAParser::readZDA(const char *line, int len)
|
bool NMEAParser::readZDA(CTX &ctx, const char *line, int len)
|
||||||
{
|
{
|
||||||
int col = 1;
|
int col = 1;
|
||||||
const char *vp = line;
|
const char *vp = line;
|
||||||
@ -468,8 +470,8 @@ bool NMEAParser::readZDA(const char *line, int len)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_date = QDate(y, m, d);
|
ctx.date = QDate(y, m, d);
|
||||||
if (!_date.isValid()) {
|
if (!ctx.date.isValid()) {
|
||||||
_errorString = "Invalid date";
|
_errorString = "Invalid date";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -486,13 +488,11 @@ bool NMEAParser::parse(QFile *file, QList<TrackData> &tracks,
|
|||||||
qint64 len;
|
qint64 len;
|
||||||
char line[80 + 2 + 1 + 1];
|
char line[80 + 2 + 1 + 1];
|
||||||
SegmentData segment;
|
SegmentData segment;
|
||||||
|
CTX ctx;
|
||||||
|
|
||||||
|
|
||||||
_errorLine = 1;
|
_errorLine = 1;
|
||||||
_errorString.clear();
|
_errorString.clear();
|
||||||
_date = QDate();
|
|
||||||
_time = QTime();
|
|
||||||
_GGA = false;
|
|
||||||
|
|
||||||
while (!file->atEnd()) {
|
while (!file->atEnd()) {
|
||||||
len = file->readLine(line, sizeof(line));
|
len = file->readLine(line, sizeof(line));
|
||||||
@ -507,16 +507,16 @@ bool NMEAParser::parse(QFile *file, QList<TrackData> &tracks,
|
|||||||
|
|
||||||
if (validSentence(line, len)) {
|
if (validSentence(line, len)) {
|
||||||
if (!memcmp(line + 3, "RMC,", 4)) {
|
if (!memcmp(line + 3, "RMC,", 4)) {
|
||||||
if (!readRMC(segment, line + 7, len - 7))
|
if (!readRMC(ctx, line + 7, len - 7, segment))
|
||||||
return false;
|
return false;
|
||||||
} else if (!memcmp(line + 3, "GGA,", 4)) {
|
} else if (!memcmp(line + 3, "GGA,", 4)) {
|
||||||
if (!readGGA(segment, line + 7, len - 7))
|
if (!readGGA(ctx, line + 7, len - 7, segment))
|
||||||
return false;
|
return false;
|
||||||
} else if (!memcmp(line + 3, "WPL,", 4)) {
|
} else if (!memcmp(line + 3, "WPL,", 4)) {
|
||||||
if (!readWPL(waypoints, line + 7, len - 7))
|
if (!readWPL(line + 7, len - 7, waypoints))
|
||||||
return false;
|
return false;
|
||||||
} else if (!memcmp(line + 3, "ZDA,", 4)) {
|
} else if (!memcmp(line + 3, "ZDA,", 4)) {
|
||||||
if (!readZDA(line + 7, len - 7))
|
if (!readZDA(ctx, line + 7, len - 7))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
class NMEAParser : public Parser
|
class NMEAParser : public Parser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NMEAParser() : _errorLine(0), _GGA(false) {}
|
NMEAParser() : _errorLine(0) {}
|
||||||
|
|
||||||
bool parse(QFile *file, QList<TrackData> &tracks, QList<RouteData> &routes,
|
bool parse(QFile *file, QList<TrackData> &tracks, QList<RouteData> &routes,
|
||||||
QList<Area> &polygons, QVector<Waypoint> &waypoints);
|
QList<Area> &polygons, QVector<Waypoint> &waypoints);
|
||||||
@ -16,6 +16,14 @@ public:
|
|||||||
int errorLine() const {return _errorLine;}
|
int errorLine() const {return _errorLine;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
struct CTX {
|
||||||
|
CTX() : GGA(false) {}
|
||||||
|
|
||||||
|
QDate date;
|
||||||
|
QTime time;
|
||||||
|
bool GGA;
|
||||||
|
};
|
||||||
|
|
||||||
bool readEW(const char *data, int len, qreal &lon);
|
bool readEW(const char *data, int len, qreal &lon);
|
||||||
bool readLon(const char *data, int len, qreal &lon);
|
bool readLon(const char *data, int len, qreal &lon);
|
||||||
bool readNS(const char *data, int len, qreal &lat);
|
bool readNS(const char *data, int len, qreal &lat);
|
||||||
@ -25,17 +33,13 @@ private:
|
|||||||
bool readAltitude(const char *data, int len, qreal &ele);
|
bool readAltitude(const char *data, int len, qreal &ele);
|
||||||
bool readGeoidHeight(const char *data, int len, qreal &gh);
|
bool readGeoidHeight(const char *data, int len, qreal &gh);
|
||||||
|
|
||||||
bool readRMC(SegmentData &segment, const char *line, int len);
|
bool readRMC(CTX &ctx, const char *line, int len, SegmentData &segment);
|
||||||
bool readGGA(SegmentData &segment, const char *line, int len);
|
bool readGGA(CTX &ctx, const char *line, int len, SegmentData &segment);
|
||||||
bool readWPL(QVector<Waypoint> &waypoints, const char *line, int len);
|
bool readWPL(const char *line, int len, QVector<Waypoint> &waypoints);
|
||||||
bool readZDA(const char *line, int len);
|
bool readZDA(CTX &ctx, const char *line, int len);
|
||||||
|
|
||||||
int _errorLine;
|
int _errorLine;
|
||||||
QString _errorString;
|
QString _errorString;
|
||||||
|
|
||||||
QDate _date;
|
|
||||||
QTime _time;
|
|
||||||
bool _GGA;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NMEAPARSER_H
|
#endif // NMEAPARSER_H
|
||||||
|
@ -104,10 +104,10 @@ AlbersEqual::AlbersEqual(const Ellipsoid *ellipsoid, double standardParallel1,
|
|||||||
} else
|
} else
|
||||||
_n = sin_lat1;
|
_n = sin_lat1;
|
||||||
|
|
||||||
_C = sqr_m1 + _n * q1;
|
_c = sqr_m1 + _n * q1;
|
||||||
_a_over_n = ellipsoid->radius() / _n;
|
_a_over_n = ellipsoid->radius() / _n;
|
||||||
nq0 = _n * q0;
|
nq0 = _n * q0;
|
||||||
_rho0 = (_C < nq0) ? 0 : _a_over_n * sqrt(_C - nq0);
|
_rho0 = (_c < nq0) ? 0 : _a_over_n * sqrt(_c - nq0);
|
||||||
}
|
}
|
||||||
|
|
||||||
PointD AlbersEqual::ll2xy(const Coordinates &c) const
|
PointD AlbersEqual::ll2xy(const Coordinates &c) const
|
||||||
@ -131,7 +131,7 @@ PointD AlbersEqual::ll2xy(const Coordinates &c) const
|
|||||||
e_sin = _e * sin_lat;
|
e_sin = _e * sin_lat;
|
||||||
q = ALBERS_Q(sin_lat, ONE_MINUS_SQR(e_sin), e_sin);
|
q = ALBERS_Q(sin_lat, ONE_MINUS_SQR(e_sin), e_sin);
|
||||||
nq = _n * q;
|
nq = _n * q;
|
||||||
rho = (_C < nq) ? 0 : _a_over_n * sqrt(_C - nq);
|
rho = (_c < nq) ? 0 : _a_over_n * sqrt(_c - nq);
|
||||||
theta = _n * dlam;
|
theta = _n * dlam;
|
||||||
|
|
||||||
return PointD(rho * sin(theta) + _falseEasting,
|
return PointD(rho * sin(theta) + _falseEasting,
|
||||||
@ -168,7 +168,7 @@ Coordinates AlbersEqual::xy2ll(const PointD &p) const
|
|||||||
if (rho != 0.0)
|
if (rho != 0.0)
|
||||||
theta = atan2(dx, rho0_minus_dy);
|
theta = atan2(dx, rho0_minus_dy);
|
||||||
rho_n = rho * _n;
|
rho_n = rho * _n;
|
||||||
q = (_C - (rho_n * rho_n) / _a2) / _n;
|
q = (_c - (rho_n * rho_n) / _a2) / _n;
|
||||||
qc = 1 - ((_one_minus_es) / (_two_e)) * log((1.0 - _e) / (1.0 + _e));
|
qc = 1 - ((_one_minus_es) / (_two_e)) * log((1.0 - _e) / (1.0 + _e));
|
||||||
if (fabs(fabs(qc) - fabs(q)) > 1.0e-6) {
|
if (fabs(fabs(qc) - fabs(q)) > 1.0e-6) {
|
||||||
q_over_2 = q / 2.0;
|
q_over_2 = q / 2.0;
|
||||||
|
@ -25,7 +25,7 @@ private:
|
|||||||
|
|
||||||
double _a2;
|
double _a2;
|
||||||
double _rho0;
|
double _rho0;
|
||||||
double _C;
|
double _c;
|
||||||
double _n;
|
double _n;
|
||||||
double _e;
|
double _e;
|
||||||
double _es;
|
double _es;
|
||||||
|
@ -15,16 +15,16 @@ Krovak::Krovak(const Ellipsoid *ellipsoid, double standardParallel,
|
|||||||
|
|
||||||
_phiP = deg2rad(standardParallel);
|
_phiP = deg2rad(standardParallel);
|
||||||
_e = sqrt(ellipsoid->es());
|
_e = sqrt(ellipsoid->es());
|
||||||
_A = ellipsoid->radius() * sqrt(1.0 - ellipsoid->es())
|
_a = ellipsoid->radius() * sqrt(1.0 - ellipsoid->es())
|
||||||
/ (1.0 - ellipsoid->es() * sinPhiC2);
|
/ (1.0 - ellipsoid->es() * sinPhiC2);
|
||||||
_B = sqrt(1.0 + (ellipsoid->es() * cosPhiC4 / (1.0 - ellipsoid->es())));
|
_b = sqrt(1.0 + (ellipsoid->es() * cosPhiC4 / (1.0 - ellipsoid->es())));
|
||||||
double gamma0 = asin(sinPhiC / _B);
|
double gamma0 = asin(sinPhiC / _b);
|
||||||
_t0 = tan(M_PI_4 + gamma0 / 2.0) * pow((1.0 + _e * sinPhiC) /
|
_t0 = tan(M_PI_4 + gamma0 / 2.0) * pow((1.0 + _e * sinPhiC) /
|
||||||
(1.0 - _e * sinPhiC), _e*_B / 2.0) / pow(tan(M_PI_4 + phiC/2.0), _B);
|
(1.0 - _e * sinPhiC), _e*_b / 2.0) / pow(tan(M_PI_4 + phiC/2.0), _b);
|
||||||
_n = sin(_phiP);
|
_n = sin(_phiP);
|
||||||
_r0 = scale * _A / tan(_phiP);
|
_r0 = scale * _a / tan(_phiP);
|
||||||
_FE = falseEasting;
|
_fe = falseEasting;
|
||||||
_FN = falseNorthing;
|
_fn = falseNorthing;
|
||||||
_cosAlphaC = cos(alphaC);
|
_cosAlphaC = cos(alphaC);
|
||||||
_sinAlphaC = sin(alphaC);
|
_sinAlphaC = sin(alphaC);
|
||||||
_lambda0 = deg2rad(longitudeOrigin);
|
_lambda0 = deg2rad(longitudeOrigin);
|
||||||
@ -35,23 +35,23 @@ PointD Krovak::ll2xy(const Coordinates &c) const
|
|||||||
double phi = deg2rad(c.lat());
|
double phi = deg2rad(c.lat());
|
||||||
double lambda = deg2rad(c.lon());
|
double lambda = deg2rad(c.lon());
|
||||||
double eSinPhi = _e * sin(phi);
|
double eSinPhi = _e * sin(phi);
|
||||||
double U = 2.0 * (atan(_t0 * pow(tan(phi/2.0 + M_PI_4), _B)
|
double U = 2.0 * (atan(_t0 * pow(tan(phi/2.0 + M_PI_4), _b)
|
||||||
/ pow((1.0 + eSinPhi) / (1.0 - eSinPhi), _e * _B/2.0)) - M_PI_4);
|
/ pow((1.0 + eSinPhi) / (1.0 - eSinPhi), _e * _b/2.0)) - M_PI_4);
|
||||||
double cosU = cos(U);
|
double cosU = cos(U);
|
||||||
double V = _B * (_lambda0 - lambda);
|
double V = _b * (_lambda0 - lambda);
|
||||||
double T = asin(_cosAlphaC * sin(U) + _sinAlphaC * cosU * cos(V));
|
double T = asin(_cosAlphaC * sin(U) + _sinAlphaC * cosU * cos(V));
|
||||||
double D = asin(cosU * sin(V) / cos(T));
|
double D = asin(cosU * sin(V) / cos(T));
|
||||||
double theta = _n * D;
|
double theta = _n * D;
|
||||||
double r = _r0 * pow(tan(M_PI_4 + _phiP/2.0), _n)
|
double r = _r0 * pow(tan(M_PI_4 + _phiP/2.0), _n)
|
||||||
/ pow(tan(T/2.0 + M_PI_4), _n);
|
/ pow(tan(T/2.0 + M_PI_4), _n);
|
||||||
|
|
||||||
return PointD(r * sin(theta) + _FE, r * cos(theta) + _FN);
|
return PointD(r * sin(theta) + _fe, r * cos(theta) + _fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
Coordinates Krovak::xy2ll(const PointD &p) const
|
Coordinates Krovak::xy2ll(const PointD &p) const
|
||||||
{
|
{
|
||||||
double Xp = p.y() - _FN;
|
double Xp = p.y() - _fn;
|
||||||
double Yp = p.x() - _FE;
|
double Yp = p.x() - _fe;
|
||||||
double Xp2 = Xp * Xp;
|
double Xp2 = Xp * Xp;
|
||||||
double Yp2 = Yp * Yp;
|
double Yp2 = Yp * Yp;
|
||||||
double r = sqrt(Xp2 + Yp2);
|
double r = sqrt(Xp2 + Yp2);
|
||||||
@ -63,8 +63,8 @@ Coordinates Krovak::xy2ll(const PointD &p) const
|
|||||||
double V = asin(cos(T) * sin(D) / cos(U));
|
double V = asin(cos(T) * sin(D) / cos(U));
|
||||||
double phi = U;
|
double phi = U;
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
phi = 2.0 * (atan(pow(_t0, -1.0/_B) * pow(tan(U/2.0 + M_PI_4), 1.0/_B)
|
phi = 2.0 * (atan(pow(_t0, -1.0/_b) * pow(tan(U/2.0 + M_PI_4), 1.0/_b)
|
||||||
* pow((1.0 + _e * sin(phi))/(1.0 - _e * sin(phi)), _e/2.0)) - M_PI_4);
|
* pow((1.0 + _e * sin(phi))/(1.0 - _e * sin(phi)), _e/2.0)) - M_PI_4);
|
||||||
|
|
||||||
return Coordinates(rad2deg(_lambda0 - V/_B), rad2deg(phi));
|
return Coordinates(rad2deg(_lambda0 - V/_b), rad2deg(phi));
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,8 @@ public:
|
|||||||
virtual Coordinates xy2ll(const PointD &p) const;
|
virtual Coordinates xy2ll(const PointD &p) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double _e, _A, _B, _t0, _n, _r0, _phiP;
|
double _e, _a, _b, _t0, _n, _r0, _phiP;
|
||||||
double _cosAlphaC, _sinAlphaC, _lambda0, _FE, _FN;
|
double _cosAlphaC, _sinAlphaC, _lambda0, _fe, _fn;
|
||||||
};
|
};
|
||||||
|
|
||||||
class KrovakNE : public CT
|
class KrovakNE : public CT
|
||||||
|
@ -11,8 +11,8 @@ LambertAzimuthal::LambertAzimuthal(const Ellipsoid *ellipsoid,
|
|||||||
{
|
{
|
||||||
double lat0 = deg2rad(latitudeOrigin);
|
double lat0 = deg2rad(latitudeOrigin);
|
||||||
|
|
||||||
_falseEasting = falseEasting;
|
_fe = falseEasting;
|
||||||
_falseNorthing = falseNorthing;
|
_fn = falseNorthing;
|
||||||
_lon0 = deg2rad(longitudeOrigin);
|
_lon0 = deg2rad(longitudeOrigin);
|
||||||
|
|
||||||
_a = ellipsoid->radius();
|
_a = ellipsoid->radius();
|
||||||
@ -25,8 +25,8 @@ LambertAzimuthal::LambertAzimuthal(const Ellipsoid *ellipsoid,
|
|||||||
_qP = (1.0 - _es) * ((1.0 / (1.0 - _es)) - ((1.0/(2.0*_e))
|
_qP = (1.0 - _es) * ((1.0 / (1.0 - _es)) - ((1.0/(2.0*_e))
|
||||||
* log((1.0 - _e) / (1.0 + _e))));
|
* log((1.0 - _e) / (1.0 + _e))));
|
||||||
_beta0 = asin(q0 / _qP);
|
_beta0 = asin(q0 / _qP);
|
||||||
_Rq = _a * sqrt(_qP / 2.0);
|
_rq = _a * sqrt(_qP / 2.0);
|
||||||
_D = _a * (cos(lat0) / sqrt(1.0 - _es * sin2(lat0))) / (_Rq * cos(_beta0));
|
_d = _a * (cos(lat0) / sqrt(1.0 - _es * sin2(lat0))) / (_rq * cos(_beta0));
|
||||||
}
|
}
|
||||||
|
|
||||||
PointD LambertAzimuthal::ll2xy(const Coordinates &c) const
|
PointD LambertAzimuthal::ll2xy(const Coordinates &c) const
|
||||||
@ -38,11 +38,11 @@ PointD LambertAzimuthal::ll2xy(const Coordinates &c) const
|
|||||||
- ((1.0/(2.0*_e)) * log((1.0 - _e * sin(lat)) / (1.0 + _e
|
- ((1.0/(2.0*_e)) * log((1.0 - _e * sin(lat)) / (1.0 + _e
|
||||||
* sin(lat)))));
|
* sin(lat)))));
|
||||||
double beta = asin(q / _qP);
|
double beta = asin(q / _qP);
|
||||||
double B = _Rq * sqrt(2.0 / (1.0 + sin(_beta0) * sin(beta) + (cos(_beta0)
|
double B = _rq * sqrt(2.0 / (1.0 + sin(_beta0) * sin(beta) + (cos(_beta0)
|
||||||
* cos(beta) * cos(lon - _lon0))));
|
* cos(beta) * cos(lon - _lon0))));
|
||||||
|
|
||||||
double x = _falseEasting + ((B * _D) * (cos(beta) * sin(lon - _lon0)));
|
double x = _fe + ((B * _d) * (cos(beta) * sin(lon - _lon0)));
|
||||||
double y = _falseNorthing + (B / _D) * ((cos(_beta0) * sin(beta))
|
double y = _fn + (B / _d) * ((cos(_beta0) * sin(beta))
|
||||||
- (sin(_beta0) * cos(beta) * cos(lon - _lon0)));
|
- (sin(_beta0) * cos(beta) * cos(lon - _lon0)));
|
||||||
|
|
||||||
return PointD(x, y);
|
return PointD(x, y);
|
||||||
@ -53,14 +53,14 @@ Coordinates LambertAzimuthal::xy2ll(const PointD &p) const
|
|||||||
double es4 = _es * _es;
|
double es4 = _es * _es;
|
||||||
double es6 = _es * es4;
|
double es6 = _es * es4;
|
||||||
|
|
||||||
double rho = sqrt(sqr((p.x() - _falseEasting) / _D) + sqr(_D * (p.y()
|
double rho = sqrt(sqr((p.x() - _fe) / _d) + sqr(_d * (p.y()
|
||||||
- _falseNorthing)));
|
- _fn)));
|
||||||
double C = 2.0 * asin(rho / (2.0*_Rq));
|
double C = 2.0 * asin(rho / (2.0*_rq));
|
||||||
double betaS = asin((cos(C) * sin(_beta0)) + ((_D * (p.y() -_falseNorthing)
|
double betaS = asin((cos(C) * sin(_beta0)) + ((_d * (p.y() -_fn)
|
||||||
* sin(C) * cos(_beta0)) / rho));
|
* sin(C) * cos(_beta0)) / rho));
|
||||||
|
|
||||||
double lon = _lon0 + atan((p.x() - _falseEasting) * sin(C) / (_D * rho
|
double lon = _lon0 + atan((p.x() - _fe) * sin(C) / (_d * rho
|
||||||
* cos(_beta0) * cos(C) - sqr(_D) * (p.y() - _falseNorthing) * sin(_beta0)
|
* cos(_beta0) * cos(C) - sqr(_d) * (p.y() - _fn) * sin(_beta0)
|
||||||
* sin(C)));
|
* sin(C)));
|
||||||
double lat = betaS + ((_es/3.0 + 31.0*es4/180.0 + 517.0*es6/5040.0)
|
double lat = betaS + ((_es/3.0 + 31.0*es4/180.0 + 517.0*es6/5040.0)
|
||||||
* sin(2.0*betaS)) + ((23.0*es4/360.0 + 251.0*es6/3780.0) * sin(4.0*betaS))
|
* sin(2.0*betaS)) + ((23.0*es4/360.0 + 251.0*es6/3780.0) * sin(4.0*betaS))
|
||||||
|
@ -18,9 +18,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
double _lon0;
|
double _lon0;
|
||||||
double _falseNorthing;
|
double _fn, _fe;
|
||||||
double _falseEasting;
|
double _a, _e, _es, _qP, _beta0, _rq, _d;
|
||||||
double _a, _e, _es, _qP, _beta0, _Rq, _D;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LAMBERTAZIMUTHAL_H
|
#endif // LAMBERTAZIMUTHAL_H
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
ObliqueStereographic::ObliqueStereographic(const Ellipsoid *ellipsoid,
|
ObliqueStereographic::ObliqueStereographic(const Ellipsoid *ellipsoid,
|
||||||
double latitudeOrigin, double longitudeOrigin, double scale,
|
double latitudeOrigin, double longitudeOrigin, double scale,
|
||||||
double falseEasting, double falseNorthing)
|
double falseEasting, double falseNorthing)
|
||||||
: _FE(falseEasting), _FN(falseNorthing)
|
: _fe(falseEasting), _fn(falseNorthing)
|
||||||
{
|
{
|
||||||
double lat0 = deg2rad(latitudeOrigin);
|
double lat0 = deg2rad(latitudeOrigin);
|
||||||
double sinPhi0 = sin(lat0);
|
double sinPhi0 = sin(lat0);
|
||||||
@ -48,17 +48,17 @@ PointD ObliqueStereographic::ll2xy(const Coordinates &c) const
|
|||||||
double B = (1.0 + sin(chi) * _sinChi0 + cos(chi) * _cosChi0
|
double B = (1.0 + sin(chi) * _sinChi0 + cos(chi) * _cosChi0
|
||||||
* cos(lambda - _lambda0));
|
* cos(lambda - _lambda0));
|
||||||
|
|
||||||
return PointD(_FE + _twoRk0 * cos(chi) * sin(lambda - _lambda0) / B,
|
return PointD(_fe + _twoRk0 * cos(chi) * sin(lambda - _lambda0) / B,
|
||||||
_FN + _twoRk0 * (sin(chi) * _cosChi0 - cos(chi) * _sinChi0
|
_fn + _twoRk0 * (sin(chi) * _cosChi0 - cos(chi) * _sinChi0
|
||||||
* cos(lambda - _lambda0)) / B);
|
* cos(lambda - _lambda0)) / B);
|
||||||
}
|
}
|
||||||
|
|
||||||
Coordinates ObliqueStereographic::xy2ll(const PointD &p) const
|
Coordinates ObliqueStereographic::xy2ll(const PointD &p) const
|
||||||
{
|
{
|
||||||
double i = atan((p.x() - _FE) / (_h + (p.y() - _FN)));
|
double i = atan((p.x() - _fe) / (_h + (p.y() - _fn)));
|
||||||
double j = atan((p.x() - _FE) / (_g - (p.y() - _FN))) - i;
|
double j = atan((p.x() - _fe) / (_g - (p.y() - _fn))) - i;
|
||||||
|
|
||||||
double chi = _chi0 + 2.0 * atan(((p.y() - _FN) - (p.x() - _FE) * tan(j/2.0))
|
double chi = _chi0 + 2.0 * atan(((p.y() - _fn) - (p.x() - _fe) * tan(j/2.0))
|
||||||
/ _twoRk0);
|
/ _twoRk0);
|
||||||
double lambda = j + 2.0 * i + _lambda0;
|
double lambda = j + 2.0 * i + _lambda0;
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ private:
|
|||||||
double _lambda0;
|
double _lambda0;
|
||||||
double _n;
|
double _n;
|
||||||
double _c;
|
double _c;
|
||||||
double _FE, _FN;
|
double _fe, _fn;
|
||||||
double _twoRk0, _g, _h;
|
double _twoRk0, _g, _h;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user