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


Java PolylineOptions.color方法代碼示例

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


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

示例1: addPolyline

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
/**
 * If an origin and destination exist this will draw a line between them and
 * render the time it takes to reach the {@link DistanceAction#destination}
 */
private void addPolyline() {
    if (this.origin == null || this.destination == null) {
        return;
    }
    releasePolyline();
    this.destination.marker.setTitle(getTitleForDistance(getDistance()));
    this.destination.marker.setSnippet(this.snippet);
    this.destination.marker.showInfoWindow();
    final PolylineOptions polylineOptions = new PolylineOptions();
    polylineOptions.add(this.origin.latLng);
    polylineOptions.add(this.destination.latLng);
    polylineOptions.width(5);
    polylineOptions.color(this.colorAccent);
    polylineOptions.zIndex(1000);
    this.polyline = this.mapController.addPolyline(polylineOptions);
}
 
開發者ID:ZafraniTechLLC,項目名稱:Companion-For-PUBG-Android,代碼行數:21,代碼來源:DistanceAction.java

示例2: addPolylineToMapAsMarkers

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
/**
 * Add a Polyline to the map as markers
 *
 * @param map
 * @param polylineOptions
 * @param polylineMarkerOptions
 * @param globalPolylineOptions
 * @return
 */
public PolylineMarkers addPolylineToMapAsMarkers(GoogleMap map,
                                                 PolylineOptions polylineOptions,
                                                 MarkerOptions polylineMarkerOptions,
                                                 PolylineOptions globalPolylineOptions) {

    PolylineMarkers polylineMarkers = new PolylineMarkers(this);

    if (globalPolylineOptions != null) {
        polylineOptions.color(globalPolylineOptions.getColor());
        polylineOptions.geodesic(globalPolylineOptions.isGeodesic());
    }

    Polyline polyline = addPolylineToMap(map, polylineOptions);
    polylineMarkers.setPolyline(polyline);

    List<Marker> markers = addPointsToMapAsMarkers(map,
            polylineOptions.getPoints(), polylineMarkerOptions, false);
    polylineMarkers.setMarkers(markers);

    return polylineMarkers;
}
 
開發者ID:ngageoint,項目名稱:geopackage-android-map,代碼行數:31,代碼來源:GoogleMapShapeConverter.java

示例3: drawSubsection

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
public static void drawSubsection(GoogleMap map, List<LatLng> coords, int startIndex, int endIndex, int color){
  if(sectionPolyline != null){
    sectionPolyline.remove();
  }

  PolylineOptions line = new PolylineOptions();
  line.geodesic(true);
  line.width(14);
  line.zIndex(100);
  line.color(color);

  int start = startIndex;
  int end = endIndex;

  if(startIndex > endIndex){
    int temp = startIndex;
    start = endIndex;
    end = temp;
  }

  for(LatLng ll : coords.subList(start, end)){
    line.add(ll);
  }

  sectionPolyline = map.addPolyline(line);
}
 
開發者ID:fiskurgit,項目名稱:KortidTol,代碼行數:27,代碼來源:MapTools.java

示例4: onMapReady

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
@Override
public void onMapReady(GoogleMap googleMap) {

    mMap = googleMap;
    int marca = 0;

    for (Punto incidencia :incidencias) {
        mMap.addMarker(new MarkerOptions().position(new LatLng(incidencia.getX(), incidencia.getY())).icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_VIOLET)));
    }

    for (Punto punto : puntos) {
        mMap.addMarker(new MarkerOptions().position(new LatLng(punto.getX(), punto.getY())).title("Step " + (++marca)));
    }
    mMap.moveCamera(CameraUpdateFactory.newLatLng(new LatLng(puntos.get(0).getX(), puntos.get(0).getY())));

    UiSettings ui = mMap.getUiSettings();
    ui.setZoomControlsEnabled(true);


    for (int i = 0; i < puntos.size() - 1; i++) {
        PolylineOptions linea = new PolylineOptions().add(new LatLng(puntos.get(i).getX(), puntos.get(i).getY())).add(new LatLng(puntos.get(i + 1).getX(), puntos.get(i + 1).getY()));
        linea.color(Color.BLUE);
        linea.width(3f);
        mMap.addPolyline(linea);
    }
}
 
