【发布时间】:2023-02-21 23:45:39
【问题描述】:
我正在尝试将可变列表转换为自定义对象列表以存储纬度和经度。
但是,我不确定转换是否正确
所以 Mutable List 被声明为 val coordinateArray: MutableList<MutableList<Double>> = mutableListOf()
这就是我转换它的方式
val pointList: MutableList<Point> = ArrayList()
for (i in coordinateArray.indices) {
val point = Point(i.toDouble(), (i+1).toDouble())
pointList.add(point)
}
val distance = 0.0001
val bufferedPolygonList: List<Point> = AreaBuffer.buffer(pointList, distance)
上面的代码生成一个缓冲多边形坐标列表。
在测试上面的坐标时,坐标是无穷大,这是不正确的。
如果我做错了什么,你能告诉我吗?
【问题讨论】:
标签: kotlin coordinates