Skip to content
Permalink
Browse files

allow entry of visibility scales in floating point

git-svn-id: http://svn.osgeo.org/qgis/trunk@12661 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Jan 2, 2010
1 parent 4785ba5 commit e4ee1a9f9f9b6570324d068bdc63e1d9a1e67031
@@ -14,15 +14,19 @@
* *
***************************************************************************/
/* $Id$ */

#include <limits>

#include "qgslabeldialog.h"
#include "qgsfield.h"
#include "qgslabel.h"
#include "qgslabelattributes.h"
#include "qgslogger.h"

#include <QColorDialog>
#include <QFontDialog>
#include <QTabWidget>
#include "qgslogger.h"
#include <QDoubleValidator>


const int PIXMAP_WIDTH = 200;
@@ -146,8 +150,10 @@ void QgsLabelDialog::init( )

// set up the scale based layer visibility stuff....
chkUseScaleDependentRendering->setChecked( mLabel->scaleBasedVisibility() );
spinMinimumScale->setValue(( int )mLabel->minScale() );
spinMaximumScale->setValue(( int )mLabel->maxScale() );
leMinimumScale->setText( QString::number( mLabel->minScale(), 'f' ) );
leMinimumScale->setValidator( new QDoubleValidator( 0, std::numeric_limits<float>::max(), 1000, this ) );
leMaximumScale->setText( QString::number( mLabel->maxScale(), 'f' ) );
leMaximumScale->setValidator( new QDoubleValidator( 0, std::numeric_limits<float>::max(), 1000, this ) );

//
//set the non-databound fields up now
@@ -438,8 +444,8 @@ void QgsLabelDialog::apply()

// set up the scale based layer visibility stuff....
mLabel->setScaleBasedVisibility( chkUseScaleDependentRendering->isChecked() );
mLabel->setMinScale( spinMinimumScale->value() );
mLabel->setMaxScale( spinMaximumScale->value() );
mLabel->setMinScale( leMinimumScale->text().toFloat() );
mLabel->setMaxScale( leMaximumScale->text().toFloat() );
}

int QgsLabelDialog::fieldIndexFromName( QString name )
@@ -15,7 +15,7 @@
* *
***************************************************************************/

#include <QDebug>
#include <limits>

#include "qgslogger.h"
#include "qgsapplication.h"
@@ -98,8 +98,10 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer *lyr, QWidget *p

// set up the scale based layer visibility stuff....
chkUseScaleDependentRendering->setChecked( lyr->hasScaleBasedVisibility() );
spinMinimumScale->setValue(( int )lyr->minimumScale() );
spinMaximumScale->setValue(( int )lyr->maximumScale() );
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 ) );

// build GUI components
cboxColorMap->addItem( tr( "Grayscale" ) );
@@ -1446,8 +1448,8 @@ void QgsRasterLayerProperties::apply()

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

//update the legend pixmap
pixmapLegend->setPixmap( mRasterLayer->legendAsPixmap() );
@@ -18,6 +18,7 @@
/* $Id$ */

#include <memory>
#include <limits>

#include "qgisapp.h"
#include "qgsapplication.h"
@@ -476,8 +477,10 @@ void QgsVectorLayerProperties::reset( void )

// set up the scale based layer visibility stuff....
chkUseScaleDependentRendering->setChecked( layer->hasScaleBasedVisibility() );
spinMinimumScale->setValue(( int )layer->minimumScale() );
spinMaximumScale->setValue(( int )layer->maximumScale() );
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 ) );

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

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

