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
0615c0b7
Commit
0615c0b7
authored
Sep 26, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1894 from dogmaphobic/mapCaching
Fixed QtLocation Caching
parents
9e967dc9
50650e7d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
47 deletions
+54
-47
OpenPilotMaps.cc
src/QtLocationPlugin/OpenPilotMaps.cc
+10
-4
qgeomapreplyqgc.cpp
src/QtLocationPlugin/qgeomapreplyqgc.cpp
+0
-4
qgeotiledmappingmanagerengineqgc.cpp
src/QtLocationPlugin/qgeotiledmappingmanagerengineqgc.cpp
+37
-38
qgeotilefetcherqgc.cpp
src/QtLocationPlugin/qgeotilefetcherqgc.cpp
+7
-1
No files found.
src/QtLocationPlugin/OpenPilotMaps.cc
View file @
0615c0b7
...
...
@@ -48,10 +48,10 @@ const QString ProviderStrings::kLevelsForSigPacSpainMap[] =
ProviderStrings
::
ProviderStrings
()
{
// Google version strings
VersionGoogleMap
=
"m@
296306248
"
;
VersionGoogleSatellite
=
"s@1
68
"
;
VersionGoogleLabels
=
"h@
296000000
"
;
VersionGoogleTerrain
=
"t@132,r@
296000000
"
;
VersionGoogleMap
=
"m@
313
"
;
VersionGoogleSatellite
=
"s@1
77
"
;
VersionGoogleLabels
=
"h@
313
"
;
VersionGoogleTerrain
=
"t@132,r@
313
"
;
SecGoogleWord
=
"Galileo"
;
// Google (China) version strings
...
...
@@ -196,7 +196,13 @@ void UrlFactory::_tryCorrectGoogleVersions()
_network
->
setProxy
(
tProxy
);
QString
url
=
"http://maps.google.com/maps?output=classic"
;
qheader
.
setUrl
(
QUrl
(
url
));
#if defined Q_OS_MACX
QByteArray
userAgent
=
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
;
#elif defined Q_OS_WIN32
QByteArray
userAgent
=
"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7"
;
#else
QByteArray
userAgent
=
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:21.0) Gecko/20130331 Firefox/21.0"
;
#endif
qheader
.
setRawHeader
(
"User-Agent"
,
userAgent
);
_googleReply
=
_network
->
get
(
qheader
);
connect
(
_googleReply
,
SIGNAL
(
finished
()),
this
,
SLOT
(
_googleVersionCompleted
()));
...
...
src/QtLocationPlugin/qgeomapreplyqgc.cpp
View file @
0615c0b7
...
...
@@ -95,13 +95,11 @@ void QGeoMapReplyQGC::networkReplyFinished()
{
if
(
!
m_reply
)
{
qWarning
()
<<
"NULL Map request reply"
;
return
;
}
if
(
m_reply
->
error
()
!=
QNetworkReply
::
NoError
)
{
qWarning
()
<<
"Map request reply error:"
<<
m_reply
->
error
();
return
;
}
...
...
@@ -146,14 +144,12 @@ void QGeoMapReplyQGC::networkReplyError(QNetworkReply::NetworkError error)
{
if
(
!
m_reply
)
{
qWarning
()
<<
"NULL Map request error"
;
return
;
}
if
(
error
!=
QNetworkReply
::
OperationCanceledError
)
{
setError
(
QGeoTiledMapReply
::
CommunicationError
,
m_reply
->
errorString
());
qWarning
()
<<
"Map request reply error:"
<<
m_reply
->
errorString
();
}
setFinished
(
true
);
...
...
src/QtLocationPlugin/qgeotiledmappingmanagerengineqgc.cpp
View file @
0615c0b7
...
...
@@ -121,45 +121,44 @@ QGeoTiledMappingManagerEngineQGC::QGeoTiledMappingManagerEngineQGC(const QVarian
// qDebug() << "Mapping cache directory:" << cacheDir;
//}
QGeoTileCache
*
tileCache
=
createTileCacheWithDir
(
cacheDir
);
int
cacheLimit
=
0
;
if
(
parameters
.
contains
(
QStringLiteral
(
"mapping.cache.disk.size"
)))
{
bool
ok
=
false
;
cacheLimit
=
parameters
.
value
(
QStringLiteral
(
"mapping.cache.disk.size"
)).
toString
().
toInt
(
&
ok
);
if
(
!
ok
)
cacheLimit
=
0
;
}
if
(
!
cacheLimit
)
// QGC Default
cacheLimit
=
1024
*
1024
*
1024
;
tileCache
->
setMaxDiskUsage
(
cacheLimit
);
//qDebug() << "Disk caching limit:" << cacheLimit;
cacheLimit
=
0
;
if
(
parameters
.
contains
(
QStringLiteral
(
"mapping.cache.memory.size"
)))
{
bool
ok
=
false
;
cacheLimit
=
parameters
.
value
(
QStringLiteral
(
"mapping.cache.memory.size"
)).
toString
().
toInt
(
&
ok
);
if
(
!
ok
)
cacheLimit
=
0
;
}
if
(
!
cacheLimit
)
// QGC Default
cacheLimit
=
10
*
1024
*
1024
;
tileCache
->
setMaxMemoryUsage
(
cacheLimit
);
//qDebug() << "Memory caching limit:" << cacheLimit;
cacheLimit
=
0
;
if
(
parameters
.
contains
(
QStringLiteral
(
"mapping.cache.texture.size"
)))
{
bool
ok
=
false
;
cacheLimit
=
parameters
.
value
(
QStringLiteral
(
"mapping.cache.texture.size"
)).
toString
().
toInt
(
&
ok
);
if
(
!
ok
)
cacheLimit
=
0
;
QGeoTileCache
*
pTileCache
=
tileCache
();
if
(
pTileCache
)
{
int
cacheLimit
=
0
;
//-- Disk Cache
if
(
parameters
.
contains
(
QStringLiteral
(
"mapping.cache.disk.size"
)))
{
bool
ok
=
false
;
cacheLimit
=
parameters
.
value
(
QStringLiteral
(
"mapping.cache.disk.size"
)).
toString
().
toInt
(
&
ok
);
if
(
!
ok
)
cacheLimit
=
0
;
}
if
(
!
cacheLimit
)
{
#ifdef __mobile__
cacheLimit
=
128
*
1024
*
1024
;
#else
cacheLimit
=
1024
*
1024
*
1024
;
#endif
}
pTileCache
->
setMaxDiskUsage
(
cacheLimit
);
//-- Memory Cache
cacheLimit
=
0
;
if
(
parameters
.
contains
(
QStringLiteral
(
"mapping.cache.memory.size"
)))
{
bool
ok
=
false
;
cacheLimit
=
parameters
.
value
(
QStringLiteral
(
"mapping.cache.memory.size"
)).
toString
().
toInt
(
&
ok
);
if
(
!
ok
)
cacheLimit
=
0
;
}
if
(
!
cacheLimit
)
{
#ifdef __mobile__
cacheLimit
=
16
*
1024
*
1024
;
#else
cacheLimit
=
128
*
1024
*
1024
;
#endif
}
pTileCache
->
setMaxMemoryUsage
(
cacheLimit
);
}
if
(
!
cacheLimit
)
// QGC Default
cacheLimit
=
10
*
1024
*
1024
;
tileCache
->
setExtraTextureUsage
(
cacheLimit
);
*
error
=
QGeoServiceProvider
::
NoError
;
errorString
->
clear
();
...
...
src/QtLocationPlugin/qgeotilefetcherqgc.cpp
View file @
0615c0b7
...
...
@@ -55,7 +55,13 @@
QGeoTileFetcherQGC
::
QGeoTileFetcherQGC
(
QGeoTiledMappingManagerEngine
*
parent
)
:
QGeoTileFetcher
(
parent
)
,
m_networkManager
(
new
QNetworkAccessManager
(
this
))
,
m_userAgent
(
"Qt Application"
)
#if defined Q_OS_MACX
,
m_userAgent
(
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0"
)
#elif defined Q_OS_WIN32
,
m_userAgent
(
"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7"
)
#else
,
m_userAgent
(
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:21.0) Gecko/20130331 Firefox/21.0"
)
#endif
,
m_UrlFactory
(
NULL
)
{
QStringList
langs
=
QLocale
::
system
().
uiLanguages
();
...
...
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