Skip to content

Commit 9164ae9

Browse files
committed
Options: remove legacy rendering options, add parallel rendering
1 parent e4a1651 commit 9164ae9

File tree

8 files changed

+65
-133
lines changed

8 files changed

+65
-133
lines changed

python/gui/qgsmapcanvas.sip

+16
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,22 @@ class QgsMapCanvas : QGraphicsView
7171
//! @note added in 2.1
7272
const QgsLabelingResults* labelingResults() const;
7373

74+
//! Set whether to cache images of rendered layers
75+
//! @note added in 2.1
76+
void setCachingEnabled( bool enabled );
77+
78+
//! Check whether images of rendered layers are curerently being cached
79+
//! @note added in 2.1
80+
bool isCachingEnabled() const;
81+
82+
//! Set whether the layers are rendered in parallel or sequentially
83+
//! @note added in 2.1
84+
void setParallelRenderingEnabled( bool enabled );
85+
86+
//! Check whether the layers are rendered in parallel or sequentially
87+
//! @note added in 2.1
88+
bool isParallelRenderingEnabled() const;
89+
7490
//! @deprecated since 2.1 - there could be more than just one "map" items
7591
QgsMapCanvasMap* map();
7692

src/app/qgisapp.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -2071,6 +2071,8 @@ void QgisApp::createOverview()
20712071
mMapCanvas->setWheelAction(( QgsMapCanvas::WheelAction ) action, zoomFactor );
20722072

20732073
mMapCanvas->setCachingEnabled( mySettings.value( "/qgis/enable_render_caching", false ).toBool() );
2074+
2075+
mMapCanvas->setParallelRenderingEnabled( mySettings.value( "/qgis/parallel_rendering", false).toBool() );
20742076
}
20752077

20762078
void QgisApp::addDockWidget( Qt::DockWidgetArea theArea, QDockWidget * thepDockWidget )
@@ -6601,6 +6603,8 @@ void QgisApp::options()
66016603

66026604
mMapCanvas->setCachingEnabled( mySettings.value( "/qgis/enable_render_caching", false ).toBool() );
66036605

6606+
mMapCanvas->setParallelRenderingEnabled( mySettings.value( "/qgis/parallel_rendering", false).toBool() );
6607+
66046608
//do we need this? TS
66056609
mMapCanvas->refresh();
66066610

src/app/qgsoptions.cpp

+2-48
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,6 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
9393
connect( cmbIconSize, SIGNAL( highlighted( const QString& ) ), this, SLOT( iconSizeChanged( const QString& ) ) );
9494
connect( cmbIconSize, SIGNAL( textChanged( const QString& ) ), this, SLOT( iconSizeChanged( const QString& ) ) );
9595

96-
#ifdef Q_WS_X11
97-
connect( chkEnableBackbuffer, SIGNAL( stateChanged( int ) ), this, SLOT( toggleEnableBackbuffer( int ) ) );
98-
#endif
99-
10096
connect( this, SIGNAL( accepted() ), this, SLOT( saveOptions() ) );
10197
connect( this, SIGNAL( rejected() ), this, SLOT( rejectOptions() ) );
10298

@@ -349,26 +345,6 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
349345
if ( index == -1 ) index = 1;
350346
cmbScanZipInBrowser->setCurrentIndex( index );
351347

352-
// Set the enable backbuffer state for X11 (linux) systems only
353-
// TODO: remove this when threading is implemented
354-
#ifdef Q_WS_X11
355-
chkEnableBackbuffer->setChecked( settings.value( "/Map/enableBackbuffer", 1 ).toBool() );
356-
toggleEnableBackbuffer( chkEnableBackbuffer->checkState() );
357-
#elif defined(Q_WS_MAC)
358-
chkEnableBackbuffer->setChecked( true );
359-
chkEnableBackbuffer->setEnabled( false );
360-
labelUpdateThreshold->setEnabled( false );
361-
spinBoxUpdateThreshold->setEnabled( false );
362-
#else // Q_WS_WIN32
363-
chkEnableBackbuffer->setChecked( true );
364-
chkEnableBackbuffer->setEnabled( false );
365-
#endif
366-
367-
// set the display update threshold
368-
spinBoxUpdateThreshold->setSpecialValueText( tr( "All" ) );
369-
spinBoxUpdateThreshold->setMinimum( 999 );
370-
spinBoxUpdateThreshold->setValue( qMax( 999, settings.value( "/Map/updateThreshold" ).toInt() ) );
371-
372348
// log rendering events, for userspace debugging
373349
mLogCanvasRefreshChkBx->setChecked( settings.value( "/Map/logCanvasRefreshEvent", false ).toBool() );
374350