開發者ID:santiihoyos,項目名稱:LazarilloApp,代碼行數:27,代碼來源:MapsActivity.java

示例5: drawPath

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
private Polyline drawPath(List<LatLong> latLongs, int color, float zIndex, Polyline polyline) {
    if (googleMap != null && latLongs != null && !latLongs.isEmpty()) {
        PolylineOptions polyLineOptions = new PolylineOptions();
        polyLineOptions.width(getResources().getDimension(R.dimen._2dp));
        polyLineOptions.color(color);
        polyLineOptions.zIndex(zIndex);

        for (LatLong latLong : latLongs) {
            polyLineOptions.add(new LatLng(latLong.latitude(), latLong.longitude()));
        }

        if (polyline != null) polyline.remove();
        return googleMap.addPolyline(polyLineOptions);
    }

    return null;
}
 
開發者ID:miguelbcr,項目名稱:RxGpsService,代碼行數:18,代碼來源:PlaceMapFragment.java

示例6: 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

示例7: getPath

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
@Override
public PolylineOptions getPath(LatLng start, LatLng finish) {

    // computes all possible paths from starting vertex
    computePaths(latLngNodeMap.get(start));
    // holds a list of vertices that make up the shortest path between start and finish
    List <Vertex> path = getShortestPathTo(latLngNodeMap.get(finish));

    PolylineOptions options = new PolylineOptions();

    // add the LatLngs of each vertex in the path to the polyline
    for (int i = 0; i < path.size(); i++) {
        LatLng cords = new LatLng(path.get(i).lat, path.get(i).lon);
        options.add(cords);
    }

    options.color(Color.BLUE);
    return options;
}
 
開發者ID:derekriley,項目名稱:UWP-navigation,代碼行數:20,代碼來源:NavigationPathProvider.java

示例8: getPolyLineOptions

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
private List<PolylineOptions> getPolyLineOptions(
        ArrayList<LatLng> latLngPath, Set<LatLng> duplicates,
        LatLngBounds.Builder builder, boolean healthiest) {
    int color = healthiest ? Color.rgb(0, 204, 204) : Color
            .rgb(227, 74, 51);
    List<PolylineOptions> optionsList = Lists.newLinkedList();

    LatLng previous = null;
    for (LatLng current : latLngPath) {
        builder.include(current);
        if (previous != null) {
            PolylineOptions polylineOptions = new PolylineOptions();
            polylineOptions.add(previous).add(current);
            polylineOptions.color(color);
            if (healthiest && duplicates.contains(previous)
                    && duplicates.contains(current)) {
                polylineOptions.width(WIDTH_THIN);
            } else {
                polylineOptions.width(WIDTH_THICK);
            }
            optionsList.add(polylineOptions);
        }
        previous = current;
    }
    return optionsList;
}
 
開發者ID:dhasenfratz,項目名稱:hRouting_Android,代碼行數:27,代碼來源:PathMapFragment.java

示例9: addMeasurementLine

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
public void addMeasurementLine(Packet packet) {
    for (Gateway gateway : packet.getGateways()) {
        double gwLat = gateway.getLatitude();
        double gwLon = gateway.getLongitude();
        double rssi = gateway.getRssi();
        if (gwLat != 0 && gwLon != 0) {
            PolylineOptions options = new PolylineOptions();
            options.add(new LatLng(packet.getLatitude(), packet.getLongitude()));
            options.add(new LatLng(gwLat, gwLon));
            if (rssi == 0) {
                options.color(0x7f000000);
            } else if (rssi < -120) {
                options.color(0x7f0000ff);
            } else if (rssi < -115) {
                options.color(0x7f00ffff);
            } else if (rssi < -110) {
                options.color(0x7f00ff00);
            } else if (rssi < -105) {
                options.color(0x7fffff00);
            } else if (rssi < -100) {
                options.color(0x7fff7f00);
            } else {
                options.color(0x7fff0000);
            }
            options.width(2);
            mMap.addPolyline(options);
        }
    }
}
 
