API cleanups to qgis project and maprenderer classes

git-svn-id: http://svn.osgeo.org/qgis/trunk@9536 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
timlinux 2008-10-24 21:47:48 +00:00
parent 0e4c6a17db
commit e1b3c93e6a
14 changed files with 24 additions and 24 deletions

View File

@ -44,7 +44,7 @@ class QgsMapRenderer : QObject
void setMapUnits(QGis::UnitType u); void setMapUnits(QGis::UnitType u);
//! sets whether map image will be for overview //! sets whether map image will be for overview
void setOverview(bool isOverview = true); void enableOverviewMode(bool isOverview = true);
void setOutputSize(QSize size, int dpi); void setOutputSize(QSize size, int dpi);

View File

@ -58,7 +58,7 @@ class QgsMapCanvas : QGraphicsView
void updateOverview(); void updateOverview();
void setOverview(QgsMapOverviewCanvas* overview); void enableOverviewMode(QgsMapOverviewCanvas* overview);
QgsMapCanvasMap* map(); QgsMapCanvasMap* map();

View File

@ -1399,7 +1399,7 @@ void QgsLegend::updateOverview()
mMapCanvas->updateOverview(); mMapCanvas->updateOverview();
} }
void QgsLegend::setOverviewAllLayers( bool isInOverview ) void QgsLegend::enableOverviewModeAllLayers( bool isInOverview )
{ {
QTreeWidgetItem* theItem = firstItem(); QTreeWidgetItem* theItem = firstItem();
while ( theItem ) while ( theItem )

View File

@ -154,7 +154,7 @@ class QgsLegend : public QTreeWidget
void updateOverview(); void updateOverview();
/**Show/remove all layer in/from overview*/ /**Show/remove all layer in/from overview*/
void setOverviewAllLayers( bool isInOverview ); void enableOverviewModeAllLayers( bool isInOverview );
/**Adds an entry to mPixmapWidthValues*/ /**Adds an entry to mPixmapWidthValues*/
void addPixmapWidthValue( int width ); void addPixmapWidthValue( int width );

View File

@ -1506,8 +1506,8 @@ void QgisApp::setupConnections()
connect( mStopRenderButton, SIGNAL( clicked() ), this, SLOT( stopRendering() ) ); connect( mStopRenderButton, SIGNAL( clicked() ), this, SLOT( stopRendering() ) );
// Connect warning dialog from project reading // Connect warning dialog from project reading
connect( QgsProject::instance(), SIGNAL( warnOlderProjectVersion( QString ) ), connect( QgsProject::instance(), SIGNAL( oldProjectVersionWarning( QString ) ),
this, SLOT( warnOlderProjectVersion( QString ) ) ); this, SLOT( oldProjectVersionWarning( QString ) ) );
} }
void QgisApp::createCanvas() void QgisApp::createCanvas()
@ -1580,7 +1580,7 @@ void QgisApp::createOverview()
// add to the Panel submenu // add to the Panel submenu
mPanelMenu->addAction( mOverviewDock->toggleViewAction() ); mPanelMenu->addAction( mOverviewDock->toggleViewAction() );
mMapCanvas->setOverview( overviewCanvas ); mMapCanvas->enableOverviewMode( overviewCanvas );
// moved here to set anti aliasing to both map canvas and overview // moved here to set anti aliasing to both map canvas and overview
QSettings mySettings; QSettings mySettings;
@ -3469,7 +3469,7 @@ void QgisApp::addAllToOverview()
{ {
if ( mMapLegend ) if ( mMapLegend )
{ {
mMapLegend->setOverviewAllLayers( true ); mMapLegend->enableOverviewModeAllLayers( true );
} }
// notify the project we've made a change // notify the project we've made a change
@ -3481,7 +3481,7 @@ void QgisApp::removeAllFromOverview()
{ {
if ( mMapLegend ) if ( mMapLegend )
{ {
mMapLegend->setOverviewAllLayers( false ); mMapLegend->enableOverviewModeAllLayers( false );
} }
// notify the project we've made a change // notify the project we've made a change
@ -5627,7 +5627,7 @@ void QgisApp::newBookmark()
// Slot that gets called when the project file was saved with an older // Slot that gets called when the project file was saved with an older
// version of QGIS // version of QGIS
void QgisApp::warnOlderProjectVersion( QString oldVersion ) void QgisApp::oldProjectVersionWarning( QString oldVersion )
{ {
QSettings settings; QSettings settings;

View File

@ -548,7 +548,7 @@ class QgisApp : public QMainWindow
void showPythonDialog(); void showPythonDialog();
//! Shows a warning when an old project file is read. //! Shows a warning when an old project file is read.
void warnOlderProjectVersion( QString ); void oldProjectVersionWarning( QString );
//! Toggle map tips on/off //! Toggle map tips on/off
void toggleMapTips(); void toggleMapTips();

View File

@ -88,14 +88,14 @@ void QgsMeasureDialog::mouseMove( QgsPoint &point )
{ {
QList<QgsPoint> tmpPoints = mTool->points(); QList<QgsPoint> tmpPoints = mTool->points();
tmpPoints.append( point ); tmpPoints.append( point );
double area = mTool->canvas()->mapRenderer()->distArea()->measurePolygon( tmpPoints ); double area = mTool->canvas()->mapRenderer()->distanceArea()->measurePolygon( tmpPoints );
editTotal->setText( formatArea( area ) ); editTotal->setText( formatArea( area ) );
} }
else if ( !mMeasureArea && mTool->points().size() > 0 ) else if ( !mMeasureArea && mTool->points().size() > 0 )
{ {
QgsPoint p1( mTool->points().last() ), p2( point ); QgsPoint p1( mTool->points().last() ), p2( point );
double d = mTool->canvas()->mapRenderer()->distArea()->measureLine( p1, p2 ); double d = mTool->canvas()->mapRenderer()->distanceArea()->measureLine( p1, p2 );
QTreeWidgetItem *item = mTable->topLevelItem( mTable->topLevelItemCount() - 1 ); QTreeWidgetItem *item = mTable->topLevelItem( mTable->topLevelItemCount() - 1 );
item->setText( 0, QLocale::system().toString( d, 'f', 2 ) ); item->setText( 0, QLocale::system().toString( d, 'f', 2 ) );
editTotal->setText( formatDistance( mTotal + d ) ); editTotal->setText( formatDistance( mTotal + d ) );
@ -107,7 +107,7 @@ void QgsMeasureDialog::addPoint( QgsPoint &point )
int numPoints = mTool->points().size(); int numPoints = mTool->points().size();
if ( mMeasureArea && numPoints > 2 ) if ( mMeasureArea && numPoints > 2 )
{ {
double area = mTool->canvas()->mapRenderer()->distArea()->measurePolygon( mTool->points() ); double area = mTool->canvas()->mapRenderer()->distanceArea()->measurePolygon( mTool->points() );
editTotal->setText( formatArea( area ) ); editTotal->setText( formatArea( area ) );
} }
else if ( !mMeasureArea && numPoints > 1 ) else if ( !mMeasureArea && numPoints > 1 )
@ -116,7 +116,7 @@ void QgsMeasureDialog::addPoint( QgsPoint &point )
QgsPoint p1 = mTool->points()[last], p2 = mTool->points()[last+1]; QgsPoint p1 = mTool->points()[last], p2 = mTool->points()[last+1];
double d = mTool->canvas()->mapRenderer()->distArea()->measureLine( p1, p2 ); double d = mTool->canvas()->mapRenderer()->distanceArea()->measureLine( p1, p2 );
mTotal += d; mTotal += d;
editTotal->setText( formatDistance( mTotal ) ); editTotal->setText( formatDistance( mTotal ) );

View File

@ -67,7 +67,7 @@ void QgsMeasureTool::activate()
// If we suspect that they have data that is projected, yet the // If we suspect that they have data that is projected, yet the
// map CRS is set to a geographic one, warn them. // map CRS is set to a geographic one, warn them.
if ( mCanvas->mapRenderer()->distArea()->geographic() && if ( mCanvas->mapRenderer()->distanceArea()->geographic() &&
( mCanvas->extent().height() > 360 || ( mCanvas->extent().height() > 360 ||
mCanvas->extent().width() > 720 ) ) mCanvas->extent().width() > 720 ) )
{ {

View File

@ -82,12 +82,12 @@ class CORE_EXPORT QgsMapRenderer : public QObject
void updateScale(); void updateScale();
//! Return the measuring object //! Return the measuring object
QgsDistanceArea* distArea() { return mDistArea; } QgsDistanceArea* distanceArea() { return mDistArea; }
QGis::UnitType mapUnits() const; QGis::UnitType mapUnits() const;
void setMapUnits( QGis::UnitType u ); void setMapUnits( QGis::UnitType u );
//! sets whether map image will be for overview //! sets whether map image will be for overview
void setOverview( bool isOverview = true ) { mOverview = isOverview; } void enableOverviewMode( bool isOverview = true ) { mOverview = isOverview; }
void setOutputSize( QSize size, int dpi ); void setOutputSize( QSize size, int dpi );

View File

@ -797,8 +797,8 @@ bool QgsProject::read()
QgsProjectFileTransform projectFile( *doc, fileVersion ); QgsProjectFileTransform projectFile( *doc, fileVersion );
//! Shows a warning when an old project file is read. //! Shows a warning when an old project file is read.
emit warnOlderProjectVersion( fileVersion.text() ); emit oldProjectVersionWarning( fileVersion.text() );
QgsDebugMsg( "Emitting warnOlderProjectVersion(oldVersion)." ); QgsDebugMsg( "Emitting oldProjectVersionWarning(oldVersion)." );
projectFile.dump(); projectFile.dump();

View File

@ -264,7 +264,7 @@ class CORE_EXPORT QgsProject : public QObject
void writeProject( QDomDocument & ); void writeProject( QDomDocument & );
//! emitted when an old project file is read. //! emitted when an old project file is read.
void warnOlderProjectVersion( QString ); void oldProjectVersionWarning( QString );
private: private:

View File

@ -306,7 +306,7 @@ void QgsMapCanvas::setLayerSet( QList<QgsMapCanvasLayer>& layers )
} // addLayer } // addLayer
void QgsMapCanvas::setOverview( QgsMapOverviewCanvas* overview ) void QgsMapCanvas::enableOverviewMode( QgsMapOverviewCanvas* overview )
{ {
if ( mMapOverview ) if ( mMapOverview )
{ {

View File

@ -110,7 +110,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
void updateOverview(); void updateOverview();
void setOverview( QgsMapOverviewCanvas* overview ); void enableOverviewMode( QgsMapOverviewCanvas* overview );
QgsMapCanvasMap* map(); QgsMapCanvasMap* map();

View File

@ -72,7 +72,7 @@ QgsMapOverviewCanvas::QgsMapOverviewCanvas( QWidget * parent, QgsMapCanvas* mapC
mPanningWidget = new QgsPanningWidget( this ); mPanningWidget = new QgsPanningWidget( this );
mMapRenderer = new QgsMapRenderer; mMapRenderer = new QgsMapRenderer;
mMapRenderer->setOverview(); mMapRenderer->enableOverviewMode();
setBackgroundColor( palette().window().color() ); setBackgroundColor( palette().window().color() );
} }