java.lang.ObjectMap
public class Map
A helper class that fetches a Google map for a specific location as an Image. Example of use:
public class MapActor extends Actor
{
Map map;
public MapActor()
{
map = new Map("Brazil");
setImage(map.getImage());
}
public void act()
{
map.zoomIn(1);
setImage(map.getImage());
}
public void setType(String type)
{
map.setType(type);
setImage(map.getImage());
}
}
| Constructor Summary | |
|---|---|
Map(java.lang.String location)
Constructs a map object that build a map of a specific location, e.g."-15.800513, -47.91378" or "Brooklyn Bridge, New York, NY". |
|
Map(java.lang.String location,
int width,
int height,
int zoom)
Constructs a map object that build a map of a specific location, e.g."-15.800513, -47.91378" or "Brooklyn Bridge, New York, NY". |
|
| Method Summary | |
|---|---|
greenfoot.GreenfootImage |
getImage()
Returns the map represented as GreenfootImage. |
void |
setType(java.lang.String type)
Sets the type of the map as one of: "roadmap" (the default), "satellite", "hybrid" or "terrain". |
void |
setZoom(int value)
Sets the zoom factor insuring it is in the range [0-20]. |
void |
zoomIn(int value)
Increases the zoom factor. |
void |
zoomOut(int value)
Decreases the zoom factor. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Map(java.lang.String location)
location - the location represents the center the map.
public Map(java.lang.String location,
int width,
int height,
int zoom)
location - the location represents the center the map.width - the image's width.height - the image's height.zoom - the zoom factor of the map [0-20].| Method Detail |
|---|
public void setZoom(int value)
value - the zoom factor.public greenfoot.GreenfootImage getImage()
public void setType(java.lang.String type)
type - the type of the map.
if - the passed parameter is not one of the predefined types.public void zoomIn(int value)
value - the change of the zoom factor.public void zoomOut(int value)
value - the change of the zoom factor.