diff --git a/app/src/main/java/com/example/cosmosclient/entities/Feature.java b/app/src/main/java/com/example/cosmosclient/entities/Feature.java index 63c3374..1b505d7 100644 --- a/app/src/main/java/com/example/cosmosclient/entities/Feature.java +++ b/app/src/main/java/com/example/cosmosclient/entities/Feature.java @@ -1,15 +1,15 @@ package com.example.cosmosclient.entities; public class Feature { - private String name; + private String genre; private int code; private Location location = new Location(); - public void setName(String name){ - this.name = name; + public String getGenre() { + return genre; } - public String getName(){ - return this.name; + public void setGenre(String genre) { + this.genre = genre; } public void setCode(int code){ diff --git a/app/src/main/java/com/example/cosmosclient/resources/LocationRest.java b/app/src/main/java/com/example/cosmosclient/resources/LocationRest.java index 43de065..6109a92 100644 --- a/app/src/main/java/com/example/cosmosclient/resources/LocationRest.java +++ b/app/src/main/java/com/example/cosmosclient/resources/LocationRest.java @@ -12,6 +12,8 @@ @POST("location") @FormUrlEncoded - Call LocationService(@Field("latitude") double lat, - @Field("longitude") double lon); + Call LocationService(@Field("leftLatitude") double leftLat, + @Field("leftLongitude") double leftLon, + @Field("rightLatitude") double rightLat, + @Field("rightLongitude") double rightLon); } diff --git a/app/src/main/java/com/example/cosmosclient/services/CosomosBackgroundService.java b/app/src/main/java/com/example/cosmosclient/services/CosomosBackgroundService.java index bb78f17..8397fe0 100644 --- a/app/src/main/java/com/example/cosmosclient/services/CosomosBackgroundService.java +++ b/app/src/main/java/com/example/cosmosclient/services/CosomosBackgroundService.java @@ -42,6 +42,7 @@ private Context context; private LocationManager locationManager; private Location LOC; + private double leftLat,leftLon,rightLat,rightLon; //ここに計算予定 private static final int MinTime = 1000;/*最小時間間隔*/ private static final float MinDistance = 1;/*最小距離間隔*/ @@ -164,8 +165,14 @@ //interfaceから実装を取得 final LocationRest LocationService = retrofit.create(LocationRest.class); + leftLat = Math.floor((location.getLatitude() + 0.1) * 10.0) / 10.0; + leftLon = Math.floor(location.getLongitude() * 10.0) / 10.0; + + rightLat = Math.floor(location.getLatitude() * 10.0) / 10.0; + rightLon = Math.floor((location.getLongitude() + 0.1) * 10.0) / 10.0; + //API呼び出しのための値入力 - Call call = LocationService.LocationService(LOC.getLatitude(),LOC.getLongitude()); + Call call = LocationService.LocationService(leftLat,leftLon,rightLat,rightLon); //サーバからデータ受け取り call.enqueue(new Callback() {