More api cleanups mainly affecting gui

git-svn-id: http://svn.osgeo.org/qgis/trunk@9233 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
timlinux 2008-08-31 18:28:22 +00:00
parent 21a5d7248b
commit 8f60bc5095
45 changed files with 134 additions and 134 deletions

View File

@ -31,7 +31,7 @@ class QgisInterface : QObject
//! Zoom to full extent of map layers
virtual void zoomFull()=0;
//! Zoom to previous view extent
virtual void zoomPrevious()=0;
virtual void zoomToPrevious()=0;
//! Zoome to extent of the active layer
virtual void zoomActiveLayer()=0;

View File

@ -11,13 +11,13 @@ class QgsMapCanvasLayer
%End
public:
QgsMapCanvasLayer(QgsMapLayer* layer, bool visible = TRUE, bool inOverview = FALSE);
QgsMapCanvasLayer(QgsMapLayer* layer, bool visible = TRUE, bool isInOverview = FALSE);
void setVisible(bool visible);
void setInOverview(bool inOverview);
void setInOverview(bool isInOverview);
bool isVisible() const;
bool inOverview() const;
bool isInOverview() const;
QgsMapLayer* layer();
//const QgsMapLayer* layer() const;
@ -68,7 +68,7 @@ class QgsMapCanvas : QGraphicsView
QPixmap& canvasPixmap();
//! Get the last reported scale of the canvas
double getScale();
double scale();
//! Clear the map canvas
void clear();
@ -85,10 +85,10 @@ class QgsMapCanvas : QGraphicsView
void setExtent(const QgsRect & r);
//! Zoom to the full extent of all layers
void zoomFullExtent();
void zoomToFullExtent();
//! Zoom to the previous extent (view)
void zoomPreviousExtent();
void zoomToPreviousExtent();
/**Zooms to the extend of the selected features*/
void zoomToSelected();
@ -165,7 +165,7 @@ class QgsMapCanvas : QGraphicsView
void enableAntiAliasing(bool theFlag);
//! Select which Qt class to render with
void useQImageToRender(bool theFlag);
void useImageToRender(bool theFlag);
// following 2 methods should be moved elsewhere or changed to private
// currently used by pan map tool
@ -272,7 +272,7 @@ class QgsMapCanvas : QGraphicsView
void moveCanvasContents(bool reset = FALSE);
//! called on resize or changed extent to notify canvas items to change their rectangle
void updateCanvasItemsPositions();
void updateCanvasItemPositions();
}; // class QgsMapCanvas

View File

@ -42,10 +42,10 @@ class QgsMapCanvasItem : QGraphicsItem
void setRect(const QgsRect& r);
//! transformation from screen coordinates to map coordinates
QgsPoint toMapCoords(const QPoint& point);
QgsPoint toMapCoordinates(const QPoint& point);
//! transformation from map coordinates to screen coordinates
QPointF toCanvasCoords(const QgsPoint& point);
QPointF toCanvasCoordinates(const QgsPoint& point);
};

View File

@ -33,7 +33,7 @@ class QgsMapCanvasMap : QGraphicsRectItem
void enableAntiAliasing(bool flag);
void useQImageToRender(bool flag);
void useImageToRender(bool flag);
//! renders map using QgsMapRender to mPixmap
void render();

View File

@ -17,7 +17,7 @@ class QgsMapOverviewCanvas : QWidget
void refresh();
//! changes background color
void setbgColor(const QColor& color);
void setBackgroundColor(const QColor& color);
//! updates layer set for overview
void setLayerSet(const QStringList& layerSet);

View File

