当前位置: 首页>>代码示例>>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;未经允许,请勿转载。