#include #include #include #include #include #include #include #include #include #include #include #include namespace mbgl { namespace style { CustomGeometrySource::CustomGeometrySource(std::string id, const CustomGeometrySource::Options& options) : Source(makeMutable(std::move(id), options)), loader(std::make_unique>( Scheduler::GetBackground(), options.fetchTileFunction, options.cancelTileFunction)) {} CustomGeometrySource::~CustomGeometrySource() = default; const CustomGeometrySource::Impl& CustomGeometrySource::impl() const { return static_cast(*baseImpl); } void CustomGeometrySource::loadDescription(FileSource&) { baseImpl = makeMutable(impl(), loader->self()); loaded = true; observer->onSourceLoaded(*this); } bool CustomGeometrySource::supportsLayerType(const mbgl::style::LayerTypeInfo* info) const { return mbgl::underlying_type(Tile::Kind::Geometry) == mbgl::underlying_type(info->tileKind); } void CustomGeometrySource::setTileData(const CanonicalTileID& tileID, const GeoJSON& data) { loader->self().invoke(&CustomTileLoader::setTileData, tileID, data); } void CustomGeometrySource::invalidateTile(const CanonicalTileID& tileID) { loader->self().invoke(&CustomTileLoader::invalidateTile, tileID); } void CustomGeometrySource::invalidateRegion(const LatLngBounds& bounds) { loader->self().invoke(&CustomTileLoader::invalidateRegion, bounds, impl().getZoomRange()); } Mutable CustomGeometrySource::createMutable() const noexcept { return staticMutableCast(makeMutable(impl())); } } // namespace style } // namespace mbgl