refs #101: first cut of basic hacky data sources
This commit is contained in:
@@ -11,11 +11,11 @@
|
||||
|
||||
using namespace llmr;
|
||||
|
||||
TileData::TileData(Tile::ID id, const Style& style, GlyphAtlas& glyphAtlas, const bool use_raster, const bool use_retina)
|
||||
TileData::TileData(Tile::ID id, const Style& style, GlyphAtlas& glyphAtlas, const std::string url, const bool is_raster)
|
||||
: id(id),
|
||||
use_raster(use_raster),
|
||||
use_retina(use_retina),
|
||||
url(url),
|
||||
state(State::initial),
|
||||
is_raster(is_raster),
|
||||
raster(),
|
||||
style(style),
|
||||
glyphAtlas(glyphAtlas) {
|
||||
@@ -38,14 +38,6 @@ const std::string TileData::toString() const {
|
||||
void TileData::request() {
|
||||
state = State::loading;
|
||||
|
||||
std::string url;
|
||||
|
||||
if (use_raster) {
|
||||
url = util::sprintf(kTileRasterURL, id.z, id.x, id.y, (use_retina ? "@2x" : ""));
|
||||
} else {
|
||||
url = util::sprintf(kTileVectorURL, id.z, id.x, id.y);
|
||||
}
|
||||
|
||||
// Note: Somehow this feels slower than the change to request_http()
|
||||
std::weak_ptr<TileData> weak_tile = shared_from_this();
|
||||
platform::Request *request = platform::request_http(url, [=](platform::Response& res) {
|
||||
@@ -78,7 +70,8 @@ bool TileData::parse() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (use_raster) {
|
||||
if (is_raster) {
|
||||
// raster tiles don't need parsed, just decoded
|
||||
raster = std::make_shared<Raster>();
|
||||
raster->load(data);
|
||||
state = State::parsed;
|
||||
|
||||
Reference in New Issue
Block a user