1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-06-27 11:39:16 +02:00

Code cleanup

This commit is contained in:
2018-10-11 18:19:35 +02:00
parent b73072795a
commit 8f4ce8d38c
12 changed files with 32 additions and 41 deletions

View File

@ -1,7 +1,7 @@
#include <cmath>
#include <QPainter>
#include "common/util.h"
#include "config.h"
#include "nicenum.h"
#include "axisitem.h"

View File

@ -1,34 +0,0 @@
#include <cmath>
#include "nicenum.h"
double niceNum(double x, int round)
{
int expv;
double f;
double nf;
expv = (int)floor(log10(x));
f = x / pow(10.0, expv);
if (round) {
if (f < 1.5)
nf = 1.0;
else if (f < 3.0)
nf = 2.0;
else if (f < 7.0)
nf = 5.0;
else
nf = 10.0;
} else {
if (f <= 1.0)
nf = 1.0;
else if (f <= 2.0)
nf = 2.0;
else if (f <= 5.0)
nf = 5.0;
else
nf = 10.0;
}
return nf * pow(10.0, expv);
}

View File

@ -1,6 +0,0 @@
#ifndef MISC_H
#define MISC_H
double niceNum(double x, int round);
#endif // MISC_H

View File

@ -1,11 +1,8 @@
#include <cmath>
#include <QApplication>
#include <QCursor>
#include <QPainter>
#include "common/greatcircle.h"
#include "map/map.h"
#include "tooltip.h"
#include "nicenum.h"
#include "pathitem.h"
@ -50,6 +47,7 @@ void PathItem::updateShape()
void PathItem::addSegment(const Coordinates &c1, const Coordinates &c2)
{
if (fabs(c1.lon() - c2.lon()) > 180.0) {
// Split segment on date line crossing
QPointF p;
if (c2.lon() < 0) {

View File

@ -1,7 +1,7 @@
#include <cmath>
#include <QPainter>
#include "common/util.h"
#include "config.h"
#include "nicenum.h"
#include "scaleitem.h"