热图 - 生成简单“HeatPoint”谷歌地图Android版 [英] Heatmap - Generating Simple 'HeatPoint' Google Maps Android

查看:937
本文介绍了热图 - 生成简单“HeatPoint”谷歌地图Android版的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android SDK中2.3.3
谷歌地图V2

Android SDK 2.3.3 Google Maps V2

目前我画界重叠并将它们添加到一个图形页面。大小由一定的价值决定的,我期待用别的东西来决定圆的颜色的RadialGradient

Currently I'm drawing circles overlays and adding them to a MapView. The size is dictated by a certain value and I'm looking to determine the RadialGradient color of the circle by something else.

            circle.setShader(new RadialGradient(pt.x, pt.y, 40, Color.argb(150, 252, 5, 5), Color.argb(60, 234, 231, 0), TileMode.MIRROR));
            canvas.drawCircle(pt.x, pt.y, radius, circle);

它的工作原理,但我想preFER边缘看起来更类似于经典的heatpoint地图。

It works, however I'd prefer the edges to look more similar to the classic heatpoint map.

目前

想我实现(我还是很喜欢的形状是圆形的)

What I'd like to achieve (I'd still like the shape to be circular)

我在想可能是为了实现一个更典型的热图直视画圆目前下方有悦目面积较大,然而,这会对性能产生影响考虑,我有重新在移动设备上这样做每变焦​​-render或失去作用。

I'm thinking of possibly drawing a circle directly underneath the current with a sightly bigger area in order to achieve a more typical heatmap look, however this has performance implications considering I'm doing this on a mobile device which has to re-render per zoom in or out action.

推荐答案

有几个明显的选择这里,我敢肯定还有更多的非明显的方式做到这一点还有:

There are a few obvious options here, and I'm sure there are many more non-obvious ways to do this as well:

  • Draw multiple concentric circles as you suggested
  • Load a concentric circle pattern from an image and draw that (less rendering, but, of course, you have to load the image)
  • Use a BitmapShader to draw a single circle with a custom gradient that matches what you're looking for: http://developer.android.com/reference/android/graphics/BitmapShader.html

不幸的是,我不知道这些选项中会给你最好的性能,所以你可能必须自己进行测试。我怀疑,对于大量的热图点,后来的两个选项之一将更有效率,但是这只不过是一个猜测。

Unfortunately, I don't know which of these options will give you the best performance, so you'll probably have to test them yourself. I suspect that, for a large number of heatmap points, one of the later two options will be more efficient, but that's nothing more than a guess.

这篇关于热图 - 生成简单“HeatPoint”谷歌地图Android版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