Skip to content

Commit 7c318ea

Browse files
author
timlinux
committed
API cleanups
git-svn-id: http://svn.osgeo.org/qgis/trunk@9529 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 3d90a7b commit 7c318ea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+238
-238
lines changed

python/core/qgsmaplayer.sip

+10-10
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public:
160160
virtual bool copySymbologySettings(const QgsMapLayer& other) = 0;
161161

162162
/** Returns true if this layer can be in the same symbology group with another layer */
163-
virtual bool isSymbologyCompatible(const QgsMapLayer& other) const = 0;
163+
virtual bool hasCompatibleSymbology(const QgsMapLayer& other) const = 0;
164164

165165
/** Accessor for transparency level. */
166166
unsigned int getTransparency();
@@ -174,21 +174,21 @@ public:
174174
* Interactive users of this provider can then, for example,
175175
* call a QMessageBox to display the contents.
176176
*/
177-
virtual QString errorCaptionString();
177+
virtual QString lastErrorTitle();
178178

179179
/**
180180
* If an operation returns 0 (e.g. draw()), this function
181181
* returns the text of the error associated with the failure.
182182
* Interactive users of this provider can then, for example,
183183
* call a QMessageBox to display the contents.
184184
*/
185-
virtual QString errorString();
185+
virtual QString lastError();
186186

187187
/** Returns layer's spatial reference system */
188188
const QgsCoordinateReferenceSystem& srs();
189189

190190
/** Sets layer's spatial reference system */
191-
void setSrs(const QgsCoordinateReferenceSystem& srs);
191+
void setCrs(const QgsCoordinateReferenceSystem& srs);
192192

193193
/** A convenience function to capitalise the layer name */
194194
static QString capitaliseLayerName(const QString name);
@@ -251,16 +251,16 @@ public slots:
251251
virtual void invalidTransformInput();
252252

253253
/** Accessor and mutator for the minimum scale member */
254-
void setMinScale(float theMinScale);
255-
float minScale();
254+
void setMinimumScale(float theMinScale);
255+
float minimumScale();
256256

257257
/** Accessor and mutator for the maximum scale member */
258-
void setMaxScale(float theMaxScale);
259-
float maxScale();
258+
void setMaximumScale(float theMaxScale);
259+
float maximumScale();
260260

261261
/** Accessor and mutator for the scale based visilibility flag */
262-
void setScaleBasedVisibility( bool theVisibilityFlag);
263-
bool scaleBasedVisibility();
262+
void toggleScaleBasedVisibility( bool theVisibilityFlag);
263+
bool hasScaleBasedVisibility();
264264

265265
signals:
266266

python/core/qgsrasterdataprovider.sip

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public:
107107
* call a QMessageBox to display the contents.
108108
*
109109
*/
110-
virtual QString errorCaptionString() = 0;
110+
virtual QString lastErrorTitle() = 0;
111111

112112
/**
113113
* \brief Returns the verbose error text for the last error in this provider
@@ -118,7 +118,7 @@ public:
118118
* call a QMessageBox to display the contents.
119119
*
120120
*/
121-
virtual QString errorString() = 0;
121+
virtual QString lastError() = 0;
122122

123123

124124
protected:

python/core/qgsrasterlayer.sip

+3-3
Original file line numberDiff line numberDiff line change
@@ -400,23 +400,23 @@ public:
400400
/**Copies the symbology settings from another layer. Returns true in case of success*/
401401
bool copySymbologySettings(const QgsMapLayer& other);
402402

403-
bool isSymbologyCompatible(const QgsMapLayer& other) const;
403+
bool hasCompatibleSymbology(const QgsMapLayer& other) const;
404404

405405
/**
406406
* If an operation returns 0 (e.g. draw()), this function
407407
* returns the text of the error associated with the failure.
408408
* Interactive users of this provider can then, for example,
409409
* call a QMessageBox to display the contents.
410410
*/
411-
QString errorCaptionString();
411+
QString lastErrorTitle();
412412

413413
/**
414414
* If an operation returns 0 (e.g. draw()), this function
415415
* returns the text of the error associated with the failure.
416416
* Interactive users of this provider can then, for example,
417417
* call a QMessageBox to display the contents.
418418
*/
419-
QString errorString();
419+
QString lastError();
420420

