mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-02-03 09:44:01 -05: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
|
||||
QQmlProperty::write(item, "smoothing", MainCore::instance()->getSettings().getMapSmoothing());
|
||||
QQmlProperty::write(item, "mapProvider", m_settings.m_mapProvider);
|
||||
QVariantMap parameters;
|
||||
QString mapType;
|
||||
@ -4619,7 +4620,8 @@ ADSBDemodGUI::ADSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb
|
||||
connect(rollupContents, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
||||
|
||||
// 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();
|
||||
if (multisamples > 0)
|
||||
{
|
||||
@ -4628,7 +4630,7 @@ ADSBDemodGUI::ADSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb
|
||||
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);
|
||||
|
||||
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
|
||||
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()
|
||||
|
@ -14,6 +14,7 @@ Item {
|
||||
property string requestedMapType
|
||||
property bool lightIcons
|
||||
property variant guiPtr
|
||||
property bool smoothing
|
||||
|
||||
function createMap(pluginParameters, requestedMap, gui) {
|
||||
requestedMapType = requestedMap
|
||||
@ -140,8 +141,8 @@ Item {
|
||||
Grid {
|
||||
horizontalItemAlignment: Grid.AlignHCenter
|
||||
columnSpacing: 5
|
||||
//layer.enabled: true
|
||||
//layer.smooth: true
|
||||
layer.enabled: smoothing
|
||||
layer.smooth: smoothing
|
||||
Image {
|
||||
id: image
|
||||
source: navAidImage
|
||||
@ -206,8 +207,8 @@ Item {
|
||||
sourceItem: Grid {
|
||||
columns: 1
|
||||
Grid {
|
||||
//layer.enabled: true
|
||||
//layer.smooth: true
|
||||
layer.enabled: smoothing
|
||||
layer.smooth: smoothing
|
||||
horizontalItemAlignment: Grid.AlignHCenter
|
||||
Text {
|
||||
id: airspaceText
|
||||
@ -239,8 +240,8 @@ Item {
|
||||
sourceItem: Grid {
|
||||
columns: 1
|
||||
Grid {
|
||||
//layer.enabled: true
|
||||
//layer.smooth: true
|
||||
layer.enabled: smoothing
|
||||
layer.smooth: smoothing
|
||||
horizontalItemAlignment: Grid.AlignHCenter
|
||||
Image {
|
||||
id: image
|
||||
@ -334,8 +335,8 @@ Item {
|
||||
columns: 1
|
||||
Grid {
|
||||
horizontalItemAlignment: Grid.AlignHCenter
|
||||
//layer.enabled: true
|
||||
//layer.smooth: true
|
||||
layer.enabled: smoothing
|
||||
layer.smooth: smoothing
|
||||
Image {
|
||||
id: image
|
||||
source: airportImage
|
||||
|
@ -10,6 +10,7 @@ Item {
|
||||
property string mapProvider: "osm"
|
||||
property variant mapPtr
|
||||
property variant guiPtr
|
||||
property bool smoothing
|
||||
|
||||
function createMap(pluginParameters, gui) {
|
||||
guiPtr = gui
|
||||
@ -187,8 +188,8 @@ Item {
|
||||
sourceItem: Grid {
|
||||
columns: 1
|
||||
Grid {
|
||||
//layer.enabled: true
|
||||
//layer.smooth: true
|
||||
layer.enabled: smoothing
|
||||
layer.smooth: smoothing
|
||||
horizontalItemAlignment: Grid.AlignHCenter
|
||||
Text {
|
||||
id: polygonText
|
||||
@ -219,8 +220,8 @@ Item {
|
||||
sourceItem: Grid {
|
||||
columns: 1
|
||||
Grid {
|
||||
//layer.enabled: true
|
||||
//layer.smooth: true
|
||||
layer.enabled: smoothing
|
||||
layer.smooth: smoothing
|
||||
horizontalItemAlignment: Grid.AlignHCenter
|
||||
Text {
|
||||
id: polylineText
|
||||
@ -247,9 +248,8 @@ Item {
|
||||
Grid {
|
||||
horizontalItemAlignment: Grid.AlignHCenter
|
||||
columnSpacing: 5
|
||||
// This is very slow with lots of items, so we use MSAA for the whole map instead
|
||||
//layer.enabled: true
|
||||
//layer.smooth: true
|
||||
layer.enabled: smoothing
|
||||
layer.smooth: smoothing
|
||||
Image {
|
||||
id: image
|
||||
rotation: mapImageRotation
|
||||
|
@ -201,8 +201,9 @@ MapGUI::MapGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *featur
|
||||
rollupContents->arrangeRollups();
|
||||
connect(rollupContents, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
||||
|
||||
// Enable MSAA antialiasing on 2D map, otherwise text is not clear
|
||||
// This is much faster than using layer.smooth in the QML, when there are many items
|
||||
// Enable MSAA antialiasing on 2D map
|
||||
// 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();
|
||||
if (multisamples > 0)
|
||||
{
|
||||
@ -1041,6 +1042,7 @@ void MapGUI::applyMap2DSettings(bool reloadMap)
|
||||
}
|
||||
|
||||
// Create the map using the specified provider
|
||||
QQmlProperty::write(item, "smoothing", MainCore::instance()->getSettings().getMapSmoothing());
|
||||
QQmlProperty::write(item, "mapProvider", m_settings.m_mapProvider);
|
||||
QVariantMap parameters;
|
||||
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
|
||||
m_antennaMapItem.setLabel(new QString(MainCore::instance()->getSettings().getStationName()));
|
||||
m_antennaMapItem.setText(new QString(MainCore::instance()->getSettings().getStationName()));
|
||||
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()
|
||||
|
@ -203,6 +203,13 @@ public:
|
||||
emit preferenceChanged(Preferences::MapMultisampling);
|
||||
}
|
||||
|
||||
bool getMapSmoothing() const { return m_preferences.getMapSmoothing(); }
|
||||
void setMapSmoothing(bool smoothing)
|
||||
{
|
||||
m_preferences.setMapSmoothing(smoothing);
|
||||
emit preferenceChanged(Preferences::MapSmoothing);
|
||||
}
|
||||
|
||||
signals:
|
||||
void preferenceChanged(int);
|
||||
|
||||
|
@ -23,7 +23,8 @@ void Preferences::resetToDefaults()
|
||||
m_consoleMinLogLevel = QtDebugMsg;
|
||||
m_fileMinLogLevel = QtDebugMsg;
|
||||
m_multisampling = 0;
|
||||
m_mapMultisampling = 16;
|
||||
m_mapMultisampling = 0;
|
||||
m_mapSmoothing = true;
|
||||
}
|
||||
|
||||
QByteArray Preferences::serialize() const
|
||||
@ -45,6 +46,7 @@ QByteArray Preferences::serialize() const
|
||||
s.writeS32((int) Multisampling, m_multisampling);
|
||||
s.writeBool((int) AutoUpdatePosition, m_autoUpdatePosition);
|
||||
s.writeS32((int) MapMultisampling, m_mapMultisampling);
|
||||
s.writeBool((int) MapSmoothing, m_mapSmoothing);
|
||||
return s.final();
|
||||
}
|
||||
|
||||
@ -101,6 +103,7 @@ bool Preferences::deserialize(const QByteArray& data)
|
||||
d.readS32((int) Multisampling, &m_multisampling, 0);
|
||||
d.readBool((int) AutoUpdatePosition, &m_autoUpdatePosition, true);
|
||||
d.readS32((int) MapMultisampling, &m_mapMultisampling, 16);
|
||||
d.readBool((int) MapSmoothing, &m_mapSmoothing, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -24,7 +24,8 @@ public:
|
||||
SourceItemIndex,
|
||||
Multisampling,
|
||||
AutoUpdatePosition,
|
||||
MapMultisampling
|
||||
MapMultisampling,
|
||||
MapSmoothing
|
||||
};
|
||||
|
||||
Preferences();
|
||||
@ -83,6 +84,9 @@ public:
|
||||
int getMapMultisampling() const { return m_mapMultisampling; }
|
||||
void setMapMultisampling(int samples) { m_mapMultisampling = samples; }
|
||||
|
||||
bool getMapSmoothing() const { return m_mapSmoothing; }
|
||||
void setMapSmoothing(bool smoothing) { m_mapSmoothing = smoothing; }
|
||||
|
||||
protected:
|
||||
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
|
||||
@ -103,7 +107,8 @@ protected:
|
||||
QString m_logFileName;
|
||||
|
||||
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
|
||||
|
@ -38,6 +38,7 @@ GraphicsDialog::GraphicsDialog(MainSettings& mainSettings, QWidget* parent) :
|
||||
} else {
|
||||
ui->mapMultisampling->setCurrentText(QString::number(samples));
|
||||
}
|
||||
ui->mapSmoothing->setChecked(m_mainSettings.getMapSmoothing());
|
||||
}
|
||||
|
||||
GraphicsDialog::~GraphicsDialog()
|
||||
@ -49,5 +50,6 @@ void GraphicsDialog::accept()
|
||||
{
|
||||
m_mainSettings.setMultisampling(ui->multisampling->currentText().toInt());
|
||||
m_mainSettings.setMapMultisampling(ui->mapMultisampling->currentText().toInt());
|
||||
m_mainSettings.setMapSmoothing(ui->mapSmoothing->isChecked());
|
||||
QDialog::accept();
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>282</width>
|
||||
<height>131</height>
|
||||
<height>155</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
@ -95,6 +95,11 @@ Requires windows to be reopened to take effect</string>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<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>
|
||||
<property name="text">
|
||||
<string>Off</string>
|
||||
@ -122,6 +127,23 @@ Requires windows to be reopened to take effect</string>
|
||||
</item>
|
||||
</widget>
|
||||
</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>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
Reference in New Issue
Block a user