diff --git a/src/Map.java b/src/Map.java index abfd465..4d07aba 100644 --- a/src/Map.java +++ b/src/Map.java @@ -1,15 +1,15 @@ -import java.util.*; - public class Map { private MapLongitude mapLongitude; private Longitude longitude; private MapLatitude mapLatitude; private Latitude latitude; + private Presenter presenter; public Map() { this.mapLongitude = new MapLongitude(); this.longitude = new Longitude(mapLongitude); this.mapLatitude = new MapLatitude(); this.latitude = new Latitude(mapLatitude); + this.presenter = new Presenter(mapLongitude, mapLatitude); // Presenter�������� } public double getMapLongitude() { return mapLongitude.getValue(); @@ -19,7 +19,8 @@ } public void updateGPS(double lat2, double long2) { this.longitude.updateGPS(lat2, long2); - this.latitude.updateGPS(lat2, long2); + this.latitude.updateGPS(lat2, long2); + this.presenter.updateGPS(lat2, long2); } public double getMapLatitude() { return mapLatitude.getValue(); @@ -27,4 +28,13 @@ public double getLatitude() { return latitude.getValue(); } + // �����X�V��ON/OFF��؂�ւ��郁�\�b�h + public void setAutoUpdateEnabled(boolean enabled) { + presenter.setAutoUpdateEnabled(enabled); + } + + // �蓮�X�V�̂��߂̃��\�b�h + public void manualUpdate(double lat, double lon) { + presenter.manualUpdate(lat, lon); + } } \ No newline at end of file diff --git a/src/Presenter.java b/src/Presenter.java new file mode 100644 index 0000000..5e3bb9c --- /dev/null +++ b/src/Presenter.java @@ -0,0 +1,29 @@ +// �V���� Presenter �N���X��lj����܂��B +public class Presenter { + private MapLongitude mapLongitude; + private MapLatitude mapLatitude; + private boolean autoUpdateEnabled; + + public Presenter(MapLongitude mapLongitude, MapLatitude mapLatitude) { + this.mapLongitude = mapLongitude; + this.mapLatitude = mapLatitude; + this.autoUpdateEnabled = true; // �f�t�H���g�ł͎����X�V��ON�ł��B + } + + public void setAutoUpdateEnabled(boolean enabled) { + this.autoUpdateEnabled = enabled; + } + + public void updateGPS(double lat, double lon) { + if (autoUpdateEnabled) { + mapLatitude.updateLatitude(lat); + mapLongitude.updateLongitude(lon); + } + } + + // �蓮�Œn�}�̕\���ʒu���X�V���郁�\�b�h��lj����܂��B + public void manualUpdate(double lat, double lon) { + mapLatitude.updateLatitude(lat); + mapLongitude.updateLongitude(lon); + } +} \ No newline at end of file