mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
(cherry picked from commit 55b20c75c0)
Co-authored-by: sheirerd <sheirerd@ainfosec.com>
This commit is contained in:
@@ -87,17 +87,20 @@ public class PlottableEntityHistory
|
||||
*/
|
||||
public void add(PlottableDecodeEvent event)
|
||||
{
|
||||
TimestampedGeoPosition mostRecentPosition = getLatestPosition();
|
||||
TimestampedGeoPosition latest = new TimestampedGeoPosition(event.getLocation(), event.getTimeStart());
|
||||
|
||||
if(isUnique(latest, mostRecentPosition))
|
||||
if(event.isValidLocation())
|
||||
{
|
||||
mCurrentEvent = event;
|
||||
mLocationHistory.add(0, latest);
|
||||
TimestampedGeoPosition mostRecentPosition = getLatestPosition();
|
||||
TimestampedGeoPosition latest = new TimestampedGeoPosition(event.getLocation(), event.getTimeStart());
|
||||
|
||||
while(mLocationHistory.size() > MAX_LOCATION_HISTORY)
|
||||
if(isUnique(latest, mostRecentPosition))
|
||||
{
|
||||
mLocationHistory.remove(mLocationHistory.size() - 1);
|
||||
mCurrentEvent = event;
|
||||
mLocationHistory.add(0, latest);
|
||||
|
||||
while(mLocationHistory.size() > MAX_LOCATION_HISTORY)
|
||||
{
|
||||
mLocationHistory.remove(mLocationHistory.size() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,42 +101,45 @@ public class PlottableEntityModel extends AbstractTableModel implements Listener
|
||||
@Override
|
||||
public void receive(PlottableDecodeEvent plottableDecodeEvent)
|
||||
{
|
||||
//Add or update the event on the swing event thread
|
||||
EventQueue.invokeLater(() -> {
|
||||
Identifier from = plottableDecodeEvent.getIdentifierCollection().getFromIdentifier();
|
||||
if(plottableDecodeEvent.isValidLocation())
|
||||
{
|
||||
//Add or update the event on the swing event thread
|
||||
EventQueue.invokeLater(() -> {
|
||||
Identifier from = plottableDecodeEvent.getIdentifierCollection().getFromIdentifier();
|
||||
|
||||
if(from != null && from.getForm() != Form.LOCATION)
|
||||
{
|
||||
AliasListConfigurationIdentifier aliasList = plottableDecodeEvent.getIdentifierCollection().getAliasListConfiguration();
|
||||
String key = (aliasList != null ? aliasList.toString() : KEY_NO_ALIAS_LIST) + from;
|
||||
|
||||
PlottableEntityHistory entityHistory = mEntityHistoryMap.get(key);
|
||||
|
||||
if(entityHistory == null)
|
||||
if(from != null && from.getForm() != Form.LOCATION)
|
||||
{
|
||||
entityHistory = new PlottableEntityHistory(from, plottableDecodeEvent);
|
||||
mEntityHistories.add(entityHistory);
|
||||
mEntityHistoryMap.put(key, entityHistory);
|
||||
int index = mEntityHistories.indexOf(entityHistory);
|
||||
fireTableRowsInserted(index, index);
|
||||
AliasListConfigurationIdentifier aliasList = plottableDecodeEvent.getIdentifierCollection().getAliasListConfiguration();
|
||||
String key = (aliasList != null ? aliasList.toString() : KEY_NO_ALIAS_LIST) + from;
|
||||
|
||||
PlottableEntityHistory entityHistory = mEntityHistoryMap.get(key);
|
||||
|
||||
if(entityHistory == null)
|
||||
{
|
||||
entityHistory = new PlottableEntityHistory(from, plottableDecodeEvent);
|
||||
mEntityHistories.add(entityHistory);
|
||||
mEntityHistoryMap.put(key, entityHistory);
|
||||
int index = mEntityHistories.indexOf(entityHistory);
|
||||
fireTableRowsInserted(index, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
entityHistory.add(plottableDecodeEvent);
|
||||
int index = mEntityHistories.indexOf(entityHistory);
|
||||
fireTableRowsUpdated(index, index);
|
||||
}
|
||||
|
||||
for(IPlottableUpdateListener listener : mPlottableUpdateListeners)
|
||||
{
|
||||
listener.addPlottableEntity(entityHistory);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
entityHistory.add(plottableDecodeEvent);
|
||||
int index = mEntityHistories.indexOf(entityHistory);
|
||||
fireTableRowsUpdated(index, index);
|
||||
LOGGER.warn("Received plottable decode event that does not contain a FROM identifier - cannot plot");
|
||||
}
|
||||
|
||||
for(IPlottableUpdateListener listener : mPlottableUpdateListeners)
|
||||
{
|
||||
listener.addPlottableEntity(entityHistory);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.warn("Received plottable decode event that does not contain a FROM identifier - cannot plot");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user