Newer
Older
MapPush / src / Presenter.java
public class Presenter {
    private MapLongitude mapLongitude;
    private Longitude longitude;
    private MapLatitude mapLatitude;
    private Latitude latitude;
    private boolean autoUpdate;

    public Presenter(MapLongitude mapLong, Longitude longi, MapLatitude mapLat, Latitude lat) {
        this.mapLongitude = mapLong;
        this.longitude = longi;
        this.mapLatitude = mapLat;
        this.latitude = lat;
        this.autoUpdate = true; // 初期値は自動更新ONとします
    }

    public void updateGPS(double lat2, double long2) {
        // 緯度経度オブジェクトの状態を更新
        longitude.updateGPS(lat2, long2);
        latitude.updateGPS(lat2, long2);
        // 自動更新がONの場合、マップの緯度経度も更新
        if (autoUpdate) {
            mapLongitude.updateLongitude(long2);
            mapLatitude.updateLatitude(lat2);
        }
    }

    public void setAutoUpdate(boolean autoUpdate) {
        this.autoUpdate = autoUpdate;
    }
}