Skip to content

Commit

Permalink
API cleanups to qgis project and maprenderer classes
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@9536 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Oct 24, 2008
1 parent 0e4c6a1 commit e1b3c93
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion python/core/qgsmaprenderer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class QgsMapRenderer : QObject
void setMapUnits(QGis::UnitType u);

//! sets whether map image will be for overview
void setOverview(bool isOverview = true);
void enableOverviewMode(bool isOverview = true);

void setOutputSize(QSize size, int dpi);

Expand Down
2 changes: 1 addition & 1 deletion python/gui/qgsmapcanvas.sip
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class QgsMapCanvas : QGraphicsView

void updateOverview();

void setOverview(QgsMapOverviewCanvas* overview);
void enableOverviewMode(QgsMapOverviewCanvas* overview);

QgsMapCanvasMap* map();

Expand Down
2 changes: 1 addition & 1 deletion src/app/legend/qgslegend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,7 @@ void QgsLegend::updateOverview()
mMapCanvas->updateOverview();
}

void QgsLegend::setOverviewAllLayers( bool isInOverview )
void QgsLegend::enableOverviewModeAllLayers( bool isInOverview )
{
QTreeWidgetItem* theItem = firstItem();
while ( theItem )
Expand Down
2 changes: 1 addition & 1 deletion src/app/legend/qgslegend.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class QgsLegend : public QTreeWidget
void updateOverview();

/**Show/remove all layer in/from overview*/
void setOverviewAllLayers( bool isInOverview );
void enableOverviewModeAllLayers( bool isInOverview );

/**Adds an entry to mPixmapWidthValues*/
void addPixmapWidthValue( int width );
Expand Down
12 changes: 6 additions & 6 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1506,8 +1506,8 @@ void QgisApp::setupConnections()
connect( mStopRenderButton, SIGNAL( clicked() ), this, SLOT( stopRendering() ) );

// Connect warning dialog from project reading
connect( QgsProject::instance(), SIGNAL( warnOlderProjectVersion( QString ) ),
this, SLOT( warnOlderProjectVersion( QString ) ) );
connect( QgsProject::instance(), SIGNAL( oldProjectVersionWarning( QString ) ),
this, SLOT( oldProjectVersionWarning( QString ) ) );

}
void QgisApp::createCanvas()
Expand Down Expand Up @@ -1580,7 +1580,7 @@ void QgisApp::createOverview()
// add to the Panel submenu
mPanelMenu->addAction( mOverviewDock->toggleViewAction() );

mMapCanvas->setOverview( overviewCanvas );
mMapCanvas->enableOverviewMode( overviewCanvas );

// moved here to set anti aliasing to both map canvas and overview
QSettings mySettings;
Expand Down Expand Up @@ -3469,7 +3469,7 @@ void QgisApp::addAllToOverview()
{
if ( mMapLegend )
{
mMapLegend->setOverviewAllLayers( true );
mMapLegend->enableOverviewModeAllLayers( true );
}

// notify the project we've made a change
Expand All @@ -3481,7 +3481,7 @@ void QgisApp::removeAllFromOverview()
{
if ( mMapLegend )
{
mMapLegend->setOverviewAllLayers( false );
mMapLegend->enableOverviewModeAllLayers( false );
}

// notify the project we've made a change
Expand Down Expand Up @@ -5627,7 +5627,7 @@ void QgisApp::newBookmark()
// Slot that gets called when the project file was saved with an older
// version of QGIS

void QgisApp::warnOlderProjectVersion( QString oldVersion )
void QgisApp::oldProjectVersionWarning( QString oldVersion )
{
QSettings settings;

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ class QgisApp : public QMainWindow
void showPythonDialog();

//! Shows a warning when an old project file is read.
void warnOlderProjectVersion( QString );
void oldProjectVersionWarning( QString );

//! Toggle map tips on/off
void toggleMapTips();
Expand Down
8 changes: 4 additions & 4 deletions src/app/qgsmeasuredialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ void QgsMeasureDialog::mouseMove( QgsPoint &point )
{
QList<QgsPoint> tmpPoints = mTool->points();
tmpPoints.append( point );
double area = mTool->canvas()->mapRenderer()->distArea()->measurePolygon( tmpPoints );
double area = mTool->canvas()->mapRenderer()->distanceArea()->measurePolygon( tmpPoints );
editTotal->setText( formatArea( area ) );
}
else if ( !mMeasureArea && mTool->points().size() > 0 )
{
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 );
item->setText( 0, QLocale::system().toString( d, 'f', 2 ) );
editTotal->setText( formatDistance( mTotal + d ) );
Expand All @@ -107,7 +107,7 @@ void QgsMeasureDialog::addPoint( QgsPoint &point )
int numPoints = mTool->points().size();
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 ) );
}
else if ( !mMeasureArea && numPoints > 1 )
Expand All @@ -116,7 +116,7 @@ void QgsMeasureDialog::addPoint( QgsPoint &point )

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;
editTotal->setText( formatDistance( mTotal ) );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsmeasuretool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void QgsMeasureTool::activate()

// If we suspect that they have data that is projected, yet the
// 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().width() > 720 ) )
{
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsmaprenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ class CORE_EXPORT QgsMapRenderer : public QObject
void updateScale();

//! Return the measuring object
QgsDistanceArea* distArea() { return mDistArea; }
QgsDistanceArea* distanceArea() { return mDistArea; }
QGis::UnitType mapUnits() const;
void setMapUnits( QGis::UnitType u );

//! 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 );

Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsproject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -797,8 +797,8 @@ bool QgsProject::read()
QgsProjectFileTransform projectFile( *doc, fileVersion );

//! Shows a warning when an old project file is read.
emit warnOlderProjectVersion( fileVersion.text() );
QgsDebugMsg( "Emitting warnOlderProjectVersion(oldVersion)." );
emit oldProjectVersionWarning( fileVersion.text() );
QgsDebugMsg( "Emitting oldProjectVersionWarning(oldVersion)." );

projectFile.dump();

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsproject.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class CORE_EXPORT QgsProject : public QObject
void writeProject( QDomDocument & );

//! emitted when an old project file is read.
void warnOlderProjectVersion( QString );
void oldProjectVersionWarning( QString );

private:

Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsmapcanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ void QgsMapCanvas::setLayerSet( QList<QgsMapCanvasLayer>& layers )

} // addLayer

void QgsMapCanvas::setOverview( QgsMapOverviewCanvas* overview )
void QgsMapCanvas::enableOverviewMode( QgsMapOverviewCanvas* overview )
{
if ( mMapOverview )
{
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsmapcanvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView

void updateOverview();

void setOverview( QgsMapOverviewCanvas* overview );
void enableOverviewMode( QgsMapOverviewCanvas* overview );

QgsMapCanvasMap* map();

Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsmapoverviewcanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ QgsMapOverviewCanvas::QgsMapOverviewCanvas( QWidget * parent, QgsMapCanvas* mapC
mPanningWidget = new QgsPanningWidget( this );

mMapRenderer = new QgsMapRenderer;
mMapRenderer->setOverview();
mMapRenderer->enableOverviewMode();

setBackgroundColor( palette().window().color() );
}
Expand Down

0 comments on commit e1b3c93

Please sign in to comment.