Class Map
- java.lang.Object
-
- Map
-
public class Map extends java.lang.ObjectA 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()); } }- Version:
- 1.0
- Author:
- amjad
-
-
Constructor Summary
Constructors Constructor 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".
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description greenfoot.GreenfootImagegetImage()Returns the map represented as GreenfootImage.voidsetType(java.lang.String type)Sets the type of the map as one of: "roadmap" (the default), "satellite", "hybrid" or "terrain".voidsetZoom(int value)Sets the zoom factor insuring it is in the range [0-20].voidzoomIn(int value)Increases the zoom factor.voidzoomOut(int value)Decreases the zoom factor.
-
-
-
Constructor Detail
-
Map
public 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". The width and height fields will be set to default values as 600 x 400. The zoom field will be set to default as 5.- Parameters:
location- the location represents the center the map.
-
Map
public 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".- Parameters:
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
-
setZoom
public void setZoom(int value)
Sets the zoom factor insuring it is in the range [0-20].- Parameters:
value- the zoom factor.
-
getImage
public greenfoot.GreenfootImage getImage()
Returns the map represented as GreenfootImage.- Returns:
- GreenfootImage of the map.
-
setType
public void setType(java.lang.String type)
Sets the type of the map as one of: "roadmap" (the default), "satellite", "hybrid" or "terrain".- Parameters:
type- the type of the map.
-
zoomIn
public void zoomIn(int value)
Increases the zoom factor.- Parameters:
value- the change of the zoom factor.
-
zoomOut
public void zoomOut(int value)
Decreases the zoom factor.- Parameters:
value- the change of the zoom factor.
-
-