Skip to content

Commit

Permalink
fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Feb 5, 2013
1 parent 89bdb10 commit f47d820
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 74 deletions.
10 changes: 5 additions & 5 deletions src/app/qgsidentifyresultsdialog.cpp
Expand Up @@ -178,8 +178,8 @@ QTreeWidgetItem *QgsIdentifyResultsDialog::layerItem( QObject *layer )
}

void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer,
const QgsFeature &f,
const QMap<QString, QString> &derivedAttributes )
const QgsFeature &f,
const QMap<QString, QString> &derivedAttributes )
{
QTreeWidgetItem *layItem = layerItem( vlayer );

Expand Down Expand Up @@ -291,9 +291,9 @@ void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer,
}

void QgsIdentifyResultsDialog::addFeature( QgsRasterLayer *layer,
QString label,
const QMap<QString, QString> &attributes,
const QMap<QString, QString> &derivedAttributes )
QString label,
const QMap<QString, QString> &attributes,
const QMap<QString, QString> &derivedAttributes )
{
QTreeWidgetItem *layItem = layerItem( layer );

Expand Down
38 changes: 19 additions & 19 deletions src/app/qgsmaptoolidentifyaction.cpp
Expand Up @@ -77,26 +77,26 @@ void QgsMapToolIdentifyAction::canvasPressEvent( QMouseEvent *e )

void QgsMapToolIdentifyAction::canvasReleaseEvent( QMouseEvent *e )
{
if ( !mCanvas || mCanvas->isDrawing() )
{
return;
}
if ( !mCanvas || mCanvas->isDrawing() )
{
return;
}

resultsDialog()->clear();
resultsDialog()->clear();

connect( this, SIGNAL( identifyProgress( int, int ) ), QgisApp::instance(), SLOT( showProgress( int, int ) ) );
connect( this, SIGNAL( identifyMessage( QString ) ), QgisApp::instance(), SLOT( showStatusMessage( QString ) ) );
bool res = QgsMapToolIdentify::identify(e->x(), e->y() );
disconnect( this, SIGNAL( identifyProgress( int, int ) ), QgisApp::instance(), SLOT( showProgress( int, int ) ) );
disconnect( this, SIGNAL( identifyMessage( QString ) ), QgisApp::instance(), SLOT( showStatusMessage( QString ) ) );
connect( this, SIGNAL( identifyProgress( int, int ) ), QgisApp::instance(), SLOT( showProgress( int, int ) ) );
connect( this, SIGNAL( identifyMessage( QString ) ), QgisApp::instance(), SLOT( showStatusMessage( QString ) ) );
bool res = QgsMapToolIdentify::identify( e->x(), e->y() );
disconnect( this, SIGNAL( identifyProgress( int, int ) ), QgisApp::instance(), SLOT( showProgress( int, int ) ) );
disconnect( this, SIGNAL( identifyMessage( QString ) ), QgisApp::instance(), SLOT( showStatusMessage( QString ) ) );


QList<VectorResult>::const_iterator vresult;
for ( vresult = results().mVectorResults.begin(); vresult != results().mVectorResults.end(); ++vresult)
resultsDialog()->addFeature( vresult->mLayer, vresult->mFeature, vresult->mDerivedAttributes);
QList<RasterResult>::const_iterator rresult;
for ( rresult = results().mRasterResults.begin(); rresult != results().mRasterResults.end(); ++rresult)
resultsDialog()->addFeature( rresult->mLayer, rresult->mLabel, rresult->mAttributes, rresult->mDerivedAttributes);
QList<VectorResult>::const_iterator vresult;
for ( vresult = results().mVectorResults.begin(); vresult != results().mVectorResults.end(); ++vresult )
resultsDialog()->addFeature( vresult->mLayer, vresult->mFeature, vresult->mDerivedAttributes );
QList<RasterResult>::const_iterator rresult;
for ( rresult = results().mRasterResults.begin(); rresult != results().mRasterResults.end(); ++rresult )
resultsDialog()->addFeature( rresult->mLayer, rresult->mLabel, rresult->mAttributes, rresult->mDerivedAttributes );

if ( res )
{
Expand Down Expand Up @@ -132,8 +132,8 @@ void QgsMapToolIdentifyAction::deactivate()

QGis::UnitType QgsMapToolIdentifyAction::displayUnits()
{
// Get the units for display
QSettings settings;
return QGis::fromLiteral( settings.value( "/qgis/measure/displayunits", QGis::toLiteral( QGis::Meters ) ).toString() );
// Get the units for display
QSettings settings;
return QGis::fromLiteral( settings.value( "/qgis/measure/displayunits", QGis::toLiteral( QGis::Meters ) ).toString() );
}

40 changes: 20 additions & 20 deletions src/gui/qgsmaptoolidentify.cpp
Expand Up @@ -64,20 +64,20 @@ void QgsMapToolIdentify::canvasPressEvent( QMouseEvent *e )

void QgsMapToolIdentify::canvasReleaseEvent( QMouseEvent *e )
{
Q_UNUSED( e );
Q_UNUSED( e );
}

bool QgsMapToolIdentify::identify(int x, int y, QList<QgsMapLayer *> layerList, IdentifyMode mode)
bool QgsMapToolIdentify::identify( int x, int y, QList<QgsMapLayer *> layerList, IdentifyMode mode )
{
return identify(x, y, mode, layerList, AllLayers);
return identify( x, y, mode, layerList, AllLayers );
}

bool QgsMapToolIdentify::identify(int x, int y, IdentifyMode mode, LayerType layerType)
bool QgsMapToolIdentify::identify( int x, int y, IdentifyMode mode, LayerType layerType )
{
return identify(x, y, mode, QList<QgsMapLayer*>(), layerType);
return identify( x, y, mode, QList<QgsMapLayer*>(), layerType );
}

bool QgsMapToolIdentify::identify(int x, int y, IdentifyMode mode, QList<QgsMapLayer*> layerList, LayerType layerType )
bool QgsMapToolIdentify::identify( int x, int y, IdentifyMode mode, QList<QgsMapLayer*> layerList, LayerType layerType )
{
bool res = false;

Expand All @@ -89,13 +89,13 @@ bool QgsMapToolIdentify::identify(int x, int y, IdentifyMode mode, QList<QgsMapL
mResultData.mVectorResults.clear();
mResultData.mRasterResults.clear();

if (mode == DefaultQgsSetting)
if ( mode == DefaultQgsSetting )
{
QSettings settings;
mode = static_cast<IdentifyMode>( settings.value( "/Map/identifyMode", 0 ).toInt() );
}

if ( mode == ActiveLayer && ~layerList.isEmpty())
if ( mode == ActiveLayer && !layerList.isEmpty() )
{
QgsMapLayer *layer = mCanvas->currentLayer();

Expand All @@ -116,20 +116,20 @@ bool QgsMapToolIdentify::identify(int x, int y, IdentifyMode mode, QList<QgsMapL
QStringList noIdentifyLayerIdList = QgsProject::instance()->readListEntry( "Identify", "/disabledLayers" );

int layerCount;
if (layerList.isEmpty())
layerCount = mCanvas->layerCount();
if ( layerList.isEmpty() )
layerCount = mCanvas->layerCount();
else
layerCount = layerList.count();
layerCount = layerList.count();


for ( int i = 0; i < layerCount; i++ )
{

QgsMapLayer *layer ;
if (layerList.isEmpty())
layer = mCanvas->layer( i );
if ( layerList.isEmpty() )
layer = mCanvas->layer( i );
else
layer = layerList.value( i );
layer = layerList.value( i );

emit identifyProgress( i, mCanvas->layerCount() );
emit identifyMessage( tr( "Identifying on %1..." ).arg( layer->name() ) );
Expand Down Expand Up @@ -166,11 +166,11 @@ void QgsMapToolIdentify::deactivate()

bool QgsMapToolIdentify::identifyLayer( QgsMapLayer *layer, int x, int y, LayerType layerType )
{
if ( layer->type() == QgsMapLayer::RasterLayer && (layerType==AllLayers || layerType==RasterLayer))
if ( layer->type() == QgsMapLayer::RasterLayer && ( layerType == AllLayers || layerType == RasterLayer ) )
{
return identifyRasterLayer( qobject_cast<QgsRasterLayer *>( layer ), x, y );
}
else if ( layer->type() == QgsMapLayer::VectorLayer && (layerType==AllLayers || layerType==VectorLayer))
else if ( layer->type() == QgsMapLayer::VectorLayer && ( layerType == AllLayers || layerType == VectorLayer ) )
{
return identifyVectorLayer( qobject_cast<QgsVectorLayer *>( layer ), x, y );
}
Expand Down Expand Up @@ -322,7 +322,7 @@ bool QgsMapToolIdentify::identifyVectorLayer( QgsVectorLayer *layer, int x, int

derivedAttributes.insert( tr( "feature id" ), fid < 0 ? tr( "new feature" ) : FID_TO_STRING( fid ) );

mResultData.mVectorResults.append( VectorResult(layer, *f_it, derivedAttributes));
mResultData.mVectorResults.append( VectorResult( layer, *f_it, derivedAttributes ) );
}

if ( renderer && renderer->capabilities() & QgsFeatureRendererV2::ScaleDependent )
Expand Down Expand Up @@ -404,7 +404,7 @@ bool QgsMapToolIdentify::identifyRasterLayer( QgsRasterLayer *layer, int x, int
if ( attributes.size() > 0 )
{
derivedAttributes.insert( tr( "(clicked coordinate)" ), idPoint.toString() );
mResultData.mRasterResults.append( RasterResult(layer, type, attributes, derivedAttributes));
mResultData.mRasterResults.append( RasterResult( layer, type, attributes, derivedAttributes ) );
}

return res;
Expand All @@ -424,10 +424,10 @@ void QgsMapToolIdentify::convertMeasurement( QgsDistanceArea &calc, double &meas

QGis::UnitType QgsMapToolIdentify::displayUnits()
{
return mCanvas->mapUnits();
return mCanvas->mapUnits();
}

QgsMapToolIdentify::IdentifyResults &QgsMapToolIdentify::results()
{
return mResultData;
return mResultData;
}
60 changes: 30 additions & 30 deletions src/gui/qgsmaptoolidentify.h
Expand Up @@ -46,49 +46,49 @@ class GUI_EXPORT QgsMapToolIdentify : public QgsMapTool

enum IdentifyMode
{
DefaultQgsSetting=-1,
ActiveLayer,
TopDownStopAtFirst,
TopDownAll
DefaultQgsSetting = -1,
ActiveLayer,
TopDownStopAtFirst,
TopDownAll
};

enum LayerType
{
AllLayers=-1,
VectorLayer,
RasterLayer
AllLayers = -1,
VectorLayer,
RasterLayer
};

struct VectorResult
{
VectorResult(){}
VectorResult(QgsVectorLayer * layer, QgsFeature feature, QMap< QString, QString > derivedAttributes):
mLayer( layer ), mFeature( feature ), mDerivedAttributes( derivedAttributes ) {}
QgsVectorLayer* mLayer;
QgsFeature mFeature;
QMap< QString, QString > mDerivedAttributes;
VectorResult() {}
VectorResult( QgsVectorLayer * layer, QgsFeature feature, QMap< QString, QString > derivedAttributes ):
mLayer( layer ), mFeature( feature ), mDerivedAttributes( derivedAttributes ) {}
QgsVectorLayer* mLayer;
QgsFeature mFeature;
QMap< QString, QString > mDerivedAttributes;
};

struct RasterResult
{
RasterResult(){}
RasterResult( QgsRasterLayer * layer, QString label, QMap< QString, QString > attributes, QMap< QString, QString > derivedAttributes):
mLayer( layer ), mLabel( label ), mAttributes( attributes ), mDerivedAttributes( derivedAttributes ) {}
QgsRasterLayer* mLayer;
QString mLabel;
QMap< QString, QString > mAttributes;
QMap< QString, QString > mDerivedAttributes;
RasterResult() {}
RasterResult( QgsRasterLayer * layer, QString label, QMap< QString, QString > attributes, QMap< QString, QString > derivedAttributes ):
mLayer( layer ), mLabel( label ), mAttributes( attributes ), mDerivedAttributes( derivedAttributes ) {}
QgsRasterLayer* mLayer;
QString mLabel;
QMap< QString, QString > mAttributes;
QMap< QString, QString > mDerivedAttributes;
};

struct IdentifyResults
{
IdentifyResults(){}
IdentifyResults ( QList<VectorResult> vectorResults , QList<RasterResult> rasterResults) :
mVectorResults( vectorResults),
mRasterResults( rasterResults )
{}
QList<VectorResult> mVectorResults;
QList<RasterResult> mRasterResults;
IdentifyResults() {}
IdentifyResults( QList<VectorResult> vectorResults , QList<RasterResult> rasterResults ) :
mVectorResults( vectorResults ),
mRasterResults( rasterResults )
{}
QList<VectorResult> mVectorResults;
QList<RasterResult> mRasterResults;
};

//! constructor
Expand All @@ -115,7 +115,7 @@ class GUI_EXPORT QgsMapToolIdentify : public QgsMapTool
@param layerList Performs the identification within the given list of layers. Default value is an empty list, i.e. uses all the layers.
@param mode Identification mode. Can use Qgis default settings or a defined mode. Default mode is DefaultQgsSetting.
@return true if identification succeeded and a feature has been found, false otherwise.*/
bool identify(int x, int y, QList<QgsMapLayer*> layerList = QList<QgsMapLayer*>(), IdentifyMode mode = DefaultQgsSetting);
bool identify( int x, int y, QList<QgsMapLayer*> layerList = QList<QgsMapLayer*>(), IdentifyMode mode = DefaultQgsSetting );

/** Performs the identification.
To avoid beeing forced to specify IdentifyMode with a list of layers
Expand All @@ -125,7 +125,7 @@ class GUI_EXPORT QgsMapToolIdentify : public QgsMapTool
@param mode Identification mode. Can use Qgis default settings or a defined mode.
@param layerType Only performs identification in a certain type of layers (raster, vector). Default value is AllLayers.
@return true if identification succeeded and a feature has been found, false otherwise.*/
bool identify(int x, int y, IdentifyMode mode, LayerType layerType = AllLayers);
bool identify( int x, int y, IdentifyMode mode, LayerType layerType = AllLayers );

/** Access to results */
IdentifyResults &results();
Expand All @@ -144,7 +144,7 @@ class GUI_EXPORT QgsMapToolIdentify : public QgsMapTool
@param layerList Performs the identification within the given list of layers.
@param layerType Only performs identification in a certain type of layers (raster, vector).
@return true if identification succeeded and a feature has been found, false otherwise.*/
bool identify(int x, int y, IdentifyMode mode, QList<QgsMapLayer*> layerList, LayerType layerType = AllLayers);
bool identify( int x, int y, IdentifyMode mode, QList<QgsMapLayer*> layerList, LayerType layerType = AllLayers );
bool identifyLayer( QgsMapLayer *layer, int x, int y, LayerType layerType = AllLayers );
bool identifyRasterLayer( QgsRasterLayer *layer, int x, int y );
bool identifyVectorLayer( QgsVectorLayer *layer, int x, int y );
Expand Down

0 comments on commit f47d820

Please sign in to comment.