mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
fix dox and switch to classic enum
scope based enum is causing troubles from Python depending on sip version
This commit is contained in:
parent
9e216b40cc
commit
84d6bbe88a
@ -1,7 +0,0 @@
|
||||
# The following has been generated automatically from src/core/classification/qgsclassificationlogarithmic.h
|
||||
# monkey patching scoped based enum
|
||||
QgsClassificationLogarithmic.NegativeValueHandling.NoHandling.__doc__ = "No handling"
|
||||
QgsClassificationLogarithmic.NegativeValueHandling.Discard.__doc__ = "Negative values are discarded - this will require all values"
|
||||
QgsClassificationLogarithmic.NegativeValueHandling.PrependBreak.__doc__ = "Prepend an extra break to include negative values - this will require all values"
|
||||
QgsClassificationLogarithmic.NegativeValueHandling.__doc__ = '\n\n' + '* ``NoHandling``: ' + QgsClassificationLogarithmic.NegativeValueHandling.NoHandling.__doc__ + '\n' + '* ``Discard``: ' + QgsClassificationLogarithmic.NegativeValueHandling.Discard.__doc__ + '\n' + '* ``PrependBreak``: ' + QgsClassificationLogarithmic.NegativeValueHandling.PrependBreak.__doc__
|
||||
# --
|
@ -22,7 +22,7 @@ Implementation of a logarithmic scale method
|
||||
%End
|
||||
public:
|
||||
|
||||
enum class NegativeValueHandling
|
||||
enum NegativeValueHandling
|
||||
{
|
||||
NoHandling,
|
||||
Discard,
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -74,13 +74,13 @@ class TestQgsClassificationMethods(unittest.TestCase):
|
||||
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])
|
||||
|
Loading…
x
Reference in New Issue
Block a user