修改冲突
This commit is contained in:
@@ -12,7 +12,6 @@ import android.widget.EditText
|
||||
import android.widget.Toast
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.activity.viewModels
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
@@ -20,7 +19,6 @@ import androidx.navigation.findNavController
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.navinfo.collect.library.data.entity.NiLocation
|
||||
import com.navinfo.collect.library.map.NIMapController
|
||||
import com.navinfo.omqs.Constant
|
||||
import com.navinfo.omqs.R
|
||||
@@ -43,7 +41,6 @@ import com.navinfo.omqs.util.SpeakMode
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.launch
|
||||
import org.oscim.core.GeoPoint
|
||||
import org.oscim.layers.marker.MarkerItem
|
||||
import org.oscim.renderer.GLViewport
|
||||
import org.videolan.vlc.Util
|
||||
import java.math.BigDecimal
|
||||
@@ -407,7 +404,7 @@ class MainActivity : BaseActivity() {
|
||||
val inputDialog = MaterialAlertDialogBuilder(
|
||||
this
|
||||
).setTitle("坐标定位").setView(view)
|
||||
var editText = view.findViewById<EditText>(R.id.dialog_edittext)
|
||||
val editText = view.findViewById<EditText>(R.id.dialog_edittext)
|
||||
editText.hint = "请输入经纬度例如:\n116.1234567,39.1234567\n116.1234567 39.1234567"
|
||||
inputDialog.setNegativeButton("取消") { dialog, _ ->
|
||||
dialog.dismiss()
|
||||
@@ -670,8 +667,7 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
fun playVideo() {
|
||||
private fun playVideo() {
|
||||
if (mapController.markerHandle.getCurrentMark() == null) {
|
||||
BaseToast.makeText(this, "请先选择轨迹点!", BaseToast.LENGTH_SHORT).show()
|
||||
return
|
||||
@@ -685,16 +681,14 @@ class MainActivity : BaseActivity() {
|
||||
/**
|
||||
* 设置为播放状态
|
||||
*/
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
fun setPlayStatus() {
|
||||
private fun setPlayStatus() {
|
||||
//切换为播放
|
||||
viewModel.setSelectPauseTrace(true)
|
||||
binding.mainActivitySnapshotPause.isSelected = viewModel.isSelectPauseTrace()
|
||||
playVideo()
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
fun pauseVideo() {
|
||||
private fun pauseVideo() {
|
||||
val traceVideoBean = TraceVideoBean(command = "pauseVideo?", userid = Constant.USER_ID)
|
||||
viewModel.sendServerCommand(this, traceVideoBean, IndoorToolsCommand.STOP)
|
||||
}
|
||||
@@ -732,7 +726,7 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
fun pasePlayTrace() {
|
||||
fun pausePlayTrace() {
|
||||
viewModel.setSelectTrace(false)
|
||||
binding.mainActivityTraceSnapshotPoints.isSelected = viewModel.isSelectTrace()
|
||||
viewModel.setSelectPauseTrace(false)
|
||||
@@ -780,11 +774,11 @@ class MainActivity : BaseActivity() {
|
||||
mapController.mMapView.setScaleBarLayer(GLViewport.Position.BOTTOM_CENTER, 128, 65)
|
||||
}
|
||||
mapController.mMapView.vtmMap.animator().animateTo(
|
||||
GeoPoint(
|
||||
mapController.mMapView.vtmMap.mapPosition.geoPoint.latitude,
|
||||
mapController.mMapView.vtmMap.mapPosition.geoPoint.longitude
|
||||
)
|
||||
GeoPoint(
|
||||
mapController.mMapView.vtmMap.mapPosition.geoPoint.latitude,
|
||||
mapController.mMapView.vtmMap.mapPosition.geoPoint.longitude
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private fun voiceOnTouchStart() {
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.navinfo.collect.library.map.OnGeoPointClickListener
|
||||
import com.navinfo.collect.library.map.handler.ONNoteItemClickListener
|
||||
import com.navinfo.collect.library.map.handler.OnNiLocationItemListener
|
||||
import com.navinfo.collect.library.map.handler.OnQsRecordItemClickListener
|
||||
import com.navinfo.collect.library.map.handler.OnTaskLinkItemClickListener
|
||||
import com.navinfo.collect.library.utils.GeometryTools
|
||||
import com.navinfo.collect.library.utils.GeometryToolsKt
|
||||
import com.navinfo.omqs.Constant
|
||||
@@ -80,7 +81,8 @@ class MainViewModel @Inject constructor(
|
||||
private val realmOperateHelper: RealmOperateHelper,
|
||||
private val networkService: NetworkService,
|
||||
private val sharedPreferences: SharedPreferences
|
||||
) : ViewModel(), SocketServer.OnConnectSinsListener, SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
) : ViewModel(), SocketServer.OnConnectSinsListener,
|
||||
SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
private val TAG = "MainViewModel"
|
||||
|
||||
@@ -185,7 +187,7 @@ class MainViewModel @Inject constructor(
|
||||
|
||||
private var timer: Timer? = null
|
||||
|
||||
private var disTime :Long = 1000
|
||||
private var disTime: Long = 1000
|
||||
|
||||
init {
|
||||
|
||||
@@ -250,7 +252,7 @@ class MainViewModel @Inject constructor(
|
||||
* 处理定位点的点击
|
||||
*/
|
||||
object : OnNiLocationItemListener {
|
||||
override fun onNiLocation(tag: String, it: NiLocation) {
|
||||
override fun onNiLocation(tag: String, index: Int, it: NiLocation) {
|
||||
if (tag == TAG)
|
||||
liveDataNILocationList.value = it
|
||||
}
|
||||
@@ -415,10 +417,10 @@ class MainViewModel @Inject constructor(
|
||||
)
|
||||
)
|
||||
}
|
||||
withContext(Dispatchers.Main){
|
||||
if(Constant.AUTO_LOCATION){
|
||||
withContext(Dispatchers.Main) {
|
||||
if (Constant.AUTO_LOCATION) {
|
||||
mapController.mMapView.vtmMap.animator()
|
||||
.animateTo(GeoPoint( location.longitude, location.latitude))
|
||||
.animateTo(GeoPoint(location.longitude, location.latitude))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -597,7 +599,7 @@ class MainViewModel @Inject constructor(
|
||||
})
|
||||
}
|
||||
|
||||
private fun initCameraDialog(context:Context){
|
||||
private fun initCameraDialog(context: Context) {
|
||||
if (mCameraDialog == null) {
|
||||
mCameraDialog = CommonDialog(
|
||||
context,
|
||||
@@ -903,10 +905,10 @@ class MainViewModel @Inject constructor(
|
||||
* @param niLocation 轨迹点
|
||||
*/
|
||||
fun setCurrentIndexNiLocation(niLocation: NiLocation) {
|
||||
viewModelScope.launch ( Dispatchers.IO ){
|
||||
Log.e("qj","开始$currentIndexNiLocation")
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
Log.e("qj", "开始$currentIndexNiLocation")
|
||||
currentIndexNiLocation = mapController.markerHandle.getNILocationIndex(niLocation)!!
|
||||
Log.e("qj","结束$currentIndexNiLocation")
|
||||
Log.e("qj", "结束$currentIndexNiLocation")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -957,7 +959,7 @@ class MainViewModel @Inject constructor(
|
||||
if (mNiLocation != null) {
|
||||
setCurrentIndexNiLocation(mNiLocation)
|
||||
showMarker(mapController.mMapView.context, mNiLocation)
|
||||
Log.e("qj","反向控制$currentIndexNiLocation")
|
||||
Log.e("qj", "反向控制$currentIndexNiLocation")
|
||||
} else {
|
||||
BaseToast.makeText(
|
||||
mapController.mMapView.context,
|
||||
@@ -967,12 +969,12 @@ class MainViewModel @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun isAutoCamera():Boolean{
|
||||
fun isAutoCamera(): Boolean {
|
||||
|
||||
return shareUtil?.connectstate == true
|
||||
}
|
||||
|
||||
fun autoCamera(){
|
||||
fun autoCamera() {
|
||||
if (shareUtil?.connectstate == true) {
|
||||
val hostBean1 = HostBean()
|
||||
hostBean1.ipAddress = shareUtil!!.takeCameraIP
|
||||
@@ -983,28 +985,30 @@ class MainViewModel @Inject constructor(
|
||||
}
|
||||
|
||||
fun startTimer() {
|
||||
if(timer!=null){
|
||||
if (timer != null) {
|
||||
cancelTrace()
|
||||
}
|
||||
timer = fixedRateTimer("", false, disTime, disTime) {
|
||||
if(currentIndexNiLocation<mapController.markerHandle.getNILocationItemizedLayerSize()){
|
||||
Log.e("qj","定时器")
|
||||
if (currentIndexNiLocation < mapController.markerHandle.getNILocationItemizedLayerSize()) {
|
||||
Log.e("qj", "定时器")
|
||||
val niLocation = mapController.markerHandle.getNILocation(currentIndexNiLocation)
|
||||
val nextNiLocation = mapController.markerHandle.getNILocation(currentIndexNiLocation+1)
|
||||
if(nextNiLocation!=null&&niLocation!=null){
|
||||
var nilocationDisTime = nextNiLocation.timeStamp.toLong() - niLocation.timeStamp.toLong()
|
||||
disTime = if(nilocationDisTime<1000){
|
||||
val nextNiLocation =
|
||||
mapController.markerHandle.getNILocation(currentIndexNiLocation + 1)
|
||||
if (nextNiLocation != null && niLocation != null) {
|
||||
var nilocationDisTime =
|
||||
nextNiLocation.timeStamp.toLong() - niLocation.timeStamp.toLong()
|
||||
disTime = if (nilocationDisTime < 1000) {
|
||||
1000
|
||||
}else{
|
||||
} else {
|
||||
nilocationDisTime
|
||||
}
|
||||
showMarker(mapController.mMapView.context,nextNiLocation)
|
||||
showMarker(mapController.mMapView.context, nextNiLocation)
|
||||
currentIndexNiLocation += 1
|
||||
//再次启动
|
||||
startTimer()
|
||||
}
|
||||
}else{
|
||||
Toast.makeText(mapController.mMapView.context,"无数据了!",Toast.LENGTH_LONG).show()
|
||||
} else {
|
||||
Toast.makeText(mapController.mMapView.context, "无数据了!", Toast.LENGTH_LONG).show()
|
||||
cancelTrace()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user