Browse Source

Add getMapProviderFromId support

QGC4.4
DonLakeFlyer 5 years ago
parent
commit
359e37f9c0
  1. 11
      src/QtLocationPlugin/QGCMapUrlEngine.cpp
  2. 1
      src/QtLocationPlugin/QGCMapUrlEngine.h

11
src/QtLocationPlugin/QGCMapUrlEngine.cpp

@ -155,6 +155,17 @@ QString UrlFactory::getTypeFromId(int id) { @@ -155,6 +155,17 @@ QString UrlFactory::getTypeFromId(int id) {
return "";
}
MapProvider* UrlFactory::getMapProviderFromId(int id)
{
QString type = getTypeFromId(id);
if (!type.isEmpty()) {
if (_providersTable.find(type) != _providersTable.end()) {
return _providersTable[type];
}
}
return nullptr;
}
// Todo : qHash produce a uint bigger than max(int)
// There is still a low probability for this to
// generate similar hash for different types

1
src/QtLocationPlugin/QGCMapUrlEngine.h

@ -48,6 +48,7 @@ public: @@ -48,6 +48,7 @@ public:
int getIdFromType(QString type);
QString getTypeFromId(int id);
MapProvider* getMapProviderFromId(int id);
QGCTileSet getTileCount(int zoom, double topleftLon, double topleftLat,
double bottomRightLon, double bottomRightLat,

Loading…
Cancel
Save