當前位置: 首頁>>代碼示例>>Java>>正文


Java PolylineOptions.addAll方法代碼示例

本文整理匯總了Java中com.google.android.gms.maps.model.PolylineOptions.addAll方法的典型用法代碼示例。如果您正苦於以下問題:Java PolylineOptions.addAll方法的具體用法?Java PolylineOptions.addAll怎麽用?Java PolylineOptions.addAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.android.gms.maps.model.PolylineOptions的用法示例。


在下文中一共展示了PolylineOptions.addAll方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onRoutingSuccess

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
@Override
public void onRoutingSuccess(ArrayList<Route> route, int j) {
    if (polylines.size() > 0) {
        for (Polyline poly : polylines) {
            poly.remove();
        }
    }

    polylines = new ArrayList<>();
    //add route(s) to the map.
    for (int i = 0; i < route.size(); i++) {

        //In case of more than 5 alternative routes
        int colorIndex = i % COLORS.length;

        PolylineOptions polyOptions = new PolylineOptions();
        polyOptions.color(getResources().getColor(COLORS[colorIndex]));
        polyOptions.width(10 + i * 3);
        polyOptions.addAll(route.get(i).getPoints());
        Polyline polyline = mMap.addPolyline(polyOptions);
        polylines.add(polyline);
    }
}
 
開發者ID:clementf2b,項目名稱:FaceT,代碼行數:24,代碼來源:NearbyLocationActivity.java

示例2: getPolylineOptions

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
/**
 * Gets polyline options for polyline.
 * @param latLngBoundsBuilder the bounds
 * @param polylineData the polyline
 * @return the polyline options
 */
public PolylineOptions getPolylineOptions(LatLngBounds.Builder latLngBoundsBuilder, PolylineData polylineData) {
	PolylineOptions polyline = new PolylineOptions();
	String encodedValue = polylineData.getEncodedValue();
	if (encodedValue == null) {
		return null;
	}
	List<LatLng> latLngList = PolyUtil.decode(encodedValue);
	for (LatLng latLng : latLngList) {
		latLngBoundsBuilder.include(latLng);
	}
	polyline.addAll(latLngList);
	polyline.color(polylineData.getColor());
	return polyline;
}
 
開發者ID:Zlate87,項目名稱:sample-transport-app,代碼行數:21,代碼來源:RouteMapService.java

示例3: displayTrack

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
private void displayTrack() {
    ArrayList<AltitudeTrackSegment> listTrackSegment = MapUtilities.getAltitudeTrackSegments(igcFile);

    for (AltitudeTrackSegment trackSegment : listTrackSegment) {
        PolylineOptions polyline = getAltitudeTrackPolyline(trackSegment);
        polyline.addAll(Utilities.getLatLngPoints(trackSegment.getListRecords()));
        try {
            googleMap.addPolyline(polyline);
        } catch (Throwable t) {
            Crashlytics.log("FlightPreviewActivity :: Tried to draw polyline when googleMap is null");
            Crashlytics.logException(t);
        }
    }

}
 
開發者ID:santiago-hollmann,項目名稱:igcparser,代碼行數:16,代碼來源:FlightPreviewActivity.java

示例4: addLineStringToMap

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
/**
 * Adds a GeoJsonLineString to the map as a Polyline
 *
 * @param lineStringStyle contains relevant styling properties for the Polyline
 * @param lineString      contains coordinates for the Polyline
 * @return Polyline object created from given GeoJsonLineString
 */
private Polyline addLineStringToMap(GeoJsonLineStringStyle lineStringStyle,
        GeoJsonLineString lineString) {
    PolylineOptions polylineOptions = lineStringStyle.toPolylineOptions();
    // Add coordinates
    polylineOptions.addAll(lineString.getCoordinates());
    return mMap.addPolyline(polylineOptions);
}
 
開發者ID:josegury,項目名稱:AndroidMarkerClusteringMaps,代碼行數:15,代碼來源:GeoJsonRenderer.java

示例5: addLineStringToMap

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
/**
 * Adds a KML LineString to the map as a Polyline by combining the styling and coordinates
 *
 * @param lineString contains coordinates for the Polyline
 * @param style      contains relevant styling properties for the Polyline
 * @return Polyline object
 */
private Polyline addLineStringToMap(KmlLineString lineString, KmlStyle style,
        KmlStyle inlineStyle) {
    PolylineOptions polylineOptions = style.getPolylineOptions();
    polylineOptions.addAll(lineString.getGeometryObject());
    if (inlineStyle != null) {
        setInlineLineStringStyle(polylineOptions, inlineStyle);
    } else if (style.isLineRandomColorMode()) {
        polylineOptions.color(KmlStyle.computeRandomColor(polylineOptions.getColor()));
    }
    return mMap.addPolyline(polylineOptions);
}
 
開發者ID:josegury,項目名稱:AndroidMarkerClusteringMaps,代碼行數:19,代碼來源:KmlRenderer.java

示例6: drawRouteOnMap

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
private void drawRouteOnMap(GoogleMap map, List<LatLng> positions){
    PolylineOptions options = new PolylineOptions().width(5).color(Color.RED).geodesic(true);
    options.addAll(positions);
    Polyline polyline = map.addPolyline(options);
}
 
開發者ID:ayushghd,項目名稱:iSPY,代碼行數:6,代碼來源:ShortestDistance.java

