#1849 Map enhancements. Adds track list, zoom to selection, history trail size and other features. (#1920)

Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
Denny Sheirer
2024-05-19 07:06:44 -04:00
committed by GitHub
parent c50a914632
commit dddda052fa
14 changed files with 1566 additions and 241 deletions

View File

@@ -31,7 +31,8 @@ import org.jdesktop.swingx.mapviewer.GeoPosition;
*/
public class PlottableEntityHistory
{
private List<GeoPosition> mLocationHistory = new ArrayList<>();
public static final int MAX_LOCATION_HISTORY = 10;
private List<TimestampedGeoPosition> mLocationHistory = new ArrayList<>();
private PlottableDecodeEvent mCurrentEvent;
private Identifier mIdentifier;
@@ -47,11 +48,24 @@ public class PlottableEntityHistory
/**
* Location history for this entity
*/
public List<GeoPosition> getLocationHistory()
public List<TimestampedGeoPosition> getLocationHistory()
{
return new ArrayList<>(mLocationHistory);
}
/**
* Latest position for this entity.
*/
public TimestampedGeoPosition getLatestPosition()
{
if(mLocationHistory.size() > 0)
{
return mLocationHistory.get(0);
}
return null;
}
/**
* Identifier for this plottable
*/
@@ -74,6 +88,11 @@ public class PlottableEntityHistory
public void add(PlottableDecodeEvent event)
{
mCurrentEvent = event;
mLocationHistory.add(event.getLocation());
mLocationHistory.add(0, new TimestampedGeoPosition(event.getLocation(), event.getTimeStart()));
while(mLocationHistory.size() > MAX_LOCATION_HISTORY)
{
mLocationHistory.remove(mLocationHistory.size() - 1);
}
}
}