Skip to content

Commit 7b37614

Browse files
committed
#8725: use default drawing config
1 parent d2d8e4f commit 7b37614

File tree

4 files changed

+198
-1
lines changed

4 files changed

+198
-1
lines changed

src/app/qgsoptions.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,11 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
523523
chkAntiAliasing->setChecked( settings.value( "/qgis/enable_anti_aliasing", true ).toBool() );
524524
chkUseRenderCaching->setChecked( settings.value( "/qgis/enable_render_caching", false ).toBool() );
525525

526+
// Default simplify drawing configuration
527+
mSimplifyDrawingGroupBox->setChecked( settings.value( "/qgis/simplifyDrawingHints", (int)QgsVectorLayer::FullSimplification ).toInt() != QgsVectorLayer::NoSimplification );
528+
mSimplifyDrawingSlider->setValue( (int)(5.0f * (settings.value( "/qgis/simplifyDrawingTol", 1.0F ).toFloat()-1)) );
529+
mSimplifyDrawingPanel->setVisible( mSimplifyDrawingSlider->value()>0 );
530+
526531
// Slightly awkard here at the settings value is true to use QImage,
527532
// but the checkbox is true to use QPixmap
528533
chkUseQPixmap->setChecked( !( settings.value( "/qgis/use_qimage_to_render", true ).toBool() ) );
@@ -980,6 +985,10 @@ void QgsOptions::saveOptions()
980985
bool legendLayersCapitalise = settings.value( "/qgis/capitaliseLayerName", false ).toBool();
981986
settings.setValue( "/qgis/capitaliseLayerName", capitaliseCheckBox->isChecked() );
982987

988+
// Default simplify drawing configuration
989+
settings.setValue( "/qgis/simplifyDrawingHints", (int)(mSimplifyDrawingGroupBox->isChecked() ? QgsVectorLayer::FullSimplification : QgsVectorLayer::NoSimplification) );
990+
settings.setValue( "/qgis/simplifyDrawingTol", (float)(1.0f + 0.2f*mSimplifyDrawingSlider->value()) );
991+
983992
// project
984993
settings.setValue( "/qgis/projOpenAtLaunch", mProjectOnLaunchCmbBx->currentIndex() );
985994
settings.setValue( "/qgis/projOpenAtLaunchPath", mProjectOnLaunchLineEdit->text() );
@@ -1850,3 +1859,7 @@ void QgsOptions::saveContrastEnhancement( QComboBox *cbox, QString name )
18501859
settings.setValue( "/Raster/defaultContrastEnhancementAlgorithm/" + name, value );
18511860
}
18521861

1862+
void QgsOptions::on_mSimplifyDrawingSlider_valueChanged( int value )
1863+
{
1864+
mSimplifyDrawingPanel->setVisible( value>0 );
1865+
}

src/app/qgsoptions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ class APP_EXPORT QgsOptions : public QgsOptionsDialogBase, private Ui::QgsOption
227227
*/
228228
void saveGdalDriverList();
229229

230+
void on_mSimplifyDrawingSlider_valueChanged( int value );
231+
230232
private:
231233
QStringList i18nList();
232234
void initContrastEnhancement( QComboBox *cbox, QString name, QString defaultVal );

src/core/qgsvectorlayer.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@ QgsVectorLayer::QgsVectorLayer( QString vectorLayerPath,
181181
connect( this, SIGNAL( selectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ), this, SIGNAL( selectionChanged() ) );
182182

183183
connect( QgsProject::instance()->relationManager(), SIGNAL( relationsLoaded() ), this, SLOT( onRelationsLoaded() ) );
184+
185+
// Default simplify drawing configuration
186+
QSettings settings;
187+
setSimplifyDrawingHints( settings.value( "/qgis/simplifyDrawingHints", (int)mSimplifyDrawingHints ).toInt() );
188+
setSimplifyDrawingTol( settings.value( "/qgis/simplifyDrawingTol", mSimplifyDrawingTol ).toFloat() );
189+
184190
} // QgsVectorLayer ctor
185191

186192

src/ui/qgsoptionsbase.ui

