增加地图要素捕捉过滤业务
This commit is contained in:
parent
33d17eea0d
commit
3caaa57e20
@ -428,9 +428,9 @@ class ImportOMDBHelper @AssistedInject constructor(
|
||||
if (resultEntity != null) {
|
||||
|
||||
if (currentConfig.catch) {
|
||||
renderEntity.catchEnable = 0
|
||||
} else {
|
||||
renderEntity.catchEnable = 1
|
||||
} else {
|
||||
renderEntity.catchEnable = 0
|
||||
}
|
||||
|
||||
//对code编码需要特殊处理 存在多个属性值时,渲染优先级:SA>PA,存在多个属性值时,渲染优先级:FRONTAGE>MAIN_SIDE_A CCESS
|
||||
|
@ -260,6 +260,9 @@ class RealmOperateHelper() {
|
||||
): MutableList<RenderEntity> {
|
||||
val result = mutableListOf<RenderEntity>()
|
||||
val polygon = getPolygonFromPoint(point, buffer, bufferType)
|
||||
|
||||
niMapController.lineHandler.showLine(polygon.toText())
|
||||
|
||||
// 根据polygon查询相交的tile号
|
||||
val tileXSet = mutableSetOf<Int>()
|
||||
tileXSet.toString()
|
||||
@ -285,13 +288,11 @@ class RealmOperateHelper() {
|
||||
} else {
|
||||
// 查询realm中对应tile号的数据
|
||||
realmList = getSelectTaskRealmTools(RenderEntity::class.java, false)
|
||||
.lessThan("catchEnable", 1)
|
||||
.greaterThanOrEqualTo("zoomMin", niMapController.mMapView.mapLevel).
|
||||
lessThanOrEqualTo("zoomMax", niMapController.mMapView.mapLevel)
|
||||
.greaterThanOrEqualTo("tileX", xStart)
|
||||
.lessThanOrEqualTo("tileX", xEnd)
|
||||
.greaterThanOrEqualTo("tileY", yStart)
|
||||
.lessThanOrEqualTo("tileY", yEnd)
|
||||
.greaterThan("catchEnable", 0)
|
||||
.findAll()
|
||||
}
|
||||
// 将获取到的数据和查询的polygon做相交,只返回相交的数据
|
||||
@ -426,7 +427,7 @@ class RealmOperateHelper() {
|
||||
|
||||
if (enableSql) {
|
||||
var sql =
|
||||
" enable${MapParamUtils.getDataLayerEnum().sql} }"
|
||||
" enable${MapParamUtils.getDataLayerEnum().sql}"
|
||||
getSelectTaskRealmInstance().where(clazz).rawPredicate(sql)
|
||||
} else {
|
||||
getSelectTaskRealmInstance().where(clazz)
|
||||
|
@ -4,7 +4,9 @@ import android.util.Log
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.Observer
|
||||
import com.blankj.utilcode.util.MapUtils
|
||||
import com.navinfo.collect.library.data.entity.TaskBean
|
||||
import com.navinfo.collect.library.utils.MapParamUtils
|
||||
import com.navinfo.omqs.Constant
|
||||
import com.navinfo.omqs.db.ImportOMDBHelper
|
||||
import com.navinfo.omqs.tools.FileManager
|
||||
@ -145,7 +147,10 @@ class TaskDownloadScope(
|
||||
change(FileDownloadStatus.DONE)
|
||||
Log.e("jingo", "数据安装结束")
|
||||
withContext(Dispatchers.Main) {
|
||||
downloadManager.mapController.layerManagerHandler.updateOMDBVectorTileLayer()
|
||||
//任务与当前一致,需要更新渲染图层
|
||||
if(MapParamUtils.getTaskId()==taskBean.id){
|
||||
downloadManager.mapController.layerManagerHandler.updateOMDBVectorTileLayer()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
change(FileDownloadStatus.IMPORTING, it)
|
||||
|
@ -26,6 +26,7 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import com.blankj.utilcode.util.ClipboardUtils
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import com.navinfo.collect.library.data.entity.RenderEntity
|
||||
import com.navinfo.collect.library.map.NIMapController
|
||||
import com.navinfo.collect.library.map.handler.MeasureLayerHandler
|
||||
import com.navinfo.omqs.Constant
|
||||
@ -46,6 +47,7 @@ import com.navinfo.omqs.ui.fragment.tasklist.TaskManagerFragment
|
||||
import com.navinfo.omqs.ui.other.BaseToast
|
||||
import com.navinfo.omqs.ui.widget.RecyclerViewSpacesItemDecoration
|
||||
import com.navinfo.omqs.util.FlowEventBus
|
||||
import com.navinfo.omqs.util.SignUtil
|
||||
import com.navinfo.omqs.util.SpeakMode
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.launch
|
||||
@ -337,6 +339,22 @@ class MainActivity : BaseActivity() {
|
||||
.replace(R.id.main_activity_sign_more_info_fragment, SignMoreInfoFragment())
|
||||
.commit()
|
||||
}
|
||||
//启动问题记录
|
||||
val signBean = SignBean(
|
||||
iconId = SignUtil.getSignIcon(it),
|
||||
iconText = SignUtil.getSignIconText(it),
|
||||
linkId = it.properties[RenderEntity.Companion.LinkTable.linkPid]
|
||||
?: "",
|
||||
name = SignUtil.getSignNameText(it),
|
||||
bottomRightText = SignUtil.getSignBottomRightText(it),
|
||||
renderEntity = it,
|
||||
isMoreInfo = SignUtil.isMoreInfo(it),
|
||||
index = SignUtil.getRoadInfoIndex(it)
|
||||
)
|
||||
val bundle = Bundle()
|
||||
bundle.putParcelable("SignBean", signBean)
|
||||
bundle.putBoolean("AutoSave", false)
|
||||
rightController.navigate(R.id.EvaluationResultFragment, bundle)
|
||||
}
|
||||
|
||||
viewModel.liveIndoorToolsResp.observe(this) {
|
||||
|
@ -30,7 +30,6 @@ import com.navinfo.collect.library.garminvirbxe.HostBean
|
||||
import com.navinfo.collect.library.map.NIMapController
|
||||
import com.navinfo.collect.library.map.OnGeoPointClickListener
|
||||
import com.navinfo.collect.library.map.handler.*
|
||||
import com.navinfo.collect.library.utils.DistanceUtil
|
||||
import com.navinfo.collect.library.utils.GeometryTools
|
||||
import com.navinfo.collect.library.utils.GeometryToolsKt
|
||||
import com.navinfo.collect.library.utils.MapParamUtils
|
||||
@ -58,9 +57,6 @@ import kotlinx.coroutines.flow.flow
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.sync.Mutex
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.locationtech.jts.algorithm.distance.DistanceToPoint
|
||||
import org.locationtech.jts.algorithm.distance.PointPairDistance
|
||||
import org.locationtech.jts.geom.Coordinate
|
||||
import org.locationtech.jts.geom.Geometry
|
||||
import org.oscim.core.GeoPoint
|
||||
import org.oscim.core.MapPosition
|
||||
@ -240,6 +236,9 @@ class MainViewModel @Inject constructor(
|
||||
|
||||
shareUtil = ShareUtil(mapController.mMapView.context, 1)
|
||||
|
||||
//初始化
|
||||
realmOperateHelper.niMapController = mapController
|
||||
|
||||
initLocation()
|
||||
/**
|
||||
* 处理点击道路捕捉回调功能
|
||||
@ -316,8 +315,12 @@ class MainViewModel @Inject constructor(
|
||||
}
|
||||
sharedPreferences.registerOnSharedPreferenceChangeListener(this)
|
||||
MapParamUtils.setTaskId(sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1))
|
||||
Constant.currentSelectTaskFolder = File(Constant.USER_DATA_PATH +"/${MapParamUtils.getTaskId()}")
|
||||
Constant.currentSelectTaskConfig = RealmConfiguration.Builder().directory(Constant.currentSelectTaskFolder).name("OMQS.realm").encryptionKey(Constant.PASSWORD).allowQueriesOnUiThread(true).schemaVersion(2).build()
|
||||
Constant.currentSelectTaskFolder =
|
||||
File(Constant.USER_DATA_PATH + "/${MapParamUtils.getTaskId()}")
|
||||
Constant.currentSelectTaskConfig =
|
||||
RealmConfiguration.Builder().directory(Constant.currentSelectTaskFolder)
|
||||
.name("OMQS.realm").encryptionKey(Constant.PASSWORD).allowQueriesOnUiThread(true)
|
||||
.schemaVersion(2).build()
|
||||
MapParamUtils.setTaskConfig(Constant.currentSelectTaskConfig)
|
||||
socketServer = SocketServer(mapController, traceDataBase, sharedPreferences)
|
||||
|
||||
@ -671,13 +674,21 @@ class MainViewModel @Inject constructor(
|
||||
point.longitude,
|
||||
point.latitude
|
||||
),
|
||||
buffer = 2.5, catchAll = false
|
||||
buffer = 2.0, catchAll = false,
|
||||
)
|
||||
|
||||
if (itemList.size == 1) {
|
||||
liveDataSignMoreInfo.postValue(itemList[0])
|
||||
//增加道路线过滤原则
|
||||
val filterResult = itemList.filter {
|
||||
if(isHighRoad()){
|
||||
mapController.mMapView.mapLevel>=it.zoomMin&&mapController.mMapView.mapLevel<=it.zoomMax
|
||||
}else{
|
||||
//关闭时过滤道路线捕捉s
|
||||
mapController.mMapView.mapLevel>=it.zoomMin&&mapController.mMapView.mapLevel<=it.zoomMax&&it.code!=DataCodeEnum.OMDB_RD_LINK.code
|
||||
}
|
||||
}.toList()
|
||||
if (filterResult.size == 1) {
|
||||
liveDataSignMoreInfo.postValue(filterResult[0])
|
||||
} else {
|
||||
liveDataItemList.postValue(itemList)
|
||||
liveDataItemList.postValue(filterResult)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -697,11 +708,11 @@ class MainViewModel @Inject constructor(
|
||||
|
||||
val linkList = realmOperateHelper.queryLink(point = point)
|
||||
|
||||
/* val linkList = realmOperateHelper.queryLine(
|
||||
point = point,
|
||||
buffer = 1.0,
|
||||
table = "OMDB_RD_LINK_KIND"
|
||||
)*/
|
||||
/* val linkList = realmOperateHelper.queryLine(
|
||||
point = point,
|
||||
buffer = 1.0,
|
||||
table = "OMDB_RD_LINK_KIND"
|
||||
)*/
|
||||
|
||||
var hisRoadName = false
|
||||
|
||||
@ -754,6 +765,7 @@ class MainViewModel @Inject constructor(
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
DataCodeEnum.OMDB_LANE_NUM.code, //车道数
|
||||
DataCodeEnum.OMDB_RD_LINK_KIND.code,//种别,
|
||||
DataCodeEnum.OMDB_RD_LINK_FUNCTION_CLASS.code, // 功能等级,
|
||||
@ -805,8 +817,11 @@ class MainViewModel @Inject constructor(
|
||||
|
||||
val realm = realmOperateHelper.getSelectTaskRealmInstance()
|
||||
|
||||
val entityList =
|
||||
realmOperateHelper.getSelectTaskRealmTools(RenderEntity::class.java, true)
|
||||
val entityList =
|
||||
realmOperateHelper.getSelectTaskRealmTools(
|
||||
RenderEntity::class.java,
|
||||
true
|
||||
)
|
||||
.and()
|
||||
.equalTo("table", DataCodeEnum.OMDB_RESTRICTION.name)
|
||||
.and()
|
||||
@ -1121,6 +1136,7 @@ class MainViewModel @Inject constructor(
|
||||
val geoPoint = GeometryTools.createGeoPoint(data.wkt!!.toText())
|
||||
mapController.markerHandle.addMarker(geoPoint, "moreInfo")
|
||||
}
|
||||
|
||||
Geometry.TYPENAME_LINESTRING -> {
|
||||
mapController.lineHandler.showLine(data.wkt!!.toText())
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ open class RenderEntity() : RealmObject(), Parcelable {
|
||||
var zoomMin: Int = 18 //显示最小级别
|
||||
var zoomMax: Int = 23 //显示最大级别
|
||||
var enable:Int = 0 // 默认0不是显示 1为渲染显示 2为常显
|
||||
var catchEnable:Int = 0 // 0捕捉 1不捕捉
|
||||
var catchEnable:Int = 0 // 0不捕捉 1捕捉
|
||||
|
||||
constructor(name: String) : this() {
|
||||
this.name = name
|
||||
|
@ -735,7 +735,7 @@ public final class NIMapView extends RelativeLayout {
|
||||
if (mapView != null && mapView.map() != null)
|
||||
return mapView.map().getMapPosition().getZoomLevel();
|
||||
|
||||
return 0;
|
||||
return 16;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -146,6 +146,7 @@ class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView, traceP
|
||||
// 添加显示grid的tile号的图层
|
||||
tileGridLayer = TileGridLayer(mMapView.vtmMap)
|
||||
addLayer(tileGridLayer, NIMapView.LAYER_GROUPS.OPERATE_MARKER)
|
||||
tileGridLayer.isEnabled = false
|
||||
}
|
||||
|
||||
private fun resetOMDBVectorTileLayer() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user