Merge pull request #941 from srcejon/apt_image_zoom

Add image zooming to APT demodulator
pull/942/head
Edouard Griffiths 2021-06-26 09:40:26 +02:00 zatwierdzone przez GitHub
commit 0cf6497ba0
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
10 zmienionych plików z 161 dodań i 47 usunięć

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 252 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 254 KiB

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 9.8 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 11 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 9.2 KiB

Wyświetl plik

@ -584,6 +584,7 @@ int APTDemod::webapiActionsPost(
{
SWGSDRangel::SWGAPTDemodActions_aos* aos = swgAPTDemodActions->getAos();
QString *satelliteName = aos->getSatelliteName();
qDebug() << "APTDemod::webapiActionsPost - AOS " << *satelliteName;
if (satelliteName != nullptr)
{
if (matchSatellite(*satelliteName))
@ -617,6 +618,7 @@ int APTDemod::webapiActionsPost(
{
SWGSDRangel::SWGAPTDemodActions_los* los = swgAPTDemodActions->getLos();
QString *satelliteName = los->getSatelliteName();
qDebug() << "APTDemod::webapiActionsPost - LOS " << *satelliteName;
if (satelliteName != nullptr)
{

Wyświetl plik

@ -25,9 +25,10 @@
#include <QAction>
#include <QRegExp>
#include <QFileDialog>
#include <QGraphicsScene>
#include <QGraphicsPixmapItem>
#include "aptdemodgui.h"
#include "util/ax25.h"
#include "device/deviceuiset.h"
#include "dsp/dspengine.h"
@ -42,6 +43,7 @@
#include "gui/devicestreamselectiondialog.h"
#include "dsp/dspengine.h"
#include "gui/crightclickenabler.h"
#include "gui/graphicsviewzoom.h"
#include "channel/channelwebapiutils.h"
#include "maincore.h"
@ -101,7 +103,20 @@ bool APTDemodGUI::handleMessage(const Message& message)
const APTDemod::MsgImage& imageMsg = (APTDemod::MsgImage&) message;
m_image = imageMsg.getImage();
m_pixmap.convertFromImage(m_image);
ui->image->setPixmap(m_pixmap);
if (m_pixmapItem != nullptr)
{
m_pixmapItem->setPixmap(m_pixmap);
if (ui->zoomAll->isChecked()) {
ui->image->fitInView(m_pixmapItem, Qt::KeepAspectRatio);
}
}
else
{
m_pixmapItem = m_scene->addPixmap(m_pixmap);
m_pixmapItem->setPos(0, 0);
ui->image->fitInView(m_pixmapItem, Qt::KeepAspectRatio);
}
QStringList imageTypes = imageMsg.getImageTypes();
if (imageTypes.size() == 0)
{
@ -171,7 +186,19 @@ bool APTDemodGUI::handleMessage(const Message& message)
}
m_pixmap.convertFromImage(m_image);
ui->image->setPixmap(m_pixmap);
if (m_pixmapItem != nullptr)
{
m_pixmapItem->setPixmap(m_pixmap);
if (ui->zoomAll->isChecked()) {
ui->image->fitInView(m_pixmapItem, Qt::KeepAspectRatio);
}
}
else
{
m_pixmapItem = m_scene->addPixmap(m_pixmap);
m_pixmapItem->setPos(0, 0);
ui->image->fitInView(m_pixmapItem, Qt::KeepAspectRatio);
}
return true;
}
@ -302,7 +329,9 @@ void APTDemodGUI::on_startStop_clicked(bool checked)
void APTDemodGUI::on_resetDecoder_clicked()
{
ui->image->setPixmap(QPixmap());
if (m_pixmapItem != nullptr) {
m_pixmapItem->setPixmap(QPixmap());
}
ui->imageContainer->setWindowTitle("Received image");
// Send message to reset decoder
m_aptDemod->getInputMessageQueue()->push(APTDemod::MsgResetDecoder::create());
@ -332,6 +361,30 @@ void APTDemodGUI::on_saveImage_clicked()
}
}
void APTDemodGUI::on_zoomIn_clicked()
{
m_zoom->gentleZoom(1.25);
ui->zoomAll->setChecked(false);
}
void APTDemodGUI::on_zoomOut_clicked()
{
m_zoom->gentleZoom(0.75);
ui->zoomAll->setChecked(false);
}
void APTDemodGUI::on_zoomAll_clicked(bool checked)
{
if (checked && (m_pixmapItem != nullptr)) {
ui->image->fitInView(m_pixmapItem, Qt::KeepAspectRatio);
}
}
void APTDemodGUI::on_image_zoomed()
{
ui->zoomAll->setChecked(false);
}
void APTDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
{
(void) widget;
@ -389,7 +442,9 @@ APTDemodGUI::APTDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
m_deviceUISet(deviceUISet),
m_channelMarker(this),
m_doApplySettings(true),
m_tickCount(0)
m_tickCount(0),
m_scene(nullptr),
m_pixmapItem(nullptr)
{
ui->setupUi(this);
@ -425,6 +480,13 @@ APTDemodGUI::APTDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
connect(&m_channelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor()));
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
m_zoom = new GraphicsViewZoom(ui->image); // Deleted automatically when view is deleted
connect(m_zoom, SIGNAL(zoomed()), this, SLOT(on_image_zoomed()));
m_scene = new QGraphicsScene(ui->image);
ui->image->setScene(m_scene);
ui->image->show();
displaySettings();
applySettings(true);
}

Wyświetl plik

@ -42,6 +42,9 @@ class DeviceUISet;
class BasebandSampleSink;
class APTDemod;
class APTDemodGUI;
class QGraphicsScene;
class QGraphicsPixmapItem;
class GraphicsViewZoom;
namespace Ui {
class APTDemodGUI;
@ -79,6 +82,9 @@ private:
QImage m_image;
QPixmap m_pixmap;
QGraphicsScene* m_scene;
QGraphicsPixmapItem* m_pixmapItem;
GraphicsViewZoom* m_zoom;
explicit APTDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent = 0);
virtual ~APTDemodGUI();
@ -107,6 +113,10 @@ private slots:
void on_showSettings_clicked();
void on_resetDecoder_clicked();
void on_saveImage_clicked();
void on_zoomIn_clicked();
void on_zoomOut_clicked();
void on_zoomAll_clicked(bool checked=false);
void on_image_zoomed();
void onWidgetRolled(QWidget* widget, bool rollDown);
void onMenuDialogCalled(const QPoint& p);
void handleInputMessages();

Wyświetl plik

@ -356,6 +356,9 @@
</item>
<item>
<layout class="QHBoxLayout" name="buttonLayout">
<property name="spacing">
<number>4</number>
</property>
<item>
<widget class="ButtonSwitch" name="startStop">
<property name="toolTip">
@ -372,7 +375,7 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="showSettings">
<widget class="QToolButton" name="showSettings">
<property name="toolTip">
<string>Show settings dialog</string>
</property>
@ -386,7 +389,7 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="resetDecoder">
<widget class="QToolButton" name="resetDecoder">
<property name="toolTip">
<string>Reset decoder (clears current image)</string>
</property>
@ -400,7 +403,7 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="saveImage">
<widget class="QToolButton" name="saveImage">
<property name="toolTip">
<string>Save image to disk</string>
</property>
@ -413,6 +416,54 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="zoomIn">
<property name="toolTip">
<string>Zoom in to image</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/zoomin.png</normaloff>:/zoomin.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="zoomOut">
<property name="toolTip">
<string>Zoom out from image</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/zoomout.png</normaloff>:/zoomout.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="zoomAll">
<property name="toolTip">
<string>Zoom image to fit window</string>
</property>
<property name="text">
<string>^</string>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/zoomall.png</normaloff>:/zoomall.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
@ -426,13 +477,6 @@
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="channelsLabel">
<property name="text">
<string>Channels</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="channels">
<property name="minimumSize">
@ -645,25 +689,13 @@
</layout>
</item>
<item>
<widget class="ScaledImage" name="image">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QGraphicsView" name="image">
<property name="minimumSize">
<size>
<width>300</width>
<height>350</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
@ -677,9 +709,10 @@
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>LevelMeterSignalDB</class>
@ -688,15 +721,9 @@
<container>1</container>
</customwidget>
<customwidget>
<class>ValueDialZ</class>
<extends>QWidget</extends>
<header>gui/valuedialz.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ScaledImage</class>
<extends>QLabel</extends>
<header>gui/scaledimage.h</header>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
</customwidgets>
<tabstops>

Wyświetl plik

@ -62,7 +62,19 @@ Clears the current image and restarts the decoder. The decoder must be reset bet
Saves the current image to disk. Images can be saved in PNG, JPEG, BMP, PPM, XBM or XPM formats.
<h3>10: Channel selection</h3>
<h3>10: Zoom in</h3>
Zooms in to the image. You can also zoom in with the scroll wheel.
<h3>11: Zoom out</h3>
Zooms out from the image. You can also zoom out with the scroll wheel.
<h3>12: Zoom image to fit</h3>
Zooms so that the image fits in to the available space.
<h3>13: Channel selection</h3>
Selects whether:
@ -70,29 +82,29 @@ Selects whether:
- only channel A is displayed
- only channel B is displayed
<h3>11: Crop noise</h3>
<h3>14: Crop noise</h3>
When checked, noise is cropped from the top and bottom of the image. This is noise that is typically the result of the satellite being at a low elevation.
<h3>12: Apply denoise filter</h3>
<h3>15: Apply denoise filter</h3>
When checked, a denoise filter is applied to the received image.
<h3>13: Apply linear equalisation</h3>
<h3>16: Apply linear equalisation</h3>
When checked, linear equalisation is performed, which can enhance the contrast. The equalisation is performed separately on each channel.
<h3>14: Apply histogram equalisation</h3>
<h3>17: Apply histogram equalisation</h3>
When checked, histogram equalisation is performed, which can enhance the contrast. The equalisation is performed separately on each channel.
<h3>15: Overlay precipitation</h3>
<h3>18: Overlay precipitation</h3>
When checked, precipitation is detected from the IR channel and overlayed on both channels using a colour palette.
This option will not work if linear or histogram equalisation has been applied.
<h3>16: Pass direction</h3>
<h3>19: Pass direction</h3>
The pass direction check button should be set to match the direction of the satellite pass.
i.e. select down arrow for satellite passing from the North to the South and the up arrow for the satellite passing from the South to the North.

Wyświetl plik

@ -107,6 +107,7 @@
<file>load.png</file>
<file>keyboard.png</file>
<file>kill.png</file>
<file>zoomall.png</file>
<file>zoomin.png</file>
<file>zoomout.png</file>
<file>LiberationMono-Regular.ttf</file>

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 398 B