Skip to content

Commit

Permalink
fix dox and switch to classic enum
Browse files Browse the repository at this point in the history
scope based enum is causing troubles from Python depending on sip version
  • Loading branch information
3nids committed Dec 6, 2019
1 parent 9e216b4 commit 84d6bbe
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
7 changes: 0 additions & 7 deletions python/core/auto_additions/qgsclassificationlogarithmic.py

This file was deleted.

Expand Up @@ -22,7 +22,7 @@ Implementation of a logarithmic scale method
%End
public:

enum class NegativeValueHandling
enum NegativeValueHandling
{
NoHandling,
Discard,
Expand Down
6 changes: 5 additions & 1 deletion src/core/classification/qgsclassificationlogarithmic.h
Expand Up @@ -29,7 +29,11 @@ class CORE_EXPORT QgsClassificationLogarithmic : public QgsClassificationMethod
{
public:

enum class NegativeValueHandling : int
/**
* Handling of negative and 0 values in the method
* \since QGIS 3.12
*/
enum NegativeValueHandling
{
NoHandling = 0, //!< No handling
Discard, //!< Negative values are discarded - this will require all values
Expand Down
2 changes: 1 addition & 1 deletion src/core/classification/qgsclassificationmethod.cpp
Expand Up @@ -185,7 +185,7 @@ const QgsProcessingParameterDefinition *QgsClassificationMethod::parameterDefini
if ( def->name() == parameterName )
return def;
}
QgsMessageLog::logMessage( QStringLiteral( "No parameter defintion found for %1 in %2 method." ).arg( parameterName ).arg( name() ) );
QgsMessageLog::logMessage( QStringLiteral( "No parameter definition found for %1 in %2 method." ).arg( parameterName ).arg( name() ) );
return nullptr;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/src/python/test_qgsclassificationmethod.py
Expand Up @@ -74,13 +74,13 @@ def testQgsClassificationLogarithmic_FilterZeroNeg(self):
vl = createMemoryLayer(values)
m = QgsClassificationLogarithmic()

m.setParameterValues({'ZERO_NEG_VALUES_HANDLE': int(QgsClassificationLogarithmic.NegativeValueHandling.Discard)})
m.setParameterValues({'ZERO_NEG_VALUES_HANDLE': QgsClassificationLogarithmic.NegativeValueHandling.Discard})
r = m.classes(vl, 'value', 4)
self.assertEqual(len(r), 4)
self.assertEqual(r[0].label(), '1 - 10^1')
self.assertEqual(QgsClassificationMethod.rangesToBreaks(r), [10.0, 100.0, 1000.0, 10000.0])

m.setParameterValues({'ZERO_NEG_VALUES_HANDLE': int(QgsClassificationLogarithmic.NegativeValueHandling.PrependBreak)})
m.setParameterValues({'ZERO_NEG_VALUES_HANDLE': QgsClassificationLogarithmic.NegativeValueHandling.PrependBreak})
r = m.classes(vl, 'value', 4)
self.assertEqual(r[0].label(), '-2 - 10^0')
self.assertEqual(QgsClassificationMethod.rangesToBreaks(r), [1.0, 10.0, 100.0, 1000.0, 10000.0])
Expand Down

0 comments on commit 84d6bbe

Please sign in to comment.