diff --git a/src/main/java/org/ntlab/nemophila/models/shops/ShopManager.java b/src/main/java/org/ntlab/nemophila/models/shops/ShopManager.java index 3ac567e..01812ab 100644 --- a/src/main/java/org/ntlab/nemophila/models/shops/ShopManager.java +++ b/src/main/java/org/ntlab/nemophila/models/shops/ShopManager.java @@ -32,18 +32,16 @@ //お店の情報を全て返す public Collection getShops(double upperRightLongitude, double upperRightLatitude, - double lowerLeftlongitude, - double lowerLeftlatitude) { + double lowerLeftLongitude, + double lowerLeftLatitude) { Collection response = new ArrayList<>(); for (Shop shop: shopsMap.values()) { double longitude = shop.getLongitude(); double latitude = shop.getLatitude(); - if (longitude < upperRightLongitude && longitude > lowerLeftlongitude) { - if (latitude < upperRightLatitude && latitude > lowerLeftlatitude) { - response.add(shop); - } + if ((lowerLeftLongitude < longitude && longitude < upperRightLongitude) && (lowerLeftLatitude < latitude && latitude < upperRightLatitude)) { + response.add(shop); } } diff --git a/src/main/java/org/ntlab/nemophila/resources/shops/ShopsRest.java b/src/main/java/org/ntlab/nemophila/resources/shops/ShopsRest.java index 16cfecc..aa74e37 100644 --- a/src/main/java/org/ntlab/nemophila/resources/shops/ShopsRest.java +++ b/src/main/java/org/ntlab/nemophila/resources/shops/ShopsRest.java @@ -17,10 +17,10 @@ @QueryParam("monitor_upper_right_latitude") double upperRightLatitude, @QueryParam("monitor_lower_left_longitude") double lowerLeftLongitude, @QueryParam("monitor_lower_left_latitude") double lowerLeftLatitude) { - System.out.println(upperRightLatitude); - System.out.println(upperRightLongitude); - System.out.println(lowerLeftLatitude); - System.out.println(lowerLeftLongitude); + // System.out.println(upperRightLatitude); + // System.out.println(upperRightLongitude); + // System.out.println(lowerLeftLatitude); + // System.out.println(lowerLeftLongitude); ShopManager shopManager = ShopManager.getInstance(); Collection response = shopManager.getShops(upperRightLongitude, upperRightLatitude, lowerLeftLongitude, lowerLeftLatitude); return response;