mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-07-28 01:14:24 +02:00
Compare commits
7 Commits
12.1
...
ed638bb5fc
Author | SHA1 | Date | |
---|---|---|---|
ed638bb5fc | |||
ae3d190e08 | |||
a5916cad90 | |||
aea8402016 | |||
7a53fb8e01 | |||
f952e02535 | |||
9538d15d79 |
@ -1,4 +1,4 @@
|
|||||||
version: 12.1.{build}
|
version: 12.2.{build}
|
||||||
|
|
||||||
configuration:
|
configuration:
|
||||||
- Release
|
- Release
|
||||||
|
@ -3,7 +3,7 @@ unix:!macx:!android {
|
|||||||
} else {
|
} else {
|
||||||
TARGET = GPXSee
|
TARGET = GPXSee
|
||||||
}
|
}
|
||||||
VERSION = 12.1
|
VERSION = 12.2
|
||||||
|
|
||||||
QT += core \
|
QT += core \
|
||||||
gui \
|
gui \
|
||||||
|
@ -37,7 +37,7 @@ Unicode true
|
|||||||
; The name of the installer
|
; The name of the installer
|
||||||
Name "GPXSee"
|
Name "GPXSee"
|
||||||
; Program version
|
; Program version
|
||||||
!define VERSION "12.1"
|
!define VERSION "12.2"
|
||||||
|
|
||||||
; The file to write
|
; The file to write
|
||||||
OutFile "GPXSee-${VERSION}_x64.exe"
|
OutFile "GPXSee-${VERSION}_x64.exe"
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
#include <QSurfaceFormat>
|
#include <QSurfaceFormat>
|
||||||
|
#include <QImageReader>
|
||||||
#ifdef Q_OS_ANDROID
|
#ifdef Q_OS_ANDROID
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QJniObject>
|
#include <QJniObject>
|
||||||
@ -59,6 +60,9 @@ App::App(int &argc, char **argv) : QApplication(argc, argv)
|
|||||||
fmt.setStencilBufferSize(8);
|
fmt.setStencilBufferSize(8);
|
||||||
fmt.setSamples(4);
|
fmt.setSamples(4);
|
||||||
QSurfaceFormat::setDefaultFormat(fmt);
|
QSurfaceFormat::setDefaultFormat(fmt);
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
QImageReader::setAllocationLimit(0);
|
||||||
|
#endif // QT6
|
||||||
|
|
||||||
loadDatums();
|
loadDatums();
|
||||||
loadPCSs();
|
loadPCSs();
|
||||||
|
@ -59,10 +59,11 @@ static double area(const QVector<Coordinates> &polygon)
|
|||||||
{
|
{
|
||||||
double area = 0;
|
double area = 0;
|
||||||
|
|
||||||
for (int i = 0; i < polygon.size(); i++) {
|
for (int i = 0; i < polygon.size() - 1; i++) {
|
||||||
int j = (i + 1) % polygon.size();
|
const Coordinates &pi = polygon.at(i);
|
||||||
area += polygon.at(i).lon() * polygon.at(j).lat();
|
const Coordinates &pj = polygon.at(i+1);
|
||||||
area -= polygon.at(i).lat() * polygon.at(j).lon();
|
area += pi.lon() * pj.lat();
|
||||||
|
area -= pi.lat() * pj.lon();
|
||||||
}
|
}
|
||||||
area /= 2.0;
|
area /= 2.0;
|
||||||
|
|
||||||
@ -71,15 +72,18 @@ static double area(const QVector<Coordinates> &polygon)
|
|||||||
|
|
||||||
static Coordinates centroid(const QVector<Coordinates> &polygon)
|
static Coordinates centroid(const QVector<Coordinates> &polygon)
|
||||||
{
|
{
|
||||||
|
Q_ASSERT(polygon.size() > 3);
|
||||||
|
Q_ASSERT(polygon.first() == polygon.last());
|
||||||
|
|
||||||
double cx = 0, cy = 0;
|
double cx = 0, cy = 0;
|
||||||
double factor = 1.0 / (6.0 * area(polygon));
|
double factor = 1.0 / (6.0 * area(polygon));
|
||||||
|
|
||||||
for (int i = 0; i < polygon.size(); i++) {
|
for (int i = 0; i < polygon.size() - 1; i++) {
|
||||||
int j = (i + 1) % polygon.size();
|
const Coordinates &pi = polygon.at(i);
|
||||||
qreal f = (polygon.at(i).lon() * polygon.at(j).lat()
|
const Coordinates &pj = polygon.at(i+1);
|
||||||
- polygon.at(j).lon() * polygon.at(i).lat());
|
double f = (pi.lon() * pj.lat() - pj.lon() * pi.lat());
|
||||||
cx += (polygon.at(i).lon() + polygon.at(j).lon()) * f;
|
cx += (pi.lon() + pj.lon()) * f;
|
||||||
cy += (polygon.at(i).lat() + polygon.at(j).lat()) * f;
|
cy += (pi.lat() + pj.lat()) * f;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Coordinates(cx * factor, cy * factor);
|
return Coordinates(cx * factor, cy * factor);
|
||||||
|
@ -278,10 +278,10 @@ void Style::defaultPolygonStyle()
|
|||||||
|
|
||||||
// Draw order
|
// Draw order
|
||||||
_drawOrder
|
_drawOrder
|
||||||
<< TYPE(0x4b) << 0x10d01 << 0x10104 << 0x10613 << TYPE(0x4a)
|
<< TYPE(0x4b) << 0x10d01 << 0x10104 << TYPE(0x4a)
|
||||||
<< 0x10101 << 0x10102 << 0x10301 << 0x10302 << 0x10303
|
<< 0x10101 << 0x10102 << 0x10301 << 0x10302 << 0x10303
|
||||||
<< 0x10304 << 0x10305 << 0x10306 << 0x10105 << 0x10409
|
<< 0x10304 << 0x10305 << 0x10306 << 0x10613 << 0x10105
|
||||||
<< 0x10503 << 0x10601 << 0x1060a
|
<< 0x10409 << 0x10503 << 0x10601 << 0x1060a
|
||||||
<< TYPE(0x01) << 0x10800 << TYPE(0x02) << 0x10801 << TYPE(0x03) << 0x10802
|
<< TYPE(0x01) << 0x10800 << TYPE(0x02) << 0x10801 << TYPE(0x03) << 0x10802
|
||||||
<< TYPE(0x17) << 0x10a04 << TYPE(0x18) << 0x1090c << TYPE(0x1a) << 0x1090e
|
<< TYPE(0x17) << 0x10a04 << TYPE(0x18) << 0x1090c << TYPE(0x1a) << 0x1090e
|
||||||
<< TYPE(0x28) << 0x10b01 << TYPE(0x32) << 0x10b02 << TYPE(0x3c) << 0x10b03
|
<< TYPE(0x28) << 0x10b01 << TYPE(0x32) << 0x10b02 << TYPE(0x3c) << 0x10b03
|
||||||
|
@ -329,13 +329,3 @@ QList<SubDiv*> TREFile::subdivs(const RectC &rect, int bits,
|
|||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG
|
|
||||||
QDebug IMG::operator<<(QDebug dbg, const TREFile::MapLevel &level)
|
|
||||||
{
|
|
||||||
dbg.nospace() << "MapLevel(" << level.level << "," << level.bits << ", "
|
|
||||||
<< level.subdivs << ")";
|
|
||||||
|
|
||||||
return dbg.space();
|
|
||||||
}
|
|
||||||
#endif // QT_NO_DEBUG
|
|
||||||
|
@ -42,8 +42,6 @@ private:
|
|||||||
};
|
};
|
||||||
typedef RTree<SubDiv*, double, 2> SubDivTree;
|
typedef RTree<SubDiv*, double, 2> SubDivTree;
|
||||||
|
|
||||||
friend QDebug operator<<(QDebug dbg, const MapLevel &level);
|
|
||||||
|
|
||||||
bool load(int idx);
|
bool load(int idx);
|
||||||
int level(int bits, const Range &baseMap);
|
int level(int bits, const Range &baseMap);
|
||||||
int readExtEntry(Handle &hdl, quint32 &polygons, quint32 &lines,
|
int readExtEntry(Handle &hdl, quint32 &polygons, quint32 &lines,
|
||||||
@ -59,9 +57,6 @@ private:
|
|||||||
QMap<int, SubDivTree*> _subdivs;
|
QMap<int, SubDivTree*> _subdivs;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG
|
|
||||||
QDebug operator<<(QDebug dbg, const TREFile::MapLevel &level);
|
|
||||||
#endif // QT_NO_DEBUG
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // IMG_TREFILE_H
|
#endif // IMG_TREFILE_H
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
|
|
||||||
|
|
||||||
#define TILE_SIZE 256
|
#define TILE_SIZE 256
|
||||||
|
|
||||||
void Image::draw(QPainter *painter, const QRectF &rect, Map::Flags flags)
|
void Image::draw(QPainter *painter, const QRectF &rect, Map::Flags flags)
|
||||||
@ -11,26 +10,17 @@ void Image::draw(QPainter *painter, const QRectF &rect, Map::Flags flags)
|
|||||||
|
|
||||||
/* When OpenGL is used, big images are rendered incredibly slow or not at
|
/* When OpenGL is used, big images are rendered incredibly slow or not at
|
||||||
all using the QPainter::drawImage() function with a source rect set. So
|
all using the QPainter::drawImage() function with a source rect set. So
|
||||||
we have to tile the image ourself before it can be drawn.
|
we have to tile the image ourself before it can be drawn. */
|
||||||
|
|
||||||
We have to use a list of dynamically allocated pixmaps as QPainter
|
|
||||||
rendering is broken in yet another way with OpenGL and drawPixmap() does
|
|
||||||
access already deleted image instances when reusing a single pixmap. */
|
|
||||||
if (flags & Map::OpenGL) {
|
if (flags & Map::OpenGL) {
|
||||||
QList<QPixmap *> list;
|
|
||||||
|
|
||||||
for (int i = sr.left()/TILE_SIZE; i <= sr.right()/TILE_SIZE; i++) {
|
for (int i = sr.left()/TILE_SIZE; i <= sr.right()/TILE_SIZE; i++) {
|
||||||
for (int j = sr.top()/TILE_SIZE; j <= sr.bottom()/TILE_SIZE; j++) {
|
for (int j = sr.top()/TILE_SIZE; j <= sr.bottom()/TILE_SIZE; j++) {
|
||||||
QPoint tl(i * TILE_SIZE, j * TILE_SIZE);
|
QPoint tl(i * TILE_SIZE, j * TILE_SIZE);
|
||||||
QRect tile(tl, QSize(TILE_SIZE, TILE_SIZE));
|
QRect tile(tl, QSize(TILE_SIZE, TILE_SIZE));
|
||||||
QPixmap *pm = new QPixmap(QPixmap::fromImage(_img.copy(tile)));
|
QImage img(_img.copy(tile));
|
||||||
list.append(pm);
|
img.setDevicePixelRatio(ratio);
|
||||||
pm->setDevicePixelRatio(ratio);
|
painter->drawImage(tl/ratio, img);
|
||||||
painter->drawPixmap(tl/ratio, *pm);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qDeleteAll(list);
|
|
||||||
} else
|
} else
|
||||||
painter->drawImage(rect.topLeft(), _img, sr);
|
painter->drawImage(rect.topLeft(), _img, sr);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user