mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-01-18 11:52:08 +01:00
Try to load maps with incorrect (windows absolute) image paths.
This commit is contained in:
parent
aef0357204
commit
75bd388be0
@ -154,14 +154,13 @@ bool OfflineMap::createProjection(const QString &datum,
|
|||||||
const QString &projection, const ProjectionSetup &setup,
|
const QString &projection, const ProjectionSetup &setup,
|
||||||
QList<ReferencePoint> &points)
|
QList<ReferencePoint> &points)
|
||||||
{
|
{
|
||||||
Ellipsoid::Name ellipsoid = Ellipsoid::WGS84;
|
|
||||||
|
|
||||||
if (points.count() < 2) {
|
if (points.count() < 2) {
|
||||||
qWarning("%s: insufficient number of reference points",
|
qWarning("%s: insufficient number of reference points",
|
||||||
qPrintable(_name));
|
qPrintable(_name));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ellipsoid::Name ellipsoid = Ellipsoid::WGS84;
|
||||||
for (size_t i = 0; i < ARRAY_SIZE(datums); i++) {
|
for (size_t i = 0; i < ARRAY_SIZE(datums); i++) {
|
||||||
if (datum.startsWith(datums[i].name)) {
|
if (datum.startsWith(datums[i].name)) {
|
||||||
ellipsoid = datums[i].ellipsoid;
|
ellipsoid = datums[i].ellipsoid;
|
||||||
@ -284,8 +283,25 @@ bool OfflineMap::computeResolution(QList<ReferencePoint> &points)
|
|||||||
bool OfflineMap::getImageInfo(const QString &path)
|
bool OfflineMap::getImageInfo(const QString &path)
|
||||||
{
|
{
|
||||||
QFileInfo ii(_imgPath);
|
QFileInfo ii(_imgPath);
|
||||||
|
|
||||||
if (ii.isRelative())
|
if (ii.isRelative())
|
||||||
_imgPath = path + "/" + _imgPath;
|
ii.setFile(path + "/" + _imgPath);
|
||||||
|
|
||||||
|
if (!ii.exists()) {
|
||||||
|
int last = _imgPath.lastIndexOf('\\');
|
||||||
|
if (last >= 0 && last < _imgPath.length() - 1) {
|
||||||
|
QStringRef fn(&_imgPath, last + 1, _imgPath.length() - last - 1);
|
||||||
|
ii.setFile(path + "/" + fn.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ii.exists())
|
||||||
|
_imgPath = ii.absoluteFilePath();
|
||||||
|
else {
|
||||||
|
qWarning("%s: %s: No such image file", qPrintable(_name),
|
||||||
|
qPrintable(_imgPath));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
QImageReader img(_imgPath);
|
QImageReader img(_imgPath);
|
||||||
_size = img.size();
|
_size = img.size();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user