[qt] Build improvements and better handling of map settings (#197)

* QMapboxGLSettings functions for changing default options and getting default styles

* [qt] allow to build without widgets and other cmake improvements

* [qt] Install include/mbgl for development

* [qt] library static/shared install+export

* [qt] Add missing mbgl-compiler-options dependency for 'qmapboxgl'

* [qt] Raise CMAKE_OSX_DEPLOYMENT_TARGET from 10.13 to 13.0

* [qt] Add Qt::Sql dependency also to the final library. Build qmapboxgl as OBJECT lib inside QtLocation plugin.

* Remove Qt::Sql dependency from 'qmapboxgl'. Not really needed.

* Set CMake config files path back to ${CMAKE_INSTALL_LIBDIR}/cmake/QMapboxGL/

* [qt] Set CMAKE_OSX_DEPLOYMENT_TARGET only if it is not yet set

* [qt] Support CMake v3.11 and earlier versions

* [qt] Comment out 'iOS_static' from CI until it is fixed.

Co-authored-by: Rinigus <rinigus.git@gmail.com>
This commit is contained in:
kiibimees
2022-02-14 18:18:29 +02:00
committed by GitHub
parent 13983337f6
commit 747eb3a440
10 changed files with 192 additions and 82 deletions

View File

@@ -459,6 +459,43 @@ void QMapboxGLSettings::setResourceTransform(const std::function<std::string(con
m_resourceTransform = transform;
}
/*!
Reset all settings based on the given template.
MapLibre can support servers with different resource path structure.
Some of the most common servers like Maptiler and Mapbox are defined
in the library. This function will re-initialise all settings based
on the default values of specific service provider defaults.
*/
void QMapboxGLSettings::resetToTemplate(SettingsTemplate settings_template)
{
if(m_tileServerOptionsInternal) delete m_tileServerOptionsInternal;
if(settings_template == MapLibreSettings){
m_tileServerOptionsInternal = new mbgl::TileServerOptions(mbgl::TileServerOptions::MapLibreConfiguration());
}else if(settings_template == MapTilerSettings){
m_tileServerOptionsInternal = new mbgl::TileServerOptions(mbgl::TileServerOptions::MapTilerConfiguration());
}else if(settings_template == MapboxSettings){
m_tileServerOptionsInternal = new mbgl::TileServerOptions(mbgl::TileServerOptions::MapboxConfiguration());
}else{
m_tileServerOptionsInternal = new mbgl::TileServerOptions(mbgl::TileServerOptions::DefaultConfiguration());
}
}
/*!
All predefined styles.
Return all styles that are defined in default settings.
*/
QVector<QPair<QString, QString> > QMapboxGLSettings::defaultStyles(){
QVector<QPair<QString, QString>> styles;
for (const auto &style : tileServerOptionsInternal()->defaultStyles()) {
styles.append(QPair<QString, QString>(
QString::fromStdString(style.getUrl()), QString::fromStdString(style.getName())));
}
return styles;
}
mbgl::TileServerOptions *QMapboxGLSettings::tileServerOptionsInternal() const {
return m_tileServerOptionsInternal;
}