diff --git a/app/src/main/java/com/example/cosmosclient/GPSresources/StoreLocationsMethods.java b/app/src/main/java/com/example/cosmosclient/GPSresources/StoreLocationsMethods.java deleted file mode 100644 index 51c215e..0000000 --- a/app/src/main/java/com/example/cosmosclient/GPSresources/StoreLocationsMethods.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.example.cosmosclient.GPSresources; - -import android.location.Location; - -import com.example.cosmosclient.entities.Feature; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -public class StoreLocationsMethods { - private double NowLat; - private double NowLon; - private HashMap> feature = new HashMap<>(); - /*戻り値となる通知が必要なお店情報を格納する連想配列を作成*/ - private ArrayList nearShops=new ArrayList<>(); - - public StoreLocationsMethods(double NowLat, double NowLon){ - this.NowLat=NowLat; - this.NowLon=NowLon; - } - public void updateLocations(double NowLat,double NowLon){ - this.NowLat=NowLat; - this.NowLon=NowLon; - } - public double getNowLat(){ - return this.NowLat; - } - public double getNowLon(){ - return this.NowLon; - } - - public void setNearShops(HashMap> feature){ - this.feature=feature; - //HashMapを順番に実行 - for(HashMap.Entry> e : feature.entrySet()) { - //ArrayList>を回していく - for(int i=0; i < e.getValue().size();i++) { - float[] distance = getDistance(this.NowLat, this.NowLon, e.getValue().get(i).getLocation().getLatitude(), e.getValue().get(i).getLocation().getLongitude()); - // distance[0] = [2点間の距離] - //m単位 - if (distance[0] <= 50) { - /*ここから通知に必要な近い店の情報を格納する処理を記述*/ - /*中身を作成*/ - Feature childFeature = new Feature(); - childFeature.setCode(e.getValue().get(i).getCode()); - childFeature.setLocation(e.getValue().get(i).getLocation()); - childFeature.setName(e.getValue().get(i).getName()); - if(nearShops.indexOf(childFeature)==-1){ - /*通知に必要な近い店の情報を格納する処理を格納*/ - nearShops.add(childFeature); - } - } - } - } - } - public ArrayList getNearShops() { - return nearShops; - } - - /*通知送信後、通知すべきショップ情報リストから削除する*/ - /*引数はArrayList型*/ - /*引数のArrayListと一致するものをnearShopsから削除する*/ - public void deleteNearShops(ArrayList deleteList) { - for(int i=0; i < deleteList.size();i++){ - if(nearShops.indexOf(deleteList)!=-1){ - /*ここで削除*/ - nearShops.remove(nearShops.indexOf(deleteList)); - } - - } - - } - - - public float[] getDistance(double x, double y, double x2, double y2) { - // 結果を格納するための配列を生成 - float[] results = new float[3]; - // results[0] = [2点間の距離] - // results[1] = [始点から見た方位角] - // results[2] = [終点から見た方位角] - - // 距離計算 - Location.distanceBetween(x, y, x2, y2, results); - - return results; - } -}