Skip to content
Permalink
Browse files

Options: remove legacy rendering options, add parallel rendering

  • Loading branch information
wonder-sk committed Dec 9, 2013
1 parent e4a1651 commit 9164ae9412d7df5b05e97432e4b96f7378cfecd3
@@ -71,6 +71,22 @@ class QgsMapCanvas : QGraphicsView
//! @note added in 2.1
const QgsLabelingResults* labelingResults() const;

//! Set whether to cache images of rendered layers
//! @note added in 2.1
void setCachingEnabled( bool enabled );

//! Check whether images of rendered layers are curerently being cached
//! @note added in 2.1
bool isCachingEnabled() const;

//! Set whether the layers are rendered in parallel or sequentially
//! @note added in 2.1
void setParallelRenderingEnabled( bool enabled );

//! Check whether the layers are rendered in parallel or sequentially
//! @note added in 2.1
bool isParallelRenderingEnabled() const;

//! @deprecated since 2.1 - there could be more than just one "map" items
QgsMapCanvasMap* map();

@@ -2071,6 +2071,8 @@ void QgisApp::createOverview()
mMapCanvas->setWheelAction(( QgsMapCanvas::WheelAction ) action, zoomFactor );

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

mMapCanvas->setParallelRenderingEnabled( mySettings.value( "/qgis/parallel_rendering", false).toBool() );
}

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

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

mMapCanvas->setParallelRenderingEnabled( mySettings.value( "/qgis/parallel_rendering", false).toBool() );

//do we need this? TS
mMapCanvas->refresh();

@@ -93,10 +93,6 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
connect( cmbIconSize, SIGNAL( highlighted( const QString& ) ), this, SLOT( iconSizeChanged( const QString& ) ) );
connect( cmbIconSize, SIGNAL( textChanged( const QString& ) ), this, SLOT( iconSizeChanged( const QString& ) ) );

#ifdef Q_WS_X11
connect( chkEnableBackbuffer, SIGNAL( stateChanged( int ) ), this, SLOT( toggleEnableBackbuffer( int ) ) );
#endif

connect( this, SIGNAL( accepted() ), this, SLOT( saveOptions() ) );
connect( this, SIGNAL( rejected() ), this, SLOT( rejectOptions() ) );

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

// Set the enable backbuffer state for X11 (linux) systems only
// TODO: remove this when threading is implemented
#ifdef Q_WS_X11
chkEnableBackbuffer->setChecked( settings.value( "/Map/enableBackbuffer", 1 ).toBool() );
toggleEnableBackbuffer( chkEnableBackbuffer->checkState() );
#elif defined(Q_WS_MAC)
chkEnableBackbuffer->setChecked( true );
chkEnableBackbuffer->setEnabled( false );
labelUpdateThreshold->setEnabled( false );
spinBoxUpdateThreshold->setEnabled( false );
#else // Q_WS_WIN32
chkEnableBackbuffer->setChecked( true );
chkEnableBackbuffer->setEnabled( false );
#endif

// set the display update threshold
spinBoxUpdateThreshold->setSpecialValueText( tr( "All" ) );
spinBoxUpdateThreshold->setMinimum( 999 );
spinBoxUpdateThreshold->setValue( qMax( 999, settings.value( "/Map/updateThreshold" ).toInt() ) );

// log rendering events, for userspace debugging
mLogCanvasRefreshChkBx->setChecked( settings.value( "/Map/logCanvasRefreshEvent", false ).toBool() );

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

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

void QgsOptions::toggleEnableBackbuffer( int state )
{
#ifdef Q_WS_X11
if ( Qt::Checked == state )
{
labelUpdateThreshold->setEnabled( false );
spinBoxUpdateThreshold->setEnabled( false );
}
else
{
labelUpdateThreshold->setEnabled( true );
spinBoxUpdateThreshold->setEnabled( true );
}
#else
Q_UNUSED( state );
#endif
}

