Skip to content

Commit

Permalink
Slightly cleaner code
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 18, 2021
1 parent 155ee72 commit 2d83a01
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions src/app/qgsidentifyresultsdialog.cpp
Expand Up @@ -87,11 +87,9 @@
#include "qgsexpressioncontextutils.h"
#include "qgsidentifymenu.h"
#include "qgsjsonutils.h"
#include <nlohmann/json.hpp>

#include "qgspointcloudlayer.h"
#include "qgspointcloudrenderer.h"
#include "qgscircle.h"

#include <nlohmann/json.hpp>

QgsIdentifyResultsWebView::QgsIdentifyResultsWebView( QWidget *parent ) : QgsWebView( parent )
{
Expand Down Expand Up @@ -2069,17 +2067,23 @@ void QgsIdentifyResultsDialog::attributeValueChanged( QgsFeatureId fid, int idx,

void QgsIdentifyResultsDialog::highlightFeature( QTreeWidgetItem *item )
{
QgsMapLayer *layer = nullptr;
QgsVectorLayer *vlayer = vectorLayer( item );
QgsRasterLayer *rlayer = rasterLayer( item );
QgsVectorTileLayer *vtlayer = vectorTileLayer( item );
QgsPointCloudLayer *pcLayer = pointCloudLayer( item );

layer = vlayer ? static_cast<QgsMapLayer *>( vlayer ) : static_cast<QgsMapLayer *>( rlayer );
layer = layer ? layer : vtlayer;
layer = layer ? layer : pcLayer;
QgsMapLayer *layer = vlayer ? static_cast<QgsMapLayer *>( vlayer ) : QgsIdentifyResultsDialog::layer( item );
if ( !layer )
return;

if ( !layer ) return;
switch ( layer->type() )
{
case QgsMapLayerType::VectorLayer:
case QgsMapLayerType::RasterLayer:
case QgsMapLayerType::VectorTileLayer:
case QgsMapLayerType::PointCloudLayer:
break;
case QgsMapLayerType::PluginLayer:
case QgsMapLayerType::MeshLayer:
case QgsMapLayerType::AnnotationLayer:
return; // not supported
}

QgsIdentifyResultsFeatureItem *featItem = dynamic_cast<QgsIdentifyResultsFeatureItem *>( featureItem( item ) );
if ( !featItem )
Expand Down

0 comments on commit 2d83a01

Please sign in to comment.