修改测量工具的联动功能

修改崩溃bug
This commit is contained in:
squallzhjch 2023-08-10 14:02:52 +08:00
parent 6bed16f470
commit 54b30d5db5
5 changed files with 8 additions and 9 deletions

View File

@ -503,7 +503,7 @@ class MainActivity : BaseActivity() {
/** /**
* 结束测量 * 结束测量
*/ */
private fun measuringToolOff() { fun measuringToolOff() {
//监听测距值 //监听测距值
mapController.measureLayerHandler.measureValueLiveData.removeObservers(this) mapController.measureLayerHandler.measureValueLiveData.removeObservers(this)
mapController.measureLayerHandler.tempMeasureValueLiveData.removeObservers(this) mapController.measureLayerHandler.tempMeasureValueLiveData.removeObservers(this)

View File

@ -97,7 +97,7 @@ class TaskLinkFragment : BaseFragment(), View.OnClickListener {
* 线长度 * 线长度
*/ */
mapController.measureLayerHandler.measureValueLiveData.observe(viewLifecycleOwner) { mapController.measureLayerHandler.measureValueLiveData.observe(viewLifecycleOwner) {
binding.taskLinkLength.text = "${it}" binding.taskLinkLength.text = "${it.valueString}${it.unit}"
} }
mapController.measureLayerHandler.tempMeasureValueLiveData.observe(viewLifecycleOwner) { mapController.measureLayerHandler.tempMeasureValueLiveData.observe(viewLifecycleOwner) {
(activity as MainActivity).setHomeCenterText("${it.valueString}${it.unit}") (activity as MainActivity).setHomeCenterText("${it.valueString}${it.unit}")
@ -110,6 +110,7 @@ class TaskLinkFragment : BaseFragment(), View.OnClickListener {
* 显示地图准星 * 显示地图准星
*/ */
activity?.let { activity?.let {
(activity as MainActivity).measuringToolOff()
(activity as MainActivity).setHomeCenterVisibility(View.VISIBLE) (activity as MainActivity).setHomeCenterVisibility(View.VISIBLE)
} }
} }

View File

@ -296,9 +296,11 @@ class TaskLinkViewModel @Inject constructor(
if (task != null) { if (task != null) {
liveDataTaskBean.postValue(realm.copyFromRealm(task)) liveDataTaskBean.postValue(realm.copyFromRealm(task))
} }
hadLinkDvoBean = realm.copyFromRealm(objects) if(objects != null) {
withContext(Dispatchers.Main) { hadLinkDvoBean = realm.copyFromRealm(objects)
mapController.measureLayerHandler.initPathLine(hadLinkDvoBean?.geometry!!) withContext(Dispatchers.Main) {
mapController.measureLayerHandler.initPathLine(hadLinkDvoBean?.geometry!!)
}
} }
} }
} }

View File

@ -51,7 +51,6 @@ public class OMDBReferenceDataSource implements ITileDataSource {
if (!listResult.isEmpty()) { if (!listResult.isEmpty()) {
mThreadLocalDecoders.get().decode(tile.zoomLevel, tile, mapDataSink, listResult); mThreadLocalDecoders.get().decode(tile.zoomLevel, tile, mapDataSink, listResult);
} }
Log.e("jingo",listResult.size() + "条数据");
mapDataSink.completed(QueryResult.SUCCESS); mapDataSink.completed(QueryResult.SUCCESS);
// Log.d("RealmDBTileDataSource", "tile:"+tile.getBoundingBox().toString()); // Log.d("RealmDBTileDataSource", "tile:"+tile.getBoundingBox().toString());
} else { } else {

View File

@ -50,12 +50,9 @@ public class OMDBTileDataSource implements ITileDataSource {
} }
List<RenderEntity> listResult = realmQuery/*.distinct("id")*/.findAll(); List<RenderEntity> listResult = realmQuery/*.distinct("id")*/.findAll();
if (!listResult.isEmpty()) { if (!listResult.isEmpty()) {
Log.e("qj", "查询数据==" + listResult.size() + "==地图级别" + tile.zoomLevel);
mThreadLocalDecoders.get().decode(tile.zoomLevel, tile, mapDataSink, listResult); mThreadLocalDecoders.get().decode(tile.zoomLevel, tile, mapDataSink, listResult);
} }
Log.e("jingo",listResult.size() + "条数据 主");
mapDataSink.completed(QueryResult.SUCCESS); mapDataSink.completed(QueryResult.SUCCESS);
// Log.d("RealmDBTileDataSource", "tile:"+tile.getBoundingBox().toString());
} else { } else {
mapDataSink.completed(QueryResult.SUCCESS); mapDataSink.completed(QueryResult.SUCCESS);
} }