Merge branch 'master' of gitlab.navinfo.com:CollectVehicle/OneMapQS
Conflicts: app/src/main/java/com/navinfo/omqs/db/RealmOperateHelper.kt app/src/main/java/com/navinfo/omqs/ui/activity/map/MainActivity.kt app/src/main/java/com/navinfo/omqs/ui/activity/map/MainViewModel.kt vtm
This commit is contained in:
@@ -30,6 +30,9 @@ import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.flow
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.locationtech.jts.geom.Geometry
|
||||
import org.locationtech.jts.geom.GeometryFactory
|
||||
import org.locationtech.jts.geom.LineString
|
||||
import org.locationtech.jts.geom.MultiLineString
|
||||
import org.spatialite.database.SQLiteDatabase
|
||||
import java.io.File
|
||||
import javax.inject.Inject
|
||||
@@ -183,15 +186,23 @@ class ImportOMDBHelper @AssistedInject constructor(
|
||||
tableNum += importConfig.tableMap.size
|
||||
}
|
||||
//缓存任务link信息,便于下面与数据进行任务link匹配
|
||||
val hashMap: HashMap<Long, HadLinkDvoBean> =
|
||||
HashMap<Long, HadLinkDvoBean>() //define empty hashmap
|
||||
val hashMap: HashMap<Long, HadLinkDvoBean> = HashMap<Long, HadLinkDvoBean>()
|
||||
|
||||
val lineList = arrayOfNulls<LineString>(task.hadLinkDvoList.size)
|
||||
var index = 0
|
||||
task.hadLinkDvoList.forEach {
|
||||
hashMap[it.linkPid.toLong()] = it;
|
||||
hashMap[it.linkPid.toLong()] = it
|
||||
lineList[index] = GeometryTools.createGeometry(it.geometry) as LineString
|
||||
index++
|
||||
}
|
||||
|
||||
val resHashMap: HashMap<String, RenderEntity> =
|
||||
HashMap<String, RenderEntity>() //define empty hashmap
|
||||
try {
|
||||
|
||||
var multipLine = MultiLineString(lineList, GeometryFactory())
|
||||
|
||||
|
||||
// 遍历解压后的文件,读取该数据返回
|
||||
Log.d("ImportOMDBHelper", "表解析===开始时间$dataImportTime===")
|
||||
|
||||
@@ -249,7 +260,7 @@ class ImportOMDBHelper @AssistedInject constructor(
|
||||
renderEntity.geometry = map["geometry"].toString()
|
||||
Log.d("ImportOMDBHelper", "解析===1处理3D")
|
||||
// 其他数据插入到Properties中
|
||||
if (!currentConfig.is3D) { // 如果是非3d要素,则自动将Z轴坐标全部置为0
|
||||
/* if (!currentConfig.is3D) { // 如果是非3d要素,则自动将Z轴坐标全部置为0
|
||||
val coordinates =
|
||||
renderEntity.wkt?.coordinates?.map { coordinate ->
|
||||
coordinate.z = 0.0
|
||||
@@ -271,7 +282,7 @@ class ImportOMDBHelper @AssistedInject constructor(
|
||||
if (newGeometry != null) {
|
||||
renderEntity.geometry = newGeometry.toString()
|
||||
}
|
||||
}
|
||||
}*/
|
||||
Log.d("ImportOMDBHelper", "解析===2处理3D")
|
||||
Log.d("ImportOMDBHelper", "解析===1处理属性")
|
||||
for ((key, value) in map) {
|
||||
@@ -391,6 +402,7 @@ class ImportOMDBHelper @AssistedInject constructor(
|
||||
|
||||
Log.d("ImportOMDBHelper", "解析===2处理杆状物")
|
||||
Log.d("ImportOMDBHelper", "解析===1任务路线匹配")
|
||||
|
||||
//遍历判断只显示与任务Link相关的任务数据
|
||||
if (currentConfig.checkLinkId) {
|
||||
|
||||
@@ -484,7 +496,19 @@ class ImportOMDBHelper @AssistedInject constructor(
|
||||
}
|
||||
|
||||
} else {
|
||||
renderEntity.enable = 2
|
||||
renderEntity.enable = 1
|
||||
|
||||
/* var geometry = GeometryTools.createGeometry(renderEntity.geometry)
|
||||
if(multipLine.intersects(geometry)){
|
||||
renderEntity.enable = 1
|
||||
}else{
|
||||
val dis = multipLine.distance(GeometryTools.createGeometry(renderEntity.geometry))
|
||||
if(dis>36){
|
||||
continue
|
||||
}else{
|
||||
renderEntity.enable = 1
|
||||
}
|
||||
}*/
|
||||
Log.e("qj", "${renderEntity.name}==不包括任务linkPid")
|
||||
}
|
||||
Log.d("ImportOMDBHelper", "解析===2任务路线匹配")
|
||||
|
||||
@@ -815,4 +815,40 @@ class ImportPreProcess {
|
||||
val code = renderEntity.properties[codeName]
|
||||
renderEntity.properties["src"] = "${prefix}${code}${suffix}"
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前数据的中心点坐标
|
||||
* */
|
||||
fun obtainTrafficSignCenterPoint(renderEntity: RenderEntity) {
|
||||
// 获取中心坐标点,将中心坐标作为数据的新的geometry位置
|
||||
val centerPoint = renderEntity.wkt?.centroid
|
||||
// 根据heading方向自动生成新的Geometry
|
||||
var radian = 0.0
|
||||
val pointStart = Coordinate(centerPoint!!.x, centerPoint.y)
|
||||
var angle =
|
||||
if (renderEntity?.properties?.get("heading") == null) 0.0 else renderEntity?.properties?.get(
|
||||
"heading"
|
||||
)?.toDouble()!!
|
||||
// angle角度为与正北方向的顺时针夹角,将其转换为与X轴正方向的逆时针夹角,即为正东方向的夹角
|
||||
angle = ((450 - angle) % 360)
|
||||
radian = Math.toRadians(angle)
|
||||
|
||||
// 计算偏移距离
|
||||
var dx: Double = GeometryTools.convertDistanceToDegree(
|
||||
defaultTranslateDistance,
|
||||
centerPoint.y
|
||||
) * Math.cos(radian)
|
||||
var dy: Double = GeometryTools.convertDistanceToDegree(
|
||||
defaultTranslateDistance,
|
||||
centerPoint.y
|
||||
) * Math.sin(radian)
|
||||
val listResult = mutableListOf<ReferenceEntity>()
|
||||
|
||||
val coorEnd = Coordinate(pointStart.getX() + dx, pointStart.getY() + dy, pointStart.z)
|
||||
renderEntity.geometry =
|
||||
WKTWriter(3).write(GeometryTools.createLineString(arrayOf(pointStart, coorEnd)))
|
||||
|
||||
val code = renderEntity.properties["signType"]
|
||||
renderEntity.properties["src"] = "assets:omdb/appendix/1105_${code}_0.svg"
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ class RealmOperateHelper() {
|
||||
val realm = getSelectTaskRealmInstance()
|
||||
val realmList =
|
||||
getSelectTaskRealmTools(RenderEntity::class.java, false)
|
||||
.equalTo("table", "OMDB_RD_LINK")
|
||||
.equalTo("table", "OMDB_RD_LINK_KIND")
|
||||
.greaterThanOrEqualTo("tileX", xStart)
|
||||
.lessThanOrEqualTo("tileX", xEnd)
|
||||
.greaterThanOrEqualTo("tileY", yStart)
|
||||
@@ -74,6 +74,7 @@ class RealmOperateHelper() {
|
||||
// 将获取到的数据和查询的polygon做相交,只返回相交的数据
|
||||
val dataList = realm.copyFromRealm(realmList)
|
||||
realm.close()
|
||||
|
||||
val queryResult = dataList?.stream()?.filter {
|
||||
polygon.intersects(it.wkt)
|
||||
}?.toList()
|
||||
@@ -200,7 +201,7 @@ class RealmOperateHelper() {
|
||||
var link: RenderEntity? = null
|
||||
val realm = getSelectTaskRealmInstance()
|
||||
val realmR =
|
||||
realm.where(RenderEntity::class.java).equalTo("table", "OMDB_RD_LINK")
|
||||
realm.where(RenderEntity::class.java).equalTo("table", "OMDB_RD_LINK_KIND")
|
||||
.equalTo("properties['${LinkTable.linkPid}']", linkPid).findFirst()
|
||||
if (realmR != null) {
|
||||
link = realm.copyFromRealm(realmR)
|
||||
@@ -330,7 +331,7 @@ class RealmOperateHelper() {
|
||||
val result = mutableListOf<RenderEntity>()
|
||||
val realm = getSelectTaskRealmInstance()
|
||||
val realmList = getSelectTaskRealmTools(RenderEntity::class.java, false)
|
||||
.notEqualTo("table", DataCodeEnum.OMDB_RD_LINK.name)
|
||||
.notEqualTo("table", DataCodeEnum.OMDB_RD_LINK_KIND.name)
|
||||
.equalTo("properties['${LinkTable.linkPid}']", linkPid)
|
||||
.findAll()
|
||||
result.addAll(realm.copyFromRealm(realmList))
|
||||
@@ -478,5 +479,5 @@ enum class BUFFER_TYPE(val index: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
private val DEFAULT_BUFFER: Double = 15.0
|
||||
private const val DEFAULT_BUFFER: Double = 15.0
|
||||
private val DEFAULT_BUFFER_TYPE = BUFFER_TYPE.METER
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -470,7 +470,8 @@ class MainActivity : BaseActivity() {
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
NaviStatus.NAVI_STATUS_DIRECTION_OFF -> TODO()
|
||||
NaviStatus.NAVI_STATUS_DIRECTION_OFF -> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -504,7 +505,8 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
findNavController(R.id.main_activity_right_fragment).addOnDestinationChangedListener { _, destination, arguments ->
|
||||
findNavController(R.id.main_activity_right_fragment).addOnDestinationChangedListener { _, destination, _ ->
|
||||
backSignMoreInfo()
|
||||
if (destination.id == R.id.RightEmptyFragment) {
|
||||
binding.mainActivityRightVisibilityButtonsGroup.visibility = View.VISIBLE
|
||||
} else {
|
||||
@@ -1185,6 +1187,7 @@ class MainActivity : BaseActivity() {
|
||||
* 打开道路名称属性看板,选择的道路在viewmodel里记录,不用
|
||||
*/
|
||||
fun openRoadNameFragment() {
|
||||
backSignMoreInfo()
|
||||
if (viewModel.liveDataRoadName.value != null) {
|
||||
viewModel.showSignMoreInfo(viewModel.liveDataRoadName.value!!)
|
||||
}
|
||||
@@ -1212,10 +1215,18 @@ class MainActivity : BaseActivity() {
|
||||
rightController.navigate(R.id.TaskLinkFragment)
|
||||
}
|
||||
|
||||
/**
|
||||
* 右侧按钮+经纬度按钮
|
||||
*/
|
||||
fun setRightButtonsVisible(visible: Int) {
|
||||
binding.mainActivityRightVisibilityButtonsGroup2.visibility = visible
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏更多信息面板
|
||||
*/
|
||||
fun backSignMoreInfo(){
|
||||
val fragment =
|
||||
supportFragmentManager.findFragmentById(R.id.main_activity_sign_more_info_fragment)
|
||||
if(fragment!=null&&!fragment.isHidden){
|
||||
supportFragmentManager.beginTransaction().remove(fragment).commit()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -583,7 +583,7 @@ class MainViewModel @Inject constructor(
|
||||
GeometryTools.createPoint(
|
||||
point.longitude, point.latitude
|
||||
),
|
||||
buffer = 2.4, catchAll = false,
|
||||
buffer = 3.2, catchAll = false,
|
||||
)
|
||||
//增加道路线过滤原则
|
||||
val filterResult = itemList.filter {
|
||||
@@ -719,12 +719,6 @@ class MainViewModel @Inject constructor(
|
||||
|
||||
val linkList = realmOperateHelper.queryLink(point = point)
|
||||
|
||||
/* val linkList = realmOperateHelper.queryLine(
|
||||
point = point,
|
||||
buffer = 1.0,
|
||||
table = "OMDB_RD_LINK_KIND"
|
||||
)*/
|
||||
|
||||
var hisRoadName = false
|
||||
|
||||
if (linkList.isNotEmpty()) {
|
||||
@@ -830,13 +824,16 @@ class MainViewModel @Inject constructor(
|
||||
val outList = entityList.distinct()
|
||||
for (i in outList.indices) {
|
||||
val outLink = outList[i].properties["linkOut"]
|
||||
val linkOutEntity = realmOperateHelper.getSelectTaskRealmTools(
|
||||
RenderEntity::class.java, true
|
||||
).equalTo("table", DataCodeEnum.OMDB_RD_LINK.name).and()
|
||||
.equalTo(
|
||||
"properties['${RenderEntity.Companion.LinkTable.linkPid}']",
|
||||
outLink
|
||||
).findFirst()
|
||||
val linkOutEntity =
|
||||
realmOperateHelper.getSelectTaskRealmTools(
|
||||
RenderEntity::class.java,
|
||||
true
|
||||
)
|
||||
.equalTo("table", DataCodeEnum.OMDB_RD_LINK_KIND.name).and()
|
||||
.equalTo(
|
||||
"properties['${RenderEntity.Companion.LinkTable.linkPid}']",
|
||||
outLink
|
||||
).findFirst()
|
||||
if (linkOutEntity != null) {
|
||||
mapController.lineHandler.linksLayer.addLine(
|
||||
linkOutEntity.geometry, 0x7DFF0000
|
||||
@@ -893,7 +890,6 @@ class MainViewModel @Inject constructor(
|
||||
fun onClickMenu() {
|
||||
menuState = !menuState
|
||||
liveDataMenuState.postValue(menuState)
|
||||
// naviEngine!!.bindingRoute(null, mapController.mMapView.vtmMap.mapPosition.geoPoint)
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
|
||||
@@ -30,7 +30,7 @@ class TopSignAdapter(private var itemListener: ((Int, SignBean) -> Unit?)? = nul
|
||||
DataCodeEnum.OMDB_TUNNEL.code,
|
||||
DataCodeEnum.OMDB_ROUNDABOUT.code,
|
||||
DataCodeEnum.OMDB_VIADUCT.code,
|
||||
-> bd.topSignName.text = ""
|
||||
-> bd.topSignName.text = "形态"
|
||||
else -> bd.topSignName.text = item.name
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ class PersonalCenterFragment(private var indoorDataListener: ((Boolean) -> Unit?
|
||||
// 定位到指定位置
|
||||
niMapController.mMapView.vtmMap.animator()
|
||||
// .animateTo(GeoPoint( 40.05108004733645, 116.29187746293708 ))
|
||||
.animateTo(GeoPoint(40.51850916836801, 115.78801387178642))
|
||||
.animateTo(GeoPoint(40.09848700000006, 116.53088699999999))
|
||||
}
|
||||
|
||||
R.id.personal_center_menu_open_all_layer -> {
|
||||
|
||||
@@ -353,6 +353,10 @@ class TaskListAdapter(
|
||||
refreshData(list)
|
||||
}
|
||||
|
||||
fun getSelectTaskPosition():Int{
|
||||
return selectPosition
|
||||
}
|
||||
|
||||
companion object {
|
||||
object ItemClickStatus {
|
||||
const val ITEM_LAYOUT_CLICK = 0 //条目点击
|
||||
|
||||
@@ -126,6 +126,12 @@ class TaskListFragment : BaseFragment() {
|
||||
viewModel.liveDataTaskList.observe(viewLifecycleOwner) {
|
||||
loadFinish()
|
||||
adapter.initSelectTask(it, viewModel.currentSelectTaskBean?.id)
|
||||
var position = adapter.getSelectTaskPosition()
|
||||
if(position<0){
|
||||
position = 0
|
||||
}
|
||||
//定位到被选中的任务
|
||||
binding.taskListRecyclerview.smoothScrollToPosition(position)
|
||||
}
|
||||
|
||||
//监听并调用上传
|
||||
|
||||
Reference in New Issue
Block a user