Skip to content
Permalink
Browse files

reindent georeferencer plugin

git-svn-id: http://svn.osgeo.org/qgis/trunk@13041 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Mar 10, 2010
1 parent 4e23117 commit 9da13b63c7ea04eae823c418fe216dd36b885267
Showing with 1,747 additions and 1,715 deletions.
  1. +31 −30 src/plugins/georeferencer/qgsgcpcanvasitem.cpp
  2. +25 −24 src/plugins/georeferencer/qgsgcpcanvasitem.h
  3. +19 −19 src/plugins/georeferencer/qgsgcplist.cpp
  4. +8 −8 src/plugins/georeferencer/qgsgcplist.h
  5. +77 −72 src/plugins/georeferencer/qgsgcplistmodel.cpp
  6. +13 −13 src/plugins/georeferencer/qgsgcplistmodel.h
  7. +85 −85 src/plugins/georeferencer/qgsgcplistwidget.cpp
  8. +33 −33 src/plugins/georeferencer/qgsgcplistwidget.h
  9. +17 −15 src/plugins/georeferencer/qgsgeorefconfigdialog.cpp
  10. +13 −12 src/plugins/georeferencer/qgsgeorefconfigdialog.h
  11. +27 −26 src/plugins/georeferencer/qgsgeorefdatapoint.cpp
  12. +32 −32 src/plugins/georeferencer/qgsgeorefdatapoint.h
  13. +41 −41 src/plugins/georeferencer/qgsgeorefdelegates.cpp
  14. +34 −31 src/plugins/georeferencer/qgsgeorefdelegates.h
  15. +1 −1 src/plugins/georeferencer/qgsgeorefdescriptiondialog.h
  16. +26 −26 src/plugins/georeferencer/qgsgeorefplugin.cpp
  17. +1 −1 src/plugins/georeferencer/qgsgeorefplugin.h
  18. +410 −408 src/plugins/georeferencer/qgsgeorefplugingui.cpp
  19. +166 −166 src/plugins/georeferencer/qgsgeorefplugingui.h
  20. +1 −1 src/plugins/georeferencer/qgsgeoreftooladdpoint.cpp
  21. +7 −7 src/plugins/georeferencer/qgsgeoreftooladdpoint.h
  22. +2 −2 src/plugins/georeferencer/qgsgeoreftooldeletepoint.cpp
  23. +7 −7 src/plugins/georeferencer/qgsgeoreftooldeletepoint.h
  24. +10 −10 src/plugins/georeferencer/qgsgeoreftoolmovepoint.cpp
  25. +15 −15 src/plugins/georeferencer/qgsgeoreftoolmovepoint.h
  26. +156 −148 src/plugins/georeferencer/qgsgeoreftransform.cpp
  27. +105 −102 src/plugins/georeferencer/qgsgeoreftransform.h
  28. +30 −30 src/plugins/georeferencer/qgsgeorefvalidators.cpp
  29. +3 −3 src/plugins/georeferencer/qgsgeorefvalidators.h
  30. +79 −79 src/plugins/georeferencer/qgsimagewarper.cpp
  31. +15 −14 src/plugins/georeferencer/qgsimagewarper.h
  32. +31 −31 src/plugins/georeferencer/qgsmapcoordsdialog.cpp
  33. +35 −35 src/plugins/georeferencer/qgsmapcoordsdialog.h
  34. +26 −25 src/plugins/georeferencer/qgsopenrasterdialog.cpp
  35. +16 −15 src/plugins/georeferencer/qgsopenrasterdialog.h
  36. +101 −100 src/plugins/georeferencer/qgstransformsettingsdialog.cpp
  37. +29 −29 src/plugins/georeferencer/qgstransformsettingsdialog.h
  38. +20 −19 src/plugins/georeferencer/qgsvalidateddoublespinbox.h
@@ -16,35 +16,35 @@

#include "qgsgcpcanvasitem.h"

QgsGCPCanvasItem::QgsGCPCanvasItem(QgsMapCanvas* mapCanvas, const QgsPoint& rasterCoords,
const QgsPoint& worldCoords, bool isGCPSource )
: QgsMapCanvasItem( mapCanvas )
, mPointBrush(Qt::red)
, mLabelBrush(Qt::yellow)
, mRasterCoords(rasterCoords)
, mWorldCoords(worldCoords)
, mId(-1)
, mIsGCPSource(isGCPSource)
, mEnabled(true)
QgsGCPCanvasItem::QgsGCPCanvasItem( QgsMapCanvas* mapCanvas, const QgsPoint& rasterCoords,
const QgsPoint& worldCoords, bool isGCPSource )
: QgsMapCanvasItem( mapCanvas )
, mPointBrush( Qt::red )
, mLabelBrush( Qt::yellow )
, mRasterCoords( rasterCoords )
, mWorldCoords( worldCoords )
, mId( -1 )
, mIsGCPSource( isGCPSource )
, mEnabled( true )
{
setFlags(QGraphicsItem::ItemIsMovable);
setFlags( QGraphicsItem::ItemIsMovable );

updatePosition();
}