開發者ID:jpmeijers,項目名稱:ttnmapper_android_v2,代碼行數:30,代碼來源:MapsActivity.java

示例10: addPolylinesToMap

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
/**
 * Add a list of Polylines to the map
 *
 * @param map
 * @param polylines
 * @return
 */
public static MultiPolyline addPolylinesToMap(GoogleMap map,
                                              MultiPolylineOptions polylines) {
    MultiPolyline multiPolyline = new MultiPolyline();
    for (PolylineOptions polylineOption : polylines.getPolylineOptions()) {
        if (polylines.getOptions() != null) {
            polylineOption.color(polylines.getOptions().getColor());
            polylineOption.geodesic(polylines.getOptions().isGeodesic());
        }
        Polyline polyline = addPolylineToMap(map, polylineOption);
        multiPolyline.add(polyline);
    }
    return multiPolyline;
}
 
開發者ID:ngageoint,項目名稱:geopackage-android-map,代碼行數:21,代碼來源:GoogleMapShapeConverter.java

示例11: drawSegmentPathUser

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
private void drawSegmentPathUser(LatLng latLng) {
    PolylineOptions polyLineOptions = new PolylineOptions();
    polyLineOptions.width(getResources().getDimension(R.dimen._2dp));
    polyLineOptions.color(ContextCompat.getColor(getContext(), R.color.blue));
    polyLineOptions.zIndex(2f);

    if (polylineUserLastPath != null) {
        for (LatLng latLngOld : polylineUserLastPath.getPoints())
            polyLineOptions.add(latLngOld);
    }

    polyLineOptions.add(latLng);
    polylineUserLastPath = removePath(polylineUserLastPath);
    polylineUserLastPath = googleMap.addPolyline(polyLineOptions);
}
 
開發者ID:miguelbcr,項目名稱:RxGpsService,代碼行數:16,代碼來源:PlaceMapFragment.java

示例12: 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

示例13: drawPath

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
private void drawPath()
{
    if ( mMap == null)
        return;
    PolylineOptions options = new PolylineOptions();
    options.color(Color.parseColor("#CC0000FF"));
    options.width(4);
    options.visible(true);
    options.add(new LatLng(currentLAT, currentLONG));
    options.add(new LatLng(lat, lng));
    mMap.addPolyline(options);
}
 
開發者ID:smerkousdavid,項目名稱:myva-Home,代碼行數:13,代碼來源:MapsActivity.java

示例14: getEditPolylineOptions

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
/**
 * Get the edit polyline options
 *
 * @param style observation shape style
 * @return edit polyline options
 */
private PolylineOptions getEditPolylineOptions(ObservationShapeStyle style) {
    PolylineOptions polylineOptions = new PolylineOptions();
    polylineOptions.width(style.getStrokeWidth());
    polylineOptions.color(style.getStrokeColor());
    polylineOptions.geodesic(MapShapeObservation.GEODESIC);
    return polylineOptions;
}
 
開發者ID:ngageoint,項目名稱:mage-android,代碼行數:14,代碼來源:LocationEditActivity.java

示例15: setMapRoute

import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
@Override
public void setMapRoute(List<Coordinate> points) {
    LatLngParser parser = new LatLngParser();

    CameraPosition cameraPosition =
            new CameraPosition.Builder()
                    .target(parser.parse(points.get(FIRST)))
                    .zoom(MapNavigationConstants.NAVIGATION_ZOOM)
                    .build();

    googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));

    googleMap.animateCamera(
            CameraUpdateFactory.zoomTo(
                    MapNavigationConstants.NAVIGATION_ZOOM),
            MapNavigationConstants.ZOOM_DURATION, null);

    PolylineOptions polynesOpt = new PolylineOptions();
    polynesOpt.color(R.color.map_navigation_route);

    for(Coordinate coordinate:points){
        polynesOpt.add(parser.parse(coordinate));
    }
    polynesOpt.geodesic(true);

    googleMap.addPolyline(polynesOpt);

}
 
開發者ID:cristianoliveira,項目名稱:bikeon-android-app,代碼行數:29,代碼來源:MapNavigationFragment.java


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