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


Java Marker.setTag方法代码示例

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


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

示例1: setMarkers

import com.google.android.gms.maps.model.Marker; //导入方法依赖的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: drawOnMap

import com.google.android.gms.maps.model.Marker; //导入方法依赖的package包/类
private Marker drawOnMap(Integer pointId){
        //Bitmap btmp = BitmapFactory.decodeResource(activityContext.getResources(), icons.get(getPos()));
        // Bitmap resizedBitmap = getMarker(pointId, activityContext);
    
        Marker marker = map.addMarker(new MarkerOptions()
                //.title(getPos() + " | " + getName())
                .title(getName())
                .snippet(getTitle())
                .position(coordinates)
                .anchor((float)0.5, (float)0.5)
                .infoWindowAnchor((float)0.5, (float)0.2)
                //.icon(BitmapDescriptorFactory.fromBitmap(btmp)));
//                .icon(BitmapDescriptorFactory.fromBitmap(resizedBitmap)));
                .icon(bitmapDescriptorFromVector(activityContext, getMarker(pointId, activityContext))));
        // Storing the Point ID
        marker.setTag(getIdPoint().toString());
        
        return marker;
    }
 
开发者ID:stefanonicolai,项目名称:AstronomyTourPadova,代码行数:20,代码来源:AtMarker.java

示例3: refreshMarkers

import com.google.android.gms.maps.model.Marker; //导入方法依赖的package包/类
private void refreshMarkers() {
//        if (allMarkers.size() == allTrips.size()) return;
        LatLngBounds.Builder boundBuilder = new LatLngBounds.Builder();
        allMarkers.clear();
        gMap.clear();
        for (Trip t : allTrips) {
            DateTime begDate = DateTime.parse(t.getStartDate());
            DateTime endDate = DateTime.parse(t.getEndDate());
            LatLng thisLoc = new LatLng(t.getLat(), t.getLng());
            Marker m = gMap.addMarker(
                    new MarkerOptions().position(thisLoc).title(t.getName())
                            .snippet(formatDate(begDate, endDate)));
            m.setTag(t);
            allMarkers.add(m);
            boundBuilder.include(thisLoc);
        }
        if (allMarkers.size() > 0) {
            int screenWidth = getResources().getDisplayMetrics().widthPixels;
            int screenHeight = getResources().getDisplayMetrics().heightPixels;
            LatLngBounds bound = boundBuilder.build();
            CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngBounds(bound,
                    screenWidth, screenHeight, 56);
            gMap.animateCamera(cameraUpdate);
        }
    }
 
开发者ID:gvsucis,项目名称:mobile-app-dev-book,代码行数:26,代码来源:TripMapFragment.java

示例4: settaMarkersGiaPresenti

import com.google.android.gms.maps.model.Marker; //导入方法依赖的package包/类
/**
 * Imposta un marker per ogni parcheggio già presente in zona
 */
void settaMarkersGiaPresenti() {
    // rimuovi tutti i markers
    for(Marker m : mMarkerListPresenti)
        m.remove();
    mMarkerListPresenti.clear();

    // aggiungi un marker per ogni posizione
    for (Parcheggio p : ElencoParcheggi.getInstance().getListParcheggi()) {
        LatLng coordParcheggio = p.getCoordinate();

        Marker marker = mMappa.addMarker(new MarkerOptions()
                .position(coordParcheggio)
                .title(p.getIndirizzo())
                .icon(BitmapDescriptorFactory.defaultMarker(138)));

        // Associo al marker un tag che corrisponde al parcheggio in questo modo posso
        // poi eliminarlo direttamente
        marker.setTag(p);

        mMarkerListPresenti.add(marker);
    }
    mMainActivity.modificaTxtMarkerPresenti(ElencoParcheggi.getInstance().getListParcheggi().size());
}
 
开发者ID:IelloDevTeam,项目名称:IelloAndroidAdminApp,代码行数:27,代码来源:MappaGoogle.java

示例5: showSpawnLocations

import com.google.android.gms.maps.model.Marker; //导入方法依赖的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

示例6: collectLocationsAndPutOnMap

import com.google.android.gms.maps.model.Marker; //导入方法依赖的package包/类
private void collectLocationsAndPutOnMap(Map<String, Object> servings) {

        //iterate through each user, ignoring their UID
        for (Map.Entry<String, Object> entry : servings.entrySet()) {

            //Get user map
            singleUser = (Map) entry.getValue();
            //Get phone field and append to list

            latitudes.add((Double) singleUser.get("latitude"));
            longitudes.add((Double) singleUser.get("longitude"));
            keys.add((String) singleUser.get("key"));
            userIds.add((String) singleUser.get("userId"));
            //amount.add((Double) singleUser.get("price"));


            titles.add((String) singleUser.get("title"));
        }

        for (int i = 0; i < latitudes.size(); i++) {
            LatLng aLocation = new LatLng(
                    latitudes.get(i), longitudes.get(i)
            );


            BitmapDrawable bitmapdraw=(BitmapDrawable)getResources().getDrawable(R.drawable.wii);
            Bitmap b=bitmapdraw.getBitmap();
            Bitmap smallMarker = Bitmap.createScaledBitmap(b, 150, 150, false);

            Marker marker =  googleMap.addMarker(new MarkerOptions()
                    .position(aLocation)
                    .title(titles.get(i))
                    .icon(BitmapDescriptorFactory.
                            fromBitmap(smallMarker))

            );
            marker.setTag(keys.get(i));
            marker.showInfoWindow();
        /*googleMap.addMarker(new MarkerOptions()
                .position(new LatLng(
                        20, -25))
                .title("fake location"));*/

        }

    }
 
开发者ID:thandomy,项目名称:foodie,代码行数:47,代码来源:HomeActivity.java


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