1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-06-28 12:09:15 +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,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"

View File

@ -1,16 +0,0 @@
#include <cctype>
#include "str2int.h"
int str2int(const char *str, int len)
{
int res = 0;
for (const char *sp = str; sp < str + len; sp++) {
if (::isdigit(*sp))
res = res * 10 + *sp - '0';
else
return -1;
}
return res;
}

View File

@ -1,6 +0,0 @@
#ifndef MISC_H
#define MISC_H
int str2int(const char *str, int len);
#endif // MISC_H

View File

@ -1,5 +1,21 @@
#include <cctype>
#include <cmath>
#include "nicenum.h"
#include "util.h"
int str2int(const char *str, int len)
{
int res = 0;
for (const char *sp = str; sp < str + len; sp++) {
if (::isdigit(*sp))
res = res * 10 + *sp - '0';
else
return -1;
}
return res;
}
double niceNum(double x, int round)
{

7
src/common/util.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef UTIL_H
#define UTIL_H
int str2int(const char *str, int len);
double niceNum(double x, int round);
#endif // UTIL_H

View File

@ -1,5 +1,5 @@
#include <cstring>
#include "common/str2int.h"
#include "common/util.h"
#include "igcparser.h"

View File

@ -1,5 +1,5 @@
#include <cstring>
#include "common/str2int.h"
#include "common/util.h"
#include "nmeaparser.h"

View File

@ -1,5 +1,5 @@
#include "common/coordinates.h"
#include "common/str2int.h"
#include "common/util.h"
#include "angularunits.h"
static double sDMS2deg(double val)