Print beginning trail horodate.
This commit is contained in:
parent
259f12ac3f
commit
d4c99b4a59
|
|
@ -47,6 +47,7 @@ import java.util.Observer;
|
||||||
|
|
||||||
import fr.chteufleur.mytrackingdog.models.Gpx;
|
import fr.chteufleur.mytrackingdog.models.Gpx;
|
||||||
import fr.chteufleur.mytrackingdog.models.beans.MyLocation;
|
import fr.chteufleur.mytrackingdog.models.beans.MyLocation;
|
||||||
|
import fr.chteufleur.mytrackingdog.models.beans.MyLocationArray;
|
||||||
import fr.chteufleur.mytrackingdog.services.ServiceGps;
|
import fr.chteufleur.mytrackingdog.services.ServiceGps;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity implements IOrientationConsumer, Observer {
|
public class MainActivity extends AppCompatActivity implements IOrientationConsumer, Observer {
|
||||||
|
|
@ -410,10 +411,12 @@ public class MainActivity extends AppCompatActivity implements IOrientationConsu
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDogTrace() {
|
private void updateDogTrace() {
|
||||||
|
MyLocationArray listLoc = serviceGps.getListGeoPointDog();
|
||||||
Polyline line = new Polyline(map);
|
Polyline line = new Polyline(map);
|
||||||
line.setTitle(Gpx.DOG_TRACE_NAME);
|
line.setTitle(Gpx.DOG_TRACE_NAME);
|
||||||
|
line.setSubDescription("Départ: "+listLoc.getFirstLocation().getDatePrint());
|
||||||
line.setColor(Color.BLUE);
|
line.setColor(Color.BLUE);
|
||||||
line.setPoints(convertListLocation(serviceGps.getListGeoPointDog()));
|
line.setPoints(convertListLocation(listLoc));
|
||||||
line.setWidth(LINE_WIDTH_BIG);
|
line.setWidth(LINE_WIDTH_BIG);
|
||||||
line.setGeodesic(true);
|
line.setGeodesic(true);
|
||||||
line.setInfoWindow(new BasicInfoWindow(R.layout.bonuspack_bubble, map));
|
line.setInfoWindow(new BasicInfoWindow(R.layout.bonuspack_bubble, map));
|
||||||
|
|
@ -422,10 +425,12 @@ public class MainActivity extends AppCompatActivity implements IOrientationConsu
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTrailTrace() {
|
private void updateTrailTrace() {
|
||||||
|
MyLocationArray listLoc = serviceGps.getListGeoPointTraceur();
|
||||||
Polyline line = new Polyline(map);
|
Polyline line = new Polyline(map);
|
||||||
line.setTitle(Gpx.TRAIL_TRACE_NAME);
|
line.setTitle(Gpx.TRAIL_TRACE_NAME);
|
||||||
|
line.setSubDescription("Départ: "+listLoc.getFirstLocation().getDatePrint());
|
||||||
line.setColor(Color.RED);
|
line.setColor(Color.RED);
|
||||||
line.setPoints(convertListLocation(serviceGps.getListGeoPointTraceur()));
|
line.setPoints(convertListLocation(listLoc));
|
||||||
line.setWidth(LINE_WIDTH_BIG);
|
line.setWidth(LINE_WIDTH_BIG);
|
||||||
line.setGeodesic(true);
|
line.setGeodesic(true);
|
||||||
line.setInfoWindow(new BasicInfoWindow(R.layout.bonuspack_bubble, map));
|
line.setInfoWindow(new BasicInfoWindow(R.layout.bonuspack_bubble, map));
|
||||||
|
|
@ -461,7 +466,7 @@ public class MainActivity extends AppCompatActivity implements IOrientationConsu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<GeoPoint> convertListLocation(List<MyLocation> list) {
|
private List<GeoPoint> convertListLocation(MyLocationArray list) {
|
||||||
List<GeoPoint> ret = new ArrayList<>();
|
List<GeoPoint> ret = new ArrayList<>();
|
||||||
if (list != null) {
|
if (list != null) {
|
||||||
for (MyLocation loc : list) {
|
for (MyLocation loc : list) {
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,15 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import fr.chteufleur.mytrackingdog.models.beans.MyLocation;
|
import fr.chteufleur.mytrackingdog.models.beans.MyLocation;
|
||||||
|
import fr.chteufleur.mytrackingdog.models.beans.MyLocationArray;
|
||||||
|
|
||||||
public class Traces {
|
public class Traces {
|
||||||
|
|
||||||
private static final String TAG = Traces.class.getName();
|
private static final String TAG = Traces.class.getName();
|
||||||
|
|
||||||
private List<MyLocation> listPointTraceur = new ArrayList<>();
|
private MyLocationArray listPointTraceur = new MyLocationArray();
|
||||||
private List<MyLocation> listPointDog = new ArrayList<>();
|
private MyLocationArray listPointDog = new MyLocationArray();
|
||||||
private List<MyLocation> listPointObjects = new ArrayList<>();
|
private MyLocationArray listPointObjects = new MyLocationArray();
|
||||||
|
|
||||||
private boolean traceurActivated = false;
|
private boolean traceurActivated = false;
|
||||||
private boolean dogActivated = false;
|
private boolean dogActivated = false;
|
||||||
|
|
@ -38,13 +39,13 @@ public class Traces {
|
||||||
addPointDog(point);
|
addPointDog(point);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public List<MyLocation> getListPointTraceur() {
|
public MyLocationArray getListPointTraceur() {
|
||||||
return listPointTraceur;
|
return listPointTraceur;
|
||||||
}
|
}
|
||||||
public List<MyLocation> getListPointDog() {
|
public MyLocationArray getListPointDog() {
|
||||||
return listPointDog;
|
return listPointDog;
|
||||||
}
|
}
|
||||||
public List<MyLocation> getListPointObjects() {
|
public MyLocationArray getListPointObjects() {
|
||||||
return listPointObjects;
|
return listPointObjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,13 @@ public class MyLocation {
|
||||||
return formaterDate.format(date)+"T"+formaterTime.format(date)+"Z";
|
return formaterDate.format(date)+"T"+formaterTime.format(date)+"Z";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDatePrint() {
|
||||||
|
Date date = new Date(this.time);
|
||||||
|
SimpleDateFormat formaterDate = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
SimpleDateFormat formaterTime = new SimpleDateFormat("HH:mm:ss");
|
||||||
|
return formaterDate.format(date)+" "+formaterTime.format(date);
|
||||||
|
}
|
||||||
|
|
||||||
public double getAltitude() {
|
public double getAltitude() {
|
||||||
return this.altitude;
|
return this.altitude;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
package fr.chteufleur.mytrackingdog.models.beans;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class MyLocationArray extends ArrayList<MyLocation> {
|
||||||
|
|
||||||
|
private MyLocation firstLocation = null;
|
||||||
|
private MyLocation lastLocation = null;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean add(MyLocation loc) {
|
||||||
|
if (firstLocation == null || loc.getTime() < firstLocation.getTime()) {
|
||||||
|
firstLocation = loc;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lastLocation == null || loc.getTime() > lastLocation.getTime()) {
|
||||||
|
lastLocation = loc;
|
||||||
|
}
|
||||||
|
return super.add(loc);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyLocation getFirstLocation() {
|
||||||
|
return firstLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyLocation getLastLocation() {
|
||||||
|
return lastLocation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -22,6 +22,7 @@ import fr.chteufleur.mytrackingdog.models.Gpx;
|
||||||
import fr.chteufleur.mytrackingdog.models.ImportGpx;
|
import fr.chteufleur.mytrackingdog.models.ImportGpx;
|
||||||
import fr.chteufleur.mytrackingdog.models.Traces;
|
import fr.chteufleur.mytrackingdog.models.Traces;
|
||||||
import fr.chteufleur.mytrackingdog.models.beans.MyLocation;
|
import fr.chteufleur.mytrackingdog.models.beans.MyLocation;
|
||||||
|
import fr.chteufleur.mytrackingdog.models.beans.MyLocationArray;
|
||||||
import fr.chteufleur.mytrackingdog.models.beans.TraceLocation;
|
import fr.chteufleur.mytrackingdog.models.beans.TraceLocation;
|
||||||
import fr.chteufleur.mytrackingdog.models.beans.WayPointLocation;
|
import fr.chteufleur.mytrackingdog.models.beans.WayPointLocation;
|
||||||
|
|
||||||
|
|
@ -152,13 +153,13 @@ public class ServiceGps extends Observable implements IServiceGps, LocationListe
|
||||||
return currentLocation;
|
return currentLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MyLocation> getListGeoPointTraceur() {
|
public MyLocationArray getListGeoPointTraceur() {
|
||||||
return traces.getListPointTraceur();
|
return traces.getListPointTraceur();
|
||||||
}
|
}
|
||||||
public List<MyLocation> getListGeoPointDog() {
|
public MyLocationArray getListGeoPointDog() {
|
||||||
return traces.getListPointDog();
|
return traces.getListPointDog();
|
||||||
}
|
}
|
||||||
public List<MyLocation> getListGeoPointObjects() {
|
public MyLocationArray getListGeoPointObjects() {
|
||||||
return traces.getListPointObjects();
|
return traces.getListPointObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue