Browse Source

Fix warnings. Select on find.

chirpmodem-v8.1.0
Jon Beniston 3 weeks ago
parent
commit
dc1d14effe
  1. 14
      plugins/feature/aircraft/aircraftgui.cpp
  2. 7
      plugins/feature/aircraft/aircrafttracker.cpp
  3. 51
      plugins/feature/map/map/map3d.html
  4. 12
      plugins/feature/map/mapgui.cpp
  5. 1
      plugins/feature/map/mapitem.h
  6. 24
      plugins/feature/map/mapmodel.cpp
  7. 29
      plugins/feature/map/mapmodel.h

14
plugins/feature/aircraft/aircraftgui.cpp

@ -533,8 +533,11 @@ AircraftGUI::AircraftGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Featu @@ -533,8 +533,11 @@ AircraftGUI::AircraftGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Featu
});
// Context menus: copy cell contents or find the aircraft on the Map
for (auto pair : { qMakePair((QTableView *) ui->aircraft, true), qMakePair((QTableView *) ui->oldAircraft, true),
qMakePair((QTableView *) ui->flights, false), qMakePair((QTableView *) ui->oldFlights, false) })
const QPair<QTableView *, bool> contextMenuViews[] = {
{ ui->aircraft, true }, { ui->oldAircraft, true },
{ ui->flights, false }, { ui->oldFlights, false }
};
for (const auto& pair : contextMenuViews)
{
QTableView *view = pair.first;
bool isAircraft = pair.second;
@ -940,8 +943,11 @@ void AircraftGUI::setDefaultColumnWidths() @@ -940,8 +943,11 @@ void AircraftGUI::setDefaultColumnWidths()
set(ui->flights, FlightTableModel::COL_ROUTE_SOURCE, "Message <>DB");
// The archive views show the same columns, so give them the same widths
for (auto pair : { qMakePair((QTableView *) ui->aircraft, (QTableView *) ui->oldAircraft),
qMakePair((QTableView *) ui->flights, (QTableView *) ui->oldFlights) })
const QPair<QTableView *, QTableView *> archiveViews[] = {
{ ui->aircraft, ui->oldAircraft },
{ ui->flights, ui->oldFlights }
};
for (const auto& pair : archiveViews)
{
for (int col = 0; col < pair.first->model()->columnCount(); col++) {
pair.second->setColumnWidth(col, pair.first->columnWidth(col));

7
plugins/feature/aircraft/aircrafttracker.cpp

@ -2204,8 +2204,11 @@ void AircraftTracker::mergeFlightInto(TrackedAircraft *item, TrackedFlight *dst, @@ -2204,8 +2204,11 @@ void AircraftTracker::mergeFlightInto(TrackedAircraft *item, TrackedFlight *dst,
// stays on the Map with nothing left that knows how to take it off. Where dst has one
// of its own, src's drawing is removed rather than kept: two flights have become one,
// and only one route can be current.
for (auto pair : { qMakePair(&src->m_flightPlan, &dst->m_flightPlan),
qMakePair(&src->m_clearance, &dst->m_clearance) })
const QPair<TrackedFlight::FiledRoute *, TrackedFlight::FiledRoute *> routes[] = {
{ &src->m_flightPlan, &dst->m_flightPlan },
{ &src->m_clearance, &dst->m_clearance }
};
for (const auto& pair : routes)
{
TrackedFlight::FiledRoute *from = pair.first;
TrackedFlight::FiledRoute *to = pair.second;

51
plugins/feature/map/map/map3d.html

@ -1004,23 +1004,29 @@ @@ -1004,23 +1004,29 @@
viewer.selectedEntity = pickEntityPrioritized(e);
}
// Follow an entity with the camera, in the current camera mode. Something with no
// position to follow - a polygon or polyline - is zoomed to instead
function followEntity(entity) {
withFullDetail(entity, function () {
if (cameraMode === cameraModeFirstPerson) {
setFirstPersonView(entity);
} else if (cameraMode === cameraModeFlyBy) {
setFlyByView(entity);
} else {
if (Cesium.Property.getValueOrUndefined(entity.position, viewer.clock.currentTime)) {
setThirdPersonView(entity);
} else {
clearFarAmbient(entity);
viewer.zoomTo(entity);
}
}
});
}
function pickAndTrack(e) {
const entity = pickEntityPrioritized(e);
if (Cesium.defined(entity)) {
withFullDetail(entity, function () {
if (cameraMode === cameraModeFirstPerson) {
setFirstPersonView(entity);
} else if (cameraMode === cameraModeFlyBy) {
setFlyByView(entity);
} else {
if (Cesium.Property.getValueOrUndefined(entity.position, viewer.clock.currentTime)) {
setThirdPersonView(entity);
} else {
clearFarAmbient(entity);
viewer.zoomTo(entity);
}
}
});
followEntity(entity);
} else if (Cesium.defined(viewer.trackedEntity)) {
//viewer.trackedEntity = undefined;
lodPendingFocus = undefined;
@ -3619,11 +3625,15 @@ @@ -3619,11 +3625,15 @@
const command = JSON.parse(event.data);
if (command.command == "trackId") {
// Track an entity with the given ID
// Select and track an entity with the given ID, as a click then a double
// click on it would. Setting trackedEntity alone left a first person or
// fly-by camera on whatever it was following before. An ID that isn't on
// the map leaves the selection and camera be
const entity = czmlStream.entities.getById(command.id);
withFullDetail(entity, function () {
viewer.trackedEntity = entity;
});
if (Cesium.defined(entity)) {
viewer.selectedEntity = entity;
followEntity(entity);
}
} else if (command.command == "setHomeView") {
// Set the viewing rectangle used when the home button is pressed
Cesium.Camera.DEFAULT_VIEW_RECTANGLE = Cesium.Rectangle.fromDegrees(
@ -3635,7 +3645,10 @@ @@ -3635,7 +3645,10 @@
Cesium.Camera.DEFAULT_VIEW_FACTOR = 0.0;
viewer.camera.flyHome(0);
} else if (command.command == "setView") {
// Set the camera view
// Set the camera view. Only sent for a search, so stop following whatever
// was being tracked, or the camera would stay with it
lodPendingFocus = undefined;
setThirdPersonView(undefined);
viewer.scene.camera.setView({
destination: Cesium.Cartesian3.fromDegrees(command.longitude, command.latitude, command.altitude),
orientation: {

12
plugins/feature/map/mapgui.cpp

@ -3713,14 +3713,16 @@ void MapGUI::find(const QString& target) @@ -3713,14 +3713,16 @@ void MapGUI::find(const QString& target)
}
else
{
// The names match case-insensitively, but the 3D map's IDs don't, so
// track by the item's own name, not what was typed
ObjectMapItem *mapItem = (ObjectMapItem *)m_objectMapModel.findMapItem(target);
if (mapItem != nullptr)
{
map->setProperty("center", QVariant::fromValue(mapItem->getCoordinates()));
if (m_cesium) {
m_cesium->track(target);
m_cesium->track(mapItem->getName());
}
m_objectMapModel.moveToFront(m_objectMapModel.findMapItemIndex(target).row());
m_objectMapModel.moveToFront(mapItem->m_row);
return;
}
@ -3729,18 +3731,18 @@ void MapGUI::find(const QString& target) @@ -3729,18 +3731,18 @@ void MapGUI::find(const QString& target)
{
map->setProperty("center", QVariant::fromValue(polylineMapItem->getCoordinates()));
if (m_cesium) {
m_cesium->track(target);
m_cesium->track(polylineMapItem->getName());
}
//m_polylineMapModel.moveToFront(m_polylineMapModel.findMapItemIndex(target).row());
return;
}
PolygonMapItem *polygonMapItem = (PolygonMapItem *)m_polylineMapModel.findMapItem(target);
PolygonMapItem *polygonMapItem = (PolygonMapItem *)m_polygonMapModel.findMapItem(target);
if (polygonMapItem != nullptr)
{
map->setProperty("center", QVariant::fromValue(polygonMapItem->getCoordinates()));
if (m_cesium) {
m_cesium->track(target);
m_cesium->track(polygonMapItem->getName());
}
//m_polylineMapModel.moveToFront(m_polylineMapModel.findMapItemIndex(target).row());
return;

1
plugins/feature/map/mapitem.h

@ -73,6 +73,7 @@ public: @@ -73,6 +73,7 @@ public:
int m_row = -1;
virtual void update(SWGSDRangel::SWGMapItem *mapItem);
QGeoCoordinate getCoordinates();
const QString& getName() const { return m_name; }
protected:

24
plugins/feature/map/mapmodel.cpp

@ -1877,6 +1877,7 @@ bool ObjectMapFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourceP @@ -1877,6 +1877,7 @@ bool ObjectMapFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourceP
void ObjectMapFilter::viewChanged(double topLeftLongitude, double topLeftLatitude, double bottomRightLongitude, double bottomRightLatitude, double zoomLevel)
{
PROFILER_START()
beginFilterChange();
m_zoomLevel = zoomLevel;
if (!std::isnan(topLeftLongitude))
{
@ -1885,7 +1886,7 @@ void ObjectMapFilter::viewChanged(double topLeftLongitude, double topLeftLatitud @@ -1885,7 +1886,7 @@ void ObjectMapFilter::viewChanged(double topLeftLongitude, double topLeftLatitud
m_bottomRightLongitude = bottomRightLongitude;
m_bottomRightLatitude = bottomRightLatitude;
}
invalidateFilter();
endFilterChange();
PROFILER_STOP("Map filter objects")
}
@ -1927,11 +1928,12 @@ bool PolygonFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourcePar @@ -1927,11 +1928,12 @@ bool PolygonFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourcePar
void PolygonFilter::viewChanged(double topLeftLongitude, double topLeftLatitude, double bottomRightLongitude, double bottomRightLatitude, double zoomLevel)
{
PROFILER_START()
beginFilterChange();
m_zoomLevel = zoomLevel;
if (!std::isnan(topLeftLongitude)) {
m_view = QGeoRectangle(QGeoCoordinate(topLeftLatitude, topLeftLongitude), QGeoCoordinate(bottomRightLatitude, bottomRightLongitude));
}
invalidateFilter();
endFilterChange();
PROFILER_STOP("Map filter polygons")
}
@ -1972,11 +1974,12 @@ bool PolylineFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourcePa @@ -1972,11 +1974,12 @@ bool PolylineFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourcePa
void PolylineFilter::viewChanged(double topLeftLongitude, double topLeftLatitude, double bottomRightLongitude, double bottomRightLatitude, double zoomLevel)
{
PROFILER_START()
beginFilterChange();
m_zoomLevel = zoomLevel;
if (!std::isnan(topLeftLongitude)) {
m_view = QGeoRectangle(QGeoCoordinate(topLeftLatitude, topLeftLongitude), QGeoCoordinate(bottomRightLatitude, bottomRightLongitude));
}
invalidateFilter();
endFilterChange();
PROFILER_STOP("Map filter polylines")
}
@ -2021,11 +2024,12 @@ bool ImageFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParen @@ -2021,11 +2024,12 @@ bool ImageFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParen
void ImageFilter::viewChanged(double topLeftLongitude, double topLeftLatitude, double bottomRightLongitude, double bottomRightLatitude, double zoomLevel)
{
PROFILER_START()
beginFilterChange();
m_zoomLevel = zoomLevel;
if (!std::isnan(topLeftLongitude)) {
m_view = QGeoRectangle(QGeoCoordinate(topLeftLatitude, topLeftLongitude), QGeoCoordinate(bottomRightLatitude, bottomRightLongitude));
}
invalidateFilter();
endFilterChange();
PROFILER_STOP("Map filter images")
}
@ -2037,24 +2041,28 @@ Q_INVOKABLE int ImageFilter::mapRowToSource(int row) @@ -2037,24 +2041,28 @@ Q_INVOKABLE int ImageFilter::mapRowToSource(int row)
void PolygonFilter::setPosition(const QGeoCoordinate& position)
{
beginFilterChange();
m_position = position;
invalidateFilter();
endFilterChange();
}
void PolylineFilter::setPosition(const QGeoCoordinate& position)
{
beginFilterChange();
m_position = position;
invalidateFilter();
endFilterChange();
}
void ObjectMapFilter::setPosition(const QGeoCoordinate& position)
{
beginFilterChange();
m_position = position;
invalidateFilter();
endFilterChange();
}
void ImageFilter::setPosition(const QGeoCoordinate& position)
{
beginFilterChange();
m_position = position;
invalidateFilter();
endFilterChange();
}

29
plugins/feature/map/mapmodel.h

@ -454,6 +454,14 @@ public: @@ -454,6 +454,14 @@ public:
Q_INVOKABLE int mapRowToSource(int row);
void setPosition(const QGeoCoordinate& position);
protected:
// Qt 6.10 brought these, deprecating invalidateFilter() in their favour. On anything
// older they stand in for it, as in AcarsMessageFilter
#if QT_VERSION < QT_VERSION_CHECK(6, 10, 0)
void beginFilterChange() {}
void endFilterChange() { invalidateFilter(); }
#endif
private:
QGeoRectangle m_view;
double m_zoomLevel;
@ -476,6 +484,13 @@ public: @@ -476,6 +484,13 @@ public:
Q_INVOKABLE int mapRowToSource(int row);
void setPosition(const QGeoCoordinate& position);
protected:
// As in PolygonFilter
#if QT_VERSION < QT_VERSION_CHECK(6, 10, 0)
void beginFilterChange() {}
void endFilterChange() { invalidateFilter(); }
#endif
private:
QGeoRectangle m_view;
double m_zoomLevel;
@ -503,6 +518,13 @@ public: @@ -503,6 +518,13 @@ public:
Q_INVOKABLE int mapRowToSource(int row);
void setPosition(const QGeoCoordinate& position);
protected:
// As in PolygonFilter
#if QT_VERSION < QT_VERSION_CHECK(6, 10, 0)
void beginFilterChange() {}
void endFilterChange() { invalidateFilter(); }
#endif
private:
double m_topLeftLongitude;
double m_topLeftLatitude;
@ -528,6 +550,13 @@ public: @@ -528,6 +550,13 @@ public:
Q_INVOKABLE int mapRowToSource(int row);
void setPosition(const QGeoCoordinate& position);
protected:
// As in PolygonFilter
#if QT_VERSION < QT_VERSION_CHECK(6, 10, 0)
void beginFilterChange() {}
void endFilterChange() { invalidateFilter(); }
#endif
private:
QGeoRectangle m_view;
double m_zoomLevel;

Loading…
Cancel
Save