Java 类com.google.android.gms.maps.model.LatLngBounds.Builder 实例源码

项目:appez-android    文件:SmartMapHandlerActivity.java   
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);
}
项目:PhoneChat    文件:PluginUtil.java   
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();
}
项目:PhoneChat    文件:PluginUtil.java   
public static  LatLngBounds convertToLatLngBounds(List<LatLng> points) {
  LatLngBounds.Builder latLngBuilder = LatLngBounds.builder();
  Iterator<LatLng> iterator = points.listIterator();
  while (iterator.hasNext()) {
    latLngBuilder.include(iterator.next());
  }
  return latLngBuilder.build();
}
项目:neo4art    文件:PluginUtil.java   
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();
}
项目:neo4art    文件:PluginUtil.java   
public static  LatLngBounds convertToLatLngBounds(List<LatLng> points) {
  LatLngBounds.Builder latLngBuilder = LatLngBounds.builder();
  Iterator<LatLng> iterator = points.listIterator();
  while (iterator.hasNext()) {
    latLngBuilder.include(iterator.next());
  }
  return latLngBuilder.build();
}
项目:neo4art    文件:PluginUtil.java   
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();
}
项目:neo4art    文件:PluginUtil.java   
public static  LatLngBounds convertToLatLngBounds(List<LatLng> points) {
  LatLngBounds.Builder latLngBuilder = LatLngBounds.builder();
  Iterator<LatLng> iterator = points.listIterator();
  while (iterator.hasNext()) {
    latLngBuilder.include(iterator.next());
  }
  return latLngBuilder.build();
}
项目:neo4art    文件:PluginUtil.java   
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();
}
项目:neo4art    文件:PluginUtil.java   
public static  LatLngBounds convertToLatLngBounds(List<LatLng> points) {
  LatLngBounds.Builder latLngBuilder = LatLngBounds.builder();
  Iterator<LatLng> iterator = points.listIterator();
  while (iterator.hasNext()) {
    latLngBuilder.include(iterator.next());
  }
  return latLngBuilder.build();
}
项目:rallye-android-client    文件:GameMapFragment.java   
@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();
    }
}
项目:rallye-android-client    文件:GameMapFragment.java   
@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;
}
项目:sprockets-android    文件:GoogleMaps.java   
private void doAnimateCameraToIncludePosition(GoogleMap map, LatLng position) {
    map.animateCamera(CameraUpdateFactory.newLatLngBounds(
            new Builder().include(map.getCameraPosition().target).include(position).build(),
            mContext.getResources().getDimensionPixelOffset(R.dimen.touch_target_min_size)));
}
项目:Purdue-App-Old    文件:MapActivity.java   
/** Called when the user confirms layer selection in LayersDialog */
public void onLayersUpdate(List<String> enabledLayers) {
    // Clear the map
    gmap.clear();

    // If no layers at all were selected, then reset the camera and return
    if (enabledLayers.size() == 0) {
        gmap.animateCamera(CameraUpdateFactory.newLatLngZoom(
                new LatLng(mpd.PURDUE_CENTER_LAT, mpd.PURDUE_CENTER_LNG),
                mpd.PURDUE_CAMPUS_ZOOM));
        return;
    }

    // Create a camera update bounds which will be updated as we add pins
    LatLngBounds.Builder latlngbuilder = LatLngBounds.builder();

    // The list of layers contains each layer the user has selected.
    // If the user selects multiple layers then they should be displayed simultaneously
    for (String i : enabledLayers) {

        for (LatLng loc : mpd.getLayerPoints(i)) {
            // Calculate the distance between the user's location and the pin (in meters)
            int dBetween = 0;
            if (gmap.getMyLocation() != null) {
                double dBetweenD = MapData.distanceBetween(gmap.getMyLocation().getLatitude(), 
                        gmap.getMyLocation().getLongitude(), loc.latitude, loc.longitude) * 1000;
                // Cast it as an int to chop of the decimal as we really don't care about anything less than 1 meter
                dBetween = (int) dBetweenD;
            }

            // Create a new marker at that position with the title set as the distance
            gmap.addMarker(new MarkerOptions()
                .position(loc)
                .title("" + dBetween + " m"));
            latlngbuilder.include(loc);
        }

    }

    // Animate the camera so it includes all the new pins
    gmap.animateCamera(CameraUpdateFactory.newLatLngBounds(latlngbuilder.build(), 300));
}
项目:tiempobus    文件:ParadasCercanas.java   
/**
 * Seleccion de proximidad de paradas
 */
public void seleccionarProximidad() {

    final CharSequence[] items = {context.getString(R.string.proximidad_1), context.getString(R.string.proximidad_2), context.getString(R.string.proximidad_3)};

    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle(R.string.proximidad);

    builder.setItems(items, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int item) {

            if (item == 0) {

                context.distancia = DISTACIA_CERCANA;
                miLocalizacion(true);

            } else if (item == 1) {

                context.distancia = DISTACIA_MEDIA;
                miLocalizacion(true);

            } else if (item == 2) {

                context.distancia = DISTACIA_LEJOS;
                miLocalizacion(true);

            }

        }
    });

    AlertDialog alert = builder.create();

    alert.show();

}