Skip to content
Permalink
Browse files

Used QsgScaleComboBox in scale based visibility. Also fix #6213

  • Loading branch information
homann committed Sep 21, 2012
1 parent 413e9dc commit 73fcb6625789055bf67225d1c3d44a1872cf5c2c
@@ -83,10 +83,17 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanv

// set up the scale based layer visibility stuff....
chkUseScaleDependentRendering->setChecked( lyr->hasScaleBasedVisibility() );
leMinimumScale->setText( QString::number( lyr->minimumScale(), 'f' ) );
leMinimumScale->setValidator( new QDoubleValidator( 0, std::numeric_limits<float>::max(), 1000, this ) );
leMaximumScale->setText( QString::number( lyr->maximumScale(), 'f' ) );
leMaximumScale->setValidator( new QDoubleValidator( 0, std::numeric_limits<float>::max(), 1000, this ) );
bool projectScales = QgsProject::instance()->readBoolEntry( "Scales", "/useProjectScales" );
if ( projectScales )
{
QStringList scalesList = QgsProject::instance()->readListEntry( "Scales", "/ScalesList" );
cbMinimumScale->updateScales( scalesList );
cbMaximumScale->updateScales( scalesList );
}
cbMinimumScale->setScale( 1.0 / lyr->minimumScale() );
cbMaximumScale->setScale( 1.0 / lyr->maximumScale() );


leNoDataValue->setValidator( new QDoubleValidator( -std::numeric_limits<double>::max(), std::numeric_limits<double>::max(), 1000, this ) );

// build GUI components
@@ -750,8 +757,8 @@ void QgsRasterLayerProperties::apply()

// set up the scale based layer visibility stuff....
mRasterLayer->toggleScaleBasedVisibility( chkUseScaleDependentRendering->isChecked() );
mRasterLayer->setMinimumScale( leMinimumScale->text().toFloat() );
mRasterLayer->setMaximumScale( leMaximumScale->text().toFloat() );
mRasterLayer->setMinimumScale( 1.0 / cbMinimumScale->scale() );
mRasterLayer->setMaximumScale( 1.0 / cbMaximumScale->scale() );

//update the legend pixmap
pixmapLegend->setPixmap( mRasterLayer->legendAsPixmap() );
@@ -586,10 +586,15 @@ void QgsVectorLayerProperties::reset( void )

// set up the scale based layer visibility stuff....
chkUseScaleDependentRendering->setChecked( layer->hasScaleBasedVisibility() );
leMinimumScale->setText( QString::number( layer->minimumScale(), 'f' ) );
leMinimumScale->setValidator( new QDoubleValidator( 0, std::numeric_limits<float>::max(), 1000, this ) );
leMaximumScale->setText( QString::number( layer->maximumScale(), 'f' ) );
leMaximumScale->setValidator( new QDoubleValidator( 0, std::numeric_limits<float>::max(), 1000, this ) );
bool projectScales = QgsProject::instance()->readBoolEntry( "Scales", "/useProjectScales" );
if ( projectScales )
{
QStringList scalesList = QgsProject::instance()->readListEntry( "Scales", "/ScalesList" );
cbMinimumScale->updateScales( scalesList );
cbMaximumScale->updateScales( scalesList );
}
cbMinimumScale->setScale( 1.0 / layer->minimumScale() );
cbMaximumScale->setScale( 1.0 / layer->maximumScale() );

// symbology initialization
if ( legendtypecombobox->count() == 0 )
@@ -682,8 +687,8 @@ void QgsVectorLayerProperties::apply()

// set up the scale based layer visibility stuff....
layer->toggleScaleBasedVisibility( chkUseScaleDependentRendering->isChecked() );
layer->setMinimumScale( leMinimumScale->text().toFloat() );
layer->setMaximumScale( leMaximumScale->text().toFloat() );
layer->setMinimumScale( 1.0 / cbMinimumScale->scale() );
layer->setMaximumScale( 1.0 / cbMaximumScale->scale() );

// provider-specific options
if ( layer->dataProvider() )
@@ -382,7 +382,7 @@ void QgsMapRenderer::render( QPainter* painter, double* forceWidthScale )
.arg( ml->extent().toString() )
);

if ( !ml->hasScaleBasedVisibility() || ( ml->minimumScale() < mScale && mScale < ml->maximumScale() ) || mOverview )
if ( !ml->hasScaleBasedVisibility() || ( ml->minimumScale() <= mScale && mScale < ml->maximumScale() ) || mOverview )
{
connect( ml, SIGNAL( drawingProgress( int, int ) ), this, SLOT( onDrawingProgress( int, int ) ) );

@@ -589,7 +589,7 @@
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Maximum</string>
<string>Less than:</string>
</property>
</widget>
</item>
@@ -599,15 +599,15 @@
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Minimum</string>
<string>More than or equal to:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLineEdit" name="leMaximumScale"/>
<widget class="QgsScaleComboBox" name="cbMaximumScale"/>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="leMinimumScale"/>
<widget class="QgsScaleComboBox" name="cbMinimumScale"/>
</item>
</layout>
</widget>
@@ -1052,8 +1052,8 @@ p, li { white-space: pre-wrap; }
<tabstop>tableTransparency</tabstop>
<tabstop>leDisplayName</tabstop>
<tabstop>leLayerSource</tabstop>
<tabstop>leMinimumScale</tabstop>
<tabstop>leMaximumScale</tabstop>
<tabstop>cbMinimumScale</tabstop>
<tabstop>cbMaximumScale</tabstop>
<tabstop>leSpatialRefSys</tabstop>
<tabstop>pbnChangeSpatialRefSys</tabstop>
<tabstop>tePyramidDescription</tabstop>
@@ -492,22 +492,22 @@
<item row="0" column="2">
<widget class="QLabel" name="textLabel1_2_2">
<property name="text">
<string>Maximum</string>
<string>Less than:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="textLabel1">
<property name="text">
<string>Minimum</string>
<string>More than or equal to:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="leMinimumScale"/>
<widget class="QgsScaleComboBox" name="cbMinimumScale"/>
</item>
<item row="0" column="3">
<widget class="QLineEdit" name="leMaximumScale"/>
<widget class="QgsScaleComboBox" name="cbMaximumScale"/>
</item>
</layout>
</widget>
@@ -968,8 +968,8 @@
<layoutdefault spacing="6" margin="11"/>
<tabstops>
<tabstop>pbnIndex</tabstop>
<tabstop>leMinimumScale</tabstop>
<tabstop>leMaximumScale</tabstop>
<tabstop>cbMinimumScale</tabstop>
<tabstop>cbMaximumScale</tabstop>
<tabstop>txtSubsetSQL</tabstop>
<tabstop>pbnQueryBuilder</tabstop>
</tabstops>

0 comments on commit 73fcb66

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