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
c63de4c8
Commit
c63de4c8
authored
Sep 16, 2019
by
Pierre TILAK
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Error handling, avoid index out of range
parent
5683020f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
QGCMapUrlEngine.cpp
src/QtLocationPlugin/QGCMapUrlEngine.cpp
+17
-6
No files found.
src/QtLocationPlugin/QGCMapUrlEngine.cpp
View file @
c63de4c8
...
...
@@ -16,6 +16,9 @@
//#define DEBUG_GOOGLE_MAPS
#include "QGCLoggingCategory.h"
QGC_LOGGING_CATEGORY
(
QGCMapUrlEngineLog
,
"QGCMapUrlEngineLog"
)
#include "AppSettings.h"
#include "QGCApplication.h"
#include "QGCMapEngine.h"
...
...
@@ -52,6 +55,7 @@ QString UrlFactory::getImageFormat(int id, const QByteArray& image) {
if
(
_providersTable
.
find
(
type
)
!=
_providersTable
.
end
())
{
return
_providersTable
[
getTypeFromId
(
id
)]
->
getImageFormat
(
image
);
}
else
{
qCDebug
(
QGCMapUrlEngineLog
)
<<
"getImageFormat : Map not registered :"
<<
type
;
return
""
;
}
}
...
...
@@ -61,6 +65,7 @@ QString UrlFactory::getImageFormat(QString type, const QByteArray& image) {
if
(
_providersTable
.
find
(
type
)
!=
_providersTable
.
end
())
{
return
_providersTable
[
type
]
->
getImageFormat
(
image
);
}
else
{
qCDebug
(
QGCMapUrlEngineLog
)
<<
"getImageFormat : Map not registered :"
<<
type
;
return
""
;
}
// QString format;
...
...
@@ -135,13 +140,19 @@ QNetworkRequest UrlFactory::getTileURL(int id, int x, int y, int zoom,
if
(
_providersTable
.
find
(
type
)
!=
_providersTable
.
end
())
{
return
_providersTable
[
type
]
->
getTileURL
(
x
,
y
,
zoom
,
networkManager
);
}
qCDebug
(
QGCMapUrlEngineLog
)
<<
"getTileURL : map not registered :"
<<
type
;
return
QNetworkRequest
(
QUrl
());
}
//-----------------------------------------------------------------------------
QNetworkRequest
UrlFactory
::
getTileURL
(
QString
type
,
int
x
,
int
y
,
int
zoom
,
QNetworkAccessManager
*
networkManager
)
{
if
(
_providersTable
.
find
(
type
)
!=
_providersTable
.
end
())
{
return
_providersTable
[
type
]
->
getTileURL
(
x
,
y
,
zoom
,
networkManager
);
}
qCDebug
(
QGCMapUrlEngineLog
)
<<
"getTileURL : map not registered :"
<<
type
;
return
QNetworkRequest
(
QUrl
());
////-- Build URL
// QNetworkRequest request;
// QString url = _getURL(type, x, y, zoom, networkManager);
...
...
@@ -468,10 +479,9 @@ quint32 UrlFactory::averageSizeForType(QString type) {
qDebug
()
<<
"UrlFactory::averageSizeForType for"
<<
type
;
if
(
_providersTable
.
find
(
type
)
!=
_providersTable
.
end
())
{
return
_providersTable
[
type
]
->
getAverageSize
();
}
else
{
}
qDebug
()
<<
"UrlFactory::averageSizeForType "
<<
type
<<
" Not registered"
;
}
// switch (type) {
// case GoogleMap:
...
...
@@ -509,7 +519,7 @@ quint32 UrlFactory::averageSizeForType(QString type) {
// default:
// break;
// }
//
return AVERAGE_TILE_SIZE;
return
AVERAGE_TILE_SIZE
;
}
QString
UrlFactory
::
getTypeFromId
(
int
id
)
{
...
...
@@ -522,6 +532,7 @@ QString UrlFactory::getTypeFromId(int id) {
return
i
.
key
();
}
}
qCDebug
(
QGCMapUrlEngineLog
)
<<
"getTypeFromId : id not found"
<<
id
return
""
;
}
...
...
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