[Fix]解决ArrayList的操作异常

This commit is contained in:
chenfufeng
2022-09-29 17:00:30 +08:00
parent 5f3a464e11
commit dd10a4d195
2 changed files with 7 additions and 3 deletions

View File

@@ -22,6 +22,7 @@ import com.mogo.eagle.core.function.overview.InfStructureManager;
import com.mogo.eagle.core.function.overview.ViewModelExtKt;
import com.mogo.eagle.core.function.overview.vm.OverViewModel;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.IMogoMap;
import com.mogo.map.IMogoUiSettings;
import com.mogo.map.MogoMapView;
@@ -213,7 +214,9 @@ public class MapFragment extends MvpFragment<MapView, MapPresenter>
@Override
public void onAutopilotRotting(@Nullable MessagePad.GlobalPathResp globalPathResp) {
InfStructureManager.INSTANCE.savePlanningData(globalPathResp.getWayPointsList());
UiThreadHandler.post(() -> {
InfStructureManager.INSTANCE.savePlanningData(globalPathResp.getWayPointsList());
});
}
@Override

View File

@@ -322,13 +322,14 @@ public class AMapCustomView
* @param locationList
*/
private void drawInfrastructureMarkers(List<MessagePad.Location> locationList) {
if (locationList == null) return;
if (!pathMap.isEmpty()) {
pathMap.clear();
}
String geoHash;
ArrayList<Infrastructure> infList;
for (MessagePad.Location location : locationList) {
LatLng latLng = MarkerDrawerManager.INSTANCE.coordinateConverterWgsToGcj(mContext, location);
for (int i = 0; i < locationList.size(); i++) {
LatLng latLng = MarkerDrawerManager.INSTANCE.coordinateConverterWgsToGcj(mContext, locationList.get(i));
geoHash = GeoHash.withCharacterPrecision(latLng.latitude, latLng.longitude, 7).toBase32();
// 网格内的轨迹点只取一次s
if (!pathMap.containsKey(geoHash)) {