public class Map
extends java.lang.Object
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 and Description |
|---|
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".
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
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].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.