Skip to content

Commit e6002ec

Browse files
author
jef
committed
reindent georeferencer plugin
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13041 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 9da4554 commit e6002ec

38 files changed

+1747
-1715
lines changed

src/plugins/georeferencer/qgsgcpcanvasitem.cpp

+31-30
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,35 @@
1616

1717
#include "qgsgcpcanvasitem.h"
1818

19-
QgsGCPCanvasItem::QgsGCPCanvasItem(QgsMapCanvas* mapCanvas, const QgsPoint& rasterCoords,
20-
const QgsPoint& worldCoords, bool isGCPSource )
21-
: QgsMapCanvasItem( mapCanvas )
22-
, mPointBrush(Qt::red)
23-
, mLabelBrush(Qt::yellow)
24-
, mRasterCoords(rasterCoords)
25-
, mWorldCoords(worldCoords)
26-
, mId(-1)
27-
, mIsGCPSource(isGCPSource)
28-
, mEnabled(true)
19+
QgsGCPCanvasItem::QgsGCPCanvasItem( QgsMapCanvas* mapCanvas, const QgsPoint& rasterCoords,
20+
const QgsPoint& worldCoords, bool isGCPSource )
21+
: QgsMapCanvasItem( mapCanvas )
22+
, mPointBrush( Qt::red )
23+
, mLabelBrush( Qt::yellow )
24+
, mRasterCoords( rasterCoords )
25+
, mWorldCoords( worldCoords )
26+
, mId( -1 )
27+
, mIsGCPSource( isGCPSource )
28+
, mEnabled( true )
2929
{
30-
setFlags(QGraphicsItem::ItemIsMovable);
30+
setFlags( QGraphicsItem::ItemIsMovable );
3131

3232
updatePosition();
3333
}
3434