void QgsGCPCanvasItem::paint( QPainter* p )
{
p->setRenderHint(QPainter::Antialiasing);
p->setOpacity(mEnabled ? 1.0 : 0.3);
p->setRenderHint( QPainter::Antialiasing );
p->setOpacity( mEnabled ? 1.0 : 0.3 );

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

QSettings s;
bool showIDs = s.value("/Plugin-GeoReferencer/Config/ShowId").toBool();
if (!showIDs && mIsGCPSource)
bool showIDs = s.value( "/Plugin-GeoReferencer/Config/ShowId" ).toBool();
if ( !showIDs && mIsGCPSource )
{
QString msg = QString( "X %1\nY %2" ).arg( QString::number( mWorldCoords.x(), 'f' ) ).
arg( QString::number( mWorldCoords.y(), 'f' ) );
@@ -53,17 +53,17 @@ void QgsGCPCanvasItem::paint( QPainter* p )
p->setBrush( mLabelBrush );
p->drawRect( textBounds.x() - 2, textBounds.y() - 2, textBounds.width() + 4, textBounds.height() + 4 );
p->drawText( textBounds, Qt::AlignLeft, msg );
mTextBounds = QSizeF(textBounds.width() + 4, textBounds.height() + 4);
mTextBounds = QSizeF( textBounds.width() + 4, textBounds.height() + 4 );
}
else if (showIDs)
else if ( showIDs )
{
p->setFont( QFont( "helvetica", 12 ) );
QString msg = QString::number(mId);
QString msg = QString::number( mId );
p->setBrush( mLabelBrush );
p->drawRect( 5, 4, p->fontMetrics().width(msg) + 2, 14 );
p->drawText(6, 16, msg);
p->drawRect( 5, 4, p->fontMetrics().width( msg ) + 2, 14 );
p->drawText( 6, 16, msg );
QFontMetrics fm = p->fontMetrics();
mTextBounds = QSize(fm.width(msg) + 4, fm.height() + 4);
mTextBounds = QSize( fm.width( msg ) + 4, fm.height() + 4 );
}
// else
// mTextBounds = QSizeF(0, 0);
@@ -77,36 +77,37 @@ QRectF QgsGCPCanvasItem::boundingRect() const
QPainterPath QgsGCPCanvasItem::shape() const
{
QPainterPath p;
p.addEllipse(-2, -2, 5, 5);
p.addRect(6, 6, mTextBounds.width(), mTextBounds.height());
p.addEllipse( -2, -2, 5, 5 );
p.addRect( 6, 6, mTextBounds.width(), mTextBounds.height() );

return p;
}

void QgsGCPCanvasItem::setEnabled(bool enabled)
void QgsGCPCanvasItem::setEnabled( bool enabled )
{
mEnabled = enabled;
mPointBrush = enabled ? QBrush(Qt::red) : QBrush(Qt::gray);
mLabelBrush = enabled ? QBrush(Qt::yellow) : QBrush(Qt::gray);
mPointBrush = enabled ? QBrush( Qt::red ) : QBrush( Qt::gray );
mLabelBrush = enabled ? QBrush( Qt::yellow ) : QBrush( Qt::gray );
update();
}

void QgsGCPCanvasItem::setRasterCoords(QgsPoint p)
void QgsGCPCanvasItem::setRasterCoords( QgsPoint p )
{
mRasterCoords = p;
}

void QgsGCPCanvasItem::setWorldCoords(QgsPoint p)
void QgsGCPCanvasItem::setWorldCoords( QgsPoint p )
{
mWorldCoords = p;
}

void QgsGCPCanvasItem::setId(int id) {
void QgsGCPCanvasItem::setId( int id )
{
mId = id;
update();
}

void QgsGCPCanvasItem::updatePosition()
{
setPos( toCanvasCoordinates( mIsGCPSource ? mRasterCoords : mWorldCoords) );
setPos( toCanvasCoordinates( mIsGCPSource ? mRasterCoords : mWorldCoords ) );
}
@@ -20,39 +20,40 @@
#include "qgsmapcanvas.h"
#include "qgsmapcanvasitem.h"

class QgsGCPCanvasItem : public QgsMapCanvasItem {
public:
QgsGCPCanvasItem( QgsMapCanvas* mapCanvas, const QgsPoint& rasterCoords,
const QgsPoint& worldCoords, bool isGCPSource/* = true*/ );
class QgsGCPCanvasItem : public QgsMapCanvasItem
{
public:
QgsGCPCanvasItem( QgsMapCanvas* mapCanvas, const QgsPoint& rasterCoords,
const QgsPoint& worldCoords, bool isGCPSource/* = true*/ );

//! draws point information
void paint( QPainter* p );
//! draws point information
void paint( QPainter* p );

//! handler for manual updating of position and size
QRectF boundingRect() const;
//! handler for manual updating of position and size
QRectF boundingRect() const;

QPainterPath shape() const;
QPainterPath shape() const;

void setEnabled(bool enabled);
void setEnabled( bool enabled );

void setRasterCoords(QgsPoint p);
void setWorldCoords(QgsPoint p);
void setRasterCoords( QgsPoint p );
void setWorldCoords( QgsPoint p );

int id() { return mId; }
void setId(int id);
int id() { return mId; }
void setId( int id );

void updatePosition();
void updatePosition();

private:
QSizeF mTextBounds;
QBrush mPointBrush;
QBrush mLabelBrush;
QgsPoint mRasterCoords;
QgsPoint mWorldCoords;
private:
QSizeF mTextBounds;
QBrush mPointBrush;
QBrush mLabelBrush;
QgsPoint mRasterCoords;
QgsPoint mWorldCoords;

int mId;
bool mIsGCPSource;
bool mEnabled;
int mId;
bool mIsGCPSource;
bool mEnabled;
};

#endif // QGSGCPCANVASITEM_H
@@ -20,30 +20,30 @@
#include "qgsgcplist.h"

QgsGCPList::QgsGCPList()
: QList<QgsGeorefDataPoint *>()
: QList<QgsGeorefDataPoint *>()
{
}

QgsGCPList::QgsGCPList(const QgsGCPList &list)
QgsGCPList::QgsGCPList( const QgsGCPList &list )
{
clear();
QgsGCPList::const_iterator it = list.constBegin();
for (; it != list.constEnd(); ++it)
for ( ; it != list.constEnd(); ++it )
{
QgsGeorefDataPoint *pt = new QgsGeorefDataPoint(**it);
append(pt);
QgsGeorefDataPoint *pt = new QgsGeorefDataPoint( **it );
append( pt );
}
}

void QgsGCPList::createGCPVectors(std::vector<QgsPoint> &mapCoords,
std::vector<QgsPoint> &pixelCoords)
void QgsGCPList::createGCPVectors( std::vector<QgsPoint> &mapCoords,
std::vector<QgsPoint> &pixelCoords )
{
mapCoords = std::vector<QgsPoint>(size());
pixelCoords = std::vector<QgsPoint>(size());
for (int i = 0, j = 0; i < sizeAll(); i++)
mapCoords = std::vector<QgsPoint>( size() );
pixelCoords = std::vector<QgsPoint>( size() );
for ( int i = 0, j = 0; i < sizeAll(); i++ )
{
QgsGeorefDataPoint *pt = at(i);
if (pt->isEnabled())
QgsGeorefDataPoint *pt = at( i );
if ( pt->isEnabled() )
{
mapCoords[j] = pt->mapCoords();
pixelCoords[j] = pt->pixelCoords();
@@ -54,14 +54,14 @@ void QgsGCPList::createGCPVectors(std::vector<QgsPoint> &mapCoords,

int QgsGCPList::size() const
{
if (QList<QgsGeorefDataPoint *>::isEmpty())
if ( QList<QgsGeorefDataPoint *>::isEmpty() )
return 0;

int s = 0;
const_iterator it = begin();
while (it != end())
while ( it != end() )
{
if ((*it)->isEnabled()) s++;
if (( *it )->isEnabled() ) s++;
it++;
}
return s;
@@ -72,14 +72,14 @@ int QgsGCPList::sizeAll() const
return QList<QgsGeorefDataPoint *>::size();
}

QgsGCPList &QgsGCPList::operator =(const QgsGCPList &list)
QgsGCPList &QgsGCPList::operator =( const QgsGCPList & list )
{
clear();
QgsGCPList::const_iterator it = list.constBegin();
for (; it != list.constEnd(); ++it)
for ( ; it != list.constEnd(); ++it )
{
QgsGeorefDataPoint *pt = new QgsGeorefDataPoint(**it);
append(pt);
QgsGeorefDataPoint *pt = new QgsGeorefDataPoint( **it );
append( pt );
}
return *this;
}
@@ -26,16 +26,16 @@ class QgsPoint;
// what is better use inherid or agrigate QList?
class QgsGCPList : public QList<QgsGeorefDataPoint *>
{
public:
QgsGCPList();
QgsGCPList(const QgsGCPList &list);
public:
QgsGCPList();
QgsGCPList( const QgsGCPList &list );

void createGCPVectors(std::vector<QgsPoint> &mapCoords,
std::vector<QgsPoint> &pixelCoords);
int size() const;
int sizeAll() const;
void createGCPVectors( std::vector<QgsPoint> &mapCoords,
std::vector<QgsPoint> &pixelCoords );
int size() const;
int sizeAll() const;

QgsGCPList &operator =(const QgsGCPList &list);
QgsGCPList &operator =( const QgsGCPList &list );
};

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

0 comments on commit 9da13b6

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