diff --git a/src/Map.java b/src/Map.java index abfd465..b53abc2 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 setAutoUpdate(boolean autoUpdate) { + presenter.setAutoUpdate(autoUpdate); + } } \ No newline at end of file diff --git a/src/Presenter.java b/src/Presenter.java new file mode 100644 index 0000000..3b66d78 --- /dev/null +++ b/src/Presenter.java @@ -0,0 +1,30 @@ +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; // �����l�͎����X�VON�Ƃ��܂� + } + + public void updateGPS(double lat2, double long2) { + // �ܓx�o�x�I�u�W�F�N�g�̏�Ԃ��X�V + longitude.updateGPS(lat2, long2); + latitude.updateGPS(lat2, long2); + // �����X�V��ON�̏ꍇ�A�}�b�v�̈ܓx�o�x���X�V + if (autoUpdate) { + mapLongitude.updateLongitude(long2); + mapLatitude.updateLatitude(lat2); + } + } + + public void setAutoUpdate(boolean autoUpdate) { + this.autoUpdate = autoUpdate; + } +} \ No newline at end of file