1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-27 21:24:47 +01:00

Compare commits

..

4 Commits

4 changed files with 39 additions and 22 deletions

View File

@ -184,7 +184,10 @@ bool JLS::readLine(BitStream &bs)
_b[1] = _b[1] + mes;
if (_n[1] == 0x40) {
_a[1] = _a[1] >> 1;
_b[1] = _b[1] >> 1;
if (_b[1] >= 0)
_b[1] = _b[1] >> 1;
else
_b[1] = -((1 - _b[1]) >> 1);
_n[1] = 0x21;
} else {
_n[1] = _n[1] + 1;
@ -273,7 +276,10 @@ bool JLS::readLine(BitStream &bs)
_a[ictx] = _a[ictx] + (evh - rctx);
if (_n[ictx] == 0x40) {
_a[ictx] = _a[ictx] >> 1;
_b[ictx] = _b[ictx] >> 1;
if (_b[ictx] >= 0)
_b[ictx] = _b[ictx] >> 1;
else
_b[ictx] = -((1 - _b[ictx]) >> 1);
_n[ictx] = 0x21;
} else
_n[ictx] = _n[ictx] + 1;

View File

@ -99,16 +99,31 @@ MatrixD Filter::blur(const MatrixD &m, int radius)
{
MatrixD src(m);
MatrixD dst(m.h(), m.w());
double sum = 0;
int cnt = 0;
for (int i = 0; i < m.size(); i++)
if (std::isnan(m.at(i)))
src.at(i) = -500;
for (int i = 0; i < m.size(); i++) {
if (!std::isnan(m.at(i))) {
sum += m.at(i);
cnt++;
}
}
if (cnt != m.size()) {
double avg = sum / cnt;
for (int i = 0; i < m.size(); i++)
if (std::isnan(m.at(i)))
src.at(i) = avg;
}
gaussBlur4(src, dst, radius);
for (int i = 0; i < dst.size(); i++)
if (std::isnan(m.at(i)))
dst.at(i) = NAN;
if (cnt != m.size()) {
for (int i = 0; i < dst.size(); i++)
if (std::isnan(m.at(i)))
dst.at(i) = NAN;
}
return dst;
}

View File

@ -223,18 +223,6 @@ bool GCS::loadList(const QString &path)
return true;
}
Coordinates GCS::toWGS84(const Coordinates &c) const
{
return datum().toWGS84(Coordinates(_primeMeridian.toGreenwich(c.lon()),
c.lat()));
}
Coordinates GCS::fromWGS84(const Coordinates &c) const
{
Coordinates ds(datum().fromWGS84(c));
return Coordinates(_primeMeridian.fromGreenwich(ds.lon()), ds.lat());
}
QList<KV<int, QString> > GCS::list()
{
QList<KV<int, QString> > list;

View File

@ -29,8 +29,16 @@ public:
bool isValid() const {return _datum.isValid() && _angularUnits.isValid()
&& _primeMeridian.isValid();}
Coordinates toWGS84(const Coordinates &c) const;
Coordinates fromWGS84(const Coordinates &c) const;
Coordinates toWGS84(const Coordinates &c) const
{
return datum().toWGS84(Coordinates(_primeMeridian.toGreenwich(c.lon()),
c.lat()));
}
Coordinates fromWGS84(const Coordinates &c) const
{
Coordinates ds(datum().fromWGS84(c));
return Coordinates(_primeMeridian.fromGreenwich(ds.lon()), ds.lat());
}
static GCS gcs(int id);
static GCS gcs(int geodeticDatum, int primeMeridian, int angularUnits);