Skip to content

Commit c6fb52f

Browse files
author
timlinux
committedAug 23, 2008
Further api consistency cleanups
git-svn-id: http://svn.osgeo.org/qgis/trunk@9134 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 120a61c commit c6fb52f

24 files changed

+80
-80
lines changed
 

‎python/core/qgsmaprenderer.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class QgsMapRenderer : QObject
3131
const QgsMapToPixel* coordinateTransform();
3232

3333
double scale() const;
34-
double mupp() const;
34+
double mapUnitsPerPixel() const;
3535

3636
int width() const;
3737
int height() const;

‎python/core/qgsmaptopixel.sip

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ class QgsMapToPixel
1212

1313
public:
1414
/* Constructor
15-
* @param mupp Map units per pixel
15+
* @param mapUnitsPerPixel Map units per pixel
1616
* @param ymax Maximum y value of the map canvas
1717
* @param ymin Minimum y value of the map canvas
1818
* @param xmin Minimum x value of the map canvas
1919
*/
20-
QgsMapToPixel(double mupp=0, double ymax = 0, double ymin=0,
20+
QgsMapToPixel(double mapUnitsPerPixel=0, double ymax = 0, double ymin=0,
2121
double xmin = 0);
2222
//! destructor
2323
~QgsMapToPixel();
@@ -61,9 +61,9 @@ class QgsMapToPixel
6161

6262
QgsPoint toMapPoint(int x, int y);
6363
/*! Set map units per pixel
64-
* @param mupp Map units per pixel
64+
* @param mapUnitsPerPixel Map units per pixel
6565
*/
66-
void setMapUnitsPerPixel(double mupp);
66+
void setMapUnitsPerPixel(double mapUnitsPerPixel);
6767

6868
//! Return current map units per pixel
6969
double mapUnitsPerPixel();
@@ -75,12 +75,12 @@ class QgsMapToPixel
7575
//! set minimum x value
7676
void setXMinimum(double xmin);
7777
/*! Set parameters for use in tranfsorming coordinates
78-
* @param mupp Map units per pixel
78+
* @param mapUnitsPerPixel Map units per pixel
7979
* @param xmin Minimum x value
8080
* @param ymin Minimum y value
8181
* @param ymax Maximum y value
8282
*/
83-
void setParameters(double mupp, double xmin, double ymin, double ymax);
83+
void setParameters(double mapUnitsPerPixel, double xmin, double ymin, double ymax);
8484
//! String representation of the parameters used in the transform
8585
QString showParameters();
8686

‎python/core/qgsproject.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public:
6262
void setFilename( const QString & name );
6363

6464
/** returns file name */
65-
QString filename() const;
65+
QString setFilename() const;
6666
//@}
6767

6868

‎python/gui/qgsmapcanvas.sip

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ class QgsMapCanvas : QGraphicsView
7373
//! Clear the map canvas
7474
void clear();
7575

76-
//! Returns the mupp (map units per pixel) for the canvas
77-
double mupp() const;
76+
//! Returns the mapUnitsPerPixel (map units per pixel) for the canvas
77+
double mapUnitsPerPixel() const;
7878

7979
//! Returns the current zoom exent of the map canvas
8080
QgsRect extent() const;

‎src/app/legend/qgslegend.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,12 +1795,12 @@ void QgsLegend::legendLayerZoomNative()
17951795
if(layer)
17961796
{
17971797
QgsDebugMsg("Raster units per pixel : " + QString::number(layer->rasterUnitsPerPixel()));
1798-
QgsDebugMsg("Mupp before : " + QString::number(mMapCanvas->mupp()));
1798+
QgsDebugMsg("MapUnitsPerPixel before : " + QString::number(mMapCanvas->mapUnitsPerPixel()));
17991799

1800-
mMapCanvas->zoom(fabs( layer->rasterUnitsPerPixel() / mMapCanvas->mupp()));
1800+
mMapCanvas->zoom(fabs( layer->rasterUnitsPerPixel() / mMapCanvas->mapUnitsPerPixel()));
18011801
mMapCanvas->refresh();
18021802

1803-
QgsDebugMsg("Mupp after : " + QString::number(mMapCanvas->mupp()));
1803+
QgsDebugMsg("MapUnitsPerPixel after : " + QString::number(mMapCanvas->mapUnitsPerPixel()));
18041804

18051805
// notify the project we've made a change
18061806
QgsProject::instance()->dirty(true);

‎src/app/qgisapp.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,14 @@ static void setTitleBarText_( QWidget & qgisApp )
224224

225225
if ( QgsProject::instance()->title().isEmpty() )
226226
{
227-
if ( QgsProject::instance()->filename().isEmpty() )
227+
if ( QgsProject::instance()->setFilename().isEmpty() )
228228
{
229229
// no project title nor file name, so just leave caption with
230230
// application name and version
231231
}
232232
else
233233
{
234-
QFileInfo projectFileInfo( QgsProject::instance()->filename() );
234+
QFileInfo projectFileInfo( QgsProject::instance()->setFilename() );
235235
caption += projectFileInfo.baseName();
236236
}
237237
}
@@ -2882,7 +2882,7 @@ bool QgisApp::fileSave()
28822882
// the current project file name is empty
28832883
bool isNewProject = false;
28842884

2885-
if ( QgsProject::instance()->filename().isNull() )
2885+
if ( QgsProject::instance()->setFilename().isNull() )
28862886
{
28872887
isNewProject = true;
28882888

@@ -2925,7 +2925,7 @@ bool QgisApp::fileSave()
29252925
if ( QgsProject::instance()->write() )
29262926
{
29272927
setTitleBarText_(*this); // update title bar
2928-
statusBar()->showMessage(tr("Saved project to:") + " " + QgsProject::instance()->filename() );
2928+
statusBar()->showMessage(tr("Saved project to:") + " " + QgsProject::instance()->setFilename() );
29292929

29302930
if (isNewProject)
29312931
{
@@ -2938,13 +2938,13 @@ bool QgisApp::fileSave()
29382938
{
29392939
QMessageBox::critical(this,
29402940
tr("Unable to save project"),
2941-
tr("Unable to save project to ") + QgsProject::instance()->filename() );
2941+
tr("Unable to save project to ") + QgsProject::instance()->setFilename() );
29422942
}
29432943
}
29442944
catch ( std::exception & e )
29452945
{
29462946
QMessageBox::critical( this,
2947-
tr("Unable to save project ") + QgsProject::instance()->filename(),
2947+
tr("Unable to save project ") + QgsProject::instance()->setFilename(),
29482948
QString::fromLocal8Bit( e.what() ) );
29492949
}
29502950
return true;
@@ -3008,21 +3008,21 @@ void QgisApp::fileSaveAs()
30083008
if ( QgsProject::instance()->write() )
30093009
{
30103010
setTitleBarText_(*this); // update title bar
3011-
statusBar()->showMessage(tr("Saved project to:") + " " + QgsProject::instance()->filename() );
3011+
statusBar()->showMessage(tr("Saved project to:") + " " + QgsProject::instance()->setFilename() );
30123012
// add this to the list of recently used project files
30133013
saveRecentProjectPath(fullPath.filePath(), settings);
30143014
}
30153015
else
30163016
{
30173017
QMessageBox::critical(this,
30183018
tr("Unable to save project"),
3019-
tr("Unable to save project to ") + QgsProject::instance()->filename() );
3019+
tr("Unable to save project to ") + QgsProject::instance()->setFilename() );
30203020
}
30213021
}
30223022
catch ( std::exception & e )
30233023
{
30243024
QMessageBox::critical( 0x0,
3025-
tr("Unable to save project ") + QgsProject::instance()->filename(),
3025+
tr("Unable to save project ") + QgsProject::instance()->setFilename(),
30263026
QString::fromLocal8Bit( e.what() ),
30273027
QMessageBox::Ok,
30283028
Qt::NoButton );
@@ -4618,8 +4618,8 @@ void QgisApp::updateMouseCoordinatePrecision()
46184618
// coordinates with the aim of always having enough decimal places
46194619
// to show the difference in position between adjacent pixels.
46204620
// Also avoid taking the log of 0.
4621-
if (getMapCanvas()->mupp() != 0.0)
4622-
dp = static_cast<int> (ceil(-1.0*log10(getMapCanvas()->mupp())));
4621+
if (getMapCanvas()->mapUnitsPerPixel() != 0.0)
4622+
dp = static_cast<int> (ceil(-1.0*log10(getMapCanvas()->mapUnitsPerPixel())));
46234623
}
46244624
else
46254625
dp = QgsProject::instance()->readNumEntry("PositionPrecision","/DecimalPlaces");

‎src/app/qgsmaptoolidentify.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ void QgsMapToolIdentify::identifyRasterWmsLayer(const QgsPoint& point)
180180
//we need to map the view pixel coordinates
181181
//to WMS layer pixel coordinates
182182
QgsRect viewExtent = mCanvas->extent();
183-
double mupp = mCanvas->mupp();
184-
if(mupp == 0)
183+
double mapUnitsPerPixel = mCanvas->mapUnitsPerPixel();
184+
if(mapUnitsPerPixel == 0)
185185
{
186186
return;
187187
}
@@ -196,7 +196,7 @@ void QgsMapToolIdentify::identifyRasterWmsLayer(const QgsPoint& point)
196196

197197
if(xMinView < xMinLayer)
198198
{
199-
i = (int)(point.x() - (xMinLayer - xMinView) / mupp);
199+
i = (int)(point.x() - (xMinLayer - xMinView) / mapUnitsPerPixel);
200200
}
201201
else
202202
{
@@ -205,7 +205,7 @@ void QgsMapToolIdentify::identifyRasterWmsLayer(const QgsPoint& point)
205205

206206
if(yMaxView > yMaxLayer)
207207
{
208-
j = (int)(point.y() - (yMaxView - yMaxLayer) / mupp);
208+
j = (int)(point.y() - (yMaxView - yMaxLayer) / mapUnitsPerPixel);
209209
}
210210
else
211211
{

‎src/core/composer/qgscomposermap.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ void QgsComposerMap::cache ( void )
147147
}
148148

149149
mCachePixmap = QPixmap( w, h );
150-
double mupp = mExtent.width() / w;
150+
double mapUnitsPerPixel = mExtent.width() / w;
151151

152152
// WARNING: ymax in QgsMapToPixel is device height!!!
153-
QgsMapToPixel transform(mupp, h, mExtent.yMin(), mExtent.xMin() );
153+
QgsMapToPixel transform(mapUnitsPerPixel, h, mExtent.yMin(), mExtent.xMin() );
154154

155155
mCachePixmap.fill(QColor(255,255,255));
156156

‎src/core/composer/qgscomposermap.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@ class CORE_EXPORT QgsComposerMap : /*public QWidget , private Ui::QgsComposerMap
111111
/**Sets offset values to shift image (useful for live updates when moving item content)*/
112112
void setOffset(double xOffset, double yOffset);
113113

114-
/** stores state in DOM node
115-
* @param elem is DOM element corresponding to 'Composer' tag
114+
/** stores state in Dom node
115+
* @param elem is Dom element corresponding to 'Composer' tag
116116
* @param temp write template file
117117
*/
118118
bool writeXML(QDomElement& elem, QDomDocument & doc);
119119

120-
/** sets state from DOM document
121-
* @param itemElem is DOM node corresponding to 'ComposerMap' tag
120+
/** sets state from Dom document
121+
* @param itemElem is Dom node corresponding to 'ComposerMap' tag
122122
*/
123123
bool readXML(const QDomElement& itemElem, const QDomDocument& doc);
124124

‎src/core/qgscoordinatereferencesystem.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,12 @@ class CORE_EXPORT QgsCoordinateReferenceSystem
214214
*/
215215
QString toWkt() const;
216216

217-
/*! Restores state from the given DOM node.
217+
/*! Restores state from the given Dom node.
218218
* @param theNode The node from which state will be restored
219219
* @return bool True on success, False on failure
220220
*/
221221
bool readXML( QDomNode & theNode );
222-
/*! Stores state to the given DOM node in the given document.
222+
/*! Stores state to the given Dom node in the given document.
223223
* Below is an example of the generated tag.
224224
* <spatialrefsys>
225225
* <proj4>+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs </proj4>

‎src/core/qgsmaplayer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ QString QgsMapLayer::loadNamedStyle ( const QString theURI, bool &theResultFlag)
481481
}
482482
else
483483
{
484-
QFileInfo project( QgsProject::instance()->filename() );
484+
QFileInfo project( QgsProject::instance()->setFilename() );
485485
QgsDebugMsg( QString("project filename: %1").arg( project.absoluteFilePath() ) );
486486

487487
QString qml;

‎src/core/qgsmaprenderer.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,36 +140,36 @@ void QgsMapRenderer::adjustExtentToSize()
140140
}
141141

142142
// calculate the translation and scaling parameters
143-
// mupp = map units per pixel
144-
double muppY = static_cast<double>(mExtent.height())
143+
// mapUnitsPerPixel = map units per pixel
144+
double mapUnitsPerPixelY = static_cast<double>(mExtent.height())
145145
/ static_cast<double>(myHeight);
146-
double muppX = static_cast<double>(mExtent.width())
146+
double mapUnitsPerPixelX = static_cast<double>(mExtent.width())
147147
/ static_cast<double>(myWidth);
148-
mMupp = muppY > muppX ? muppY : muppX;
148+
mMapUnitsPerPixel = mapUnitsPerPixelY > mapUnitsPerPixelX ? mapUnitsPerPixelY : mapUnitsPerPixelX;
149149

150150
// calculate the actual extent of the mapCanvas
151151
double dxmin, dxmax, dymin, dymax, whitespace;
152152

153-
if (muppY > muppX)
153+
if (mapUnitsPerPixelY > mapUnitsPerPixelX)
154154
{
155155
dymin = mExtent.yMin();
156156
dymax = mExtent.yMax();
157-
whitespace = ((myWidth * mMupp) - mExtent.width()) * 0.5;
157+
whitespace = ((myWidth * mMapUnitsPerPixel) - mExtent.width()) * 0.5;
158158
dxmin = mExtent.xMin() - whitespace;
159159
dxmax = mExtent.xMax() + whitespace;
160160
}
161161
else
162162
{
163163
dxmin = mExtent.xMin();
164164
dxmax = mExtent.xMax();
165-
whitespace = ((myHeight * mMupp) - mExtent.height()) * 0.5;
165+
whitespace = ((myHeight * mMapUnitsPerPixel) - mExtent.height()) * 0.5;
166166
dymin = mExtent.yMin() - whitespace;
167167
dymax = mExtent.yMax() + whitespace;
168168
}
169169

170170
#ifdef QGISDEBUG
171171
QString myMessage = "+-------------------MapRenderer--------------------------------+\n";
172-
myMessage += QString("Map units per pixel (x,y) : %1, %2\n").arg(muppX).arg(muppY);
172+
myMessage += QString("Map units per pixel (x,y) : %1, %2\n").arg(mapUnitsPerPixelX).arg(mapUnitsPerPixelY);
173173
myMessage += QString("Pixmap dimensions (x,y) : %1, %2\n").arg(myWidth).arg(myHeight);
174174
myMessage += QString("Extent dimensions (x,y) : %1, %2\n").arg(mExtent.width()).arg(mExtent.height());
175175
myMessage += mExtent.toString();
@@ -191,7 +191,7 @@ void QgsMapRenderer::adjustExtentToSize()
191191
QgsLogger::debug("Scale (assuming meters as map units) = 1", mScale, 1, __FILE__, __FUNCTION__, __LINE__);
192192
#endif
193193

194-
newCoordXForm.setParameters(mMupp, dxmin, dymin, myHeight);
194+
newCoordXForm.setParameters(mMapUnitsPerPixel, dxmin, dymin, myHeight);
195195
mRenderContext.setMapToPixel(newCoordXForm);
196196
mRenderContext.setExtent(mExtent);
197197
}

‎src/core/qgsmaprenderer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class CORE_EXPORT QgsMapRenderer : public QObject
6565
/**Sets scale for scale based visibility. Normally, the scale is calculated automatically. This
6666
function is only used to force a preview scale (e.g. for print composer)*/
6767
void setScale(double scale) {mScale = scale;}
68-
double mupp() const { return mMupp; }
68+
double mapUnitsPerPixel() const { return mMapUnitsPerPixel; }
6969

7070
int width() const { return mSize.width(); };
7171
int height() const { return mSize.height(); };
@@ -172,7 +172,7 @@ class CORE_EXPORT QgsMapRenderer : public QObject
172172
bool mDrawing;
173173

174174
//! map units per pixel
175-
double mMupp;
175+
double mMapUnitsPerPixel;
176176

177177
//! Map scale at its current zool level
178178
double mScale;

‎src/core/qgsmaptopixel.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
#include <QPoint>
2020
#include <QTextStream>
2121

22-
QgsMapToPixel::QgsMapToPixel(double mupp,
22+
QgsMapToPixel::QgsMapToPixel(double mapUnitsPerPixel,
2323
double ymax,
2424
double ymin,
2525
double xmin)
26-
: mMapUnitsPerPixel(mupp),
26+
: mMapUnitsPerPixel(mapUnitsPerPixel),
2727
yMax(ymax),
2828
yMin(ymin),
2929
xMin(xmin),
@@ -53,9 +53,9 @@ QgsPoint QgsMapToPixel::toMapCoordinates(int x, int y) const
5353
return toMapPoint(x, y);
5454
}
5555

56-
void QgsMapToPixel::setMapUnitsPerPixel(double mupp)
56+
void QgsMapToPixel::setMapUnitsPerPixel(double mapUnitsPerPixel)
5757
{
58-
mMapUnitsPerPixel = mupp;
58+
mMapUnitsPerPixel = mapUnitsPerPixel;
5959
}
6060

6161
double QgsMapToPixel::mapUnitsPerPixel() const
@@ -78,9 +78,9 @@ void QgsMapToPixel::setXMinimum(double xmin)
7878
xMin = xmin;
7979
}
8080

81-
void QgsMapToPixel::setParameters(double mupp, double xmin, double ymin, double ymax)
81+
void QgsMapToPixel::setParameters(double mapUnitsPerPixel, double xmin, double ymin, double ymax)
8282
{
83-
mMapUnitsPerPixel = mupp;
83+
mMapUnitsPerPixel = mapUnitsPerPixel;
8484
xMin = xmin;
8585
yMin = ymin;
8686
yMax = ymax;

0 commit comments

Comments
 (0)
Please sign in to comment.