mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
unifying identify results in a single struct
This commit is contained in:
parent
e37e1cc5c4
commit
66696ba197
@ -20,21 +20,19 @@ class QgsMapToolIdentify : QgsMapTool
|
||||
VectorLayer,
|
||||
RasterLayer,
|
||||
};
|
||||
|
||||
struct VectorResult
|
||||
{
|
||||
VectorResult();
|
||||
VectorResult(QgsVectorLayer* layer, QgsFeature feature, QMap< QString, QString > derivedAttributes);
|
||||
QgsVectorLayer* mLayer;
|
||||
QgsFeature mFeature;
|
||||
QMap< QString, QString > mDerivedAttributes;
|
||||
};
|
||||
|
||||
struct RasterResult
|
||||
|
||||
struct IdentifyResult
|
||||
{
|
||||
RasterResult();
|
||||
RasterResult( QgsRasterLayer * layer, QString label, QgsFields fields, QgsFeature feature, QMap< QString, QString > derivedAttributes );
|
||||
QgsRasterLayer* mLayer;
|
||||
IdentifyResult();
|
||||
|
||||
IdentifyResult( QgsMapLayer * layer, QgsFeature feature, QMap< QString, QString > derivedAttributes );
|
||||
|
||||
IdentifyResult( QgsMapLayer * layer, QString label, QMap< QString, QString > attributes, QMap< QString, QString > derivedAttributes );
|
||||
|
||||
IdentifyResult( QgsMapLayer * layer, QString label, QgsFields fields, QgsFeature feature, QMap< QString, QString > derivedAttributes );
|
||||
|
||||
QgsMapLayer* mLayer;
|
||||
QString mLabel;
|
||||
QgsFields mFields;
|
||||
QgsFeature mFeature;
|
||||
@ -42,14 +40,6 @@ class QgsMapToolIdentify : QgsMapTool
|
||||
QMap< QString, QString > mDerivedAttributes;
|
||||
};
|
||||
|
||||
struct IdentifyResults
|
||||
{
|
||||
IdentifyResults();
|
||||
IdentifyResults ( QList<QgsMapToolIdentify::VectorResult> vectorResults , QList<QgsMapToolIdentify::RasterResult> rasterResults);
|
||||
QList<QgsMapToolIdentify::VectorResult> mVectorResults;
|
||||
QList<QgsMapToolIdentify::RasterResult> mRasterResults;
|
||||
};
|
||||
|
||||
//! constructor
|
||||
QgsMapToolIdentify( QgsMapCanvas* canvas );
|
||||
|
||||
@ -73,8 +63,8 @@ class QgsMapToolIdentify : QgsMapTool
|
||||
@param y y coordinates of mouseEvent
|
||||
@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.*/
|
||||
IdentifyResults identify(int x, int y, QList<QgsMapLayer*> layerList = QList<QgsMapLayer*>(), IdentifyMode mode = DefaultQgsSetting);
|
||||
@return a list of IdentifyResult*/
|
||||
QList<QgsMapToolIdentify::IdentifyResult> 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
|
||||
@ -83,8 +73,8 @@ class QgsMapToolIdentify : QgsMapTool
|
||||
@param y y coordinates of mouseEvent
|
||||
@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.*/
|
||||
IdentifyResults identify(int x, int y, IdentifyMode mode, LayerType layerType = AllLayers);
|
||||
@return a list of IdentifyResult*/
|
||||
QList<QgsMapToolIdentify::IdentifyResult> identify(int x, int y, IdentifyMode mode, LayerType layerType = AllLayers);
|
||||
|
||||
signals:
|
||||
void identifyProgress( int, int );
|
||||
|
@ -292,9 +292,19 @@ QTreeWidgetItem *QgsIdentifyResultsDialog::layerItem( QObject *layer )
|
||||
return 0;
|
||||
}
|
||||
|
||||
void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer,
|
||||
const QgsFeature &f,
|
||||
const QMap<QString, QString> &derivedAttributes )
|
||||
void QgsIdentifyResultsDialog::addFeature( QgsMapToolIdentify::IdentifyResult result )
|
||||
{
|
||||
if ( result.mLayer->type() == QgsMapLayer::VectorLayer )
|
||||
{
|
||||
addFeature( qobject_cast<QgsVectorLayer *>( result.mLayer ), result.mFeature, result.mDerivedAttributes );
|
||||
}
|
||||
else if ( result.mLayer->type() == QgsMapLayer::RasterLayer )
|
||||
{
|
||||
addFeature( qobject_cast<QgsRasterLayer *>( result.mLayer ), result.mLabel, result.mAttributes, result.mDerivedAttributes, result.mFields, result.mFeature );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer, const QgsFeature &f, const QMap<QString, QString> &derivedAttributes )
|
||||
{
|
||||
QTreeWidgetItem *layItem = layerItem( vlayer );
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "qgsfeature.h"
|
||||
#include "qgsfeaturestore.h"
|
||||
#include "qgsfield.h"
|
||||
#include "qgsmaptoolidentify.h"
|
||||
#include "qgscoordinatereferencesystem.h"
|
||||
|
||||
#include <QWidget>
|
||||
@ -101,18 +102,21 @@ class QgsIdentifyResultsDialog: public QDialog, private Ui::QgsIdentifyResultsBa
|
||||
~QgsIdentifyResultsDialog();
|
||||
|
||||
/** Add add feature from vector layer */
|
||||
void addFeature( QgsVectorLayer *layer,
|
||||
void addFeature( QgsVectorLayer * layer,
|
||||
const QgsFeature &f,
|
||||
const QMap< QString, QString > &derivedAttributes );
|
||||
|
||||
/** Add add feature from other layer */
|
||||
void addFeature( QgsRasterLayer *layer,
|
||||
void addFeature( QgsRasterLayer * layer,
|
||||
QString label,
|
||||
const QMap< QString, QString > &attributes,
|
||||
const QMap< QString, QString > &derivedAttributes,
|
||||
const QgsFields &fields = QgsFields(),
|
||||
const QgsFeature &feature = QgsFeature() );
|
||||
|
||||
/** Add feature from identify results */
|
||||
void addFeature( QgsMapToolIdentify::IdentifyResult result );
|
||||
|
||||
/** map tool was deactivated */
|
||||
void deactivate();
|
||||
|
||||
|
@ -41,14 +41,14 @@
|
||||
#include <QStatusBar>
|
||||
#include <QVariant>
|
||||
|
||||
QgsMapToolIdentifyAction::QgsMapToolIdentifyAction( QgsMapCanvas* canvas )
|
||||
QgsMapToolIdentifyAction::QgsMapToolIdentifyAction( QgsMapCanvas * canvas )
|
||||
: QgsMapToolIdentify( canvas )
|
||||
{
|
||||
// set cursor
|
||||
QPixmap myIdentifyQPixmap = QPixmap(( const char ** ) identify_cursor );
|
||||
mCursor = QCursor( myIdentifyQPixmap, 1, 1 );
|
||||
|
||||
connect( this, SIGNAL( changedRasterResults( QList<RasterResult>& ) ), this, SLOT( handleChangedRasterResults( QList<RasterResult>& ) ) );
|
||||
connect( this, SIGNAL( changedRasterResults( QList<IdentifyResult>& ) ), this, SLOT( handleChangedRasterResults( QList<RasterResult>& ) ) );
|
||||
}
|
||||
|
||||
QgsMapToolIdentifyAction::~QgsMapToolIdentifyAction()
|
||||
@ -93,23 +93,18 @@ void QgsMapToolIdentifyAction::canvasReleaseEvent( QMouseEvent *e )
|
||||
|
||||
connect( this, SIGNAL( identifyProgress( int, int ) ), QgisApp::instance(), SLOT( showProgress( int, int ) ) );
|
||||
connect( this, SIGNAL( identifyMessage( QString ) ), QgisApp::instance(), SLOT( showStatusMessage( QString ) ) );
|
||||
IdentifyResults results = QgsMapToolIdentify::identify( e->x(), e->y() );
|
||||
QList<IdentifyResult> results = 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 )
|
||||
QList<IdentifyResult>::const_iterator result;
|
||||
for ( result = results.begin(); result != results.end(); ++result )
|
||||
{
|
||||
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, rresult->mFields, rresult->mFeature );
|
||||
resultsDialog()->addFeature( *result );
|
||||
}
|
||||
|
||||
if ( !results.mRasterResults.isEmpty() || !results.mVectorResults.isEmpty() )
|
||||
if ( !results.isEmpty() )
|
||||
{
|
||||
resultsDialog()->show();
|
||||
}
|
||||
@ -129,14 +124,17 @@ void QgsMapToolIdentifyAction::canvasReleaseEvent( QMouseEvent *e )
|
||||
}
|
||||
}
|
||||
|
||||
void QgsMapToolIdentifyAction::handleChangedRasterResults( QList<RasterResult>& rasterResults )
|
||||
void QgsMapToolIdentifyAction::handleChangedRasterResults( QList<IdentifyResult> &results )
|
||||
{
|
||||
// Add new result after raster format change
|
||||
QgsDebugMsg( QString( "%1 raster results" ).arg( rasterResults.size() ) );
|
||||
QList<RasterResult>::const_iterator rresult;
|
||||
for ( rresult = rasterResults.begin(); rresult != rasterResults.end(); ++rresult )
|
||||
QgsDebugMsg( QString( "%1 raster results" ).arg( results.size() ) );
|
||||
QList<IdentifyResult>::const_iterator rresult;
|
||||
for ( rresult = results.begin(); rresult != results.end(); ++rresult )
|
||||
{
|
||||
resultsDialog()->addFeature( rresult->mLayer, rresult->mLabel, rresult->mAttributes, rresult->mDerivedAttributes, rresult->mFields, rresult->mFeature );
|
||||
if ( rresult->mLayer->type() == QgsMapLayer::RasterLayer )
|
||||
{
|
||||
resultsDialog()->addFeature( qobject_cast<QgsRasterLayer *>( rresult->mLayer ), rresult->mLabel, rresult->mAttributes, rresult->mDerivedAttributes, rresult->mFields, rresult->mFeature );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ class QgsMapToolIdentifyAction : public QgsMapToolIdentify
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QgsMapToolIdentifyAction( QgsMapCanvas* canvas );
|
||||
QgsMapToolIdentifyAction( QgsMapCanvas * canvas );
|
||||
|
||||
~QgsMapToolIdentifyAction();
|
||||
|
||||
@ -65,7 +65,7 @@ class QgsMapToolIdentifyAction : public QgsMapToolIdentify
|
||||
|
||||
public slots:
|
||||
void handleCopyToClipboard( QgsFeatureStore & );
|
||||
void handleChangedRasterResults( QList<RasterResult>& rasterResults );
|
||||
void handleChangedRasterResults( QList<IdentifyResult>& results );
|
||||
|
||||
signals:
|
||||
void identifyProgress( int, int );
|
||||
|
@ -53,34 +53,34 @@ QgsMapToolIdentify::~QgsMapToolIdentify()
|
||||
{
|
||||
}
|
||||
|
||||
void QgsMapToolIdentify::canvasMoveEvent( QMouseEvent *e )
|
||||
void QgsMapToolIdentify::canvasMoveEvent( QMouseEvent * e )
|
||||
{
|
||||
Q_UNUSED( e );
|
||||
}
|
||||
|
||||
void QgsMapToolIdentify::canvasPressEvent( QMouseEvent *e )
|
||||
void QgsMapToolIdentify::canvasPressEvent( QMouseEvent * e )
|
||||
{
|
||||
Q_UNUSED( e );
|
||||
}
|
||||
|
||||
void QgsMapToolIdentify::canvasReleaseEvent( QMouseEvent *e )
|
||||
void QgsMapToolIdentify::canvasReleaseEvent( QMouseEvent * e )
|
||||
{
|
||||
Q_UNUSED( e );
|
||||
}
|
||||
|
||||
QgsMapToolIdentify::IdentifyResults QgsMapToolIdentify::identify ( int x, int y, QList<QgsMapLayer *> layerList, IdentifyMode mode )
|
||||
QList<QgsMapToolIdentify::IdentifyResult> QgsMapToolIdentify::identify( int x, int y, QList<QgsMapLayer *> layerList, IdentifyMode mode )
|
||||
{
|
||||
return identify( x, y, mode, layerList, AllLayers );
|
||||
}
|
||||
|
||||
QgsMapToolIdentify::IdentifyResults QgsMapToolIdentify::identify( int x, int y, IdentifyMode mode, LayerType layerType )
|
||||
QList<QgsMapToolIdentify::IdentifyResult> QgsMapToolIdentify::identify( int x, int y, IdentifyMode mode, LayerType layerType )
|
||||
{
|
||||
return identify( x, y, mode, QList<QgsMapLayer*>(), layerType );
|
||||
}
|
||||
|
||||
QgsMapToolIdentify::IdentifyResults QgsMapToolIdentify::identify( int x, int y, IdentifyMode mode, QList<QgsMapLayer*> layerList, LayerType layerType )
|
||||
QList<QgsMapToolIdentify::IdentifyResult> QgsMapToolIdentify::identify( int x, int y, IdentifyMode mode, QList<QgsMapLayer*> layerList, LayerType layerType )
|
||||
{
|
||||
IdentifyResults results;
|
||||
QList<IdentifyResult> results;
|
||||
|
||||
mLastPoint = mCanvas->getCoordinateTransform()->toMapCoordinates( x, y );
|
||||
mLastExtent = mCanvas->extent();
|
||||
@ -165,7 +165,7 @@ void QgsMapToolIdentify::deactivate()
|
||||
QgsMapTool::deactivate();
|
||||
}
|
||||
|
||||
bool QgsMapToolIdentify::identifyLayer( IdentifyResults *results, QgsMapLayer *layer, QgsPoint point, QgsRectangle viewExtent, double mapUnitsPerPixel, LayerType layerType )
|
||||
bool QgsMapToolIdentify::identifyLayer( QList<IdentifyResult> *results, QgsMapLayer *layer, QgsPoint point, QgsRectangle viewExtent, double mapUnitsPerPixel, LayerType layerType )
|
||||
{
|
||||
if ( layer->type() == QgsMapLayer::RasterLayer && ( layerType == AllLayers || layerType == RasterLayer ) )
|
||||
{
|
||||
@ -181,7 +181,7 @@ bool QgsMapToolIdentify::identifyLayer( IdentifyResults *results, QgsMapLayer *l
|
||||
}
|
||||
}
|
||||
|
||||
bool QgsMapToolIdentify::identifyVectorLayer( IdentifyResults *results, QgsVectorLayer *layer, QgsPoint point )
|
||||
bool QgsMapToolIdentify::identifyVectorLayer( QList<IdentifyResult> *results, QgsVectorLayer *layer, QgsPoint point )
|
||||
{
|
||||
if ( !layer )
|
||||
return false;
|
||||
@ -262,7 +262,7 @@ bool QgsMapToolIdentify::identifyVectorLayer( IdentifyResults *results, QgsVecto
|
||||
|
||||
derivedAttributes.insert( tr( "feature id" ), fid < 0 ? tr( "new feature" ) : FID_TO_STRING( fid ) );
|
||||
|
||||
results->mVectorResults.append( VectorResult( layer, *f_it, derivedAttributes ) );
|
||||
results->append( IdentifyResult( qobject_cast<QgsMapLayer *>( layer ), *f_it, derivedAttributes ) );
|
||||
}
|
||||
|
||||
if ( renderer && renderer->capabilities() & QgsFeatureRendererV2::ScaleDependent )
|
||||
@ -339,7 +339,7 @@ QMap< QString, QString > QgsMapToolIdentify::featureDerivedAttributes( QgsFeatur
|
||||
return derivedAttributes;
|
||||
}
|
||||
|
||||
bool QgsMapToolIdentify::identifyRasterLayer( IdentifyResults *results, QgsRasterLayer *layer, QgsPoint point, QgsRectangle viewExtent, double mapUnitsPerPixel )
|
||||
bool QgsMapToolIdentify::identifyRasterLayer( QList<IdentifyResult> *results, QgsRasterLayer *layer, QgsPoint point, QgsRectangle viewExtent, double mapUnitsPerPixel )
|
||||
{
|
||||
QgsDebugMsg( "point = " + point.toString() );
|
||||
if ( !layer ) return false;
|
||||
@ -433,7 +433,7 @@ bool QgsMapToolIdentify::identifyRasterLayer( IdentifyResults *results, QgsRaste
|
||||
attributes.insert( dprovider->generateBandName( bandNo ), valueString );
|
||||
}
|
||||
QString label = layer->name();
|
||||
results->mRasterResults.append( RasterResult( layer, label, attributes, derivedAttributes ) );
|
||||
results->append( IdentifyResult( qobject_cast<QgsMapLayer *>( layer ), label, attributes, derivedAttributes ) );
|
||||
}
|
||||
else if ( format == QgsRasterDataProvider::IdentifyFormatFeature )
|
||||
{
|
||||
@ -467,7 +467,7 @@ bool QgsMapToolIdentify::identifyRasterLayer( IdentifyResults *results, QgsRaste
|
||||
QMap< QString, QString > derAttributes = derivedAttributes;
|
||||
derAttributes.unite( featureDerivedAttributes( &feature, layer ) );
|
||||
|
||||
results->mRasterResults.append( RasterResult( layer, labels.join( " / " ), featureStore.fields(), feature, derAttributes ) );
|
||||
results->append( IdentifyResult( qobject_cast<QgsMapLayer *>( layer ), labels.join( " / " ), featureStore.fields(), feature, derAttributes ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -482,7 +482,7 @@ bool QgsMapToolIdentify::identifyRasterLayer( IdentifyResults *results, QgsRaste
|
||||
attributes.insert( "", value );
|
||||
|
||||
QString label = layer->subLayers().value( bandNo );
|
||||
results->mRasterResults.append( RasterResult( layer, label, attributes, derivedAttributes ) );
|
||||
results->append( IdentifyResult( qobject_cast<QgsMapLayer *>( layer ), label, attributes, derivedAttributes ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -509,10 +509,10 @@ QGis::UnitType QgsMapToolIdentify::displayUnits()
|
||||
void QgsMapToolIdentify::formatChanged( QgsRasterLayer *layer )
|
||||
{
|
||||
QgsDebugMsg( "Entered" );
|
||||
IdentifyResults results;
|
||||
QList<IdentifyResult> results;
|
||||
if ( identifyRasterLayer( &results, layer, mLastPoint, mLastExtent, mLastMapUnitsPerPixel ) )
|
||||
{
|
||||
emit changedRasterResults( results.mRasterResults );
|
||||
emit changedRasterResults( results );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
class QgsRasterLayer;
|
||||
class QgsVectorLayer;
|
||||
class QgsMapLayer;
|
||||
class QgsMapCanvas;
|
||||
|
||||
/**
|
||||
@ -60,25 +61,20 @@ class GUI_EXPORT QgsMapToolIdentify : public QgsMapTool
|
||||
RasterLayer
|
||||
};
|
||||
|
||||
struct VectorResult
|
||||
struct IdentifyResult
|
||||
{
|
||||
VectorResult() {}
|
||||
VectorResult( QgsVectorLayer * layer, QgsFeature feature, QMap< QString, QString > derivedAttributes ):
|
||||
mLayer( layer ), mFeature( feature ), mDerivedAttributes( derivedAttributes ) {}
|
||||
QgsVectorLayer* mLayer;
|
||||
QgsFeature mFeature;
|
||||
QMap< QString, QString > mDerivedAttributes;
|
||||
};
|
||||
IdentifyResult() {}
|
||||
|
||||
struct RasterResult
|
||||
{
|
||||
RasterResult() {}
|
||||
RasterResult( QgsRasterLayer * layer, QString label, QMap< QString, QString > attributes, QMap< QString, QString > derivedAttributes ):
|
||||
IdentifyResult( QgsMapLayer * layer, QgsFeature feature, QMap< QString, QString > derivedAttributes ):
|
||||
mLayer( layer ), mFeature( feature ), mDerivedAttributes( derivedAttributes ) {}
|
||||
|
||||
IdentifyResult( QgsMapLayer * layer, QString label, QMap< QString, QString > attributes, QMap< QString, QString > derivedAttributes ):
|
||||
mLayer( layer ), mLabel( label ), mAttributes( attributes ), mDerivedAttributes( derivedAttributes ) {}
|
||||
|
||||
RasterResult( QgsRasterLayer * layer, QString label, QgsFields fields, QgsFeature feature, QMap< QString, QString > derivedAttributes ):
|
||||
IdentifyResult( QgsMapLayer * layer, QString label, QgsFields fields, QgsFeature feature, QMap< QString, QString > derivedAttributes ):
|
||||
mLayer( layer ), mLabel( label ), mFields( fields ), mFeature( feature ), mDerivedAttributes( derivedAttributes ) {}
|
||||
QgsRasterLayer* mLayer;
|
||||
|
||||
QgsMapLayer* mLayer;
|
||||
QString mLabel;
|
||||
QgsFields mFields;
|
||||
QgsFeature mFeature;
|
||||
@ -86,19 +82,8 @@ class GUI_EXPORT QgsMapToolIdentify : public QgsMapTool
|
||||
QMap< QString, QString > mDerivedAttributes;
|
||||
};
|
||||
|
||||
struct IdentifyResults
|
||||
{
|
||||
IdentifyResults() {}
|
||||
IdentifyResults( QList<VectorResult> vectorResults , QList<RasterResult> rasterResults ) :
|
||||
mVectorResults( vectorResults ),
|
||||
mRasterResults( rasterResults )
|
||||
{}
|
||||
QList<VectorResult> mVectorResults;
|
||||
QList<RasterResult> mRasterResults;
|
||||
};
|
||||
|
||||
//! constructor
|
||||
QgsMapToolIdentify( QgsMapCanvas* canvas );
|
||||
QgsMapToolIdentify( QgsMapCanvas * canvas );
|
||||
|
||||
virtual ~QgsMapToolIdentify();
|
||||
|
||||
@ -120,8 +105,8 @@ class GUI_EXPORT QgsMapToolIdentify : public QgsMapTool
|
||||
@param y y coordinates of mouseEvent
|
||||
@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.*/
|
||||
IdentifyResults identify( int x, int y, QList<QgsMapLayer*> layerList = QList<QgsMapLayer*>(), IdentifyMode mode = DefaultQgsSetting );
|
||||
@return a list of IdentifyResult*/
|
||||
QList<IdentifyResult> 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
|
||||
@ -130,8 +115,8 @@ class GUI_EXPORT QgsMapToolIdentify : public QgsMapTool
|
||||
@param y y coordinates of mouseEvent
|
||||
@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.*/
|
||||
IdentifyResults identify( int x, int y, IdentifyMode mode, LayerType layerType = AllLayers );
|
||||
@return a list of IdentifyResult*/
|
||||
QList<IdentifyResult> identify( int x, int y, IdentifyMode mode, LayerType layerType = AllLayers );
|
||||
|
||||
public slots:
|
||||
void formatChanged( QgsRasterLayer *layer );
|
||||
@ -139,7 +124,7 @@ class GUI_EXPORT QgsMapToolIdentify : public QgsMapTool
|
||||
signals:
|
||||
void identifyProgress( int, int );
|
||||
void identifyMessage( QString );
|
||||
void changedRasterResults( QList<RasterResult>& );
|
||||
void changedRasterResults( QList<IdentifyResult>& );
|
||||
|
||||
private:
|
||||
/** Performs the identification.
|
||||
@ -151,13 +136,13 @@ 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.*/
|
||||
IdentifyResults identify( int x, int y, IdentifyMode mode, QList<QgsMapLayer*> layerList, LayerType layerType = AllLayers );
|
||||
QList<IdentifyResult> identify( int x, int y, IdentifyMode mode, QList<QgsMapLayer*> layerList, LayerType layerType = AllLayers );
|
||||
|
||||
/** call the right method depending on layer type */
|
||||
bool identifyLayer( IdentifyResults *results, QgsMapLayer *layer, QgsPoint point, QgsRectangle viewExtent, double mapUnitsPerPixel, LayerType layerType = AllLayers );
|
||||
bool identifyLayer( QList<IdentifyResult> *results, QgsMapLayer *layer, QgsPoint point, QgsRectangle viewExtent, double mapUnitsPerPixel, LayerType layerType = AllLayers );
|
||||
|
||||
bool identifyRasterLayer( IdentifyResults *results, QgsRasterLayer *layer, QgsPoint point, QgsRectangle viewExtent, double mapUnitsPerPixel );
|
||||
bool identifyVectorLayer( IdentifyResults *results, QgsVectorLayer *layer, QgsPoint point );
|
||||
bool identifyRasterLayer( QList<IdentifyResult> *results, QgsRasterLayer *layer, QgsPoint point, QgsRectangle viewExtent, double mapUnitsPerPixel );
|
||||
bool identifyVectorLayer( QList<IdentifyResult> *results, QgsVectorLayer *layer, QgsPoint point );
|
||||
|
||||
//! Private helper
|
||||
virtual void convertMeasurement( QgsDistanceArea &calc, double &measure, QGis::UnitType &u, bool isArea );
|
||||
|
Loading…
x
Reference in New Issue
Block a user