问题描述
我正在尝试在地图中插入更多折线选项,我想放置3个条件,然后根据它们选择线条的颜色。 有了代码,我可以看到正确的地图部分,但没有显示任何行。 有人知道如何帮助我吗?
override fun onMapReady(p0: GoogleMap?) {
googleMap = p0
val bc = LatLngBounds.Builder()
val points: ArrayList<LatLng> = ArrayList()
val locations: ArrayList<Location> = ArrayList()
val polypoint : ArrayList<PolylineOptions> = ArrayList()
googleMap!!.setOnMapLoadedCallback {
foo.bar.forEachIndexed {fooIndex,step ->
bar.asd.forEachIndexed { index,location ->
asd.add(location)
for (point: Location in asd) {
val list = foo.bar[fooIndex]!!.asd.chunked(2)
if (index < list.size) {
val value = getValue()
if (value >= 0 && value < 70) {
googleMap!!.addPolyline(PolylineOptions()
.add(LatLng(point.latitude,point.longitude),LatLng(point.latitude,point.longitude))
.width(14f)
.color(Color.GREEN))
} else if (value >= 70 && value < 150) {
googleMap!!.addPolyline(PolylineOptions()
.add(LatLng(point.latitude,point.longitude))
.width(14f)
.color(Color.YELLOW))
} else {
googleMap!!.addPolyline(PolylineOptions()
.add(LatLng(point.latitude,point.longitude))
.width(14f)
.color(Color.RED))
}
}
}
points.add(LatLng(location.latitude,location.longitude))
bc.include(LatLng(location.latitude,location.longitude))
}
}
if (points.size != 0) {
if (points.size < 2) {
bc.include(points[0])
bc.include(points[points.size - 1])
}
googleMap!!.moveCamera(CameraUpdateFactory.newLatLngBounds(bc.build(),60))
}
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)