// Presenter クラスの追加
public class Presenter {
private boolean autoUpdateEnabled = true; // デフォルトは自動更新ON
private C mapLatitude;
private D mapLongitude;
public Presenter(C mapLatitude, D mapLongitude) {
this.mapLatitude = mapLatitude;
this.mapLongitude = mapLongitude;
}
public void setAutoUpdateEnabled(boolean enabled) {
this.autoUpdateEnabled = enabled;
}
public void updateGPS(double lat, double lon) {
// 緯度経度オブジェクトは常に更新
// 地図の中心位置は自動更新がONの場合のみ更新
if (autoUpdateEnabled) {
mapLatitude.updateLatitude(lat);
mapLongitude.updateLongitude(lon);
}
}
// ユーザーが手動で更新を行いたい場合に使うメソッド
public void manualUpdate(double lat, double lon) {
mapLatitude.updateLatitude(lat);
mapLongitude.updateLongitude(lon);
}
}