Merge branch 'master' of https://gitlab.navinfo.com/CollectVehicle/OneMapQS
Conflicts: app/src/main/java/com/navinfo/omqs/ui/fragment/tasklist/TaskListFragment.kt
This commit is contained in:
commit
d1f7129549
@ -92,6 +92,8 @@ class Constant {
|
||||
val OMDB_LAYER_VISIBLE_LIST: MutableList<String> = mutableListOf() // 记录OMDB数据显示的图层名称列表
|
||||
|
||||
const val EVENT_LAYER_MANAGER_CHANGE = "EVENT_LAYER_MANAGER_CHANGE" // 图层管理中的配置修改
|
||||
|
||||
const val SELECT_TASK_ID = "select_task_id" //选中的任务ID
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.navinfo.omqs.hilt
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.util.Log
|
||||
import androidx.room.Room
|
||||
import com.google.gson.Gson
|
||||
@ -25,7 +27,6 @@ import io.realm.Realm
|
||||
import kotlinx.coroutines.*
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.logging.HttpLoggingInterceptor
|
||||
import retrofit2.Call
|
||||
import retrofit2.Retrofit
|
||||
import retrofit2.converter.gson.GsonConverterFactory
|
||||
import java.util.concurrent.TimeUnit
|
||||
@ -38,6 +39,7 @@ import javax.inject.Singleton
|
||||
@InstallIn(SingletonComponent::class)
|
||||
class GlobalModule {
|
||||
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideApplication(@ApplicationContext application: Application): OMQSApplication {
|
||||
@ -166,4 +168,10 @@ class GlobalModule {
|
||||
fun provideRealmDefaultInstance(): Realm {
|
||||
return Realm.getDefaultInstance()
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideSharedPreferences(context: Application): SharedPreferences {
|
||||
return context.getSharedPreferences("Shared" + Constant.USER_ID, Context.MODE_PRIVATE)
|
||||
}
|
||||
}
|
@ -462,6 +462,24 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 准星的显隐控制
|
||||
*/
|
||||
fun setHomeCenterVisibility(visible: Int) {
|
||||
binding.mainActivityHomeCenter.visibility = visible
|
||||
binding.mainActivityHomeCenterText.visibility = visible
|
||||
if (visible != View.VISIBLE) {
|
||||
binding.mainActivityHomeCenterText.text = ""
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置屏幕中心文字内容
|
||||
*/
|
||||
fun setHomeCenterText(str: String) {
|
||||
binding.mainActivityHomeCenterText.text = str
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏或显示右侧展开按钮
|
||||
*/
|
||||
@ -474,6 +492,10 @@ class MainActivity : BaseActivity() {
|
||||
*/
|
||||
fun setTopMenuButtonVisibility(visibility: Int) {
|
||||
binding.mainActivityMenu.visibility = visibility
|
||||
if (visibility != View.VISIBLE) {
|
||||
binding.mainActivityMenuGroup.visibility = View.INVISIBLE
|
||||
binding.mainActivityMenu.isSelected = false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -608,8 +630,14 @@ class MainActivity : BaseActivity() {
|
||||
*/
|
||||
fun onClickNewNote() {
|
||||
rightController.navigate(R.id.NoteFragment)
|
||||
binding.mainActivityMenu.isSelected = false
|
||||
binding.mainActivityMenuGroup.visibility = View.INVISIBLE
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增评测link
|
||||
*/
|
||||
fun onClickTaskLink() {
|
||||
rightController.navigate(R.id.TaskLinkFragment)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,169 @@
|
||||
package com.navinfo.omqs.ui.fragment.tasklink
|
||||
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.navinfo.collect.library.map.NIMapController
|
||||
import com.navinfo.omqs.R
|
||||
import com.navinfo.omqs.databinding.FragmentTaskLinkBinding
|
||||
import com.navinfo.omqs.ui.activity.map.MainActivity
|
||||
import com.navinfo.omqs.ui.fragment.BaseFragment
|
||||
import com.navinfo.omqs.ui.other.BaseToast
|
||||
import com.navinfo.omqs.ui.other.shareViewModels
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class TaskLinkFragment : BaseFragment(), View.OnClickListener {
|
||||
private var _binding: FragmentTaskLinkBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
@Inject
|
||||
lateinit var mapController: NIMapController
|
||||
|
||||
private val viewModel by shareViewModels<TaskLinkViewModel>("taskLink")
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = FragmentTaskLinkBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
||||
binding.taskLinkAddPoint.setOnClickListener(this)
|
||||
binding.taskLinkKind.setOnClickListener(this)
|
||||
binding.taskLinkFunctionalLevel.setOnClickListener(this)
|
||||
binding.taskLinkDataLevel.setOnClickListener(this)
|
||||
binding.taskLinkBarCancel.setOnClickListener(this)
|
||||
binding.taskLinkBarSave.setOnClickListener(this)
|
||||
/**
|
||||
* 数据操作结束
|
||||
*/
|
||||
viewModel.liveDataFinish.observe(viewLifecycleOwner) {
|
||||
if (it)
|
||||
onBackPressed()
|
||||
}
|
||||
/**
|
||||
* 种别
|
||||
*/
|
||||
viewModel.liveDataSelectKind.observe(viewLifecycleOwner) {
|
||||
binding.taskLinkKind.text = it?.title
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能等级
|
||||
*/
|
||||
viewModel.liveDataSelectFunctionLevel.observe(viewLifecycleOwner) {
|
||||
binding.taskLinkFunctionalLevel.text = it?.title
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据等级
|
||||
*/
|
||||
viewModel.liveDataSelectDataLevel.observe(viewLifecycleOwner) {
|
||||
binding.taskLinkDataLevel.text = it?.title
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前选中任务
|
||||
*/
|
||||
viewModel.liveDataTaskBean.observe(viewLifecycleOwner) {
|
||||
binding.taskLinkTaskName.text = it?.evaluationTaskName
|
||||
}
|
||||
|
||||
/**
|
||||
* viewModel 返回的文字信息
|
||||
*/
|
||||
viewModel.liveDataToastMessage.observe(viewLifecycleOwner) {
|
||||
Toast.makeText(requireContext(), it, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
/**
|
||||
* 线长度
|
||||
*/
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
mapController.measureLayerHandler.lineLenghtLiveData.observe(viewLifecycleOwner) {
|
||||
binding.taskLinkLength.text = "${it}米"
|
||||
}
|
||||
mapController.measureLayerHandler.tempLineDistanceLiveData.observe(viewLifecycleOwner) {
|
||||
(activity as MainActivity).setHomeCenterText(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
/**
|
||||
* 显示地图准星
|
||||
*/
|
||||
activity?.let {
|
||||
(activity as MainActivity).setHomeCenterVisibility(View.VISIBLE)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
/**
|
||||
* 隐藏地图准星
|
||||
*/
|
||||
requireActivity().findNavController(R.id.main_activity_middle_fragment).navigateUp()
|
||||
activity?.let {
|
||||
(activity as MainActivity).setHomeCenterVisibility(View.GONE)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
when (v) {
|
||||
binding.taskLinkAddPoint -> {
|
||||
viewModel.addPoint()
|
||||
}
|
||||
binding.taskLinkKind -> {
|
||||
showMiddleFragment()
|
||||
viewModel.setAdapterList(1)
|
||||
}
|
||||
binding.taskLinkFunctionalLevel -> {
|
||||
showMiddleFragment()
|
||||
viewModel.setAdapterList(2)
|
||||
}
|
||||
binding.taskLinkDataLevel -> {
|
||||
showMiddleFragment()
|
||||
viewModel.setAdapterList(3)
|
||||
}
|
||||
binding.taskLinkBarCancel -> {
|
||||
onBackPressed()
|
||||
}
|
||||
binding.taskLinkBarSave -> {
|
||||
viewModel.saveData()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示中间面板
|
||||
*/
|
||||
private fun showMiddleFragment() {
|
||||
activity?.run {
|
||||
val controller = findNavController(
|
||||
R.id.main_activity_middle_fragment
|
||||
)
|
||||
if (controller.currentDestination?.id == R.id.MiddleEmptyFragment)
|
||||
controller.navigate(R.id.TaskLinkMiddleFragment)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBackPressed(): Boolean {
|
||||
findNavController().navigateUp()
|
||||
return true
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
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
|
||||
|
||||
data class TaskLinkInfoAdapterItem(
|
||||
val title: String,
|
||||
val type: String
|
||||
)
|
||||
|
||||
class TaskLinkMiddleAdapter(private var itemListener: ((Int, TaskLinkInfoAdapterItem) -> Unit?)? = null) :
|
||||
BaseRecyclerViewAdapter<TaskLinkInfoAdapterItem>() {
|
||||
|
||||
private var selectTitle = ""
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
|
||||
val viewBinding =
|
||||
AdapterTaskLinkInfoBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
return BaseViewHolder(viewBinding)
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
|
||||
val binding = holder.viewBinding as AdapterTaskLinkInfoBinding
|
||||
binding.title.text = data[position].title
|
||||
|
||||
if (selectTitle == binding.title.text) {
|
||||
binding.title.setBackgroundResource(R.drawable.shape_bg_blue_bg_4_radius)
|
||||
binding.title.setTextColor(holder.viewBinding.root.context.getColor(R.color.white))
|
||||
} else {
|
||||
binding.title.setBackgroundResource(R.drawable.shape_rect_white_2dp_bg)
|
||||
binding.title.setTextColor(holder.viewBinding.root.context.getColor(R.color.black))
|
||||
}
|
||||
binding.root.setOnClickListener {
|
||||
if (selectTitle != data[position].title) {
|
||||
selectTitle = data[position].title
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
itemListener?.invoke(position, data[position])
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package com.navinfo.omqs.ui.fragment.tasklink
|
||||
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.navinfo.collect.library.map.NIMapController
|
||||
import com.navinfo.omqs.R
|
||||
import com.navinfo.omqs.databinding.FragmentTaskLinkBinding
|
||||
import com.navinfo.omqs.databinding.FragmentTaskLinkMiddleBinding
|
||||
import com.navinfo.omqs.ui.activity.map.MainActivity
|
||||
import com.navinfo.omqs.ui.fragment.BaseFragment
|
||||
import com.navinfo.omqs.ui.fragment.evaluationresult.LeftAdapter
|
||||
import com.navinfo.omqs.ui.other.shareViewModels
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class TaskLinkMiddleFragment : BaseFragment(), View.OnClickListener {
|
||||
private var _binding: FragmentTaskLinkMiddleBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
@Inject
|
||||
lateinit var mapController: NIMapController
|
||||
|
||||
private val viewModel by shareViewModels<TaskLinkViewModel>("taskLink")
|
||||
|
||||
/**
|
||||
* 监听左侧栏的点击事件
|
||||
*/
|
||||
val adapter = TaskLinkMiddleAdapter { _, item ->
|
||||
viewModel.setAdapterSelectValve(item)
|
||||
if (activity != null) {
|
||||
requireActivity().findNavController(R.id.main_activity_middle_fragment).navigateUp()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = FragmentTaskLinkMiddleBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
||||
binding.taskLinkMiddleRecyclerview.layoutManager = LinearLayoutManager(requireContext())
|
||||
binding.taskLinkMiddleRecyclerview.adapter = adapter
|
||||
viewModel.liveDataLeftAdapterList.observe(viewLifecycleOwner) {
|
||||
adapter.refreshData(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
when (v) {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBackPressed(): Boolean {
|
||||
findNavController().navigateUp()
|
||||
return true
|
||||
}
|
||||
}
|
@ -0,0 +1,202 @@
|
||||
package com.navinfo.omqs.ui.fragment.tasklink
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import android.os.Build
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.navinfo.collect.library.data.entity.HadLinkDvoBean
|
||||
import com.navinfo.collect.library.data.entity.TaskBean
|
||||
import com.navinfo.collect.library.map.NIMapController
|
||||
import com.navinfo.omqs.Constant
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import io.realm.Realm
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
import org.bson.codecs.UuidCodec
|
||||
import org.bson.internal.UuidHelper
|
||||
import org.oscim.core.GeoPoint
|
||||
import java.util.UUID
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
class TaskLinkViewModel @Inject constructor(
|
||||
val mapController: NIMapController,
|
||||
val sharedPreferences: SharedPreferences
|
||||
) : ViewModel(), SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
/**
|
||||
* 种别
|
||||
*/
|
||||
private val kindList = listOf<TaskLinkInfoAdapterItem>(
|
||||
TaskLinkInfoAdapterItem("高速道路", "1"),
|
||||
TaskLinkInfoAdapterItem("城市高速", "2"),
|
||||
TaskLinkInfoAdapterItem("国道", "3"),
|
||||
TaskLinkInfoAdapterItem("省道", "4"),
|
||||
TaskLinkInfoAdapterItem("县道", "6"),
|
||||
TaskLinkInfoAdapterItem("乡镇村道路", "7"),
|
||||
TaskLinkInfoAdapterItem("其他道路", "8"),
|
||||
TaskLinkInfoAdapterItem("非引导道路", "9"),
|
||||
TaskLinkInfoAdapterItem("步行道路", "10"),
|
||||
TaskLinkInfoAdapterItem("人渡", "11"),
|
||||
TaskLinkInfoAdapterItem("轮渡", "13"),
|
||||
TaskLinkInfoAdapterItem("自行车道路", "15"),
|
||||
)
|
||||
|
||||
/**
|
||||
* FunctionGrade 功能等级
|
||||
*/
|
||||
private val functionLevelList = listOf<TaskLinkInfoAdapterItem>(
|
||||
TaskLinkInfoAdapterItem("等级1", "1"),
|
||||
TaskLinkInfoAdapterItem("等级2", "2"),
|
||||
TaskLinkInfoAdapterItem("等级3", "3"),
|
||||
TaskLinkInfoAdapterItem("等级4", "4"),
|
||||
TaskLinkInfoAdapterItem("等级5", "5"),
|
||||
)
|
||||
|
||||
/**
|
||||
* 数据级别
|
||||
*/
|
||||
private val dataLevelList = listOf<TaskLinkInfoAdapterItem>(
|
||||
TaskLinkInfoAdapterItem("Pro lane model(有高精车道模型覆盖的高速和城高link)", "1"),
|
||||
TaskLinkInfoAdapterItem("Lite lane model(有高精车道模型覆盖的普通路link)", "2"),
|
||||
TaskLinkInfoAdapterItem("Standard road model(其他link)", "3"),
|
||||
)
|
||||
|
||||
/**
|
||||
* 处理结束关闭fragment`
|
||||
*/
|
||||
val liveDataFinish = MutableLiveData(false)
|
||||
|
||||
/**
|
||||
* 左侧面板展示内容
|
||||
*/
|
||||
val liveDataLeftAdapterList = MutableLiveData<List<TaskLinkInfoAdapterItem>>()
|
||||
|
||||
/**
|
||||
* 选择的种别
|
||||
*/
|
||||
val liveDataSelectKind = MutableLiveData<TaskLinkInfoAdapterItem?>()
|
||||
|
||||
/**
|
||||
* 选择的功能等级
|
||||
*/
|
||||
val liveDataSelectFunctionLevel = MutableLiveData<TaskLinkInfoAdapterItem?>()
|
||||
|
||||
/**
|
||||
* 选择的数据等级
|
||||
*/
|
||||
val liveDataSelectDataLevel = MutableLiveData<TaskLinkInfoAdapterItem?>()
|
||||
|
||||
/**
|
||||
* 要提示的错误信息
|
||||
*/
|
||||
val liveDataToastMessage = MutableLiveData<String>()
|
||||
|
||||
/**
|
||||
* 当前选中的任务
|
||||
*/
|
||||
val liveDataTaskBean = MutableLiveData<TaskBean?>()
|
||||
|
||||
/**
|
||||
* 当前正在选择哪个数据 1:种别 2:功能等级 3:数据等级
|
||||
*/
|
||||
private var selectType = 0
|
||||
|
||||
init {
|
||||
getTaskBean()
|
||||
sharedPreferences.registerOnSharedPreferenceChangeListener(this)
|
||||
}
|
||||
|
||||
|
||||
private fun getTaskBean() {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val id = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1)
|
||||
val realm = Realm.getDefaultInstance()
|
||||
val res = realm.where(TaskBean::class.java).equalTo("id", id).findFirst()
|
||||
liveDataTaskBean.postValue(realm.copyFromRealm(res))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑点
|
||||
*/
|
||||
fun addPoint() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
mapController.measureLayerHandler.drawLineOrPolygon(false)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置左侧面板要显示的内容
|
||||
*/
|
||||
fun setAdapterList(type: Int) {
|
||||
selectType = type
|
||||
when (type) {
|
||||
1 -> liveDataLeftAdapterList.value = kindList
|
||||
2 -> liveDataLeftAdapterList.value = functionLevelList
|
||||
3 -> liveDataLeftAdapterList.value = dataLevelList
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回左侧面板选择的内容
|
||||
*/
|
||||
fun setAdapterSelectValve(item: TaskLinkInfoAdapterItem) {
|
||||
when (selectType) {
|
||||
1 -> liveDataSelectKind.value = item
|
||||
2 -> liveDataSelectFunctionLevel.value = item
|
||||
3 -> liveDataSelectDataLevel.value = item
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
mapController.measureLayerHandler.clear()
|
||||
}
|
||||
sharedPreferences.unregisterOnSharedPreferenceChangeListener(this)
|
||||
super.onCleared()
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
fun saveData() {
|
||||
viewModelScope.launch(Dispatchers.Default) {
|
||||
if (liveDataTaskBean.value == null) {
|
||||
liveDataToastMessage.postValue("还没有选择任何一条任务!")
|
||||
return@launch
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
|
||||
if (mapController.measureLayerHandler.mPathLayer.points.size < 2) {
|
||||
liveDataToastMessage.postValue("道路点少于2个!")
|
||||
return@launch
|
||||
}
|
||||
}
|
||||
if (liveDataSelectKind.value == null) {
|
||||
liveDataToastMessage.postValue("请选择种别!")
|
||||
return@launch
|
||||
}
|
||||
if (liveDataSelectFunctionLevel.value == null) {
|
||||
liveDataToastMessage.postValue("请选择功能等级!")
|
||||
return@launch
|
||||
}
|
||||
if (liveDataSelectDataLevel.value == null) {
|
||||
liveDataToastMessage.postValue("请选择数据等级!")
|
||||
return@launch
|
||||
}
|
||||
val linkBean = HadLinkDvoBean(linkPid = UUID.randomUUID().toString())
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听shared变化
|
||||
*/
|
||||
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) {
|
||||
if (key == Constant.SELECT_TASK_ID) {
|
||||
getTaskBean()
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package com.navinfo.omqs.ui.fragment.tasklist
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.content.DialogInterface
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
@ -16,14 +15,10 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.navinfo.collect.library.data.entity.HadLinkDvoBean
|
||||
import com.navinfo.omqs.R
|
||||
import com.navinfo.omqs.databinding.FragmentTaskBinding
|
||||
import com.navinfo.omqs.databinding.FragmentTaskListBinding
|
||||
import com.navinfo.omqs.http.taskdownload.TaskDownloadManager
|
||||
import com.navinfo.omqs.http.taskupload.TaskUploadManager
|
||||
import com.navinfo.omqs.ui.fragment.BaseFragment
|
||||
import com.navinfo.omqs.ui.other.shareViewModels
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
|
||||
/**
|
||||
* 当前任务的道路列表
|
||||
@ -42,7 +37,9 @@ class TaskFragment : BaseFragment() {
|
||||
TaskAdapter(object : TaskAdapterCallback {
|
||||
override fun itemOnClick(bean: HadLinkDvoBean) {
|
||||
if(bean!=null){
|
||||
viewModel.showCurrentLink(bean)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
viewModel.showCurrentLink(bean)
|
||||
}
|
||||
}else{
|
||||
Toast.makeText(context, "数据错误,无法显示!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.navinfo.omqs.ui.fragment.tasklist
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Dialog
|
||||
import android.graphics.Color
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
@ -10,7 +9,6 @@ import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.navinfo.collect.library.data.entity.QsRecordBean
|
||||
import com.navinfo.collect.library.data.entity.TaskBean
|
||||
import com.navinfo.omqs.R
|
||||
import com.navinfo.omqs.databinding.AdapterTaskListBinding
|
||||
@ -19,15 +17,9 @@ import com.navinfo.omqs.http.taskupload.TaskUploadManager
|
||||
import com.navinfo.omqs.tools.FileManager
|
||||
import com.navinfo.omqs.tools.FileManager.Companion.FileDownloadStatus
|
||||
import com.navinfo.omqs.tools.FileManager.Companion.FileUploadStatus
|
||||
import com.navinfo.omqs.ui.dialog.FirstDialog
|
||||
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
|
||||
import com.navinfo.omqs.ui.other.BaseViewHolder
|
||||
import com.navinfo.omqs.ui.widget.LeftDeleteView
|
||||
import io.realm.Realm
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
/**
|
||||
* 离线地图城市列表 RecyclerView 适配器
|
||||
@ -51,8 +43,7 @@ class TaskListAdapter(
|
||||
|
||||
private var isShowDeleteView = false
|
||||
|
||||
private
|
||||
val downloadBtnClick = View.OnClickListener() {
|
||||
private val downloadBtnClick = View.OnClickListener() {
|
||||
if (it.tag != null) {
|
||||
val taskBean = data[it.tag as Int]
|
||||
if (taskBean.hadLinkDvoList.isNotEmpty()) {
|
||||
@ -131,6 +122,7 @@ class TaskListAdapter(
|
||||
holder: BaseViewHolder,
|
||||
@SuppressLint("RecyclerView") position: Int
|
||||
) {
|
||||
Log.e("jingo", "TaskListAdapter onBindViewHolder $position ")
|
||||
val binding: AdapterTaskListBinding =
|
||||
holder.viewBinding as AdapterTaskListBinding
|
||||
val taskBean = data[position]
|
||||
@ -216,7 +208,7 @@ class TaskListAdapter(
|
||||
* 重置item状态
|
||||
* @param point
|
||||
*/
|
||||
fun restoreItemView() {
|
||||
private fun restoreItemView() {
|
||||
leftDeleteView?.let {
|
||||
if (isShowDeleteView)
|
||||
it.resetDeleteStatus()
|
||||
@ -370,6 +362,17 @@ class TaskListAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
fun initSelectTask(list: List<TaskBean>, id: Int?) {
|
||||
|
||||
for (i in list.indices) {
|
||||
if (list[i].id == id) {
|
||||
selectPosition = i
|
||||
break
|
||||
}
|
||||
}
|
||||
refreshData(list)
|
||||
}
|
||||
|
||||
companion object {
|
||||
object ItemClickStatus {
|
||||
const val ITEM_LAYOUT_CLICK = 0 //条目点击
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.navinfo.omqs.ui.fragment.tasklist
|
||||
|
||||
import android.app.Dialog
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
@ -9,26 +8,15 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.navinfo.collect.library.data.entity.QsRecordBean
|
||||
import com.navinfo.collect.library.data.entity.TaskBean
|
||||
import com.navinfo.omqs.databinding.FragmentTaskListBinding
|
||||
import com.navinfo.omqs.http.taskdownload.TaskDownloadManager
|
||||
import com.navinfo.omqs.http.taskupload.TaskUploadManager
|
||||
import com.navinfo.omqs.tools.FileManager
|
||||
import com.navinfo.omqs.ui.dialog.FirstDialog
|
||||
import com.navinfo.omqs.ui.fragment.BaseFragment
|
||||
import com.navinfo.omqs.ui.other.shareViewModels
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.realm.Realm
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import javax.inject.Inject
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
@AndroidEntryPoint
|
||||
class TaskListFragment : BaseFragment() {
|
||||
|
||||
@ -47,11 +35,27 @@ class TaskListFragment : BaseFragment() {
|
||||
|
||||
private val adapter: TaskListAdapter by lazy {
|
||||
TaskListAdapter(
|
||||
downloadManager, uploadManager,binding.taskListRecyclerview
|
||||
downloadManager, uploadManager, binding.taskListRecyclerview
|
||||
) { _, status, taskBean ->
|
||||
if(taskBean.hadLinkDvoList.isEmpty()){
|
||||
if (taskBean.hadLinkDvoList.isEmpty()) {
|
||||
Toast.makeText(context, "数据错误,无Link数据!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
when (status) {
|
||||
TaskListAdapter.Companion.ItemClickStatus.ITEM_LAYOUT_CLICK -> {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
viewModel.setSelectTaskBean(taskBean)
|
||||
} else {
|
||||
}
|
||||
}
|
||||
TaskListAdapter.Companion.ItemClickStatus.DELETE_LAYOUT_CLICK -> {
|
||||
context?.let { viewModel.removeTask(it, taskBean) }
|
||||
}
|
||||
TaskListAdapter.Companion.ItemClickStatus.UPLOAD_LAYOUT_CLICK -> {
|
||||
showLoadingDialog("正在校验")
|
||||
Toast.makeText(context, "正在校验", Toast.LENGTH_SHORT).show()
|
||||
viewModel.checkUploadTask(binding.root.context, taskBean)
|
||||
}
|
||||
else -> {
|
||||
if(status==TaskListAdapter.Companion.ItemClickStatus.ITEM_LAYOUT_CLICK){
|
||||
viewModel.setSelectTaskBean(taskBean as TaskBean)
|
||||
}else if(status==TaskListAdapter.Companion.ItemClickStatus.DELETE_LAYOUT_CLICK){
|
||||
@ -62,6 +66,7 @@ class TaskListFragment : BaseFragment() {
|
||||
viewModel.checkUploadTask(binding.root.context,taskBean)
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -85,21 +90,13 @@ class TaskListFragment : BaseFragment() {
|
||||
binding.taskListRecyclerview.layoutManager = layoutManager
|
||||
binding.taskListRecyclerview.adapter = adapter
|
||||
viewModel.liveDataTaskList.observe(viewLifecycleOwner) {
|
||||
adapter.refreshData(it)
|
||||
}
|
||||
|
||||
//监听关闭任务状态
|
||||
viewModel.liveDataCloseTask.observe(viewLifecycleOwner){
|
||||
if(it){
|
||||
Toast.makeText(binding.root.context,"成功关闭!",Toast.LENGTH_LONG).show()
|
||||
}
|
||||
hideLoadingDialog()
|
||||
adapter.initSelectTask(it,viewModel.currentSelectTaskBean?.id)
|
||||
}
|
||||
|
||||
//监听并调用上传
|
||||
viewModel.liveDataTaskUpload.observe(viewLifecycleOwner){
|
||||
viewModel.liveDataTaskUpload.observe(viewLifecycleOwner) {
|
||||
for ((key, value) in it) {
|
||||
if(value){
|
||||
if (value) {
|
||||
adapter.uploadTask(key)
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.navinfo.omqs.ui.fragment.tasklist
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.widget.Toast
|
||||
@ -28,7 +29,9 @@ import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
class TaskViewModel @Inject constructor(
|
||||
private val networkService: NetworkService, private val mapController: NIMapController
|
||||
private val networkService: NetworkService,
|
||||
private val mapController: NIMapController,
|
||||
private val sharedPreferences: SharedPreferences
|
||||
) : ViewModel() {
|
||||
|
||||
/**
|
||||
@ -57,7 +60,7 @@ class TaskViewModel @Inject constructor(
|
||||
/**
|
||||
* 当前选中的任务
|
||||
*/
|
||||
private var currentSelectTaskBean: TaskBean? = null
|
||||
var currentSelectTaskBean: TaskBean? = null
|
||||
|
||||
/**
|
||||
* 任务列表查询协程
|
||||
@ -66,6 +69,7 @@ class TaskViewModel @Inject constructor(
|
||||
|
||||
private var filterTaskJob: Job? = null
|
||||
|
||||
|
||||
/**
|
||||
* 下载任务列表
|
||||
*/
|
||||
@ -135,6 +139,15 @@ class TaskViewModel @Inject constructor(
|
||||
FileManager.checkOMDBFileInfo(item)
|
||||
}
|
||||
liveDataTaskList.postValue(taskList)
|
||||
val id = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1)
|
||||
if (id > -1) {
|
||||
for(item in taskList){
|
||||
if(item.id == id){
|
||||
currentSelectTaskBean = item
|
||||
liveDataTaskLinks.postValue(currentSelectTaskBean!!.hadLinkDvoList)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,6 +156,9 @@ class TaskViewModel @Inject constructor(
|
||||
*/
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
fun setSelectTaskBean(taskBean: TaskBean) {
|
||||
|
||||
sharedPreferences.edit().putInt(Constant.SELECT_TASK_ID, taskBean.id).commit()
|
||||
|
||||
currentSelectTaskBean = taskBean
|
||||
|
||||
liveDataTaskLinks.value = taskBean.hadLinkDvoList
|
||||
|
BIN
app/src/main/res/drawable-xxhdpi/icon_menu_note.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/icon_menu_note.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/drawable-xxhdpi/icon_note.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/icon_note.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
@ -31,6 +31,28 @@
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/main_activity_home_center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/home_map_center"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/main_activity_home_center_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/main_activity_home_center"
|
||||
app:layout_constraintRight_toLeftOf="@id/main_activity_home_center"
|
||||
app:layout_constraintTop_toTopOf="@id/main_activity_home_center" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/main_activity_camera2"
|
||||
android:layout_width="48dp"
|
||||
@ -79,7 +101,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/top_right_drawer_btns_mr"
|
||||
app:constraint_referenced_ids="main_activity_serach,main_activity_2d_3d,main_activity_camera,main_activity_trace,main_activity_calc_disance,main_activity_note,main_activity_menu"
|
||||
app:constraint_referenced_ids="main_activity_note,main_activity_task_line,main_activity_serach,main_activity_2d_3d,main_activity_camera,main_activity_trace,main_activity_calc_disance,main_activity_menu"
|
||||
app:flow_horizontalGap="6dp"
|
||||
app:flow_wrapMode="aligned"
|
||||
app:layout_constraintRight_toLeftOf="@id/main_activity_right_fragment"
|
||||
@ -90,7 +112,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="invisible"
|
||||
app:constraint_referenced_ids="main_activity_serach,main_activity_2d_3d,main_activity_camera,main_activity_trace,main_activity_note,main_activity_calc_disance" />
|
||||
app:constraint_referenced_ids="main_activity_serach,main_activity_2d_3d,main_activity_camera,main_activity_trace,main_activity_note,main_activity_task_line,main_activity_calc_disance" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/main_activity_serach"
|
||||
@ -126,6 +148,12 @@
|
||||
android:id="@+id/main_activity_note"
|
||||
style="@style/top_right_drawer_btns_style"
|
||||
android:onClick="@{()->mainActivity.onClickNewNote()}"
|
||||
android:src="@drawable/icon_menu_note" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/main_activity_task_line"
|
||||
style="@style/top_right_drawer_btns_style"
|
||||
android:onClick="@{()->mainActivity.onClickTaskLink()}"
|
||||
android:src="@drawable/icon_calc_disance" />
|
||||
|
||||
<ImageButton
|
||||
@ -517,5 +545,6 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
17
app/src/main/res/layout/adapter_task_link_info.xml
Normal file
17
app/src/main/res/layout/adapter_task_link_info.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
tools:context="com.navinfo.omqs.ui.fragment.tasklink.TaskLinkMiddleAdapter">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:padding="5dp"
|
||||
android:textColor="@color/white" />
|
||||
</LinearLayout>
|
@ -39,7 +39,7 @@
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:layout_marginRight="14dp"
|
||||
android:background="@drawable/ripple_fragment_save_botton_bg"
|
||||
android:background="@drawable/ripple_fragment_save_button_bg"
|
||||
android:src="@drawable/icon_save"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="@dimen/right_fragment_w"
|
||||
@ -8,13 +9,13 @@
|
||||
tools:context=".ui.fragment.note.NoteFragment">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/note_bar"
|
||||
android:id="@+id/note_bar_cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:drawableLeft="@drawable/selector_btn_back_xml"
|
||||
android:text="Mark"
|
||||
android:text="便签"
|
||||
android:textColor="@color/default_blue_text_color"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
@ -26,24 +27,12 @@
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:layout_marginRight="14dp"
|
||||
android:background="@drawable/ripple_fragment_save_botton_bg"
|
||||
android:background="@drawable/ripple_fragment_save_button_bg"
|
||||
android:src="@drawable/icon_save"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/note_bar_cancel"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@color/transparent"
|
||||
android:src="@drawable/icon_fragment_close"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintRight_toLeftOf="@id/note_bar_save"
|
||||
app:layout_constraintTop_toTopOf="@id/note_bar_save" />
|
||||
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/note_bar_delete"
|
||||
android:layout_width="40dp"
|
||||
|
294
app/src/main/res/layout/fragment_task_link.xml
Normal file
294
app/src/main/res/layout/fragment_task_link.xml
Normal file
@ -0,0 +1,294 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="@dimen/right_fragment_w"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/shape_right_fragment_bg"
|
||||
tools:context=".ui.fragment.tasklink.TaskLinkFragment">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_link_bar_cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:drawableLeft="@drawable/selector_btn_back_xml"
|
||||
android:text="测评Link"
|
||||
android:textColor="@color/default_blue_text_color"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/task_link_bar_save"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:layout_marginRight="14dp"
|
||||
android:background="@drawable/ripple_fragment_save_button_bg"
|
||||
android:src="@drawable/icon_save"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/task_link_bar_delete"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginRight="5dp"
|
||||
android:background="@color/transparent"
|
||||
android:src="@drawable/icon_delete"
|
||||
app:layout_constraintBottom_toBottomOf="@id/task_link_bar_save"
|
||||
app:layout_constraintRight_toLeftOf="@id/task_link_bar_save"
|
||||
app:layout_constraintTop_toTopOf="@id/task_link_bar_save" />
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:paddingLeft="11dp"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingRight="9dp"
|
||||
android:paddingBottom="6dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/note_camera"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/task_link_bar_save">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="7dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
style="@style/evaluation_fragment_title_text_style"
|
||||
android:layout_width="60dp"
|
||||
android:text="当前任务" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_link_task_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/sketch_back"
|
||||
style="@style/sketch_operation_style"
|
||||
android:src="@drawable/sketch_back" />
|
||||
|
||||
<View
|
||||
style="@style/link_gray_style"
|
||||
android:layout_margin="2dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/sketch_forward"
|
||||
style="@style/sketch_operation_style"
|
||||
android:src="@drawable/sketch_forward" />
|
||||
|
||||
<View
|
||||
style="@style/link_gray_style"
|
||||
android:layout_margin="2dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sketch_clear"
|
||||
style="@style/sketch_operation_style"
|
||||
android:text="重绘" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/task_link_add_point"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:text="打点" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="7dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/evaluation_fragment_title_text_style"
|
||||
android:layout_width="60dp"
|
||||
android:text="Link长度" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_link_length"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0米" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="7dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/evaluation_fragment_title_text_style"
|
||||
android:layout_width="60dp"
|
||||
android:text="种别" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_link_kind"
|
||||
style="@style/evaluation_fragment_text_style"
|
||||
android:text="" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="7dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/evaluation_fragment_title_text_style"
|
||||
android:layout_width="60dp"
|
||||
android:text="功能等级" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_link_functional_level"
|
||||
style="@style/evaluation_fragment_text_style"
|
||||
android:text="" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="7dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/evaluation_fragment_title_text_style"
|
||||
android:layout_width="60dp"
|
||||
android:text="数据级别" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_link_data_level"
|
||||
style="@style/evaluation_fragment_text_style"
|
||||
android:text="" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/evaluation_fragment_title_text_style"
|
||||
android:layout_width="60dp"
|
||||
android:layout_gravity="top"
|
||||
android:text="备注" />
|
||||
|
||||
<com.navinfo.omqs.ui.widget.MyEditeText
|
||||
android:id="@+id/note_description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shape_rect_white_2dp_bg"
|
||||
android:elevation="2dp"
|
||||
android:gravity="start"
|
||||
android:hint="请输入备注信息"
|
||||
android:inputType="textMultiLine"
|
||||
android:lines="3"
|
||||
android:maxLines="3"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="多媒体"
|
||||
android:textColor="@color/default_blue_text_color"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<!--
|
||||
这种效果也好实现,主要的关键点是 Android:clipChildren=”false” 这个属性。
|
||||
1.配置ViewPager 和其父布局的 android:clipChildren属性为”false”.
|
||||
(android:clipChildren表示是否限制子View在其范围内,默认为true. 代码设置setClipChildren(false))
|
||||
因为如果clipChildren属性设置为true,就表明我们要将children给clip掉,就是说对于子元素来说,超出当前view的部分都会被切掉,那我们在这里把它设置成false,就表明超出view的部分,不要切掉,依然显示。
|
||||
注意:setClipChildren(false)在3.0以上版本中,开启了硬件加速后将不能正常工作,所以需要将其设置为软件加速。设置软硬件加速使用 setLayerType(View.LAYER_TYPE_SOFTWARE, null); 也可以在布局文件中添加 android:layerType=”software”
|
||||
|
||||
-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/note_picture_left"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:background="@drawable/icon_picture_left"
|
||||
android:padding="5dp" />
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/note_picture_viewpager"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="1"
|
||||
android:clipChildren="false" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/note_picture_right"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:background="@drawable/icon_picture_right"
|
||||
android:padding="5dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/note_voice_recyclerview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="120dp" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/note_camera"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/baseline_camera_alt_24"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@id/note_voice" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/note_voice"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/baseline_keyboard_voice_24"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintLeft_toRightOf="@id/note_camera"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
14
app/src/main/res/layout/fragment_task_link_middle.xml
Normal file
14
app/src/main/res/layout/fragment_task_link_middle.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/task_link_middle_recyclerview"
|
||||
android:layout_width="@dimen/fragment_problem_link_width"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="55dp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:background="@drawable/shape_middle_fragment_bg" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -25,5 +25,10 @@
|
||||
android:name="com.navinfo.omqs.ui.fragment.note.CanvasFragment"
|
||||
android:label="绘图页面"
|
||||
tools:layout="@layout/fragment_canvas"></fragment>
|
||||
<fragment
|
||||
android:id="@+id/TaskLinkMiddleFragment"
|
||||
android:name="com.navinfo.omqs.ui.fragment.tasklink.TaskLinkMiddleFragment"
|
||||
android:label="新增评测Link属性选择页面"
|
||||
tools:layout="@layout/fragment_task_link_middle"></fragment>
|
||||
|
||||
</navigation>
|
@ -28,13 +28,19 @@
|
||||
android:name="com.navinfo.omqs.ui.fragment.evaluationresult.EvaluationResultFragment"
|
||||
android:label="评测页面"
|
||||
tools:layout="@layout/fragment_evaluation_result">
|
||||
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/NoteFragment"
|
||||
android:name="com.navinfo.omqs.ui.fragment.note.NoteFragment"
|
||||
android:label="便签页面"
|
||||
tools:layout="@layout/fragment_note">
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/TaskLinkFragment"
|
||||
android:name="com.navinfo.omqs.ui.fragment.tasklink.TaskLinkFragment"
|
||||
android:label="测评Link"
|
||||
tools:layout="@layout/fragment_task_link">
|
||||
</fragment>
|
||||
</navigation>
|
@ -1 +1,45 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="136" height="136" viewBox="0 0 136 136"><defs><style>.a,.f{fill:#fff;}.a{opacity:0;}.b{fill:#ff5f4c;opacity:0.304;}.c{fill:#a74d4b;opacity:0.708;}.d{fill:url(#a);}.e{fill:url(#b);}.g{fill:#2a23f5;stroke:#db4646;stroke-linecap:square;stroke-width:3px;stroke-dasharray:9 10;}.h{stroke:none;}.i{fill:none;}</style><radialGradient id="a" cx="0.21" cy="0.134" r="1.274" gradientTransform="matrix(0.849, 0.529, -0.307, 0.493, 0.073, -0.043)" gradientUnits="objectBoundingBox"><stop offset="0" stop-color="#ff9287"/><stop offset="0.786" stop-color="#ff5f4c"/><stop offset="1" stop-color="#ff5f4c"/></radialGradient><radialGradient id="b" cx="0.5" cy="0.5" r="0.5" gradientUnits="objectBoundingBox"><stop offset="0" stop-color="#e75545"/><stop offset="0.793" stop-color="#c4483b"/><stop offset="1" stop-color="#983b31"/></radialGradient></defs><g transform="translate(-956 -396)"><rect class="a" width="136" height="136" transform="translate(956 396)"/><g transform="translate(989.164 429.346)"><g transform="translate(10.653 81.66)"><ellipse class="b" cx="24.183" cy="8.497" rx="24.183" ry="8.497"/><ellipse class="c" cx="8.497" cy="3.268" rx="8.497" ry="3.268" transform="translate(15.687 5.229)"/></g><g transform="translate(0 0)"><path class="d" d="M22.956,71.538q-.792-.8-1.543-1.533A36.466,36.466,0,0,1,0,36.4C0,16.3,15.6,0,34.837,0S69.673,16.3,69.673,36.4c0,15.235-8.954,28.283-21.664,33.711q-.588.673-1.219,1.424A73.582,73.582,0,0,0,35.337,90.157S30.335,78.981,22.956,71.538Z" transform="translate(0 0)"/><circle class="e" cx="27.451" cy="27.451" r="27.451" transform="translate(7.029 7.568)"/></g></g><g transform="translate(10096 7643)"><circle class="f" cx="28" cy="28" r="28" transform="translate(-9100 -7207)"/><g class="g" transform="translate(-9096 -7203)"><circle class="h" cx="24" cy="24" r="24"/><circle class="i" cx="24" cy="24" r="25.5"/></g></g></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="136"
|
||||
height="136" viewBox="0 0 136 136">
|
||||
<defs>
|
||||
<style>
|
||||
.a,.f{fill:#fff;}.a{opacity:0;}.b{fill:#ff5f4c;opacity:0.304;}.c{fill:#a74d4b;opacity:0.708;}.d{fill:url(#a);}.e{fill:url(#b);}.g{fill:#2a23f5;stroke:#db4646;stroke-linecap:square;stroke-width:3px;stroke-dasharray:9
|
||||
10;}.h{stroke:none;}.i{fill:none;}
|
||||
</style>
|
||||
<radialGradient id="a" cx="0.21" cy="0.134" r="1.274"
|
||||
gradientTransform="matrix(0.849, 0.529, -0.307, 0.493, 0.073, -0.043)"
|
||||
gradientUnits="objectBoundingBox">
|
||||
<stop offset="0" stop-color="#ff9287" />
|
||||
<stop offset="0.786" stop-color="#ff5f4c" />
|
||||
<stop offset="1" stop-color="#ff5f4c" />
|
||||
</radialGradient>
|
||||
<radialGradient id="b" cx="0.5" cy="0.5" r="0.5" gradientUnits="objectBoundingBox">
|
||||
<stop offset="0" stop-color="#e75545" />
|
||||
<stop offset="0.793" stop-color="#c4483b" />
|
||||
<stop offset="1" stop-color="#983b31" />
|
||||
</radialGradient>
|
||||
</defs>
|
||||
<g transform="translate(-956 -396)">
|
||||
<rect class="a" width="136" height="136" transform="translate(956 396)" />
|
||||
<g transform="translate(989.164 429.346)">
|
||||
<g transform="translate(10.653 81.66)">
|
||||
<ellipse class="b" cx="24.183" cy="8.497" rx="24.183" ry="8.497" />
|
||||
<ellipse class="c" cx="8.497" cy="3.268" rx="8.497" ry="3.268"
|
||||
transform="translate(15.687 5.229)" />
|
||||
</g>
|
||||
<g transform="translate(0 0)">
|
||||
<path class="d"
|
||||
d="M22.956,71.538q-.792-.8-1.543-1.533A36.466,36.466,0,0,1,0,36.4C0,16.3,15.6,0,34.837,0S69.673,16.3,69.673,36.4c0,15.235-8.954,28.283-21.664,33.711q-.588.673-1.219,1.424A73.582,73.582,0,0,0,35.337,90.157S30.335,78.981,22.956,71.538Z"
|
||||
transform="translate(0 0)" />
|
||||
<circle class="e" cx="27.451" cy="27.451" r="27.451"
|
||||
transform="translate(7.029 7.568)" />
|
||||
</g>
|
||||
</g>
|
||||
<g transform="translate(10096 7643)">
|
||||
<circle class="f" cx="28" cy="28" r="28" transform="translate(-9100 -7207)" />
|
||||
<g class="g" transform="translate(-9096 -7203)">
|
||||
<circle class="h" cx="24" cy="24" r="24" />
|
||||
<circle class="i" cx="24" cy="24" r="25.5" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 2.4 KiB |
@ -1 +1,24 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="74.999" viewBox="0 0 56 74.999"><defs><style>.a{fill:#fff;opacity:0;}.b{fill:#fad950;}.c,.d{fill:#0b1923;}.c{stroke:#0b1923;stroke-width:0.5px;}.e,.f{stroke:none;}.f{fill:#0b1923;}</style></defs><g transform="translate(1401 -1261.001) rotate(90)"><rect class="a" width="56" height="56" transform="translate(1280 1345)"/><g transform="translate(0 -2)"><g class="b" transform="translate(1280 1349)"><path class="e" d="M 52.55363845825195 47.5 L 3.446360111236572 47.5 C 3.195830106735229 47.5 3.067879915237427 47.34397125244141 3.0139000415802 47.25096893310547 C 2.959929943084717 47.157958984375 2.887939929962158 46.96945190429688 3.012239933013916 46.75191879272461 L 27.56587028503418 3.783060550689697 C 27.69112968444824 3.563860416412354 27.89163017272949 3.53113055229187 28 3.53113055229187 C 28.10836029052734 3.53113055229187 28.30886077880859 3.563860416412354 28.43411064147949 3.783050537109375 L 52.98777008056641 46.75193023681641 C 53.112060546875 46.96945190429688 53.04006958007812 47.157958984375 52.98609924316406 47.25096893310547 C 52.93212127685547 47.34397125244141 52.80416870117188 47.5 52.55363845825195 47.5 Z"/><path class="f" d="M 27.99999618530273 6.046699523925781 L 5.169540405273438 46 L 50.83046340942383 46 L 27.99999618530273 6.046699523925781 M 27.99999809265137 2.0311279296875 C 28.67629432678223 2.0311279296875 29.35259056091309 2.367034912109375 29.73648071289062 3.038848876953125 L 54.29013061523438 46.00772094726562 C 55.05202102661133 47.34104156494141 54.08929061889648 49 52.55363845825195 49 L 3.446361541748047 49 C 1.910709381103516 49 0.9479789733886719 47.34104156494141 1.709869384765625 46.00772094726562 L 26.26350975036621 3.038848876953125 C 26.64740562438965 2.367034912109375 27.32370185852051 2.0311279296875 27.99999809265137 2.0311279296875 Z"/></g><path class="c" d="M44.849,49.162a.812.812,0,0,0,.794-.794V46.779H48.2a4.526,4.526,0,0,0,3.462-1.419,5.191,5.191,0,0,0,1.248-3.178,2.467,2.467,0,0,0,2.213-2.667c-.113-3.235-3.235-4.483-5.221-4.483H40.309a5.77,5.77,0,0,0-5.278,5.618v1.475a1.138,1.138,0,0,0,1.135,1.135h.34c.113,2.043,1.305,3.518,2.951,3.518h1.873v1.589a.812.812,0,0,0,.794.794h.908v.624a2.519,2.519,0,0,0,2.5,2.5h.738v1.362a1.5,1.5,0,0,0,1.475,1.475H50.41a1.5,1.5,0,0,0,1.475-1.475V50.127a1.5,1.5,0,0,0-1.475-1.475H47.743a1.5,1.5,0,0,0-1.475,1.475v1.362H45.53a1.707,1.707,0,0,1-1.7-1.7v-.624Zm2.213,4.483V52.283c1.873,0,1.873-.794,0-.794ZM37.3,43.2h6.242a2.894,2.894,0,0,0,1.759-.624,2.984,2.984,0,0,0,1.021,1.589,3.224,3.224,0,0,0,2.1.794h.4c1.532-.284,2.44-1.589,2.44-3.575a4,4,0,0,0-1.816-3.745,6.605,6.605,0,0,1,.851-.34.413.413,0,1,0-.227-.794,3.922,3.922,0,0,0-1.532.794l-.057.057a6.481,6.481,0,0,0-1.532,2.1c-.738,1.419-2.1,2.951-3.4,2.951H36.167a.366.366,0,0,1-.34-.34V40.593a4.919,4.919,0,0,1,4.483-4.824H49.9c1.135,0,4.313.681,4.426,3.689a1.7,1.7,0,0,1-1.419,1.873,6.868,6.868,0,0,0-.057-1.078.4.4,0,1,0-.794.113,5.661,5.661,0,0,1-1.021,4.426,3.6,3.6,0,0,1-2.894,1.192H39.458C38.266,45.984,37.415,44.849,37.3,43.2Zm4.824,3.575h2.667v1.589H42.125Z" transform="translate(1262.925 1337.469)"/></g><path class="d" d="M69.876,257.508H31.287a2.233,2.233,0,1,1,0-4.466H69.876a2.233,2.233,0,1,1,0,4.466Zm1.217-.951-9.7-8.471a2.2,2.2,0,0,1,0-3.157,2.328,2.328,0,0,1,3.234,0l9.705,8.471a2.2,2.2,0,0,1,0,3.157A2.325,2.325,0,0,1,71.093,256.557Zm-9.7,5.908,9.7-8.471a2.328,2.328,0,0,1,3.234,0,2.2,2.2,0,0,1,0,3.157l-9.7,8.471a2.328,2.328,0,0,1-3.234,0A2.2,2.2,0,0,1,61.392,262.465Z" transform="translate(1016.726 1425) rotate(-90)"/></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="56" height="74.999" viewBox="0 0 56 74.999">
|
||||
<defs>
|
||||
<style>
|
||||
.a{fill:#fff;opacity:0;}.b{fill:#fad950;}.c,.d{fill:#0b1923;}.c{stroke:#0b1923;stroke-width:0.5px;}.e,.f{stroke:none;}.f{fill:#0b1923;}
|
||||
</style>
|
||||
</defs>
|
||||
<g transform="translate(1401 -1261.001) rotate(90)">
|
||||
<rect class="a" width="56" height="56" transform="translate(1280 1345)" />
|
||||
<g transform="translate(0 -2)">
|
||||
<g class="b" transform="translate(1280 1349)">
|
||||
<path class="e"
|
||||
d="M 52.55363845825195 47.5 L 3.446360111236572 47.5 C 3.195830106735229 47.5 3.067879915237427 47.34397125244141 3.0139000415802 47.25096893310547 C 2.959929943084717 47.157958984375 2.887939929962158 46.96945190429688 3.012239933013916 46.75191879272461 L 27.56587028503418 3.783060550689697 C 27.69112968444824 3.563860416412354 27.89163017272949 3.53113055229187 28 3.53113055229187 C 28.10836029052734 3.53113055229187 28.30886077880859 3.563860416412354 28.43411064147949 3.783050537109375 L 52.98777008056641 46.75193023681641 C 53.112060546875 46.96945190429688 53.04006958007812 47.157958984375 52.98609924316406 47.25096893310547 C 52.93212127685547 47.34397125244141 52.80416870117188 47.5 52.55363845825195 47.5 Z" />
|
||||
<path class="f"
|
||||
d="M 27.99999618530273 6.046699523925781 L 5.169540405273438 46 L 50.83046340942383 46 L 27.99999618530273 6.046699523925781 M 27.99999809265137 2.0311279296875 C 28.67629432678223 2.0311279296875 29.35259056091309 2.367034912109375 29.73648071289062 3.038848876953125 L 54.29013061523438 46.00772094726562 C 55.05202102661133 47.34104156494141 54.08929061889648 49 52.55363845825195 49 L 3.446361541748047 49 C 1.910709381103516 49 0.9479789733886719 47.34104156494141 1.709869384765625 46.00772094726562 L 26.26350975036621 3.038848876953125 C 26.64740562438965 2.367034912109375 27.32370185852051 2.0311279296875 27.99999809265137 2.0311279296875 Z" />
|
||||
</g>
|
||||
<path class="c"
|
||||
d="M44.849,49.162a.812.812,0,0,0,.794-.794V46.779H48.2a4.526,4.526,0,0,0,3.462-1.419,5.191,5.191,0,0,0,1.248-3.178,2.467,2.467,0,0,0,2.213-2.667c-.113-3.235-3.235-4.483-5.221-4.483H40.309a5.77,5.77,0,0,0-5.278,5.618v1.475a1.138,1.138,0,0,0,1.135,1.135h.34c.113,2.043,1.305,3.518,2.951,3.518h1.873v1.589a.812.812,0,0,0,.794.794h.908v.624a2.519,2.519,0,0,0,2.5,2.5h.738v1.362a1.5,1.5,0,0,0,1.475,1.475H50.41a1.5,1.5,0,0,0,1.475-1.475V50.127a1.5,1.5,0,0,0-1.475-1.475H47.743a1.5,1.5,0,0,0-1.475,1.475v1.362H45.53a1.707,1.707,0,0,1-1.7-1.7v-.624Zm2.213,4.483V52.283c1.873,0,1.873-.794,0-.794ZM37.3,43.2h6.242a2.894,2.894,0,0,0,1.759-.624,2.984,2.984,0,0,0,1.021,1.589,3.224,3.224,0,0,0,2.1.794h.4c1.532-.284,2.44-1.589,2.44-3.575a4,4,0,0,0-1.816-3.745,6.605,6.605,0,0,1,.851-.34.413.413,0,1,0-.227-.794,3.922,3.922,0,0,0-1.532.794l-.057.057a6.481,6.481,0,0,0-1.532,2.1c-.738,1.419-2.1,2.951-3.4,2.951H36.167a.366.366,0,0,1-.34-.34V40.593a4.919,4.919,0,0,1,4.483-4.824H49.9c1.135,0,4.313.681,4.426,3.689a1.7,1.7,0,0,1-1.419,1.873,6.868,6.868,0,0,0-.057-1.078.4.4,0,1,0-.794.113,5.661,5.661,0,0,1-1.021,4.426,3.6,3.6,0,0,1-2.894,1.192H39.458C38.266,45.984,37.415,44.849,37.3,43.2Zm4.824,3.575h2.667v1.589H42.125Z"
|
||||
transform="translate(1262.925 1337.469)" />
|
||||
</g>
|
||||
<path class="d"
|
||||
d="M69.876,257.508H31.287a2.233,2.233,0,1,1,0-4.466H69.876a2.233,2.233,0,1,1,0,4.466Zm1.217-.951-9.7-8.471a2.2,2.2,0,0,1,0-3.157,2.328,2.328,0,0,1,3.234,0l9.705,8.471a2.2,2.2,0,0,1,0,3.157A2.325,2.325,0,0,1,71.093,256.557Zm-9.7,5.908,9.7-8.471a2.328,2.328,0,0,1,3.234,0,2.2,2.2,0,0,1,0,3.157l-9.7,8.471a2.328,2.328,0,0,1-3.234,0A2.2,2.2,0,0,1,61.392,262.465Z"
|
||||
transform="translate(1016.726 1425) rotate(-90)" />
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.8 KiB |
@ -19,6 +19,15 @@ open class HadLinkDvoBean @JvmOverloads constructor(
|
||||
/**
|
||||
* 不作业原因
|
||||
*/
|
||||
var reason: String = ""
|
||||
var reason: String = "",
|
||||
|
||||
/**
|
||||
* 1:源库link, 3:现象新增
|
||||
*/
|
||||
var linkStatus: Int = 1,
|
||||
|
||||
/**
|
||||
* link 长度
|
||||
*/
|
||||
var linkLength: Double = 0.000
|
||||
) : RealmObject()
|
@ -1,18 +1,11 @@
|
||||
package com.navinfo.collect.library.map
|
||||
|
||||
import android.os.Build
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.navinfo.collect.library.data.entity.NiLocation
|
||||
import com.navinfo.collect.library.data.handler.DataNiLocationHandler
|
||||
import com.navinfo.collect.library.map.NIMapView.OnMapClickListener
|
||||
import com.navinfo.collect.library.map.handler.*
|
||||
import com.navinfo.collect.library.map.handler.MeasureLayerHandler
|
||||
import com.navinfo.collect.library.map.handler.ViewportHandler
|
||||
import com.navinfo.collect.library.system.Constant
|
||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
import kotlinx.coroutines.flow.SharedFlow
|
||||
import kotlinx.coroutines.launch
|
||||
import org.oscim.core.GeoPoint
|
||||
|
||||
|
@ -5,13 +5,17 @@ import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.text.TextPaint
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.navinfo.collect.library.R
|
||||
import com.navinfo.collect.library.map.NIMapView
|
||||
import com.navinfo.collect.library.map.layers.NIPolygonLayer
|
||||
import com.navinfo.collect.library.utils.DistanceUtil
|
||||
import com.navinfo.collect.library.utils.GeometryTools
|
||||
import com.navinfo.collect.library.utils.StringUtil.Companion.createUUID
|
||||
import org.oscim.android.canvas.AndroidBitmap
|
||||
import org.oscim.backend.CanvasAdapter
|
||||
import org.oscim.backend.canvas.Bitmap
|
||||
@ -27,6 +31,8 @@ import org.oscim.layers.vector.PathLayer
|
||||
import org.oscim.layers.vector.geometries.Style
|
||||
import org.oscim.map.Map
|
||||
import java.math.BigDecimal
|
||||
import kotlin.math.abs
|
||||
import kotlin.math.ceil
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
open class MeasureLayerHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
@ -37,230 +43,195 @@ open class MeasureLayerHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
private var bDrawLine = false
|
||||
private val bDrawPoint = false
|
||||
|
||||
private var mAreaLayer: ItemizedLayer
|
||||
/**
|
||||
* 加上虚线的总长度
|
||||
*/
|
||||
val tempLineDistanceLiveData = MutableLiveData("")
|
||||
|
||||
/**
|
||||
* 实际绘制的总长度
|
||||
*/
|
||||
val lineLenghtLiveData = MutableLiveData<Double>(0.000)
|
||||
|
||||
private val markerLayer: ItemizedLayer by lazy {
|
||||
|
||||
val markerSymbol = MarkerSymbol(
|
||||
mPathMarkerBitmap, MarkerSymbol.HotspotPlace.CENTER
|
||||
)
|
||||
//新增marker图层
|
||||
val layer = ItemizedLayer(
|
||||
mapView.vtmMap, mutableListOf<MarkerInterface>(), markerSymbol, itemGestureListener
|
||||
)
|
||||
|
||||
addLayer(layer, NIMapView.LAYER_GROUPS.OPERATE_MARKER)
|
||||
layer
|
||||
}
|
||||
|
||||
private val mAreaLayer: ItemizedLayer by lazy {
|
||||
val markerSymbol = MarkerSymbol(mPathMarkerBitmap, MarkerSymbol.HotspotPlace.CENTER)
|
||||
ItemizedLayer(mMapView.vtmMap, ArrayList(), markerSymbol, null)
|
||||
}
|
||||
|
||||
//绘制线 样式
|
||||
private val lineStyle: Style
|
||||
|
||||
private val newTempStyle: Style
|
||||
|
||||
//线型编辑时的样式
|
||||
private val editTempStyle: Style
|
||||
|
||||
//新增线数据引线
|
||||
private var mPathLayerTemp: PathLayer
|
||||
|
||||
//新增线数据
|
||||
private var mPathLayer: PathLayer
|
||||
|
||||
//线路端点图标
|
||||
private var mPathMarkerBitmap: Bitmap
|
||||
|
||||
private var bDrawPolygon = false
|
||||
|
||||
private var mPolygonLayer: NIPolygonLayer
|
||||
|
||||
init {
|
||||
|
||||
private val lineStyle: Style by lazy {
|
||||
//新增线数据图层和线样式
|
||||
lineStyle = Style.builder().scaleZoomLevel(20).buffer(1.0)
|
||||
Style.builder().scaleZoomLevel(20).buffer(1.0)
|
||||
.stippleColor(context.resources.getColor(R.color.draw_line_blue1_color, null))
|
||||
.strokeWidth(4f)
|
||||
.fillColor(context.resources.getColor(R.color.draw_line_blue2_color, null))
|
||||
.fillAlpha(0.5f)
|
||||
.strokeColor(context.resources.getColor(R.color.draw_line_blue2_color, null))
|
||||
.fillColor(context.resources.getColor(R.color.draw_line_red_color, null))
|
||||
.stippleWidth(4f)
|
||||
.fixed(true)
|
||||
.build()
|
||||
.stippleWidth(4f).fixed(true).build()
|
||||
}
|
||||
|
||||
newTempStyle = Style.builder()
|
||||
.stippleColor(context.resources.getColor(R.color.transparent, null))
|
||||
.stipple(30)
|
||||
.stippleWidth(30f)
|
||||
.strokeWidth(4f)
|
||||
private val newTempStyle: Style by lazy {
|
||||
Style.builder().stippleColor(context.resources.getColor(R.color.transparent, null))
|
||||
.stipple(30).stippleWidth(30f).strokeWidth(4f)
|
||||
.strokeColor(context.resources.getColor(R.color.draw_line_blue2_color, null))
|
||||
.fixed(true)
|
||||
.randomOffset(false)
|
||||
.build()
|
||||
.fixed(true).randomOffset(false).build()
|
||||
}
|
||||
|
||||
editTempStyle = Style.builder()
|
||||
.stippleColor(context.resources.getColor(R.color.transparent, null))
|
||||
.stipple(30)
|
||||
.stippleWidth(30f)
|
||||
.strokeWidth(8f)
|
||||
.strokeColor(context.resources.getColor(R.color.draw_line_red_color, null))
|
||||
.fixed(true)
|
||||
.randomOffset(false)
|
||||
.build()
|
||||
|
||||
mPolygonLayer = NIPolygonLayer(
|
||||
mMapView.vtmMap,
|
||||
lineStyle
|
||||
)
|
||||
// addLayer(mPolygonLayer, NIMapView.LAYER_GROUPS.OPERATE)
|
||||
|
||||
mPathLayerTemp = PathLayer(mMapView.vtmMap, newTempStyle)
|
||||
// addLayer(mPathLayerTemp, NIMapView.LAYER_GROUPS.OPERATE)
|
||||
|
||||
mPathMarkerBitmap = AndroidBitmap(
|
||||
BitmapFactory.decodeResource(
|
||||
context.resources,
|
||||
R.mipmap.icon_path_maker
|
||||
)
|
||||
)
|
||||
|
||||
val markerSymbol = MarkerSymbol(mPathMarkerBitmap, MarkerSymbol.HotspotPlace.CENTER)
|
||||
|
||||
mAreaLayer = ItemizedLayer(mMapView.vtmMap, ArrayList(), markerSymbol, null)
|
||||
|
||||
mPathLayer = PathLayer(mMapView.vtmMap, lineStyle)
|
||||
|
||||
addLayer(mPathLayer, NIMapView.LAYER_GROUPS.OPERATE_LINE)
|
||||
//线型编辑时的样式
|
||||
private val editTempStyle: Style by lazy {
|
||||
Style.builder().stippleColor(context.resources.getColor(R.color.transparent, null))
|
||||
.stipple(30).stippleWidth(30f).strokeWidth(8f)
|
||||
.strokeColor(context.resources.getColor(R.color.draw_line_red_color, null)).fixed(true)
|
||||
.randomOffset(false).build()
|
||||
|
||||
}
|
||||
|
||||
open fun drawLineOrPolygon(type: Int) {
|
||||
//新增线数据引线
|
||||
private val mPathLayerTemp: PathLayer by lazy {
|
||||
val layer = PathLayer(mMapView.vtmMap, newTempStyle)
|
||||
addLayer(layer, NIMapView.LAYER_GROUPS.OPERATE_LINE)
|
||||
layer
|
||||
}
|
||||
|
||||
//新增线数据
|
||||
val mPathLayer: PathLayer by lazy {
|
||||
val layer = PathLayer(mMapView.vtmMap, lineStyle)
|
||||
addLayer(layer, NIMapView.LAYER_GROUPS.OPERATE_LINE)
|
||||
layer
|
||||
}
|
||||
|
||||
//线路端点图标
|
||||
private val mPathMarkerBitmap: Bitmap by lazy {
|
||||
AndroidBitmap(
|
||||
BitmapFactory.decodeResource(
|
||||
context.resources, R.mipmap.icon_path_maker
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private var bDrawPolygon = false
|
||||
|
||||
val mPolygonLayer: NIPolygonLayer by lazy {
|
||||
val layer = NIPolygonLayer(mMapView.vtmMap, lineStyle)
|
||||
addLayer(layer, NIMapView.LAYER_GROUPS.OPERATE_LINE)
|
||||
layer
|
||||
}
|
||||
|
||||
|
||||
init {
|
||||
mMapView.vtmMap.events.bind(this)
|
||||
}
|
||||
|
||||
open fun drawLineOrPolygon(isPolygon: Boolean) {
|
||||
bDrawLine = true
|
||||
|
||||
// //画面
|
||||
// if (type == 3) {
|
||||
// if (mPolygonLayer == null) {
|
||||
// mPolygonLayer = NIPolygonLayer(mMapView.vtmMap, lineStyle)
|
||||
// addLayer(mPolygonLayer, NIMapView.LAYER_GROUPS.OPERATE)
|
||||
// } else if (!mPolygonLayer.isEnabled) {
|
||||
// mPolygonLayer.isEnabled = true
|
||||
// }
|
||||
// } else {
|
||||
// if (mPathLayer == null) {
|
||||
// mPathLayer = PathLayer(mMapView.vtmMap, lineStyle)
|
||||
// addLayer(mPathLayer, NIMapView.LAYER_GROUPS.OPERATE)
|
||||
// } else if (!mPathLayer.isEnabled()) {
|
||||
// mPathLayer.setEnabled(true)
|
||||
// }
|
||||
// }
|
||||
// //上一个点的引线
|
||||
// if (mPathLayerTemp == null) {
|
||||
// mPathLayerTemp = PathLayer(mMapView.vtmMap, newTempStyle)
|
||||
// addLayer(mPathLayerTemp, NIMapView.LAYER_GROUPS.OPERATE)
|
||||
// } else if (!mPathLayerTemp.isEnabled) {
|
||||
// mPathLayerTemp.isEnabled = true
|
||||
// }
|
||||
// val geoPoint: GeoPoint =
|
||||
// GeoPoint(
|
||||
// mMapView.vtmMap.getMapPosition().getLatitude(),
|
||||
// mMapView.vtmMap.getMapPosition().getLongitude()
|
||||
// )
|
||||
//
|
||||
// //编辑点
|
||||
// if (editIndex > -1) {
|
||||
// if (mPathMakers.size > editIndex) {
|
||||
// mMapView.layerManager.removeMarker(
|
||||
// mPathMakers[editIndex],
|
||||
// NILayerManager.MARQUEE_MARKER_LAYER
|
||||
// )
|
||||
// mPathMakers.removeAt(editIndex)
|
||||
// if (mPathMarkerBitmap == null) {
|
||||
// mPathMarkerBitmap = AndroidBitmap(
|
||||
// BitmapFactory.decodeResource(
|
||||
// mContext.getResources(),
|
||||
// R.mipmap.icon_path_maker
|
||||
// )
|
||||
// )
|
||||
// }
|
||||
// val markerItem = MarkerItem(createUUID(), "", "", geoPoint)
|
||||
// val markerSymbol = MarkerSymbol(mPathMarkerBitmap, MarkerSymbol.HotspotPlace.CENTER)
|
||||
// markerItem.marker = markerSymbol
|
||||
// mMapView.layerManager.addMarker2MarkerLayer(
|
||||
// markerItem,
|
||||
// mPathMarkerBitmap,
|
||||
// NILayerManager.MARQUEE_MARKER_LAYER,
|
||||
// NIMapView.LAYER_GROUPS.OTHER.ordinal,
|
||||
// itemGestureListener
|
||||
// )
|
||||
// mPathMakers.add(editIndex, markerItem)
|
||||
// if (mPathLayer != null && mPathLayer.getPoints().size > 0) {
|
||||
// val list: MutableList<GeoPoint> = mPathLayer.getPoints()
|
||||
// if (editIndex < list.size) {
|
||||
// list.removeAt(editIndex)
|
||||
// val list2: MutableList<GeoPoint> = java.util.ArrayList(list)
|
||||
// list2.add(editIndex, geoPoint)
|
||||
// mPathLayer.setPoints(list2)
|
||||
// }
|
||||
// } else if (mPolygonLayer != null && mPolygonLayer.points.size > 0) {
|
||||
// val list = mPolygonLayer.points
|
||||
// if (editIndex < list.size) {
|
||||
// list.removeAt(editIndex)
|
||||
// val list2: MutableList<GeoPoint> = java.util.ArrayList(list)
|
||||
// list2.add(editIndex, geoPoint)
|
||||
// mPolygonLayer.setPoints(list2)
|
||||
// }
|
||||
// }
|
||||
// if (mPathLayerTemp != null) {
|
||||
// mPathLayerTemp.setStyle(newTempStyle)
|
||||
// val list: MutableList<GeoPoint> = java.util.ArrayList<GeoPoint>()
|
||||
// if (type == 3 && mPathMakers.size > 1) {
|
||||
// list.add(mPathMakers[0].geoPoint)
|
||||
// list.add(geoPoint)
|
||||
// list.add(mPathMakers[mPathMakers.size - 1].geoPoint)
|
||||
// } else {
|
||||
// list.add(mPathMakers[mPathMakers.size - 1].geoPoint)
|
||||
// list.add(geoPoint)
|
||||
// }
|
||||
// mPathLayerTemp.setPoints(list)
|
||||
// }
|
||||
// }
|
||||
// editIndex = -1
|
||||
// } else { //新增点
|
||||
// if (type == 3) {
|
||||
// val points: MutableList<GeoPoint> = java.util.ArrayList(mPolygonLayer.points)
|
||||
// if (points.size > 2) {
|
||||
// val list: MutableList<GeoPoint> = java.util.ArrayList()
|
||||
// points.add(points[0])
|
||||
// list.add(points[0])
|
||||
// list.add(geoPoint)
|
||||
// list.add(mPolygonLayer.points[mPolygonLayer.points.size - 1])
|
||||
// val bCross = GeometryTools.isPolygonCrosses(points, list)
|
||||
// if (bCross == true) {
|
||||
// Toast.makeText(mContext, "不能交叉", Toast.LENGTH_SHORT).show()
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
// mPolygonLayer.addPoint(geoPoint)
|
||||
// } else {
|
||||
// val points: List<GeoPoint> = mPathLayer.getPoints()
|
||||
// if (points.size > 2) {
|
||||
// val list: MutableList<GeoPoint> = java.util.ArrayList()
|
||||
// list.add(geoPoint)
|
||||
// list.add(points[points.size - 1])
|
||||
// val bCross = GeometryTools.isLineStringCrosses(points, list)
|
||||
// if (bCross == true) {
|
||||
// Toast.makeText(mContext, "不能交叉", Toast.LENGTH_SHORT).show()
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
// mPathLayer.addPoint(geoPoint)
|
||||
// }
|
||||
// if (mPathMarkerBitmap == null) {
|
||||
// mPathMarkerBitmap = AndroidBitmap(
|
||||
// BitmapFactory.decodeResource(
|
||||
// mContext.getResources(),
|
||||
// R.mipmap.icon_path_maker
|
||||
// )
|
||||
// )
|
||||
// }
|
||||
// val markerItem = MarkerItem(createUUID(), "", "", geoPoint)
|
||||
// val markerSymbol = MarkerSymbol(mPathMarkerBitmap, MarkerSymbol.HotspotPlace.CENTER)
|
||||
// markerItem.marker = markerSymbol
|
||||
// mMapView.layerManager.addMarker2MarkerLayer(
|
||||
// markerItem,
|
||||
// mPathMarkerBitmap,
|
||||
// NILayerManager.MARQUEE_MARKER_LAYER,
|
||||
// NIMapView.LAYER_GROUPS.OTHER.ordinal,
|
||||
// itemGestureListener
|
||||
// )
|
||||
// mPathMakers.add(markerItem)
|
||||
// }
|
||||
//画面
|
||||
if (isPolygon && !mPolygonLayer.isEnabled) {
|
||||
mPolygonLayer.isEnabled = true
|
||||
} else if (!mPathLayer.isEnabled) {
|
||||
mPathLayer.isEnabled = true
|
||||
}
|
||||
//上一个点的引线
|
||||
if (!mPathLayerTemp.isEnabled) {
|
||||
mPathLayerTemp.isEnabled = true
|
||||
}
|
||||
val geoPoint = GeoPoint(
|
||||
mMapView.vtmMap.mapPosition.latitude, mMapView.vtmMap.mapPosition.longitude
|
||||
)
|
||||
|
||||
//编辑点
|
||||
if (editIndex > -1) {
|
||||
if (mPathMakers.size > editIndex) {
|
||||
markerLayer.removeItem(editIndex)
|
||||
mPathMakers.removeAt(editIndex)
|
||||
val markerItem = MarkerItem(createUUID(), "", "", geoPoint)
|
||||
markerLayer.addItem(markerItem)
|
||||
mPathMakers.add(editIndex, markerItem)
|
||||
if (mPathLayer.points.size > 0) {
|
||||
val list: MutableList<GeoPoint> = mPathLayer.points
|
||||
if (editIndex < list.size) {
|
||||
list.removeAt(editIndex)
|
||||
val list2: MutableList<GeoPoint> = java.util.ArrayList(list)
|
||||
list2.add(editIndex, geoPoint)
|
||||
mPathLayer.setPoints(list2)
|
||||
}
|
||||
} else if (mPolygonLayer.points.size > 0) {
|
||||
val list = mPolygonLayer.points
|
||||
if (editIndex < list.size) {
|
||||
list.removeAt(editIndex)
|
||||
val list2: MutableList<GeoPoint> = java.util.ArrayList(list)
|
||||
list2.add(editIndex, geoPoint)
|
||||
mPolygonLayer.setPoints(list2)
|
||||
}
|
||||
}
|
||||
mPathLayerTemp.setStyle(newTempStyle)
|
||||
val list: MutableList<GeoPoint> = java.util.ArrayList<GeoPoint>()
|
||||
if (isPolygon && mPathMakers.size > 1) {
|
||||
list.add(mPathMakers[0].geoPoint)
|
||||
list.add(geoPoint)
|
||||
list.add(mPathMakers[mPathMakers.size - 1].geoPoint)
|
||||
} else {
|
||||
list.add(mPathMakers[mPathMakers.size - 1].geoPoint)
|
||||
list.add(geoPoint)
|
||||
}
|
||||
mPathLayerTemp.setPoints(list)
|
||||
}
|
||||
editIndex = -1
|
||||
} else { //新增点
|
||||
if (isPolygon) {
|
||||
val points: MutableList<GeoPoint> = java.util.ArrayList(mPolygonLayer.points)
|
||||
if (points.size > 2) {
|
||||
val list: MutableList<GeoPoint> = java.util.ArrayList()
|
||||
points.add(points[0])
|
||||
list.add(points[0])
|
||||
list.add(geoPoint)
|
||||
list.add(mPolygonLayer.points[mPolygonLayer.points.size - 1])
|
||||
val bCross = GeometryTools.isPolygonCrosses(points, list)
|
||||
if (bCross) {
|
||||
Toast.makeText(mContext, "不能交叉", Toast.LENGTH_SHORT).show()
|
||||
return
|
||||
}
|
||||
}
|
||||
mPolygonLayer.addPoint(geoPoint)
|
||||
} else {
|
||||
val points: List<GeoPoint> = mPathLayer.points
|
||||
if (points.size > 2) {
|
||||
val list: MutableList<GeoPoint> = java.util.ArrayList()
|
||||
list.add(geoPoint)
|
||||
list.add(points[points.size - 1])
|
||||
val bCross = GeometryTools.isLineStringCrosses(points, list)
|
||||
if (bCross) {
|
||||
Toast.makeText(mContext, "不能交叉", Toast.LENGTH_SHORT).show()
|
||||
return
|
||||
}
|
||||
}
|
||||
mPathLayer.addPoint(geoPoint)
|
||||
if (mPathLayer.points.size > 1) {
|
||||
val distance: Double = GeometryTools.getDistance(mPathLayer.points)
|
||||
val bg = BigDecimal(distance)
|
||||
val f1 = bg.setScale(3, BigDecimal.ROUND_HALF_UP).toDouble()
|
||||
lineLenghtLiveData.value = f1
|
||||
}
|
||||
}
|
||||
val markerItem = MarkerItem(createUUID(), "", "", geoPoint)
|
||||
markerLayer.addItem(markerItem)
|
||||
mPathMakers.add(markerItem)
|
||||
}
|
||||
showAreaLayer()
|
||||
}
|
||||
|
||||
@ -298,10 +269,8 @@ open class MeasureLayerHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
* 隐藏面积计算
|
||||
*/
|
||||
open fun hideAreaLayer() {
|
||||
if (mAreaLayer != null) {
|
||||
mAreaLayer.removeAllItems()
|
||||
mMapView.vtmMap.layers().remove(mAreaLayer)
|
||||
}
|
||||
mAreaLayer.removeAllItems()
|
||||
mMapView.vtmMap.layers().remove(mAreaLayer)
|
||||
}
|
||||
|
||||
|
||||
@ -309,46 +278,39 @@ open class MeasureLayerHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
* 显示面积计算
|
||||
*/
|
||||
open fun showAreaLayer() {
|
||||
if (mAreaLayer != null) {
|
||||
mAreaLayer.removeAllItems()
|
||||
mMapView.vtmMap.layers().remove(mAreaLayer)
|
||||
}
|
||||
if (mPolygonLayer != null && mPolygonLayer.points.size > 2) {
|
||||
mAreaLayer.removeAllItems()
|
||||
mMapView.vtmMap.layers().remove(mAreaLayer)
|
||||
if (mPolygonLayer.points.size > 2) {
|
||||
val list: MutableList<GeoPoint> = ArrayList(mPolygonLayer.points)
|
||||
val area = DistanceUtil.planarPolygonAreaMeters2(list)
|
||||
var areaString: String
|
||||
if (area < 1000000) {
|
||||
areaString = area.toString() + "平方米"
|
||||
val areaString = if (area < 1000000) {
|
||||
area.toString() + "平方米"
|
||||
} else if (area < 10000000000.0) {
|
||||
val d = area / 1000000.0
|
||||
val bg = BigDecimal(d)
|
||||
val f1 = bg.setScale(1, BigDecimal.ROUND_HALF_UP).toDouble()
|
||||
areaString = f1.toString() + "平方公里"
|
||||
f1.toString() + "平方公里"
|
||||
} else {
|
||||
val d = area / 10000000000.0
|
||||
val bg = BigDecimal(d)
|
||||
val f1 = bg.setScale(1, BigDecimal.ROUND_HALF_UP).toDouble()
|
||||
areaString = f1.toString() + "万平方公里"
|
||||
f1.toString() + "万平方公里"
|
||||
}
|
||||
val textPaint = TextPaint()
|
||||
textPaint.textSize = 13 * CanvasAdapter.getScale()
|
||||
textPaint.color = Color.BLUE
|
||||
val width = Math.ceil(textPaint.measureText(areaString).toDouble()).toInt()
|
||||
val width = ceil(textPaint.measureText(areaString).toDouble()).toInt()
|
||||
val fontMetrics = textPaint.fontMetrics
|
||||
val height =
|
||||
Math.ceil((Math.abs(fontMetrics.bottom) + Math.abs(fontMetrics.top)).toDouble())
|
||||
.toInt()
|
||||
val height = ceil((abs(fontMetrics.bottom) + abs(fontMetrics.top)).toDouble()).toInt()
|
||||
val bitmap = android.graphics.Bitmap.createBitmap(
|
||||
width,
|
||||
height,
|
||||
android.graphics.Bitmap.Config.ARGB_8888
|
||||
width, height, android.graphics.Bitmap.Config.ARGB_8888
|
||||
)
|
||||
val canvas = Canvas(bitmap)
|
||||
canvas.drawText(areaString, 0f, Math.abs(fontMetrics.ascent), textPaint)
|
||||
val bitmap2: Bitmap = AndroidBitmap(bitmap)
|
||||
val markerSymbol = MarkerSymbol(bitmap2, MarkerSymbol.HotspotPlace.CENTER)
|
||||
mAreaLayer = ItemizedLayer(mMapView.vtmMap, ArrayList(), markerSymbol, null)
|
||||
mMapView.vtmMap.layers().add(mAreaLayer)
|
||||
canvas.drawText(areaString, 0f, abs(fontMetrics.ascent), textPaint)
|
||||
// val bitmap2: Bitmap = AndroidBitmap(bitmap)
|
||||
// val markerSymbol = MarkerSymbol(bitmap2, MarkerSymbol.HotspotPlace.CENTER)
|
||||
// mAreaLayer = ItemizedLayer(mMapView.vtmMap, ArrayList(), markerSymbol, null)
|
||||
// mMapView.vtmMap.layers().add(mAreaLayer)
|
||||
list.add(list[0])
|
||||
val polygon = GeometryTools.createPolygon(list)
|
||||
val point = polygon.centroid
|
||||
@ -360,66 +322,119 @@ open class MeasureLayerHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
}
|
||||
|
||||
open fun removeLine() {
|
||||
// bDrawLine = false
|
||||
// editIndex = -1
|
||||
// for (item in mPathMakers) {
|
||||
// mMapView.layerManager.removeMarker(item, NILayerManager.MARQUEE_MARKER_LAYER)
|
||||
// }
|
||||
// mPathMakers.clear()
|
||||
// if (mPathLayer != null) {
|
||||
// mPathLayer.clearPath()
|
||||
// mPathLayer.isEnabled = false
|
||||
// }
|
||||
// if (mPolygonLayer != null) {
|
||||
// mPolygonLayer.clearPath()
|
||||
// mPolygonLayer.isEnabled = false
|
||||
// }
|
||||
// if (mPathLayerTemp != null) {
|
||||
// mPathLayerTemp.clearPath()
|
||||
// mPathLayerTemp.isEnabled = false
|
||||
// mPathLayerTemp.setStyle(newTempStyle)
|
||||
// }
|
||||
bDrawLine = false
|
||||
editIndex = -1
|
||||
markerLayer.removeAllItems()
|
||||
mPathMakers.clear()
|
||||
mPathLayer.clearPath()
|
||||
mPathLayer.isEnabled = false
|
||||
mPolygonLayer.clearPath()
|
||||
mPolygonLayer.isEnabled = false
|
||||
mPathLayerTemp.clearPath()
|
||||
mPathLayerTemp.isEnabled = false
|
||||
mPathLayerTemp.setStyle(newTempStyle)
|
||||
hideAreaLayer()
|
||||
}
|
||||
|
||||
fun clean() {
|
||||
fun clear() {
|
||||
removeLine()
|
||||
mMapView.vtmMap.updateMap(true)
|
||||
}
|
||||
|
||||
override fun onMapEvent(e: Event?, mapPosition: MapPosition?) {
|
||||
|
||||
override fun onMapEvent(e: Event, mapPosition: MapPosition) {
|
||||
if (!bDrawLine) return
|
||||
// if (mMapView.centerPixel[1] > mMapView.vtmMap.height / 2) {
|
||||
// val geoPoint =
|
||||
// mMapView.vtmMap.viewport()
|
||||
// .fromScreenPoint(
|
||||
// mMapView.centerPixel[0],
|
||||
// mMapView.vtmMap.height - mMapView.centerPixel[1]
|
||||
// )
|
||||
// mapPosition.setPosition(geoPoint)
|
||||
// }
|
||||
if (e === Map.POSITION_EVENT) {
|
||||
if (mPathLayer.points.size > 0) {
|
||||
if (editIndex > -1) {
|
||||
val list: MutableList<GeoPoint> = mutableListOf()
|
||||
if (editIndex == 0 || editIndex == mPathMakers.size - 1) {
|
||||
list.add(mPathMakers[editIndex].geoPoint)
|
||||
list.add(
|
||||
GeoPoint(
|
||||
mapPosition.latitude, mapPosition.longitude
|
||||
)
|
||||
)
|
||||
} else {
|
||||
list.add(mPathMakers[editIndex - 1].geoPoint)
|
||||
list.add(
|
||||
GeoPoint(
|
||||
mapPosition.latitude, mapPosition.longitude
|
||||
)
|
||||
)
|
||||
list.add(mPathMakers[editIndex + 1].geoPoint)
|
||||
}
|
||||
mPathLayerTemp.setPoints(list)
|
||||
// crossText.setText("")
|
||||
} else {
|
||||
val list: MutableList<GeoPoint> = mutableListOf()
|
||||
list.add(mPathLayer.points[mPathLayer.points.size - 1])
|
||||
val nowPoint = GeoPoint(
|
||||
mapPosition.latitude, mapPosition.longitude
|
||||
)
|
||||
list.add(
|
||||
nowPoint
|
||||
)
|
||||
mPathLayerTemp.setPoints(list)
|
||||
if (mPathLayer.points.size > 0) {
|
||||
val dList = mPathLayer.points.toMutableList()
|
||||
dList.add(nowPoint)
|
||||
val distance: Double =
|
||||
GeometryTools.getDistance(dList)
|
||||
if (distance < 1000) {
|
||||
tempLineDistanceLiveData.value = "${distance.toInt()}米"
|
||||
} else {
|
||||
try {
|
||||
val d = distance / 1000.0
|
||||
val bg = BigDecimal(d)
|
||||
val f1 =
|
||||
bg.setScale(1, BigDecimal.ROUND_HALF_UP).toDouble()
|
||||
tempLineDistanceLiveData.value = "${f1}公里"
|
||||
} catch (e: Exception) {
|
||||
Log.e("jingo",e.toString() + "$distance")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val itemGestureListener: OnItemGestureListener<*> =
|
||||
private val itemGestureListener: OnItemGestureListener<MarkerInterface> =
|
||||
object : OnItemGestureListener<MarkerInterface> {
|
||||
override fun onItemSingleTapUp(index: Int, item: MarkerInterface): Boolean {
|
||||
if (bDrawLine) {
|
||||
// for (i in mPathMakers.indices) {
|
||||
// val item1 = mPathMakers[i]
|
||||
// if (item === item1) {
|
||||
// mMapView.layerManager.jumpToPosition(
|
||||
// item.getPoint().longitude,
|
||||
// item.getPoint().latitude,
|
||||
// 0
|
||||
// )
|
||||
// editIndex = i
|
||||
// if (mPathLayerTemp != null) {
|
||||
// mPathLayerTemp.setStyle(editTempStyle)
|
||||
// val list: MutableList<GeoPoint> = java.util.ArrayList<GeoPoint>()
|
||||
// if (editIndex == 0 || editIndex == mPathMakers.size - 1) {
|
||||
// list.add(item.geoPoint as Nothing)
|
||||
// list.add(item.geoPoint as Nothing)
|
||||
// } else {
|
||||
// list.add(mPathMakers[editIndex - 1].geoPoint as Nothing)
|
||||
// list.add(item.geoPoint as Nothing)
|
||||
// list.add(mPathMakers[editIndex + 1].geoPoint as Nothing)
|
||||
// }
|
||||
// mPathLayerTemp.setPoints(list)
|
||||
// }
|
||||
// return true
|
||||
// }
|
||||
// }
|
||||
for (i in mPathMakers.indices) {
|
||||
val item1 = mPathMakers[i]
|
||||
if (item === item1) {
|
||||
mMapView.vtmMap.animator().animateTo(
|
||||
GeoPoint(
|
||||
item.getPoint().latitude, item.getPoint().longitude
|
||||
)
|
||||
)
|
||||
editIndex = i
|
||||
mPathLayerTemp.setStyle(editTempStyle)
|
||||
val list: MutableList<GeoPoint> = mutableListOf()
|
||||
if (editIndex == 0 || editIndex == mPathMakers.size - 1) {
|
||||
list.add(item.getPoint())
|
||||
list.add(item.getPoint())
|
||||
} else {
|
||||
list.add(mPathMakers[editIndex - 1].geoPoint)
|
||||
list.add(item.getPoint())
|
||||
list.add(mPathMakers[editIndex + 1].geoPoint)
|
||||
}
|
||||
mPathLayerTemp.setPoints(list)
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.navinfo.collect.library.utils
|
||||
|
||||
import java.text.ParsePosition
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
|
2
vtm
2
vtm
@ -1 +1 @@
|
||||
Subproject commit dd13e533c38b5738ab404c2737d7ccadeff01323
|
||||
Subproject commit 1ee201a41f78f169873848209a3f3bdac36f185a
|
Loading…
x
Reference in New Issue
Block a user