mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Cleaned up a bunch of debug statments.
git-svn-id: http://svn.osgeo.org/qgis/trunk@8417 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
a906ffb053
commit
a690af633c
@ -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,12 +326,12 @@ 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();
|
||||
@ -330,8 +339,10 @@ void QgsComposerMap::paint ( QPainter* painter, const QStyleOptionGraphicsItem*
|
||||
|
||||
// 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);
|
||||
|
||||
|
@ -41,7 +41,9 @@ QgsComposerVectorLegend::QgsComposerVectorLegend ( QgsComposition *composition,
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
//std::cout << "QgsComposerVectorLegend::QgsComposerVectorLegend()" << std::endl;
|
||||
#ifdef QGISDEBUG
|
||||
std::cout << "QgsComposerVectorLegend::QgsComposerVectorLegend()" << std::endl;
|
||||
#endif
|
||||
|
||||
mComposition = composition;
|
||||
mId = id;
|
||||
@ -76,7 +78,9 @@ QgsComposerVectorLegend::QgsComposerVectorLegend ( QgsComposition *composition,
|
||||
QgsComposerVectorLegend::QgsComposerVectorLegend ( QgsComposition *composition, int id )
|
||||
: QGraphicsRectItem(0,0,10,10,0)
|
||||
{
|
||||
//std::cout << "QgsComposerVectorLegend::QgsComposerVectorLegend()" << std::endl;
|
||||
#ifdef QGISDEBUG
|
||||
std::cout << "QgsComposerVectorLegend::QgsComposerVectorLegend()" << std::endl;
|
||||
#endif
|
||||
|
||||
setupUi(this);
|
||||
|
||||
@ -142,7 +146,9 @@ QgsComposerVectorLegend::~QgsComposerVectorLegend()
|
||||
#define FONT_WORKAROUND_SCALE 10
|
||||
QRectF QgsComposerVectorLegend::render ( QPainter *p )
|
||||
{
|
||||
//std::cout << "QgsComposerVectorLegend::render p = " << p << std::endl;
|
||||
#ifdef QGISDEBUG
|
||||
std::cout << "QgsComposerVectorLegend::render p = " << p << std::endl;
|
||||
#endif
|
||||
|
||||
// Painter can be 0, create dummy to avoid many if below
|
||||
QPainter *painter = NULL;
|
||||
@ -350,7 +356,7 @@ QRectF QgsComposerVectorLegend::render ( QPainter *p )
|
||||
double groupStartHeight = height;
|
||||
for ( int j = groupLayers.size()-1; j >= 0; j-- )
|
||||
{
|
||||
std::cout << "layer = " << groupLayers[j] << std::endl;
|
||||
//std::cout << "layer = " << groupLayers[j] << std::endl;
|
||||
|
||||
double localHeight = groupStartHeight;
|
||||
|
||||
@ -463,9 +469,11 @@ QRectF QgsComposerVectorLegend::render ( QPainter *p )
|
||||
|
||||
void QgsComposerVectorLegend::cache ( void )
|
||||
{
|
||||
#ifdef QGISDEBUG
|
||||
std::cout << "QgsComposerVectorLegend::cache()" << std::endl;
|
||||
#endif
|
||||
|
||||
//typical boundingRect size is 15 units wide,
|
||||
//typical boundingRect size is 15 units wide,
|
||||
mCachePixmap = QPixmap((int)QGraphicsRectItem::rect().width(), (int)QGraphicsRectItem::rect().height() );
|
||||
|
||||
|
||||
@ -552,7 +560,9 @@ void QgsComposerVectorLegend::on_mTitleLineEdit_editingFinished ( void )
|
||||
void QgsComposerVectorLegend::on_mPreviewModeComboBox_activated ( int i )
|
||||
{
|
||||
mPreviewMode = (PreviewMode) i;
|
||||
#ifdef QGISDEBUG
|
||||
std::cout << "mPreviewMode = " << mPreviewMode << std::endl;
|
||||
#endif
|
||||
writeSettings();
|
||||
}
|
||||
|
||||
@ -586,7 +596,9 @@ void QgsComposerVectorLegend::on_mFrameCheckBox_stateChanged ( int )
|
||||
|
||||
void QgsComposerVectorLegend::recalculate ( void )
|
||||
{
|
||||
#ifdef QGISDEBUG
|
||||
std::cout << "QgsComposerVectorLegend::recalculate" << std::endl;
|
||||
#endif
|
||||
|
||||
// Recalculate sizes according to current font size
|
||||
|
||||
@ -596,9 +608,6 @@ void QgsComposerVectorLegend::recalculate ( void )
|
||||
mSectionFont = mFont;
|
||||
mSectionFont.setPointSizeFloat ( 1.2 * mFont.pointSizeFloat() );
|
||||
|
||||
std::cout << "font size = " << mFont.pointSizeFloat() << std::endl;
|
||||
std::cout << "title font size = " << mTitleFont.pointSizeFloat() << std::endl;
|
||||
|
||||
// Font size in canvas units
|
||||
float size = 25.4 * mComposition->scale() * mFont.pointSizeFloat() / 72;
|
||||
|
||||
@ -607,9 +616,14 @@ void QgsComposerVectorLegend::recalculate ( void )
|
||||
mSymbolWidth = 3.5 * size;
|
||||
mSymbolSpace = 0.4 * size;
|
||||
|
||||
#ifdef QGISDEBUG
|
||||
std::cout << "font size = " << mFont.pointSizeFloat() << std::endl;
|
||||
std::cout << "title font size = " << mTitleFont.pointSizeFloat() << std::endl;
|
||||
|
||||
std::cout << "mMargin = " << mMargin << " mSymbolHeight = " << mSymbolHeight
|
||||
<< "mSymbolWidth = " << mSymbolWidth << " mSymbolSpace = " << mSymbolSpace << std::endl;
|
||||
|
||||
#endif
|
||||
|
||||
QRectF r = render(0);
|
||||
|
||||
QGraphicsRectItem::setRect(0, 0, r.width(), r.height() );
|
||||
@ -695,7 +709,9 @@ bool QgsComposerVectorLegend::selected( void )
|
||||
|
||||
void QgsComposerVectorLegend::contextMenuEvent( QContextMenuEvent *event)
|
||||
{
|
||||
#ifdef QGISDEBUG
|
||||
std::cout << "QgsComposerVectorLegend::contextMenuEvent" << std::endl;
|
||||
#endif
|
||||
|
||||
QMenu layersPopupMenu( this);
|
||||
layersPopupMenu.addAction( tr("Combine selected layers"), this, SLOT(groupLayers()) );
|
||||
@ -748,7 +764,9 @@ void QgsComposerVectorLegend::setLayerGroup ( QString id, int group )
|
||||
|
||||
void QgsComposerVectorLegend::layerChanged ( QTreeWidgetItem *lvi )
|
||||
{
|
||||
#ifdef QGISDEBUG
|
||||
std::cout << "QgsComposerVectorLegend::layerChanged" << std::endl;
|
||||
#endif
|
||||
|
||||
if ( lvi == 0 ) return;
|
||||
|
||||
@ -764,7 +782,9 @@ void QgsComposerVectorLegend::layerChanged ( QTreeWidgetItem *lvi )
|
||||
|
||||
void QgsComposerVectorLegend::groupLayers ( void )
|
||||
{
|
||||
#ifdef QGISDEBUG
|
||||
std::cout << "QgsComposerVectorLegend::groupLayers" << std::endl;
|
||||
#endif
|
||||
|
||||
QTreeWidgetItemIterator it( mLayersListView );
|
||||
int count = 0;
|
||||
@ -772,7 +792,9 @@ void QgsComposerVectorLegend::groupLayers ( void )
|
||||
QString id;
|
||||
while ( *it ) {
|
||||
if ( (*it)->isSelected() ) {
|
||||
#ifdef QGISDEBUG
|
||||
std::cout << "selected: " << (*it)->text(0).toLocal8Bit().data() << " " << (*it)->text(2).toLocal8Bit().data() << std::endl;
|
||||
#endif
|
||||
|
||||
id = (*it)->text(2);
|
||||
setLayerGroup ( id, mNextLayerGroup );
|
||||
@ -787,11 +809,13 @@ void QgsComposerVectorLegend::groupLayers ( void )
|
||||
lastItem->setText(1,"" );
|
||||
}
|
||||
|
||||
#ifdef QGISDEBUG
|
||||
std::cout << "Groups:" << std::endl;
|
||||
|
||||
for ( std::map<QString,int>::iterator it3 = mLayersGroups.begin(); it3 != mLayersGroups.end(); ++it3 ) {
|
||||
std::cout << "layer: " << (it3->first).toLocal8Bit().data() << " group: " << it3->second << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
mNextLayerGroup++;
|
||||
|
||||
@ -810,7 +834,10 @@ QWidget *QgsComposerVectorLegend::options ( void )
|
||||
|
||||
bool QgsComposerVectorLegend::writeSettings ( void )
|
||||
{
|
||||
#ifdef QGISDEBUG
|
||||
std::cout << "QgsComposerVectorLegend::writeSettings" << std::endl;
|
||||
#endif
|
||||
|
||||
QString path;
|
||||
path.sprintf("/composition_%d/vectorlegend_%d/", mComposition->id(), mId );
|
||||
|
||||
|
@ -72,7 +72,9 @@ void QgsComposerView::resizeEvent ( QResizeEvent * )
|
||||
* Really, we should do something like re-center the window.
|
||||
*/
|
||||
//mComposer->zoomFull();
|
||||
std::cout << "resize anchor: " << resizeAnchor() << std::endl;
|
||||
#ifdef QGISDEBUG
|
||||
std::cout << "resize anchor: " << resizeAnchor() << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
//TODO: add mouse wheel event forwarding
|
||||
|
@ -388,10 +388,9 @@ void QgsComposition::mousePressEvent(QMouseEvent* e)
|
||||
void QgsComposition::mouseMoveEvent(QMouseEvent* e)
|
||||
{
|
||||
#ifdef QGISDEBUG
|
||||
#endif
|
||||
std::cerr << "QgsComposition::mouseMoveEvent() mTool = " << mTool << " mToolStep = "
|
||||
<< mToolStep << std::endl;
|
||||
|
||||
#endif
|
||||
|
||||
QPointF p = mView->mapToScene(e->pos());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user