diff --git a/src/Map.java b/src/Map.java index abfd465..56049d0 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, longitude, mapLatitude, latitude); } public double getMapLongitude() { return mapLongitude.getValue(); @@ -17,9 +17,8 @@ public double getLongitude() { return longitude.getValue(); } - public void updateGPS(double lat2, double long2) { - this.longitude.updateGPS(lat2, long2); - this.latitude.updateGPS(lat2, long2); + public void updateGPS(double lat, double lon) { + presenter.updateGPS(lat, lon); } public double getMapLatitude() { return mapLatitude.getValue(); @@ -27,4 +26,7 @@ public double getLatitude() { return latitude.getValue(); } + public void setAutoUpdateEnabled(boolean enabled) { + presenter.setAutoUpdateEnabled(enabled); + } } \ No newline at end of file diff --git a/src/Presenter.java b/src/Presenter.java new file mode 100644 index 0000000..c376c3f --- /dev/null +++ b/src/Presenter.java @@ -0,0 +1,34 @@ +public class Presenter { + private MapLongitude mapLongitude; + private Longitude longitude; + private MapLatitude mapLatitude; + private Latitude latitude; + private boolean autoUpdateEnabled; + + public Presenter(MapLongitude mapLong, Longitude longi, MapLatitude mapLat, Latitude lat) { + this.mapLongitude = mapLong; + this.longitude = longi; + this.mapLatitude = mapLat; + this.latitude = lat; + this.autoUpdateEnabled = false; // �f�t�H���g�ł͎����X�V��OFF + } + + public void setAutoUpdateEnabled(boolean enabled) { + this.autoUpdateEnabled = enabled; + } + + // GPS�̈ʒu�����X�V���A�K�v�ɉ�����MapLongitude��MapLatitude���X�V���� + public void updateGPS(double lat2, double long2) { + // Longitude��Latitude�̏�Ԃ��X�V + longitude.updateGPS(long2, lat2); + latitude.updateGPS(long2, lat2); + + // autoUpdateEnabled��true�Ȃ�Map�̏�Ԃ��X�V + if (autoUpdateEnabled) { + mapLongitude.updateGPS(long2, lat2); + mapLatitude.updateGPS(long2, lat2); + } + } + + // ���ɕK�v�ȃ��\�b�h������΂����ɒlj����� +} \ No newline at end of file