[core] Introduce shared base class for VectorSource and RasterSource
This commit is contained in:
@@ -8,7 +8,7 @@ RasterSource::RasterSource(std::string id_,
|
||||
std::string url_,
|
||||
uint16_t tileSize_,
|
||||
std::unique_ptr<Tileset>&& tileset_)
|
||||
: Source(SourceType::Raster, std::move(id_), std::move(url_), tileSize_, std::move(tileset_)) {
|
||||
: TileSource(SourceType::Raster, std::move(id_), std::move(url_), tileSize_, std::move(tileset_)) {
|
||||
}
|
||||
|
||||
std::unique_ptr<Tile> RasterSource::createTile(const OverscaledTileID& tileID,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/style/source.hpp>
|
||||
#include <mbgl/style/tile_source.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class RasterSource : public Source {
|
||||
class RasterSource : public TileSource {
|
||||
public:
|
||||
RasterSource(std::string id,
|
||||
std::string url,
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace style {
|
||||
VectorSource::VectorSource(std::string id_,
|
||||
std::string url_,
|
||||
std::unique_ptr<Tileset>&& tileset_)
|
||||
: Source(SourceType::Vector, std::move(id_), std::move(url_), util::tileSize, std::move(tileset_)) {
|
||||
: TileSource(SourceType::Vector, std::move(id_), std::move(url_), util::tileSize, std::move(tileset_)) {
|
||||
}
|
||||
|
||||
std::unique_ptr<Tile> VectorSource::createTile(const OverscaledTileID& tileID,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/style/source.hpp>
|
||||
#include <mbgl/style/tile_source.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class VectorSource : public Source {
|
||||
class VectorSource : public TileSource {
|
||||
public:
|
||||
VectorSource(std::string id,
|
||||
std::string url,
|
||||
|
||||
15
src/mbgl/style/tile_source.cpp
Normal file
15
src/mbgl/style/tile_source.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <mbgl/style/tile_source.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
TileSource::TileSource(SourceType type_,
|
||||
std::string id_,
|
||||
std::string url_,
|
||||
uint16_t tileSize_,
|
||||
std::unique_ptr<Tileset>&& tileset_)
|
||||
: Source(type_, std::move(id_), std::move(url_), tileSize_, std::move(tileset_)) {
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
22
src/mbgl/style/tile_source.hpp
Normal file
22
src/mbgl/style/tile_source.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/style/source.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
/*
|
||||
Shared implementation for VectorSource and RasterSource. Should eventually
|
||||
be refactored to use composition rather than inheritance.
|
||||
*/
|
||||
class TileSource : public Source {
|
||||
public:
|
||||
TileSource(SourceType,
|
||||
std::string id,
|
||||
std::string url,
|
||||
uint16_t tileSize,
|
||||
std::unique_ptr<Tileset>&&);
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
Reference in New Issue
Block a user