Skip to content

Commit

Permalink
Address Peter's points from review
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Aug 15, 2018
1 parent 767a7b0 commit ca65717
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
Expand Up @@ -274,7 +274,6 @@ Reads configuration from the given DOM element
};



class QgsMeshRendererSettings
{
%Docstring
Expand Down
1 change: 1 addition & 0 deletions src/app/mesh/qgsrenderermeshpropertieswidget.cpp
Expand Up @@ -125,6 +125,7 @@ void QgsRendererMeshPropertiesWidget::onActiveDatasetGroupChanged()
mMeshRendererVectorSettingsWidget->syncToLayer();

mContoursGroupBox->setChecked( scalarGroup >= 0 );
mContoursGroupBox->setEnabled( scalarGroup >= 0 );
mVectorsGroupBox->setChecked( vectorGroup >= 0 );
mVectorsGroupBox->setEnabled( vectorGroup >= 0 );
}
4 changes: 2 additions & 2 deletions src/core/mesh/qgsmeshlayerutils.cpp
Expand Up @@ -51,7 +51,7 @@ void QgsMeshLayerUtils::calculateMinimumMaximum( double &min, double &max, const

void QgsMeshLayerUtils::calculateMinMaxForDatasetGroup( double &min, double &max, QgsMeshDataProvider *provider, int groupIndex )
{
if ( groupIndex < 0 || groupIndex >= provider->datasetGroupCount() )
if ( groupIndex < 0 || !provider || groupIndex >= provider->datasetGroupCount() )
{
min = std::numeric_limits<double>::quiet_NaN();
max = std::numeric_limits<double>::quiet_NaN();
Expand All @@ -73,7 +73,7 @@ void QgsMeshLayerUtils::calculateMinMaxForDatasetGroup( double &min, double &max

void QgsMeshLayerUtils::calculateMinMaxForDataset( double &min, double &max, QgsMeshDataProvider *provider, QgsMeshDatasetIndex index )
{
if ( !index.isValid() )
if ( !index.isValid() || !provider )
{
min = std::numeric_limits<double>::quiet_NaN();
max = std::numeric_limits<double>::quiet_NaN();
Expand Down
15 changes: 12 additions & 3 deletions src/core/mesh/qgsmeshlayerutils.h
Expand Up @@ -40,13 +40,22 @@ class CORE_EXPORT QgsMeshLayerUtils
{
public:

//! Calculates min/max values from the given vector of values
/**
* Calculates min/max values from the given vector of values.
* Ignores any NaN values in the input. Returns NaN for min/max on error.
*/
static void calculateMinimumMaximum( double &min, double &max, const QVector<double> &arr );

//! Calculates min/max values for the whole dataset group (considering all datasets within it)
/**
* Calculates min/max values for the whole dataset group (considering all datasets within it).
* Ignores any NaN values in the input. Returns NaN for min/max on error.
*/
static void calculateMinMaxForDatasetGroup( double &min, double &max, QgsMeshDataProvider *provider, int groupIndex );

//! Calculates min/max values for one dataset
/**
* Calculates min/max values for one dataset.
* Ignores any NaN values in the input. Returns NaN for min/max on error.
*/
static void calculateMinMaxForDataset( double &min, double &max, QgsMeshDataProvider *provider, QgsMeshDatasetIndex index );
};

Expand Down
3 changes: 1 addition & 2 deletions src/core/mesh/qgsmeshrenderersettings.h
Expand Up @@ -24,6 +24,7 @@
#include "qgis_core.h"
#include "qgis.h"
#include "qgscolorrampshader.h"
#include "qgsmeshdataprovider.h"


/**
Expand Down Expand Up @@ -252,8 +253,6 @@ class CORE_EXPORT QgsMeshRendererVectorSettings
};


#include "qgsmeshdataprovider.h"

/**
* \ingroup core
*
Expand Down

0 comments on commit ca65717

Please sign in to comment.