Skip to content
Permalink
Browse files
Cleaned up a bunch of debug statments.
git-svn-id: http://svn.osgeo.org/qgis/trunk@8417 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
StevenB authored and StevenB committed May 9, 2008
1 parent a906ffb commit a690af633c65b919438a9a23f9e6149341230f42
@@ -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;
@@ -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);

@@ -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();
}

@@ -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;

@@ -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;
@@ -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 )
@@ -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;
@@ -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
@@ -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
@@ -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;
@@ -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));

@@ -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?
@@ -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() );
@@ -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();
}
@@ -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;
@@ -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 );

@@ -33,8 +33,6 @@

#define PI 3.14159265358979323846

#define QGISDEBUG 1

QgsComposerPicture::QgsComposerPicture ( QgsComposition *composition,
int id, QString file )
: QWidget(composition),
@@ -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;

@@ -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);

@@ -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?
@@ -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;
@@ -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);

Loading

0 comments on commit a690af6

Please sign in to comment.