calculate proper tile position

This commit is contained in:
Konstantin Käfer
2014-01-08 14:32:58 +01:00
parent 7253f808c6
commit 7526d681e2
8 changed files with 165 additions and 77 deletions

View File

@@ -6,17 +6,25 @@
using namespace llmr;
map::map(class platform *platform, class painter *painter)
map::map(class platform *platform)
: platform(platform),
painter(painter),
transform(new class transform()) {
transform(new class transform()),
painter(new class painter(platform, transform)) {
painter->setTransform(transform);
transform->setLonLat(13, 50);
transform->setZoom(3);
tiles.push_back(new class tile(1, 0, 0));
platform->request(tiles.back());
tile *tile = new class tile(0, 0, 0);
tiles.push_back(tile);
platform->request(tile);
tiles.push_back(new class tile(1, 1, 0));
platform->request(tiles.back());
tiles.push_back(new class tile(1, 0, 1));
platform->request(tiles.back());
tiles.push_back(new class tile(1, 1, 1));
platform->request(tiles.back());
}
@@ -24,6 +32,15 @@ map::~map() {
delete transform;
}
void map::setup() {
painter->setup();
}
void map::resize(uint32_t width, uint32_t height) {
transform->width = width;
transform->height = height;
platform->restart();
}
void map::moveBy(double dx, double dy) {
transform->moveBy(dx, dy);
@@ -61,4 +78,4 @@ void map::tileFailed(tile *tile) {
fprintf(stderr, "[%8zx] tile failed to load %d/%d/%d\n",
std::hash<std::thread::id>()(std::this_thread::get_id()),
tile->z, tile->x, tile->y);
}
}