mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-04-21 20:59:11 +02:00
Compare commits
3 Commits
acc9d07a22
...
789606cf86
Author | SHA1 | Date | |
---|---|---|---|
789606cf86 | |||
542b3e920e | |||
0248ecb254 |
@ -148,9 +148,9 @@ qreal DEM::elevation(const Coordinates &c)
|
|||||||
|
|
||||||
QList<Area> DEM::tiles()
|
QList<Area> DEM::tiles()
|
||||||
{
|
{
|
||||||
|
static const QRegularExpression re("([NS])([0-9]{2})([EW])([0-9]{3})");
|
||||||
QDir dir(_dir);
|
QDir dir(_dir);
|
||||||
QFileInfoList files(dir.entryInfoList(QDir::Files | QDir::Readable));
|
QFileInfoList files(dir.entryInfoList(QDir::Files | QDir::Readable));
|
||||||
QRegularExpression re("([NS])([0-9]{2})([EW])([0-9]{3})");
|
|
||||||
QLocale l(QLocale::system());
|
QLocale l(QLocale::system());
|
||||||
QList<Area> list;
|
QList<Area> list;
|
||||||
|
|
||||||
|
@ -88,6 +88,7 @@ static Coordinates parseUTM(const QString &zone, const QString &easting,
|
|||||||
bool GPSDumpParser::parse(QFile *file, QList<TrackData> &tracks,
|
bool GPSDumpParser::parse(QFile *file, QList<TrackData> &tracks,
|
||||||
QList<RouteData> &routes, QList<Area> &polygons, QVector<Waypoint> &waypoints)
|
QList<RouteData> &routes, QList<Area> &polygons, QVector<Waypoint> &waypoints)
|
||||||
{
|
{
|
||||||
|
static const QRegularExpression dm("[ ]{2,}");
|
||||||
Q_UNUSED(tracks);
|
Q_UNUSED(tracks);
|
||||||
Q_UNUSED(routes);
|
Q_UNUSED(routes);
|
||||||
Q_UNUSED(polygons);
|
Q_UNUSED(polygons);
|
||||||
@ -95,7 +96,6 @@ bool GPSDumpParser::parse(QFile *file, QList<TrackData> &tracks,
|
|||||||
_errorLine = 1;
|
_errorLine = 1;
|
||||||
_errorString.clear();
|
_errorString.clear();
|
||||||
Type type = Unknown;
|
Type type = Unknown;
|
||||||
QRegularExpression dm("[ ]{2,}");
|
|
||||||
|
|
||||||
while (!file->atEnd()) {
|
while (!file->atEnd()) {
|
||||||
QByteArray ba(file->readLine(4096).trimmed());
|
QByteArray ba(file->readLine(4096).trimmed());
|
||||||
|
@ -62,7 +62,7 @@ OziMap::OziMap(const QString &fileName, CalibrationType type,
|
|||||||
if (type == Unknown) {
|
if (type == Unknown) {
|
||||||
_tar = new Tar(fileName);
|
_tar = new Tar(fileName);
|
||||||
if (!_tar->open()) {
|
if (!_tar->open()) {
|
||||||
_errorString = "Error reading tar file: " + _tar->errorString();
|
_errorString = _tar->errorString();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QStringList files(_tar->files());
|
QStringList files(_tar->files());
|
||||||
@ -262,27 +262,30 @@ bool OziMap::setImageInfo(const QString &path)
|
|||||||
|
|
||||||
bool OziMap::setTileInfo(const QStringList &tiles, const QString &path)
|
bool OziMap::setTileInfo(const QStringList &tiles, const QString &path)
|
||||||
{
|
{
|
||||||
|
static const QRegularExpression rx("_[0-9]+_[0-9]+\\.");
|
||||||
|
|
||||||
if (!_map.size.isValid()) {
|
if (!_map.size.isValid()) {
|
||||||
_errorString = "Missing total image size (IWH)";
|
_errorString = "Missing total image size (IWH)";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QRegularExpression rx("_[0-9]+_[0-9]+\\.");
|
|
||||||
for (int i = 0; i < tiles.size(); i++) {
|
for (int i = 0; i < tiles.size(); i++) {
|
||||||
if (tiles.at(i).contains(rx)) {
|
const QString &tile = tiles.at(i);
|
||||||
_tile.path = QString(tiles.at(i)).replace(rx, "_%1_%2.");
|
|
||||||
|
if (tile.startsWith("set/") && tile.contains(rx)) {
|
||||||
|
_tile.path = QString(tile).replace(rx, "_%1_%2.");
|
||||||
|
|
||||||
if (_tar) {
|
if (_tar) {
|
||||||
QByteArray ba = _tar->file(tiles.at(i));
|
QByteArray ba(_tar->file(tile));
|
||||||
QBuffer buffer(&ba);
|
QBuffer buffer(&ba);
|
||||||
_tile.size = QImageReader(&buffer).size();
|
_tile.size = QImageReader(&buffer).size();
|
||||||
} else {
|
} else {
|
||||||
_tile.path = path + "/" + _tile.path;
|
_tile.path = path + "/" + _tile.path;
|
||||||
_tile.size = QImageReader(path + "/" + tiles.at(i)).size();
|
_tile.size = QImageReader(path + "/" + tile).size();
|
||||||
}
|
}
|
||||||
if (!_tile.size.isValid()) {
|
if (!_tile.size.isValid()) {
|
||||||
_errorString = QString("Error retrieving tile size: "
|
_errorString = QString("Error retrieving tile size: "
|
||||||
"%1: Invalid image").arg(QFileInfo(tiles.at(i)).fileName());
|
"%1: Invalid image").arg(QFileInfo(tile).fileName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,8 +396,9 @@ void OziMap::drawOZF(QPainter *painter, const QRectF &rect) const
|
|||||||
int y = round(tl.y() * _mapRatio + j * _ozf->tileSize().height());
|
int y = round(tl.y() * _mapRatio + j * _ozf->tileSize().height());
|
||||||
|
|
||||||
QPixmap pixmap;
|
QPixmap pixmap;
|
||||||
QString key = _ozf->fileName() + "/" + QString::number(_zoom) + "_"
|
QString key(_ozf->fileName() + "/" + QString::number(_zoom) + "_"
|
||||||
+ QString::number(x) + "_" + QString::number(y);
|
+ QString::number(x) + "_" + QString::number(y));
|
||||||
|
|
||||||
if (!QPixmapCache::find(key, &pixmap)) {
|
if (!QPixmapCache::find(key, &pixmap)) {
|
||||||
pixmap = _ozf->tile(_zoom, x, y);
|
pixmap = _ozf->tile(_zoom, x, y);
|
||||||
if (!pixmap.isNull())
|
if (!pixmap.isNull())
|
||||||
|
@ -97,10 +97,10 @@ static Projection parseProjection(const QString &str, const GCS &gcs)
|
|||||||
|
|
||||||
bool RMap::parseIMP(const QByteArray &data)
|
bool RMap::parseIMP(const QByteArray &data)
|
||||||
{
|
{
|
||||||
QStringList lines = QString(data).split("\r\n");
|
static const QRegularExpression re("^P[0-9]+=");
|
||||||
|
QStringList lines(QString(data).split("\r\n"));
|
||||||
QVector<CalibrationPoint> calibrationPoints;
|
QVector<CalibrationPoint> calibrationPoints;
|
||||||
QString projection, datum;
|
QString projection, datum;
|
||||||
QRegularExpression re("^P[0-9]+=");
|
|
||||||
|
|
||||||
for (int i = 0; i < lines.count(); i++) {
|
for (int i = 0; i < lines.count(); i++) {
|
||||||
const QString &line = lines.at(i);
|
const QString &line = lines.at(i);
|
||||||
|
@ -70,11 +70,11 @@ bool Tar::loadTar()
|
|||||||
quint64 size;
|
quint64 size;
|
||||||
qint64 ret;
|
qint64 ret;
|
||||||
|
|
||||||
while ((ret = _file.read(buffer, BLOCKSIZE)) > 0) {
|
while ((ret = _file.read(buffer, BLOCKSIZE))) {
|
||||||
if (ret < BLOCKSIZE) {
|
if (ret < BLOCKSIZE) {
|
||||||
_file.close();
|
_file.close();
|
||||||
_index.clear();
|
_index.clear();
|
||||||
_errorString = "Error reading header block";
|
_errorString = "Error reading TAR header block";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
size = number(hdr->size, sizeof(hdr->size));
|
size = number(hdr->size, sizeof(hdr->size));
|
||||||
@ -100,7 +100,7 @@ bool Tar::loadTmi(const QString &path)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
while (!file.atEnd()) {
|
while (!file.atEnd()) {
|
||||||
QByteArray line = file.readLine(4096);
|
QByteArray line(file.readLine(4096));
|
||||||
int pos = line.indexOf(':');
|
int pos = line.indexOf(':');
|
||||||
if (line.size() < 10 || pos < 7 || !line.startsWith("block")) {
|
if (line.size() < 10 || pos < 7 || !line.startsWith("block")) {
|
||||||
qWarning("%s:%d: syntax error", qPrintable(path), ln);
|
qWarning("%s:%d: syntax error", qPrintable(path), ln);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user