1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/classification/qgsclassificationmethod.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
// This is required for the ConvertToSubClassCode to work properly
// so RTTI for casting is available in the whole module.
%ModuleCode
#include "qgsclassificationequalinterval.h"
#include "qgsclassificationjenks.h"
#include "qgsclassificationprettybreaks.h"
#include "qgsclassificationquantile.h"
#include "qgsclassificationstandarddeviation.h"
#include "qgsclassificationfixedinterval.h"
%End
class QgsClassificationRange
{
%Docstring(signature="appended")
:py:class:`QgsClassificationRange` contains the information about a
classification range
.. versionadded:: 3.10
%End
%TypeHeaderCode
#include "qgsclassificationmethod.h"
%End
public:
QgsClassificationRange( const QString &label, double lowerBound, double upperBound );
%Docstring
Constructor
%End
double lowerBound() const;
%Docstring
Returns the lower bound
%End
double upperBound() const;
%Docstring
Returns the upper bound
%End
QString label() const;
%Docstring
Returns the lower bound
%End
SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsClassificationRange: '%1'>" ).arg( sipCpp->label() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End
};
class QgsClassificationMethod /Abstract/
{
%Docstring(signature="appended")
:py:class:`QgsClassificationMethod` is an abstract class for
implementations of classification methods
.. seealso:: :py:class:`QgsClassificationMethodRegistry`
.. versionadded:: 3.10
%End
%TypeHeaderCode
#include "qgsclassificationmethod.h"
%End
%ConvertToSubClassCode
if ( dynamic_cast<QgsClassificationEqualInterval *>( sipCpp ) )
sipType = sipType_QgsClassificationEqualInterval;
else if ( dynamic_cast<QgsClassificationJenks *>( sipCpp ) )
sipType = sipType_QgsClassificationJenks;
else if ( dynamic_cast<QgsClassificationPrettyBreaks *>( sipCpp ) )
sipType = sipType_QgsClassificationPrettyBreaks;
else if ( dynamic_cast<QgsClassificationQuantile *>( sipCpp ) )
sipType = sipType_QgsClassificationQuantile;
else if ( dynamic_cast<QgsClassificationStandardDeviation *>( sipCpp ) )
sipType = sipType_QgsClassificationStandardDeviation;
else if ( dynamic_cast<QgsClassificationFixedInterval *>( sipCpp ) )
sipType = sipType_QgsClassificationFixedInterval;
else
sipType = 0;
%End
public:
enum MethodProperty /BaseType=IntEnum/
{
NoFlag,
ValuesNotRequired,
SymmetricModeAvailable,
IgnoresClassCount,
};
typedef QFlags<QgsClassificationMethod::MethodProperty> MethodProperties;
enum ClassPosition /BaseType=IntEnum/
{
LowerBound,
Inner,
UpperBound
};
explicit QgsClassificationMethod( MethodProperties properties = NoFlag, int codeComplexity = 1 );
%Docstring
Creates a classification method.
:param properties: The properties of the implemented method
:param codeComplexity: as the exponent in the big O notation
%End
virtual ~QgsClassificationMethod();
virtual QgsClassificationMethod *clone() const = 0 /Factory/;
%Docstring
Returns a clone of the method. Implementation can take advantage of
copyBase method which copies the parameters of the base class
%End
virtual QString name() const = 0;
%Docstring
The readable and translate name of the method
%End
virtual QString id() const = 0;
%Docstring
The id of the method as saved in the project, must be unique in registry
%End
virtual QIcon icon() const;
%Docstring
The icon of the method
%End
QgsClassificationMethod::MethodProperties flags() const;
%Docstring
Returns the classification flags.
.. versionadded:: 3.26
%End
virtual QString labelForRange( double lowerValue, double upperValue, ClassPosition position = Inner ) const;
%Docstring
Returns the label for a range
%End
virtual void writeXml( QDomElement &element, const QgsReadWriteContext &context ) const;
%Docstring
Writes extra information about the method
%End
virtual void readXml( const QDomElement &element, const QgsReadWriteContext &context );
%Docstring
Reads extra information to apply it to the method
%End
virtual bool valuesRequired() const;
%Docstring
Returns if the method requires values to calculate the classes If not,
bounds are sufficient
%End
int codeComplexity() const;
%Docstring
Code complexity as the exponent in Big O notation
%End
bool symmetricModeAvailable() const;
%Docstring
Returns if the method supports symmetric calculation
%End
bool symmetricModeEnabled() const;
%Docstring
Returns if the symmetric mode is enabled
%End
double symmetryPoint() const;
%Docstring
Returns the symmetry point for symmetric mode
%End
bool symmetryAstride() const;
%Docstring
Returns if the symmetric mode is astride if ``True``, it will remove the
symmetry point break so that the 2 classes form only one
%End
void setSymmetricMode( bool enabled, double symmetryPoint = 0, bool symmetryAstride = false );
%Docstring
Defines if the symmetric mode is enables and configures its parameters.
If the symmetric mode is not available in the current implementation,
calling this method has no effect.
:param enabled: if the symmetric mode is enabled
:param symmetryPoint: the value of the symmetry point
:param symmetryAstride: if ``True``, it will remove the symmetry point
break so that the 2 classes form only one
%End
QString labelFormat() const;
%Docstring
Returns the format of the label for the classes
%End
void setLabelFormat( const QString &format );
%Docstring
Defines the format of the labels for the classes, using %1 and %2 for
the bounds
%End
int labelPrecision() const;
%Docstring
Returns the precision for the formatting of the labels
%End
void setLabelPrecision( int labelPrecision );
%Docstring
Defines the precision for the formatting of the labels
%End
bool labelTrimTrailingZeroes() const;
%Docstring
Returns if the trailing 0 are trimmed in the label
%End
void setLabelTrimTrailingZeroes( bool trimTrailingZeroes );
%Docstring
Defines if the trailing 0 are trimmed in the label
%End
static QList<double> rangesToBreaks( const QList<QgsClassificationRange> &classes );
%Docstring
Transforms a list of classes to a list of breaks
%End
QList<QgsClassificationRange> classes( const QgsVectorLayer *layer, const QString &expression, int nclasses ) /Deprecated/;
%Docstring
This will calculate the classes for a given layer to define the classes.
:param layer: The vector layer
:param expression: The name of the field on which the classes are
calculated
:param nclasses: The number of classes to be returned
.. deprecated:: 3.38
Use :py:func:`~QgsClassificationMethod.classesV2` instead.
%End
QList<QgsClassificationRange> classesV2( const QgsVectorLayer *layer, const QString &expression, int nclasses, QString &error /Out/ );
%Docstring
This will calculate the classes for a given layer to define the classes.
:param layer: The vector layer
:param expression: The name of the field on which the classes are
calculated
:param nclasses: The number of classes to be returned
:return: - list of generated classes
- error: error string if an error occurred while generating the
classes
.. versionadded:: 3.38
%End
QList<QgsClassificationRange> classes( const QList<double> &values, int nclasses );
%Docstring
This will calculate the classes for a list of values.
:param values: The list of values
:param nclasses: The number of classes to be returned
%End
QList<QgsClassificationRange> classes( double minimum, double maximum, int nclasses );
%Docstring
This will calculate the classes for defined bounds without any values.
.. warning::
If the method implementation requires values, this will return an empty list.
:param minimum: The minimum value for the breaks
:param maximum: The maximum value for the breaks
:param nclasses: The number of classes to be returned
%End
QDomElement save( QDomDocument &doc, const QgsReadWriteContext &context ) const;
%Docstring
Saves the method to a DOM element and return it
:param doc: the DOM document
:param context: the read/write context
%End
static QgsClassificationMethod *create( const QDomElement &element, const QgsReadWriteContext &context ) /Factory/;
%Docstring
Reads the DOM element and return a new classification method from it
:param element: the DOM element
:param context: the read/write context
%End
static void makeBreaksSymmetric( QList<double> &breaks /In,Out/, double symmetryPoint, bool astride );
%Docstring
Remove the breaks that are above the existing opposite sign classes to
keep colors symmetrically balanced around symmetryPoint Does not put a
break on the symmetryPoint. This is done before.
:param breaks: The breaks of an already-done classification
:param symmetryPoint: The point around which we want a symmetry
:param astride: A bool indicating if the symmetry is made astride the
symmetryPoint or not ( [-1,1] vs. [-1,0][0,1] )
%End
QString labelForRange( const QgsRendererRange &range, ClassPosition position = Inner ) const;
%Docstring
Returns the label for a range
%End
const QgsProcessingParameterDefinition *parameterDefinition( const QString ¶meterName ) const;
%Docstring
Returns the parameter from its name
.. versionadded:: 3.12
%End
QgsProcessingParameterDefinitions parameterDefinitions() const;
%Docstring
Returns the list of parameters
.. versionadded:: 3.12
%End
void setParameterValues( const QVariantMap &values );
%Docstring
Defines the values of the additional parameters
.. versionadded:: 3.12
%End
QVariantMap parameterValues() const;
%Docstring
Returns the values of the processing parameters. One could use
:py:class:`QgsProcessingParameters`.parameterAsXxxx to retrieve the
actual value of a parameter.
.. versionadded:: 3.12
%End
static const int MAX_PRECISION;
static const int MIN_PRECISION;
protected:
void copyBase( QgsClassificationMethod *c ) const;
%Docstring
Copy the parameters (shall be used in clone implementation)
%End
QString formatNumber( double value ) const;
%Docstring
Format the number according to label properties
%End
void addParameter( QgsProcessingParameterDefinition *definition /Transfer/ );
%Docstring
Add a parameter to the method. The paramaeter is a processing parameter
which will allow its configuration in the GUI.
.. note::
Only parameters having their widget implementation in C++ are supported. i.e. pure
Python parameters are not supported.
.. versionadded:: 3.12
%End
};
QFlags<QgsClassificationMethod::MethodProperty> operator|(QgsClassificationMethod::MethodProperty f1, QFlags<QgsClassificationMethod::MethodProperty> f2);
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/classification/qgsclassificationmethod.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|