增加道路名显示和详细信息功能

This commit is contained in:
squallzhjch
2023-06-21 10:10:21 +08:00
parent 1fe90ccf26
commit 7b4229d756
16 changed files with 413 additions and 33 deletions

View File

@@ -1,9 +1,12 @@
package com.navinfo.omqs.ui.widget
import android.util.Log
import com.google.gson.Gson
import com.navinfo.collect.library.data.entity.RenderEntity
import com.navinfo.omqs.R
import com.navinfo.omqs.bean.RoadNameBean
import com.navinfo.omqs.bean.SignBean
import org.json.JSONArray
class SignUtil {
companion object {
@@ -329,5 +332,43 @@ class SignUtil {
}
return stringBuffer.toString()
}
fun getRoadNameList(data: RenderEntity): MutableList<RoadNameBean> {
val list = mutableListOf<RoadNameBean>()
if (data.code == 2011) {
try {
val shapeStr = data.properties["shapeList"]
val array = JSONArray(shapeStr)
for (i in 0 until array.length()) {
val jsonObject = array.getJSONObject(0)
val name = jsonObject.optString("name", "")
val type = jsonObject.optInt("nameType", 0)
val seqNum = jsonObject.optInt("seqNum", 1)
val nameClass = jsonObject.optInt("nameClass", 1)
val bean = RoadNameBean(
name = name,
type = type,
seqNum = seqNum,
nameClass = nameClass
)
list.add(bean)
}
/**
* 排序
*/
list.sortWith { n1, n2 ->
if (n1.nameClass != n2.nameClass) {
n1.nameClass.compareTo(n2.nameClass)
} else {
n1.seqNum.compareTo(n2.seqNum)
}
}
} catch (e: Exception) {
}
}
return list
}
}
}