Skip to content

Commit

Permalink
Feature #8725: Show configuration option
Browse files Browse the repository at this point in the history
Shows a new rendering tab in the layer options form for configure the
drawing simplification.
  • Loading branch information
ahuarte47 committed Oct 26, 2013
1 parent 6e24fe7 commit 2c00524
Show file tree
Hide file tree
Showing 4 changed files with 185 additions and 0 deletions.
20 changes: 20 additions & 0 deletions i18n/qgis_es.ts
Expand Up @@ -49496,6 +49496,10 @@ Should the existing classes be deleted before classification?</source>
<source>General</source>
<translation>General</translation>
</message>
<message>
<source>Rendering</source>
<translation>Representación</translation>
</message>
<message>
<source>Display name</source>
<translation type="obsolete">Mostrar el nombre</translation>
Expand Down Expand Up @@ -49944,6 +49948,22 @@ Should the existing classes be deleted before classification?</source>
<source>Type</source>
<translation>Tipo</translation>
</message>
<message>
<source>Fast drawing</source>
<translation>Pintado rápido</translation>
</message>
<message>
<source>&lt;b&gt;Note:&lt;/b&gt; This option enables geometry simplification drawing for fast rendering of the layer.</source>
<translation>&lt;b&gt;Nota:&lt;/b&gt; Esta opción activa el pintado simplificado de las geometrías para acelerar la representación de la capa.</translation>
</message>
<message>
<source>Simplification factor (Higher value draws more simplified geometries): </source>
<translation>Factor de simplificación (Cuanto mayor es el valor más se simplifica la geometría): </translation>
</message>
<message>
<source>Higher value draws more simplified geometries</source>
<translation>Cuanto mayor es el valor más se simplifica la geometría</translation>
</message>
</context>
<context>
<name>QgsVectorLayerSaveAsDialog</name>
Expand Down
8 changes: 8 additions & 0 deletions src/app/qgsvectorlayerproperties.cpp
Expand Up @@ -392,6 +392,10 @@ void QgsVectorLayerProperties::syncToLayer( void )
cbMinimumScale->setScale( 1.0 / layer->minimumScale() );
cbMaximumScale->setScale( 1.0 / layer->maximumScale() );

// get simplify drawing configuration
mSimplifyDrawingGroupBox->setChecked( layer->simplifyDrawing() );
mSimplifyDrawingSlider->setValue( (int)(10.0f * (layer->simplifyDrawingTol()-1)) );

// load appropriate symbology page (V1 or V2)
updateSymbologyPage();

Expand Down Expand Up @@ -529,6 +533,10 @@ void QgsVectorLayerProperties::apply()
layer->setMetadataUrlType( mLayerMetadataUrlTypeComboBox->currentText() );
layer->setMetadataUrlFormat( mLayerMetadataUrlFormatComboBox->currentText() );

//layer simplify drawing configuration
layer->setSimplifyDrawing( mSimplifyDrawingGroupBox->isChecked() );
layer->setSimplifyDrawingTol( 1.0f + 0.1f*mSimplifyDrawingSlider->value() );

// update symbology
emit refreshLegend( layer->id(), QgsLegendItem::DontChange );

Expand Down
8 changes: 8 additions & 0 deletions src/core/qgsvectorlayer.cpp
Expand Up @@ -1830,6 +1830,10 @@ bool QgsVectorLayer::readSymbology( const QDomNode& node, QString& errorMessage
mLabel->setMinScale( e.attribute( "minLabelScale", "1" ).toFloat() );
mLabel->setMaxScale( e.attribute( "maxLabelScale", "100000000" ).toFloat() );

// get the simplification drawing configuration
setSimplifyDrawing( e.attribute( "simplifyDrawingFlag", "1" ) == "1" );
setSimplifyDrawingTol( e.attribute( "simplifyDrawingTol", "1" ).toFloat() );

//also restore custom properties (for labeling-ng)
readCustomProperties( node, "labeling" );

Expand Down Expand Up @@ -2163,6 +2167,10 @@ bool QgsVectorLayer::writeSymbology( QDomNode& node, QDomDocument& doc, QString&
mapLayerNode.setAttribute( "minLabelScale", QString::number( mLabel->minScale() ) );
mapLayerNode.setAttribute( "maxLabelScale", QString::number( mLabel->maxScale() ) );

// save the simplification drawing configuration
mapLayerNode.setAttribute( "simplifyDrawingFlag", mSimplifyDrawing ? 1 : 0 );
mapLayerNode.setAttribute( "simplifyDrawingTol", QString::number( mSimplifyDrawingTol ) );

//save customproperties (for labeling ng)
writeCustomProperties( node, doc );

Expand Down
149 changes: 149 additions & 0 deletions src/ui/qgsvectorlayerpropertiesbase.ui
Expand Up @@ -144,6 +144,18 @@
<normaloff>:/images/themes/default/propertyicons/attributes.png</normaloff>:/images/themes/default/propertyicons/attributes.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Rendering</string>
</property>
<property name="toolTip">
<string>Rendering</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/propertyicons/rendering.png</normaloff>:/images/themes/default/propertyicons/rendering.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Display</string>
Expand Down Expand Up @@ -895,6 +907,143 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="mOptsPage_Rendering">
<layout class="QVBoxLayout" name="verticalLayout_19">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_15">
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
</property>
<property name="text">
<string>Rendering</string>
</property>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scrollArea_19">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_19">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>794</width>
<height>780</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_32">
<item>
<widget class="QGroupBox" name="mSimplifyDrawingGroupBox">
<property name="title">
<string>Fast drawing</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="_12">
<item row="0" column="1" colspan="5">
<widget class="QLabel" name="label_16">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;b&gt;Note:&lt;/b&gt; This option enables geometry simplification drawing for fast rendering of the layer.</string>
</property>
<property name="margin">
<number>2</number>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLabel" name="label_17">
<property name="text">
<string>Simplification factor (Higher value draws more simplified geometries): </string>
</property>
<property name="margin">
<number>2</number>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QSlider" name="mSimplifyDrawingSlider">
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Higher value draws more simplified geometries</string>
</property>
<property name="maximum">
<number>20</number>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="tracking">
<bool>true</bool>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="invertedAppearance">
<bool>false</bool>
</property>
<property name="invertedControls">
<bool>false</bool>
</property>
</widget>
</item>
<item row="7" column="3">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="mOptsPage_Display">
<layout class="QVBoxLayout" name="verticalLayout_25">
<property name="margin">
Expand Down

0 comments on commit 2c00524

Please sign in to comment.