Skip to content

Commit

Permalink
Cleaned up a bunch of debug statments.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8417 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
StevenB authored and StevenB committed May 9, 2008
1 parent a5e45ca commit adf55f5
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 29 deletions.
28 changes: 20 additions & 8 deletions src/app/composer/qgscomposerlabel.cpp
Expand Up @@ -31,7 +31,9 @@ QgsComposerLabel::QgsComposerLabel ( QgsComposition *composition, int id,
{
setupUi(this);

//std::cout << "QgsComposerLabel::QgsComposerLabel()" << std::endl;
#ifdef QGISDEBUG
std::cout << "QgsComposerLabel::QgsComposerLabel()" << std::endl;
#endif

mComposition = composition;
mId = id;
Expand Down Expand Up @@ -64,7 +66,9 @@ QgsComposerLabel::QgsComposerLabel ( QgsComposition *composition, int id,
QgsComposerLabel::QgsComposerLabel ( QgsComposition *composition, int id )
: QAbstractGraphicsShapeItem(0)
{
//std::cout << "QgsComposerLabel::QgsComposerLabel()" << std::endl;
#ifdef QGISDEBUG
std::cout << "QgsComposerLabel::QgsComposerLabel()" << std::endl;
#endif

setupUi(this);

Expand All @@ -86,7 +90,10 @@ QgsComposerLabel::QgsComposerLabel ( QgsComposition *composition, int id )

QgsComposerLabel::~QgsComposerLabel()
{
//std::cout << "QgsComposerLabel::~QgsComposerLabel" << std::endl;
#ifdef QGISDEBUG
std::cout << "QgsComposerLabel::~QgsComposerLabel" << std::endl;
#endif
//make ourselves disappear so there aren't any interesting effects when we get destroyed
QGraphicsItem::hide();
}

Expand All @@ -96,7 +103,9 @@ QgsComposerLabel::~QgsComposerLabel()
#define WIDTH_EXTENSION 1.0
void QgsComposerLabel::paint ( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget )
{
//std::cout << "QgsComposerLabel::paint" << std::endl;
#ifdef QGISDEBUG
std::cout << "QgsComposerLabel::paint" << std::endl;
#endif

float size = 25.4 * mComposition->scale() * mFont.pointSizeF() / 72;

Expand Down Expand Up @@ -234,7 +243,9 @@ QRectF QgsComposerLabel::boundingRect ( void ) const

QPolygonF QgsComposerLabel::areaPoints() const
{
//std::cout << "QgsComposerLabel::areaPoints" << std::endl;
#ifdef QGISDEBUG
std::cout << "QgsComposerLabel::areaPoints" << std::endl;
#endif
QRectF r = boundingRect();

QPolygonF pa;
Expand Down Expand Up @@ -268,11 +279,12 @@ void QgsComposerLabel::on_mTextEdit_textChanged()

void QgsComposerLabel::setSelected ( bool s )
{
//std::cout << "QgsComposerLabel::setSelected" << std::endl;
#ifdef QGISDEBUG
std::cout << "QgsComposerLabel::setSelected" << std::endl;
#endif

mSelected = s;
QAbstractGraphicsShapeItem::update(); // show highlight

std::cout << "mSelected = " << mSelected << std::endl;
}

bool QgsComposerLabel::selected( void )
Expand Down
32 changes: 25 additions & 7 deletions src/app/composer/qgscomposermap.cpp
Expand Up @@ -42,8 +42,9 @@
QgsComposerMap::QgsComposerMap ( QgsComposition *composition, int id, int x, int y, int width, int height )
: QWidget(), QGraphicsRectItem(0,0,width,height,0)
{
std::cout << "QgsComposerMap::QgsComposerMap()" << std::endl;

#ifdef QGISDEBUG
std::cout << "QgsComposerMap::QgsComposerMap()" << std::endl;
#endif
setupUi(this);

mComposition = composition;
Expand Down Expand Up @@ -119,7 +120,9 @@ void QgsComposerMap::init ()

QgsComposerMap::~QgsComposerMap()
{
#ifdef QGISDEBUG
std::cerr << "QgsComposerMap::~QgsComposerMap" << std::endl;
#endif
}

/* This function is called by paint() and cache() to render the map. It does not override any functions
Expand Down Expand Up @@ -265,7 +268,9 @@ void QgsComposerMap::setUserExtent ( QgsRect const & rect )

void QgsComposerMap::cache ( void )
{
#ifdef QGISDEBUG
std::cout << "QgsComposerMap::cache()" << std::endl;
#endif

// Create preview on some reasonable size. It was slow with cca 1500x1500 points on 2x1.5GHz
// Note: The resolution should also respect the line widths, it means that
Expand All @@ -278,8 +283,10 @@ void QgsComposerMap::cache ( void )
// It can happen that extent is not initialised well -> check
if ( h < 1 || h > 10000 ) h = w;

#ifdef QGISDEBUG
std::cout << "extent = " << mExtent.width() << " x " << mExtent.height() << std::endl;
std::cout << "cache = " << w << " x " << h << std::endl;
#endif

mCacheExtent = QgsRect ( mExtent );
double scale = mExtent.width() / w;
Expand All @@ -299,7 +306,9 @@ void QgsComposerMap::cache ( void )
* on both the cache, screen render, and print.
*/

#ifdef QGISDEBUG
std::cout << "transform = " << transform.showParameters().toLocal8Bit().data() << std::endl;
#endif

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

Expand All @@ -317,21 +326,23 @@ void QgsComposerMap::paint ( QPainter* painter, const QStyleOptionGraphicsItem*
if ( mDrawing ) return;
mDrawing = true;

#ifdef QGISDEBUG
std::cout << "QgsComposerMapt::paint mPlotStyle = " << plotStyle()
<< " mPreviewMode = " << mPreviewMode << std::endl;
#endif

if ( plotStyle() == QgsComposition::Preview && mPreviewMode == Cache ) { // Draw from cache
std::cout << "use cache" << std::endl;

if ( !mCacheUpdated || mMapCanvas->layerCount() != mNumCachedLayers )
{
cache();
}

// Scale so that the cache fills the map rectangle
double scale = 1.0 * QGraphicsRectItem::rect().width() / mCachePixmap.width();
#ifdef QGISDEBUG
std::cout << "scale = " << scale << std::endl;

#endif

painter->save();

painter->translate(0, 0); //do we need this?
Expand All @@ -346,7 +357,9 @@ void QgsComposerMap::paint ( QPainter* painter, const QStyleOptionGraphicsItem*
plotStyle() == QgsComposition::Print ||
plotStyle() == QgsComposition::Postscript )
{
#ifdef QGISDEBUG
std::cout << "render" << std::endl;
#endif

double scale = mExtent.width() / QGraphicsRectItem::rect().width();
QgsMapToPixel transform(scale, QGraphicsRectItem::rect().height(), mExtent.yMin(), mExtent.xMin() );
Expand Down Expand Up @@ -503,8 +516,9 @@ void QgsComposerMap::on_mWidthScaleLineEdit_editingFinished ( void ) { scaleChan

void QgsComposerMap::mapCanvasChanged ( void )
{
#ifdef QGISDEBUG
std::cout << "QgsComposerMap::canvasChanged" << std::endl;

#endif
mCacheUpdated = false;
QGraphicsRectItem::update();
}
Expand Down Expand Up @@ -562,9 +576,11 @@ void QgsComposerMap::recalculate ( void )
mExtent.setYmax ( yc + height/2 );
}

#ifdef QGISDEBUG
std::cout << "mUserExtent = " << mUserExtent.stringRep().toLocal8Bit().data() << std::endl;
std::cout << "mScale = " << mScale << std::endl;
std::cout << "mExtent = " << mExtent.stringRep().toLocal8Bit().data() << std::endl;
#endif

setOptions();
mCacheUpdated = false;
Expand All @@ -581,8 +597,10 @@ void QgsComposerMap::on_mFrameCheckBox_clicked ( )


void QgsComposerMap::setOptions ( void )
{
{
#ifdef QGISDEBUG
std::cout << "QgsComposerMap::setOptions" << std::endl;
#endif

mNameLabel->setText ( mName );

Expand Down
2 changes: 0 additions & 2 deletions src/app/composer/qgscomposerpicture.cpp
Expand Up @@ -33,8 +33,6 @@

#define PI 3.14159265358979323846

#define QGISDEBUG 1

QgsComposerPicture::QgsComposerPicture ( QgsComposition *composition,
int id, QString file )
: QWidget(composition),
Expand Down
14 changes: 14 additions & 0 deletions src/app/composer/qgscomposerscalebar.cpp
Expand Up @@ -36,7 +36,10 @@ QgsComposerScalebar::QgsComposerScalebar ( QgsComposition *composition, int id,
{
setupUi(this);

#ifdef QGISDEBUG
std::cout << "QgsComposerScalebar::QgsComposerScalebar()" << std::endl;
#endif

mId = id;
mSelected = false;

Expand Down Expand Up @@ -120,7 +123,9 @@ QgsComposerScalebar::QgsComposerScalebar ( QgsComposition *composition, int id )
mMap(0),
mBrush(QColor(150,150,150))
{
#ifdef QGISDEBUG
std::cout << "QgsComposerScalebar::QgsComposerScalebar()" << std::endl;
#endif

setupUi(this);

Expand Down Expand Up @@ -410,7 +415,9 @@ void QgsComposerScalebar::moveBy(double x, double y)

void QgsComposerScalebar::recalculate(void)
{
#ifdef QGISDEBUG
std::cout << "QgsComposerScalebar::recalculate" << std::endl;
#endif

// !!! prepareGeometryChange() MUST BE called before the value returned by areaPoints() changes
//Is this still true after the port to GraphicsView?
Expand All @@ -423,13 +430,17 @@ void QgsComposerScalebar::recalculate(void)

QRectF QgsComposerScalebar::boundingRect(void) const
{
#ifdef QGISDEBUG
std::cout << "QgsComposerScalebar::boundingRect" << std::endl;
#endif
return mBoundingRect;
}

QPolygonF QgsComposerScalebar::areaPoints(void) const
{
#ifdef QGISDEBUG
std::cout << "QgsComposerScalebar::areaPoints" << std::endl;
#endif

QRectF r = boundingRect();
QPolygonF pa;
Expand Down Expand Up @@ -496,7 +507,10 @@ QWidget *QgsComposerScalebar::options(void)

bool QgsComposerScalebar::writeSettings(void)
{
#ifdef QGISDEBUG
std::cout << "QgsComposerScalebar::writeSettings" << std::endl;
#endif

QString path;
path.sprintf("/composition_%d/scalebar_%d/", mComposition->id(), mId);

Expand Down

0 comments on commit adf55f5

Please sign in to comment.