mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-07-17 20:34:23 +02:00
Compare commits
6 Commits
12.1
...
ae3d190e08
Author | SHA1 | Date | |
---|---|---|---|
ae3d190e08 | |||
a5916cad90 | |||
aea8402016 | |||
7a53fb8e01 | |||
f952e02535 | |||
9538d15d79 |
@ -1,4 +1,4 @@
|
||||
version: 12.1.{build}
|
||||
version: 12.2.{build}
|
||||
|
||||
configuration:
|
||||
- Release
|
||||
|
@ -3,7 +3,7 @@ unix:!macx:!android {
|
||||
} else {
|
||||
TARGET = GPXSee
|
||||
}
|
||||
VERSION = 12.1
|
||||
VERSION = 12.2
|
||||
|
||||
QT += core \
|
||||
gui \
|
||||
|
@ -37,7 +37,7 @@ Unicode true
|
||||
; The name of the installer
|
||||
Name "GPXSee"
|
||||
; Program version
|
||||
!define VERSION "12.1"
|
||||
!define VERSION "12.2"
|
||||
|
||||
; The file to write
|
||||
OutFile "GPXSee-${VERSION}_x64.exe"
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QLibraryInfo>
|
||||
#include <QSurfaceFormat>
|
||||
#include <QImageReader>
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include <QCoreApplication>
|
||||
#include <QJniObject>
|
||||
@ -59,6 +60,9 @@ App::App(int &argc, char **argv) : QApplication(argc, argv)
|
||||
fmt.setStencilBufferSize(8);
|
||||
fmt.setSamples(4);
|
||||
QSurfaceFormat::setDefaultFormat(fmt);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QImageReader::setAllocationLimit(0);
|
||||
#endif // QT6
|
||||
|
||||
loadDatums();
|
||||
loadPCSs();
|
||||
|
@ -59,10 +59,11 @@ static double area(const QVector<Coordinates> &polygon)
|
||||
{
|
||||
double area = 0;
|
||||
|
||||
for (int i = 0; i < polygon.size(); i++) {
|
||||
int j = (i + 1) % polygon.size();
|
||||
area += polygon.at(i).lon() * polygon.at(j).lat();
|
||||
area -= polygon.at(i).lat() * polygon.at(j).lon();
|
||||
for (int i = 0; i < polygon.size() - 1; i++) {
|
||||
const Coordinates &pi = polygon.at(i);
|
||||
const Coordinates &pj = polygon.at(i+1);
|
||||
area += pi.lon() * pj.lat();
|
||||
area -= pi.lat() * pj.lon();
|
||||
}
|
||||
area /= 2.0;
|
||||
|
||||
@ -71,15 +72,18 @@ static double area(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 factor = 1.0 / (6.0 * area(polygon));
|
||||
|
||||
for (int i = 0; i < polygon.size(); i++) {
|
||||
int j = (i + 1) % polygon.size();
|
||||
qreal f = (polygon.at(i).lon() * polygon.at(j).lat()
|
||||
- polygon.at(j).lon() * polygon.at(i).lat());
|
||||
cx += (polygon.at(i).lon() + polygon.at(j).lon()) * f;
|
||||
cy += (polygon.at(i).lat() + polygon.at(j).lat()) * f;
|
||||
for (int i = 0; i < polygon.size() - 1; i++) {
|
||||
const Coordinates &pi = polygon.at(i);
|
||||
const Coordinates &pj = polygon.at(i+1);
|
||||
double f = (pi.lon() * pj.lat() - pj.lon() * pi.lat());
|
||||
cx += (pi.lon() + pj.lon()) * f;
|
||||
cy += (pi.lat() + pj.lat()) * f;
|
||||
}
|
||||
|
||||
return Coordinates(cx * factor, cy * factor);
|
||||
|
@ -329,13 +329,3 @@ QList<SubDiv*> TREFile::subdivs(const RectC &rect, int bits,
|
||||
|
||||
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;
|
||||
|
||||
friend QDebug operator<<(QDebug dbg, const MapLevel &level);
|
||||
|
||||
bool load(int idx);
|
||||
int level(int bits, const Range &baseMap);
|
||||
int readExtEntry(Handle &hdl, quint32 &polygons, quint32 &lines,
|
||||
@ -59,9 +57,6 @@ private:
|
||||
QMap<int, SubDivTree*> _subdivs;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
QDebug operator<<(QDebug dbg, const TREFile::MapLevel &level);
|
||||
#endif // QT_NO_DEBUG
|
||||
}
|
||||
|
||||
#endif // IMG_TREFILE_H
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include <QPainter>
|
||||
#include "image.h"
|
||||
|
||||
|
||||
#define TILE_SIZE 256
|
||||
|
||||
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
|
||||
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 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. */
|
||||
we have to tile the image ourself before it can be drawn. */
|
||||
if (flags & Map::OpenGL) {
|
||||
QList<QPixmap *> list;
|
||||
|
||||
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++) {
|
||||
QPoint tl(i * TILE_SIZE, j * TILE_SIZE);
|
||||
QRect tile(tl, QSize(TILE_SIZE, TILE_SIZE));
|
||||
QPixmap *pm = new QPixmap(QPixmap::fromImage(_img.copy(tile)));
|
||||
list.append(pm);
|
||||
pm->setDevicePixelRatio(ratio);
|
||||
painter->drawPixmap(tl/ratio, *pm);
|
||||
QImage img(_img.copy(tile));
|
||||
img.setDevicePixelRatio(ratio);
|
||||
painter->drawImage(tl/ratio, img);
|
||||
}
|
||||
}
|
||||
|
||||
qDeleteAll(list);
|
||||
} else
|
||||
painter->drawImage(rect.topLeft(), _img, sr);
|
||||
}
|
||||
|
Reference in New Issue
Block a user