Skip to content
This repository has been archived by the owner on Apr 27, 2024. It is now read-only.

Commit

Permalink
TileManager:
Browse files Browse the repository at this point in the history
- set zoomMin/Max for current TileSource
- add zoom-level switch threshold
- add TileManager.getTile()
- remove releaseTiles()
- extract JobCompletedEvent from anonymous class
  • Loading branch information
hjanetzek committed Sep 19, 2014
1 parent 2c5db19 commit 0c54d5d
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 96 deletions.
13 changes: 11 additions & 2 deletions vtm/src/org/oscim/layers/tile/JobQueue.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
* Copyright 2012, 2013 Hannes Janetzek
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
Expand All @@ -20,11 +19,16 @@
import static org.oscim.layers.tile.MapTile.State.LOADING;
import static org.oscim.layers.tile.MapTile.State.NONE;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* A JobQueue keeps the list of pending jobs for a MapView and prioritizes them.
*/
public class JobQueue {

static final Logger log = LoggerFactory.getLogger(JobQueue.class);

private int mCurrentJob = 0;
private MapTile[] mJobs;

Expand All @@ -51,7 +55,12 @@ public synchronized void clear() {
MapTile[] tiles = mJobs;

for (int i = mCurrentJob, n = mJobs.length; i < n; i++) {
tiles[i].state = NONE;

if (tiles[i].state == LOADING)
tiles[i].state = NONE;
else
log.debug("wrong tile in queue {} {}", tiles[i], tiles[i].state);

tiles[i] = null;
}
mCurrentJob = 0;
Expand Down
Loading

0 comments on commit 0c54d5d

Please sign in to comment.