Add Az/El and distance to airport information box.

Use km rather than nm for distance to airport calculation.
Require double click to set ATC freqeuncy.
Allow airport to be set as target, by double clicking Az/El in airport
info box.
pull/704/head
Jon Beniston 2020-11-10 13:40:57 +00:00
rodzic 599c31493a
commit 51bf8a6b21
6 zmienionych plików z 78 dodań i 39 usunięć

Wyświetl plik

@ -89,14 +89,14 @@
<item row="3" column="0">
<widget class="QLabel" name="airportRangeLabel">
<property name="text">
<string>Airport display range (nm)</string>
<string>Airport display distance (km)</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="airportRange">
<property name="toolTip">
<string>Displays airports within the specified range in nautical miles from My Position</string>
<string>Displays airports within the specified distance in kilometres from My Position</string>
</property>
<property name="maximum">
<number>20000</number>

Wyświetl plik

@ -432,8 +432,12 @@ bool AirportModel::setData(const QModelIndex &index, const QVariant& value, int
int idx = value.toInt();
if ((idx >= 0) && (idx < m_airports[row]->m_frequencies.size()))
m_gui->setFrequency(m_airports[row]->m_frequencies[idx]->m_frequency * 1000000);
else
qDebug() << "AirportModel::setData unexpected idx " << idx << " frequencies.size() " << m_airports[row]->m_frequencies.size();
else if (idx == m_airports[row]->m_frequencies.size())
{
// Set airport as target
m_gui->target(m_azimuth[row], m_elevation[row]);
emit dataChanged(index, index);
}
return true;
}
return true;
@ -1456,15 +1460,18 @@ void ADSBDemodGUI::updateAirports()
{
m_airportModel.removeAllAirports();
QHash<int, AirportInformation *>::iterator i = m_airportInfo->begin();
AzEl azEl = m_azEl;
while (i != m_airportInfo->end())
{
AirportInformation *airportInfo = i.value();
// Calculate range to airport from My Position - One degree = 60 nautical miles
float latDiff = std::fabs(airportInfo->m_latitude - m_azEl.getLocationSpherical().m_latitude) * 60.0f;
float longDiff = std::fabs(airportInfo->m_longitude - m_azEl.getLocationSpherical().m_longitude) * 60.0f;
float range = sqrt(latDiff*latDiff+longDiff*longDiff);
// Calculate distance and az/el to airport from My Position
azEl.setTarget(airportInfo->m_latitude, airportInfo->m_longitude, feetToMetres(airportInfo->m_elevation));
azEl.calculate();
// Only display airport if in range
if (range <= m_settings.m_airportRange)
if (azEl.getDistance() <= m_settings.m_airportRange*1000.0f)
{
// Only display the airport if it's large enough
if (airportInfo->m_type >= m_settings.m_airportMinimumSize)
@ -1472,7 +1479,7 @@ void ADSBDemodGUI::updateAirports()
// Only display heliports if enabled
if (m_settings.m_displayHeliports || (airportInfo->m_type != ADSBDemodSettings::AirportType::Heliport))
{
m_airportModel.addAirport(airportInfo);
m_airportModel.addAirport(airportInfo, azEl.getAzimuth(), azEl.getElevation(), azEl.getDistance());
}
}
}
@ -1484,6 +1491,19 @@ void ADSBDemodGUI::updateAirports()
m_currentDisplayHeliports = m_settings.m_displayHeliports;
}
// Set a static target, such as an airport
void ADSBDemodGUI::target(float az, float el)
{
if (m_trackAircraft)
{
// Restore colour of current target
m_trackAircraft->m_isTarget = false;
m_aircraftModel.aircraftUpdated(m_trackAircraft);
m_trackAircraft = nullptr;
}
m_adsbDemod->setTarget(az, el);
}
void ADSBDemodGUI::targetAircraft(Aircraft *aircraft)
{
if (aircraft != m_trackAircraft)

Wyświetl plik

@ -324,16 +324,18 @@ public:
{
}
Q_INVOKABLE void addAirport(AirportInformation *airport) {
Q_INVOKABLE void addAirport(AirportInformation *airport, float az, float el, float distance) {
QString text;
int rows;
beginInsertRows(QModelIndex(), rowCount(), rowCount());
m_airports.append(airport);
airportFreq(airport, text, rows);
airportFreq(airport, az, el, distance, text, rows);
m_airportDataFreq.append(text);
m_airportDataFreqRows.append(rows);
m_showFreq.append(false);
m_azimuth.append(az);
m_elevation.append(el);
endInsertRows();
}
@ -346,6 +348,8 @@ public:
m_airportDataFreq.removeAt(row);
m_airportDataFreqRows.removeAt(row);
m_showFreq.removeAt(row);
m_azimuth.removeAt(row);
m_elevation.removeAt(row);
endRemoveRows();
}
}
@ -356,6 +360,8 @@ public:
m_airportDataFreq.clear();
m_airportDataFreqRows.clear();
m_showFreq.clear();
m_azimuth.clear();
m_elevation.clear();
endRemoveRows();
}
@ -372,7 +378,7 @@ public:
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
}
void airportFreq(AirportInformation *airport, QString& text, int& rows) {
void airportFreq(AirportInformation *airport, float az, float el, float distance, QString& text, int& rows) {
// Create the text to go in the bubble next to the airport
// Display name and frequencies
QStringList list;
@ -385,6 +391,9 @@ public:
list.append(QString("%1: %2 MHz").arg(frequencyInfo->m_type).arg(frequencyInfo->m_frequency));
rows++;
}
list.append(QString("Az/El: %1/%2").arg((int)std::round(az)).arg((int)std::round(el)));
list.append(QString("Distance: %1 km").arg(distance/1000.0f, 0, 'f', 1));
rows += 2;
text = list.join("\n");
}
@ -415,6 +424,8 @@ private:
QList<QString> m_airportDataFreq;
QList<int> m_airportDataFreqRows;
QList<bool> m_showFreq;
QList<float> m_azimuth;
QList<float> m_elevation;
};
class ADSBDemodGUI : public ChannelGUI {
@ -430,6 +441,7 @@ public:
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
void highlightAircraft(Aircraft *aircraft);
void targetAircraft(Aircraft *aircraft);
void target(float az, float el);
bool setFrequency(float frequency);
bool useSIUints() { return m_settings.m_siUnits; }

Wyświetl plik

@ -57,7 +57,7 @@ struct ADSBDemodSettings
Serializable *m_channelMarker;
float m_airportRange; //!< How far away should we display airports (nm)
float m_airportRange; //!< How far away should we display airports (km)
enum AirportType {
Small,
Medium,

Wyświetl plik

@ -161,11 +161,17 @@ Item {
var freqIdx = Math.floor((mouse.y-5)/((height-10)/airportDataRows))
if (freqIdx == 0) {
showFreq = false
} else {
selectedFreq = freqIdx - 1
}
} else {
showFreq = true
showFreq = true
}
}
onDoubleClicked: (mouse) => {
if (showFreq) {
var freqIdx = Math.floor((mouse.y-5)/((height-10)/airportDataRows))
if (freqIdx != 0) {
selectedFreq = freqIdx - 1
}
}
}
}

