当前位置: 首页>>代码示例>>Java>>正文


Java GoogleMap.addMarker方法代码示例

本文整理汇总了Java中com.google.android.gms.maps.GoogleMap.addMarker方法的典型用法代码示例。如果您正苦于以下问题:Java GoogleMap.addMarker方法的具体用法?Java GoogleMap.addMarker怎么用?Java GoogleMap.addMarker使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.gms.maps.GoogleMap的用法示例。


在下文中一共展示了GoogleMap.addMarker方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setMarkers

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
private void setMarkers(GoogleMap map, List<Restaurant> restaurants) {
    if (map == null) {
        return;
    }
    map.clear();
    MarkerOptions options = new MarkerOptions().position(
            new LatLng(Prefs.LastLatitude.getDouble(), Prefs.LastLongitude.getDouble()))
            .icon(BitmapDescriptorFactory.fromResource(R.drawable.current_location));
    map.addMarker(options);
    for (Restaurant restaurant : restaurants) {
        MarkerOptions markerOptions = new MarkerOptions().position(
                new LatLng(restaurant.mLatitude, restaurant.mLongitude))
                .title(restaurant.mName)
                .icon(BitmapDescriptorFactory.fromResource(R.drawable.restaurant_pin));
        Marker marker = map.addMarker(markerOptions);
        marker.setTag(restaurant);
    }
    mMap.setOnInfoWindowClickListener(mInfoWindowClickListener);
}
 
开发者ID:boldijar,项目名称:today-menu-android,代码行数:20,代码来源:RestaurantsMapFragment.java

示例2: addTag

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
private void addTag(Context context, GoogleMap map, TagModel item, boolean addCache) {
    LatLng location = new LatLng(item.getLatitude(), item.getLongitude());
    BitmapDescriptor tagIcon = getTagIcon(item.getRoadCondition());
    Marker marker = map.addMarker(new MarkerOptions()
            .position(location)
            .icon(tagIcon)
            .anchor(0.5f, 0.5f)
            .title(item.getName())
            .snippet(item.getDescription()));
    if (addCache && markersCache != null) {
        markersCache.put(marker, item);
    }
}
 
开发者ID:WorldBank-Transport,项目名称:RoadLab-Pro,代码行数:14,代码来源:MeasurementsGoogleMapHelper.java

示例3: onMapReady

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
/**
 * Run this code when the map has been loaded and is ready
 * @param googleMap the map
 */
@Override
public void onMapReady(GoogleMap googleMap) {
    map = googleMap;
    googleMap.setLatLngBoundsForCameraTarget(null);
    googleMap.setMinZoomPreference(6.0f);
    // Add a marker in Sydney, Australia,
    // and move the map's camera to the same location.

    if(location != null) {
        LatLng loc = new LatLng(location.getLatitude(), location.getLongitude());
        map.addMarker(new MarkerOptions().position(loc)
                .title("Location"));
        map.moveCamera(CameraUpdateFactory.newLatLng(loc));
    } else {
        LatLng sydney = new LatLng(-33.852, 151.211);
        googleMap.addMarker(new MarkerOptions().position(sydney)
                .title("Location"));
        googleMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
    }
}
 
开发者ID:CMPUT301F17T13,项目名称:cat-is-a-dog,代码行数:25,代码来源:AddHabitEventActivity.java

示例4: onMapReady

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
@Override
public void onMapReady(final GoogleMap googleMap) {
    googleMap.setMyLocationEnabled(true);
    googleMap.getUiSettings().setMyLocationButtonEnabled(true);
    googleMap.getUiSettings().setMapToolbarEnabled(false);
    LatLng latLng = mPointOfInterest.latLng;
    if (latLng != null) {
        googleMap.addMarker(new MarkerOptions().position(latLng)
                .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)));
        googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 16f));
    }
}
 
开发者ID:sathishmscict,项目名称:Pickr,代码行数:13,代码来源:DetailActivity.java

示例5: onMapReady

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
    float zoomLevel = (float) 16.0;
    LatLng coordenadas = new LatLng(evento.getLatitud(), evento.getLongitud());
    googleMap.addMarker(new MarkerOptions().position(coordenadas).title(evento.getTitulo()));
    googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(coordenadas, zoomLevel));
}
 
开发者ID:ur13l,项目名称:Guanajoven,代码行数:8,代码来源:DetalleEventoFragment.java

示例6: onMapReady

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
    float zoomLevel = (float) 16.0;
    LatLng coordenadas = new LatLng(region.getLatitud(), region.getLongitud());
    googleMap.addMarker(new MarkerOptions().position(coordenadas).title(region.getNombre()));
    googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(coordenadas, zoomLevel));
}
 
开发者ID:ur13l,项目名称:Guanajoven,代码行数:8,代码来源:DetalleRegionFragment.java

示例7: setIntersection

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
private static void setIntersection(Context context, GoogleMap gMap, LatLng latLng) {
    Marker marker = gMap.addMarker(new MarkerOptions().position(latLng).icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_arrow)));
    mIntersectingToClear.add(marker);
    DatabaseHelper myDb = DatabaseHelper.getInstance(context);
    myDb.saveIntersections(mIntersecting);
    myDb.close();
}
 
