本文整理汇总了Java中com.google.android.gms.maps.model.MarkerOptions.icon方法的典型用法代码示例。如果您正苦于以下问题:Java MarkerOptions.icon方法的具体用法?Java MarkerOptions.icon怎么用?Java MarkerOptions.icon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.maps.model.MarkerOptions
的用法示例。
在下文中一共展示了MarkerOptions.icon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addGateway
import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
public void addGateway(Packet packet) {
for (Gateway gateway : packet.getGateways()) {
double gwLat = gateway.getLatitude();
double gwLon = gateway.getLongitude();
if (gwLat != 0 && gwLon != 0) {
String gatewayId = gateway.getGatewayID();
if (gatewaysWithMarkers.contains(gatewayId)) {
//already has a marker for this gateway
} else {
MarkerOptions gwoptions = new MarkerOptions();
gwoptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.gateway_dot));
gwoptions.position(new LatLng(gwLat, gwLon));
gwoptions.title(gatewayId);
//gwoptions.snippet(gatewayId);
gwoptions.anchor((float) 0.5, (float) 0.5);
mMap.addMarker(gwoptions);
gatewaysWithMarkers.add(gatewayId);
}
}
}
}
示例2: onBeforeClusterRendered
import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
protected void onBeforeClusterRendered(Cluster<IssueMarker> cluster, MarkerOptions options) {
super.onBeforeClusterRendered(cluster, options);
// Cluster customization
Context context = mMap.getContext();
int clusterSize = cluster.getSize();
String clusterIconRes = "cluster1";
for (int i = 0; i < CLUSTER_THRESHOLDS.length; i++) {
int threshold = CLUSTER_THRESHOLDS[i];
if (clusterSize >= threshold) clusterIconRes = "cluster" + (i + 2);
}
mClusterIconGenerator.setBackground(getClusterIcon(context, clusterIconRes));
mClusterIconGenerator.setTextAppearance(R.style.ClusterIconText);
Bitmap sizeIcon = mClusterIconGenerator.makeIcon(String.valueOf(clusterSize));
options.icon(BitmapDescriptorFactory.fromBitmap(sizeIcon));
}
示例3: onLocationChanged
import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void onLocationChanged(Location location)
{
mLastLocation = location;
if (mCurrLocationMarker != null) {
mCurrLocationMarker.remove();
}
//Place current location marker
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(latLng);
markerOptions.title("Current Position");
markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA));
mCurrLocationMarker = mGoogleMap.addMarker(markerOptions);
//move map camera
mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng,11));
}
示例4: drawNext
import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
public Marker drawNext() {
MarkerOptions options = new MarkerOptions();
if (isFirstPop) {
options.position(path.getFirst().getStart());
options.icon(firstNodeIcon);
isFirstPop = false;
} else {
last = path.pop();
options.position(last.getEnd());
if (path.size() == 0) {
options.icon(lastNodeIcon);
} else {
options.icon(middleNodeIcon);
}
}
return map.addMarker(options);
}
示例5: ShowNearbyPlaces
import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
private void ShowNearbyPlaces(List<HashMap<String, String>> nearbyPlacesList) {
for (int i = 0; i < nearbyPlacesList.size(); i++) {
Log.d("onPostExecute","Entered into showing locations");
MarkerOptions markerOptions = new MarkerOptions();
HashMap<String, String> googlePlace = nearbyPlacesList.get(i);
double lat = Double.parseDouble(googlePlace.get("lat"));
double lng = Double.parseDouble(googlePlace.get("lng"));
String placeName = googlePlace.get("place_name");
String vicinity = googlePlace.get("vicinity");
LatLng latLng = new LatLng(lat, lng);
markerOptions.position(latLng);
markerOptions.title(placeName + " : " + vicinity);
mMap.addMarker(markerOptions);
markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED));
//move map camera
mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
mMap.animateCamera(CameraUpdateFactory.zoomTo(11));
}
}
示例6: createMarker
import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
private void createMarker(LatLng latLng, int position){
MarkerOptions mOptions = new MarkerOptions().position(latLng);
if(position == 1){
Log.i("position1",latLng.toString());
mOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
addCameraToMap(latLng);
mMap.addMarker(mOptions.title("My Location"));
}
else{
Log.i("position2",latLng.toString());
mOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_YELLOW));
addCameraToMap(latLng);
mMap.addMarker(mOptions.title("Tracked User's Location"));
}
}
示例7: onLocationChanged
import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void onLocationChanged(Location location) {
//place marker at current position
//mGoogleMap.clear();
if (currLocationMarker != null) {
currLocationMarker.remove();
}
latLng = new LatLng(location.getLatitude(), location.getLongitude());
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(latLng);
markerOptions.title(getString(R.string.current_position));
markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA));
currLocationMarker = mGoogleMap.addMarker(markerOptions);
//zoom to current position:
CameraPosition cameraPosition = new CameraPosition.Builder()
.target(latLng).zoom(14).build();
mGoogleMap.animateCamera(CameraUpdateFactory
.newCameraPosition(cameraPosition));
mMocketClient.pushLatLngToServer(latLng);
}
示例8: onPostExecute
import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
protected void onPostExecute(List<HashMap<String, String>> list) {
googleMap.clear();
for (int i = 0; i < list.size(); i++) {
MarkerOptions markerOptions = new MarkerOptions();
HashMap<String, String> googlePlace = list.get(i);
double lat = Double.parseDouble(googlePlace.get("lat"));
double lng = Double.parseDouble(googlePlace.get("lng"));
String placeName = googlePlace.get("place_name");
//String vicinity = googlePlace.get("vicinity");
LatLng latLng = new LatLng(lat, lng);
markerOptions.position(latLng);
markerOptions.title(placeName);
markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.custom_marker));
googleMap.addMarker(markerOptions);
}
}
示例9: onBeforeClusterItemRendered
import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
protected void onBeforeClusterItemRendered(CustomMarker item, MarkerOptions markerOptions) {
// Set the info window to show their name.
TextView tv = (TextView) mActivity.getLayoutInflater().inflate(R.layout.view_cluster_item, null);
tv.setText(item.getTitle());
mIconGenerator.setContentView(tv);
Bitmap icon = mIconGenerator.makeIcon();
markerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon));
}
示例10: onLocationChanged
import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void onLocationChanged(Location location) {
Log.d("onLocationChanged", "entered");
mLastLocation = location;
if (mCurrLocationMarker != null) {
mCurrLocationMarker.remove();
}
//Place current location marker
latitude = location.getLatitude();
longitude = location.getLongitude();
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(latLng);
markerOptions.title("Current Position");
markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA));
mCurrLocationMarker = mMap.addMarker(markerOptions);
//move map camera
mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
mMap.animateCamera(CameraUpdateFactory.zoomTo(18));
Log.d("onLocationChanged", String.format("latitude:%.3f longitude:%.3f",latitude,longitude));
//stop location updates
if (mGoogleApiClient != null) {
LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
Log.d("onLocationChanged", "Removing Location Updates");
}
Log.d("onLocationChanged", "Exit");
}
示例11: onLocationChanged
import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void onLocationChanged(Location location) {
Log.d("onLocationChanged", "entered");
mLastLocation = location;
if (mCurrLocationMarker != null) {
mCurrLocationMarker.remove();
}
//Place current location marker
latitude = location.getLatitude();
longitude = location.getLongitude();
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(latLng);
markerOptions.title("Current Position");
markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA));
mCurrLocationMarker = mMap.addMarker(markerOptions);
//move map camera
mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
mMap.animateCamera(CameraUpdateFactory.zoomTo(11));
Toast.makeText(MapsActivity2.this,"Your Current Location", Toast.LENGTH_LONG).show();
Log.d("onLocationChanged", String.format("latitude:%.3f longitude:%.3f",latitude,longitude));
//stop location updates
if (mGoogleApiClient != null) {
LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
Log.d("onLocationChanged", "Removing Location Updates");
}
Log.d("onLocationChanged", "Exit");
}
示例12: onLocationChanged
import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void onLocationChanged(Location location) {
Log.d("onLocationChanged", "entered");
mLastLocation = location;
if (mCurrLocationMarker != null) {
mCurrLocationMarker.remove();
}
//Place current location marker
latitude = location.getLatitude();
longitude = location.getLongitude();
LatLng latLng = new LatLng(latitude1, longitude1);
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(latLng);
markerOptions.title("Current Position");
markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA));
mCurrLocationMarker = mMap.addMarker(markerOptions);
//move map camera
mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
mMap.animateCamera(CameraUpdateFactory.zoomTo(11));
Toast.makeText(MapsActivity3.this,"Your Current Location", Toast.LENGTH_LONG).show();
Log.d("onLocationChanged", String.format("latitude:%.3f longitude:%.3f",latitude,longitude));
//stop location updates
if (mGoogleApiClient != null) {
LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
Log.d("onLocationChanged", "Removing Location Updates");
}
Log.d("onLocationChanged", "Exit");
}
示例13: addPointsToMapAsMarkers
import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
/**
* Add the list of points as markers
*
* @param map
* @param points
* @param customMarkerOptions
* @param ignoreIdenticalEnds
* @return
*/
public List<Marker> addPointsToMapAsMarkers(GoogleMap map,
List<LatLng> points, MarkerOptions customMarkerOptions,
boolean ignoreIdenticalEnds) {
List<Marker> markers = new ArrayList<Marker>();
for (int i = 0; i < points.size(); i++) {
LatLng latLng = points.get(i);
if (points.size() > 1 && i + 1 == points.size() && ignoreIdenticalEnds) {
LatLng firstLatLng = points.get(0);
if (latLng.latitude == firstLatLng.latitude
&& latLng.longitude == firstLatLng.longitude) {
break;
}
}
MarkerOptions markerOptions = new MarkerOptions();
if (customMarkerOptions != null) {
markerOptions.icon(customMarkerOptions.getIcon());
markerOptions.anchor(customMarkerOptions.getAnchorU(),
customMarkerOptions.getAnchorV());
markerOptions.draggable(customMarkerOptions.isDraggable());
}
Marker marker = addLatLngToMap(map, latLng, markerOptions);
markers.add(marker);
}
return markers;
}
示例14: onBeforeClusterItemRendered
import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
protected void onBeforeClusterItemRendered(MyItem item, MarkerOptions markerOptions) {
// markerOptions.icon(item.getMise_service());
// markerOptions.snippet(item.getSnippet());
// markerOptions.title(item.getMise_service().get(0));
markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_action_antenne));
super.onBeforeClusterItemRendered(item, markerOptions);
}
示例15: refreshZone
import com.google.android.gms.maps.model.MarkerOptions; //导入方法依赖的package包/类
/**
* Refreshes the polygon and label marker of the given zone according to zone's appearance options.
*
* @param zone zone object
*/
private void refreshZone(Zone zone) {
Pair<Marker,Polygon> markerAndPolygon = zoneVsMarkerAndPolygonMap.get(zone);
ZoneOptions zoneOptions = zone.getOptions();
//update polygon
Polygon p = markerAndPolygon.second;
PolygonOptions polygonOptions = zoneOptions.getPolygonOptions();
p.setStrokeColor(polygonOptions.getStrokeColor());
p.setStrokeWidth(polygonOptions.getStrokeWidth());
p.setFillColor(polygonOptions.getFillColor());
p.setGeodesic(polygonOptions.isGeodesic());
p.setHoles(polygonOptions.getHoles());
p.setVisible(polygonOptions.isVisible());
p.setZIndex(polygonOptions.getZIndex());
p.setClickable(polygonOptions.isClickable());
Log.i(TAG,"updated polygon id: "+p.getId());
//update label marker
Marker m = markerAndPolygon.first;
ZoneLabelOptions zoneLabelOptions = zoneOptions.getZoneLabelOptions();
MarkerOptions mO = zoneLabelOptions.getLabelMarkerOptions();
if(zoneLabelOptions.isDisplayLabel())
mO.icon(BitmapDescriptorFactory.fromBitmap(getLabelBitmap(zone.getName(),zoneLabelOptions)));
m.setIcon(mO.getIcon());
m.setZIndex(mO.getZIndex());
m.setVisible(mO.isVisible());
m.setAlpha(mO.getAlpha());
m.setAnchor(mO.getAnchorV(),mO.getAnchorU());
m.setDraggable(mO.isDraggable());
m.setFlat(mO.isFlat());
m.setInfoWindowAnchor(mO.getInfoWindowAnchorV(),mO.getInfoWindowAnchorU());
m.setRotation(mO.getRotation());
m.setSnippet(mO.getSnippet());
m.setTitle(zone.getName());
}