mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-17 02:57:35 -05:00
Revert "#1990 Ignores GPS positions with 0/0 latitude and longitude values."
This reverts commit 55b20c75c0.
This commit is contained in:
@@ -87,20 +87,17 @@ public class PlottableEntityHistory
|
|||||||
*/
|
*/
|
||||||
public void add(PlottableDecodeEvent event)
|
public void add(PlottableDecodeEvent event)
|
||||||
{
|
{
|
||||||
if(event.isValidLocation())
|
TimestampedGeoPosition mostRecentPosition = getLatestPosition();
|
||||||
|
TimestampedGeoPosition latest = new TimestampedGeoPosition(event.getLocation(), event.getTimeStart());
|
||||||
|
|
||||||
|
if(isUnique(latest, mostRecentPosition))
|
||||||
{
|
{
|
||||||
TimestampedGeoPosition mostRecentPosition = getLatestPosition();
|
mCurrentEvent = event;
|
||||||
TimestampedGeoPosition latest = new TimestampedGeoPosition(event.getLocation(), event.getTimeStart());
|
mLocationHistory.add(0, latest);
|
||||||
|
|
||||||
if(isUnique(latest, mostRecentPosition))
|
while(mLocationHistory.size() > MAX_LOCATION_HISTORY)
|
||||||
{
|
{
|
||||||
mCurrentEvent = event;
|
mLocationHistory.remove(mLocationHistory.size() - 1);
|
||||||
mLocationHistory.add(0, latest);
|
|
||||||
|
|
||||||
while(mLocationHistory.size() > MAX_LOCATION_HISTORY)
|
|
||||||
{
|
|
||||||
mLocationHistory.remove(mLocationHistory.size() - 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,45 +101,42 @@ public class PlottableEntityModel extends AbstractTableModel implements Listener
|
|||||||
@Override
|
@Override
|
||||||
public void receive(PlottableDecodeEvent plottableDecodeEvent)
|
public void receive(PlottableDecodeEvent plottableDecodeEvent)
|
||||||
{
|
{
|
||||||
if(plottableDecodeEvent.isValidLocation())
|
//Add or update the event on the swing event thread
|
||||||
{
|
EventQueue.invokeLater(() -> {
|
||||||
//Add or update the event on the swing event thread
|
Identifier from = plottableDecodeEvent.getIdentifierCollection().getFromIdentifier();
|
||||||
EventQueue.invokeLater(() -> {
|
|
||||||
Identifier from = plottableDecodeEvent.getIdentifierCollection().getFromIdentifier();
|
|
||||||
|
|
||||||
if(from != null && from.getForm() != Form.LOCATION)
|
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)
|
||||||
{
|
{
|
||||||
AliasListConfigurationIdentifier aliasList = plottableDecodeEvent.getIdentifierCollection().getAliasListConfiguration();
|
entityHistory = new PlottableEntityHistory(from, plottableDecodeEvent);
|
||||||
String key = (aliasList != null ? aliasList.toString() : KEY_NO_ALIAS_LIST) + from;
|
mEntityHistories.add(entityHistory);
|
||||||
|
mEntityHistoryMap.put(key, entityHistory);
|
||||||
PlottableEntityHistory entityHistory = mEntityHistoryMap.get(key);
|
int index = mEntityHistories.indexOf(entityHistory);
|
||||||
|
fireTableRowsInserted(index, index);
|
||||||
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
|
else
|
||||||
{
|
{
|
||||||
LOGGER.warn("Received plottable decode event that does not contain a FROM identifier - cannot plot");
|
entityHistory.add(plottableDecodeEvent);
|
||||||
|
int index = mEntityHistories.indexOf(entityHistory);
|
||||||
|
fireTableRowsUpdated(index, index);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
for(IPlottableUpdateListener listener : mPlottableUpdateListeners)
|
||||||
|
{
|
||||||
|
listener.addPlottableEntity(entityHistory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGGER.warn("Received plottable decode event that does not contain a FROM identifier - cannot plot");
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -62,16 +62,6 @@ public class PlottableDecodeEvent extends DecodeEvent
|
|||||||
return mGeoPosition;
|
return mGeoPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates if the location is non-null and either latitude or longitude is not at the zero axis. If the location
|
|
||||||
* coordinates are zero or both are very small values close to zero, then the location is flagged as invalid.
|
|
||||||
*/
|
|
||||||
public boolean isValidLocation()
|
|
||||||
{
|
|
||||||
return mGeoPosition != null &&
|
|
||||||
((Math.abs(mGeoPosition.getLatitude()) > 0.01) || (Math.abs(mGeoPosition.getLongitude()) > 0.01));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the heading for the mobile plottable event
|
* Sets the heading for the mobile plottable event
|
||||||
* @param heading
|
* @param heading
|
||||||
|
|||||||
Reference in New Issue
Block a user