/** * Sets the rotation / heading of the Point in degrees clockwise about the marker's anchor * * @param rotation Decimal representation of the rotation value of the Point */ public void setMarkerRotation(float rotation) { mMarkerOptions.rotation(rotation); }
public Builder<T> rotation(float rotation) { markerOptions.rotation(rotation); return this; }
private void addMarker(GoogleMap map, double lat, double lon, int title, int snippet, boolean flat, float rotation) { map.addMarker(new MarkerOptions().position(new LatLng(lat, lon)) .title(getString(title)) .snippet(getString(snippet)) .flat(flat).rotation(rotation)); } }
/** * Creates a new marker option from given properties of an existing marker option * * @param originalMarkerOption An existing MarkerOption instance * @param iconRandomColorMode True if marker color mode is random, false otherwise * @param markerColor Color of the marker * @return A new MarkerOption */ private static MarkerOptions createMarkerOptions(MarkerOptions originalMarkerOption, boolean iconRandomColorMode, float markerColor) { MarkerOptions newMarkerOption = new MarkerOptions(); newMarkerOption.rotation(originalMarkerOption.getRotation()); newMarkerOption.anchor(originalMarkerOption.getAnchorU(), originalMarkerOption.getAnchorV()); if (iconRandomColorMode) { float hue = getHueValue(computeRandomColor((int) markerColor)); originalMarkerOption.icon(BitmapDescriptorFactory.defaultMarker(hue)); } newMarkerOption.icon(originalMarkerOption.getIcon()); return newMarkerOption; }
/** * Sets the inline point style by copying over the styles that have been set * * @param markerOptions marker options object to add inline styles to * @param inlineStyle inline styles to apply * @param markerUrlIconUrl default marker icon URL from shared style */ private void setInlinePointStyle(MarkerOptions markerOptions, KmlStyle inlineStyle, String markerUrlIconUrl) { MarkerOptions inlineMarkerOptions = inlineStyle.getMarkerOptions(); if (inlineStyle.isStyleSet("heading")) { markerOptions.rotation(inlineMarkerOptions.getRotation()); } if (inlineStyle.isStyleSet("hotSpot")) { markerOptions .anchor(inlineMarkerOptions.getAnchorU(), inlineMarkerOptions.getAnchorV()); } if (inlineStyle.isStyleSet("markerColor")) { markerOptions.icon(inlineMarkerOptions.getIcon()); } if (inlineStyle.isStyleSet("iconUrl")) { addMarkerIcons(inlineStyle.getIconUrl(), markerOptions); } else if (markerUrlIconUrl != null) { // Inline style with no icon defined addMarkerIcons(markerUrlIconUrl, markerOptions); } }
/** * Gets a new MarkerOptions object containing styles for the GeoJsonPoint * * @return new MarkerOptions object */ public MarkerOptions toMarkerOptions() { MarkerOptions markerOptions = new MarkerOptions(); markerOptions.alpha(mMarkerOptions.getAlpha()); markerOptions.anchor(mMarkerOptions.getAnchorU(), mMarkerOptions.getAnchorV()); markerOptions.draggable(mMarkerOptions.isDraggable()); markerOptions.flat(mMarkerOptions.isFlat()); markerOptions.icon(mMarkerOptions.getIcon()); markerOptions.infoWindowAnchor(mMarkerOptions.getInfoWindowAnchorU(), mMarkerOptions.getInfoWindowAnchorV()); markerOptions.rotation(mMarkerOptions.getRotation()); markerOptions.snippet(mMarkerOptions.getSnippet()); markerOptions.title(mMarkerOptions.getTitle()); markerOptions.visible(mMarkerOptions.isVisible()); markerOptions.zIndex(mMarkerOptions.getZIndex()); return markerOptions; }
public MarkerOptions rotation(float rotation) { real.rotation(rotation); return this; }
/** * Sets the rotation / heading for a marker * * @param heading Decimal representation of a rotation value */ /* package */ void setHeading(float heading) { mMarkerOptions.rotation(heading); mStylesSet.add("heading"); }
/** * Sets the rotation of the GeoJsonPoint in degrees clockwise about the marker's anchor point * * @param rotation rotation value of the GeoJsonPoint */ public void setRotation(float rotation) { mMarkerOptions.rotation(rotation); styleChanged(); }
public void setRotation(float rotation) { if (marker != null) { marker.setRotation(rotation); } else { markerOptions.rotation(rotation); } }
.icon(BitmapDescriptorFactory.defaultMarker(i * 360 / numMarkersInRainbow)) .flat(flat) .rotation(rotation)); mMarkerRainbow.add(marker);
Bitmap smallCar = Bitmap.createScaledBitmap(b,60, 72,false); markerOptions1.icon(BitmapDescriptorFactory.fromBitmap(smallCar)); markerOptions1.rotation(Float.parseFloat(get_cab_position_response_data.getString("cab_bearing")));
Bitmap smallCar = Bitmap.createScaledBitmap(b,60, 72,false); markerOptions1.icon(BitmapDescriptorFactory.fromBitmap(smallCar)); markerOptions1.rotation(mLastLocation.getBearing());
/** * Creates a new marker option from given properties of an existing marker option * * @param originalMarkerOption An existing MarkerOption instance * @param iconRandomColorMode True if marker color mode is random, false otherwise * @param markerColor Color of the marker * @return A new MarkerOption */ private static MarkerOptions createMarkerOptions(MarkerOptions originalMarkerOption, boolean iconRandomColorMode, float markerColor) { MarkerOptions newMarkerOption = new MarkerOptions(); newMarkerOption.rotation(originalMarkerOption.getRotation()); newMarkerOption.anchor(originalMarkerOption.getAnchorU(), originalMarkerOption.getAnchorV()); if (iconRandomColorMode) { float hue = getHueValue(computeRandomColor((int) markerColor)); originalMarkerOption.icon(BitmapDescriptorFactory.defaultMarker(hue)); } newMarkerOption.icon(originalMarkerOption.getIcon()); return newMarkerOption; }
/** * Sets the inline point style by copying over the styles that have been set * * @param markerOptions marker options object to add inline styles to * @param inlineStyle inline styles to apply * @param markerUrlIconUrl default marker icon URL from shared style */ private void setInlinePointStyle(MarkerOptions markerOptions, KmlStyle inlineStyle, String markerUrlIconUrl) { MarkerOptions inlineMarkerOptions = inlineStyle.getMarkerOptions(); if (inlineStyle.isStyleSet("heading")) { markerOptions.rotation(inlineMarkerOptions.getRotation()); } if (inlineStyle.isStyleSet("hotSpot")) { markerOptions .anchor(inlineMarkerOptions.getAnchorU(), inlineMarkerOptions.getAnchorV()); } if (inlineStyle.isStyleSet("markerColor")) { markerOptions.icon(inlineMarkerOptions.getIcon()); } if (inlineStyle.isStyleSet("iconUrl")) { addMarkerIcons(inlineStyle.getIconUrl(), markerOptions); } else if (markerUrlIconUrl != null) { // Inline style with no icon defined addMarkerIcons(markerUrlIconUrl, markerOptions); } }
com.google.android.gms.maps.model.Marker createMarker(List<Marker> markers, LatLng position) { markerOptions.position(position); ClusterOptions opts = clusterOptionsProvider.getClusterOptions(markers); markerOptions.icon(opts.getIcon()); if (GOOGLE_PLAY_SERVICES_4_0) { try { markerOptions.alpha(opts.getAlpha()); } catch (NoSuchMethodError error) { // not the cutest way to handle backward compatibility GOOGLE_PLAY_SERVICES_4_0 = false; } } markerOptions.anchor(opts.getAnchorU(), opts.getAnchorV()); markerOptions.flat(opts.isFlat()); markerOptions.infoWindowAnchor(opts.getInfoWindowAnchorU(), opts.getInfoWindowAnchorV()); markerOptions.rotation(opts.getRotation()); if (GOOGLE_PLAY_SERVICES_9_2) { try { markerOptions.zIndex(opts.getZIndex()); } catch (NoSuchMethodError error) { GOOGLE_PLAY_SERVICES_9_2 = false; } } return map.addMarker(markerOptions); }
private void showBlueDot(LatLng center, double accuracyRadius, double bearing) { if (mCircle == null) { // location can received before map is initialized, ignoring those updates if (mMap != null) { mCircle = mMap.addCircle(new CircleOptions() .center(center) .radius(accuracyRadius) .fillColor(0x201681FB) .strokeColor(0x500A78DD) .zIndex(1.0f) .visible(true) .strokeWidth(5.0f)); mMarker = mMap.addMarker(new MarkerOptions() .position(center) .icon(BitmapDescriptorFactory.fromResource(R.drawable.map_blue_dot)) .anchor(0.5f, 0.5f) .rotation((float)bearing) .flat(true)); } } else { // move existing markers position to received location mCircle.setCenter(center); mCircle.setRadius(accuracyRadius); mMarker.setPosition(center); mMarker.setRotation((float)bearing); } }
/** * Gets a new MarkerOptions object containing styles for the GeoJsonPoint * * @return new MarkerOptions object */ public MarkerOptions toMarkerOptions() { MarkerOptions markerOptions = new MarkerOptions(); markerOptions.alpha(mMarkerOptions.getAlpha()); markerOptions.anchor(mMarkerOptions.getAnchorU(), mMarkerOptions.getAnchorV()); markerOptions.draggable(mMarkerOptions.isDraggable()); markerOptions.flat(mMarkerOptions.isFlat()); markerOptions.icon(mMarkerOptions.getIcon()); markerOptions.infoWindowAnchor(mMarkerOptions.getInfoWindowAnchorU(), mMarkerOptions.getInfoWindowAnchorV()); markerOptions.rotation(mMarkerOptions.getRotation()); markerOptions.snippet(mMarkerOptions.getSnippet()); markerOptions.title(mMarkerOptions.getTitle()); markerOptions.visible(mMarkerOptions.isVisible()); return markerOptions; }
private void showBlueDot(LatLng center, double accuracyRadius, double bearing) { if (mCircle == null) { // location can received before map is initialized, ignoring those updates if (mMap != null) { mCircle = mMap.addCircle(new CircleOptions() .center(center) .radius(accuracyRadius) .fillColor(ACTIVE_LEVEL_BLUE_DOT_COLOR) .strokeColor(0x00000000) .zIndex(1.0f) .visible(true)); mMarker = mMap.addMarker(new MarkerOptions() .position(center) .icon(BitmapDescriptorFactory.fromResource(R.drawable.map_blue_dot)) .anchor(0.5f, 0.5f) .rotation((float)bearing) .flat(true)); mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(center, 17.0f)); } } else { mCircle.setCenter(center); mCircle.setRadius(accuracyRadius); mMarker.setPosition(center); mMarker.setRotation((float)bearing); } }
private static MarkerOptions copy(MarkerOptions options) { MarkerOptions copy = new MarkerOptions(); if (GOOGLE_PLAY_SERVICES_4_0) { try { copy.alpha(options.getAlpha()); } catch (NoSuchMethodError error) { // not the cutest way to handle backward compatibility GOOGLE_PLAY_SERVICES_4_0 = false; } } copy.anchor(options.getAnchorU(), options.getAnchorV()); copy.draggable(options.isDraggable()); copy.flat(options.isFlat()); copy.icon(options.getIcon()); copy.infoWindowAnchor(options.getInfoWindowAnchorU(), options.getInfoWindowAnchorV()); copy.position(options.getPosition()); copy.rotation(options.getRotation()); copy.snippet(options.getSnippet()); copy.title(options.getTitle()); copy.visible(options.isVisible()); if (GOOGLE_PLAY_SERVICES_9_2) { try { copy.zIndex(options.getZIndex()); } catch (NoSuchMethodError error) { GOOGLE_PLAY_SERVICES_9_2 = false; } } return copy; } }