diff --git a/src/Map.java b/src/Map.java index 82489d5..780c143 100644 --- a/src/Map.java +++ b/src/Map.java @@ -1,31 +1,55 @@ import java.util.*; public class Map { - private MapLatitude mapLatitude; - private Latitude latitude; - private MapLongitude mapLongitude; - private Longitude longitude; - private Presenter presenter; - public Map() { - this.mapLatitude = new MapLatitude(); - this.latitude = new Latitude(); - this.mapLongitude = new MapLongitude(); - this.longitude = new Longitude(); - this.presenter = new Presenter(longitude, latitude, mapLongitude, mapLatitude); - } - public double getMapLatitude() { - return mapLatitude.getValue(); - } - public double getLatitude() { - return latitude.getValue(); - } - public double getMapLongitude() { - return mapLongitude.getValue(); - } - public double getLongitude() { - return longitude.getValue(); - } - public void updateGPS(double lat2, double long2) { - this.presenter.updateGPS(lat2, long2); - } -} \ No newline at end of file + private MapLatitude mapLatitude; + private Latitude latitude; + private MapLongitude mapLongitude; + private Longitude longitude; + private Presenter presenter; + private boolean autoUpdate; // �����X�V�̏�Ԃ��Ǘ�����ϐ� + + public Map() { + this.mapLatitude = new MapLatitude(); + this.latitude = new Latitude(); + this.mapLongitude = new MapLongitude(); + this.longitude = new Longitude(); + this.presenter = new Presenter(longitude, latitude, mapLongitude, mapLatitude); + this.autoUpdate = true; // �f�t�H���g�͎����X�VON + } + + // �����X�V�̏�Ԃ�ݒ肷�� + public void setAutoUpdate(boolean autoUpdate) { + this.autoUpdate = autoUpdate; + } + + // ���݂�GPS�ʒu�Ŏ蓮�X�V���s�� + public void updateManually() { + this.presenter.updateMapLocation(latitude.getValue(), longitude.getValue()); + } + + // �ȉ��̃��\�b�h�͕ύX�Ȃ� + public double getMapLatitude() { + return mapLatitude.getValue(); + } + + public double getLatitude() { + return latitude.getValue(); + } + + public double getMapLongitude() { + return mapLongitude.getValue(); + } + + public double getLongitude() { + return longitude.getValue(); + } + + // GPS�ʒu���X�V���ꂽ���̏��� + public void updateGPS(double lat2, double long2) { + this.latitude.updateGPS(lat2, long2); + this.longitude.updateGPS(lat2, long2); + if (autoUpdate) { // �����X�V��ON�̎��̂ݒn�}�ʒu���X�V + this.presenter.updateMapLocation(lat2, long2); + } + } +}