diff --git a/src/Map.java b/src/Map.java index f7017c1..29e76ff 100644 --- a/src/Map.java +++ b/src/Map.java @@ -3,6 +3,8 @@ private B b; private C c; private A a; + private Presenter presenter; + public Map() { this.d = new D(); this.b = new B(d); @@ -16,9 +18,8 @@ return b.getValue(); } public void updateGPS(double lat2, double long2) { - this.b.updateGPS(lat2, long2); - this.a.updateGPS(lat2, long2); - } + this.presenter.updateGPS(lat2, long2); + } public double getMapLatitude() { return c.getValue(); } diff --git a/src/Presenter.java b/src/Presenter.java new file mode 100644 index 0000000..3bb9e82 --- /dev/null +++ b/src/Presenter.java @@ -0,0 +1,30 @@ +// Presenter �N���X�̒lj� +public class Presenter { + private boolean autoUpdateEnabled = true; // �f�t�H���g�͎����X�VON + private C mapLatitude; + private D mapLongitude; + + public Presenter(C mapLatitude, D mapLongitude) { + this.mapLatitude = mapLatitude; + this.mapLongitude = mapLongitude; + } + + public void setAutoUpdateEnabled(boolean enabled) { + this.autoUpdateEnabled = enabled; + } + + public void updateGPS(double lat, double lon) { + // �ܓx�o�x�I�u�W�F�N�g�͏�ɍX�V + // �n�}�̒��S�ʒu�͎����X�V��ON�̏ꍇ�̂ݍX�V + if (autoUpdateEnabled) { + mapLatitude.updateLatitude(lat); + mapLongitude.updateLongitude(lon); + } + } + + // ���[�U�[���蓮�ōX�V���s�������ꍇ�Ɏg�����\�b�h + public void manualUpdate(double lat, double lon) { + mapLatitude.updateLatitude(lat); + mapLongitude.updateLongitude(lon); + } +} \ No newline at end of file