Пример #1
0
    def draw_map_extentified (self) :

        if self.ctx.has_key('adjust') :
            self.ctx['bbox'] = self.__adjust_bbox(self.ctx['bbox'], self.ctx['adjust'])
            
        #

        provider = self.load_provider(self.ctx['provider'])

        sw = ModestMaps.Geo.Location(self.ctx['bbox'][0], self.ctx['bbox'][1])
        ne = ModestMaps.Geo.Location(self.ctx['bbox'][2], self.ctx['bbox'][3])
        dims = ModestMaps.Core.Point(self.ctx['width'], self.ctx['height']);
        
        self.ctx['map'] = ModestMaps.mapByExtent(provider, sw, ne, dims)

        coord, offset = ModestMaps.calculateMapExtent(provider,
                                                      self.ctx['width'], self.ctx['height'],
                                                      ModestMaps.Geo.Location(self.ctx['bbox'][0], self.ctx['bbox'][1]),
                                                      ModestMaps.Geo.Location(self.ctx['bbox'][2], self.ctx['bbox'][3]))
        
        self.ctx['zoom'] = coord.zoom

        return self.ctx['map'].draw()
Пример #2
0
    def draw_map_extentified(self):

        if self.ctx.has_key('adjust'):
            self.ctx['bbox'] = self.__adjust_bbox(self.ctx['bbox'],
                                                  self.ctx['adjust'])

        #

        provider = self.load_provider(self.ctx['provider'])

        sw = ModestMaps.Geo.Location(self.ctx['bbox'][0], self.ctx['bbox'][1])
        ne = ModestMaps.Geo.Location(self.ctx['bbox'][2], self.ctx['bbox'][3])
        dims = ModestMaps.Core.Point(self.ctx['width'], self.ctx['height'])

        self.ctx['map'] = ModestMaps.mapByExtent(provider, sw, ne, dims)

        coord, offset = ModestMaps.calculateMapExtent(
            provider, self.ctx['width'], self.ctx['height'],
            ModestMaps.Geo.Location(self.ctx['bbox'][0], self.ctx['bbox'][1]),
            ModestMaps.Geo.Location(self.ctx['bbox'][2], self.ctx['bbox'][3]))

        self.ctx['zoom'] = coord.zoom

        return self.ctx['map'].draw()