merge code

This commit is contained in:
qiji4215 2023-08-11 10:27:35 +08:00
parent 215aad041e
commit dcca1d50ea

View File

@ -402,6 +402,47 @@ class MainActivity : BaseActivity() {
}
}
/**
* 开始测量
*/
private fun measuringToolOn() {
val root = binding.mainActivityMeasuringTool.root
val valueView = root.findViewById<TextView>(R.id.measuring_tool_value)
val unitView = root.findViewById<TextView>(R.id.measuring_tool_value_unit)
val centerTextView = binding.mainActivityHomeCenterText
//监听测距值
mapController.measureLayerHandler.measureValueLiveData.observe(this) {
valueView.text = it.valueString
unitView.text = it.unit
}
mapController.measureLayerHandler.tempMeasureValueLiveData.observe(this)
{
centerTextView.text = "${it.valueString}${it.unit}"
}
viewModel.setMeasuringToolEnable(true)
binding.mainActivityHomeCenter.visibility = View.VISIBLE
binding.mainActivityHomeCenterText.visibility = View.VISIBLE
viewModel.setMeasuringToolType(MeasureLayerHandler.MEASURE_TYPE.DISTANCE)
root.visibility = View.VISIBLE
root.findViewById<View>(R.id.measuring_tool_distance).isSelected = true
root.findViewById<View>(R.id.measuring_tool_area).isSelected = false
root.findViewById<View>(R.id.measuring_tool_angle).isSelected = false
}
/**
* 结束测量
*/
fun measuringToolOff() {
//监听测距值
mapController.measureLayerHandler.measureValueLiveData.removeObservers(this)
mapController.measureLayerHandler.tempMeasureValueLiveData.removeObservers(this)
viewModel.setMeasuringToolEnable(false)
binding.mainActivityHomeCenter.visibility = View.GONE
binding.mainActivityHomeCenterText.visibility = View.GONE
binding.mainActivityMeasuringTool.root.visibility = View.GONE
}
//根据输入的经纬度跳转坐标
fun jumpPosition() {
val view = this.layoutInflater.inflate(R.layout.dialog_view_edittext, null)