mapeditor.cpp
changeset 782 ffb02a9bb508
parent 780 fe839bdfd10c
child 785 5987f9f15bac
     1.1 --- a/mapeditor.cpp	Wed Jul 22 11:48:23 2009 +0000
     1.2 +++ b/mapeditor.cpp	Mon Jul 27 12:53:17 2009 +0000
     1.3 @@ -304,7 +304,7 @@
     1.4  		printer->setOutputFileName(settings.value("/mainwindow/printerFileName",printer->outputFileName()).toString());
     1.5  	}
     1.6  
     1.7 -	QRectF totalBBox=model->getTotalBBox();
     1.8 +	QRectF totalBBox=getTotalBBox();
     1.9  
    1.10  	// Try to set orientation automagically
    1.11  	// Note: Interpretation of generated postscript is amibiguous, if 
    1.12 @@ -386,6 +386,39 @@
    1.13  	}
    1.14  }
    1.15  
    1.16 +QRectF MapEditor::getTotalBBox()	//FIXME-2 needed e.g. for image export
    1.17 +{
    1.18 +	QRectF r;
    1.19 +/*
    1.20 +	for (int i=0;i<rootItem->branchCount(); i++)
    1.21 +		r=addBBox (rootItem->getBranchNum(i)->getTotalBBox(), r);
    1.22 +*/ 
    1.23 +	return r;	
    1.24 +}
    1.25 +
    1.26 +
    1.27 +QPixmap MapEditor::getPixmap()
    1.28 +{
    1.29 +	QRectF mapRect=getTotalBBox();
    1.30 +	QPixmap pix((int)mapRect.width()+2,(int)mapRect.height()+1);
    1.31 +	QPainter pp (&pix);
    1.32 +	
    1.33 +	pp.setRenderHints(renderHints());
    1.34 +
    1.35 +	// Don't print the visualisation of selection
    1.36 +	model->unselect();
    1.37 +
    1.38 +	mapScene->render (	&pp, 
    1.39 +		QRectF(0,0,mapRect.width()+2,mapRect.height()+2),
    1.40 +		QRectF(mapRect.x(),mapRect.y(),mapRect.width(),mapRect.height() ));
    1.41 +
    1.42 +	// Restore selection
    1.43 +	model->reselect();
    1.44 +	
    1.45 +	return pix;
    1.46 +}
    1.47 +
    1.48 +
    1.49  void MapEditor::setAntiAlias (bool b)
    1.50  {
    1.51  	setRenderHint(QPainter::Antialiasing,b);