[QGIS Commit] r14497 - trunk/qgis/src/app
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Wed Nov 3 07:57:34 EDT 2010
Author: mhugent
Date: 2010-11-03 04:57:34 -0700 (Wed, 03 Nov 2010)
New Revision: 14497
Modified:
trunk/qgis/src/app/qgsmaptoolselect.cpp
trunk/qgis/src/app/qgsmaptoolselectutils.cpp
trunk/qgis/src/app/qgsmaptoolselectutils.h
Log:
Apply non-string parts of patch #2938
Modified: trunk/qgis/src/app/qgsmaptoolselect.cpp
===================================================================
--- trunk/qgis/src/app/qgsmaptoolselect.cpp 2010-11-03 00:10:46 UTC (rev 14496)
+++ trunk/qgis/src/app/qgsmaptoolselect.cpp 2010-11-03 11:57:34 UTC (rev 14497)
@@ -29,7 +29,7 @@
QgsMapToolSelect::QgsMapToolSelect( QgsMapCanvas* canvas )
- : QgsMapTool( canvas )
+ : QgsMapTool( canvas )
{
mCursor = Qt::ArrowCursor;
}
@@ -37,7 +37,7 @@
void QgsMapToolSelect::canvasReleaseEvent( QMouseEvent * e )
{
QgsVectorLayer* vlayer = QgsMapToolSelectUtils::getCurrentVectorLayer( mCanvas );
- if ( vlayer == NULL )
+ if( vlayer == NULL )
{
return;
}
@@ -46,9 +46,8 @@
QgsMapToolSelectUtils::expandSelectRectangle( selectRect, vlayer, e->pos() );
QgsMapToolSelectUtils::setRubberBand( mCanvas, selectRect, &rubberBand );
QgsGeometry* selectGeom = rubberBand.asGeometry();
- bool addSelection = e->modifiers() & Qt::ControlModifier ? true : false;
- bool substractSelection = e->modifiers() & Qt::ShiftModifier ? true : false;
- QgsMapToolSelectUtils::setSelectFeatures( mCanvas, selectGeom, false, addSelection, substractSelection, true );
+ bool doDifference = e->modifiers() & Qt::ControlModifier ? true : false;
+ QgsMapToolSelectUtils::setSelectFeatures( mCanvas, selectGeom, false, doDifference, true );
delete selectGeom;
rubberBand.reset( true );
}
Modified: trunk/qgis/src/app/qgsmaptoolselectutils.cpp
===================================================================
--- trunk/qgis/src/app/qgsmaptoolselectutils.cpp 2010-11-03 00:10:46 UTC (rev 14496)
+++ trunk/qgis/src/app/qgsmaptoolselectutils.cpp 2010-11-03 11:57:34 UTC (rev 14497)
@@ -81,8 +81,7 @@
void QgsMapToolSelectUtils::setSelectFeatures( QgsMapCanvas* canvas,
QgsGeometry* selectGeometry,
bool doContains,
- bool addSelection,
- bool substractSelection,
+ bool doDifference,
bool singleSelect )
{
if( selectGeometry->type() != QGis::Polygon )
@@ -124,8 +123,7 @@
QgsDebugMsg( "Selection layer: " + vlayer->name() );
QgsDebugMsg( "Selection polygon: " + selectGeomTrans.exportToWkt() );
QgsDebugMsg( "doContains: " + QString( doContains ? "T" : "F" ) );
- QgsDebugMsg( "addSelection: " + QString( addSelection ? "T" : "F" ) );
- QgsDebugMsg( "substractSelection: " + QString( substractSelection ? "T" : "F" ) );
+ QgsDebugMsg( "doDifference: " + QString( doDifference ? "T" : "F" ) );
vlayer->select( QgsAttributeList(), selectGeomTrans.boundingBox(), true, true );
@@ -161,30 +159,24 @@
newSelectedFeatures.insert( closestFeatureId );
}
- QgsDebugMsg( "Number of selected features: " + QString::number( newSelectedFeatures.size() ) );
+ QgsDebugMsg( "Number of new selected features: " + QString::number( newSelectedFeatures.size() ) );
QgsFeatureIds layerSelectedFeatures;
- if( addSelection )
+ if( doDifference )
{
layerSelectedFeatures = vlayer->selectedFeaturesIds();
QgsFeatureIds::const_iterator i = newSelectedFeatures.constEnd();
while( i != newSelectedFeatures.constBegin() )
{
--i;
- layerSelectedFeatures.insert( *i );
- }
- }
- else if( substractSelection )
- {
- layerSelectedFeatures = vlayer->selectedFeaturesIds();
- QgsFeatureIds::const_iterator i = newSelectedFeatures.constEnd();
- while( i != newSelectedFeatures.constBegin() )
- {
- --i;
if( layerSelectedFeatures.contains( *i ) )
{
layerSelectedFeatures.remove( *i );
}
+ else
+ {
+ layerSelectedFeatures.insert( *i );
+ }
}
}
else
@@ -198,8 +190,7 @@
void QgsMapToolSelectUtils::setSelectFeatures( QgsMapCanvas* canvas, QgsGeometry* selectGeometry, QMouseEvent * e )
{
- bool doContains = e->modifiers() & Qt::AltModifier ? true : false;
- bool addSelection = e->modifiers() & Qt::ControlModifier ? true : false;
- bool substractSelection = e->modifiers() & Qt::ShiftModifier ? true : false;
- setSelectFeatures( canvas, selectGeometry, doContains, addSelection, substractSelection );
+ bool doContains = e->modifiers() & Qt::ShiftModifier ? true : false;
+ bool doDifference = e->modifiers() & Qt::ControlModifier ? true : false;
+ setSelectFeatures( canvas, selectGeometry, doContains, doDifference );
}
Modified: trunk/qgis/src/app/qgsmaptoolselectutils.h
===================================================================
--- trunk/qgis/src/app/qgsmaptoolselectutils.h 2010-11-03 00:10:46 UTC (rev 14496)
+++ trunk/qgis/src/app/qgsmaptoolselectutils.h 2010-11-03 11:57:34 UTC (rev 14497)
@@ -40,17 +40,14 @@
must be in terms of the canvas coordinate system.
@param doContains Features will only be selected if contained within the
selection rubber band.
- @param addSelection New selected features will be added to the layer's
- currently selected features.
- @param substractSelection New selected features will be subtracted from
- the layer's currently selected features.
+ @param doDifference Take the symmetric difference of the the current selected
+ features and the new features found within the provided selectGeometry.
@param singleSelect Only selects the closest feature to the selectGeometry.
*/
void setSelectFeatures( QgsMapCanvas* canvas,
QgsGeometry* selectGeometry,
bool doContains = true,
- bool addSelection = false,
- bool substractSelection = false,
+ bool doDifference = false,
bool singleSelect = false );
/**
More information about the QGIS-commit
mailing list