Skip to content
Permalink
Browse files
fix warning
  • Loading branch information
jef-n committed Feb 5, 2013
1 parent 89bdb10 commit f47d82043fbf357ed809f6969de84c7a2a703fd2
Showing with 74 additions and 74 deletions.
  1. +5 −5 src/app/qgsidentifyresultsdialog.cpp
  2. +19 −19 src/app/qgsmaptoolidentifyaction.cpp
  3. +20 −20 src/gui/qgsmaptoolidentify.cpp
  4. +30 −30 src/gui/qgsmaptoolidentify.h
@@ -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 );

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

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

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

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

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

0 comments on commit f47d820

Please sign in to comment.