Skip to content

Commit 28c3443

Browse files
committed
indentation update
1 parent e27d809 commit 28c3443

13 files changed

+98
-91
lines changed

python/gui/editorwidgets/qgsspinbox.sip

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ class QgsSpinBox : QSpinBox
1010
MinimumValue,
1111
MaximumValue,
1212
CustomValue
13-
};
14-
13+
};
14+
1515
explicit QgsSpinBox( QWidget *parent /TransferThis/ = 0 );
1616

1717
//! determines if the widget will show a clear button
1818
//! @note the clear button will set the widget to its minimum value
1919
void setShowClearButton( const bool showClearButton );
2020
bool showClearButton() const;
21-
21+
2222
/**Sets if the widget will allow entry of simple expressions, which are
2323
* evaluated and then discarded.
2424
* @param enabled set to true to allow expression entry
@@ -53,7 +53,7 @@ class QgsSpinBox : QSpinBox
5353

5454
virtual int valueFromText( const QString & text ) const;
5555
virtual QValidator::State validate( QString & input, int & pos ) const;
56-
56+
5757
protected:
5858
virtual void resizeEvent( QResizeEvent* event );
5959
virtual void changeEvent( QEvent* event );

python/gui/qgsnewmemorylayerdialog.sip

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ class QgsNewMemoryLayerDialog : QDialog
2525
QString layerName() const;
2626

2727
protected slots:
28-
28+
2929
void on_mChangeSrsButton_clicked();
3030
};

src/app/qgisapp.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -1750,16 +1750,16 @@ void QgisApp::createStatusBar()
17501750
mRotationEdit->setObjectName( "mRotationEdit" );
17511751
mRotationEdit->setMaximumWidth( 100 );
17521752
mRotationEdit->setMaximumHeight( 20 );
1753-
mRotationEdit->setRange(-180, 180);
1754-
mRotationEdit->setWrapping(true);
1755-
mRotationEdit->setSingleStep(5.0);
1753+
mRotationEdit->setRange( -180, 180 );
1754+
mRotationEdit->setWrapping( true );
1755+
mRotationEdit->setSingleStep( 5.0 );
17561756
mRotationEdit->setFont( myFont );
17571757
mRotationEdit->setWhatsThis( tr( "Shows the current map clockwise rotation "
1758-
"in degrees. It also allows editing to set "
1759-
"the rotation") );
1758+
"in degrees. It also allows editing to set "
1759+
"the rotation" ) );
17601760
mRotationEdit->setToolTip( tr( "Current clockwise map rotation in degrees" ) );
17611761
statusBar()->addPermanentWidget( mRotationEdit, 0 );
1762-
connect( mRotationEdit, SIGNAL( valueChanged(int) ), this, SLOT( userRotation() ) );
1762+
connect( mRotationEdit, SIGNAL( valueChanged( int ) ), this, SLOT( userRotation() ) );
17631763

17641764
showRotation();
17651765

@@ -6900,7 +6900,7 @@ void QgisApp::userCenter()
69006900
void QgisApp::userRotation()
69016901
{
69026902
double degrees = mRotationEdit->value();
6903-
mMapCanvas->setRotation(degrees);
6903+
mMapCanvas->setRotation( degrees );
69046904
mMapCanvas->refresh();
69056905
}
69066906

src/core/qgsmapsettings.cpp

+14-12
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,16 @@ void QgsMapSettings::updateDerived()
161161
mMapToPixel.setMapRotation( mRotation, visibleExtent().center().x(), visibleExtent().center().y() );
162162

163163
#if 1 // set visible extent taking rotation in consideration
164-
if ( mRotation ) {
165-
QgsPoint p1 = mMapToPixel.toMapCoordinates( QPoint(0,0) );
166-
QgsPoint p2 = mMapToPixel.toMapCoordinates( QPoint(0,myHeight) );
167-
QgsPoint p3 = mMapToPixel.toMapCoordinates( QPoint(myWidth,0) );
168-
QgsPoint p4 = mMapToPixel.toMapCoordinates( QPoint(myWidth,myHeight) );
169-
dxmin = std::min(p1.x(), std::min(p2.x(), std::min(p3.x(), p4.x())));
170-
dymin = std::min(p1.y(), std::min(p2.y(), std::min(p3.y(), p4.y())));
171-
dxmax = std::max(p1.x(), std::max(p2.x(), std::max(p3.x(), p4.x())));
172-
dymax = std::max(p1.y(), std::max(p2.y(), std::max(p3.y(), p4.y())));
164+
if ( mRotation )
165+
{
166+
QgsPoint p1 = mMapToPixel.toMapCoordinates( QPoint( 0, 0 ) );
167+
QgsPoint p2 = mMapToPixel.toMapCoordinates( QPoint( 0, myHeight ) );
168+
QgsPoint p3 = mMapToPixel.toMapCoordinates( QPoint( myWidth, 0 ) );
169+
QgsPoint p4 = mMapToPixel.toMapCoordinates( QPoint( myWidth, myHeight ) );
170+
dxmin = std::min( p1.x(), std::min( p2.x(), std::min( p3.x(), p4.x() ) ) );
171+
dymin = std::min( p1.y(), std::min( p2.y(), std::min( p3.y(), p4.y() ) ) );
172+
dxmax = std::max( p1.x(), std::max( p2.x(), std::max( p3.x(), p4.x() ) ) );
173+
dymax = std::max( p1.y(), std::max( p2.y(), std::max( p3.y(), p4.y() ) ) );
173174
mVisibleExtent.set( dxmin, dymin, dxmax, dymax );
174175
}
175176
#endif
@@ -547,7 +548,8 @@ void QgsMapSettings::readXML( QDomNode& theNode )
547548
// set rotation
548549
QDomNode rotationNode = theNode.namedItem( "rotation" );
549550
QString rotationVal = rotationNode.toElement().text();
550-
if ( ! rotationVal.isEmpty() ) {
551+
if ( ! rotationVal.isEmpty() )
552+
{
551553
double rot = rotationVal.toDouble();
552554
setRotation( rot );
553555
}
@@ -568,9 +570,9 @@ void QgsMapSettings::writeXML( QDomNode& theNode, QDomDocument& theDoc )
568570
// Write current view rotation
569571
QDomElement rotNode = theDoc.createElement( "rotation" );
570572
rotNode.appendChild(
571-
theDoc.createTextNode( qgsDoubleToString( rotation() ) )
573+
theDoc.createTextNode( qgsDoubleToString( rotation() ) )
572574
);
573-
theNode.appendChild(rotNode);
575+
theNode.appendChild( rotNode );
574576

575577
// projections enabled
576578
QDomElement projNode = theDoc.createElement( "projections" );

src/core/qgsmaptopixel.cpp

+18-17
Original file line numberDiff line numberDiff line change
@@ -46,48 +46,49 @@ int QgsMapToPixel::mapHeight() const
4646

4747
int QgsMapToPixel::mapWidth() const
4848
{
49-
return ((xCenter-xMin)*2)/mMapUnitsPerPixel;
49+
return (( xCenter -xMin )*2 ) / mMapUnitsPerPixel;
5050
}
5151

5252
QTransform QgsMapToPixel::getMatrix() const
5353
{
54-
double cy = mapHeight()/2.0;
55-
double cx = mapWidth()/2.0;
54+
double cy = mapHeight() / 2.0;
55+
double cx = mapWidth() / 2.0;
5656
double rotation = mapRotation();
5757

5858
#if 0 // debugging
59-
QgsDebugMsg(QString("XXX %7 -- xCent:%1 yCent:%2 mWidth:%3 mHeight:%4 uPP:%5 rot:%6")
60-
.arg(xCenter).arg(yCenter).arg(mWidth).arg(mHeight)
61-
.arg(mMapUnitsPerPixel).arg(rotation).arg((quintptr)this,QT_POINTER_SIZE *2, 15, QChar('0')));
59+
QgsDebugMsg( QString( "XXX %7 -- xCent:%1 yCent:%2 mWidth:%3 mHeight:%4 uPP:%5 rot:%6" )
60+
.arg( xCenter ).arg( yCenter ).arg( mWidth ).arg( mHeight )
61+
.arg( mMapUnitsPerPixel ).arg( rotation ).arg(( quintptr )this, QT_POINTER_SIZE *2, 15, QChar( '0' ) ) );
6262
#endif
6363

6464
// NOTE: operations are done in the reverse order in which
6565
// they are configured, so translation to geographical
6666
// center happens first, then scaling, then rotation
6767
// and finally translation to output viewport center
6868

69-
if ( ! rotation ) {
69+
if ( ! rotation )
70+
{
7071
// Returning a simplified matrix in hope it'll give expected
7172
// results from an existing test, see
7273
// https://travis-ci.org/qgis/QGIS/builds/42508945
73-
return QTransform::fromScale( 1.0/mMapUnitsPerPixel, -1.0/mMapUnitsPerPixel )
74-
.translate( -xMin, - ( yMin + mHeight*mMapUnitsPerPixel ) );
74+
return QTransform::fromScale( 1.0 / mMapUnitsPerPixel, -1.0 / mMapUnitsPerPixel )
75+
.translate( -xMin, - ( yMin + mHeight*mMapUnitsPerPixel ) );
7576
}
7677

7778
return QTransform::fromTranslate( cx, cy )
7879
.rotate( rotation )
79-
.scale( 1/mMapUnitsPerPixel, -1/mMapUnitsPerPixel )
80-
.translate ( -xCenter, -yCenter )
80+
.scale( 1 / mMapUnitsPerPixel, -1 / mMapUnitsPerPixel )
81+
.translate( -xCenter, -yCenter )
8182
;
8283
}
8384

8485
QgsPoint QgsMapToPixel::toMapPoint( double x, double y ) const
8586
{
8687
bool invertible;
87-
QTransform matrix = getMatrix().inverted(&invertible);
88-
assert(invertible);
88+
QTransform matrix = getMatrix().inverted( &invertible );
89+
assert( invertible );
8990
double mx, my;
90-
matrix.map(x, y, &mx, &my);
91+
matrix.map( x, y, &mx, &my );
9192
QgsPoint ret( mx, my );
9293

9394
//QgsDebugMsg(QString("XXX toMapPoint x:%1 y:%2 -> x:%3 y:%4").arg(x).arg(y).arg(mx).arg(my));
@@ -126,8 +127,8 @@ void QgsMapToPixel::setMapRotation( double degrees, double cx, double cy )
126127
mMapRotation = degrees;
127128
xCenter = cx;
128129
yCenter = cy;
129-
assert(xCenter >= xMin);
130-
assert(yCenter >= yMin);
130+
assert( xCenter >= xMin );
131+
assert( yCenter >= yMin );
131132
//assert(yCenter <= yMin + mHeight*mMapUnitsPerPixel;
132133
}
133134

@@ -206,7 +207,7 @@ void QgsMapToPixel::transformInPlace( qreal& x, qreal& y ) const
206207

207208
QTransform matrix = getMatrix();
208209
double mx, my;
209-
matrix.map(x, y, &mx, &my);
210+
matrix.map( x, y, &mx, &my );
210211
//QgsDebugMsg(QString("XXX transformInPlace X : %1-->%2, Y: %3 -->%4").arg(x).arg(mx).arg(y).arg(my));
211212
x = mx; y = my;
212213
}

src/core/qgsmaptopixel.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ class CORE_EXPORT QgsMapToPixel
7474
@note not available in python bindings
7575
*/
7676
template <class T>
77-
void transformInPlace( QVector<T>& x, QVector<T>& y ) const {
77+
void transformInPlace( QVector<T>& x, QVector<T>& y ) const
78+
{
7879
assert( x.size() == y.size() );
7980
for ( int i = 0; i < x.size(); ++i )
8081
transformInPlace( x[i], y[i] );
@@ -120,7 +121,7 @@ class CORE_EXPORT QgsMapToPixel
120121
//! Set maximum y value
121122
// @deprecated in 2.8, use setViewportHeight
122123
// @note this really sets the viewport height, not ymax
123-
void setYMaximum( double yMax ) { setViewportHeight(yMax); }
124+
void setYMaximum( double yMax ) { setViewportHeight( yMax ); }
124125
//! Set viewport height
125126
//! @note added in 2.8
126127
void setViewportHeight( double height );

src/core/raster/qgsrasterdrawer.cpp

+14-12
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,14 @@ void QgsRasterDrawer::drawImage( QPainter* p, QgsRasterViewPort* viewPort, const
115115
int w = theQgsMapToPixel->mapWidth();
116116
int h = theQgsMapToPixel->mapHeight();
117117

118-
if ( theQgsMapToPixel ) {
118+
if ( theQgsMapToPixel )
119+
{
119120
double rotation = theQgsMapToPixel->mapRotation();
120-
if ( rotation ) {
121+
if ( rotation )
122+
{
121123
// both viewPort and image sizes are dependent on scale
122-
double cx = w/2.0;
123-
double cy = h/2.0;
124+
double cx = w / 2.0;
125+
double cy = h / 2.0;
124126
p->translate( cx, cy );
125127
p->rotate( rotation );
126128
p->translate( -cx, -cy );
@@ -131,19 +133,19 @@ void QgsRasterDrawer::drawImage( QPainter* p, QgsRasterViewPort* viewPort, const
131133

132134
#if 0
133135
// For debugging:
134-
QRectF br = QRectF(tlPoint, img.size());
136+
QRectF br = QRectF( tlPoint, img.size() );
135137
QPointF c = br.center();
136-
double rad = std::max(br.width(),br.height())/10;
138+
double rad = std::max( br.width(), br.height() ) / 10;
137139
p->drawRoundedRect( br, rad, rad );
138-
p->drawLine( QLineF(br.x(), br.y(), br.x()+br.width(), br.y()+br.height()) );
139-
p->drawLine( QLineF(br.x()+br.width(), br.y(), br.x(), br.y()+br.height()) );
140+
p->drawLine( QLineF( br.x(), br.y(), br.x() + br.width(), br.y() + br.height() ) );
141+
p->drawLine( QLineF( br.x() + br.width(), br.y(), br.x(), br.y() + br.height() ) );
140142

141-
double nw = br.width()*0.5; double nh = br.height()*0.5;
142-
br = QRectF(c-QPointF(nw/2,nh/2), QSize(nw, nh));
143+
double nw = br.width() * 0.5; double nh = br.height() * 0.5;
144+
br = QRectF( c - QPointF( nw / 2, nh / 2 ), QSize( nw, nh ) );
143145
p->drawRoundedRect( br, rad, rad );
144146

145-
nw = br.width()*0.5; nh = br.height()*0.5;
146-
br = QRectF(c-QPointF(nw/2,nh/2), QSize(nw, nh));
147+
nw = br.width() * 0.5; nh = br.height() * 0.5;
148+
br = QRectF( c - QPointF( nw / 2, nh / 2 ), QSize( nw, nh ) );
147149
p->drawRoundedRect( br, rad, rad );
148150
#endif
149151

src/core/raster/qgsrasterdrawer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class CORE_EXPORT QgsRasterDrawer
4646
@param topLeftCol Left position relative to left border of viewport
4747
@param topLeftRow Top position relative to top border of viewport
4848
@param mapToPixel map to device coordinate transformation info */
49-
void drawImage( QPainter* p, QgsRasterViewPort* viewPort, const QImage& img, int topLeftCol, int topLeftRow, const QgsMapToPixel* mapToPixel=0 ) const;
49+
void drawImage( QPainter* p, QgsRasterViewPort* viewPort, const QImage& img, int topLeftCol, int topLeftRow, const QgsMapToPixel* mapToPixel = 0 ) const;
5050

5151
private:
5252
QgsRasterIterator* mIterator;

src/core/raster/qgsrasterlayerrenderer.cpp

+8-7
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,17 @@ QgsRasterLayerRenderer::QgsRasterLayerRenderer( QgsRasterLayer* layer, QgsRender
3232
mMapToPixel = &theQgsMapToPixel;
3333

3434
QgsMapToPixel mapToPixel = theQgsMapToPixel;
35-
if ( mapToPixel.mapRotation() ) {
35+
if ( mapToPixel.mapRotation() )
36+
{
3637
// unset rotation for the sake of local computations.
3738
// Rotation will be handled by QPainter later
3839
// TODO: provide a method of QgsMapToPixel to fetch map center
3940
// in geographical units
4041
QgsPoint center = mapToPixel.toMapCoordinates(
41-
mapToPixel.mapWidth()/2.0,
42-
mapToPixel.mapHeight()/2.0
43-
);
44-
mapToPixel.setMapRotation(0, center.x(), center.y());
42+
mapToPixel.mapWidth() / 2.0,
43+
mapToPixel.mapHeight() / 2.0
44+
);
45+
mapToPixel.setMapRotation( 0, center.x(), center.y() );
4546
}
4647

4748
QgsRectangle myProjectedViewExtent;
@@ -133,9 +134,9 @@ QgsRasterLayerRenderer::QgsRasterLayerRenderer( QgsRasterLayer* layer, QgsRender
133134
// recalc myRasterExtent to aligned values
134135
myRasterExtent.set(
135136
mapToPixel.toMapCoordinatesF( mRasterViewPort->mTopLeftPoint.x(),
136-
mRasterViewPort->mBottomRightPoint.y() ),
137+
mRasterViewPort->mBottomRightPoint.y() ),
137138
mapToPixel.toMapCoordinatesF( mRasterViewPort->mBottomRightPoint.x(),
138-
mRasterViewPort->mTopLeftPoint.y() )
139+
mRasterViewPort->mTopLeftPoint.y() )
139140
);
140141

141142
//raster viewport top left / bottom right are already rounded to int

src/gui/qgsmapcanvasitem.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ QRectF QgsMapCanvasItem::toCanvasCoordinates( const QRectF& rect )
7373
QPointF bl( toCanvasCoordinates( rect.bottomLeft() ) );
7474
QPointF br( toCanvasCoordinates( rect.bottomRight() ) );
7575
QPointF tr( toCanvasCoordinates( rect.topRight() ) );
76-
double xmin = std::min(tl.x(), std::min(bl.x(), std::min(br.x(), tr.x())));
77-
double ymin = std::min(tl.y(), std::min(bl.y(), std::min(br.y(), tr.y())));
78-
double xmax = std::max(tl.x(), std::max(bl.x(), std::max(br.x(), tr.x())));
79-
double ymax = std::max(tl.y(), std::max(bl.y(), std::max(br.y(), tr.y())));
76+
double xmin = std::min( tl.x(), std::min( bl.x(), std::min( br.x(), tr.x() ) ) );
77+
double ymin = std::min( tl.y(), std::min( bl.y(), std::min( br.y(), tr.y() ) ) );
78+
double xmax = std::max( tl.x(), std::max( bl.x(), std::max( br.x(), tr.x() ) ) );
79+
double ymax = std::max( tl.y(), std::max( bl.y(), std::max( br.y(), tr.y() ) ) );
8080
return QRectF( QPointF( xmin, ymin ), QPointF( xmax, ymax ) );
8181
}
8282

src/gui/qgsmapcanvasmap.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ void QgsMapCanvasMap::paint( QPainter* painter )
5050
if ( mImage.size() != QSize( w, h ) )
5151
{
5252
QgsDebugMsg( QString( "map paint DIFFERENT SIZE: img %1,%2 item %3,%4" ).arg( mImage.width() ).arg( mImage.height() ).arg( w ).arg( h ) );
53-
int tX = (w-mImage.width())/2.0;
54-
int tY = (h-mImage.height())/2.0;
53+
int tX = ( w - mImage.width() ) / 2.0;
54+
int tY = ( h - mImage.height() ) / 2.0;
5555
int fX = 0;
5656
int fY = 0;
5757
int fW = w;
5858
int fH = h;
59-
painter->drawImage(tX, tY, mImage, fX, fY, fW, fH);
59+
painter->drawImage( tX, tY, mImage, fX, fY, fW, fH );
6060
}
6161
else
6262
{
@@ -67,17 +67,17 @@ void QgsMapCanvasMap::paint( QPainter* painter )
6767
#if 0
6868
QRectF br = boundingRect();
6969
QPointF c = br.center();
70-
double rad = std::max(br.width(),br.height())/10;
70+
double rad = std::max( br.width(), br.height() ) / 10;
7171
painter->drawRoundedRect( br, rad, rad );
72-
painter->drawLine( QLineF(0, 0, br.width(), br.height()) );
73-
painter->drawLine( QLineF(br.width(), 0, 0, br.height()) );
72+
painter->drawLine( QLineF( 0, 0, br.width(), br.height() ) );
73+
painter->drawLine( QLineF( br.width(), 0, 0, br.height() ) );
7474

75-
double nw = br.width()*0.5; double nh = br.height()*0.5;
76-
br = QRectF(c-QPointF(nw/2,nh/2), QSize(nw, nh));
75+
double nw = br.width() * 0.5; double nh = br.height() * 0.5;
76+
br = QRectF( c - QPointF( nw / 2, nh / 2 ), QSize( nw, nh ) );
7777
painter->drawRoundedRect( br, rad, rad );
7878

79-
nw = br.width()*0.5; nh = br.height()*0.5;
80-
br = QRectF(c-QPointF(nw/2,nh/2), QSize(nw, nh));
79+
nw = br.width() * 0.5; nh = br.height() * 0.5;
80+
br = QRectF( c - QPointF( nw / 2, nh / 2 ), QSize( nw, nh ) );
8181
painter->drawRoundedRect( br, rad, rad );
8282
#endif
8383
}

0 commit comments

Comments
 (0)