* Refactoring online file source so that tile server configuration is not hardcoded - part 1 * Added default templates * Update from master * Renaming MGLAccountManager to MGLSettings. Passing ResourceOptions and TileServerOptions to relevant classes and method in order to remove mapbox hardocded configuration * Fixing build * Addedm missing theme * Unit tests fixes * Fixing unit tests, adding factory methods for creating predefined configuration. * Fixing mapbox unit tests * Additional unit test fixes * Making MapboxConfiguration default * Making get/set resource options available in all classes that inherits from FileSource * Making get/set resource options available in all classes that inherits from FileSource - part 2 * Fixes for Android * Disable test coverage reports * Disable test coverage reports * Disable test coverage reports * Disable test coverage reports * Removing hardcoded configuration in iOS project - part 1 * Fixing wrong file extension, making use of tile server options. * Use apiKey and MGL_API_KEY everywhere * Just a rename * Re-enabling tests and improving MGLSettings init * Removing mapbox hardcoded configuration, using api key everywhere, implementing JNI conversion for TileServerOptions * Lint issues. * Integrating configurable tile server properties into Android SDK - part 2 * Removing mabox accounts * Exposing multiple configurations to Android SDK - bug fixes * Removing TileServerOptions from public interface - native methods dont work before mapbox-gl library is loaded * Adding support for configurable predefined styles * Migrating predefined styles in test app + cleanup * Parameter fix * Bug fixes * Fixing render test build * Fixing offline tester * Fixing benchmark tool * Fix: typo in method name * Adding code for public access to TileServerOptions * Bug fixes and debug code removal * Fixes for macOS, adding unit tests from MapLibre, removing redundant members from OnlineFileSource * Unit test fixes * MacOS test app - migrating to configurable tile server options, part 1 * Fixing offline maps * Migrating macOS test app to MapTiler * Minor improvements * Putting back apiKey test * Added unit tests for MapTiler configuration * Migrating test resources to MapTiler * minor fix * A few fixes * Fixing macOS tests, removing feedback functionality * Migrating ios test app to MapTiler * Migrating ui tests * UI tests fix * Benchmarking app fix * Cleanup and strings updates * Migrating benchmark app to maptiler * API key injection in benchmark app * Putting back release configuration * Additional tests and fixing issues identified by thread sanitizer. * Removing test filters * Fixes and addressing lint issues * More Maptiler tests + minro fix * Android instrumentation test migration to MapTiler. Exposing missing TileServerOptions in Android SDK. Minor fixes. * No requirements on API key format. * Fixing offline cache test tool * Adding configurable domain name for sources, adding source domain int MapTiler configuration, cleanup * Migrating tests to MapTiler, adding code for canonicalizing URLs, removing mapbox stuff from comments, cleanup * More tests * Updated database size * Lint issues * Fixed test * Updating developer config API key * Fixes for Android, propagaing updated tileServerOptions to native file sources, more tests * Just a few more fixes * Propagating updated settings to file sources + additional unit test * Lint issues * Removing test filter and fixing incorrect uri * Release preparation * macos release notes
289 lines
9.5 KiB
C++
289 lines
9.5 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <memory>
|
|
#include <mbgl/util/default_style.hpp>
|
|
#include <mbgl/util/optional.hpp>
|
|
|
|
namespace mbgl {
|
|
|
|
/**
|
|
* @brief Holds values for tile server options.
|
|
*/
|
|
class TileServerOptions final {
|
|
public:
|
|
/**
|
|
* @brief Constructs a TileServerOptions object with default values.
|
|
*/
|
|
explicit TileServerOptions();
|
|
~TileServerOptions();
|
|
|
|
// movable
|
|
TileServerOptions(TileServerOptions&& options) noexcept;
|
|
TileServerOptions& operator=(TileServerOptions&& options) noexcept;
|
|
|
|
// copyable
|
|
TileServerOptions(const TileServerOptions&);
|
|
|
|
|
|
TileServerOptions clone() const;
|
|
|
|
/**
|
|
* @brief Sets the API base URL.
|
|
*
|
|
* @param baseURL API base URL.
|
|
* @return TileServerOptions for chaining options together.
|
|
*/
|
|
TileServerOptions& withBaseURL(std::string baseURL);
|
|
|
|
/**
|
|
* @brief Gets the previously set (or default) API base URL.
|
|
*
|
|
* @return const std::string& API base URL.
|
|
*/
|
|
const std::string& baseURL() const;
|
|
|
|
/**
|
|
* @brief Sets the scheme alias for the tile server. For example maptiler:// for MapTiler.
|
|
*
|
|
* @param alias The URI alias.
|
|
* @return TileServerOptions for chaining options together.
|
|
*/
|
|
TileServerOptions& withUriSchemeAlias(std::string alias);
|
|
|
|
/**
|
|
* @brief Gets the previously set (or default) tile server URI alias.
|
|
*
|
|
* @return const std::string& scheme alias.
|
|
*/
|
|
const std::string& uriSchemeAlias() const;
|
|
|
|
/**
|
|
* @brief Sets the template for sources.
|
|
*
|
|
* @param sourceTemplate The source template.
|
|
* @param domainName The domain name.
|
|
* @return TileServerOptions for chaining options together.
|
|
*/
|
|
TileServerOptions& withSourceTemplate(std::string sourceTemplate, std::string domainName, optional<std::string> versionPrefix);
|
|
|
|
/**
|
|
* @brief Gets the previously set (or default) source template.
|
|
*
|
|
* @return const std::string& source template.
|
|
*/
|
|
const std::string& sourceTemplate() const;
|
|
|
|
/**
|
|
* @brief Gets the previously set (or default) source domain name
|
|
*
|
|
* @return const std::string& source domain name.
|
|
*/
|
|
const std::string& sourceDomainName() const;
|
|
|
|
/**
|
|
* @brief Gets the previously set (or default) version prefix
|
|
*
|
|
* @return const optional<std::string>& version prefix.
|
|
*/
|
|
const optional<std::string>& sourceVersionPrefix() const;
|
|
|
|
/**
|
|
* @brief Sets the template for styles.
|
|
*
|
|
* @param styleTemplate The style template.
|
|
* @param domainName If set, the URL domain must contain the specified string to be matched as canonical style URL .
|
|
*
|
|
* @return TileServerOptions for chaining options together.
|
|
*/
|
|
TileServerOptions& withStyleTemplate(std::string styleTemplate, std::string domainName, optional<std::string> versionPrefix);
|
|
|
|
/**
|
|
* @brief Gets the previously set (or default) style template.
|
|
*
|
|
* @return const std::string& style template.
|
|
*/
|
|
const std::string& styleTemplate() const;
|
|
|
|
/**
|
|
* @brief Gets the previously set (or default) style domain name.
|
|
*
|
|
* @return const std::string& domain name.
|
|
*/
|
|
const std::string& styleDomainName() const;
|
|
|
|
/**
|
|
* @brief Gets the previously set (or default) version prefix
|
|
*
|
|
* @return const optional<std::string>& version prefix.
|
|
*/
|
|
const optional<std::string>& styleVersionPrefix() const;
|
|
|
|
/**
|
|
* @brief Sets the template for sprites.
|
|
* @param domainName If set, the URL domain must contain the specified string to be matched as canonical sprite URL .
|
|
*
|
|
* @param spritesTemplate The sprites template.
|
|
* @return TileServerOptions for chaining options together.
|
|
*/
|
|
TileServerOptions& withSpritesTemplate(std::string spritesTemplate, std::string domainName, optional<std::string> versionPrefix);
|
|
|
|
/**
|
|
* @brief Gets the previously set (or default) sprites template.
|
|
*
|
|
* @return const std::string& sprites template.
|
|
*/
|
|
const std::string& spritesTemplate() const;
|
|
|
|
/**
|
|
* @brief Gets the previously set (or default) sprites domain name.
|
|
*
|
|
* @return const std::string& domain name.
|
|
*/
|
|
const std::string& spritesDomainName() const;
|
|
|
|
/**
|
|
* @brief Gets the previously set (or default) version prefix
|
|
*
|
|
* @return const optional<std::string>& version prefix.
|
|
*/
|
|
const optional<std::string>& spritesVersionPrefix() const;
|
|
|
|
/**
|
|
* @brief Sets the template for glyphs.
|
|
*
|
|
* @param glyphsTemplate The glyphs template.
|
|
* @param domainName If set, the URL domain must contain the specified string to be matched as canonical glyphs URL .
|
|
*
|
|
* @return TileServerOptions for chaining options together.
|
|
*/
|
|
TileServerOptions& withGlyphsTemplate(std::string glyphsTemplate, std::string domainName, optional<std::string> versionPrefix);
|
|
|
|
/**
|
|
* @brief Gets the previously set (or default) glyphs template.
|
|
*
|
|
* @return const std::string& glyphs template.
|
|
*/
|
|
const std::string& glyphsTemplate() const;
|
|
|
|
/**
|
|
* @brief Gets the previously set (or default) glyphs domain name.
|
|
*
|
|
* @return const std::string& domain name.
|
|
*/
|
|
const std::string& glyphsDomainName() const;
|
|
|
|
/**
|
|
* @brief Gets the previously set (or default) version prefix
|
|
*
|
|
* @return const optional<std::string>& version prefix.
|
|
*/
|
|
const optional<std::string>& glyphsVersionPrefix() const;
|
|
|
|
/**
|
|
* @brief Sets the template for tiles.
|
|
*
|
|
* @param tileTemplate The tile template.
|
|
* @param domainName If set, the URL domain must contain the specified string to be matched as canonical tile URL .
|
|
*
|
|
* @return TileServerOptions for chaining options together.
|
|
*/
|
|
TileServerOptions& withTileTemplate(std::string tileTemplate, std::string domainName, optional<std::string> versionPrefix);
|
|
|
|
/**
|
|
* @brief Gets the previously set (or default) tile template.
|
|
*
|
|
* @return const std::string& tile template.
|
|
*/
|
|
const std::string& tileTemplate() const;
|
|
|
|
/**
|
|
* @brief Gets the previously set (or default) tile domain name.
|
|
*
|
|
* @return const std::string& domain name.
|
|
*/
|
|
const std::string& tileDomainName() const;
|
|
|
|
/**
|
|
* @brief Gets the previously set (or default) version prefix
|
|
*
|
|
* @return const optional<std::string>& version prefix.
|
|
*/
|
|
const optional<std::string>& tileVersionPrefix() const;
|
|
|
|
/**
|
|
* @brief Sets the access token parameter name.
|
|
*
|
|
* @param apiKeyParameterName The parameter name.
|
|
* @return TileServerOptions for chaining options together.
|
|
*/
|
|
TileServerOptions& withApiKeyParameterName(std::string apiKeyParameterName);
|
|
|
|
/**
|
|
* @brief Gets the previously set (or default) apiKeyParameterName.
|
|
*
|
|
* @return const std::string& apiKeyParameterName.
|
|
*/
|
|
const std::string& apiKeyParameterName() const;
|
|
|
|
TileServerOptions& setRequiresApiKey(bool apiKeyRequired);
|
|
|
|
/**
|
|
* @brief Whether the tile server requires API key
|
|
*
|
|
* @return const bool true if API key is required
|
|
*/
|
|
bool requiresApiKey() const;
|
|
/**
|
|
* @brief Gets the default styles.
|
|
*/
|
|
const std::vector<const mbgl::util::DefaultStyle> defaultStyles() const;
|
|
|
|
/**
|
|
* @brief Sets the collection default styles.
|
|
*
|
|
* @param styles The style set.
|
|
* @return TileServerOptions for chaining options together.
|
|
*/
|
|
TileServerOptions& withDefaultStyles(std::vector<const mbgl::util::DefaultStyle> styles);
|
|
|
|
/**
|
|
* @brief Sets the default style by name. The style name must exists in defaultStyles collection
|
|
*
|
|
* @param defaultStyle The style name
|
|
* @return TileServerOptions for chaining options together.
|
|
*/
|
|
TileServerOptions& withDefaultStyle(std::string defaultStyle);
|
|
|
|
/**
|
|
* @brief Get the default style name
|
|
*/
|
|
const std::string& defaultStyle() const;
|
|
|
|
/**
|
|
* @brief Get the default configuration
|
|
*/
|
|
static TileServerOptions DefaultConfiguration();
|
|
|
|
/**
|
|
* @brief Get the tile server options configured for MapLibre.
|
|
*/
|
|
static TileServerOptions MapLibreConfiguration();
|
|
|
|
/**
|
|
* @brief Get the tile server options configured for Mapbox.
|
|
*/
|
|
static TileServerOptions MapboxConfiguration();
|
|
|
|
/**
|
|
* @brief Get the tile server options configured for MapTiler.
|
|
*/
|
|
static TileServerOptions MapTilerConfiguration();
|
|
|
|
private:
|
|
class Impl;
|
|
std::unique_ptr<Impl> impl_;
|
|
};
|
|
|
|
} // namespace mbgl
|