本文整理匯總了Java中com.google.android.gms.maps.model.PolylineOptions.width方法的典型用法代碼示例。如果您正苦於以下問題:Java PolylineOptions.width方法的具體用法?Java PolylineOptions.width怎麽用?Java PolylineOptions.width使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.android.gms.maps.model.PolylineOptions
的用法示例。
在下文中一共展示了PolylineOptions.width方法的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);
}
示例2: 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);
}
示例3: 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);
}
}
示例4: 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;
}
示例5: 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);
}
}
示例6: 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;
}
示例7: 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);
}
}
}
示例8: 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);
}
示例9: 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);
}
示例10: 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;
}
示例11: createRoutesPolyOpts
import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
private PolylineOptions createRoutesPolyOpts() {
com.google.android.gms.maps.model.LatLng currPoint;
PolylineOptions line = new PolylineOptions();
for (LatLng point : directionsRoute.overviewPolyline.decodePath()) {
currPoint = new com.google.android.gms.maps.model.LatLng(point.lat, point.lng);
line.add(currPoint);
line.width(13);
}
return line;
}
示例12: addBikePathToMap
import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
public static void addBikePathToMap (GoogleMap mMap) {
if (isBikePathPolylinesAdded)
return;
bikePathsPolylines = new ArrayList<>();
for (PolylineOptions line : bikePathPolylinesOpts) {
line.zIndex(20); // TODO: not hard coded
line.width(5); // TODO: not hard coded
line.visible(false);
bikePathsPolylines.add(mMap.addPolyline(line));
}
isBikePathPolylinesAdded = true;
}
示例13: toPolylineOptions
import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
/**
* Gets a new PolylineOptions object containing styles for the GeoJsonLineString
*
* @return new PolylineOptions object
*/
public PolylineOptions toPolylineOptions() {
PolylineOptions polylineOptions = new PolylineOptions();
polylineOptions.color(mPolylineOptions.getColor());
polylineOptions.geodesic(mPolylineOptions.isGeodesic());
polylineOptions.visible(mPolylineOptions.isVisible());
polylineOptions.width(mPolylineOptions.getWidth());
polylineOptions.zIndex(mPolylineOptions.getZIndex());
return polylineOptions;
}
示例14: setInlineLineStringStyle
import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
/**
* Sets the inline linestring style by copying over the styles that have been set
*
* @param polylineOptions polygon options object to add inline styles to
* @param inlineStyle inline styles to apply
*/
private void setInlineLineStringStyle(PolylineOptions polylineOptions, KmlStyle inlineStyle) {
PolylineOptions inlinePolylineOptions = inlineStyle.getPolylineOptions();
if (inlineStyle.isStyleSet("outlineColor")) {
polylineOptions.color(inlinePolylineOptions.getColor());
}
if (inlineStyle.isStyleSet("width")) {
polylineOptions.width(inlinePolylineOptions.getWidth());
}
if (inlineStyle.isLineRandomColorMode()) {
polylineOptions.color(KmlStyle.computeRandomColor(inlinePolylineOptions.getColor()));
}
}
示例15: createPolylineOptions
import com.google.android.gms.maps.model.PolylineOptions; //導入方法依賴的package包/類
/**
* Creates a new PolylineOption from given properties of an existing PolylineOption
* @param originalPolylineOption An existing PolylineOption instance
* @return A new PolylineOption
*/
private static PolylineOptions createPolylineOptions (PolylineOptions originalPolylineOption) {
PolylineOptions polylineOptions = new PolylineOptions();
polylineOptions.color(originalPolylineOption.getColor());
polylineOptions.width(originalPolylineOption.getWidth());
return polylineOptions;
}