@@ -522,10 +498,10 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
522498
//Changed to default to true as of QGIS 1.7
523499
chkAntiAliasing->setChecked( settings.value( "/qgis/enable_anti_aliasing", true ).toBool() );
524500
chkUseRenderCaching->setChecked( settings.value( "/qgis/enable_render_caching", false ).toBool() );
501+
chkParallelRendering->setChecked( settings.value( "/qgis/parallel_rendering", false ).toBool() );
525502

526503
// Slightly awkard here at the settings value is true to use QImage,
527504
// but the checkbox is true to use QPixmap
528-
chkUseQPixmap->setChecked( !( settings.value( "/qgis/use_qimage_to_render", true ).toBool() ) );
529505
chkAddedVisibility->setChecked( settings.value( "/qgis/new_layers_visible", true ).toBool() );
530506
cbxLegendClassifiers->setChecked( settings.value( "/qgis/showLegendClassifiers", false ).toBool() );
531507
mLegendLayersBoldChkBx->setChecked( settings.value( "/qgis/legendLayersBold", true ).toBool() );
@@ -835,24 +811,6 @@ void QgsOptions::on_mProjectOnLaunchPushBtn_pressed()
835811
}
836812
}
837813

838-
void QgsOptions::toggleEnableBackbuffer( int state )
839-
{
840-
#ifdef Q_WS_X11
841-
if ( Qt::Checked == state )
842-
{
843-
labelUpdateThreshold->setEnabled( false );
844-
spinBoxUpdateThreshold->setEnabled( false );
845-
}
846-
else
847-
{
848-
labelUpdateThreshold->setEnabled( true );
849-
spinBoxUpdateThreshold->setEnabled( true );
850-
}
851-
#else
852-
Q_UNUSED( state );
853-
#endif
854-
}
855-
856814
QString QgsOptions::theme()
857815
{
858816
// returns the current theme (as selected in the cmbTheme combo box)
@@ -975,7 +933,7 @@ void QgsOptions::saveOptions()
975933
settings.setValue( "/qgis/new_layers_visible", chkAddedVisibility->isChecked() );
976934
settings.setValue( "/qgis/enable_anti_aliasing", chkAntiAliasing->isChecked() );
977935
settings.setValue( "/qgis/enable_render_caching", chkUseRenderCaching->isChecked() );
978-
settings.setValue( "/qgis/use_qimage_to_render", !( chkUseQPixmap->isChecked() ) );
936+
settings.setValue( "/qgis/parallel_rendering", chkParallelRendering->isChecked() );
979937
settings.setValue( "/qgis/legendDoubleClickAction", cmbLegendDoubleClickAction->currentIndex() );
980938
bool legendLayersCapitalise = settings.value( "/qgis/capitaliseLayerName", false ).toBool();
981939
settings.setValue( "/qgis/capitaliseLayerName", capitaliseCheckBox->isChecked() );
@@ -1030,10 +988,6 @@ void QgsOptions::saveOptions()
1030988
settings.setValue( "/Raster/cumulativeCutLower", mRasterCumulativeCutLowerDoubleSpinBox->value() / 100.0 );
1031989
settings.setValue( "/Raster/cumulativeCutUpper", mRasterCumulativeCutUpperDoubleSpinBox->value() / 100.0 );
1032990

1033-
settings.setValue( "/Map/enableBackbuffer", chkEnableBackbuffer->isChecked() );
1034-
int threshold = spinBoxUpdateThreshold->value();
1035-
settings.setValue( "/Map/updateThreshold", threshold < 1000 ? 0 : threshold );
1036-
1037991
// log rendering events, for userspace debugging
1038992
settings.setValue( "/Map/logCanvasRefreshEvent", mLogCanvasRefreshChkBx->isChecked() );
1039993

src/app/qgsoptions.h

-4
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ class APP_EXPORT QgsOptions : public QgsOptionsDialogBase, private Ui::QgsOption
8888
*/
8989
void on_mProjectOnLaunchPushBtn_pressed();
9090

91-
//! Slot to change backbuffering. This is handled when the user changes
92-
// the value of the checkbox
93-
void toggleEnableBackbuffer( int );
94-
9591
/**
9692
* Return the desired state of newly added layers. If a layer
9793
* is to be drawn when added to the map, this function returns

src/core/qgsvectorlayer.cpp

-9
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,6 @@ QgsVectorLayer::QgsVectorLayer( QString vectorLayerPath,
164164
}
165165

166166
connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ), this, SLOT( checkJoinLayerRemove( QString ) ) );
167-
168-
// Get the update threshold from user settings. We
169-
// do this only on construction to avoid the penality of
170-
// fetching this each time the layer is drawn. If the user
171-
// changes the threshold from the preferences dialog, it will
172-
// have no effect on existing layers
173-
// TODO: load this setting somewhere else [MD]
174-
//QSettings settings;
175-
//mUpdateThreshold = settings.readNumEntry("Map/updateThreshold", 1000);
176167
}
177168

178169
connect( this, SIGNAL( selectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ), this, SIGNAL( selectionChanged() ) );

src/gui/qgsmapcanvas.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,16 @@ bool QgsMapCanvas::isCachingEnabled() const
509509
return mCache != 0;
510510
}
511511

512+
void QgsMapCanvas::setParallelRenderingEnabled( bool enabled )
513+
{
514+
mUseParallelRendering = enabled;
515+
}
516+
517+
bool QgsMapCanvas::isParallelRenderingEnabled() const
518+
{
519+
return mUseParallelRendering;
520+
}
521+
512522

513523
void QgsMapCanvas::updateOverview()
514524
{

src/gui/qgsmapcanvas.h

+8
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
150150
//! @note added in 2.1
151151
bool isCachingEnabled() const;
152152

153+
//! Set whether the layers are rendered in parallel or sequentially
154+
//! @note added in 2.1
155+
void setParallelRenderingEnabled( bool enabled );
156+
157+
//! Check whether the layers are rendered in parallel or sequentially
158+
//! @note added in 2.1
159+
bool isParallelRenderingEnabled() const;
160+
153161
//! @deprecated since 2.1 - there could be more than just one "map" items
154162
QgsMapCanvasMap* map();
155163

src/ui/qgsoptionsbase.ui

+25-72
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@
266266
<rect>
267267
<x>0</x>
268268
<y>0</y>
269-
<width>687</width>
270-
<height>523</height>
269+
<width>670</width>
270+
<height>606</height>
271271
</rect>
272272
</property>
273273
<layout class="QVBoxLayout" name="verticalLayout_28">
@@ -912,8 +912,8 @@
912912
<rect>
913913
<x>0</x>
914914
<y>0</y>
915-
<width>670</width>
916-
<height>750</height>
915+
<width>674</width>
916+
<height>799</height>
917917
</rect>
918918
</property>
919919
<layout class="QVBoxLayout" name="verticalLayout_22">
@@ -1249,7 +1249,7 @@
12491249
<x>0</x>
12501250
<y>0</y>
12511251
<width>687</width>
1252-
<height>523</height>
1252+
<height>511</height>
12531253
</rect>
12541254
</property>
12551255
<layout class="QVBoxLayout" name="verticalLayout_27">
@@ -1577,8 +1577,8 @@
15771577
<rect>
15781578
<x>0</x>
15791579
<y>0</y>
1580-
<width>572</width>
1581-
<height>611</height>
1580+
<width>670</width>
1581+
<height>631</height>
15821582
</rect>
15831583
</property>
15841584
<layout class="QVBoxLayout" name="verticalLayout_29">
@@ -1588,64 +1588,24 @@
15881588
<string>Rendering behavior</string>
15891589
</property>
15901590
<layout class="QGridLayout" name="_4">
1591-
<item row="1" column="0">
1592-
<widget class="QCheckBox" name="chkEnableBackbuffer">
1593-
<property name="toolTip">
1594-
<string>Better graphics performance at the cost of loosing the possibility to cancel rendering and incremental feature drawing</string>
1595-
</property>
1596-
<property name="text">
1597-
<string>Enable back buffer</string>
1598-
</property>
1599-
</widget>
1600-
</item>
16011591
<item row="0" column="0">
16021592
<widget class="QCheckBox" name="chkAddedVisibility">
16031593
<property name="text">
16041594
<string>By default new la&amp;yers added to the map should be displayed</string>
16051595
</property>
16061596
</widget>
16071597
</item>
1608-
<item row="4" column="0" colspan="2">
1598+
<item row="1" column="0" colspan="2">
16091599
<widget class="QCheckBox" name="chkUseRenderCaching">
16101600
<property name="text">
16111601
<string>Use render caching where possible to speed up redraws</string>
16121602
</property>
16131603
</widget>
16141604
</item>
1615-
<item row="2" column="0">
1616-
<layout class="QHBoxLayout" name="horizontalLayout_26">
1617-
<item>
1618-
<widget class="QLabel" name="labelUpdateThreshold">
1619-
<property name="text">
1620-
<string>Number of features to draw before updating the display</string>
1621-
</property>
1622-
</widget>
1623-
</item>
1624-
<item>
1625-
<widget class="QSpinBox" name="spinBoxUpdateThreshold">
1626-
<property name="maximumSize">
1627-
<size>
1628-
<width>200</width>
1629-
<height>16777215</height>
1630-
</size>
1631-
</property>
1632-
<property name="toolTip">
1633-
<string>Map display will be updated (drawn) after this many features have been read from the data source</string>
1634-
</property>
1635-
<property name="maximum">
1636-
<number>1000000</number>
1637-
</property>
1638-
<property name="value">
1639-
<number>1000</number>
1640-
</property>
1641-
</widget>
1642-
</item>
1643-
</layout>
1644-
</item>
1645-
<item row="3" column="0" colspan="2">
1646-
<widget class="QLabel" name="textLabel3">
1605+
<item row="2" column="0" colspan="2">
1606+
<widget class="QCheckBox" name="chkParallelRendering">
16471607
<property name="text">
1648-
<string>&lt;b&gt;Note:&lt;/b&gt; Set below 1000 to prevent display updates until all features have been rendered</string>
1608+
<string>Render layers in parallel using all available CPU cores</string>
16491609
</property>
16501610
</widget>
16511611
</item>
@@ -1668,13 +1628,6 @@
16681628
</property>
16691629
</widget>
16701630
</item>
1671-
<item>
1672-
<widget class="QCheckBox" name="chkUseQPixmap">
1673-
<property name="text">
1674-
<string>Fix problems with incorrectly filled polygons</string>
1675-
</property>
1676-
</widget>
1677-
</item>
16781631
</layout>
16791632
</widget>
16801633
</item>
@@ -2092,8 +2045,8 @@
20922045
<rect>
20932046
<x>0</x>
20942047
<y>0</y>
2095-
<width>441</width>
2096-
<height>281</height>
2048+
<width>495</width>
2049+
<height>351</height>
20972050
</rect>
20982051
</property>
20992052
<layout class="QVBoxLayout" name="verticalLayout_25">
@@ -2438,8 +2391,8 @@
24382391
<rect>
24392392
<x>0</x>
24402393
<y>0</y>
2441-
<width>494</width>
2442-
<height>619</height>
2394+
<width>599</width>
2395+
<height>696</height>
24432396
</rect>
24442397
</property>
24452398
<layout class="QVBoxLayout" name="verticalLayout_30">
@@ -2852,8 +2805,8 @@
28522805
<rect>
28532806
<x>0</x>
28542807
<y>0</y>
2855-
<width>670</width>
2856-
<height>551</height>
2808+
<width>544</width>
2809+
<height>656</height>
28572810
</rect>
28582811
</property>
28592812
<layout class="QVBoxLayout" name="verticalLayout_31">
@@ -3353,8 +3306,8 @@
33533306
<rect>
33543307
<x>0</x>
33553308
<y>0</y>
3356-
<width>687</width>
3357-
<height>523</height>
3309+
<width>513</width>
3310+
<height>385</height>
33583311
</rect>
33593312
</property>
33603313
<layout class="QVBoxLayout" name="verticalLayout_6">
@@ -3493,8 +3446,8 @@
34933446
<rect>
34943447
<x>0</x>
34953448
<y>0</y>
3496-
<width>687</width>
3497-
<height>523</height>
3449+
<width>707</width>
3450+
<height>402</height>
34983451
</rect>
34993452
</property>
35003453
<layout class="QGridLayout" name="gridLayout_15">
@@ -3678,8 +3631,8 @@
36783631
<rect>
36793632
<x>0</x>
36803633
<y>0</y>
3681-
<width>265</width>
3682-
<height>197</height>
3634+
<width>327</width>
3635+
<height>239</height>
36833636
</rect>
36843637
</property>
36853638
<layout class="QVBoxLayout" name="verticalLayout_32">
@@ -3778,8 +3731,8 @@
37783731
<rect>
37793732
<x>0</x>
37803733
<y>0</y>
3781-
<width>469</width>
3782-
<height>556</height>
3734+
<width>582</width>
3735+
<height>703</height>
37833736
</rect>
37843737
</property>
37853738
<layout class="QVBoxLayout" name="verticalLayout_33">

0 commit comments

Comments
 (0)