开发者ID:kav0rka,项目名称:VennTracker,代码行数:8,代码来源:Circles.java

示例8: setSpawnPoint

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
public static void setSpawnPoint(final Context context, final GoogleMap googleMap, final LatLng latLng){
    Marker marker = googleMap.addMarker(new MarkerOptions()
            .position(latLng));
    marker.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
    mSpawnPoints.add(marker);
    // Put location into the database as 2 doubles with type Spawn Location.
    DatabaseHelper myDb = DatabaseHelper.getInstance(context);
    myDb.addLocation("Spawn Location", latLng.latitude, latLng.longitude, "No Description");
    myDb.close();
}
 
开发者ID:kav0rka,项目名称:VennTracker,代码行数:11,代码来源:SpawnLocation.java

示例9: showSpawnLocations

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
private static void showSpawnLocations(GoogleMap googleMap, LatLng latLng, String description, String time) {
    Marker marker = googleMap.addMarker(new MarkerOptions().position(latLng));
    marker.setSnippet(description);
    marker.setTag(time + "");
    marker.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
    mSpawnPoints.add(marker);
    if (marker.getTag() != "") {
        mSpawnPointTimes.add(marker);
    }
}
 
开发者ID:kav0rka,项目名称:VennTracker,代码行数:11,代码来源:SpawnLocation.java

示例10: addAllMarkers

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
/**
 * Adds a marker for each event with a location.
 * @param map
 */
private void addAllMarkers(GoogleMap map){
    for (HabitEvent e:events){
        if ((e.getLat()!=null && e.getLong()!=null) && (e.getLat()!=0 && e.getLong()!=0)){
            map.addMarker(new MarkerOptions()
                    .position(new LatLng(e.getLat(), e.getLong()))
                    .title(e.getHabitType()));
        }
    }
}
 
开发者ID:CMPUT301F17T09,项目名称:GoalsAndHabits,代码行数:14,代码来源:MyHabitsMapActivity.java

示例11: onMapReady

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
    CameraPosition cameraPosition = new CameraPosition.Builder()
            .target(new LatLng(eve.getPlace().getLat(),eve.getPlace().getLon()))
            .zoom(17)
            .bearing(0)
            .tilt(80)
            .build();
    googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
    googleMap.addMarker(new MarkerOptions().position(new LatLng(eve.getPlace().getLat(),eve.getPlace().getLon())));
}
 
开发者ID:picopalette,项目名称:event-me,代码行数:12,代码来源:EventDisplayActivity.java

示例12: addImageMarker

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
private void addImageMarker(MFBImageInfo mfbii, LatLngBounds.Builder llb) {
    Bitmap bmap = MFBImageInfo.getRoundedCornerBitmap(mfbii.bitmapFromThumb(), Color.LTGRAY, RadiusImage, BorderImage, DimensionImageOverlay, DimensionImageOverlay, ActFlightMap.this);

    Marker m;

    GoogleMap map = getMap();
    if (map != null && (m = map.addMarker(new MarkerOptions()
            .position(mfbii.Location.getLatLng())
            .title(mfbii.Comment)
            .icon(BitmapDescriptorFactory.fromBitmap(bmap)))) != null) {
        m_hmImages.put(m.getId(), mfbii);
        if (llb != null)
            llb.include(mfbii.Location.getLatLng());
    }
}
 
开发者ID:ericberman,项目名称:MyFlightbookAndroid,代码行数:16,代码来源:ActFlightMap.java

示例13: setUpMap

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
public void setUpMap(GoogleMap googleMap) {

		LatLng pinPosition = new LatLng(rack.getLatitude(), rack.getLongitude());
		googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(pinPosition, 18));
		googleMap.addMarker(new MarkerOptions()
				.position(pinPosition)
				.icon(AssetHelper.getCustomPin(rack.getAverageRating(), false)));
	}
 
开发者ID:EduardoVernier,项目名称:bikedeboa-android,代码行数:9,代码来源:DetailViewModel.java

示例14: addBump

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
private void addBump(Context context, GoogleMap map, BumpModel item, boolean addCache) {
    LatLng location = new LatLng(item.getLatitude(), item.getLongitude());
    if (bumpIcon == null) {
        bumpIcon = BitmapDescriptorFactory.fromResource(R.drawable.ic_map_bump_red);
    }
    Marker marker = map.addMarker(new MarkerOptions()
            .position(location)
            .icon(bumpIcon)
            .anchor(0.5f, 0.5f)
            .title(item.getName())
            .snippet(item.getDescription()));
    if (addCache && markersCache != null) {
        markersCache.put(marker, item);
    }
}
 
开发者ID:WorldBank-Transport,项目名称:RoadLab-Pro,代码行数:16,代码来源:MeasurementsGoogleMapHelper.java

示例15: onMapReady

import com.google.android.gms.maps.GoogleMap; //导入方法依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
    Marker marker = googleMap.addMarker(new MarkerOptions().position(location)
            .title(descriptionString));
    marker.showInfoWindow();
    googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(location, 20));
}
 
开发者ID:kev5,项目名称:GoMeet,代码行数:8,代码来源:MapsMarkerActivity.java


注:本文中的com.google.android.gms.maps.GoogleMap.addMarker方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。