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