Example #1
0
    def query_tile(self, coord, layer, callback,
                    online=True, force_update=False,
                    conf=None):
        ret = 0
        if layer == LAYER_HYB:
            ret += self.query_tile(coord, LAYER_SAT, callback,
                    online, force_update, conf)

        #print "query_tile(",coord,layer,callback,online,force_update,")"
        world_tiles = mapUtils.tiles_on_level(coord[2])
        coord = (mapUtils.mod(coord[0], world_tiles),
                 mapUtils.mod(coord[1], world_tiles), coord[2])
        # try to get a tile offline
        if self.ctx_map.is_tile_in_local_repos(coord, layer) or (not online):
            if not (force_update and online):
                callback(True, coord, layer)
                return ret

        if not (coord, layer) in self.queued:
            self.queued.append((coord, layer))
            self.taskq.put(
                DownloadTask(
                    coord, layer, callback, force_update, conf
                )
            )
        return ret + 1
Example #2
0
    def query_tile(self,
                   coord,
                   layer,
                   callback,
                   online=True,
                   force_update=False,
                   conf=None,
                   hybrid_background=LAYER_SAT):
        ret = 0
        if layer == LAYER_HYB or layer == LAYER_CHA:
            ret += self.query_tile(coord, hybrid_background, callback, online,
                                   force_update, conf)

        #print "query_tile(",coord,layer,callback,online,force_update,")"
        world_tiles = mapUtils.tiles_on_level(coord[2])
        coord = (mapUtils.mod(coord[0], world_tiles),
                 mapUtils.mod(coord[1], world_tiles), coord[2])
        # try to get a tile offline
        if self.ctx_map.is_tile_in_local_repos(coord, layer) or (not online):
            if not (force_update and online):
                callback(True, coord, layer)
                return ret

        if not (coord, layer) in self.queued:
            self.queued.append((coord, layer))
            self.taskq.put(
                DownloadTask(coord, layer, callback, force_update, conf))
        return ret + 1
Example #3
0
    def query_tile(self, coord, layer, callback,
                    online=True, force_update=False,
                    conf=None):
        ret = 0
        if layer == LAYER_HYB:
            ret += self.query_tile(coord, LAYER_SAT, callback,
                    online, force_update, conf)
        elif MAP_SERVICES[layer]['ID'] == LAYER_HYB:
            ret += self.query_tile(coord, layer - 
                    HYB_SAT_LAYER_OFFSETS[MAP_SERVICES[layer]['serviceName']],
                    callback, online, force_update, conf)
        #print "query_tile(",coord,layer,callback,online,force_update,")"
        world_tiles = mapUtils.tiles_on_level(coord[2])
        coord = (mapUtils.mod(coord[0], world_tiles),
                 mapUtils.mod(coord[1], world_tiles), coord[2])
        # try to get a tile offline
        if self.ctx_map.is_tile_in_local_repos(coord, layer) or (not online):
            if not (force_update and online):
                callback(True, coord, layer)
                return ret

        if not (coord,layer) in self.queued:
            self.queued.append((coord, layer))
            self.taskq.put(
                DownloadTask(
                    coord, layer, callback, force_update, conf
                )
            )
        return ret + 1