@ -57,7 +57,7 @@ class QgsMapTool : QObject
/** Check whether this MapTool performs a zoom or pan operation.
* If it does, we will be able to perform the zoom and then
* resume operations with the original / previously used tool.*/
virtual bool isZoomTool();
virtual bool isTransient();
/** Check whether this MapTool performs an edit operation.
* If it does, we will deactivate it when editing is turned off
@ -76,19 +76,19 @@ class QgsMapTool : QObject
QgsMapTool(QgsMapCanvas* canvas /TransferThis/);
//! transformation from screen coordinates to map coordinates
QgsPoint toMapCoords(const QPoint& point);
QgsPoint toMapCoordinates(const QPoint& point);
//! transformation from screen coordinates to layer's coordinates
QgsPoint toLayerCoords(QgsMapLayer* layer, const QPoint& point);
QgsPoint toLayerCoordinates(QgsMapLayer* layer, const QPoint& point);
//! trnasformation from map coordinates to layer's coordinates
QgsPoint toLayerCoords(QgsMapLayer* layer, const QgsPoint& point);
QgsPoint toLayerCoordinates(QgsMapLayer* layer, const QgsPoint& point);
//! trnasformation of the rect from map coordinates to layer's coordinates
QgsRect toLayerCoords(QgsMapLayer* layer, const QgsRect& rect);
QgsRect toLayerCoordinates(QgsMapLayer* layer, const QgsRect& rect);
//! transformation from map coordinates to screen coordinates
QPoint toCanvasCoords(const QgsPoint& point);
QPoint toCanvasCoordinates(const QgsPoint& point);
};

View File

@ -18,7 +18,7 @@ class QgsMapToolPan : QgsMapTool
//! Overridden mouse release event
virtual void canvasReleaseEvent(QMouseEvent * e);
virtual bool isZoomTool();
virtual bool isTransient();
};

View File

@ -18,7 +18,7 @@ class QgsMapToolZoom : QgsMapTool
//! Overridden mouse release event
virtual void canvasReleaseEvent(QMouseEvent * e);
virtual bool isZoomTool();
virtual bool isTransient();
};

View File

@ -511,7 +511,7 @@ void QgsLegend::addLayer( QgsMapLayer * layer )
// first layer?
if ( mMapCanvas->layerCount() == 1 )
mMapCanvas->zoomFullExtent();
mMapCanvas->zoomToFullExtent();
setCurrentItem( llayer );
//make the QTreeWidget item up-to-date
doItemsLayout();
@ -910,7 +910,7 @@ bool QgsLegend::writeXML( QDomNode & legendnode, QDomDocument & document )
legendlayerfilenode.setAttribute( "visible", llf->isVisible() );
// show in overview flag
legendlayerfilenode.setAttribute( "inOverview", llf->isInOverview() );
legendlayerfilenode.setAttribute( "isInOverview", llf->isInOverview() );
}
break;
@ -1035,7 +1035,7 @@ bool QgsLegend::readXML( QDomNode& legendnode )
// load layer's visibility and 'show in overview' flag
theLegendLayerFile->setVisible( atoi( childelem.attribute( "visible", "1" ).toUtf8() ) ); //Default is visible
theLegendLayerFile->setInOverview( atoi( childelem.attribute( "inOverview" ).toUtf8() ) );
theLegendLayerFile->setInOverview( atoi( childelem.attribute( "isInOverview" ).toUtf8() ) );
// set the check state
blockSignals( true );
@ -1399,7 +1399,7 @@ void QgsLegend::updateOverview()
mMapCanvas->updateOverview();
}
void QgsLegend::setOverviewAllLayers( bool inOverview )
void QgsLegend::setOverviewAllLayers( bool isInOverview )
{
QTreeWidgetItem* theItem = firstItem();
while ( theItem )
@ -1407,7 +1407,7 @@ void QgsLegend::setOverviewAllLayers( bool inOverview )
QgsLegendLayerFile* llf = dynamic_cast<QgsLegendLayerFile*>( theItem );
if ( llf )
{
llf->setInOverview( inOverview );
llf->setInOverview( isInOverview );
}
theItem = nextItem( theItem );
}

View File

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

View File

@ -102,7 +102,7 @@ void QgsLegendLayerFile::updateLegendItem()
{
QPixmap pix = legend()->pixmaps().mOriginalPixmap;
if ( mLyr.inOverview() )
if ( mLyr.isInOverview() )
{
//add overview glasses to the pixmap
QPainter p( &pix );
@ -130,12 +130,12 @@ void QgsLegendLayerFile::updateLegendItem()
}
void QgsLegendLayerFile::setIconAppearance( bool inOverview,
void QgsLegendLayerFile::setIconAppearance( bool isInOverview,
bool editable )
{
QPixmap newIcon( getOriginalPixmap() );
if ( inOverview )
if ( isInOverview )
{
// Overlay the overview icon on the default icon
QPixmap myPixmap = QgisApp::getThemePixmap( "mIconOverview.png" );
@ -189,14 +189,14 @@ bool QgsLegendLayerFile::isVisible()
return mLyr.isVisible();
}
void QgsLegendLayerFile::setInOverview( bool inOverview )
void QgsLegendLayerFile::setInOverview( bool isInOverview )
{
mLyr.setInOverview( inOverview );
mLyr.setInOverview( isInOverview );
}
bool QgsLegendLayerFile::isInOverview()
{
return mLyr.inOverview();
return mLyr.isInOverview();
}
void QgsLegendLayerFile::showInOverview()
@ -333,7 +333,7 @@ void QgsLegendLayerFile::addToPopupMenu( QMenu& theMenu, QAction* toggleEditingA
QAction* showInOverviewAction = theMenu.addAction( tr( "&Show in overview" ), this, SLOT( showInOverview() ) );
showInOverviewAction->setCheckable( true );
showInOverviewAction->blockSignals( true );
showInOverviewAction->setChecked( mLyr.inOverview() );
showInOverviewAction->setChecked( mLyr.isInOverview() );
showInOverviewAction->blockSignals( false );
// remove from canvas

View File

@ -46,7 +46,7 @@ class QgsLegendLayerFile : public QgsLegendItem
QPixmap getOriginalPixmap() const;
void setIconAppearance( bool inOverview, bool editable );
void setIconAppearance( bool isInOverview, bool editable );
/**Returns a label for a layer. Is static such that
the name can be passed to the constructor of QgsLegendLayerFile*/
@ -55,7 +55,7 @@ class QgsLegendLayerFile : public QgsLegendItem
void setVisible( bool visible = TRUE );
bool isVisible();
void setInOverview( bool inOverview = TRUE );
void setInOverview( bool isInOverview = TRUE );
bool isInOverview();
/** called to add appropriate menu items to legend's popup menu */

View File

