Add marker if no marker found.

This commit is contained in:
chteufleur 2018-09-26 17:44:42 +02:00
parent fb110c4f09
commit fe8eb244d5
1 changed files with 8 additions and 0 deletions

View File

@ -250,6 +250,7 @@ public class MainActivity extends AppCompatActivity implements IOrientationConsu
private void markAsFound() { private void markAsFound() {
List<WayPointLocation> wpls = serviceGps.foundNearObjects(); List<WayPointLocation> wpls = serviceGps.foundNearObjects();
boolean findMarker = false;
for (WayPointLocation wpl : wpls) { for (WayPointLocation wpl : wpls) {
if (wpl != null && !wpl.isFound()) { if (wpl != null && !wpl.isFound()) {
wpl.setFound(); wpl.setFound();
@ -265,9 +266,16 @@ public class MainActivity extends AppCompatActivity implements IOrientationConsu
} }
} }
serviceGps.addPointObjectDog(); serviceGps.addPointObjectDog();
findMarker = true;
break; break;
} }
} }
if (wpls.isEmpty() || !findMarker) {
// if no object is near
WayPointLocation wpl = serviceGps.addPointObjectDog();
GeoPoint gp = new GeoPoint(wpl.getLatitude(), wpl.getLongitude(), wpl.getAltitude());
addMarker(gp, true);
}
} }
@Override @Override