use of org.odk.collect.geo.maps.MapPoint in project collect by opendatakit.
the class FormMapActivityTest method tappingOnDeletedInstances_showsSubmissionSummaryWithAppropriateMessage.
// Geometry is removed from the database on instance deletion but just in case there is a
// deleted instance with geometry available, show a deleted toast.
@Test
public void tappingOnDeletedInstances_showsSubmissionSummaryWithAppropriateMessage() {
Pair<Instance, MapPoint> deleted = new Pair<>(testInstances[0], new MapPoint(10.0, 125.6));
int featureId = map.getFeatureIdFor(deleted.second);
activity.onFeatureClicked(featureId);
assertSubmissionSummaryContent(deleted.first.getDisplayName(), deleted.first.getStatus(), new Date(deleted.first.getLastStatusChangeDate()), DELETED_TOAST);
}
use of org.odk.collect.geo.maps.MapPoint in project collect by opendatakit.
the class FormMapActivityTest method centerAndZoomLevel_areRestoredAfterOrientationChange.
@Ignore("Doesn't work with field-based dependency injection because we don't get an opportunity" + "to set test doubles before onCreate() is called after the orientation change")
@Test
public void centerAndZoomLevel_areRestoredAfterOrientationChange() {
map.zoomToPoint(new MapPoint(7, 7), 7, false);
RuntimeEnvironment.setQualifiers("+land");
activityController.configurationChange();
assertThat(map.getCenter(), is(new MapPoint(7, 7)));
assertThat(map.getZoom(), is(7));
}
use of org.odk.collect.geo.maps.MapPoint in project collect by opendatakit.
the class FormMapActivityTest method tappingOnUneditableInstances_showsSubmissionSummaryWithAppropriateMessage.
@Test
public void tappingOnUneditableInstances_showsSubmissionSummaryWithAppropriateMessage() {
Pair<Instance, MapPoint> sent = new Pair<>(testInstances[5], new MapPoint(10.3, 125.7));
int featureId = map.getFeatureIdFor(sent.second);
activity.onFeatureClicked(featureId);
assertSubmissionSummaryContent(sent.first.getDisplayName(), sent.first.getStatus(), new Date(sent.first.getLastStatusChangeDate()), OPEN_READ_ONLY);
}
use of org.odk.collect.geo.maps.MapPoint in project collect by opendatakit.
the class GeoPolyActivity method startInput.
@Override
public void startInput() {
inputActive = true;
if (recordingEnabled && recordingAutomatic) {
boolean retainMockAccuracy = getIntent().getBooleanExtra(Constants.EXTRA_RETAIN_MOCK_ACCURACY, false);
locationTracker.start(retainMockAccuracy);
recordPoint(map.getGpsLocation());
schedulerHandler = scheduler.scheduleAtFixedRate(() -> runOnUiThread(() -> {
Location currentLocation = locationTracker.getCurrentLocation();
if (currentLocation != null) {
MapPoint currentMapPoint = new MapPoint(currentLocation.getLatitude(), currentLocation.getLongitude(), currentLocation.getAltitude(), currentLocation.getAccuracy());
recordPoint(currentMapPoint);
}
}), INTERVAL_OPTIONS[intervalIndex], INTERVAL_OPTIONS[intervalIndex], TimeUnit.SECONDS);
}
updateUi();
}
use of org.odk.collect.geo.maps.MapPoint in project collect by opendatakit.
the class GeoPolyActivity method saveAsPolygon.
private void saveAsPolygon() {
if (map.getPolyPoints(featureId).size() > 2) {
// Close the polygon.
List<MapPoint> points = map.getPolyPoints(featureId);
int count = points.size();
if (count > 1 && !points.get(0).equals(points.get(count - 1))) {
map.appendPointToPoly(featureId, points.get(0));
}
finishWithResult();
} else {
ToastUtils.showShortToastInMiddle(this, getString(R.string.polygon_validator));
}
}
Aggregations