mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-09-05 22:57:47 -04:00
Optionally reenamable smoothing on 2D maps, as 16 MSAA isn't always available
This commit is contained in:
parent
60a3dfcee7
commit
df7b763eab
@ -4492,6 +4492,7 @@ void ADSBDemodGUI::applyMapSettings()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the map using the specified provider
|
// Create the map using the specified provider
|
||||||
|
QQmlProperty::write(item, "smoothing", MainCore::instance()->getSettings().getMapSmoothing());
|
||||||
QQmlProperty::write(item, "mapProvider", m_settings.m_mapProvider);
|
QQmlProperty::write(item, "mapProvider", m_settings.m_mapProvider);
|
||||||
QVariantMap parameters;
|
QVariantMap parameters;
|
||||||
QString mapType;
|
QString mapType;
|
||||||
@ -4619,7 +4620,8 @@ ADSBDemodGUI::ADSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb
|
|||||||
connect(rollupContents, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
connect(rollupContents, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
||||||
|
|
||||||
// Enable MSAA antialiasing on 2D map
|
// Enable MSAA antialiasing on 2D map
|
||||||
// This is much faster than using layer.smooth in the QML, when there are many items
|
// This can be much faster than using layer.smooth in the QML, when there are many items
|
||||||
|
// However, only seems to work when set to 16, and doesn't seem to be supported on all graphics cards
|
||||||
int multisamples = MainCore::instance()->getSettings().getMapMultisampling();
|
int multisamples = MainCore::instance()->getSettings().getMapMultisampling();
|
||||||
if (multisamples > 0)
|
if (multisamples > 0)
|
||||||
{
|
{
|
||||||
@ -4628,7 +4630,7 @@ ADSBDemodGUI::ADSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb
|
|||||||
ui->map->setFormat(format);
|
ui->map->setFormat(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_osmPort = 0; // Pick a free port
|
m_osmPort = 0; // Pick a free port
|
||||||
m_templateServer = new ADSBOSMTemplateServer("q2RVNAe3eFKCH4XsrE3r", m_osmPort);
|
m_templateServer = new ADSBOSMTemplateServer("q2RVNAe3eFKCH4XsrE3r", m_osmPort);
|
||||||
|
|
||||||
ui->map->setAttribute(Qt::WA_AcceptTouchEvents, true);
|
ui->map->setAttribute(Qt::WA_AcceptTouchEvents, true);
|
||||||
@ -5726,7 +5728,7 @@ void ADSBDemodGUI::preferenceChanged(int elementType)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pref == Preferences::StationName)
|
else if (pref == Preferences::StationName)
|
||||||
{
|
{
|
||||||
// Update icon label on Map
|
// Update icon label on Map
|
||||||
QQuickItem *item = ui->map->rootObject();
|
QQuickItem *item = ui->map->rootObject();
|
||||||
@ -5739,6 +5741,11 @@ void ADSBDemodGUI::preferenceChanged(int elementType)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (pref == Preferences::MapSmoothing)
|
||||||
|
{
|
||||||
|
QQuickItem *item = ui->map->rootObject();
|
||||||
|
QQmlProperty::write(item, "smoothing", MainCore::instance()->getSettings().getMapSmoothing());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ADSBDemodGUI::initAviationWeather()
|
void ADSBDemodGUI::initAviationWeather()
|
||||||
|
@ -14,6 +14,7 @@ Item {
|
|||||||
property string requestedMapType
|
property string requestedMapType
|
||||||
property bool lightIcons
|
property bool lightIcons
|
||||||
property variant guiPtr
|
property variant guiPtr
|
||||||
|
property bool smoothing
|
||||||
|
|
||||||
function createMap(pluginParameters, requestedMap, gui) {
|
function createMap(pluginParameters, requestedMap, gui) {
|
||||||
requestedMapType = requestedMap
|
requestedMapType = requestedMap
|
||||||
@ -140,8 +141,8 @@ Item {
|
|||||||
Grid {
|
Grid {
|
||||||
horizontalItemAlignment: Grid.AlignHCenter
|
horizontalItemAlignment: Grid.AlignHCenter
|
||||||
columnSpacing: 5
|
columnSpacing: 5
|
||||||
//layer.enabled: true
|
layer.enabled: smoothing
|
||||||
//layer.smooth: true
|
layer.smooth: smoothing
|
||||||
Image {
|
Image {
|
||||||
id: image
|
id: image
|
||||||
source: navAidImage
|
source: navAidImage
|
||||||
@ -206,8 +207,8 @@ Item {
|
|||||||
sourceItem: Grid {
|
sourceItem: Grid {
|
||||||
columns: 1
|
columns: 1
|
||||||
Grid {
|
Grid {
|
||||||
//layer.enabled: true
|
layer.enabled: smoothing
|
||||||
//layer.smooth: true
|
layer.smooth: smoothing
|
||||||
horizontalItemAlignment: Grid.AlignHCenter
|
horizontalItemAlignment: Grid.AlignHCenter
|
||||||
Text {
|
Text {
|
||||||
id: airspaceText
|
id: airspaceText
|
||||||
@ -239,8 +240,8 @@ Item {
|
|||||||
sourceItem: Grid {
|
sourceItem: Grid {
|
||||||
columns: 1
|
columns: 1
|
||||||
Grid {
|
Grid {
|
||||||
//layer.enabled: true
|
layer.enabled: smoothing
|
||||||
//layer.smooth: true
|
layer.smooth: smoothing
|
||||||
horizontalItemAlignment: Grid.AlignHCenter
|
horizontalItemAlignment: Grid.AlignHCenter
|
||||||
Image {
|
Image {
|
||||||
id: image
|
id: image
|
||||||
@ -334,8 +335,8 @@ Item {
|
|||||||
columns: 1
|
columns: 1
|
||||||
Grid {
|
Grid {
|
||||||
horizontalItemAlignment: Grid.AlignHCenter
|
horizontalItemAlignment: Grid.AlignHCenter
|
||||||
//layer.enabled: true
|
layer.enabled: smoothing
|
||||||
//layer.smooth: true
|
layer.smooth: smoothing
|
||||||
Image {
|
Image {
|
||||||
id: image
|
id: image
|
||||||
source: airportImage
|
source: airportImage
|
||||||
|
@ -10,6 +10,7 @@ Item {
|
|||||||
property string mapProvider: "osm"
|
property string mapProvider: "osm"
|
||||||
property variant mapPtr
|
property variant mapPtr
|
||||||
property variant guiPtr
|
property variant guiPtr
|
||||||
|
property bool smoothing
|
||||||
|
|
||||||
function createMap(pluginParameters, gui) {
|
function createMap(pluginParameters, gui) {
|
||||||
guiPtr = gui
|
guiPtr = gui
|
||||||
@ -187,8 +188,8 @@ Item {
|
|||||||
sourceItem: Grid {
|
sourceItem: Grid {
|
||||||
columns: 1
|
columns: 1
|
||||||
Grid {
|
Grid {
|
||||||
//layer.enabled: true
|
layer.enabled: smoothing
|
||||||
//layer.smooth: true
|
layer.smooth: smoothing
|
||||||
horizontalItemAlignment: Grid.AlignHCenter
|
horizontalItemAlignment: Grid.AlignHCenter
|
||||||
Text {
|
Text {
|
||||||
id: polygonText
|
id: polygonText
|
||||||
@ -219,8 +220,8 @@ Item {
|
|||||||
sourceItem: Grid {
|
sourceItem: Grid {
|
||||||
columns: 1
|
columns: 1
|
||||||
Grid {
|
Grid {
|
||||||
//layer.enabled: true
|
layer.enabled: smoothing
|
||||||
//layer.smooth: true
|
layer.smooth: smoothing
|
||||||
horizontalItemAlignment: Grid.AlignHCenter
|
horizontalItemAlignment: Grid.AlignHCenter
|
||||||
Text {
|
Text {
|
||||||
id: polylineText
|
id: polylineText
|
||||||
@ -247,9 +248,8 @@ Item {
|
|||||||
Grid {
|
Grid {
|
||||||
horizontalItemAlignment: Grid.AlignHCenter
|
horizontalItemAlignment: Grid.AlignHCenter
|
||||||
columnSpacing: 5
|
columnSpacing: 5
|
||||||
// This is very slow with lots of items, so we use MSAA for the whole map instead
|
layer.enabled: smoothing
|
||||||
//layer.enabled: true
|
layer.smooth: smoothing
|
||||||
//layer.smooth: true
|
|
||||||
Image {
|
Image {
|
||||||
id: image
|
id: image
|
||||||
rotation: mapImageRotation
|
rotation: mapImageRotation
|
||||||
|
@ -201,8 +201,9 @@ MapGUI::MapGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *featur
|
|||||||
rollupContents->arrangeRollups();
|
rollupContents->arrangeRollups();
|
||||||
connect(rollupContents, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
connect(rollupContents, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
||||||
|
|
||||||
// Enable MSAA antialiasing on 2D map, otherwise text is not clear
|
// Enable MSAA antialiasing on 2D map
|
||||||
// This is much faster than using layer.smooth in the QML, when there are many items
|
// This can be much faster than using layer.smooth in the QML, when there are many items
|
||||||
|
// However, only seems to work when set to 16, and doesn't seem to be supported on all graphics cards
|
||||||
int multisamples = MainCore::instance()->getSettings().getMapMultisampling();
|
int multisamples = MainCore::instance()->getSettings().getMapMultisampling();
|
||||||
if (multisamples > 0)
|
if (multisamples > 0)
|
||||||
{
|
{
|
||||||
@ -1041,6 +1042,7 @@ void MapGUI::applyMap2DSettings(bool reloadMap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the map using the specified provider
|
// Create the map using the specified provider
|
||||||
|
QQmlProperty::write(item, "smoothing", MainCore::instance()->getSettings().getMapSmoothing());
|
||||||
QQmlProperty::write(item, "mapProvider", m_settings.m_mapProvider);
|
QQmlProperty::write(item, "mapProvider", m_settings.m_mapProvider);
|
||||||
QVariantMap parameters;
|
QVariantMap parameters;
|
||||||
if (!m_settings.m_mapBoxAPIKey.isEmpty() && m_settings.m_mapProvider == "mapbox")
|
if (!m_settings.m_mapBoxAPIKey.isEmpty() && m_settings.m_mapProvider == "mapbox")
|
||||||
@ -1731,13 +1733,18 @@ void MapGUI::preferenceChanged(int elementType)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pref == Preferences::StationName)
|
else if (pref == Preferences::StationName)
|
||||||
{
|
{
|
||||||
// Update station name
|
// Update station name
|
||||||
m_antennaMapItem.setLabel(new QString(MainCore::instance()->getSettings().getStationName()));
|
m_antennaMapItem.setLabel(new QString(MainCore::instance()->getSettings().getStationName()));
|
||||||
m_antennaMapItem.setText(new QString(MainCore::instance()->getSettings().getStationName()));
|
m_antennaMapItem.setText(new QString(MainCore::instance()->getSettings().getStationName()));
|
||||||
update(m_map, &m_antennaMapItem, "Station");
|
update(m_map, &m_antennaMapItem, "Station");
|
||||||
}
|
}
|
||||||
|
else if (pref == Preferences::MapSmoothing)
|
||||||
|
{
|
||||||
|
QQuickItem *item = ui->map->rootObject();
|
||||||
|
QQmlProperty::write(item, "smoothing", MainCore::instance()->getSettings().getMapSmoothing());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapGUI::makeUIConnections()
|
void MapGUI::makeUIConnections()
|
||||||
|
@ -203,6 +203,13 @@ public:
|
|||||||
emit preferenceChanged(Preferences::MapMultisampling);
|
emit preferenceChanged(Preferences::MapMultisampling);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool getMapSmoothing() const { return m_preferences.getMapSmoothing(); }
|
||||||
|
void setMapSmoothing(bool smoothing)
|
||||||
|
{
|
||||||
|
m_preferences.setMapSmoothing(smoothing);
|
||||||
|
emit preferenceChanged(Preferences::MapSmoothing);
|
||||||
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void preferenceChanged(int);
|
void preferenceChanged(int);
|
||||||
|
|
||||||
|
@ -23,7 +23,8 @@ void Preferences::resetToDefaults()
|
|||||||
m_consoleMinLogLevel = QtDebugMsg;
|
m_consoleMinLogLevel = QtDebugMsg;
|
||||||
m_fileMinLogLevel = QtDebugMsg;
|
m_fileMinLogLevel = QtDebugMsg;
|
||||||
m_multisampling = 0;
|
m_multisampling = 0;
|
||||||
m_mapMultisampling = 16;
|
m_mapMultisampling = 0;
|
||||||
|
m_mapSmoothing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Preferences::serialize() const
|
QByteArray Preferences::serialize() const
|
||||||
@ -45,6 +46,7 @@ QByteArray Preferences::serialize() const
|
|||||||
s.writeS32((int) Multisampling, m_multisampling);
|
s.writeS32((int) Multisampling, m_multisampling);
|
||||||
s.writeBool((int) AutoUpdatePosition, m_autoUpdatePosition);
|
s.writeBool((int) AutoUpdatePosition, m_autoUpdatePosition);
|
||||||
s.writeS32((int) MapMultisampling, m_mapMultisampling);
|
s.writeS32((int) MapMultisampling, m_mapMultisampling);
|
||||||
|
s.writeBool((int) MapSmoothing, m_mapSmoothing);
|
||||||
return s.final();
|
return s.final();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,6 +103,7 @@ bool Preferences::deserialize(const QByteArray& data)
|
|||||||
d.readS32((int) Multisampling, &m_multisampling, 0);
|
d.readS32((int) Multisampling, &m_multisampling, 0);
|
||||||
d.readBool((int) AutoUpdatePosition, &m_autoUpdatePosition, true);
|
d.readBool((int) AutoUpdatePosition, &m_autoUpdatePosition, true);
|
||||||
d.readS32((int) MapMultisampling, &m_mapMultisampling, 16);
|
d.readS32((int) MapMultisampling, &m_mapMultisampling, 16);
|
||||||
|
d.readBool((int) MapSmoothing, &m_mapSmoothing, true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,8 @@ public:
|
|||||||
SourceItemIndex,
|
SourceItemIndex,
|
||||||
Multisampling,
|
Multisampling,
|
||||||
AutoUpdatePosition,
|
AutoUpdatePosition,
|
||||||
MapMultisampling
|
MapMultisampling,
|
||||||
|
MapSmoothing
|
||||||
};
|
};
|
||||||
|
|
||||||
Preferences();
|
Preferences();
|
||||||
@ -83,6 +84,9 @@ public:
|
|||||||
int getMapMultisampling() const { return m_mapMultisampling; }
|
int getMapMultisampling() const { return m_mapMultisampling; }
|
||||||
void setMapMultisampling(int samples) { m_mapMultisampling = samples; }
|
void setMapMultisampling(int samples) { m_mapMultisampling = samples; }
|
||||||
|
|
||||||
|
bool getMapSmoothing() const { return m_mapSmoothing; }
|
||||||
|
void setMapSmoothing(bool smoothing) { m_mapSmoothing = smoothing; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString m_sourceDevice; //!< Identification of the source used in R0 tab (GUI flavor) at startup
|
QString m_sourceDevice; //!< Identification of the source used in R0 tab (GUI flavor) at startup
|
||||||
int m_sourceIndex; //!< Index of the source used in R0 tab (GUI flavor) at startup
|
int m_sourceIndex; //!< Index of the source used in R0 tab (GUI flavor) at startup
|
||||||
@ -103,7 +107,8 @@ protected:
|
|||||||
QString m_logFileName;
|
QString m_logFileName;
|
||||||
|
|
||||||
int m_multisampling; //!< Number of samples to use for multisampling anti-aliasing for spectrums (typically 0 or 4)
|
int m_multisampling; //!< Number of samples to use for multisampling anti-aliasing for spectrums (typically 0 or 4)
|
||||||
int m_mapMultisampling; //!< Number of samples to use for multisampling anti-aliasing for 2D maps (16 gives best text)
|
int m_mapMultisampling; //!< Number of samples to use for multisampling anti-aliasing for 2D maps (16 gives best text, if not using mapSmoothing)
|
||||||
|
bool m_mapSmoothing; //!< Whether to use smoothing for text boxes on 2D maps
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_PREFERENCES_H
|
#endif // INCLUDE_PREFERENCES_H
|
||||||
|
@ -38,6 +38,7 @@ GraphicsDialog::GraphicsDialog(MainSettings& mainSettings, QWidget* parent) :
|
|||||||
} else {
|
} else {
|
||||||
ui->mapMultisampling->setCurrentText(QString::number(samples));
|
ui->mapMultisampling->setCurrentText(QString::number(samples));
|
||||||
}
|
}
|
||||||
|
ui->mapSmoothing->setChecked(m_mainSettings.getMapSmoothing());
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphicsDialog::~GraphicsDialog()
|
GraphicsDialog::~GraphicsDialog()
|
||||||
@ -49,5 +50,6 @@ void GraphicsDialog::accept()
|
|||||||
{
|
{
|
||||||
m_mainSettings.setMultisampling(ui->multisampling->currentText().toInt());
|
m_mainSettings.setMultisampling(ui->multisampling->currentText().toInt());
|
||||||
m_mainSettings.setMapMultisampling(ui->mapMultisampling->currentText().toInt());
|
m_mainSettings.setMapMultisampling(ui->mapMultisampling->currentText().toInt());
|
||||||
|
m_mainSettings.setMapSmoothing(ui->mapSmoothing->isChecked());
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>282</width>
|
<width>282</width>
|
||||||
<height>131</height>
|
<height>155</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
@ -95,6 +95,11 @@ Requires windows to be reopened to take effect</string>
|
|||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QComboBox" name="mapMultisampling">
|
<widget class="QComboBox" name="mapMultisampling">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Number of samples to use for mulitsampling anti-aliasing (MSAA) for 2D Map
|
||||||
|
|
||||||
|
Requires windows to be reopened to take effect</string>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Off</string>
|
<string>Off</string>
|
||||||
@ -122,6 +127,23 @@ Requires windows to be reopened to take effect</string>
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QCheckBox" name="mapSmoothing">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Whether smoothing should be enabled for text on 2D maps</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="mapSmoothingLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>2D Map Text Smoothing</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user