Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Crowd map works with multiple sensors

  • Loading branch information...
commit 531c0e371180256f4462722d68e620c3bbe0a838 1 parent 6efede1
@obrok obrok authored
View
2  src/main/java/pl/llp/aircasting/activity/HeatMapActivity.java
@@ -159,7 +159,7 @@ protected void onPreExecute() {
int gridSizeX = MAP_BUFFER_SIZE * mapView.getWidth() / size;
int gridSizeY = MAP_BUFFER_SIZE * mapView.getHeight() / size;
- return averagesDriver.index(northWestLoc.getLongitude(), northWestLoc.getLatitude(),
+ return averagesDriver.index(sensorManager.getVisibleSensor(), northWestLoc.getLongitude(), northWestLoc.getLatitude(),
southEastLoc.getLongitude(), southEastLoc.getLatitude(), gridSizeX, gridSizeY);
}
View
72 src/main/java/pl/llp/aircasting/api/AveragesDriver.java
@@ -1,33 +1,33 @@
/**
- AirCasting - Share your Air!
- Copyright (C) 2011-2012 HabitatMap, Inc.
+ AirCasting - Share your Air!
+ Copyright (C) 2011-2012 HabitatMap, Inc.
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
- You can contact the authors by email at <info@habitatmap.org>
-*/
+ You can contact the authors by email at <info@habitatmap.org>
+ */
package pl.llp.aircasting.api;
+import com.google.gson.reflect.TypeToken;
import pl.llp.aircasting.model.Region;
+import pl.llp.aircasting.model.Sensor;
import pl.llp.aircasting.util.http.HttpResult;
-import com.google.gson.reflect.TypeToken;
-
import java.lang.reflect.Type;
import java.util.List;
-import static java.lang.String.*;
+import static java.lang.String.valueOf;
import static pl.llp.aircasting.util.http.HttpBuilder.http;
/**
@@ -37,22 +37,24 @@
* Time: 11:58 AM
*/
public class AveragesDriver {
- private static final String AVERAGES_PATH = "/api/averages.json";
-
- Type listType = new TypeToken<List<Region>>() {
- }.getType();
-
- public HttpResult<Iterable<Region>> index(double west, double north, double east, double south, int gridSizeX, int gridSizeY) {
- return http()
- .get()
- .from(AVERAGES_PATH)
- .with("q[west]", valueOf(west))
- .with("q[north]", valueOf(north))
- .with("q[east]", valueOf(east))
- .with("q[south]", valueOf(south))
- .with("q[grid_size_x]", valueOf(gridSizeX))
- .with("q[grid_size_y]", valueOf(gridSizeY))
- .into(listType);
-
- }
+ private static final String AVERAGES_PATH = "/api/averages.json";
+
+ Type listType = new TypeToken<List<Region>>() {
+ }.getType();
+
+ public HttpResult<Iterable<Region>> index(Sensor sensor, double west, double north, double east, double south,
+ int gridSizeX, int gridSizeY) {
+ return http()
+ .get()
+ .from(AVERAGES_PATH)
+ .with("q[west]", valueOf(west))
+ .with("q[north]", valueOf(north))
+ .with("q[east]", valueOf(east))
+ .with("q[south]", valueOf(south))
+ .with("q[grid_size_x]", valueOf(gridSizeX))
+ .with("q[grid_size_y]", valueOf(gridSizeY))
+ .with("q[sensor_name]", sensor.getSensorName())
+ .with("q[measurement_type]", sensor.getMeasurementType())
+ .into(listType);
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.