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


Java DefaultClusterRenderer类代码示例

本文整理汇总了Java中com.google.maps.android.clustering.view.DefaultClusterRenderer的典型用法代码示例。如果您正苦于以下问题:Java DefaultClusterRenderer类的具体用法?Java DefaultClusterRenderer怎么用?Java DefaultClusterRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DefaultClusterRenderer类属于com.google.maps.android.clustering.view包,在下文中一共展示了DefaultClusterRenderer类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupClusterManager

import com.google.maps.android.clustering.view.DefaultClusterRenderer; //导入依赖的package包/类
private void setupClusterManager() {
        // reference

        // clustering
        if(mMap!=null) {
            mClusterManager = new ClusterManager<>(getActivity(), mMap);
            mClusterManager.setRenderer(new DefaultClusterRenderer<Hotel>(getActivity(), mMap, mClusterManager) {
                @Override
                protected void onBeforeClusterItemRendered(Hotel item, MarkerOptions markerOptions) {
                    int size = getActivity().getResources().getDimensionPixelSize(R.dimen.fragment_map_marker_size);
                    Bitmap originalBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.markerfield);
                    Bitmap bitmap = BitmapScaler.scaleToFill(originalBitmap, size, size);
                    if(originalBitmap!=bitmap){
                        originalBitmap.recycle();
                    }

                    BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(bitmap);
                    markerOptions.title(item.getName());
                    markerOptions.icon(bitmapDescriptor);
                    markerOptions.snippet(""+item.getPrice());

                    super.onBeforeClusterItemRendered(item, markerOptions);
                }
            });
            mClusterManager.setOnClusterItemInfoWindowClickListener(new ClusterManager.OnClusterItemInfoWindowClickListener<Hotel>() {
                @Override
                public void onClusterItemInfoWindowClick(Hotel i)
                {
                    getActivity().finish();
//                    Toast.makeText(getActivity(), "Action", Toast.LENGTH_SHORT).show();
                }
            });
//            mMap.setOnCameraMoveCanceledListener(m);
            //setOnCameraChangeListener(mClusterManager);
            mMap.setOnInfoWindowClickListener(mClusterManager);
            renderView();
        }
    }
 
开发者ID:Elbehiry,项目名称:Viajes,代码行数:39,代码来源:MapFragment.java

示例2: ClusterManager

import com.google.maps.android.clustering.view.DefaultClusterRenderer; //导入依赖的package包/类
public ClusterManager(Context context, GoogleMap map, MarkerManager markerManager) {
    mMap = map;
    mMarkerManager = markerManager;
    mClusterMarkers = markerManager.newCollection();
    mMarkers = markerManager.newCollection();
    mRenderer = new DefaultClusterRenderer<T>(context, map, this);
    mAlgorithm = new PreCachingAlgorithmDecorator<T>(new NonHierarchicalDistanceBasedAlgorithm<T>());
    mClusterTask = new ClusterTask();
    mRenderer.onAdd();
}
 
开发者ID:dklisiaris,项目名称:downtown,代码行数:11,代码来源:ClusterManager.java


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