3535
void QgsGCPCanvasItem::paint( QPainter* p )
3636
{
37-
p->setRenderHint(QPainter::Antialiasing);
38-
p->setOpacity(mEnabled ? 1.0 : 0.3);
37+
p->setRenderHint( QPainter::Antialiasing );
38+
p->setOpacity( mEnabled ? 1.0 : 0.3 );
3939

4040
// draw the point
4141
p->setPen( Qt::black );
4242
p->setBrush( mPointBrush );
4343
p->drawEllipse( -2, -2, 5, 5 );
4444

4545
QSettings s;
46-
bool showIDs = s.value("/Plugin-GeoReferencer/Config/ShowId").toBool();
47-
if (!showIDs && mIsGCPSource)
46+
bool showIDs = s.value( "/Plugin-GeoReferencer/Config/ShowId" ).toBool();
47+
if ( !showIDs && mIsGCPSource )
4848
{
4949
QString msg = QString( "X %1\nY %2" ).arg( QString::number( mWorldCoords.x(), 'f' ) ).
5050
arg( QString::number( mWorldCoords.y(), 'f' ) );
@@ -53,17 +53,17 @@ void QgsGCPCanvasItem::paint( QPainter* p )
5353
p->setBrush( mLabelBrush );
5454
p->drawRect( textBounds.x() - 2, textBounds.y() - 2, textBounds.width() + 4, textBounds.height() + 4 );
5555
p->drawText( textBounds, Qt::AlignLeft, msg );
56-
mTextBounds = QSizeF(textBounds.width() + 4, textBounds.height() + 4);
56+
mTextBounds = QSizeF( textBounds.width() + 4, textBounds.height() + 4 );
5757
}
58-
else if (showIDs)
58+
else if ( showIDs )
5959
{
6060
p->setFont( QFont( "helvetica", 12 ) );
61-
QString msg = QString::number(mId);
61+
QString msg = QString::number( mId );
6262
p->setBrush( mLabelBrush );
63-
p->drawRect( 5, 4, p->fontMetrics().width(msg) + 2, 14 );
64-
p->drawText(6, 16, msg);
63+
p->drawRect( 5, 4, p->fontMetrics().width( msg ) + 2, 14 );
64+
p->drawText( 6, 16, msg );
6565
QFontMetrics fm = p->fontMetrics();
66-
mTextBounds = QSize(fm.width(msg) + 4, fm.height() + 4);
66+
mTextBounds = QSize( fm.width( msg ) + 4, fm.height() + 4 );
6767
}
6868
// else
6969
// mTextBounds = QSizeF(0, 0);
@@ -77,36 +77,37 @@ QRectF QgsGCPCanvasItem::boundingRect() const
7777
QPainterPath QgsGCPCanvasItem::shape() const
7878
{
7979
QPainterPath p;
80-
p.addEllipse(-2, -2, 5, 5);
81-
p.addRect(6, 6, mTextBounds.width(), mTextBounds.height());
80+
p.addEllipse( -2, -2, 5, 5 );
81+
p.addRect( 6, 6, mTextBounds.width(), mTextBounds.height() );
8282

8383
return p;
8484
}
8585

86-
void QgsGCPCanvasItem::setEnabled(bool enabled)
86+
void QgsGCPCanvasItem::setEnabled( bool enabled )
8787
{
8888
mEnabled = enabled;
89-
mPointBrush = enabled ? QBrush(Qt::red) : QBrush(Qt::gray);
90-
mLabelBrush = enabled ? QBrush(Qt::yellow) : QBrush(Qt::gray);
89+
mPointBrush = enabled ? QBrush( Qt::red ) : QBrush( Qt::gray );
90+
mLabelBrush = enabled ? QBrush( Qt::yellow ) : QBrush( Qt::gray );
9191
update();
9292
}
9393

94-
void QgsGCPCanvasItem::setRasterCoords(QgsPoint p)
94+
void QgsGCPCanvasItem::setRasterCoords( QgsPoint p )
9595
{
9696
mRasterCoords = p;
9797
}
9898

99-
void QgsGCPCanvasItem::setWorldCoords(QgsPoint p)
99+
void QgsGCPCanvasItem::setWorldCoords( QgsPoint p )
100100
{
101101
mWorldCoords = p;
102102
}
103103

104-
void QgsGCPCanvasItem::setId(int id) {
104+
void QgsGCPCanvasItem::setId( int id )
105+
{
105106
mId = id;
106107
update();
107108
}
108109

109110
void QgsGCPCanvasItem::updatePosition()
110111
{
111-
setPos( toCanvasCoordinates( mIsGCPSource ? mRasterCoords : mWorldCoords) );
112+
setPos( toCanvasCoordinates( mIsGCPSource ? mRasterCoords : mWorldCoords ) );
112113
}

src/plugins/georeferencer/qgsgcpcanvasitem.h

+25-24
Original file line numberDiff line numberDiff line change
@@ -20,39 +20,40 @@
2020
#include "qgsmapcanvas.h"
2121
#include "qgsmapcanvasitem.h"
2222

23-
class QgsGCPCanvasItem : public QgsMapCanvasItem {
24-
public:
25-
QgsGCPCanvasItem( QgsMapCanvas* mapCanvas, const QgsPoint& rasterCoords,
26-
const QgsPoint& worldCoords, bool isGCPSource/* = true*/ );
23+
class QgsGCPCanvasItem : public QgsMapCanvasItem
24+
{
25+
public:
26+
QgsGCPCanvasItem( QgsMapCanvas* mapCanvas, const QgsPoint& rasterCoords,
27+
const QgsPoint& worldCoords, bool isGCPSource/* = true*/ );
2728

28-
//! draws point information
29-
void paint( QPainter* p );
29+
//! draws point information
30+
void paint( QPainter* p );
3031

31-
//! handler for manual updating of position and size
32-
QRectF boundingRect() const;
32+
//! handler for manual updating of position and size
33+
QRectF boundingRect() const;
3334

34-
QPainterPath shape() const;
35+
QPainterPath shape() const;
3536

36-
void setEnabled(bool enabled);
37+
void setEnabled( bool enabled );
3738

38-
void setRasterCoords(QgsPoint p);
39-
void setWorldCoords(QgsPoint p);
39+
void setRasterCoords( QgsPoint p );
40+
void setWorldCoords( QgsPoint p );
4041

41-
int id() { return mId; }
42-
void setId(int id);
42+
int id() { return mId; }
43+
void setId( int id );
4344

44-
void updatePosition();
45+
void updatePosition();
4546

46-
private:
47-
QSizeF mTextBounds;
48-
QBrush mPointBrush;
49-
QBrush mLabelBrush;
50-
QgsPoint mRasterCoords;
51-
QgsPoint mWorldCoords;
47+
private:
48+
QSizeF mTextBounds;
49+
QBrush mPointBrush;
50+
QBrush mLabelBrush;
51+
QgsPoint mRasterCoords;
52+
QgsPoint mWorldCoords;
5253

53-
int mId;
54-
bool mIsGCPSource;
55-
bool mEnabled;
54+
int mId;
55+
bool mIsGCPSource;
56+
bool mEnabled;
5657
};
5758

5859
#endif // QGSGCPCANVASITEM_H

src/plugins/georeferencer/qgsgcplist.cpp

+19-19
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,30 @@
2020
#include "qgsgcplist.h"
2121

2222
QgsGCPList::QgsGCPList()
23-
: QList<QgsGeorefDataPoint *>()
23+
: QList<QgsGeorefDataPoint *>()
2424
{
2525
}
2626

27-
QgsGCPList::QgsGCPList(const QgsGCPList &list)
27+
QgsGCPList::QgsGCPList( const QgsGCPList &list )
2828
{
2929
clear();
3030
QgsGCPList::const_iterator it = list.constBegin();
31-
for (; it != list.constEnd(); ++it)
31+
for ( ; it != list.constEnd(); ++it )
3232
{
33-
QgsGeorefDataPoint *pt = new QgsGeorefDataPoint(**it);
34-
append(pt);
33+
QgsGeorefDataPoint *pt = new QgsGeorefDataPoint( **it );
34+
append( pt );
3535
}
3636
}
3737

38-
void QgsGCPList::createGCPVectors(std::vector<QgsPoint> &mapCoords,
39-
std::vector<QgsPoint> &pixelCoords)
38+
void QgsGCPList::createGCPVectors( std::vector<QgsPoint> &mapCoords,
39+
std::vector<QgsPoint> &pixelCoords )
4040
{
41-
mapCoords = std::vector<QgsPoint>(size());
42-
pixelCoords = std::vector<QgsPoint>(size());
43-
for (int i = 0, j = 0; i < sizeAll(); i++)
41+
mapCoords = std::vector<QgsPoint>( size() );
42+
pixelCoords = std::vector<QgsPoint>( size() );
43+
for ( int i = 0, j = 0; i < sizeAll(); i++ )
4444
{
45-
QgsGeorefDataPoint *pt = at(i);
46-
if (pt->isEnabled())
45+
QgsGeorefDataPoint *pt = at( i );
46+
if ( pt->isEnabled() )
4747
{
4848
mapCoords[j] = pt->mapCoords();
4949
pixelCoords[j] = pt->pixelCoords();
@@ -54,14 +54,14 @@ void QgsGCPList::createGCPVectors(std::vector<QgsPoint> &mapCoords,
5454

5555
int QgsGCPList::size() const
5656
{
57-
if (QList<QgsGeorefDataPoint *>::isEmpty())
57+
if ( QList<QgsGeorefDataPoint *>::isEmpty() )
5858
return 0;
5959

6060
int s = 0;
6161
const_iterator it = begin();
62-
while (it != end())
62+
while ( it != end() )
6363
{
64-
if ((*it)->isEnabled()) s++;
64+
if (( *it )->isEnabled() ) s++;
6565
it++;
6666
}
6767
return s;
@@ -72,14 +72,14 @@ int QgsGCPList::sizeAll() const
7272
return QList<QgsGeorefDataPoint *>::size();
7373
}
7474

75-
QgsGCPList &QgsGCPList::operator =(const QgsGCPList &list)
75+
QgsGCPList &QgsGCPList::operator =( const QgsGCPList & list )
7676
{
7777
clear();
7878
QgsGCPList::const_iterator it = list.constBegin();
79-
for (; it != list.constEnd(); ++it)
79+
for ( ; it != list.constEnd(); ++it )
8080
{
81-
QgsGeorefDataPoint *pt = new QgsGeorefDataPoint(**it);
82-
append(pt);
81+
QgsGeorefDataPoint *pt = new QgsGeorefDataPoint( **it );
82+
append( pt );
8383
}
8484
return *this;
8585
}

src/plugins/georeferencer/qgsgcplist.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ class QgsPoint;
2626
// what is better use inherid or agrigate QList?
2727
class QgsGCPList : public QList<QgsGeorefDataPoint *>
2828
{
29-
public:
30-
QgsGCPList();
31-
QgsGCPList(const QgsGCPList &list);
29+
public:
30+
QgsGCPList();
31+
QgsGCPList( const QgsGCPList &list );
3232

33-
void createGCPVectors(std::vector<QgsPoint> &mapCoords,
34-
std::vector<QgsPoint> &pixelCoords);
35-
int size() const;
36-
int sizeAll() const;
33+
void createGCPVectors( std::vector<QgsPoint> &mapCoords,
34+
std::vector<QgsPoint> &pixelCoords );
35+
int size() const;
36+
int sizeAll() const;
3737

38-
QgsGCPList &operator =(const QgsGCPList &list);
38+
QgsGCPList &operator =( const QgsGCPList &list );
3939
};
4040

4141
//typedef std::vector<QgsGeorefDataPoint *> QgsGCPList;

0 commit comments

Comments
 (0)