Skip to content
Permalink
Browse files
API cleanups to qgis project and maprenderer classes
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9536 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Oct 24, 2008
1 parent 72d793b commit f74b6b01ea1ff1cb75961517d2b46adbee7408d5
@@ -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);

@@ -58,7 +58,7 @@ class QgsMapCanvas : QGraphicsView

void updateOverview();

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

QgsMapCanvasMap* map();

@@ -1399,7 +1399,7 @@ void QgsLegend::updateOverview()
mMapCanvas->updateOverview();
}

void QgsLegend::setOverviewAllLayers( bool isInOverview )
void QgsLegend::enableOverviewModeAllLayers( bool isInOverview )
{
QTreeWidgetItem* theItem = firstItem();
while ( theItem )
@@ -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 );
@@ -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()
@@ -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;
@@ -3469,7 +3469,7 @@ void QgisApp::addAllToOverview()
{
if ( mMapLegend )
{
mMapLegend->setOverviewAllLayers( true );
mMapLegend->enableOverviewModeAllLayers( true );
}

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

// 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
// version of QGIS

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

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

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

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

@@ -306,7 +306,7 @@ void QgsMapCanvas::setLayerSet( QList<QgsMapCanvasLayer>& layers )

} // addLayer

void QgsMapCanvas::setOverview( QgsMapOverviewCanvas* overview )
void QgsMapCanvas::enableOverviewMode( QgsMapOverviewCanvas* overview )
{
if ( mMapOverview )
{
@@ -110,7 +110,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView

void updateOverview();

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

QgsMapCanvasMap* map();

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

0 comments on commit f74b6b0

Please sign in to comment.