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


Java Cluster.getItems方法代码示例

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


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

示例1: onClusterClick

import com.google.maps.android.clustering.Cluster; //导入方法依赖的package包/类
@Override
public boolean onClusterClick(Cluster<CustomMarker> cluster) {
    // Zoom in the cluster. Need to create LatLngBounds and including all the cluster items
    // inside of bounds, then animate to center of the bounds.
    // Create the builder to collect all essential cluster items for the bounds.
    LatLngBounds.Builder builder = LatLngBounds.builder();
    for (CustomMarker item : cluster.getItems()) {
        builder.include(item.getPosition());
    }
    // Get the LatLngBounds
    final LatLngBounds bounds = builder.build();

    // Animate camera to the bounds
    try {
        mMap.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 150));
    } catch (Exception e) {
        e.printStackTrace();
    }

    return true;
}
 
开发者ID:typebrook,项目名称:FiveMinsMore,代码行数:22,代码来源:CustomRenderer.java

示例2: onClusterClick

import com.google.maps.android.clustering.Cluster; //导入方法依赖的package包/类
@Override
public boolean onClusterClick(Cluster<Asset> cluster) {
    // Show a toast with some info when the cluster is clicked.
    String firstName = cluster.getItems().iterator().next().name;
    Toast.makeText(this, cluster.getSize() + " (including " + firstName + ")", Toast.LENGTH_SHORT).show();

    // Zoom in the cluster. Need to create LatLngBounds and including all the cluster items
    // inside of bounds, then animate to center of the bounds.

    // Create the builder to collect all essential cluster items for the bounds.
    LatLngBounds.Builder builder = LatLngBounds.builder();
    for (ClusterItem item : cluster.getItems()) {
        builder.include(item.getPosition());
    }
    // Get the LatLngBounds
    final LatLngBounds bounds = builder.build();

    // Animate camera to the bounds
    try {
        getMap().animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 100));
    } catch (Exception e) {
        e.printStackTrace();
    }

    return true;
}
 
开发者ID:aminyazdanpanah,项目名称:google-maps-3D-pie-chart-marker-clustering-java,代码行数:27,代码来源:DemoActivity.java

示例3: onClusterClick

import com.google.maps.android.clustering.Cluster; //导入方法依赖的package包/类
/**
 * 
 */
@Override
public boolean onClusterClick(Cluster<MyItem> cluster) {
    
    /*
     * Calculate geographic area of cluster.
     */
    
    LatLngBounds.Builder builder = LatLngBounds.builder();
    
    Collection<MyItem> ci = cluster.getItems();
    for(MyItem item : ci) {
        builder.include(item.getPosition());
    }
   
    CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngBounds(builder.build(), 0);
    map.moveCamera(cameraUpdate);
    
    return false;
}
 
开发者ID:apps4av,项目名称:alerttown,代码行数:23,代码来源:MainActivity.java

示例4: onBeforeClusterRendered

import com.google.maps.android.clustering.Cluster; //导入方法依赖的package包/类
@Override
protected void onBeforeClusterRendered(Cluster<Person> cluster, MarkerOptions markerOptions) {
    // Draw multiple people.
    // Note: this method runs on the UI thread. Don't spend too much time in here (like in this example).
    List<Drawable> profilePhotos = new ArrayList<Drawable>(Math.min(4, cluster.getSize()));
    int width = mDimension;
    int height = mDimension;

    for (Person p : cluster.getItems()) {
        // Draw 4 at most.
        if (profilePhotos.size() == 4) break;
        Drawable drawable = getResources().getDrawable(p.profilePhoto);
        drawable.setBounds(0, 0, width, height);
        profilePhotos.add(drawable);
    }
    MultiDrawable multiDrawable = new MultiDrawable(profilePhotos);
    multiDrawable.setBounds(0, 0, width, height);

    mClusterImageView.setImageDrawable(multiDrawable);
    Bitmap icon = mClusterIconGenerator.makeIcon(String.valueOf(cluster.getSize()));
    markerOptions.icon(BitmapDescriptorFactory.fromBitmap(icon));
}
 
开发者ID:googlemaps,项目名称:android-maps-utils,代码行数:23,代码来源:CustomMarkerClusteringDemoActivity.java

示例5: onClusterClick

import com.google.maps.android.clustering.Cluster; //导入方法依赖的package包/类
@Override
public boolean onClusterClick(Cluster<Person> cluster) {
    // Show a toast with some info when the cluster is clicked.
    String firstName = cluster.getItems().iterator().next().name;
    Toast.makeText(this, cluster.getSize() + " (including " + firstName + ")", Toast.LENGTH_SHORT).show();

    // Zoom in the cluster. Need to create LatLngBounds and including all the cluster items
    // inside of bounds, then animate to center of the bounds.

    // Create the builder to collect all essential cluster items for the bounds.
    LatLngBounds.Builder builder = LatLngBounds.builder();
    for (ClusterItem item : cluster.getItems()) {
        builder.include(item.getPosition());
    }
    // Get the LatLngBounds
    final LatLngBounds bounds = builder.build();

    // Animate camera to the bounds
    try {
        getMap().animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 100));
    } catch (Exception e) {
        e.printStackTrace();
    }

    return true;
}
 
开发者ID:googlemaps,项目名称:android-maps-utils,代码行数:27,代码来源:CustomMarkerClusteringDemoActivity.java

示例6: onClusterClick