// update the display field
layer->setDisplayField( displayFieldComboBox->currentText() );
@@ -304,46 +304,20 @@
<property name="text">
<string>Maximum</string>
</property>
<property name="buddy">
<cstring>spinMaximumScale</cstring>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="textLabel1_1">
<property name="text">
<string>Minimum</string>
</property>
<property name="buddy">
<cstring>spinMinimumScale</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="spinMinimumScale">
<property name="toolTip">
<string>Minimum scale at which this layer will be displayed. </string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100000000</number>
</property>
</widget>
<widget class="QLineEdit" name="leMinimumScale"/>
</item>
<item row="0" column="3">
<widget class="QSpinBox" name="spinMaximumScale">
<property name="toolTip">
<string>Maximum scale at which this layer will be displayed. </string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100000000</number>
</property>
</widget>
<widget class="QLineEdit" name="leMaximumScale"/>
</item>
</layout>
</widget>
@@ -947,8 +921,8 @@
<tabstop>radioBelowLeft</tabstop>
<tabstop>radioBelow</tabstop>
<tabstop>radioBelowRight</tabstop>
<tabstop>spinMinimumScale</tabstop>
<tabstop>spinMaximumScale</tabstop>
<tabstop>leMinimumScale</tabstop>
<tabstop>leMaximumScale</tabstop>
<tabstop>pbnDefaultBufferColor_2</tabstop>
<tabstop>spinBufferSize</tabstop>
<tabstop>radioBufferUnitsPoints</tabstop>
@@ -1569,46 +1569,32 @@
<property name="margin">
<number>11</number>
</property>
<item row="0" column="3">
<widget class="QSpinBox" name="spinMaximumScale">
<property name="toolTip">
<string>Maximum scale at which this layer will be displayed. </string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100000000</number>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="textLabel1_2_2_2">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Maximum</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="spinMinimumScale">
<property name="toolTip">
<string>Minimum scale at which this layer will be displayed. </string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100000000</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="textLabel1_3">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Minimum</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLineEdit" name="leMaximumScale"/>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="leMinimumScale"/>
</item>
</layout>
</widget>
</item>
@@ -1824,8 +1810,8 @@
<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;
&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;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@@ -2114,8 +2100,8 @@ p, li { white-space: pre-wrap; }
<tabstop>tableTransparency</tabstop>
<tabstop>leDisplayName</tabstop>
<tabstop>leLayerSource</tabstop>
<tabstop>spinMinimumScale</tabstop>
<tabstop>spinMaximumScale</tabstop>
<tabstop>leMinimumScale</tabstop>
<tabstop>leMaximumScale</tabstop>
<tabstop>leSpatialRefSys</tabstop>
<tabstop>pbnChangeSpatialRefSys</tabstop>
<tabstop>tePyramidDescription</tabstop>
@@ -142,7 +142,7 @@
<item row="0" column="1">
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>0</number>
<number>3</number>
</property>
<widget class="QWidget" name="page_3">
<layout class="QGridLayout" name="gridLayout_4">
@@ -423,8 +423,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>401</width>
<height>425</height>
<width>514</width>
<height>428</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
@@ -548,46 +548,20 @@
<property name="text">
<string>Maximum</string>
</property>
<property name="buddy">
<cstring>spinMaximumScale</cstring>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="textLabel1">
<property name="text">
<string>Minimum</string>
</property>
<property name="buddy">
<cstring>spinMinimumScale</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="spinMinimumScale">
<property name="toolTip">
<string>Minimum scale at which this layer will be displayed. </string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100000000</number>
</property>
</widget>
<widget class="QLineEdit" name="leMinimumScale"/>
</item>
<item row="0" column="3">
<widget class="QSpinBox" name="spinMaximumScale">
<property name="toolTip">
<string>Maximum scale at which this layer will be displayed. </string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100000000</number>
</property>
</widget>
<widget class="QLineEdit" name="leMaximumScale"/>
</item>
</layout>
</widget>
@@ -732,8 +706,8 @@
<tabstop>displayFieldComboBox</tabstop>
<tabstop>leSpatialRefSys</tabstop>
<tabstop>pbnIndex</tabstop>
<tabstop>spinMinimumScale</tabstop>
<tabstop>spinMaximumScale</tabstop>
<tabstop>leMinimumScale</tabstop>
<tabstop>leMaximumScale</tabstop>
<tabstop>txtSubsetSQL</tabstop>
<tabstop>pbnQueryBuilder</tabstop>
<tabstop>buttonBox</tabstop>

0 comments on commit e4ee1a9

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