mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
use flag instead of enum
This commit is contained in:
parent
faa330401b
commit
71d7445c83
@ -15,12 +15,13 @@ class QgsMapToolIdentify : QgsMapTool
|
||||
LayerSelection
|
||||
};
|
||||
|
||||
enum LayerType
|
||||
enum Type
|
||||
{
|
||||
AllLayers,
|
||||
VectorLayer,
|
||||
RasterLayer
|
||||
RasterLayer,
|
||||
AllLayers
|
||||
};
|
||||
typedef QFlags<QgsMapToolIdentify::Type> LayerType;
|
||||
|
||||
struct IdentifyResult
|
||||
{
|
||||
|
@ -252,11 +252,11 @@ void QgsMapToolIdentify::deactivate()
|
||||
|
||||
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 ) )
|
||||
if ( layer->type() == QgsMapLayer::RasterLayer && layerType.testFlag( RasterLayer ) )
|
||||
{
|
||||
return identifyRasterLayer( results, qobject_cast<QgsRasterLayer *>( layer ), point, viewExtent, mapUnitsPerPixel );
|
||||
}
|
||||
else if ( layer->type() == QgsMapLayer::VectorLayer && ( layerType == AllLayers || layerType == VectorLayer ) )
|
||||
else if ( layer->type() == QgsMapLayer::VectorLayer && layerType.testFlag( VectorLayer ) )
|
||||
{
|
||||
return identifyVectorLayer( results, qobject_cast<QgsVectorLayer *>( layer ), point );
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ class QgsHighlight;
|
||||
class GUI_EXPORT QgsMapToolIdentify : public QgsMapTool
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_FLAGS( LayerType )
|
||||
|
||||
public:
|
||||
|
||||
@ -56,12 +57,13 @@ class GUI_EXPORT QgsMapToolIdentify : public QgsMapTool
|
||||
LayerSelection
|
||||
};
|
||||
|
||||
enum LayerType
|
||||
enum Type
|
||||
{
|
||||
AllLayers = -1,
|
||||
VectorLayer,
|
||||
RasterLayer
|
||||
VectorLayer = 1,
|
||||
RasterLayer = 2,
|
||||
AllLayers = VectorLayer | RasterLayer
|
||||
};
|
||||
Q_DECLARE_FLAGS( LayerType, Type )
|
||||
|
||||
struct IdentifyResult
|
||||
{
|
||||
@ -178,4 +180,6 @@ class GUI_EXPORT QgsMapToolIdentify : public QgsMapTool
|
||||
void handleMenuHover();
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS( QgsMapToolIdentify::LayerType )
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user