@ -728,7 +728,7 @@ void QgisApp::createActions()
mActionZoomLast = new QAction( getThemeIcon( "mActionZoomLast.png" ), tr( "Zoom Last" ), this );
//mActionZoomLast->setShortcut(tr("Ctrl+O","Zoom to Last Extent"));
mActionZoomLast->setStatusTip( tr( "Zoom to Last Extent" ) );
connect( mActionZoomLast, SIGNAL( triggered() ), this, SLOT( zoomPrevious() ) );
connect( mActionZoomLast, SIGNAL( triggered() ), this, SLOT( zoomToPrevious() ) );
mActionZoomActualSize = new QAction( tr( "Zoom Actual Size" ), this );
mActionZoomActualSize->setStatusTip( tr( "Zoom to Actual Size" ) );
@ -825,7 +825,7 @@ void QgisApp::createActions()
mActionAddToOverview = new QAction( getThemeIcon( "mActionInOverview.png" ), tr( "Add to Overview" ), this );
mActionAddToOverview->setShortcut( tr( "O", "Add current layer to overview map" ) );
mActionAddToOverview->setStatusTip( tr( "Add current layer to overview map" ) );
connect( mActionAddToOverview, SIGNAL( triggered() ), this, SLOT( inOverview() ) );
connect( mActionAddToOverview, SIGNAL( triggered() ), this, SLOT( isInOverview() ) );
mActionAddToOverview->setEnabled( false );
mActionAddAllToOverview = new QAction( getThemeIcon( "mActionAddAllToOverview.png" ), tr( "Add All to Overview" ), this );
@ -1596,7 +1596,7 @@ void QgisApp::createOverview()
// moved here to set anti aliasing to both map canvas and overview
QSettings mySettings;
mMapCanvas->enableAntiAliasing( mySettings.value( "/qgis/enable_anti_aliasing", false ).toBool() );
mMapCanvas->useQImageToRender( mySettings.value( "/qgis/use_qimage_to_render", false ).toBool() );
mMapCanvas->useImageToRender( mySettings.value( "/qgis/use_qimage_to_render", false ).toBool() );
int action = mySettings.value( "/qgis/wheel_action", 0 ).toInt();
double zoomFactor = mySettings.value( "/qgis/zoom_factor", 2 ).toDouble();
@ -3650,15 +3650,15 @@ void QgisApp::pan()
void QgisApp::zoomFull()
{
mMapCanvas->zoomFullExtent();
mMapCanvas->zoomToFullExtent();
// notify the project we've made a change
QgsProject::instance()->dirty( true );
}
void QgisApp::zoomPrevious()
void QgisApp::zoomToPrevious()
{
mMapCanvas->zoomPreviousExtent();
mMapCanvas->zoomToPreviousExtent();
// notify the project we've made a change
QgsProject::instance()->dirty( true );
@ -4078,7 +4078,7 @@ void QgisApp::showScale( double theScale )
void QgisApp::userScale()
{
double currentScale = mMapCanvas->getScale();
double currentScale = mMapCanvas->scale();
QStringList parts = mScaleEdit->text().split( ':' );
if ( parts.size() == 2 )
@ -4096,7 +4096,7 @@ void QgisApp::userScale()
// toggle overview status
void QgisApp::inOverview()
void QgisApp::isInOverview()
{
mMapLegend->legendLayerShowInOverview();
}
@ -4477,7 +4477,7 @@ void QgisApp::options()
QSettings mySettings;
mMapCanvas->enableAntiAliasing( mySettings.value( "/qgis/enable_anti_aliasing" ).toBool() );
mMapCanvas->useQImageToRender( mySettings.value( "/qgis/use_qimage_to_render" ).toBool() );
mMapCanvas->useImageToRender( mySettings.value( "/qgis/use_qimage_to_render" ).toBool() );
int action = mySettings.value( "/qgis/wheel_action", 0 ).toInt();
double zoomFactor = mySettings.value( "/qgis/zoom_factor", 2 ).toDouble();

View File

@ -312,7 +312,7 @@ class QgisApp : public QMainWindow
//! Zoom to full extent
void zoomFull();
//! Zoom to the previous extent
void zoomPrevious();
void zoomToPrevious();
//! Zoom to selected features
void zoomToSelected();
@ -358,7 +358,7 @@ class QgisApp : public QMainWindow
void addDatabaseLayer();
//#endif
/** toggles whether the current selected layer is in overview or not */
void inOverview();
void isInOverview();
//! Slot to show the map coordinate position of the mouse cursor
void showMouseCoordinate( QgsPoint & );
//! Slot to show current map scale;

View File

@ -47,9 +47,9 @@ void QgisAppInterface::zoomFull()
qgis->zoomFull();
}
void QgisAppInterface::zoomPrevious()
void QgisAppInterface::zoomToPrevious()
{
qgis->zoomPrevious();
qgis->zoomToPrevious();
}
void QgisAppInterface::zoomActiveLayer()

View File

@ -46,7 +46,7 @@ class QgisAppInterface : public QgisInterface
//! Zoom map to full extent
void zoomFull();
//! Zoom map to previous extent
void zoomPrevious();
void zoomToPrevious();
//! Zoom to active layer
void zoomActiveLayer();

View File

@ -103,7 +103,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
idPoint = snapPointFromResults( snapResults, e->pos() );
try
{
savePoint = toLayerCoords( vlayer, idPoint );
savePoint = toLayerCoordinates( vlayer, idPoint );
QgsDebugMsg( "savePoint = " + savePoint.toString() );
}
catch ( QgsCsException &cse )

View File

@ -92,7 +92,7 @@ void QgsMapToolAddVertex::canvasReleaseEvent( QMouseEvent * e )
if ( mSnapper.snapToBackgroundLayers( e->pos(), snapResults ) == 0 )
{
snappedPointMapCoord = snapPointFromResults( snapResults, e->pos() );
snappedPointLayerCoord = toLayerCoords( vlayer, snappedPointMapCoord );
snappedPointLayerCoord = toLayerCoordinates( vlayer, snappedPointMapCoord );
//and change the feature points
QList<QgsSnappingResult>::iterator sr_it = mRecentSnappingResults.begin();

View File

@ -102,7 +102,7 @@ int QgsMapToolCapture::addVertex( const QPoint& p )
QgsPoint digitisedPoint;
try
{
digitisedPoint = toLayerCoords( vlayer, p );
digitisedPoint = toLayerCoordinates( vlayer, p );
}
catch ( QgsCsException &cse )
{
@ -119,7 +119,7 @@ int QgsMapToolCapture::addVertex( const QPoint& p )
mapPoint = snapPointFromResults( snapResults, p );
try
{
layerPoint = toLayerCoords( vlayer, mapPoint ); //transform snapped point back to layer crs
layerPoint = toLayerCoordinates( vlayer, mapPoint ); //transform snapped point back to layer crs
}
catch ( QgsCsException &cse )
{

View File

@ -47,7 +47,7 @@ int QgsMapToolEdit::insertSegmentVerticesForSnap( const QList<QgsSnappingResult>
QList<QgsSnappingResult>::iterator it = transformedSnapResults.begin();
for ( ; it != transformedSnapResults.constEnd(); ++it )
{
QgsPoint layerPoint = toLayerCoords( editedLayer, it->snappedVertex );
QgsPoint layerPoint = toLayerCoordinates( editedLayer, it->snappedVertex );
it->snappedVertex = layerPoint;
}
@ -58,7 +58,7 @@ QgsPoint QgsMapToolEdit::snapPointFromResults( const QList<QgsSnappingResult>& s
{
if ( snapResults.size() < 1 )
{
return toMapCoords( screenCoords );
return toMapCoordinates( screenCoords );
}
else
{

View File

@ -246,7 +246,7 @@ void QgsMapToolIdentify::identifyVectorLayer( const QgsPoint& point )
r.setYMinimum( point.y() - searchRadius );
r.setYMaximum( point.y() + searchRadius );
r = toLayerCoords( layer, r );
r = toLayerCoordinates( layer, r );
int featureCount = 0;
//QgsFeature feat;

View File

@ -39,7 +39,7 @@ void QgsMapToolMoveFeature::canvasMoveEvent( QMouseEvent * e )
{
if ( mRubberBand )
{
QgsPoint pointCanvasCoords = toMapCoords( e->pos() );
QgsPoint pointCanvasCoords = toMapCoordinates( e->pos() );
double offsetX = pointCanvasCoords.x() - mStartPointMapCoords.x();
double offsetY = pointCanvasCoords.y() - mStartPointMapCoords.y();
mRubberBand->setTranslationOffset( offsetX, offsetY );
@ -69,7 +69,7 @@ void QgsMapToolMoveFeature::canvasPressEvent( QMouseEvent * e )
}
//find first geometry under mouse cursor and store iterator to it
QgsPoint layerCoords = toLayerCoords(( QgsMapLayer* )vlayer, e->pos() );
QgsPoint layerCoords = toLayerCoordinates(( QgsMapLayer* )vlayer, e->pos() );
QSettings settings;
double searchRadius = settings.value( "/qgis/digitizing/search_radius_vertex_edit", 10 ).toDouble();
QgsRect selectRect( layerCoords.x() - searchRadius, layerCoords.y() - searchRadius,
@ -106,7 +106,7 @@ void QgsMapToolMoveFeature::canvasPressEvent( QMouseEvent * e )
return;
}
mStartPointMapCoords = toMapCoords( e->pos() );
mStartPointMapCoords = toMapCoordinates( e->pos() );
mMovedFeature = cf.featureId(); //todo: take the closest feature, not the first one...
mRubberBand = createRubberBand();
mRubberBand->setToGeometry( cf.geometry(), *vlayer );
@ -131,8 +131,8 @@ void QgsMapToolMoveFeature::canvasReleaseEvent( QMouseEvent * e )
return;
}
QgsPoint startPointLayerCoords = toLayerCoords(( QgsMapLayer* )vlayer, mStartPointMapCoords );
QgsPoint stopPointLayerCoords = toLayerCoords(( QgsMapLayer* )vlayer, e->pos() );
QgsPoint startPointLayerCoords = toLayerCoordinates(( QgsMapLayer* )vlayer, mStartPointMapCoords );
QgsPoint stopPointLayerCoords = toLayerCoordinates(( QgsMapLayer* )vlayer, e->pos() );
double dx = stopPointLayerCoords.x() - startPointLayerCoords.x();
double dy = stopPointLayerCoords.y() - startPointLayerCoords.y();

View File

@ -162,7 +162,7 @@ void QgsMapToolMoveVertex::canvasReleaseEvent( QMouseEvent * e )
snappedPointMapCoord = snapPointFromResults( snapResults, e->pos() );
snappedPointLayerCoord = toLayerCoords( vlayer, snappedPointMapCoord );
snappedPointLayerCoord = toLayerCoordinates( vlayer, snappedPointMapCoord );
//and change the feature points
QList<QgsSnappingResult>::iterator sr_it = mRecentSnappingResults.begin();

View File

@ -92,7 +92,7 @@ void QgsMapToolSelect::canvasReleaseEvent( QMouseEvent * e )
bool lock = ( e->modifiers() & Qt::ControlModifier );
QgsVectorLayer* vlayer = dynamic_cast<QgsVectorLayer*>( mCanvas->currentLayer() );
search = toLayerCoords( vlayer, search );
search = toLayerCoordinates( vlayer, search );
QApplication::setOverrideCursor( Qt::WaitCursor );
vlayer->select( search, lock );

View File

@ -171,7 +171,7 @@ void QgsProjectFileTransform::transform081to090()
legendLayerFile.setAttribute( "visible", mapLayer.attribute( "visible" ) );
// Set overview flag from maplayer to legendlayer
legendLayerFile.setAttribute( "inOverview", mapLayer.attribute( "showInOverviewFlag" ) );
legendLayerFile.setAttribute( "isInOverview", mapLayer.attribute( "showInOverviewFlag" ) );
}
}
}

View File

@ -64,7 +64,7 @@ class GUI_EXPORT QgisInterface : public QObject
//! Zoom to full extent of map layers
virtual void zoomFull() = 0;
//! Zoom to previous view extent
virtual void zoomPrevious() = 0;
virtual void zoomToPrevious() = 0;
//! Zoome to extent of the active layer
virtual void zoomActiveLayer() = 0;

View File

@ -157,9 +157,9 @@ void QgsMapCanvas::enableAntiAliasing( bool theFlag )
mMapOverview->enableAntiAliasing( theFlag );
} // anti aliasing
void QgsMapCanvas::useQImageToRender( bool theFlag )
void QgsMapCanvas::useImageToRender( bool theFlag )
{
mMap->useQImageToRender( theFlag );
mMap->useImageToRender( theFlag );
}
QgsMapCanvasMap* QgsMapCanvas::map()
@ -188,10 +188,10 @@ void QgsMapCanvas::setCurrentLayer( QgsMapLayer* layer )
mCurrentLayer = layer;
}
double QgsMapCanvas::getScale()
double QgsMapCanvas::scale()
{
return mMapRenderer->scale();
} // getScale
} // scale
void QgsMapCanvas::setDirty( bool dirty )
{
@ -236,7 +236,7 @@ void QgsMapCanvas::setLayerSet( QList<QgsMapCanvasLayer>& layers )
{
layerSet.push_back( lyr.layer()->getLayerID() );
}
if ( lyr.inOverview() )
if ( lyr.isInOverview() )
{
layerSetOverview.push_back( lyr.layer()->getLayerID() );
}
@ -467,7 +467,7 @@ void QgsMapCanvas::setExtent( QgsRect const & r )
mLastExtent = current;
// notify canvas items of change
updateCanvasItemsPositions();
updateCanvasItemPositions();
} // setExtent
@ -489,7 +489,7 @@ void QgsMapCanvas::clear()
void QgsMapCanvas::zoomFullExtent()
void QgsMapCanvas::zoomToFullExtent()
{
if ( mDrawing )
{
@ -506,11 +506,11 @@ void QgsMapCanvas::zoomFullExtent()
}
refresh();
} // zoomFullExtent
} // zoomToFullExtent
void QgsMapCanvas::zoomPreviousExtent()
void QgsMapCanvas::zoomToPreviousExtent()
{
if ( mDrawing )
{
@ -521,7 +521,7 @@ void QgsMapCanvas::zoomPreviousExtent()
setExtent( mLastExtent );
mLastExtent = current;
refresh();
} // zoomPreviousExtent
} // zoomToPreviousExtent
bool QgsMapCanvas::projectionsEnabled()
@ -757,7 +757,7 @@ void QgsMapCanvas::mouseReleaseEvent( QMouseEvent * e )
if ( mMapTool )
{
// right button was pressed in zoom tool? return to previous non zoom tool
if ( e->button() == Qt::RightButton && mMapTool->isZoomTool() )
if ( e->button() == Qt::RightButton && mMapTool->isTransient() )
{
QgsDebugMsg( "Right click in map tool zoom or pan, last tool is " +
QString( mLastNonZoomMapTool ? "not null." : "null." ) );
@ -816,7 +816,7 @@ void QgsMapCanvas::resizeEvent( QResizeEvent * e )
mScene->setSceneRect( QRectF( 0, 0, width, height ) );
// notify canvas items of change
updateCanvasItemsPositions();
updateCanvasItemPositions();
updateScale();
refresh();
@ -825,7 +825,7 @@ void QgsMapCanvas::resizeEvent( QResizeEvent * e )
} // resizeEvent
void QgsMapCanvas::updateCanvasItemsPositions()
void QgsMapCanvas::updateCanvasItemPositions()
{
QList<QGraphicsItem*> list = mScene->items();
QList<QGraphicsItem*>::iterator it = list.begin();
@ -959,7 +959,7 @@ void QgsMapCanvas::setMapTool( QgsMapTool* tool )
if ( mMapTool )
mMapTool->deactivate();
if ( tool->isZoomTool() && mMapTool && !mMapTool->isZoomTool() )
if ( tool->isTransient() && mMapTool && !mMapTool->isTransient() )
{
// if zoom or pan tool will be active, save old tool
// to bring it back on right click
@ -1012,7 +1012,7 @@ void QgsMapCanvas::setCanvasColor( const QColor & theColor )
// background of QGraphicsScene
mScene->setBackgroundBrush( bgBrush );
} // setbgColor
} // setBackgroundColor
QColor QgsMapCanvas::canvasColor() const
{
@ -1200,7 +1200,7 @@ void QgsMapCanvas::moveCanvasContents( bool reset )
}
// show items
updateCanvasItemsPositions();
updateCanvasItemPositions();
}

View File

@ -63,14 +63,14 @@ class QgsMapTool;
class GUI_EXPORT QgsMapCanvasLayer
{
public:
QgsMapCanvasLayer( QgsMapLayer* layer, bool visible = TRUE, bool inOverview = FALSE )
: mLayer( layer ), mVisible( visible ), mInOverview( inOverview ) {}
QgsMapCanvasLayer( QgsMapLayer* layer, bool visible = TRUE, bool isInOverview = FALSE )
: mLayer( layer ), mVisible( visible ), mInOverview( isInOverview ) {}
void setVisible( bool visible ) { mVisible = visible; }
void setInOverview( bool inOverview ) { mInOverview = inOverview; }
void setInOverview( bool isInOverview ) { mInOverview = isInOverview; }
bool isVisible() const { return mVisible; }
bool inOverview() const { return mInOverview; }
bool isInOverview() const { return mInOverview; }
QgsMapLayer* layer() { return mLayer; }
const QgsMapLayer* layer() const { return mLayer; }
@ -121,7 +121,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
QPixmap& canvasPixmap();
//! Get the last reported scale of the canvas
double getScale();
double scale();
//! Clear the map canvas
void clear();
@ -138,10 +138,10 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
void setExtent( QgsRect const & r );
//! Zoom to the full extent of all layers
void zoomFullExtent();
void zoomToFullExtent();
//! Zoom to the previous extent (view)
void zoomPreviousExtent();
void zoomToPreviousExtent();
/**Zooms to the extend of the selected features*/
void zoomToSelected();
@ -221,7 +221,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
void enableAntiAliasing( bool theFlag );
//! Select which Qt class to render with
void useQImageToRender( bool theFlag );
void useImageToRender( bool theFlag );
// following 2 methods should be moved elsewhere or changed to private
// currently used by pan map tool
@ -333,7 +333,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
void moveCanvasContents( bool reset = FALSE );
//! called on resize or changed extent to notify canvas items to change their rectangle
void updateCanvasItemsPositions();
void updateCanvasItemPositions();
/// implementation struct
class CanvasProperties;

View File

@ -43,13 +43,13 @@ void QgsMapCanvasItem::paint( QPainter * painter,
paint( painter ); // call the derived item's drawing routines
}
QgsPoint QgsMapCanvasItem::toMapCoords( const QPoint& point )
QgsPoint QgsMapCanvasItem::toMapCoordinates( const QPoint& point )
{
return mMapCanvas->getCoordinateTransform()->toMapCoordinates( point - mPanningOffset );
}
QPointF QgsMapCanvasItem::toCanvasCoords( const QgsPoint& point )
QPointF QgsMapCanvasItem::toCanvasCoordinates( const QgsPoint& point )
{
double x = point.x(), y = point.y();
mMapCanvas->getCoordinateTransform()->transformInPlace( x, y );
@ -71,8 +71,8 @@ void QgsMapCanvasItem::setRect( const QgsRect& rect )
QRectF r; // empty rect by default
if ( !mRect.isEmpty() )
{
r.setTopLeft( toCanvasCoords( QgsPoint( mRect.xMin(), mRect.yMin() ) ) );
r.setBottomRight( toCanvasCoords( QgsPoint( mRect.xMax(), mRect.yMax() ) ) );
r.setTopLeft( toCanvasCoordinates( QgsPoint( mRect.xMin(), mRect.yMin() ) ) );
r.setBottomRight( toCanvasCoordinates( QgsPoint( mRect.xMax(), mRect.yMax() ) ) );
r = r.normalized();
}

View File

@ -66,10 +66,10 @@ class GUI_EXPORT QgsMapCanvasItem : public QGraphicsItem
void setRect( const QgsRect& r );
//! transformation from screen coordinates to map coordinates
QgsPoint toMapCoords( const QPoint& point );
QgsPoint toMapCoordinates( const QPoint& point );
//! transformation from map coordinates to screen coordinates
QPointF toCanvasCoords( const QgsPoint& point );
QPointF toCanvasCoordinates( const QgsPoint& point );
protected:

View File

@ -39,7 +39,7 @@ class GUI_EXPORT QgsMapCanvasMap : public QGraphicsRectItem
void enableAntiAliasing( bool flag ) { mAntiAliasing = flag; }
void useQImageToRender( bool flag ) { mUseQImageToRender = flag; }
void useImageToRender( bool flag ) { mUseQImageToRender = flag; }
//! renders map using QgsMapRenderer to mPixmap
void render();

View File

@ -74,7 +74,7 @@ QgsMapOverviewCanvas::QgsMapOverviewCanvas( QWidget * parent, QgsMapCanvas* mapC
mMapRenderer = new QgsMapRenderer;
mMapRenderer->setOverview();
setbgColor( palette().window().color() );
setBackgroundColor( palette().window().color() );
}
QgsMapOverviewCanvas::~QgsMapOverviewCanvas()
@ -251,7 +251,7 @@ void QgsMapOverviewCanvas::refresh()
}
void QgsMapOverviewCanvas::setbgColor( const QColor& color )
void QgsMapOverviewCanvas::setBackgroundColor( const QColor& color )
{
mBgColor = color;

View File

@ -51,7 +51,7 @@ class GUI_EXPORT QgsMapOverviewCanvas : public QWidget
void refresh();
//! changes background color
void setbgColor( const QColor& color );
void setBackgroundColor( const QColor& color );
//! updates layer set for overview
void setLayerSet( const QStringList& layerSet );

View File

@ -34,34 +34,34 @@ QgsMapTool::~QgsMapTool()
}
QgsPoint QgsMapTool::toMapCoords( const QPoint& point )
QgsPoint QgsMapTool::toMapCoordinates( const QPoint& point )
{
return mCanvas->getCoordinateTransform()->toMapCoordinates( point );
}
QgsPoint QgsMapTool::toLayerCoords( QgsMapLayer* layer, const QPoint& point )
QgsPoint QgsMapTool::toLayerCoordinates( QgsMapLayer* layer, const QPoint& point )
{
QgsPoint pt = toMapCoords( point );
return toLayerCoords( layer, pt );
QgsPoint pt = toMapCoordinates( point );
return toLayerCoordinates( layer, pt );
}
QgsPoint QgsMapTool::toLayerCoords( QgsMapLayer* layer, const QgsPoint& point )
QgsPoint QgsMapTool::toLayerCoordinates( QgsMapLayer* layer, const QgsPoint& point )
{
return mCanvas->mapRenderer()->mapToLayerCoordinates( layer, point );
}
QgsPoint QgsMapTool::toMapCoords( QgsMapLayer* layer, const QgsPoint& point )
QgsPoint QgsMapTool::toMapCoordinates( QgsMapLayer* layer, const QgsPoint& point )
{
return mCanvas->mapRenderer()->layerToMapCoordinates( layer, point );
}
QgsRect QgsMapTool::toLayerCoords( QgsMapLayer* layer, const QgsRect& rect )
QgsRect QgsMapTool::toLayerCoordinates( QgsMapLayer* layer, const QgsRect& rect )
{
return mCanvas->mapRenderer()->mapToLayerCoordinates( layer, rect );
}
QPoint QgsMapTool::toCanvasCoords( const QgsPoint& point )
QPoint QgsMapTool::toCanvasCoordinates( const QgsPoint& point )
{
double x = point.x(), y = point.y();
mCanvas->getCoordinateTransform()->transformInPlace( x, y );
@ -136,7 +136,7 @@ void QgsMapTool::renderComplete()
{
}
bool QgsMapTool::isZoomTool()
bool QgsMapTool::isTransient()
{
return false;
}

View File

@ -83,7 +83,7 @@ class GUI_EXPORT QgsMapTool : public QObject
/** Check whether this MapTool performs a zoom or pan operation.
* If it does, we will be able to perform the zoom and then
* resume operations with the original / previously used tool.*/
virtual bool isZoomTool();
virtual bool isTransient();
/** Check whether this MapTool performs an edit operation.
* If it does, we will deactivate it when editing is turned off
@ -105,22 +105,22 @@ class GUI_EXPORT QgsMapTool : public QObject
QgsMapTool( QgsMapCanvas* canvas );
//! transformation from screen coordinates to map coordinates
QgsPoint toMapCoords( const QPoint& point );
QgsPoint toMapCoordinates( const QPoint& point );
//! transformation from screen coordinates to layer's coordinates
QgsPoint toLayerCoords( QgsMapLayer* layer, const QPoint& point );
QgsPoint toLayerCoordinates( QgsMapLayer* layer, const QPoint& point );
//! trasformation from map coordinates to layer's coordinates
QgsPoint toLayerCoords( QgsMapLayer* layer, const QgsPoint& point );
QgsPoint toLayerCoordinates( QgsMapLayer* layer, const QgsPoint& point );
//!transformation from layer's coordinates to map coordinates (which is different in case reprojection is used)
QgsPoint toMapCoords( QgsMapLayer* layer, const QgsPoint& point );
QgsPoint toMapCoordinates( QgsMapLayer* layer, const QgsPoint& point );
//! trnasformation of the rect from map coordinates to layer's coordinates
QgsRect toLayerCoords( QgsMapLayer* layer, const QgsRect& rect );
QgsRect toLayerCoordinates( QgsMapLayer* layer, const QgsRect& rect );
//! transformation from map coordinates to screen coordinates
QPoint toCanvasCoords( const QgsPoint& point );
QPoint toCanvasCoordinates( const QgsPoint& point );
//! pointer to map canvas
QgsMapCanvas* mCanvas;

View File

@ -31,7 +31,7 @@ void QgsMapToolEmitPoint::canvasMoveEvent( QMouseEvent * e )
void QgsMapToolEmitPoint::canvasPressEvent( QMouseEvent * e )
{
QgsPoint pnt = toMapCoords( e->pos() );
QgsPoint pnt = toMapCoordinates( e->pos() );
emit gotPoint( pnt, e->button() );
}

View File

@ -40,7 +40,7 @@ class GUI_EXPORT QgsMapToolPan : public QgsMapTool
//! Overridden mouse release event
virtual void canvasReleaseEvent( QMouseEvent * e );
virtual bool isZoomTool() { return true; }
virtual bool isTransient() { return true; }
private:

View File

@ -42,7 +42,7 @@ class GUI_EXPORT QgsMapToolZoom : public QgsMapTool
//! Overridden mouse release event
virtual void canvasReleaseEvent( QMouseEvent * e );
virtual bool isZoomTool() { return true; }
virtual bool isTransient() { return true; }
protected:
//! stores actual zoom rect

View File

@ -294,7 +294,7 @@ void QgsRubberBand::paint( QPainter* p )
for ( ; it != mPoints.at( i ).constEnd(); ++it )
{
//QgsDebugMsg("Drawing rubberband vertex: " + QString::number(it->x() + mTranslationOffsetX) + "//" + QString::number(it->y() + mTranslationOffsetY));
pts.append( toCanvasCoords( QgsPoint( it->x() + mTranslationOffsetX, it->y() + mTranslationOffsetY ) ) - pos() );
pts.append( toCanvasCoordinates( QgsPoint( it->x() + mTranslationOffsetX, it->y() + mTranslationOffsetY ) ) - pos() );
}
if ( mIsPolygon )

View File

@ -41,7 +41,7 @@ void QgsVertexMarker::setIconSize( int iconSize )
void QgsVertexMarker::setCenter( const QgsPoint& point )
{
mCenter = point;
QPointF pt = toCanvasCoords( mCenter );
QPointF pt = toCanvasCoordinates( mCenter );
setPos( pt );
}

View File

@ -48,5 +48,5 @@ QRectF QgsGeorefDataPoint::boundingRect() const
void QgsGeorefDataPoint::updatePosition()
{
setPos( toCanvasCoords( mPixelCoords ) );
setPos( toCanvasCoordinates( mPixelCoords ) );
}

View File

@ -47,7 +47,7 @@ class QgsGeorefTool : public QgsMapTool
//! Mouse press event for overriding
virtual void canvasPressEvent( QMouseEvent * e )
{
QgsPoint pnt = toMapCoords( e->pos() );
QgsPoint pnt = toMapCoordinates( e->pos() );
if ( mAddPoint )
mDlg->showCoordDialog( pnt );

View File

@ -40,7 +40,7 @@ QgsGrassEditTool::QgsGrassEditTool( QgsGrassEdit* edit )
void QgsGrassEditTool::canvasPressEvent( QMouseEvent * event )
{
QgsPoint point = toLayerCoords( e->layer(), event->pos() );
QgsPoint point = toLayerCoordinates( e->layer(), event->pos() );
mouseClick( point, event->button() );
// Set last click
@ -53,7 +53,7 @@ void QgsGrassEditTool::canvasPressEvent( QMouseEvent * event )
void QgsGrassEditTool::canvasMoveEvent( QMouseEvent * event )
{
QgsPoint point = toLayerCoords( e->layer(), event->pos() );
QgsPoint point = toLayerCoordinates( e->layer(), event->pos() );
mouseMove( point );
e->statusBar()->message( e->mCanvasPrompt );
@ -147,7 +147,7 @@ void QgsGrassEditNewLine::activate()
{
Vect_reset_line( e->mPoints );
Vect_append_points( e->mPoints, e->mEditPoints, GV_FORWARD );
QgsPoint point = toMapCoords( e->mCanvas->mouseLastXY() );
QgsPoint point = toMapCoordinates( e->mCanvas->mouseLastXY() );
Vect_append_point( e->mPoints, point.x(), point.y(), 0.0 );
e->displayDynamic( e->mPoints );
}
@ -181,7 +181,7 @@ void QgsGrassEditNewLine::mouseClick( QgsPoint & point, Qt::ButtonState button )
e->mEditPoints->n_points--;
Vect_reset_line( e->mPoints );
Vect_append_points( e->mPoints, e->mEditPoints, GV_FORWARD );
QgsPoint point = toMapCoords( e->mCanvas->mouseLastXY() );
QgsPoint point = toMapCoordinates( e->mCanvas->mouseLastXY() );
Vect_append_point( e->mPoints, point.x(), point.y(), 0.0 );
e->displayDynamic( e->mPoints );
}

View File

@ -81,7 +81,7 @@ class QgsGrassRegionEdit : public QgsMapTool
//! mouse click in map canvas
void canvasPressEvent( QMouseEvent * event )
{
QgsPoint point = toMapCoords( event->pos() );
QgsPoint point = toMapCoordinates( event->pos() );
double x = point.x();
double y = point.y();
@ -106,7 +106,7 @@ class QgsGrassRegionEdit : public QgsMapTool
//! mouse movement in map canvas
void canvasMoveEvent( QMouseEvent * event )
{
QgsPoint point = toMapCoords( event->pos() );
QgsPoint point = toMapCoordinates( event->pos() );
QgsDebugMsg( "entered." );
@ -124,8 +124,8 @@ class QgsGrassRegionEdit : public QgsMapTool
void setRegion( const QgsPoint& ul, const QgsPoint& lr )
{
QPoint qul = toCanvasCoords( ul );
QPoint qlr = toCanvasCoords( lr );
QPoint qul = toCanvasCoordinates( ul );
QPoint qlr = toCanvasCoordinates( lr );
mRubberBand->setGeometry( QRect( qul, qlr ) );
}

View File

@ -43,8 +43,8 @@ void MapLayerTest::initGui()
menuId = menu->insertItem( "&PluginMenu", mapLayerPluginMenu );
#if 0
QAction *zoomPreviousAction = new QAction( "Zoom Previous", QIconSet( icon_matrix ), "&Zoom Previous", CTRL + Key_S, qgisMainWindow, "zoomFull" );
connect( zoomPreviousAction, SIGNAL( triggered() ), this, SLOT( zoomPrevious() ) );
QAction *zoomToPreviousAction = new QAction( "Zoom Previous", QIconSet( icon_matrix ), "&Zoom Previous", CTRL + Key_S, qgisMainWindow, "zoomFull" );
connect( zoomToPreviousAction, SIGNAL( triggered() ), this, SLOT( zoomToPrevious() ) );
#endif
}
void MapLayerTest::unload()