Filling in parameters · KR2016/google-maps-services-java@5363a32 · GitHub
Skip to content

Commit 5363a32

Browse files
committed
Filling in parameters
1 parent d75b88a commit 5363a32

5 files changed

Lines changed: 75 additions & 39 deletions

File tree

src/main/java/com/google/maps/PendingResultBase.java

Lines changed: 8 additions & 0 deletions
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
package com.google.maps;
22

3+
import com.google.maps.model.Size;
4+
35
public class StaticMapsApi {
46

57
private StaticMapsApi() {}
68

7-
public static StaticMapsRequest newRequest(GeoApiContext context) {
8-
return new StaticMapsRequest(context);
9+
/**
10+
* Create a new {@code StaticMapRequest}.
11+
*
12+
* @param context The {@code GeoApiContext} to make this request through.
13+
* @param size The size of the static map.
14+
*/
15+
public static StaticMapsRequest newRequest(GeoApiContext context, Size size) {
16+
return new StaticMapsRequest(context).size(size);
917
}
1018
}

src/main/java/com/google/maps/StaticMapsRequest.java

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.google.maps;
22

33
import com.google.maps.internal.ApiConfig;
4+
import com.google.maps.internal.StringJoin.UrlValue;
45
import com.google.maps.model.LatLng;
56
import com.google.maps.model.Size;
67
import java.awt.image.BufferedImage;
@@ -55,10 +56,64 @@ public StaticMapsRequest center(String location) {
5556
* @return Returns this {@code StaticMapsRequest} for call chaining.
5657
*/
5758
public StaticMapsRequest zoom(int zoom) {
58-
return param("zoom", Integer.toString(zoom));
59+
return param("zoom", zoom);
5960
}
6061

62+
/**
63+
* <code>size</code> defines the rectangular dimensions of the map image.
64+
*
65+
* @param size The Size of the static map.
66+
* @return Returns this {@code StaticMapsRequest} for call chaining.
67+
*/
6168
public StaticMapsRequest size(Size size) {
6269
return param("size", size);
6370
}
71+
72+
/**
73+
* <code>scale</code> affects the number of pixels that are returned. Setting <code>scale</code> to 2 returns twice as many pixels as <code>scale</code> set to 1 while retaining the same coverage area and level of detail (i.e. the contents of the map doesn't change).
74+
*
75+
* @param scale The scale of the static map.
76+
* @return Returns this {@code StaticMapsRequest} for call chaining.
77+
*/
78+
public StaticMapsRequest scale(int scale) {
79+
return param("scale", scale);
80+
}
81+
82+
/**
83+
* <code>format</code> defines the format of the resulting image. By default, the Google Static Maps API creates PNG images. There are several possible formats including GIF, JPEG and PNG types.
84+
*
85+
* @param format The format of the static map.
86+
* @return Returns this {@code StaticMapsRequest} for call chaining.
87+
*/
88+
public StaticMapsRequest format(String format) {
89+
return param("format", format);
90+
}
91+
92+
public enum StaticMapType implements UrlValue {
93+
roadmap, satellite, terrain, hybrid;
94+
95+
public String toUrlValue() {
96+
return this.name();
97+
}
98+
}
99+
100+
/**
101+
* <code>maptype</code> defines the type of map to construct.
102+
*
103+
* @param maptype The map type of the static map.
104+
* @return Returns this {@code StaticMapsRequest} for call chaining.
105+
*/
106+
public StaticMapsRequest maptype(StaticMapType maptype) {
107+
return param("maptype", maptype);
108+
}
109+
110+
/**
111+
* <code>region</code> defines the appropriate borders to display, based on geo-political sensitivities. Accepts a region code specified as a two-character ccTLD ('top-level domain') value.
112+
*
113+
* @param region The region of the static map.
114+
* @return Returns this {@code StaticMapsRequest} for call chaining.
115+
*/
116+
public StaticMapsRequest region(String region) {
117+
return param("region", region);
118+
}
64119
}

src/main/java/com/google/maps/model/PhotoResult.java

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/test/java/com/google/maps/StaticMapsApiTest.java

Lines changed: 1 addition & 2 deletions

0 commit comments

Comments
 (0)