| |
- __builtin__.object
-
- ImageManager
-
- PILImageManager
- PygameImageManager
- OSMManager
class ImageManager(__builtin__.object) |
|
Simple abstract interface for creating and manipulating images, to be used
by an OSMManager object. |
|
Methods defined here:
- __init__(self)
- create_image(self, width, height)
- To be overridden.
Create and return image with specified dimensions
- destroy_image(self)
- Destroys internal representation of the image, if it was
ever created.
- getImage(self)
- Returns some representation of the internal image. The returned value
is not for use by the OSMManager.
- load_image_file(self, imagef)
- To be overridden.
Loads specified image file into image object and returns it.
- paste_image(self, img, xy)
- To be overridden.
Given an already-loaded file, paste it into the internal image
at the specified top-left coordinate.
- paste_image_file(self, imagef, xy)
- Given the filename of an image, and the x,y coordinates of the
location at which to place the top left corner of the contents
of that image, pastes the image into this object's internal image.
- prepare_image(self, width, height)
- Create and internally store an image whose dimensions
are those specified by width and height.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class OSMManager(__builtin__.object) |
|
An OSMManager manages the retrieval and storage of Open Street Map
images. The basic utility is the createOSMImage() method which
automatically gets all the images needed, and tiles them together
into one big image. |
|
Methods defined here:
- __init__(self, **kwargs)
- Creates an OSMManager.
Arguments:
cache - path (relative or absolute) to directory where tiles downloaded
from OSM server should be saved. Default "/tmp".
server - URL of OSM server from which to retrieve OSM tiles. This
should be fully qualified, including the protocol.
Default "http://tile.openstreetmap.org"
image_manager - ImageManager instance which will be used to do all
image manipulation. You must provide this.
- createOSMImage(self, (minlat, maxlat, minlon, maxlon), zoom)
- Given bounding latlons (in degrees), and an OSM zoom level,
creates an image constructed from OSM tiles.
Returns (img,bounds) where img is the constructed image (as returned
by the image manager's "getImage()" method),
and bounds is the (latmin,latmax,lonmin,lonmax) bounding box
which the tiles cover.
- getLocalTileFilename(self, tile_coord, zoom)
- Given x,y coord of the tile, and the zoom level,
returns the filename to which the file would be saved
if it was downloaded. That way we don't have to kill
the osm server every time the thing runs.
- getTileCoord(self, lon_deg, lat_deg, zoom)
- Given lon,lat coords in DEGREES, and a zoom level,
returns the (x,y) coordinate of the corresponding tile #.
(http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Python)
- getTileURL(self, tile_coord, zoom)
- Given x,y coord of the tile to download, and the zoom level,
returns the URL from which to download the image.
- retrieveTileImage(self, tile_coord, zoom)
- Given x,y coord of the tile, and the zoom level,
retrieves the file to disk if necessary and
returns the local filename.
- tileNWLatlon(self, tile_coord, zoom)
- Given x,y coord of the tile, and the zoom level,
returns the (lat,lon) coordinates of the upper
left corner of the tile.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class PILImageManager(ImageManager) |
|
An ImageManager which works with PIL images. |
|
- Method resolution order:
- PILImageManager
- ImageManager
- __builtin__.object
Methods defined here:
- __init__(self, mode)
- Constructs a PIL Image Manager.
Arguments:
mode - the PIL mode in which to create the image.
- create_image(self, width, height)
- load_image_file(self, imagef)
- paste_image(self, img, xy)
Methods inherited from ImageManager:
- destroy_image(self)
- Destroys internal representation of the image, if it was
ever created.
- getImage(self)
- Returns some representation of the internal image. The returned value
is not for use by the OSMManager.
- paste_image_file(self, imagef, xy)
- Given the filename of an image, and the x,y coordinates of the
location at which to place the top left corner of the contents
of that image, pastes the image into this object's internal image.
- prepare_image(self, width, height)
- Create and internally store an image whose dimensions
are those specified by width and height.
Data descriptors inherited from ImageManager:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class PygameImageManager(ImageManager) |
|
An ImageManager which works with Pygame images. |
|
- Method resolution order:
- PygameImageManager
- ImageManager
- __builtin__.object
Methods defined here:
- __init__(self)
- create_image(self, width, height)
- load_image_file(self, imagef)
- paste_image(self, img, xy)
Methods inherited from ImageManager:
- destroy_image(self)
- Destroys internal representation of the image, if it was
ever created.
- getImage(self)
- Returns some representation of the internal image. The returned value
is not for use by the OSMManager.
- paste_image_file(self, imagef, xy)
- Given the filename of an image, and the x,y coordinates of the
location at which to place the top left corner of the contents
of that image, pastes the image into this object's internal image.
- prepare_image(self, width, height)
- Create and internally store an image whose dimensions
are those specified by width and height.
Data descriptors inherited from ImageManager:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |