1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-16 20:04:23 +02:00

Compare commits

..

8 Commits

8 changed files with 60 additions and 43 deletions

View File

@ -18,7 +18,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install dependencies
run: |
@ -26,7 +26,7 @@ jobs:
sudo apt-get install qtbase5-dev qtbase5-private-dev qtbase5-dev-tools qt5-qmake qttools5-dev-tools libqt5opengl5-dev qtpositioning5-dev libqt5svg5-dev libqt5serialport5-dev
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@ -37,9 +37,9 @@ jobs:
# queries: security-extended,security-and-quality
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"

View File

@ -16,15 +16,15 @@ static const quint8 Z[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
};
static const int J[] = {
static const quint8 J[] = {
0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 10, 11, 12, 13, 14, 15
};
JLS::JLS(quint16 diff, quint16 factor)
JLS::JLS(quint16 maxval, quint16 near)
{
_maxval = diff;
_near = factor;
_maxval = maxval;
_near = near;
_range = ((_maxval + _near * 2) / (_near * 2 + 1)) + 1;
_qbpp = ceil(log2(_range));
@ -184,18 +184,23 @@ 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 {
} else
_n[1] = _n[1] + 1;
}
if (_b[1] <= -_n[1]) {
_b[1] = _b[1] + _n[1];
if (_b[1] <= -_n[1])
_b[1] = 1 - _n[1];
} else if (_b[1] > 0)
_b[1] = ((_b[1] - _n[1]) >> 0xf) & (_b[1] - _n[1]);
} else if (_b[1] > 0) {
_b[1] = _b[1] - _n[1];
if (_b[1] > 0)
_b[1] = 0;
}
Rc = Rb;
Rb = _last[col + 1];
@ -273,7 +278,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

@ -2,15 +2,15 @@
#define IMG_JLS_H
#include <QVector>
#include "bitstream.h"
#include "map/matrix.h"
#include "subfile.h"
namespace IMG {
class JLS
{
public:
JLS(quint16 diff, quint16 factor);
JLS(quint16 maxval, quint16 near);
bool decode(const SubFile *file, SubFile::Handle &hdl, Matrix<qint16> &img);

View File

@ -477,12 +477,10 @@ MatrixD RasterTile::elevation(int extend) const
for (int i = 0; i < ll.size(); i++)
rect = rect.united(ll.at(i));
// Extra margin for always including the next DEM tile on the map tile
// edges (the DEM tile resolution is usally < 5% of the map tile)
double delta = rect.width() / 16;
rect = rect.united(Coordinates(rect.right() + delta,
rect.bottom() - delta));
_data->elevations(rect, _zoom, &tiles);
// edges (the DEM tile resolution is usally 0.5-15% of the map tile)
double factor = 6 - (_zoom - 24) * 1.7;
_data->elevations(rect.adjusted(0, 0, rect.width() / factor,
-rect.height() / factor), _zoom, &tiles);
DEM::buildTree(tiles, tree);
for (int i = 0; i < ll.size(); i++)

View File

@ -279,7 +279,7 @@ void VectorTile::elevations(const RectC &rect, const Zoom &zoom,
// Shift the DEM level to get better data then what the map defines for
// the given zoom (we prefer rendering quality rather than speed). For
// maps with a single level this has no effect.
int level = _dem->level(zoom) / 2;
int level = qMax(0, _dem->level(zoom) - 1);
QList<const DEMTile*> tiles(_dem->tiles(rect, level));
for (int i = 0; i < tiles.size(); i++) {
const DEMTile *tile = tiles.at(i);

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);