增加要素捕捉功能,

增加测量功能
This commit is contained in:
squallzhjch 2023-08-04 10:11:29 +08:00
parent 5266cbb4b1
commit 8f3bd1926a
31 changed files with 732 additions and 122 deletions

View File

@ -121,16 +121,14 @@ class RealmOperateHelper() {
suspend fun queryLink(linkPid: String): RenderEntity? {
var link: RenderEntity? = null
withContext(Dispatchers.IO) {
val realm = Realm.getDefaultInstance()
val realmR = realm.where(RenderEntity::class.java)
.equalTo("table", "OMDB_RD_LINK")
.and()
.equalTo("properties['${LinkTable.linkPid}']", linkPid)
.findFirst()
if (realmR != null) {
link = realm.copyFromRealm(realmR)
}
val realm = Realm.getDefaultInstance()
val realmR = realm.where(RenderEntity::class.java)
.equalTo("table", "OMDB_RD_LINK")
.and()
.equalTo("properties['${LinkTable.linkPid}']", linkPid)
.findFirst()
if (realmR != null) {
link = realm.copyFromRealm(realmR)
}
return link
}
@ -150,38 +148,38 @@ class RealmOperateHelper() {
sort: Boolean = true
): MutableList<RenderEntity> {
val result = mutableListOf<RenderEntity>()
withContext(Dispatchers.IO) {
val polygon = getPolygonFromPoint(point, buffer, bufferType)
// 根据polygon查询相交的tile号
val tileXSet = mutableSetOf<Int>()
tileXSet.toString()
GeometryToolsKt.getTileXByGeometry(polygon.toString(), tileXSet)
val tileYSet = mutableSetOf<Int>()
GeometryToolsKt.getTileYByGeometry(polygon.toString(), tileYSet)
val polygon = getPolygonFromPoint(point, buffer, bufferType)
// 根据polygon查询相交的tile号
val tileXSet = mutableSetOf<Int>()
tileXSet.toString()
GeometryToolsKt.getTileXByGeometry(polygon.toString(), tileXSet)
val tileYSet = mutableSetOf<Int>()
GeometryToolsKt.getTileYByGeometry(polygon.toString(), tileYSet)
// 对tileXSet和tileYSet查询最大最小值
val xStart = tileXSet.stream().min(Comparator.naturalOrder()).orElse(null)
val xEnd = tileXSet.stream().max(Comparator.naturalOrder()).orElse(null)
val yStart = tileYSet.stream().min(Comparator.naturalOrder()).orElse(null)
val yEnd = tileYSet.stream().max(Comparator.naturalOrder()).orElse(null)
// 查询realm中对应tile号的数据
val realmList = Realm.getDefaultInstance().where(RenderEntity::class.java)
.notEqualTo("table", "OMDB_RD_LINK")
.and()
.rawPredicate("tileX>=$xStart and tileX<=$xEnd and tileY>=$yStart and tileY<=$yEnd")
.findAll()
// 将获取到的数据和查询的polygon做相交只返回相交的数据
val queryResult = realmList?.stream()?.filter {
polygon.intersects(it.wkt)
}?.toList()
queryResult?.let {
result.addAll(queryResult)
}
// 对tileXSet和tileYSet查询最大最小值
val xStart = tileXSet.stream().min(Comparator.naturalOrder()).orElse(null)
val xEnd = tileXSet.stream().max(Comparator.naturalOrder()).orElse(null)
val yStart = tileYSet.stream().min(Comparator.naturalOrder()).orElse(null)
val yEnd = tileYSet.stream().max(Comparator.naturalOrder()).orElse(null)
val realm = Realm.getDefaultInstance()
// 查询realm中对应tile号的数据
val realmList = realm.where(RenderEntity::class.java)
.notEqualTo("table", "OMDB_RD_LINK")
.and()
.rawPredicate("tileX>=$xStart and tileX<=$xEnd and tileY>=$yStart and tileY<=$yEnd")
.findAll()
// 将获取到的数据和查询的polygon做相交只返回相交的数据
val queryResult = realmList?.stream()?.filter {
polygon.intersects(it.wkt)
}?.toList()
queryResult?.let {
if (sort) {
result.clear()
result.addAll(sortRenderEntity(point, result))
result.addAll(sortRenderEntity(point, realm.copyFromRealm(it)))
} else {
result.addAll(realm.copyFromRealm(it))
}
}
return result
}
@ -213,8 +211,7 @@ class RealmOperateHelper() {
@RequiresApi(Build.VERSION_CODES.N)
fun sortRenderEntity(point: Point, unSortList: List<RenderEntity>): List<RenderEntity> {
val sortList = unSortList.stream().sorted { renderEntity, renderEntity2 ->
val near = point.distance(renderEntity.wkt) - point.distance(renderEntity2.wkt)
if (near < 0) -1 else 1
point.distance(renderEntity.wkt).compareTo(point.distance(renderEntity2.wkt))
}.toList()
return sortList
}

View File

@ -281,6 +281,9 @@ class LoginViewModel @Inject constructor(
task.operationTime = DateTimeUtil.getNowDate().time
}
} else {
for (hadLink in task.hadLinkDvoList) {
hadLink.taskId = task.id
}
//赋值时间,用于查询过滤
task.operationTime = DateTimeUtil.getNowDate().time
}

View File

@ -199,7 +199,7 @@ class MainViewModel @Inject constructor(
Map.SCALE_EVENT, Map.MOVE_EVENT, Map.ROTATE_EVENT -> liveDataCenterPoint.value =
mapPosition
}
if(mapController.mMapView.vtmMap.mapPosition.zoomLevel>=16){
if (mapController.mMapView.vtmMap.mapPosition.zoomLevel >= 16) {
}
currentMapZoomLevel = mapController.mMapView.vtmMap.mapPosition.zoomLevel
@ -219,7 +219,7 @@ class MainViewModel @Inject constructor(
object : OnGeoPointClickListener {
override fun onMapClick(tag: String, point: GeoPoint) {
if (tag == TAG) {
viewModelScope.launch(Dispatchers.Default) {
viewModelScope.launch(Dispatchers.IO) {
//线选择状态
if (bSelectRoad) {
captureLink(point)
@ -280,6 +280,8 @@ class MainViewModel @Inject constructor(
initNILocationData()
}
sharedPreferences.registerOnSharedPreferenceChangeListener(this)
com.navinfo.collect.library.system.Constant.TASK_ID =
sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1)
socketServer = SocketServer(mapController, traceDataBase, sharedPreferences)
}
@ -455,8 +457,8 @@ class MainViewModel @Inject constructor(
)
)
if(itemList.size == 1){
SignUtil.getSignNameText(itemList[0])
if (itemList.size > 0) {
liveDataSignMoreInfo.postValue(itemList[0])
}
}
}

View File

@ -0,0 +1,103 @@
package com.navinfo.omqs.ui.fragment.signMoreInfo
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.ViewHolder
import com.navinfo.omqs.R
import com.navinfo.omqs.databinding.AdapterLaneBoundaryBinding
import com.navinfo.omqs.databinding.AdapterTwoItemBinding
import com.navinfo.omqs.ui.other.BaseViewHolder
import com.navinfo.omqs.ui.other.anim.ExpandableViewHoldersUtil
import com.navinfo.omqs.ui.other.anim.ExpandableViewHoldersUtil.Expandable
data class LaneBoundaryItem(
val title: String, val text: String?, val itemList: MutableList<TwoItemAdapterItem>?
)
class LaneBoundaryAdapter : RecyclerView.Adapter<ViewHolder>() {
private val keepOne: ExpandableViewHoldersUtil.KeepOneH<ExpandViewHolder> =
ExpandableViewHoldersUtil.KeepOneH()
private var dataList = mutableListOf<LaneBoundaryItem>()
class ExpandViewHolder(
val viewBinding: AdapterLaneBoundaryBinding,
private val keepOne: ExpandableViewHoldersUtil.KeepOneH<ExpandViewHolder>
) : ViewHolder(viewBinding.root),
View.OnClickListener, Expandable {
init {
viewBinding.root.setOnClickListener(this)
}
fun bind(pos: Int, laneBoundaryItem: LaneBoundaryItem) {
viewBinding.contactName.text = laneBoundaryItem.title
if (laneBoundaryItem.itemList != null) {
for (item in laneBoundaryItem.itemList) {
var view = LayoutInflater.from(viewBinding.root.context)
.inflate(R.layout.adapter_two_item, null, false)
view.findViewById<TextView>(R.id.title).text = item.title
view.findViewById<TextView>(R.id.text).text = item.text
viewBinding.infos.addView(view)
}
}
keepOne.bind(this, pos)
}
override fun onClick(v: View) {
keepOne.toggle(this,viewBinding.expandIcon)
}
override val expandView: View
get() = viewBinding.infos
}
override
fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return if (viewType == 1) {
val viewBinding = AdapterLaneBoundaryBinding.inflate(
LayoutInflater.from(parent.context), parent, false
)
ExpandViewHolder(viewBinding, keepOne)
} else {
val viewBinding =
AdapterTwoItemBinding.inflate(LayoutInflater.from(parent.context), parent, false)
BaseViewHolder(viewBinding)
}
}
override fun getItemCount(): Int {
return dataList.size
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
if (holder is ExpandViewHolder) {
holder.bind(position, dataList[position])
} else if (holder is BaseViewHolder) {
val binding: AdapterTwoItemBinding = holder.viewBinding as AdapterTwoItemBinding
val item = dataList[position]
binding.title.text = item.title
binding.text.text = item.text
}
}
override fun getItemViewType(position: Int): Int {
return if (dataList[position].itemList != null) 1
else 0
}
fun refreshData(list: List<LaneBoundaryItem>) {
dataList.clear()
dataList.addAll(list)
notifyDataSetChanged()
}
}

View File

@ -55,15 +55,27 @@ class SignMoreInfoFragment : BaseFragment() {
binding.signInfoRecyclerview.adapter = adapter
adapter.refreshData(SignUtil.getRoadNameList(it))
}
//车道边界类型
2013 -> {
val adapter = LaneBoundaryAdapter()
binding.signInfoRecyclerview.adapter = adapter
adapter.refreshData(SignUtil.getLaneBoundaryTypeInfo(it))
}
//可变点限速
2021 -> {
val adapter = TwoItemAdapter()
binding.signInfoRecyclerview.adapter = adapter
adapter.refreshData(SignUtil.getChangeLimitSpeedInfo(it))
}
//常规点限速
4002 -> {
val adapter = ElectronicEyeInfoAdapter()
val adapter = TwoItemAdapter()
binding.signInfoRecyclerview.adapter = adapter
adapter.refreshData(SignUtil.getSpeedLimitMoreInfoText(it))
}
//条件点限速
4003 -> {
val adapter = ElectronicEyeInfoAdapter()
val adapter = TwoItemAdapter()
binding.signInfoRecyclerview.adapter = adapter
adapter.refreshData(SignUtil.getConditionLimitMoreInfoText(it))
}
@ -80,11 +92,14 @@ class SignMoreInfoFragment : BaseFragment() {
binding.signInfoTitle.setCompoundDrawables(
drawable, null, null, null
)
val adapter = ElectronicEyeInfoAdapter()
val adapter = TwoItemAdapter()
binding.signInfoRecyclerview.adapter = adapter
adapter.refreshData(SignUtil.getElectronicEyeMoreInfo(it))
}
else -> {
val adapter = TwoItemAdapter()
binding.signInfoRecyclerview.adapter = adapter
}
}
}

View File

@ -2,27 +2,26 @@ package com.navinfo.omqs.ui.fragment.signMoreInfo
import android.view.LayoutInflater
import android.view.ViewGroup
import com.navinfo.omqs.R
import com.navinfo.omqs.databinding.AdapterElectronicEyeBinding
import com.navinfo.omqs.databinding.AdapterTwoItemBinding
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
import com.navinfo.omqs.ui.other.BaseViewHolder
data class ElectronicEyeMoreInfoAdapterItem(
data class TwoItemAdapterItem(
val title: String,
val text: String
)
class ElectronicEyeInfoAdapter : BaseRecyclerViewAdapter<ElectronicEyeMoreInfoAdapterItem>() {
class TwoItemAdapter : BaseRecyclerViewAdapter<TwoItemAdapterItem>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
val viewBinding =
AdapterElectronicEyeBinding.inflate(LayoutInflater.from(parent.context), parent, false)
AdapterTwoItemBinding.inflate(LayoutInflater.from(parent.context), parent, false)
return BaseViewHolder(viewBinding)
}
override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
val binding: AdapterElectronicEyeBinding =
holder.viewBinding as AdapterElectronicEyeBinding
val binding: AdapterTwoItemBinding =
holder.viewBinding as AdapterTwoItemBinding
val item = data[position]
binding.title.text = item.title
binding.text.text = item.text

View File

@ -1,11 +1,8 @@
package com.navinfo.omqs.ui.fragment.tasklink
import android.os.Build
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.annotation.RequiresApi
import com.navinfo.omqs.R
import com.navinfo.omqs.databinding.AdapterElectronicEyeBinding
import com.navinfo.omqs.databinding.AdapterTaskLinkInfoBinding
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
import com.navinfo.omqs.ui.other.BaseViewHolder

View File

@ -180,10 +180,10 @@ class TaskListAdapter(
binding.taskUploadBtn.visibility = View.INVISIBLE
}
if (taskBean.syncStatus == FileUploadStatus.DONE) {
binding.taskUploadBtn.setProgress(0)
// binding.taskUploadBtn.setProgress(0)
binding.taskUploadBtn.setBackgroundColor(binding.root.resources.getColor(R.color.ripple_end_color))
} else {
binding.taskUploadBtn.setProgress(100)
// binding.taskUploadBtn.setProgress(100)
binding.taskUploadBtn.setBackgroundColor(Color.parseColor("#888FB3"))
}
binding.taskDownloadBtn.tag = position
@ -301,7 +301,7 @@ class TaskListAdapter(
binding.taskDownloadBtn.setTextColor(Color.WHITE)
}
if (taskBean.fileSize > 0L) {
if (taskBean.fileSize > 0L && taskBean.status != FileDownloadStatus.DONE) {
val progress = (taskBean.currentSize * 100 / taskBean.fileSize).toInt()
binding.taskProgressText.text =
"$progress%"

View File

@ -5,7 +5,6 @@ import android.content.SharedPreferences
import android.content.SharedPreferences.OnSharedPreferenceChangeListener
import android.os.Build
import android.view.View
import android.widget.Toast
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
@ -19,7 +18,6 @@ import com.navinfo.collect.library.map.OnGeoPointClickListener
import com.navinfo.collect.library.utils.GeometryTools
import com.navinfo.omqs.Constant
import com.navinfo.omqs.db.RealmOperateHelper
import com.navinfo.omqs.http.NetResult
import com.navinfo.omqs.http.NetworkService
import com.navinfo.omqs.tools.FileManager
import com.navinfo.omqs.ui.dialog.FirstDialog
@ -27,7 +25,6 @@ import com.navinfo.omqs.util.DateTimeUtil
import dagger.hilt.android.lifecycle.HiltViewModel
import io.realm.Realm
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.collectLatest
import org.oscim.core.GeoPoint
import javax.inject.Inject
@ -144,6 +141,10 @@ class TaskViewModel @Inject constructor(
liveDataTaskLinks.value = taskBean.hadLinkDvoList
showTaskLinks(taskBean)
com.navinfo.collect.library.system.Constant.TASK_ID = taskBean.id
mapController.layerManagerHandler.omdbLayersClear()
mapController.mMapView.updateMap(true)
}
private fun showTaskLinks(taskBean: TaskBean) {
@ -475,8 +476,8 @@ class TaskViewModel @Inject constructor(
.equalTo("linkId", hadLinkDvoBean.linkPid)
.and().equalTo("taskId", hadLinkDvoBean.taskId)
.findAll()
if(markers != null){
for(marker in markers){
if (markers != null) {
for (marker in markers) {
mapController.markerHandle.removeQsRecordMark(marker)
}
markers.deleteAllFromRealm()

View File

@ -1,6 +1,5 @@
package com.navinfo.omqs.ui.other
import android.util.Log
import android.view.View
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner

View File

@ -0,0 +1,119 @@
package com.navinfo.omqs.ui.other.anim
import android.R.attr.animation
import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.animation.ObjectAnimator
import android.animation.ValueAnimator
import android.os.Build
import android.view.View
import android.view.animation.DecelerateInterpolator
import android.widget.ImageView
import androidx.recyclerview.widget.RecyclerView
import com.navinfo.omqs.ui.other.anim.ViewHolderAnimator.ViewHolderAnimatorListener
object ExpandableViewHoldersUtil {
//自定义处理列表中右侧图标,这里是一个旋转动画
fun rotateExpandIcon(mImage: ImageView, from: Float, to: Float) {
val valueAnimator: ValueAnimator = ValueAnimator.ofFloat(from, to) //属性动画
valueAnimator.duration = 500
valueAnimator.interpolator = DecelerateInterpolator()
valueAnimator.addUpdateListener { valueAnimator ->
mImage.rotation = valueAnimator.animatedValue as Float
}
valueAnimator.start()
}
//参数介绍1、holder对象 2、展开部分的View由holder.getExpandView()方法获取 3、animate参数为true则有动画效果
fun openH(holder: RecyclerView.ViewHolder, expandView: View, animate: Boolean) {
if (animate) {
expandView.visibility = View.VISIBLE
//改变高度的动画
val animator = ViewHolderAnimator.ofItemViewHeight(holder)
//扩展的动画,结束后透明度动画开始
animator!!.addListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator) {
val alphaAnimator = ObjectAnimator.ofFloat(expandView, View.ALPHA, 1f)
alphaAnimator.addListener(ViewHolderAnimatorListener(holder))
alphaAnimator.start()
}
})
animator.start()
} else {//为false时直接显示
expandView.visibility = View.VISIBLE
expandView.alpha = 1f
}
}
//类似于打开的方法
fun closeH(holder: RecyclerView.ViewHolder, expandView: View, animate: Boolean) {
if (animate) {
expandView.visibility = View.GONE
val animator = ViewHolderAnimator.ofItemViewHeight(holder)
expandView.visibility = View.VISIBLE
animator!!.addListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator) {
expandView.visibility = View.GONE
expandView.alpha = 0f
}
override fun onAnimationCancel(animation: Animator) {
expandView.visibility = View.GONE
expandView.alpha = 0f
}
})
animator.start()
} else {
expandView.visibility = View.GONE
expandView.alpha = 0f
}
}
//获取展开部分的View
interface Expandable {
val expandView: View
}
class KeepOneH<VH> where VH : RecyclerView.ViewHolder, VH : Expandable? {
//-1表示所有item是关闭状态opend为pos值的表示pos位置的item为展开的状态
private var _opened = -1
/**
* 此方法是在Adapter的onBindViewHolder()方法中调用
*
* @param holder holder对象
* @param pos 下标
*/
fun bind(holder: VH, pos: Int) {
if (pos == _opened) openH(holder, holder!!.expandView, false) else closeH(
holder,
holder!!.expandView,
false
)
}
/**
* 响应ViewHolder的点击事件
*
* @param holder holder对象
* @param imageView 这里我传入了一个ImageView对象为了处理图片旋转的动画为了处理内部业务
*/
fun toggle(holder: VH, imageView: ImageView) {
if (_opened == holder!!.position) {
_opened = -1
rotateExpandIcon(imageView, 180F, 0F);
closeH(holder, holder.expandView, true)
} else {
val previous = _opened
_opened = holder.position
rotateExpandIcon(imageView, 0F, 180F);
openH(holder, holder.expandView, true)
val oldHolder =
(holder.itemView.parent as RecyclerView).findViewHolderForPosition(previous) as VH?
if (oldHolder != null) closeH(oldHolder, oldHolder.expandView, true)
}
}
}
}

View File

@ -0,0 +1,22 @@
package com.navinfo.omqs.ui.other.anim
import android.animation.Animator
import android.animation.ValueAnimator
import android.view.View
object LayoutAnimator {
fun ofHeight(view: View, start: Int, end: Int): Animator {
val animator = ValueAnimator.ofInt(start, end)
animator.addUpdateListener(LayoutHeightUpdateListener(view))
return animator
}
class LayoutHeightUpdateListener(private val _view: View) :
ValueAnimator.AnimatorUpdateListener {
override fun onAnimationUpdate(animation: ValueAnimator) {
val lp = _view.layoutParams
lp.height = animation.animatedValue as Int
_view.layoutParams = lp
}
}
}

View File

@ -0,0 +1,60 @@
package com.navinfo.omqs.ui.other.anim
import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
object ViewHolderAnimator {
fun ofItemViewHeight(holder: RecyclerView.ViewHolder): Animator? {
val parent = holder.itemView.parent as View
?: throw IllegalStateException("Cannot animate the layout of a view that has no parent")
val start = holder.itemView.measuredHeight
holder.itemView.measure(
View.MeasureSpec.makeMeasureSpec(
parent.measuredWidth,
View.MeasureSpec.AT_MOST
), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)
)
val end = holder.itemView.measuredHeight
val animator = LayoutAnimator.ofHeight(holder.itemView, start, end)
animator!!.addListener(ViewHolderAnimatorListener(holder))
animator.addListener(
LayoutParamsAnimatorListener(
holder.itemView,
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
)
)
return animator
}
class ViewHolderAnimatorListener(private val _holder: RecyclerView.ViewHolder) :
AnimatorListenerAdapter() {
override fun onAnimationStart(animation: Animator) {
_holder.setIsRecyclable(false)
}
override fun onAnimationEnd(animation: Animator) {
_holder.setIsRecyclable(true)
}
override fun onAnimationCancel(animation: Animator) {
_holder.setIsRecyclable(true)
}
}
class LayoutParamsAnimatorListener(
private val _view: View,
private val _paramsWidth: Int,
private val _paramsHeight: Int
) : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator) {
val params = _view.layoutParams
params.width = _paramsWidth
params.height = _paramsHeight
_view.layoutParams = params
}
}
}

View File

@ -6,8 +6,10 @@ import com.navinfo.omqs.R
import com.navinfo.omqs.bean.RoadNameBean
import com.navinfo.omqs.bean.SignBean
import com.navinfo.omqs.ui.activity.map.LaneInfoItem
import com.navinfo.omqs.ui.fragment.signMoreInfo.ElectronicEyeMoreInfoAdapterItem
import com.navinfo.omqs.ui.fragment.signMoreInfo.LaneBoundaryItem
import com.navinfo.omqs.ui.fragment.signMoreInfo.TwoItemAdapterItem
import org.json.JSONArray
import org.json.JSONObject
import java.lang.reflect.Field
class SignUtil {
@ -104,6 +106,96 @@ class SignUtil {
}
}
/**
* 获取车道边界类型详细信息
*/
fun getLaneBoundaryTypeInfo(renderEntity: RenderEntity): List<LaneBoundaryItem> {
val list = mutableListOf<LaneBoundaryItem>()
list.add(LaneBoundaryItem("车道边界线ID", "${renderEntity.properties["featurePid"]}", null))
val type = renderEntity.properties["boundaryType"]
if (type != null) {
val typeStr = when (type.toInt()) {
0 -> "不应用"
1 -> "无标线无可区分边界"
2 -> "标线"
3 -> "路牙"
4 -> "护栏"
5 -> ""
6 -> "铺设路面边缘"
7 -> "虚拟三角岛"
8 -> "障碍物"
9 -> "杆状障碍物"
else -> ""
}
list.add(LaneBoundaryItem("边界类型", typeStr, null))
}
try {
val shapeList = renderEntity.properties["shapeList"]
if (shapeList != null && shapeList != "" && shapeList != "null") {
val itemList = mutableListOf<TwoItemAdapterItem>()
val jsonArray = JSONArray(shapeList)
for (i in 0 until jsonArray.length()) {
val arrayObject: JSONObject = jsonArray[i] as JSONObject
var markType = when (arrayObject.getInt("markType")) {
0 -> "其他"
1 -> "实线"
2 -> "虚线"
4 -> "Gore(导流区边线)"
5 -> "铺设路面边缘(标线)"
6 -> "菱形减速标线"
7 -> "可变导向标线"
8 -> "短粗虚线"
else -> ""
}
itemList.add(TwoItemAdapterItem("车道标线类型", markType))
val markColor = when (arrayObject.getInt("markColor")) {
0 -> "不应用"
1 -> "白色"
2 -> "黄色"
6 -> "蓝色"
7 -> "绿色"
9 -> "其他"
else -> ""
}
itemList.add(TwoItemAdapterItem("车道标线颜色", markColor))
itemList.add(
TwoItemAdapterItem(
"车道标线宽度(mm)",
"${arrayObject.getInt("markWidth")}"
)
)
val markMaterial = when (arrayObject.getInt("markMaterial")) {
0 -> "不应用"
1 -> "油漆"
2 -> "突起"
3 -> "油漆和突起"
else -> ""
}
itemList.add(TwoItemAdapterItem("车道标线材质", markMaterial))
itemList.add(
TwoItemAdapterItem(
"横向偏移(mm)",
"${arrayObject.getInt("lateralOffset")}"
)
)
list.add(
LaneBoundaryItem(
"车道标线序号${arrayObject.getInt("markSeqNum")}",
null,
itemList
)
)
}
}
} catch (e: Exception) {
}
return list
}
/**
* 右下角文字
*/
@ -121,26 +213,26 @@ class SignUtil {
/**
* 条件点限速更多信息
*/
fun getConditionLimitMoreInfoText(renderEntity: RenderEntity): List<ElectronicEyeMoreInfoAdapterItem> {
fun getConditionLimitMoreInfoText(renderEntity: RenderEntity): List<TwoItemAdapterItem> {
val list = mutableListOf<ElectronicEyeMoreInfoAdapterItem>()
val list = mutableListOf<TwoItemAdapterItem>()
val maxSpeed = renderEntity.properties["maxSpeed"]
if (maxSpeed != null) {
list.add(
ElectronicEyeMoreInfoAdapterItem(
TwoItemAdapterItem(
title = "最高限速值(km/h)", text = maxSpeed
)
)
}
list.add(
ElectronicEyeMoreInfoAdapterItem(
TwoItemAdapterItem(
title = "限速条件", text = getConditionLimitText(renderEntity)
)
)
val carType = renderEntity.properties["vehicleType"]
if (carType != "0") {
list.add(
ElectronicEyeMoreInfoAdapterItem(
TwoItemAdapterItem(
title = "车辆类型", text = getElectronicEyeVehicleType(carType!!.toInt())
)
)
@ -148,7 +240,7 @@ class SignUtil {
val time = renderEntity.properties["validPeriod"]
if (time?.isNotEmpty() == true) {
list.add(
ElectronicEyeMoreInfoAdapterItem(
TwoItemAdapterItem(
title = "时间段", text = time
)
)
@ -241,16 +333,16 @@ class SignUtil {
/**
* 常规点限速更多信息
*/
fun getSpeedLimitMoreInfoText(renderEntity: RenderEntity): List<ElectronicEyeMoreInfoAdapterItem> {
fun getSpeedLimitMoreInfoText(renderEntity: RenderEntity): List<TwoItemAdapterItem> {
val list = mutableListOf<ElectronicEyeMoreInfoAdapterItem>()
val list = mutableListOf<TwoItemAdapterItem>()
list.add(
ElectronicEyeMoreInfoAdapterItem(
TwoItemAdapterItem(
title = "最高限速值(km/h)", text = getSpeedLimitMaxText(renderEntity)
)
)
list.add(
ElectronicEyeMoreInfoAdapterItem(
TwoItemAdapterItem(
title = "最低限速值(km/h)", text = getSpeedLimitMinText(renderEntity)
)
)
@ -406,13 +498,6 @@ class SignUtil {
return stringBuffer.toString()
}
/**
* 获取车道边界线详细信息
*/
fun getLaneBoundaryInfo(data:RenderEntity){
}
/**
* 获取道路名列表
*/
@ -466,21 +551,49 @@ class SignUtil {
return isMore
}
/**
* 可变点限速详细信息
*/
fun getChangeLimitSpeedInfo(renderEntity: RenderEntity): List<TwoItemAdapterItem> {
val list = mutableListOf<TwoItemAdapterItem>()
val kindCode = renderEntity.properties["location"]
if (kindCode != null) {
when (kindCode.toInt()) {
1 -> list.add(
TwoItemAdapterItem(
title = "标牌位置", text = ""
)
)
2 -> list.add(
TwoItemAdapterItem(
title = "标牌位置", text = ""
)
)
3 -> list.add(
TwoItemAdapterItem(
title = "标牌位置", text = ""
)
)
}
}
return list
}
/**
* 获取电子眼详细信息
*/
fun getElectronicEyeMoreInfo(renderEntity: RenderEntity): List<ElectronicEyeMoreInfoAdapterItem> {
val list = mutableListOf<ElectronicEyeMoreInfoAdapterItem>()
fun getElectronicEyeMoreInfo(renderEntity: RenderEntity): List<TwoItemAdapterItem> {
val list = mutableListOf<TwoItemAdapterItem>()
val kindCode = renderEntity.properties["kind"]!!.toInt()
val kind = ElectronicEyeMoreInfoAdapterItem(
val kind = TwoItemAdapterItem(
title = "电子眼类型", text = getElectronicEyeKindType(kindCode)
)
list.add(kind)
when (kindCode) {
1, 2, 3, 4, 5, 6, 20, 21 -> {
list.add(
ElectronicEyeMoreInfoAdapterItem(
TwoItemAdapterItem(
title = "限速值(km/h)",
text = renderEntity.properties["speedLimit"].toString()
)
@ -490,23 +603,22 @@ class SignUtil {
val carType = renderEntity.properties["vehicleType"]
if (carType != null && carType != "0") {
list.add(
ElectronicEyeMoreInfoAdapterItem(
title = "车辆类型",
text = getElectronicEyeVehicleType(carType.toInt())
TwoItemAdapterItem(
title = "车辆类型", text = getElectronicEyeVehicleType(carType.toInt())
)
)
}
val time = renderEntity.properties["validPeriod"]
if (time?.isNotEmpty() == true) {
list.add(
ElectronicEyeMoreInfoAdapterItem(
TwoItemAdapterItem(
title = "时间段", text = time
)
)
}
if (kindCode == 20 || kindCode == 21) {
list.add(
ElectronicEyeMoreInfoAdapterItem(
TwoItemAdapterItem(
title = "区间测试配对", text = renderEntity.properties["pairEleceyeId"].toString()
)
)

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M7,10l5,5 5,-5z"/>
</vector>

View File

@ -0,0 +1,5 @@
<vector android:autoMirrored="true" android:height="24dp"
android:tint="#1717E0" android:viewportHeight="24"
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M14,7l-5,5 5,5V7z"/>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:bottomLeftRadius="6dp"
android:bottomRightRadius="6dp"
android:topLeftRadius="6dp"
android:topRightRadius="6dp" />
<solid android:color="#2632335e" />
</shape>

View File

@ -90,7 +90,7 @@
<FrameLayout
android:id="@+id/main_activity_sign_more_info_fragment"
android:layout_width="240dp"
android:layout_height="wrap_content"
android:layout_height="300dp"
android:layout_marginTop="80dp"
android:minHeight="140dp"
app:layout_constraintLeft_toLeftOf="@id/main_activity_top_sign_recyclerview"

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:orientation="vertical"
android:paddingTop="5dp"
android:paddingBottom="5dp">
<TextView
android:id="@+id/contactName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/white" />
<ImageView
android:id="@+id/expand_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/contactName"
android:layout_alignBottom="@id/contactName"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:src="@drawable/baseline_arrow_drop_down_24" />
<LinearLayout
android:id="@+id/infos"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/contactName"
android:alpha="0"
android:orientation="vertical"
android:paddingLeft="5dp" />
</RelativeLayout>

View File

@ -5,7 +5,7 @@
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:paddingBottom="5dp"
tools:context="com.navinfo.omqs.ui.fragment.signMoreInfo.ElectronicEyeInfoAdapter">
tools:context="com.navinfo.omqs.ui.fragment.signMoreInfo.TwoItemAdapter">
<TextView
android:id="@+id/title"

View File

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_rect_white_6dp_bg"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_bg_blue_bg_4_radius"
android:textColor="@color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/blue" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:background="@drawable/measuring_tool_select_point" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="选点"
android:textColor="@color/black"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:background="@drawable/measuring_tool_distance" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="测距"
android:textColor="@color/black"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:background="@drawable/measuring_tool_area" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="测面积"
android:textColor="@color/black"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:background="@drawable/measuring_tool_angle" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="测角度"
android:textColor="@color/black"
android:textSize="12sp" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/baseline_arrow_left_24"
android:gravity="center"
android:text="上一步"
android:textColor="@color/blue"
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/baseline_arrow_left_24"
android:gravity="center"
android:text="重复"
android:textColor="@color/blue"
android:textSize="12sp" />
</LinearLayout>

View File

@ -1,6 +1,5 @@
package com.navinfo.collect.library.data.entity
import com.navinfo.collect.library.system.Constant
import com.navinfo.collect.library.utils.GeometryTools
import com.navinfo.collect.library.utils.GeometryToolsKt
import io.realm.RealmDictionary
@ -8,9 +7,7 @@ import io.realm.RealmObject
import io.realm.RealmSet
import io.realm.annotations.Ignore
import io.realm.annotations.PrimaryKey
import org.locationtech.jts.geom.Coordinate
import org.locationtech.jts.geom.Geometry
import org.oscim.core.MercatorProjection
import java.util.*
/**

View File

@ -218,11 +218,11 @@ class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView, traceP
labelNiLocationLayer.isEnabled = false
}
fun omdbLayersUpdate(){
// omdbVectorTileLayer
fun omdbLayersClear(){
// omdbVectorTileLayer.
// omdbReferenceTileLayer.
omdbLabelLayer.update()
omdbReferenceLabelLayer.update()
omdbLabelLayer.clearLabels()
omdbReferenceLabelLayer.clearLabels()
}
}

View File

@ -1,6 +1,7 @@
package com.navinfo.collect.library.map.source;
import android.os.Build;
import android.util.Log;
import androidx.annotation.RequiresApi;
@ -29,27 +30,28 @@ public class OMDBReferenceDataSource implements ITileDataSource {
@Override
public void query(MapTile tile, ITileDataSink mapDataSink) {
// 获取tile对应的坐标范围
if (tile.zoomLevel>=Constant.OMDB_MIN_ZOOM&&tile.zoomLevel<=Constant.OVER_ZOOM) {
int m = Constant.OVER_ZOOM-tile.zoomLevel;
int xStart = (int)tile.tileX<<m;
int xEnd = (int)((tile.tileX+1)<<m);
int yStart = (int)tile.tileY<<m;
int yEnd = (int)((tile.tileY+1)<<m);
if (tile.zoomLevel >= Constant.OMDB_MIN_ZOOM && tile.zoomLevel <= Constant.OVER_ZOOM) {
int m = Constant.OVER_ZOOM - tile.zoomLevel;
int xStart = (int) tile.tileX << m;
int xEnd = (int) ((tile.tileX + 1) << m);
int yStart = (int) tile.tileY << m;
int yEnd = (int) ((tile.tileY + 1) << m);
Log.e("jingo", Constant.TASK_ID + " " + xStart + " " + xEnd + " " + yStart + " " + yEnd);
RealmQuery<ReferenceEntity> realmQuery = Realm.getDefaultInstance().where(ReferenceEntity.class)
.rawPredicate("tileX>="+xStart+" and tileX<="+xEnd+" and tileY>="+yStart+" and tileY<="+yEnd);
.rawPredicate("taskId=" + Constant.TASK_ID + " and tileX>=" + xStart + " and tileX<=" + xEnd + " and tileY>=" + yStart + " and tileY<=" + yEnd);
// 筛选不显示的数据
if (Constant.HAD_LAYER_INVISIABLE_ARRAY!=null&&Constant.HAD_LAYER_INVISIABLE_ARRAY.length>0) {
if (Constant.HAD_LAYER_INVISIABLE_ARRAY != null && Constant.HAD_LAYER_INVISIABLE_ARRAY.length > 0) {
realmQuery.beginGroup();
for (String type: Constant.HAD_LAYER_INVISIABLE_ARRAY) {
for (String type : Constant.HAD_LAYER_INVISIABLE_ARRAY) {
realmQuery.notEqualTo("table", type);
}
realmQuery.endGroup();
}
List<ReferenceEntity> listResult = realmQuery/*.distinct("id")*/.findAll();
if (!listResult.isEmpty()) {
mThreadLocalDecoders.get().decode(tile.zoomLevel,tile, mapDataSink, listResult);
mThreadLocalDecoders.get().decode(tile.zoomLevel, tile, mapDataSink, listResult);
}
Log.e("jingo",listResult.size() + "条数据");
mapDataSink.completed(QueryResult.SUCCESS);
// Log.d("RealmDBTileDataSource", "tile:"+tile.getBoundingBox().toString());
} else {

View File

@ -38,8 +38,8 @@ public class OMDBTileDataSource implements ITileDataSource {
int xEnd = (int) ((tile.tileX + 1) << m);
int yStart = (int) tile.tileY << m;
int yEnd = (int) ((tile.tileY + 1) << m);
RealmQuery<RenderEntity> realmQuery = Realm.getDefaultInstance().where(RenderEntity.class).rawPredicate("tileX>=" + xStart + " and tileX<=" + xEnd + " and tileY>=" + yStart + " and tileY<=" + yEnd);
Log.e("jingo", Constant.TASK_ID + " " + xStart + " " + xEnd + " " + yStart + " " + yEnd);
RealmQuery<RenderEntity> realmQuery = Realm.getDefaultInstance().where(RenderEntity.class).rawPredicate("taskId=" + Constant.TASK_ID + " and tileX>=" + xStart + " and tileX<=" + xEnd + " and tileY>=" + yStart + " and tileY<=" + yEnd);
// 筛选不显示的数据
if (Constant.HAD_LAYER_INVISIABLE_ARRAY != null && Constant.HAD_LAYER_INVISIABLE_ARRAY.length > 0) {
realmQuery.beginGroup();
@ -50,9 +50,10 @@ public class OMDBTileDataSource implements ITileDataSource {
}
List<RenderEntity> listResult = realmQuery/*.distinct("id")*/.findAll();
if (!listResult.isEmpty()) {
Log.e("qj","查询数据=="+listResult.size()+"==地图级别"+tile.zoomLevel);
mThreadLocalDecoders.get().decode(tile.zoomLevel,tile, mapDataSink, listResult);
Log.e("qj", "查询数据==" + listResult.size() + "==地图级别" + tile.zoomLevel);
mThreadLocalDecoders.get().decode(tile.zoomLevel, tile, mapDataSink, listResult);
}
Log.e("jingo",listResult.size() + "条数据 主");
mapDataSink.completed(QueryResult.SUCCESS);
// Log.d("RealmDBTileDataSource", "tile:"+tile.getBoundingBox().toString());
} else {

View File

@ -41,7 +41,7 @@ public class RealmDBTileDataSource implements ITileDataSource {
int yStart = (int)tile.tileY<<m;
int yEnd = (int)((tile.tileY+1)<<m);
RealmQuery<GeometryFeatureEntity> realmQuery = Realm.getInstance(RealmUtils.getInstance().getRealmConfiguration()).where(GeometryFeatureEntity.class)
RealmQuery<GeometryFeatureEntity> realmQuery = Realm.getDefaultInstance().where(GeometryFeatureEntity.class)
.rawPredicate("tileX>="+xStart+" and tileX<="+xEnd+" and tileY>="+yStart+" and tileY<="+yEnd);
// 筛选不显示的数据
if (Constant.HAD_LAYER_INVISIABLE_ARRAY!=null&&Constant.HAD_LAYER_INVISIABLE_ARRAY.length>0) {

View File

@ -17,10 +17,10 @@ public class Constant {
public static String MAP_PATH = Environment.getExternalStorageDirectory() + "/map/";
public static void setVisibleTypeMap(Map<String, Boolean> visibleTypeMap) {
Map<String, Boolean> HD_LAYER_VISIABLE_MAP= new HashMap<>();
Map<String, Boolean> HD_LAYER_VISIABLE_MAP = new HashMap<>();
// 只记录不显示的类型
if (visibleTypeMap!=null&&!visibleTypeMap.isEmpty()) {
for (Map.Entry<String, Boolean> e:visibleTypeMap.entrySet()) {
if (visibleTypeMap != null && !visibleTypeMap.isEmpty()) {
for (Map.Entry<String, Boolean> e : visibleTypeMap.entrySet()) {
if (!e.getValue()) {
HD_LAYER_VISIABLE_MAP.put(e.getKey(), e.getValue());
}
@ -28,11 +28,13 @@ public class Constant {
}
HAD_LAYER_INVISIABLE_ARRAY = HD_LAYER_VISIABLE_MAP.keySet().toArray(new String[HD_LAYER_VISIABLE_MAP.keySet().size()]);
}
public static String[] HAD_LAYER_INVISIABLE_ARRAY;
public static final int OVER_ZOOM = 21;
public static final int MAX_ZOOM = 23;
public static final int OMDB_MIN_ZOOM = 16;
public static int TASK_ID = -1;
/**
* 服务器地址
*/