QString QgsOptions::theme()
{
// returns the current theme (as selected in the cmbTheme combo box)
@@ -975,7 +933,7 @@ void QgsOptions::saveOptions()
settings.setValue( "/qgis/new_layers_visible", chkAddedVisibility->isChecked() );
settings.setValue( "/qgis/enable_anti_aliasing", chkAntiAliasing->isChecked() );
settings.setValue( "/qgis/enable_render_caching", chkUseRenderCaching->isChecked() );
settings.setValue( "/qgis/use_qimage_to_render", !( chkUseQPixmap->isChecked() ) );
settings.setValue( "/qgis/parallel_rendering", chkParallelRendering->isChecked() );
settings.setValue( "/qgis/legendDoubleClickAction", cmbLegendDoubleClickAction->currentIndex() );
bool legendLayersCapitalise = settings.value( "/qgis/capitaliseLayerName", false ).toBool();
settings.setValue( "/qgis/capitaliseLayerName", capitaliseCheckBox->isChecked() );
@@ -1030,10 +988,6 @@ void QgsOptions::saveOptions()
settings.setValue( "/Raster/cumulativeCutLower", mRasterCumulativeCutLowerDoubleSpinBox->value() / 100.0 );
settings.setValue( "/Raster/cumulativeCutUpper", mRasterCumulativeCutUpperDoubleSpinBox->value() / 100.0 );

settings.setValue( "/Map/enableBackbuffer", chkEnableBackbuffer->isChecked() );
int threshold = spinBoxUpdateThreshold->value();
settings.setValue( "/Map/updateThreshold", threshold < 1000 ? 0 : threshold );

// log rendering events, for userspace debugging
settings.setValue( "/Map/logCanvasRefreshEvent", mLogCanvasRefreshChkBx->isChecked() );

@@ -88,10 +88,6 @@ class APP_EXPORT QgsOptions : public QgsOptionsDialogBase, private Ui::QgsOption
*/
void on_mProjectOnLaunchPushBtn_pressed();

//! Slot to change backbuffering. This is handled when the user changes
// the value of the checkbox
void toggleEnableBackbuffer( int );

/**
* Return the desired state of newly added layers. If a layer
* is to be drawn when added to the map, this function returns
@@ -164,15 +164,6 @@ QgsVectorLayer::QgsVectorLayer( QString vectorLayerPath,
}

connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ), this, SLOT( checkJoinLayerRemove( QString ) ) );

// Get the update threshold from user settings. We
// do this only on construction to avoid the penality of
// fetching this each time the layer is drawn. If the user
// changes the threshold from the preferences dialog, it will
// have no effect on existing layers
// TODO: load this setting somewhere else [MD]
//QSettings settings;
//mUpdateThreshold = settings.readNumEntry("Map/updateThreshold", 1000);
}

connect( this, SIGNAL( selectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ), this, SIGNAL( selectionChanged() ) );
@@ -509,6 +509,16 @@ bool QgsMapCanvas::isCachingEnabled() const
return mCache != 0;
}

void QgsMapCanvas::setParallelRenderingEnabled( bool enabled )
{
mUseParallelRendering = enabled;
}

bool QgsMapCanvas::isParallelRenderingEnabled() const
{
return mUseParallelRendering;
}


void QgsMapCanvas::updateOverview()
{
@@ -150,6 +150,14 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
//! @note added in 2.1
bool isCachingEnabled() const;

//! Set whether the layers are rendered in parallel or sequentially
//! @note added in 2.1
void setParallelRenderingEnabled( bool enabled );

//! Check whether the layers are rendered in parallel or sequentially
//! @note added in 2.1
bool isParallelRenderingEnabled() const;

//! @deprecated since 2.1 - there could be more than just one "map" items
QgsMapCanvasMap* map();

@@ -266,8 +266,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>687</width>
<height>523</height>
<width>670</width>
<height>606</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_28">
@@ -912,8 +912,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>670</width>
<height>750</height>
<width>674</width>
<height>799</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_22">
@@ -1249,7 +1249,7 @@
<x>0</x>
<y>0</y>
<width>687</width>
<height>523</height>
<height>511</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_27">
@@ -1577,8 +1577,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>572</width>
<height>611</height>
<width>670</width>
<height>631</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_29">
@@ -1588,64 +1588,24 @@
<string>Rendering behavior</string>
</property>
<layout class="QGridLayout" name="_4">
<item row="1" column="0">
<widget class="QCheckBox" name="chkEnableBackbuffer">
<property name="toolTip">
<string>Better graphics performance at the cost of loosing the possibility to cancel rendering and incremental feature drawing</string>
</property>
<property name="text">
<string>Enable back buffer</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="chkAddedVisibility">
<property name="text">
<string>By default new la&amp;yers added to the map should be displayed</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="chkUseRenderCaching">
<property name="text">
<string>Use render caching where possible to speed up redraws</string>
</property>
</widget>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_26">
<item>
<widget class="QLabel" name="labelUpdateThreshold">
<property name="text">
<string>Number of features to draw before updating the display</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBoxUpdateThreshold">
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Map display will be updated (drawn) after this many features have been read from the data source</string>
</property>
<property name="maximum">
<number>1000000</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="textLabel3">
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="chkParallelRendering">
<property name="text">
<string>&lt;b&gt;Note:&lt;/b&gt; Set below 1000 to prevent display updates until all features have been rendered</string>
<string>Render layers in parallel using all available CPU cores</string>
</property>
</widget>
</item>
@@ -1668,13 +1628,6 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkUseQPixmap">
<property name="text">
<string>Fix problems with incorrectly filled polygons</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -2092,8 +2045,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>441</width>
<height>281</height>
<width>495</width>
<height>351</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_25">
@@ -2438,8 +2391,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>494</width>
<height>619</height>
<width>599</width>
<height>696</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_30">
@@ -2852,8 +2805,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>670</width>
<height>551</height>
<width>544</width>
<height>656</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_31">
@@ -3353,8 +3306,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>687</width>
<height>523</height>
<width>513</width>
<height>385</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
@@ -3493,8 +3446,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>687</width>
<height>523</height>
<width>707</width>
<height>402</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_15">
@@ -3678,8 +3631,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>265</width>
<height>197</height>
<width>327</width>
<height>239</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_32">
@@ -3778,8 +3731,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>469</width>
<height>556</height>
<width>582</width>
<height>703</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_33">

0 comments on commit 9164ae9

Please sign in to comment.
You can’t perform that action at this time.