import com.google.maps.android.clustering.Cluster; //导入方法依赖的package包/类
@Override
public boolean onClusterClick(Cluster<EntryMarker> entryMarkerCluster) {
    Log.d("", "onClusterClick()");
    ArrayList<Entry> entries = new ArrayList<>();

    for ( EntryMarker marker : entryMarkerCluster.getItems())
        entries.add(marker.entry);

    mListDialog.setData(entries);
    mListDialog.show(getFragmentManager(), "EntryListDialogFragment");

    return true;
}
 
开发者ID:timothymiko,项目名称:narrate-android,代码行数:14,代码来源:PlacesFragment.java

示例7: onClusterInfoWindowClick

import com.google.maps.android.clustering.Cluster; //导入方法依赖的package包/类
@Override
public void onClusterInfoWindowClick(Cluster<DB_Location_NoeC> cluster) {
    // Does nothing, but you could go to a list of the users.

    LatLngBounds.Builder builder = new LatLngBounds.Builder();
    for (DB_Location_NoeC marker : cluster.getItems()) {
        builder.include(marker.getPosition());
    }
    LatLngBounds bounds = builder.build();
    int padding = 60;
    CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, padding);
    mMap.animateCamera(cu);
}
 
开发者ID:derqurps,项目名称:noefinderlein,代码行数:14,代码来源:Activity_Map.java

示例8: onBeforeClusterRendered

import com.google.maps.android.clustering.Cluster; //导入方法依赖的package包/类
@Override
protected void onBeforeClusterRendered(final Cluster<GmaItem> cluster, final MarkerOptions markerOptions) {
    super.onBeforeClusterRendered(cluster, markerOptions);
    markerOptions.anchor(0.5F, 0.5F);
    int churches = 0;
    int trainings = 0;
    for (final GmaItem item : cluster.getItems()) {
        if (item instanceof ChurchItem) {
            churches++;
        } else if (item instanceof TrainingItem) {
            trainings++;
        }
    }

    // generate the title for this cluster
    final StringBuilder title = new StringBuilder();
    if(churches > 0) {
        title.append(churches).append(" Churches");
    }
    if(trainings > 0) {
        if(title.length() > 0) {
            title.append(" and ");
        }
        title.append(trainings).append(" training activities");
    }
    markerOptions.title(title.toString());
}
 
开发者ID:GlobalTechnology,项目名称:gma-android,代码行数:28,代码来源:GmaRenderer.java

示例9: onClusterClick

import com.google.maps.android.clustering.Cluster; //导入方法依赖的package包/类
@Override
public boolean onClusterClick(Cluster<Stolperstein> cluster) {
    ArrayList<Stolperstein> stolpersteine = new ArrayList<Stolperstein>(cluster.getItems());
    if (stolpersteine.size() > 1) {
        startActivity(CardsActivity.createIntent(this, stolpersteine));
    } else {
        Stolperstein stolperstein = stolpersteine.get(0);
        onClusterItemClick(stolperstein);
    }

    return false;
}
 
开发者ID:Stolpersteine,项目名称:stolpersteine-android,代码行数:13,代码来源:MapActivity.java

示例10: onBeforeClusterRendered

import com.google.maps.android.clustering.Cluster; //导入方法依赖的package包/类
@Override
protected void onBeforeClusterRendered(Cluster<DB_Location_NoeC> cluster, MarkerOptions markerOptions) {
    // Draw multiple people.
    // Note: this method runs on the UI thread. Don't spend too much time in here (like in this example).
    /*List<Drawable> profilePhotos = new ArrayList<Drawable>(Math.min(4, cluster.getSize()));
    int width = mDimension;
    int height = mDimension;

    for (Person p : cluster.getItems()) {
        // Draw 4 at most.
        if (profilePhotos.size() == 4) break;
        Drawable drawable = getResources().getDrawable(p.profilePhoto);
        drawable.setBounds(0, 0, width, height);
        profilePhotos.add(drawable);
    }
    MultiDrawable multiDrawable = new MultiDrawable(profilePhotos);
    multiDrawable.setBounds(0, 0, width, height);

    mClusterImageView.setImageDrawable(multiDrawable);
    Bitmap icon = mClusterIconGenerator.makeIcon(String.valueOf(cluster.getSize()));*/
    boolean useOpenData = this.prefs.getBoolean(Activity_Settings.KEY_PREF_LOAD_OPEN_DATA, false);
    String idstring = "";
    int iterator = 0;
    int active = 0;
    int notactive = 0;
    for (DB_Location_NoeC loc : cluster.getItems()) {
        idstring += String.valueOf(loc.getId());
        if(iterator<cluster.getSize()-1) {
            idstring += ";";
        }
        if(loc.getTodayActive()) {
            active ++;
        } else {
            notactive ++;
        }
        iterator++;
    }
    if(iterator == active && useOpenData) {
        // all active
        markerOptions.icon(BitmapDescriptorFactory.fromResource(R.mipmap.ic_noe_multimarker_active));
    } else if(iterator == notactive && useOpenData) {
        // all not active
        markerOptions.icon(BitmapDescriptorFactory.fromResource(R.mipmap.ic_noe_multimarker_inactive));
    } else {
        // mixed
        markerOptions.icon(BitmapDescriptorFactory.fromResource(R.mipmap.ic_noe_multimarker_mixed));
    }
    markerOptions.snippet(idstring);

}
 
开发者ID:derqurps,项目名称:noefinderlein,代码行数:51,代码来源:Activity_Map.java


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