Lines changed: 177 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1649,6 +1649,182 @@
16491649
</property>
16501650
</widget>
16511651
</item>
1652+
<item row="5" column="0">
1653+
<widget class="QGroupBox" name="mSimplifyDrawingGroupBox">
1654+
<property name="title">
1655+
<string>By default simplify geometries</string>
1656+
</property>
1657+
<property name="checkable">
1658+
<bool>true</bool>
1659+
</property>
1660+
<layout class="QGridLayout" name="_14">
1661+
<item row="0" column="2" colspan="3">
1662+
<widget class="QLabel" name="label_59">
1663+
<property name="sizePolicy">
1664+
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
1665+
<horstretch>0</horstretch>
1666+
<verstretch>0</verstretch>
1667+
</sizepolicy>
1668+
</property>
1669+
<property name="text">
1670+
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
1671+
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
1672+
p, li { white-space: pre-wrap; }
1673+
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
1674+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;By default new vector layers added to the map should simplify geometries to improve rendering speed. The simplification applies only during rendering of the layer and does not modify the layer geometry.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
1675+
</property>
1676+
<property name="wordWrap">
1677+
<bool>true</bool>
1678+
</property>
1679+
<property name="margin">
1680+
<number>2</number>
1681+
</property>
1682+
</widget>
1683+
</item>
1684+
<item row="5" column="2">
1685+
<widget class="QLabel" name="label_56">
1686+
<property name="text">
1687+
<string>Simplification factor (higher values result in more simplification): </string>
1688+
</property>
1689+
<property name="margin">
1690+
<number>2</number>
1691+
</property>
1692+
</widget>
1693+
</item>
1694+
<item row="5" column="3">
1695+
<widget class="QSlider" name="mSimplifyDrawingSlider">
1696+
<property name="maximumSize">
1697+
<size>
1698+
<width>130</width>
1699+
<height>16777215</height>
1700+
</size>
1701+
</property>
1702+
<property name="toolTip">
1703+
<string>Higher values result in more simplification</string>
1704+
</property>
1705+
<property name="minimum">
1706+
<number>0</number>
1707+
</property>
1708+
<property name="maximum">
1709+
<number>20</number>
1710+
</property>
1711+
<property name="value">
1712+
<number>0</number>
1713+
</property>
1714+
<property name="tracking">
1715+
<bool>true</bool>
1716+
</property>
1717+
<property name="orientation">
1718+
<enum>Qt::Horizontal</enum>
1719+
</property>
1720+
<property name="invertedAppearance">
1721+
<bool>false</bool>
1722+
</property>
1723+
<property name="invertedControls">
1724+
<bool>false</bool>
1725+
</property>
1726+
</widget>
1727+
</item>
1728+
<item row="8" column="2" colspan="2">
1729+
<widget class="QFrame" name="mSimplifyDrawingPanel">
1730+
<property name="minimumSize">
1731+
<size>
1732+
<width>0</width>
1733+
<height>70</height>
1734+
</size>
1735+
</property>
1736+
<property name="maximumSize">
1737+
<size>
1738+
<width>16777215</width>
1739+
<height>16777215</height>
1740+
</size>
1741+
</property>
1742+
<property name="frameShape">
1743+
<enum>QFrame::Box</enum>
1744+
</property>
1745+
<property name="frameShadow">
1746+
<enum>QFrame::Raised</enum>
1747+
</property>
1748+
<widget class="QLabel" name="mSimplifyDrawingIcon">
1749+
<property name="geometry">
1750+
<rect>
1751+
<x>10</x>
1752+
<y>0</y>
1753+
<width>60</width>
1754+
<height>67</height>
1755+
</rect>
1756+
</property>
1757+
<property name="sizePolicy">
1758+
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
1759+
<horstretch>0</horstretch>
1760+
<verstretch>0</verstretch>
1761+
</sizepolicy>
1762+
</property>
1763+
<property name="minimumSize">
1764+
<size>
1765+
<width>60</width>
1766+
<height>67</height>
1767+
</size>
1768+
</property>
1769+
<property name="maximumSize">
1770+
<size>
1771+
<width>40</width>
1772+
<height>40</height>
1773+
</size>
1774+
</property>
1775+
<property name="layoutDirection">
1776+
<enum>Qt::LeftToRight</enum>
1777+
</property>
1778+
<property name="autoFillBackground">
1779+
<bool>false</bool>
1780+
</property>
1781+
<property name="text">
1782+
<string/>
1783+
</property>
1784+
<property name="pixmap">
1785+
<pixmap resource="../../images/images.qrc">:/images/themes/default/mIconWarn.png</pixmap>
1786+
</property>
1787+
<property name="scaledContents">
1788+
<bool>false</bool>
1789+
</property>
1790+
</widget>
1791+
<widget class="QLabel" name="mSimplifyDrawingLabel">
1792+
<property name="geometry">
1793+
<rect>
1794+
<x>45</x>
1795+
<y>8</y>
1796+
<width>411</width>
1797+
<height>51</height>
1798+
</rect>
1799+
</property>
1800+
<property name="text">
1801+
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
1802+
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
1803+
p, li { white-space: pre-wrap; }
1804+
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
1805+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot; font-size:8pt; font-weight:600;&quot;&gt;Warning:&lt;/span&gt;&lt;/p&gt;
1806+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; Increasing this factor will further speed up rendering, but may result in gaps &lt;/span&gt;&lt;/p&gt;
1807+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; or topological errors in the layer display.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
1808+
</property>
1809+
</widget>
1810+
</widget>
1811+
</item>
1812+
<item row="5" column="4">
1813+
<spacer name="horizontalSpacer_40">
1814+
<property name="orientation">
1815+
<enum>Qt::Horizontal</enum>
1816+
</property>
1817+
<property name="sizeHint" stdset="0">
1818+
<size>
1819+
<width>20</width>
1820+
<height>20</height>
1821+
</size>
1822+
</property>
1823+
</spacer>
1824+
</item>
1825+
</layout>
1826+
</widget>
1827+
</item>
16521828
</layout>
16531829
</widget>
16541830
</item>
@@ -3858,7 +4034,7 @@
38584034
</layout>
38594035
</item>
38604036
<item>
3861-
<layout class="QHBoxLayout" name="horizontalLayout_34">
4037+
<layout class="QHBoxLayout" name="horizontalLayout_35">
38624038
<item>
38634039
<widget class="QLabel" name="lblUserAgent">
38644040
<property name="text">

0 commit comments

Comments
 (0)