Skip to content

Commit

Permalink
Issue 367: RMaps uses the same SQLite file for all map servers
Browse files Browse the repository at this point in the history
  • Loading branch information
heldersepu committed Nov 3, 2013
1 parent 12cecb1 commit 664d912
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion gmapcatcher/tilesRepo/tilesRepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ def remove_old_tile(self, coord, layer, filename=None, interval=86400):
def is_tile_in_local_repos(self, coord, layer):
raise NotImplementedException()

def set_repository_path(self, newpath):
def set_repository_path(self, conf):
raise NotImplementedException()
4 changes: 2 additions & 2 deletions gmapcatcher/tilesRepo/tilesRepoFS.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def finish(self):
TilesRepository.finish(self)

## Sets new repository path to be used for storing tiles
def set_repository_path(self, newpath):
self.configpath = newpath
def set_repository_path(self, conf):
self.configpath = conf.init_path

## check if we have locally downloaded tile
def is_tile_in_local_repos(self, coord, layer):
Expand Down
8 changes: 4 additions & 4 deletions gmapcatcher/tilesRepo/tilesRepoMGMaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TilesRepositoryMGMaps(TilesRepository):

def __init__(self, MapServ_inst, conf):
TilesRepository.__init__(self, MapServ_inst, conf)
self.set_repository_path(conf.init_path)
self.set_repository_path(conf)
self.tile_cache = lrucache.LRUCache(1000)
self.mapServ_inst = MapServ_inst
self.lock = Lock()
Expand All @@ -34,9 +34,9 @@ def finish(self):
TilesRepository.finish(self)

## Sets new repository path to be used for storing tiles
def set_repository_path(self, newpath):
self.configpath = newpath
self.create_conf_file(newpath)
def set_repository_path(self, conf):
self.configpath = conf.init_path
self.create_conf_file(conf.init_path)

## check if we have locally downloaded tile
def is_tile_in_local_repos(self, coord, layer):
Expand Down
4 changes: 2 additions & 2 deletions gmapcatcher/tilesRepo/tilesRepoOSM.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def finish(self):
TilesRepository.finish(self)

## Sets new repository path to be used for storing tiles
def set_repository_path(self, newpath):
self.configpath = newpath
def set_repository_path(self, conf):
self.configpath = conf.init_path

## check if we have locally downloaded tile
def is_tile_in_local_repos(self, coord, layer):
Expand Down
5 changes: 3 additions & 2 deletions gmapcatcher/tilesRepo/tilesRepoRMaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def __init__(self, MapServ_inst, conf):
self.tile_cache = lrucache.LRUCache(1000)
self.mapServ_inst = MapServ_inst
self.conf = conf
self.configpath = conf.init_path
self.configpath = os.path.join(conf.init_path, conf.map_service)
self.lock = Lock()
self.missingPixbuf = mapPixbuf.missing()
self.sqlite3func = RMapsFuncs(self.configpath, RMAPS_REPOSITORY_FILE_FORMAT)
Expand All @@ -321,7 +321,8 @@ def finish(self):
TilesRepository.finish(self)

## Sets new repository path to be used for storing tiles
def set_repository_path(self, newpath):
def set_repository_path(self, conf):
newpath = os.path.join(conf.init_path, conf.map_service)
self.sqlite3func.restart_thread(newpath, RMAPS_REPOSITORY_FILE_FORMAT)

## Returns the PixBuf of the tile
Expand Down
4 changes: 2 additions & 2 deletions gmapcatcher/tilesRepo/tilesRepoSQLite3.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ def finish(self):
TilesRepository.finish(self)

## Sets new repository path to be used for storing tiles
def set_repository_path(self, newpath):
self.sqlite3func.restart_thread(newpath, self.get_db_filename())
def set_repository_path(self, conf):
self.sqlite3func.restart_thread(conf.init_path, self.get_db_filename())

## Returns the PixBuf of the tile
# Uses a cache to optimise HDD read access
Expand Down
2 changes: 1 addition & 1 deletion maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def layer_changed(self, w):
cmb_model = self.cmb_layer.get_model()
self.conf.map_service = MAP_SERVERS[cmb_model[index][1]]
self.layer = cmb_model[index][2]
self.ctx_map.tile_repository.set_repository_path(self.conf.init_path)
self.ctx_map.tile_repository.set_repository_path(self.conf)
if self.visual_dlconfig.get('active', False) and not self.check_bulk_down():
self.visual_dlconfig['active'] = False
if self.gps and not self.gps_warning():
Expand Down

0 comments on commit 664d912

Please sign in to comment.