@@ 146-164 (lines=19) @@ | ||
143 | * |
|
144 | * @return \Symfony\Component\HttpFoundation\Response |
|
145 | */ |
|
146 | public function byRectangleZone($longitudeLeft, $latitudeBottom, $longitudeRight, $latitudeTop, $mapZoom = 10, $cluster = 'yes') |
|
147 | { |
|
148 | $boundingBox = array($longitudeLeft, $latitudeBottom, $longitudeRight, $latitudeTop, $mapZoom); |
|
149 | ||
150 | $response = new Response(); |
|
151 | ||
152 | try { |
|
153 | $data = $this->weather->fetchWeatherDataForCitiesWithinRectangleZone($boundingBox, $cluster); |
|
154 | $response->setContent($data); |
|
155 | } catch (NotAuthorizedException $e) { |
|
156 | $response->setContent($e->getMessage()); |
|
157 | $response->setStatusCode(Response::HTTP_UNAUTHORIZED); |
|
158 | } catch (NotFoundException $e) { |
|
159 | $response->setContent($e->getMessage()); |
|
160 | $response->setStatusCode(Response::HTTP_NOT_FOUND); |
|
161 | } |
|
162 | ||
163 | return $response; |
|
164 | } |
|
165 | ||
166 | /** |
|
167 | * Returns weather data for cities in circle. |
@@ 68-88 (lines=21) @@ | ||
65 | * |
|
66 | * @return \Symfony\Component\HttpFoundation\Response |
|
67 | */ |
|
68 | public function getFromSeveralByRectangleZone($longitudeTopLeft, $latitudeTopLeft, $longitudeBottomRight, $latitudeBottomRight, $mapZoom, $cluster = 'yes', $numberOfStations = 10) |
|
69 | { |
|
70 | $boundingBox = array( |
|
71 | $longitudeTopLeft, $latitudeTopLeft, $longitudeBottomRight, $latitudeBottomRight, $mapZoom, |
|
72 | ); |
|
73 | ||
74 | $response = new Response(); |
|
75 | ||
76 | try { |
|
77 | $data = $this->weatherStations->fetchFromSeveralByRectangleZone($boundingBox, $cluster, $numberOfStations); |
|
78 | $response->setContent($data); |
|
79 | } catch (NotAuthorizedException $e) { |
|
80 | $response->setContent($e->getMessage()); |
|
81 | $response->setStatusCode(Response::HTTP_UNAUTHORIZED); |
|
82 | } catch (NotFoundException $e) { |
|
83 | $response->setContent($e->getMessage()); |
|
84 | $response->setStatusCode(Response::HTTP_NOT_FOUND); |
|
85 | } |
|
86 | ||
87 | return $response; |
|
88 | } |
|
89 | ||
90 | /** |
|
91 | * Returns data from several stations by geo point. |