mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-27 21:24:47 +01:00
Compare commits
No commits in common. "da763e7700c5404f5b2032a5f97fe3dd3d38e148" and "28bd3e49d10d3bcb1cd2887c0838a20144957c15" have entirely different histories.
da763e7700
...
28bd3e49d1
30
.github/workflows/osx.yml
vendored
30
.github/workflows/osx.yml
vendored
@ -6,8 +6,8 @@ on:
|
|||||||
- master
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
qt5:
|
build:
|
||||||
name: GPXSee Qt5 build
|
name: GPXSee
|
||||||
runs-on: macos-10.15
|
runs-on: macos-10.15
|
||||||
steps:
|
steps:
|
||||||
- name: Set environment variables
|
- name: Set environment variables
|
||||||
@ -27,29 +27,5 @@ jobs:
|
|||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: GPXSee-qt5.dmg
|
name: GPXSee.dmg
|
||||||
path: GPXSee.dmg
|
|
||||||
|
|
||||||
qt6:
|
|
||||||
name: GPXSee Qt6 build
|
|
||||||
runs-on: macos-latest
|
|
||||||
steps:
|
|
||||||
- name: Set environment variables
|
|
||||||
run: echo "PATH=/usr/local/opt/qt@6/bin:$PATH" >> $GITHUB_ENV
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install dependencies
|
|
||||||
run: brew install qt6
|
|
||||||
- name: Create localization
|
|
||||||
run: lrelease gpxsee.pro
|
|
||||||
- name: Configure build
|
|
||||||
run: qmake gpxsee.pro
|
|
||||||
- name: Build project
|
|
||||||
run: make -j3
|
|
||||||
- name: Create DMG
|
|
||||||
run: macdeployqt GPXSee.app -dmg
|
|
||||||
- name: Upload artifacts
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: GPXSee-qt6.dmg
|
|
||||||
path: GPXSee.dmg
|
path: GPXSee.dmg
|
||||||
|
@ -700,8 +700,8 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
|
|||||||
PlotFlags flags)
|
PlotFlags flags)
|
||||||
{
|
{
|
||||||
QRect orig, adj;
|
QRect orig, adj;
|
||||||
qreal ratio, diff, q, p;
|
qreal ratio, diff, q;
|
||||||
QPointF scenePos, scalePos, posPos, motionPos;
|
QPointF origScene, origPos;
|
||||||
int zoom;
|
int zoom;
|
||||||
|
|
||||||
|
|
||||||
@ -712,9 +712,7 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
|
|||||||
|
|
||||||
// Compute sizes & ratios
|
// Compute sizes & ratios
|
||||||
orig = viewport()->rect();
|
orig = viewport()->rect();
|
||||||
scalePos = _mapScale->pos();
|
origPos = _mapScale->pos();
|
||||||
posPos = _positionCoordinates->pos();
|
|
||||||
motionPos = _motionInfo->pos();
|
|
||||||
|
|
||||||
if (orig.height() * (target.width() / target.height()) - orig.width() < 0) {
|
if (orig.height() * (target.width() / target.height()) - orig.width() < 0) {
|
||||||
ratio = target.height() / target.width();
|
ratio = target.height() / target.width();
|
||||||
@ -739,7 +737,7 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
|
|||||||
if (flags & HiRes) {
|
if (flags & HiRes) {
|
||||||
zoom = _map->zoom();
|
zoom = _map->zoom();
|
||||||
QRectF vr(mapToScene(orig).boundingRect());
|
QRectF vr(mapToScene(orig).boundingRect());
|
||||||
scenePos = vr.center();
|
origScene = vr.center();
|
||||||
|
|
||||||
QPointF s(painter->device()->logicalDpiX()
|
QPointF s(painter->device()->logicalDpiX()
|
||||||
/ (qreal)metric(QPaintDevice::PdmDpiX),
|
/ (qreal)metric(QPaintDevice::PdmDpiX),
|
||||||
@ -753,22 +751,16 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
|
|||||||
centerOn(center);
|
centerOn(center);
|
||||||
adj.moveCenter(mapFromScene(center));
|
adj.moveCenter(mapFromScene(center));
|
||||||
|
|
||||||
p = s.x() / q;
|
_mapScale->setDigitalZoom(_digitalZoom - log2(s.x() / q));
|
||||||
} else
|
_mapScale->setPos(mapToScene(QPoint(adj.bottomRight() + QPoint(
|
||||||
p = 1 / q;
|
-(SCALE_OFFSET + _mapScale->boundingRect().width()) * (s.x() / q),
|
||||||
|
-(SCALE_OFFSET + _mapScale->boundingRect().height()) * (s.x() / q)))));
|
||||||
_mapScale->setDigitalZoom(_digitalZoom - log2(p));
|
} else {
|
||||||
_mapScale->setPos(mapToScene(adj.bottomRight() + QPoint(
|
_mapScale->setDigitalZoom(_digitalZoom - log2(1.0 / q));
|
||||||
-(SCALE_OFFSET + _mapScale->boundingRect().width()) * p,
|
_mapScale->setPos(mapToScene(QPoint(adj.bottomRight() + QPoint(
|
||||||
-(SCALE_OFFSET + _mapScale->boundingRect().height()) * p)));
|
-(SCALE_OFFSET + _mapScale->boundingRect().width()) / q ,
|
||||||
_positionCoordinates->setDigitalZoom(_digitalZoom - log2(p));
|
-(SCALE_OFFSET + _mapScale->boundingRect().height()) / q))));
|
||||||
_positionCoordinates->setPos(mapToScene(adj.topLeft() + QPoint(
|
}
|
||||||
COORDINATES_OFFSET * p,
|
|
||||||
(COORDINATES_OFFSET + _positionCoordinates->boundingRect().height()) * p)));
|
|
||||||
_motionInfo->setDigitalZoom(_digitalZoom - log2(p));
|
|
||||||
_motionInfo->setPos(mapToScene(adj.topRight() + QPoint(
|
|
||||||
(-COORDINATES_OFFSET - _motionInfo->boundingRect().width()) * p,
|
|
||||||
(COORDINATES_OFFSET + _motionInfo->boundingRect().height()) * p)));
|
|
||||||
|
|
||||||
// Print the view
|
// Print the view
|
||||||
render(painter, target, adj);
|
render(painter, target, adj);
|
||||||
@ -777,14 +769,10 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
|
|||||||
if (flags & HiRes) {
|
if (flags & HiRes) {
|
||||||
_map->setZoom(zoom);
|
_map->setZoom(zoom);
|
||||||
rescale();
|
rescale();
|
||||||
centerOn(scenePos);
|
centerOn(origScene);
|
||||||
}
|
}
|
||||||
_mapScale->setDigitalZoom(_digitalZoom);
|
_mapScale->setDigitalZoom(_digitalZoom);
|
||||||
_mapScale->setPos(scalePos);
|
_mapScale->setPos(origPos);
|
||||||
_positionCoordinates->setDigitalZoom(_digitalZoom);
|
|
||||||
_positionCoordinates->setPos(posPos);
|
|
||||||
_motionInfo->setDigitalZoom(_digitalZoom);
|
|
||||||
_motionInfo->setPos(motionPos);
|
|
||||||
|
|
||||||
// Exit plot mode
|
// Exit plot mode
|
||||||
_map->setDevicePixelRatio(_deviceRatio, _mapRatio);
|
_map->setDevicePixelRatio(_deviceRatio, _mapRatio);
|
||||||
@ -1123,35 +1111,33 @@ void MapView::drawBackground(QPainter *painter, const QRectF &rect)
|
|||||||
|
|
||||||
void MapView::paintEvent(QPaintEvent *event)
|
void MapView::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
if (!_plot) {
|
QPointF scaleScenePos = mapToScene(rect().bottomRight() + QPoint(
|
||||||
QPointF scaleScenePos = mapToScene(rect().bottomRight() + QPoint(
|
-(SCALE_OFFSET + _mapScale->boundingRect().width()),
|
||||||
-(SCALE_OFFSET + _mapScale->boundingRect().width()),
|
-(SCALE_OFFSET + _mapScale->boundingRect().height())));
|
||||||
-(SCALE_OFFSET + _mapScale->boundingRect().height())));
|
if (_mapScale->pos() != scaleScenePos && !_plot)
|
||||||
if (_mapScale->pos() != scaleScenePos)
|
_mapScale->setPos(scaleScenePos);
|
||||||
_mapScale->setPos(scaleScenePos);
|
|
||||||
|
|
||||||
if (_cursorCoordinates->isVisible()) {
|
if (_cursorCoordinates->isVisible()) {
|
||||||
QPointF coordinatesScenePos = mapToScene(rect().bottomLeft()
|
QPointF coordinatesScenePos = mapToScene(rect().bottomLeft()
|
||||||
+ QPoint(COORDINATES_OFFSET, -COORDINATES_OFFSET));
|
+ QPoint(COORDINATES_OFFSET, -COORDINATES_OFFSET));
|
||||||
if (_cursorCoordinates->pos() != coordinatesScenePos)
|
if (_cursorCoordinates->pos() != coordinatesScenePos && !_plot)
|
||||||
_cursorCoordinates->setPos(coordinatesScenePos);
|
_cursorCoordinates->setPos(coordinatesScenePos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_positionCoordinates->isVisible()) {
|
if (_positionCoordinates->isVisible()) {
|
||||||
QPointF coordinatesScenePos = mapToScene(rect().topLeft()
|
QPointF coordinatesScenePos = mapToScene(rect().topLeft()
|
||||||
+ QPoint(COORDINATES_OFFSET, COORDINATES_OFFSET
|
+ QPoint(COORDINATES_OFFSET, COORDINATES_OFFSET
|
||||||
+ _positionCoordinates->boundingRect().height()));
|
+ _positionCoordinates->boundingRect().height()));
|
||||||
if (_positionCoordinates->pos() != coordinatesScenePos)
|
if (_positionCoordinates->pos() != coordinatesScenePos)
|
||||||
_positionCoordinates->setPos(coordinatesScenePos);
|
_positionCoordinates->setPos(coordinatesScenePos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_motionInfo->isVisible()) {
|
if (_motionInfo->isVisible()) {
|
||||||
QPointF coordinatesScenePos = mapToScene(rect().topRight()
|
QPointF coordinatesScenePos = mapToScene(rect().topRight()
|
||||||
+ QPoint(-COORDINATES_OFFSET - _motionInfo->boundingRect().width(),
|
+ QPoint(-COORDINATES_OFFSET - _motionInfo->boundingRect().width(),
|
||||||
COORDINATES_OFFSET + _motionInfo->boundingRect().height()));
|
COORDINATES_OFFSET + _motionInfo->boundingRect().height()));
|
||||||
if (_motionInfo->pos() != coordinatesScenePos)
|
if (_motionInfo->pos() != coordinatesScenePos)
|
||||||
_motionInfo->setPos(coordinatesScenePos);
|
_motionInfo->setPos(coordinatesScenePos);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QGraphicsView::paintEvent(event);
|
QGraphicsView::paintEvent(event);
|
||||||
|
Loading…
Reference in New Issue
Block a user