本文整理汇总了Java中com.google.android.gms.maps.model.LatLngBounds.Builder.include方法的典型用法代码示例。如果您正苦于以下问题:Java Builder.include方法的具体用法?Java Builder.include怎么用?Java Builder.include使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.maps.model.LatLngBounds.Builder
的用法示例。
在下文中一共展示了Builder.include方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addPanPropertiesToMap
import com.google.android.gms.maps.model.LatLngBounds.Builder; //导入方法依赖的package包/类
private void addPanPropertiesToMap() {
LatLngBounds bounds = null;
Builder latLngBoundBuilder = new LatLngBounds.Builder();
if (punchLocationCollection != null && punchLocationCollection.size() > 0) {
int totalLocations = punchLocationCollection.size();
for (int currentLocation = 0; currentLocation < totalLocations; currentLocation++) {
LatLng latLng = new LatLng(Double.parseDouble(punchLocationCollection.get(currentLocation).getLatitude()), Double.parseDouble(punchLocationCollection.get(currentLocation)
.getLongitude()));
latLngBoundBuilder = latLngBoundBuilder.include(latLng);
}
}
if (deviceCurrentLocation != null) {
latLngBoundBuilder.include(new LatLng(deviceCurrentLocation.getLatitude(), deviceCurrentLocation.getLongitude()));
}
// Build the map with the bounds that encompass all the
// specified location as well the current location
bounds = latLngBoundBuilder.build();
mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 50));
// Zoom in, animating the camera.
// mMap.animateCamera(CameraUpdateFactory.zoomTo(50), 2000, null);
}
示例2: JSONArray2LatLngBounds
import com.google.android.gms.maps.model.LatLngBounds.Builder; //导入方法依赖的package包/类
public static LatLngBounds JSONArray2LatLngBounds(JSONArray points) throws JSONException {
List<LatLng> path = JSONArray2LatLngList(points);
Builder builder = LatLngBounds.builder();
int i = 0;
for (i = 0; i < path.size(); i++) {
builder.include(path.get(i));
}
return builder.build();
}
示例3: onMapChange
import com.google.android.gms.maps.model.LatLngBounds.Builder; //导入方法依赖的package包/类
@Override
public void onMapChange(List<Node> nodes, List<? extends Edge> edges) {
Builder bounds = LatLngBounds.builder();
boolean hasBounds = false;
for (Node n: nodes) {
Marker m = gmap.addMarker(new MarkerOptions()
.position(toGms(n.location))
.title(n.name)
.snippet(n.description));
hasBounds = true;
bounds.include(toGms(n.location));
markers.put(m, n);
}
for (Edge e: edges) {
gmap.addPolyline(new PolylineOptions()
.add(toGms(e.nodeA.location), toGms(e.nodeB.location))
.color(getColor(e.type)));
}
if (hasBounds) {
gameBounds = bounds.build();
if (zoom == null) {
zoom = Zoom.ToGame;
}
zoomMap();
}
}
示例4: onMarkerClick
import com.google.android.gms.maps.model.LatLngBounds.Builder; //导入方法依赖的package包/类
@Override
public boolean onMarkerClick(Marker marker) {
Node source = markers.get(marker),
target;
Builder bounds = LatLngBounds.builder();
ArrayList<Node> targets = new ArrayList<Node>();
bounds.include(toGms(source.location));
for (Edge e: source.getEdges()) {
target = e.getOtherNode(source);
targets.add(target);
bounds.include(toGms(target.location));
}
Log.i(THIS, "found "+ targets.size() +" targets/edges");
for (Entry<Marker, Node> m: markers.entrySet()) {
Marker current = m.getKey();
boolean cond = targets.contains(m.getValue());
current.setVisible(cond);
}
marker.setVisible(true);
zoom = Zoom.ToBounds;
currentBounds = bounds.build();
zoomMap();
marker.showInfoWindow();
return true;
}