示例7: onRoutingSuccess

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
@Override
public void onRoutingSuccess(ArrayList<Route> route, int ii) {


    progressDialog.dismiss();
    CameraUpdate center = CameraUpdateFactory.newLatLng(start);
    CameraUpdate zoom = CameraUpdateFactory.zoomTo(16);

    map.moveCamera(center);


    if (polylines.size() > 0) {
        for (Polyline poly : polylines) {
            poly.remove();
        }
    }

    polylines = new ArrayList<>();
    //add route(s) to the map.
    for (int i = 0; i < route.size(); i++) {

        //In case of more than 5 alternative routes
        int colorIndex = i % COLORS.length;

        PolylineOptions polyOptions = new PolylineOptions();
        polyOptions.color(getResources().getColor(COLORS[colorIndex]));
        polyOptions.width(10 + i * 3);
        polyOptions.addAll(route.get(i).getPoints());
        Polyline polyline = map.addPolyline(polyOptions);
        polylines.add(polyline);

        Toast.makeText(getApplicationContext(), "Route " + (i + 1) + ": distance - " + route.get(i).getDistanceValue() + ": duration - " + route.get(i).getDurationValue(), Toast.LENGTH_SHORT).show();
    }

    // Start marker
    MarkerOptions options = new MarkerOptions();
    options.position(start);
    options.icon(BitmapDescriptorFactory.fromResource(R.drawable.start_blue));
    map.addMarker(options);

    // End marker
    options = new MarkerOptions();
    options.position(end);
    options.icon(BitmapDescriptorFactory.fromResource(R.drawable.end_green));
    map.addMarker(options);

}
 
開發者ID:SkyTreasure,項目名稱:Airbnb-Android-Google-Map-View,代碼行數:48,代碼來源:ShowDirectionActivity.java

示例8: onRoutingSuccess

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
@Override
public void onRoutingSuccess(PolylineOptions mPolyOptions, final Route route) {
    progressDialog.dismiss();
    CameraUpdate center = CameraUpdateFactory.newLatLng(start);
    CameraUpdate zoom = CameraUpdateFactory.zoomTo(16);

    map.moveCamera(center);


    if (polyline != null)
        polyline.remove();

    polyline = null;
    //adds route to the map.
    PolylineOptions polyOptions = new PolylineOptions();
    polyOptions.color(getResources().getColor(R.color.colorPrimaryDark));
    polyOptions.width(10);
    polyOptions.addAll(mPolyOptions.getPoints());
    polyline = map.addPolyline(polyOptions);

    // Start marker
    MarkerOptions options = new MarkerOptions();
    options.position(start);
    options.icon(BitmapDescriptorFactory.fromResource(R.drawable.start_blue));
    map.addMarker(options);

    // End marker
    options = new MarkerOptions();
    options.position(end);
    options.icon(BitmapDescriptorFactory.fromResource(R.drawable.end_green));
    map.addMarker(options);

    cardView.setVisibility(View.GONE);
    estimate.setVisibility(View.VISIBLE);
    estimate.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Dialog dialog = new Dialog(getActivity());
            dialog.setContentView(R.layout.dialog);
            dialog.setTitle("Estimate Details");
            dialog.setCancelable(true);
            RecyclerView recyclerView;
            recyclerView = (RecyclerView) dialog.findViewById(R.id.recycler_view);
            recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
            recyclerView.setAdapter(new DialogAdapter(route));
            recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST, R.drawable.item_divider_black));
            dialog.show();
        }
    });


}
 
開發者ID:teamOSC,項目名稱:Ghumo_Android,代碼行數:53,代碼來源:DirectionsFragment.java

示例9: dibujarMapaCamino

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
public void dibujarMapaCamino(ArrayList<Etapa> listaEtapas) {
    ArrayList<LatLng> listaCoordsParadas = new ArrayList<LatLng>();

    Iterator<Etapa> itr = listaEtapas.iterator();
    Etapa etapa = null;
    LatLng coor = null;

    while (itr.hasNext()) {
        etapa = itr.next();

        Iterator<LatLng> itr2 = etapa.getListaCoordsParadas().iterator();

        while (itr2.hasNext()) {
            coor = itr2.next();
            listaCoordsParadas.add(coor);
        }

    }

    LatLng posInicial = listaCoordsParadas.get(0);
    LatLng posFinal = listaCoordsParadas.get(listaCoordsParadas.size() - 1);

    PolylineOptions puntos = new PolylineOptions();
    puntos.addAll(listaCoordsParadas);

    try{
        if (this.mapa == null){
            this.mapa = ((MapFragment) getFragmentManager().findFragmentById(R.id.fragmentMapa)).getMap();
        } else {
            this.mapa.clear();
        }
    } catch (Exception e){
        Log.e(ActivityCaminoActual.CAMINO_ACTUAL, "Error: al cargar mapa." + e.getMessage());
    }

    mapa.setMapType(GoogleMap.MAP_TYPE_NORMAL);

    this.mapa.addMarker(new MarkerOptions().position(posInicial).title("Inicio"));
    this.mapa.addMarker(new MarkerOptions().position(posFinal).title("Fin"));

    this.mapa.addPolyline(puntos);

    this.mapa.animateCamera(CameraUpdateFactory.newLatLngZoom(posInicial, 7.0f));
}
 
開發者ID:PSanchezR,項目名稱:Camino,代碼行數:45,代碼來源:ActivityCaminoActual.java


注:本文中的com.google.android.gms.maps.model.PolylineOptions.addAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。