421421
/** Returns the data provider
422422
*

python/core/qgsvectorlayer.sip

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public:
8686
bool copySymbologySettings(const QgsMapLayer& other);
8787

8888
/** Returns true if this layer can be in the same symbology group with another layer */
89-
bool isSymbologyCompatible(const QgsMapLayer& other) const;
89+
bool hasCompatibleSymbology(const QgsMapLayer& other) const;
9090

9191
/** Returns a pointer to the renderer */
9292
const QgsRenderer* renderer() const;

python/plugins/mapserver_export/ms_export.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ def __init__(self, projectFile, mapFile):
4242
self.mapName = ''
4343
self.width = ''
4444
self.height = ''
45-
self.minScale = ''
46-
self.maxScale = ''
45+
self.minimumScale = ''
46+
self.maximumScale = ''
4747
self.template = ''
4848
self.header = ''
4949
self.footer = ''
@@ -57,8 +57,8 @@ def setOptions(self, units, image, mapname, width, height, template, header, foo
5757
self.mapName = mapname
5858
self.width = width
5959
self.height = height
60-
#self.minScale = minscale
61-
#self.maxScale = maxscale
60+
#self.minimumScale = minscale
61+
#self.maximumScale = maxscale
6262
self.template = template
6363
self.header = header
6464
self.footer = footer
@@ -218,10 +218,10 @@ def writeWebSection(self):
218218
self.outFile.write(" END\n\n")
219219

220220
self.outFile.write(" #Scale range at which web interface will operate\n")
221-
if self.minScale != "":
222-
self.outFile.write(" MINSCALE " + self.minScale + "\n")
223-
if self.maxScale != "":
224-
self.outFile.write(" MAXSCALE " + self.maxScale + "\n")
221+
if self.minimumScale != "":
222+
self.outFile.write(" MINSCALE " + self.minimumScale + "\n")
223+
if self.maximumScale != "":
224+
self.outFile.write(" MAXSCALE " + self.maximumScale + "\n")
225225

226226
self.outFile.write(" # Template and header/footer settings\n")
227227
self.outFile.write(" # Only the template parameter is required to display a map. See MapServer documentation\n")
@@ -304,9 +304,9 @@ def writeMapLayers(self):
304304
layer_def += " TYPE " + lyr.getAttribute("type").encode('utf-8').upper() + "\n"
305305

306306
# Set min/max scales
307-
if lyr.getAttribute('scaleBasedVisibilityFlag').encode('utf-8') == 1:
308-
layer_def += " MINSCALE " + lyr.getAttribute('minScale').encode('utf-8') + "\n"
309-
layer_def += " MAXSCALE " + lyr.getAttribute('maxScale').encode('utf-8') + "\n"
307+
if lyr.getAttribute('hasScaleBasedVisibilityFlag').encode('utf-8') == 1:
308+
layer_def += " MINSCALE " + lyr.getAttribute('minimumScale').encode('utf-8') + "\n"
309+
layer_def += " MAXSCALE " + lyr.getAttribute('maximumScale').encode('utf-8') + "\n"
310310

311311
# data
312312
dataString = lyr.getElementsByTagName("datasource")[0].childNodes[0].nodeValue.encode('utf-8')
@@ -383,11 +383,11 @@ def writeMapLayers(self):
383383
# the proj4 text string needs to be reformatted to make mapserver happy
384384
layer_def += self.formatProj4(proj4Text)
385385
layer_def += " END\n"
386-
scaleDependent = lyr.getAttribute("scaleBasedVisibilityFlag").encode('utf-8')
386+
scaleDependent = lyr.getAttribute("hasScaleBasedVisibilityFlag").encode('utf-8')
387387
if scaleDependent == '1':
388388
# get the min and max scale settings
389-
minscale = lyr.getAttribute("minScale").encode('utf-8')
390-
maxscale = lyr.getAttribute("maxScale").encode('utf-8')
389+
minscale = lyr.getAttribute("minimumScale").encode('utf-8')
390+
maxscale = lyr.getAttribute("maximumScale").encode('utf-8')
391391
if minscale > '':
392392
layer_def += " MINSCALE " + minscale + "\n"
393393
if maxscale > '':

src/app/legend/qgslegendlayerfilegroup.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ QgsLegendItem::DRAG_ACTION QgsLegendLayerFileGroup::accept( const QgsLegendItem*
6060
{
6161
QgsMapLayer* childlayer = llf->layer();
6262
const QgsMapLayer* newlayer = ( dynamic_cast<const QgsLegendLayerFile*>( li ) )->layer();
63-
if ( newlayer->isSymbologyCompatible( *childlayer ) )
63+
if ( newlayer->hasCompatibleSymbology( *childlayer ) )
6464
{
6565
return INSERT;
6666
}
@@ -101,7 +101,7 @@ bool QgsLegendLayerFileGroup::insert( QgsLegendItem* newItem )
101101
return false;
102102
}
103103
QgsMapLayer* newLayer = ( dynamic_cast<QgsLegendLayerFile*>( newItem ) )->layer();
104-
if ( newLayer->isSymbologyCompatible( *thelayer ) )
104+
if ( newLayer->hasCompatibleSymbology( *thelayer ) )
105105
{
106106
insertChild( childCount(), newItem );
107107
return true;

src/app/qgisapp.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5296,7 +5296,7 @@ bool QgisApp::addRasterLayer( QgsRasterLayer * theRasterLayer )
52965296
SLOT( showProgress( int, int ) ) );
52975297
// connect up any request the raster may make to update the statusbar message
52985298
QObject::connect( theRasterLayer,
5299-
SIGNAL( setStatus( QString ) ),
5299+
SIGNAL( statusChanged( QString ) ),
53005300
this,
53015301
SLOT( showStatusMessage( QString ) ) );
53025302
// notify the project we've made a change

src/app/qgsmapserverexport.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,11 @@ void QgsMapserverExport::writeMapFile()
149149
{
150150
mapFile << " FOOTER " << txtWebFooter->text().toLocal8Bit().data() << std::endl;
151151
}
152-
QString minScale = txtMinScale->text().isEmpty() ? "#MINSCALE" : "MINSCALE";
153-
QString maxScale = txtMinScale->text().isEmpty() ? " #MAXSCALE " : " MAXSCALE ";
152+
QString minimumScale = txtMinScale->text().isEmpty() ? "#MINSCALE" : "MINSCALE";
153+
QString maximumScale = txtMinScale->text().isEmpty() ? " #MAXSCALE " : " MAXSCALE ";
154154
// write min and maxscale
155-
mapFile << minScale.toLocal8Bit().data() << txtMinScale->text().toLocal8Bit().data() << std::endl;
156-
mapFile << maxScale.toLocal8Bit().data() << txtMaxScale->text().toLocal8Bit().data() << std::endl;
155+
mapFile << minimumScale.toLocal8Bit().data() << txtMinScale->text().toLocal8Bit().data() << std::endl;
156+
mapFile << maximumScale.toLocal8Bit().data() << txtMaxScale->text().toLocal8Bit().data() << std::endl;
157157
// write comments about the imagepath and image url
158158
mapFile << "# Set IMAGEPATH to the path where mapserver should\n" <<
159159
"# write its output\n" <<

src/app/qgsmaptoolidentify.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -412,16 +412,16 @@ void QgsMapToolIdentify::showError()
412412
{
413413
// QMessageBox::warning(
414414
// this,
415-
// mapLayer->errorCaptionString(),
415+
// mapLayer->lastErrorTitle(),
416416
// tr("Could not draw") + " " + mapLayer->name() + " " + tr("because") + ":\n" +
417-
// mapLayer->errorString()
417+
// mapLayer->lastError()
418418
// );
419419

420420
QgsMessageViewer * mv = new QgsMessageViewer();
421-
mv->setWindowTitle( mLayer->errorCaptionString() );
421+
mv->setWindowTitle( mLayer->lastErrorTitle() );
422422
mv->setMessageAsPlainText(
423423
QObject::tr( "Could not identify objects on" ) + " " + mLayer->name() + " " + QObject::tr( "because" ) + ":\n" +
424-
mLayer->errorString()
424+
mLayer->lastError()
425425
);
426426
mv->exec(); // deletes itself on close
427427
}

src/app/qgsrasterlayerproperties.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer *lyr, QWidget *p
9595
connect( mColormapTreeWidget, SIGNAL( itemDoubleClicked( QTreeWidgetItem*, int ) ), this, SLOT( handleColormapTreeWidgetDoubleClick( QTreeWidgetItem*, int ) ) );
9696

9797
// set up the scale based layer visibility stuff....
98-
chkUseScaleDependentRendering->setChecked( lyr->scaleBasedVisibility() );
99-
spinMinimumScale->setValue(( int )lyr->minScale() );
100-
spinMaximumScale->setValue(( int )lyr->maxScale() );
98+
chkUseScaleDependentRendering->setChecked( lyr->hasScaleBasedVisibility() );
99+
spinMinimumScale->setValue(( int )lyr->minimumScale() );
100+
spinMaximumScale->setValue(( int )lyr->maximumScale() );
101101

102102
// build GUI components
103103
cboxColorMap->addItem( tr( "Grayscale" ) );
@@ -1439,9 +1439,9 @@ void QgsRasterLayerProperties::apply()
14391439

14401440

14411441
// set up the scale based layer visibility stuff....
1442-
mRasterLayer->setScaleBasedVisibility( chkUseScaleDependentRendering->isChecked() );
1443-
mRasterLayer->setMinScale( spinMinimumScale->value() );
1444-
mRasterLayer->setMaxScale( spinMaximumScale->value() );
1442+
mRasterLayer->toggleScaleBasedVisibility( chkUseScaleDependentRendering->isChecked() );
1443+
mRasterLayer->setMinimumScale( spinMinimumScale->value() );
1444+
mRasterLayer->setMaximumScale( spinMaximumScale->value() );
14451445

14461446
//update the legend pixmap
14471447
pixmapLegend->setPixmap( mRasterLayer->getLegendQPixmap() );
@@ -1688,7 +1688,7 @@ void QgsRasterLayerProperties::on_pbnChangeSpatialRefSys_clicked()
16881688
if ( mySelector->exec() )
16891689
{
16901690
QgsCoordinateReferenceSystem srs( mySelector->selectedCrsId(), QgsCoordinateReferenceSystem::InternalCrsId );
1691-
mRasterLayer->setSrs( srs );
1691+
mRasterLayer->setCrs( srs );
16921692
}
16931693
else
16941694
{

src/app/qgsserversourceselect.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ void QgsServerSourceSelect::on_btnConnect_clicked()
334334

335335
if ( mWmsProvider )
336336
{
337-
connect( mWmsProvider, SIGNAL( setStatus( QString ) ), this, SLOT( showStatusMessage( QString ) ) );
337+
connect( mWmsProvider, SIGNAL( statusChanged( QString ) ), this, SLOT( showStatusMessage( QString ) ) );
338338

339339
// WMS Provider all set up; let's get some layers
340340

@@ -622,18 +622,18 @@ void QgsServerSourceSelect::showError( QgsWmsProvider * wms )
622622
{
623623
// QMessageBox::warning(
624624
// this,
625-
// wms->errorCaptionString(),
625+
// wms->lastErrorTitle(),
626626
// tr("Could not understand the response. The") + " " + wms->name() + " " +
627627
// tr("provider said") + ":\n" +
628-
// wms->errorString()
628+
// wms->lastError()
629629
// );
630630

631631
QgsMessageViewer * mv = new QgsMessageViewer( this );
632-
mv->setWindowTitle( wms->errorCaptionString() );
632+
mv->setWindowTitle( wms->lastErrorTitle() );
633633
mv->setMessageAsPlainText(
634634
tr( "Could not understand the response. The" ) + " " + wms->name() + " " +
635635
tr( "provider said" ) + ":\n" +
636-
wms->errorString()
636+
wms->lastError()
637637
);
638638
mv->showMessage( true ); // Is deleted when closed
639639
}

src/app/qgsvectorlayerproperties.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -383,9 +383,9 @@ void QgsVectorLayerProperties::reset( void )
383383
layer->displayField() ) );
384384

385385
// set up the scale based layer visibility stuff....
386-
chkUseScaleDependentRendering->setChecked( layer->scaleBasedVisibility() );
387-
spinMinimumScale->setValue(( int )layer->minScale() );
388-
spinMaximumScale->setValue(( int )layer->maxScale() );
386+
chkUseScaleDependentRendering->setChecked( layer->hasScaleBasedVisibility() );
387+
spinMinimumScale->setValue(( int )layer->minimumScale() );
388+
spinMaximumScale->setValue(( int )layer->maximumScale() );
389389

390390
// symbology initialization
391391
if ( legendtypecombobox->count() == 0 )
@@ -484,9 +484,9 @@ void QgsVectorLayerProperties::apply()
484484
}
485485
#endif
486486
// set up the scale based layer visibility stuff....
487-
layer->setScaleBasedVisibility( chkUseScaleDependentRendering->isChecked() );
488-
layer->setMinScale( spinMinimumScale->value() );
489-
layer->setMaxScale( spinMaximumScale->value() );
487+
layer->toggleScaleBasedVisibility( chkUseScaleDependentRendering->isChecked() );
488+
layer->setMinimumScale( spinMinimumScale->value() );
489+
layer->setMaximumScale( spinMaximumScale->value() );
490490

491491
// update the display field
492492
layer->setDisplayField( displayFieldComboBox->currentText() );
@@ -867,7 +867,7 @@ void QgsVectorLayerProperties::on_pbnChangeSpatialRefSys_clicked()
867867
if ( mySelector->exec() )
868868
{
869869
QgsCoordinateReferenceSystem srs( mySelector->selectedCrsId(), QgsCoordinateReferenceSystem::InternalCrsId );
870-
layer->setSrs( srs );
870+
layer->setCrs( srs );
871871
}
872872
else
873873
{

src/core/composer/qgscomposeritem.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -554,14 +554,14 @@ void QgsComposerItem::drawText( QPainter* p, const QRectF& rect, const QString&
554554
p->restore();
555555
}
556556

557-
double QgsComposerItem::textWidthMM( const QFont& font, const QString& text ) const
557+
double QgsComposerItem::textWidthMillimeters( const QFont& font, const QString& text ) const
558558
{
559559
QFont metricsFont = scaledFontPixelSize( font );
560560
QFontMetrics fontMetrics( metricsFont );
561561
return ( fontMetrics.width( text ) / FONT_WORKAROUND_SCALE );
562562
}
563563

564-
double QgsComposerItem::fontAscentMM( const QFont& font ) const
564+
double QgsComposerItem::fontAscentMillimeters( const QFont& font ) const
565565
{
566566
QFont metricsFont = scaledFontPixelSize( font );
567567
QFontMetrics fontMetrics( metricsFont );

src/core/composer/qgscomposeritem.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ class CORE_EXPORT QgsComposerItem: public QGraphicsRectItem
123123
/**Like the above, but with a rectangle for multiline text*/
124124
void drawText( QPainter* p, const QRectF& rect, const QString& text, const QFont& font ) const;
125125

126-
/**Returns the font width in MM (considers upscaling and downscaling with FONT_WORKAROUND_SCALE*/
127-
double textWidthMM( const QFont& font, const QString& text ) const;
126+
/**Returns the font width in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE*/
127+
double textWidthMillimeters( const QFont& font, const QString& text ) const;
128128

129-
/**Returns the font ascent in MM (considers upscaling and downscaling with FONT_WORKAROUND_SCALE*/
130-
double fontAscentMM( const QFont& font ) const;
129+
/**Returns the font ascent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE*/
130+
double fontAscentMillimeters( const QFont& font ) const;
131131

132132
/**Calculates font to from point size to pixel size*/
133133
double pixelFontSize( double pointSize ) const;

src/core/composer/qgscomposerlabel.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ void QgsComposerLabel::setFont( const QFont& f )
6868

6969
void QgsComposerLabel::adjustSizeToText()
7070
{
71-
double textWidth = textWidthMM( mFont, mText );
72-
double fontAscent = fontAscentMM( mFont );
71+
double textWidth = textWidthMillimeters( mFont, mText );
72+
double fontAscent = fontAscentMillimeters( mFont );
7373

7474
setSceneRect( QRectF( transform().dx(), transform().dy(), textWidth + 2 * mMargin + 2 * pen().widthF() + 1, \
7575
fontAscent + 2 * mMargin + 2 * pen().widthF() + 1 ) );

0 commit comments

Comments
 (0)