[core] Source-driven attribution
Implemented observer callbacks so the style knows when the source’s attribution changes and the map knows when the style’s attribution changes. Also implemented a getter for a tile source’s attribution. Fixes #2723.
This commit is contained in:
committed by
Minh Nguyễn
parent
78af55f30a
commit
f307652548
@@ -6,7 +6,7 @@ using namespace mbgl;
|
||||
using namespace mbgl::style;
|
||||
|
||||
/**
|
||||
* An implementation of style::Observer that forwards all methods to dynamically-settable lambas.
|
||||
* An implementation of style::Observer that forwards all methods to dynamically-settable lambdas.
|
||||
*/
|
||||
class StubStyleObserver : public style::Observer {
|
||||
public:
|
||||
@@ -30,6 +30,10 @@ public:
|
||||
if (sourceLoaded) sourceLoaded(source);
|
||||
}
|
||||
|
||||
void onSourceAttributionChanged(Source& source, const std::string& attribution) override {
|
||||
if (sourceAttributionChanged) sourceAttributionChanged(source, attribution);
|
||||
}
|
||||
|
||||
void onSourceError(Source& source, std::exception_ptr error) override {
|
||||
if (sourceError) sourceError(source, error);
|
||||
}
|
||||
@@ -52,6 +56,7 @@ public:
|
||||
std::function<void ()> spriteLoaded;
|
||||
std::function<void (std::exception_ptr)> spriteError;
|
||||
std::function<void (Source&)> sourceLoaded;
|
||||
std::function<void (Source&, std::string)> sourceAttributionChanged;
|
||||
std::function<void (Source&, std::exception_ptr)> sourceError;
|
||||
std::function<void (Source&, const OverscaledTileID&)> tileChanged;
|
||||
std::function<void (Source&, const OverscaledTileID&, std::exception_ptr)> tileError;
|
||||
|
||||
Reference in New Issue
Block a user