Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
8a0ff7e3
Commit
8a0ff7e3
authored
Oct 16, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2014 from dogmaphobic/cacheFor551
Fixing map cache for Qt 5.5.1
parents
d35b1789
a4cc3ca8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
40 deletions
+58
-40
qgeotiledmappingmanagerengineqgc.cpp
src/QtLocationPlugin/qgeotiledmappingmanagerengineqgc.cpp
+57
-40
qgeotiledmappingmanagerengineqgc.h
src/QtLocationPlugin/qgeotiledmappingmanagerengineqgc.h
+1
-0
No files found.
src/QtLocationPlugin/qgeotiledmappingmanagerengineqgc.cpp
View file @
8a0ff7e3
...
...
@@ -58,6 +58,7 @@
#include "qgeotilefetcherqgc.h"
#include "OpenPilotMaps.h"
#if QT_VERSION >= 0x050500
QGeoTiledMapQGC
::
QGeoTiledMapQGC
(
QGeoTiledMappingManagerEngine
*
engine
,
QObject
*
parent
)
:
QGeoTiledMap
(
engine
,
parent
)
...
...
@@ -82,7 +83,7 @@ QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVarian
mapTypes
<<
QGeoMapType
(
QGeoMapType
::
SatelliteMapDay
,
tr
(
"Google Satellite Map"
),
tr
(
"Google satellite map"
),
false
,
false
,
OpenPilot
::
GoogleSatellite
);
mapTypes
<<
QGeoMapType
(
QGeoMapType
::
TerrainMap
,
tr
(
"Google Terrain Map"
),
tr
(
"Google terrain map"
),
false
,
false
,
OpenPilot
::
GoogleTerrain
);
// TODO:
// Proper hybrid maps requires collecting two separate bimaps and overlaying them.
// Proper
google
hybrid maps requires collecting two separate bimaps and overlaying them.
//mapTypes << QGeoMapType(QGeoMapType::HybridMap, tr("Google Hybrid Map"), tr("Google hybrid map"), false, false, OpenPilot::GoogleHybrid);
// Bing
mapTypes
<<
QGeoMapType
(
QGeoMapType
::
StreetMap
,
tr
(
"Bing Street Map"
),
tr
(
"Bing street map"
),
false
,
false
,
OpenPilot
::
BingMap
);
...
...
@@ -99,13 +100,62 @@ QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVarian
// QGC Default
tileFetcher
->
setUserAgent
(
"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7"
);
#if QT_VERSION >= 0x050500
_setCache
(
parameters
);
#endif
setTileFetcher
(
tileFetcher
);
QString
cacheDir
;
*
error
=
QGeoServiceProvider
::
NoError
;
errorString
->
clear
();
#if QT_VERSION >= 0x050500
if
(
parameters
.
contains
(
QStringLiteral
(
"mapping.copyright"
)))
m_customCopyright
=
parameters
.
value
(
QStringLiteral
(
"mapping.copyright"
)).
toString
().
toLatin1
();
#endif
}
QGeoTiledMappingManagerEngineQGC
::~
QGeoTiledMappingManagerEngineQGC
()
{
}
#if QT_VERSION < 0x050500
QGeoMapData
*
QGeoTiledMappingManagerEngineQGC
::
createMapData
()
{
return
new
QGeoTiledMapData
(
this
,
0
);
}
#else
QGeoMap
*
QGeoTiledMappingManagerEngineQGC
::
createMap
()
{
return
new
QGeoTiledMapQGC
(
this
);
}
QString
QGeoTiledMappingManagerEngineQGC
::
customCopyright
()
const
{
return
m_customCopyright
;
}
#endif
#if QT_VERSION >= 0x050500
void
QGeoTiledMappingManagerEngineQGC
::
_setCache
(
const
QVariantMap
&
parameters
)
{
QString
cacheDir
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericCacheLocation
)
+
QLatin1String
(
"/QGCMapCache"
);
//-- Clear old cache
QDir
baseDir
(
cacheDir
);
if
(
baseDir
.
exists
())
{
const
QStringList
oldCacheFiles
=
baseDir
.
entryList
(
QDir
::
Files
);
foreach
(
const
QString
&
file
,
oldCacheFiles
)
baseDir
.
remove
(
file
);
}
if
(
parameters
.
contains
(
QStringLiteral
(
"mapping.cache.directory"
)))
cacheDir
=
parameters
.
value
(
QStringLiteral
(
"mapping.cache.directory"
)).
toString
();
else
{
cacheDir
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericCacheLocation
)
+
QLatin1String
(
"/QGCMapCache"
);
cacheDir
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericCacheLocation
)
+
QLatin1String
(
"/QGCMapCache
55
"
);
if
(
!
QDir
::
root
().
mkpath
(
cacheDir
))
{
qWarning
()
<<
"Could not create mapping disk cache directory: "
<<
cacheDir
;
cacheDir
=
QDir
::
homePath
()
+
QLatin1String
(
"/.qgcmapscache/"
);
...
...
@@ -117,11 +167,10 @@ QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVarian
qWarning
()
<<
"Could not create mapping disk cache directory: "
<<
cacheDir
;
cacheDir
.
clear
();
}
//else {
// qDebug() << "Mapping cache directory:" << cacheDir;
//}
QGeoTileCache
*
pTileCache
=
tileCache
();
else
{
qDebug
()
<<
"Mapping cache directory:"
<<
cacheDir
;
}
QGeoTileCache
*
pTileCache
=
createTileCacheWithDir
(
cacheDir
);
if
(
pTileCache
)
{
int
cacheLimit
=
0
;
...
...
@@ -159,37 +208,5 @@ QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVarian
}
pTileCache
->
setMaxMemoryUsage
(
cacheLimit
);
}
*
error
=
QGeoServiceProvider
::
NoError
;
errorString
->
clear
();
#if QT_VERSION >= 0x050500
if
(
parameters
.
contains
(
QStringLiteral
(
"mapping.copyright"
)))
m_customCopyright
=
parameters
.
value
(
QStringLiteral
(
"mapping.copyright"
)).
toString
().
toLatin1
();
#endif
}
QGeoTiledMappingManagerEngineQGC
::~
QGeoTiledMappingManagerEngineQGC
()
{
}
#if QT_VERSION < 0x050500
QGeoMapData
*
QGeoTiledMappingManagerEngineQGC
::
createMapData
()
{
return
new
QGeoTiledMapData
(
this
,
0
);
}
#else
QGeoMap
*
QGeoTiledMappingManagerEngineQGC
::
createMap
()
{
return
new
QGeoTiledMapQGC
(
this
);
}
QString
QGeoTiledMappingManagerEngineQGC
::
customCopyright
()
const
{
return
m_customCopyright
;
}
#endif
src/QtLocationPlugin/qgeotiledmappingmanagerengineqgc.h
View file @
8a0ff7e3
...
...
@@ -77,6 +77,7 @@ public:
private:
#if QT_VERSION >= 0x050500
QString
m_customCopyright
;
void
_setCache
(
const
QVariantMap
&
parameters
);
#endif
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment