예제 #1
0
    def bulk_download(self,
                      coord,
                      zoomlevels,
                      kmx,
                      kmy,
                      layer,
                      tile_callback,
                      completion_callback,
                      force_update=False,
                      conf=None,
                      nodups=True):
        dlon = mapUtils.km_to_lon(mapUtils.nice_round(kmx), coord[0])
        dlat = mapUtils.km_to_lat(mapUtils.nice_round(kmy))
        if zoomlevels[0] > zoomlevels[1]:
            zoomlevels = (zoomlevels[1], zoomlevels[0])

        def downThread():
            self.bulk_all_placed = False
            for zoom in xrange(zoomlevels[1], zoomlevels[0] - 1, -1):
                self.query_region_around_location(coord[0], coord[1], dlat,
                                                  dlon, zoom, layer,
                                                  tile_callback, True,
                                                  force_update, conf)
            if self.qsize() == 0:
                completion_callback()
            self.bulk_all_placed = True

        dThread = Timer(0, downThread)
        dThread.start()
예제 #2
0
    def get_tiles_range_for_zoom(self, zoom):
        # get tiles - copied from mapDownloader
        dlon = mapUtils.km_to_lon(mapUtils.nice_round(self.reg_width),
                                  self.center_lat)
        dlat = mapUtils.km_to_lat(mapUtils.nice_round(self.reg_height))

        if dlat > 170:
            dlat = 170
        if dlon > 358:
            dlon = 358

        top_left = mapUtils.coord_to_tile(
            (self.center_lat + dlat / 2, self.center_lon - dlon / 2, zoom))
        bottom_right = mapUtils.coord_to_tile(
            (self.center_lat - dlat / 2, self.center_lon + dlon / 2, zoom))

        # top_left[0][0], bottom_right[0][0], top_left[0][1], bottom_right[0][1]
        # xmin, xmax, ymin, ymax

        world_tiles = mapUtils.tiles_on_level(zoom)
        if bottom_right[0][0] - top_left[0][0] >= world_tiles:
            top_left[0][0], bottom_right[0][0] = 0, world_tiles - 1
        if bottom_right[0][1] - top_left[0][1] >= world_tiles:
            top_left[0][1], bottom_right[0][1] = 0, world_tiles - 1

        # xmin, xmax, ymin, ymax
        return (top_left[0][0], bottom_right[0][0], top_left[0][1],
                bottom_right[0][1])
예제 #3
0
    def get_tiles_range_for_zoom(self, zoom):
        # get tiles - copied from mapDownloader
        dlon = mapUtils.km_to_lon(mapUtils.nice_round(self.reg_width), self.center_lat)
        dlat = mapUtils.km_to_lat(mapUtils.nice_round(self.reg_height))

        if dlat > 170:
            dlat = 170
        if dlon > 358:
            dlon = 358

        top_left = mapUtils.coord_to_tile(
            (self.center_lat + dlat / 2, self.center_lon - dlon / 2, zoom)
        )
        bottom_right = mapUtils.coord_to_tile(
            (self.center_lat - dlat / 2, self.center_lon + dlon / 2, zoom)
        )

        # top_left[0][0], bottom_right[0][0], top_left[0][1], bottom_right[0][1]
        # xmin, xmax, ymin, ymax

        world_tiles = mapUtils.tiles_on_level(zoom)
        if bottom_right[0][0] - top_left[0][0] >= world_tiles:
            top_left[0][0], bottom_right[0][0] = 0, world_tiles - 1
        if bottom_right[0][1] - top_left[0][1] >= world_tiles:
            top_left[0][1], bottom_right[0][1] = 0, world_tiles - 1

        # xmin, xmax, ymin, ymax
        return(top_left[0][0], bottom_right[0][0], top_left[0][1], bottom_right[0][1])
예제 #4
0
    def bulk_download(
        self, coord, zoomlevels, kmx, kmy, layer, tile_callback, completion_callback, force_update=False, conf=None
    ):
        dlon = mapUtils.km_to_lon(mapUtils.nice_round(kmx), coord[0])
        dlat = mapUtils.km_to_lat(mapUtils.nice_round(kmy))
        if zoomlevels[0] > zoomlevels[1]:
            zoomlevels = (zoomlevels[1], zoomlevels[0])

        def downThread():
            self.bulk_all_placed = False
            for zoom in xrange(zoomlevels[1], zoomlevels[0] - 1, -1):
                self.query_region_around_location(
                    coord[0], coord[1], dlat, dlon, zoom, layer, tile_callback, True, force_update, conf
                )
            if self.qsize() == 0:
                completion_callback()
            self.bulk_all_placed = True

        dThread = Timer(0, downThread)
        dThread.start()
예제 #5
0
파일: EXWindow.py 프로젝트: pacoqueen/cican
    def __init__(self, mapServ, coord, kmx, kmy, layer, conf):

        def _zoom(zoom0, zoom1):
            out_hbox = gtk.HBox(False, 50)
            out_hbox.set_border_width(10)
            in_hbox = gtk.HBox(False, 20)
            in_hbox.pack_start(lbl("min:"), False)
            self.s_zoom0 = SpinBtn(zoom0)
            self.s_zoom0.set_digits(0)
            in_hbox.pack_start(self.s_zoom0)
            out_hbox.pack_start(in_hbox)

            in_hbox = gtk.HBox(False, 20)
            in_hbox.pack_start(lbl("max:"), False)
            self.s_zoom1 = SpinBtn(zoom1)
            self.s_zoom1.set_digits(0)
            in_hbox.pack_start(self.s_zoom1)
            out_hbox.pack_start(in_hbox)
            hbox = gtk.HBox()
            hbox.set_border_width(10)
            hbox.pack_start(myFrame(" Zoom ", out_hbox, 0))
            return hbox

        def _custom_path():
            def repository_type_combo(repos_type_id):
                self.cmb_repos_type = gtk.combo_box_new_text()
                for strMode in REPOS_TYPE:
                    self.cmb_repos_type.append_text(strMode)
                self.cmb_repos_type.set_active(repos_type_id)
                return self.cmb_repos_type

            def get_folder(button):
                #if os.path.isdir(self.entry_custom_path.get_text()):
                #    dir = self.entry_custom_path
                #else:
                #    dir = None
                folderName = FolderChooser()
                if folderName:
                    self.entry_custom_path.set_text(folderName)

            vbox = gtk.VBox(False, 5)
            vbox.set_border_width(5)
            hbox = gtk.HBox(False, 10)
            self.entry_custom_path = gtk.Entry()
            self.entry_custom_path.set_text( EXWindow.configpath )
            repository_type_combo( EXWindow.repostype_id )
            hbox.pack_start(self.cmb_repos_type, False)
            hbox.pack_start(self.entry_custom_path)
            button = gtk.Button(" ... ")
            button.connect('clicked', get_folder)
            hbox.pack_start(button, False)
            vbox.pack_start(hbox)
            
            hbox = gtk.HBox(False, 10)
            self.cb_overwrite_destination = gtk.CheckButton("Overwrite existing tiles in destination repository")
            hbox.pack_start( self.cb_overwrite_destination )
            vbox.pack_start(hbox)
            
            return myFrame(" Destination repository for export ", vbox)

        def _center(lat0, lon0):
            vbox = gtk.VBox(False, 5)
            hbox = gtk.HBox(False, 10)
            hbox.pack_start(lbl("latitude:"))
            self.e_lat0 = myEntry("%.6f" % lat0, 15, False)
            hbox.pack_start(self.e_lat0, False)
            vbox.pack_start(hbox)

            hbox = gtk.HBox(False, 10)
            hbox.pack_start(lbl("longitude:"))
            self.e_lon0 = myEntry("%.6f" % lon0, 15, False)
            hbox.pack_start(self.e_lon0, False)
            vbox.pack_start(hbox)
            return myFrame(" Center ", vbox)

        def _area(kmx, kmy):
            vbox = gtk.VBox(False, 5)
            hbox = gtk.HBox(False, 10)
            hbox.pack_start(lbl("width:"))
            self.e_kmx = myEntry("%.6g" % kmx, 10, False)
            hbox.pack_start(self.e_kmx, False)
            vbox.pack_start(hbox)

            hbox = gtk.HBox(False, 10)
            hbox.pack_start(lbl("height:"))
            self.e_kmy = myEntry("%.6g" % kmy, 10, False)
            hbox.pack_start(self.e_kmy, False)
            vbox.pack_start(hbox)
            return myFrame(" Area (km) ", vbox)

        def _buttons():
            hbbox = gtk.HButtonBox()
            hbbox.set_border_width(10)
            hbbox.set_layout(gtk.BUTTONBOX_SPREAD)

            self.b_export = gtk.Button("Export")
            self.b_export.connect('clicked', self.on_b_export_clicked, self)
            hbbox.pack_start(self.b_export)

            self.b_stop = gtk.Button(stock='gtk-media-stop')
            self.b_stop.connect('clicked', self.on_b_stop_clicked)
            self.b_stop.set_sensitive(False)

            hbbox.pack_start(self.b_stop)
            return hbbox

        self.mapServ = mapServ
        
        fldDown = join(conf.init_path, 'download')
        log.info( "EXWindow( %s, %s, %s, %s )" % ( str(coord), str(kmx), str(kmy), str(layer) ) )
        
        self.conf = conf
        kmx = mapUtils.nice_round(kmx)
        kmy = mapUtils.nice_round(kmy)
        self.layer = layer
        gtk.Window.__init__(self)
        lat0 = coord[0]
        lon0 = coord[1]
        zoom0 = max(MAP_MIN_ZOOM_LEVEL, coord[2]-3)
        zoom1 = min(MAP_MAX_ZOOM_LEVEL, coord[2]+1)

        vbox = gtk.VBox(False)
        hbox = gtk.HBox(False, 10)
        hbox.pack_start(_center(lat0, lon0))
        hbox.pack_start(_area(kmx, kmy))
        vbox.pack_start(hbox)
        vbox.pack_start(_zoom(zoom0, zoom1))
        vbox.pack_start(_custom_path())
        vbox.pack_start(_buttons())

        self.pbar = gtk.ProgressBar()
        self.pbar.set_text("...")
        vbox.pack_start(self.pbar)
        self.add(vbox)

        self.set_title("GMapCatcher export")
        self.set_border_width(10)
        ico = mapPixbuf.ico()
        if ico:
            self.set_icon(ico)

        self.complete=[]
        self.processing=False
        self.gmap=None
        self.downloader=None
        self.connect('delete-event', self.on_delete)
        self.connect('key-press-event', self.key_press)
        self.show_all()
        
        self.transfer_thread = None
예제 #6
0
    def __init__(self, mapServ, coord, kmx, kmy, layer, conf):
        def _zoom(zoom0, zoom1):
            out_hbox = gtk.HBox(False, 50)
            out_hbox.set_border_width(10)
            in_hbox = gtk.HBox(False, 20)
            in_hbox.pack_start(lbl("min:"), False)
            self.s_zoom0 = SpinBtn(zoom0)
            self.s_zoom0.set_digits(0)
            in_hbox.pack_start(self.s_zoom0)
            out_hbox.pack_start(in_hbox)

            in_hbox = gtk.HBox(False, 20)
            in_hbox.pack_start(lbl("max:"), False)
            self.s_zoom1 = SpinBtn(zoom1)
            self.s_zoom1.set_digits(0)
            in_hbox.pack_start(self.s_zoom1)
            out_hbox.pack_start(in_hbox)
            hbox = gtk.HBox()
            hbox.set_border_width(10)
            hbox.pack_start(myFrame(" Zoom ", out_hbox, 0))
            return hbox

        def _custom_path():
            def repository_type_combo(repos_type_id):
                self.cmb_repos_type = gtk.combo_box_new_text()
                for strMode in REPOS_TYPE:
                    self.cmb_repos_type.append_text(strMode)
                self.cmb_repos_type.set_active(repos_type_id)
                return self.cmb_repos_type

            def get_folder(button):
                #if os.path.isdir(self.entry_custom_path.get_text()):
                #    dir = self.entry_custom_path
                #else:
                #    dir = None
                folderName = FolderChooser()
                if folderName:
                    self.entry_custom_path.set_text(folderName)

            vbox = gtk.VBox(False, 5)
            vbox.set_border_width(5)
            hbox = gtk.HBox(False, 10)
            self.entry_custom_path = gtk.Entry()
            self.entry_custom_path.set_text(EXWindow.configpath)
            repository_type_combo(EXWindow.repostype_id)
            hbox.pack_start(self.cmb_repos_type, False)
            hbox.pack_start(self.entry_custom_path)
            button = gtk.Button(" ... ")
            button.connect('clicked', get_folder)
            hbox.pack_start(button, False)
            vbox.pack_start(hbox)

            hbox = gtk.HBox(False, 10)
            self.cb_overwrite_destination = gtk.CheckButton(
                "Overwrite existing tiles in destination repository")
            hbox.pack_start(self.cb_overwrite_destination)
            vbox.pack_start(hbox)

            return myFrame(" Destination repository for export ", vbox)

        def _center(lat0, lon0):
            vbox = gtk.VBox(False, 5)
            hbox = gtk.HBox(False, 10)
            hbox.pack_start(lbl("latitude:"))
            self.e_lat0 = myEntry("%.6f" % lat0, 15, False)
            hbox.pack_start(self.e_lat0, False)
            vbox.pack_start(hbox)

            hbox = gtk.HBox(False, 10)
            hbox.pack_start(lbl("longitude:"))
            self.e_lon0 = myEntry("%.6f" % lon0, 15, False)
            hbox.pack_start(self.e_lon0, False)
            vbox.pack_start(hbox)
            return myFrame(" Center ", vbox)

        def _area(kmx, kmy):
            vbox = gtk.VBox(False, 5)
            hbox = gtk.HBox(False, 10)
            hbox.pack_start(lbl("width:"))
            self.e_kmx = myEntry("%.6g" % kmx, 10, False)
            hbox.pack_start(self.e_kmx, False)
            vbox.pack_start(hbox)

            hbox = gtk.HBox(False, 10)
            hbox.pack_start(lbl("height:"))
            self.e_kmy = myEntry("%.6g" % kmy, 10, False)
            hbox.pack_start(self.e_kmy, False)
            vbox.pack_start(hbox)
            return myFrame(" Area (km) ", vbox)

        def _buttons():
            hbbox = gtk.HButtonBox()
            hbbox.set_border_width(10)
            hbbox.set_layout(gtk.BUTTONBOX_SPREAD)

            self.b_export = gtk.Button("Export")
            self.b_export.connect('clicked', self.on_b_export_clicked, self)
            hbbox.pack_start(self.b_export)

            self.b_stop = gtk.Button(stock='gtk-media-stop')
            self.b_stop.connect('clicked', self.on_b_stop_clicked)
            self.b_stop.set_sensitive(False)

            hbbox.pack_start(self.b_stop)
            return hbbox

        self.mapServ = mapServ

        fldDown = join(conf.init_path, 'download')
        log.info("EXWindow( %s, %s, %s, %s )" %
                 (str(coord), str(kmx), str(kmy), str(layer)))

        self.conf = conf
        kmx = mapUtils.nice_round(kmx)
        kmy = mapUtils.nice_round(kmy)
        self.layer = layer
        gtk.Window.__init__(self)
        lat0 = coord[0]
        lon0 = coord[1]
        zoom0 = max(MAP_MIN_ZOOM_LEVEL, coord[2] - 3)
        zoom1 = min(MAP_MAX_ZOOM_LEVEL, coord[2] + 1)

        vbox = gtk.VBox(False)
        hbox = gtk.HBox(False, 10)
        hbox.pack_start(_center(lat0, lon0))
        hbox.pack_start(_area(kmx, kmy))
        vbox.pack_start(hbox)
        vbox.pack_start(_zoom(zoom0, zoom1))
        vbox.pack_start(_custom_path())
        vbox.pack_start(_buttons())

        self.pbar = gtk.ProgressBar()
        self.pbar.set_text("...")
        vbox.pack_start(self.pbar)
        self.add(vbox)

        self.set_title("GMapCatcher export")
        self.set_border_width(10)
        ico = mapPixbuf.ico()
        if ico:
            self.set_icon(ico)

        self.complete = []
        self.processing = False
        self.gmap = None
        self.downloader = None
        self.connect('delete-event', self.on_delete)
        self.connect('key-press-event', self.key_press)
        self.show_all()

        self.transfer_thread = None
예제 #7
0
    def __init__(self, coord, kmx, kmy, layer, conf):
        def _zoom(zoom0, zoom1):
            out_hbox = gtk.HBox(False, 50)
            out_hbox.set_border_width(10)
            in_hbox = gtk.HBox(False, 20)
            in_hbox.pack_start(lbl("min:"), False)
            self.s_zoom0 = SpinBtn(zoom0)
            self.s_zoom0.set_digits(0)
            in_hbox.pack_start(self.s_zoom0)
            out_hbox.pack_start(in_hbox)

            in_hbox = gtk.HBox(False, 20)
            in_hbox.pack_start(lbl("max:"), False)
            self.s_zoom1 = SpinBtn(zoom1)
            self.s_zoom1.set_digits(0)
            in_hbox.pack_start(self.s_zoom1)
            out_hbox.pack_start(in_hbox)
            hbox = gtk.HBox()
            hbox.set_border_width(10)
            hbox.pack_start(myFrame(" Zoom ", out_hbox, 0))
            return hbox

        def _center(lat0, lon0):
            vbox = gtk.VBox(False, 5)
            hbox = gtk.HBox(False, 10)
            hbox.pack_start(lbl("latitude:"))
            self.e_lat0 = myEntry("%.6f" % lat0, 15, False)
            hbox.pack_start(self.e_lat0, False)
            vbox.pack_start(hbox)

            hbox = gtk.HBox(False, 10)
            hbox.pack_start(lbl("longitude:"))
            self.e_lon0 = myEntry("%.6f" % lon0, 15, False)
            hbox.pack_start(self.e_lon0, False)
            vbox.pack_start(hbox)
            return myFrame(" Center ", vbox)

        def _area(kmx, kmy):
            vbox = gtk.VBox(False, 5)
            hbox = gtk.HBox(False, 10)
            hbox.pack_start(lbl("width:"))
            self.e_kmx = myEntry("%.6g" % kmx, 10, False)
            hbox.pack_start(self.e_kmx, False)
            vbox.pack_start(hbox)

            hbox = gtk.HBox(False, 10)
            hbox.pack_start(lbl("height:"))
            self.e_kmy = myEntry("%.6g" % kmy, 10, False)
            hbox.pack_start(self.e_kmy, False)
            vbox.pack_start(hbox)
            return myFrame(" Area (km) ", vbox)

        def _buttons(strFolder):
            hbbox = gtk.HButtonBox()
            hbbox.set_border_width(10)
            hbbox.set_layout(gtk.BUTTONBOX_SPREAD)

            gtk.stock_add([(gtk.STOCK_HARDDISK, "_Download", 0, 0, "")])
            self.b_download = gtk.Button(stock=gtk.STOCK_HARDDISK)
            self.b_download.connect('clicked', self.run, conf.init_path,
                                    conf.repository_type, strFolder)
            hbbox.pack_start(self.b_download)

            hbox = gtk.HBox()
            gtk.stock_add([(gtk.STOCK_UNDELETE, "", 0, 0, "")])
            self.b_open = gtk.Button(stock=gtk.STOCK_UNDELETE)
            self.b_open.connect('clicked', self.do_open, strFolder)
            hbox.pack_start(self.b_open, padding=25)
            if isdir(fldDown):
                hbbox.pack_start(hbox)

            self.b_pause = gtk.Button(stock='gtk-media-pause')
            self.b_pause.connect('clicked', self.do_pause)
            self.b_pause.set_sensitive(False)

            hbbox.pack_start(self.b_pause)
            return hbbox

        fldDown = join(conf.init_path, 'download')
        print "DLWindow(", coord, kmx, kmy, layer, ')'
        self.conf = conf
        kmx = mapUtils.nice_round(kmx)
        kmy = mapUtils.nice_round(kmy)
        self.layer = layer
        gtk.Window.__init__(self)
        lat0 = coord[0]
        lon0 = coord[1]
        zoom0 = max(MAP_MIN_ZOOM_LEVEL, coord[2] - 3)
        zoom1 = min(MAP_MAX_ZOOM_LEVEL, coord[2] + 1)

        vbox = gtk.VBox(False)
        hbox = gtk.HBox(False, 10)
        hbox.pack_start(_center(lat0, lon0))
        hbox.pack_start(_area(kmx, kmy))
        vbox.pack_start(hbox)
        vbox.pack_start(_zoom(zoom0, zoom1))
        vbox.pack_start(_buttons(fldDown))

        self.pbar = gtk.ProgressBar()
        self.pbar.set_text(" ")
        vbox.pack_start(self.pbar)
        self.add(vbox)

        self.set_title("GMapCatcher download")
        self.set_border_width(10)
        ico = mapPixbuf.ico()
        if ico:
            self.set_icon(ico)

        self.complete = []
        self.processing = False
        self.gmap = None
        self.downloader = None
        self.connect('delete-event', self.on_delete)
        self.connect('key-press-event', self.key_press)
        self.show_all()
예제 #8
0
파일: DLWindow.py 프로젝트: pacoqueen/cican
    def __init__(self, coord, kmx, kmy, layer, conf):
        def _zoom(zoom0, zoom1):
            out_hbox = gtk.HBox(False, 50)
            out_hbox.set_border_width(10)
            in_hbox = gtk.HBox(False, 20)
            in_hbox.pack_start(lbl("min:"), False)
            self.s_zoom0 = SpinBtn(zoom0)
            self.s_zoom0.set_digits(0)
            in_hbox.pack_start(self.s_zoom0)
            out_hbox.pack_start(in_hbox)

            in_hbox = gtk.HBox(False, 20)
            in_hbox.pack_start(lbl("max:"), False)
            self.s_zoom1 = SpinBtn(zoom1)
            self.s_zoom1.set_digits(0)
            in_hbox.pack_start(self.s_zoom1)
            out_hbox.pack_start(in_hbox)
            hbox = gtk.HBox()
            hbox.set_border_width(10)
            hbox.pack_start(myFrame(" Zoom ", out_hbox, 0))
            return hbox

        def _center(lat0, lon0):
            vbox = gtk.VBox(False, 5)
            hbox = gtk.HBox(False, 10)
            hbox.pack_start(lbl("latitude:"))
            self.e_lat0 = myEntry("%.6f" % lat0, 15, False)
            hbox.pack_start(self.e_lat0, False)
            vbox.pack_start(hbox)

            hbox = gtk.HBox(False, 10)
            hbox.pack_start(lbl("longitude:"))
            self.e_lon0 = myEntry("%.6f" % lon0, 15, False)
            hbox.pack_start(self.e_lon0, False)
            vbox.pack_start(hbox)
            return myFrame(" Center ", vbox)

        def _area(kmx, kmy):
            vbox = gtk.VBox(False, 5)
            hbox = gtk.HBox(False, 10)
            hbox.pack_start(lbl("width:"))
            self.e_kmx = myEntry("%.6g" % kmx, 10, False)
            hbox.pack_start(self.e_kmx, False)
            vbox.pack_start(hbox)

            hbox = gtk.HBox(False, 10)
            hbox.pack_start(lbl("height:"))
            self.e_kmy = myEntry("%.6g" % kmy, 10, False)
            hbox.pack_start(self.e_kmy, False)
            vbox.pack_start(hbox)
            return myFrame(" Area (km) ", vbox)

        def _buttons(strFolder):
            hbbox = gtk.HButtonBox()
            hbbox.set_border_width(10)
            hbbox.set_layout(gtk.BUTTONBOX_SPREAD)

            gtk.stock_add([(gtk.STOCK_HARDDISK, "_Download", 0, 0, "")])
            self.b_download = gtk.Button(stock=gtk.STOCK_HARDDISK)
            self.b_download.connect("clicked", self.run, conf.init_path, conf.repository_type, strFolder)
            hbbox.pack_start(self.b_download)

            hbox = gtk.HBox()
            gtk.stock_add([(gtk.STOCK_UNDELETE, "", 0, 0, "")])
            self.b_open = gtk.Button(stock=gtk.STOCK_UNDELETE)
            self.b_open.connect("clicked", self.do_open, strFolder)
            hbox.pack_start(self.b_open, padding=25)
            if isdir(fldDown):
                hbbox.pack_start(hbox)

            self.b_pause = gtk.Button(stock="gtk-media-pause")
            self.b_pause.connect("clicked", self.do_pause)
            self.b_pause.set_sensitive(False)

            hbbox.pack_start(self.b_pause)
            return hbbox

        fldDown = join(conf.init_path, "download")
        print "DLWindow(", coord, kmx, kmy, layer, ")"
        self.conf = conf
        kmx = mapUtils.nice_round(kmx)
        kmy = mapUtils.nice_round(kmy)
        self.layer = layer
        gtk.Window.__init__(self)
        lat0 = coord[0]
        lon0 = coord[1]
        zoom0 = max(MAP_MIN_ZOOM_LEVEL, coord[2] - 3)
        zoom1 = min(MAP_MAX_ZOOM_LEVEL, coord[2] + 1)

        vbox = gtk.VBox(False)
        hbox = gtk.HBox(False, 10)
        hbox.pack_start(_center(lat0, lon0))
        hbox.pack_start(_area(kmx, kmy))
        vbox.pack_start(hbox)
        vbox.pack_start(_zoom(zoom0, zoom1))
        vbox.pack_start(_buttons(fldDown))

        self.pbar = gtk.ProgressBar()
        self.pbar.set_text(" ")
        vbox.pack_start(self.pbar)
        self.add(vbox)

        self.set_title("GMapCatcher download")
        self.set_border_width(10)
        ico = mapPixbuf.ico()
        if ico:
            self.set_icon(ico)

        self.complete = []
        self.processing = False
        self.gmap = None
        self.downloader = None
        self.connect("delete-event", self.on_delete)
        self.connect("key-press-event", self.key_press)
        self.show_all()