Wyświetl plik

@ -61,7 +61,7 @@ Clicking the Display Settings button will open the Display Settings dialog, whic
* The units for altitude, speed and vertical climb rate. These can be either ft (feet), kn (knots) and ft/min (feet per minute), or m (metres), kph (kilometers per hour) and m/s (metres per second).
* The minimum size airport that will be displayed on the map: small, medium or large. Use small to display GA airfields, medium for regional airports and large for international airports.
* Whether or not to display heliports.
* The range (in nautical miles) from My Position at which airports will be displayed on the map.
* The distance (in kilometres), from the location set under Preferences > My Position, at which airports will be displayed on the map.
* The timeout, in seconds, after which an aircraft will be removed from the table and map, if an ADS-B frame has not been received from it.
* The font used for the table.
@ -99,18 +99,18 @@ The table displays the decoded ADS-B data for each aircraft along side data avai
* Flight No. - Airline flight number or callsign. (ADS-B)
* Aircraft - The aircraft model. (DB)
* Airline - The logo of the operator of the aircraft (or owner if no operator known). (DB)
* Altitude - Altitude in feet or metres. (ADS-B)
* Speed - Speed (either ground speed, indicated airspeed, or true airspeed) in knots or kph. (ADS-B)
* Heading - The direction the aircraft is heading, in degrees. (ADS-B)
* VR - The vertical climb rate (or descent rate if negative) in feet/minute or m/s. (ADS-B)
* Range - The range (distance) to the aircraft from the receiving antenna in kilometres. The location of the receiving antenna is set under the Preferences > My Position menu.
* Altitude (Alt) - Altitude in feet or metres. (ADS-B)
* Speed (Spd) - Speed (either ground speed, indicated airspeed, or true airspeed) in knots or kph. (ADS-B)
* Heading (Hd) - The direction the aircraft is heading, in degrees. (ADS-B)
* Vertical rate (VR) - The vertical climb rate (or descent rate if negative) in feet/minute or m/s. (ADS-B)
* Distance (D) - The distance to the aircraft from the receiving antenna in kilometres. The location of the receiving antenna is set under the Preferences > My Position menu.
* Az/El - The azimuth and elevation angles to the aircraft from the receiving antenna in degrees. These values can be sent to a rotator controller Feature plugin to track the aircraft.
* Latitude - Vertical position coordinate, in decimal degrees. (ADS-B)
* Longitude - Horizontal position coordinate, in decimal degrees. (ADS-B)
* Category - The vehicle category, such as Light, Large, Heavy or Rotorcraft. (ADS-B)
* Latitude (Lat) - Vertical position coordinate, in decimal degrees. (ADS-B)
* Longitude (Lon) - Horizontal position coordinate, in decimal degrees. (ADS-B)
* Category (Cat) - The vehicle category, such as Light, Large, Heavy or Rotorcraft. (ADS-B)
* Status - The status of the flight, including if there is an emergency. (ADS-B)
* Squawk - The squawk code (Mode-A transponder code). (ADS-B)
* Registration - The registration number of the aircraft. (DB)
* Registration (Reg) - The registration number of the aircraft. (DB)
* Country - The flag of the country the aircraft is registered in. (DB)
* Registered - The date when the aircraft was registered. (DB)
* Manufacturer - The manufacturer of the aircraft. (DB)
@ -122,14 +122,14 @@ The table displays the decoded ADS-B data for each aircraft along side data avai
If an ADS-B frame has not been received from an aircraft for 60 seconds, the aircraft is removed from the table and map. This timeout can be adjusted in the Display Settings dialog.
Single clicking in a cell will highlight the row and the corresponding aircraft information box on the map will be coloured orange, rather than blue.
Right clicking on the header will open a menu allowing you to select which columns are visible.
To reorder the columns, left click and drag left or right a column header.
Left click on a header to sort the table by the data in that column.
Double clicking in an ICAO ID cell will open a Web browser and search for the corresponding aircraft on https://www.planespotters.net/
Double clicking in an Flight No cell will open a Web browser and search for the corresponding flight on https://www.flightradar24.com/
Double clicking in an Az/El cell will set the aircraft as the active target. The azimuth and elevation to the aicraft will be sent to a rotator controller plugin. The aircraft information box will be coloured green, rather than blue, on the map.
Double clicking on any other cell in the table will centre the map on the corresponding aircraft.
* Single clicking in a cell will highlight the row and the corresponding aircraft information box on the map will be coloured orange, rather than blue.
* Right clicking on the header will open a menu allowing you to select which columns are visible.
* To reorder the columns, left click and drag left or right a column header.
* Left click on a header to sort the table by the data in that column.
* Double clicking in an ICAO ID cell will open a Web browser and search for the corresponding aircraft on https://www.planespotters.net/
* Double clicking in an Flight No cell will open a Web browser and search for the corresponding flight on https://www.flightradar24.com/
* Double clicking in an Az/El cell will set the aircraft as the active target. The azimuth and elevation to the aicraft will be sent to a rotator controller plugin. The aircraft information box will be coloured green, rather than blue, on the map.
* Double clicking on any other cell in the table will centre the map on the corresponding aircraft.
<h3>Map</h3>
@ -141,10 +141,11 @@ The initial antenna location is placed according to My Position set under the Pr
Aircraft are only placed upon the map when a position can be calculated, which can require several frames to be received.
To pan around the map, click the left mouse button and drag. To zoom in or out, use the mouse scroll wheel.
Left clicking on an aicraft will highlight the corresponding row in the table for the aircraft and the information box on the map will be coloured orange, rather than blue.
Left clicking the information box next to an aircraft will reveal more information. If can be closed by clicking it again.
Left clicking the information box next to an airport will reveal ATC frequencies for the airport (if the OurAirports database has been downloaded.). This information box can be closed by left clicking on the airport identifier. Left clicking on one of the listed frequencies, will set it as the centre frequency on the selected SDRangel device set.
* To pan around the map, click the left mouse button and drag. To zoom in or out, use the mouse scroll wheel.
* Left clicking on an aicraft will highlight the corresponding row in the table for the aircraft and the information box on the map will be coloured orange, rather than blue.
* Double clicking on an aircraft will set it as the active target and the information box will be coloured green.
* Left clicking the information box next to an aircraft will reveal more information. It can be closed by clicking it again.
* Left clicking the information box next to an airport will reveal ATC frequencies for the airport (if the OurAirports database has been downloaded.). This information box can be closed by left clicking on the airport identifier. Double clicking on one of the listed frequencies, will set it as the centre frequency on the selected SDRangel device set (15). The Az/El row gives the azimuth and elevation of the airport from the location set under Preferences > My Position. Double clicking on this row will set the airport as the active target.
<h3>Attribution</h3>