• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java PointQuadTree类的典型用法和代码示例

java 2次浏览

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

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

示例1: setWeightedData

点赞 2

import com.google.maps.android.quadtree.PointQuadTree; //导入依赖的package包/类
/**
 * Changes the dataset the heatmap is portraying. Weighted.
 * User should clear overlay's tile cache (using clearTileCache()) after calling this.
 *
 * @param data Data set of points to use in the heatmap, as LatLngs.
 *             Note: Editing data without calling setWeightedData again will not update the data
 *             displayed on the map, but will impact calculation of max intensity values,
 *             as the collection you pass in is stored.
 *             Outside of changing the data, max intensity values are calculated only upon
 *             changing the radius.
 */
public void setWeightedData(Collection<WeightedLatLng> data) {
    // Change point set
    mData = data;

    // Check point set is OK
    if (mData.isEmpty()) {
        throw new IllegalArgumentException("No input points.");
    }

    // Because quadtree bounds are final once the quadtree is created, we cannot add
    // points outside of those bounds to the quadtree after creation.
    // As quadtree creation is actually quite lightweight/fast as compared to other functions
    // called in heatmap creation, re-creating the quadtree is an acceptable solution here.

    // Make the quad tree
    mBounds = getBounds(mData);

    mTree = new PointQuadTree<WeightedLatLng>(mBounds);

    // Add points to quad tree
    for (WeightedLatLng l : mData) {
        mTree.add(l);
    }

    // Calculate reasonable maximum intensity for color scale (user can also specify)
    // Get max intensities
    mMaxIntensity = getMaxIntensities(mRadius);
}
 

开发者ID:runningcode,
项目名称:CUMtd,
代码行数:40,
代码来源:HeatmapTileProvider.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)