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 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterattributetable.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsRasterAttributeTable
{
%Docstring(signature="appended")
The :py:class:`QgsRasterAttributeTable` class represents a Raster
Attribute Table (RAT).
This class is modeled after the GDAL Raster Attribute Table
implementation, it adds some convenience methods to handle data from
QGIS and to import/export a Raster Attribute Table from/to a DBF VAT
file.
.. versionadded:: 3.30
%End
%TypeHeaderCode
#include "qgsrasterattributetable.h"
%End
public:
class UsageInformation
{
%Docstring(signature="appended")
The UsageInformation class represents information about a field usage.
.. versionadded:: 3.30
%End
%TypeHeaderCode
#include "qgsrasterattributetable.h"
%End
public:
QString description;
bool unique;
bool required;
bool isColor;
bool isRamp;
bool supported;
bool maybeClass;
QList<QMetaType::Type> allowedTypes;
};
class Field
{
%Docstring(signature="appended")
The Field class represents a Raster Attribute Table field, including its
name, usage and type.
.. versionadded:: 3.30
%End
%TypeHeaderCode
#include "qgsrasterattributetable.h"
%End
public:
Field( const QString &name, const Qgis::RasterAttributeTableFieldUsage &usage, const QMetaType::Type type );
%Docstring
Creates a new Field with ``name``, ``type`` and ``usage``.
%End
Field( const QString &name, const Qgis::RasterAttributeTableFieldUsage &usage, const QVariant::Type type ) /Deprecated/;
%Docstring
Creates a new Field with ``name``, ``type`` and ``usage``.
.. deprecated:: 3.38
Use the method with a QMetaType.Type argument instead.
%End
bool isColor( ) const;
%Docstring
Returns ``True`` if the field carries a color component (Red, Green,
Blue and optionally Alpha) information.
%End
bool isRamp( ) const;
%Docstring
Returns ``True`` if the field carries a color ramp component information
(RedMin/RedMax, GreenMin/GreenMax, BlueMin/BlueMax and optionally
AlphaMin/AlphaMax) information.
%End
QString name;
Qgis::RasterAttributeTableFieldUsage usage;
QMetaType::Type type;
};
class MinMaxClass
{
%Docstring(signature="appended")
The Field class represents a Raster Attribute Table classification entry
for a thematic Raster Attribute Table.
.. versionadded:: 3.30
%End
%TypeHeaderCode
#include "qgsrasterattributetable.h"
%End
public:
QString name;
QVector< double > minMaxValues;
QColor color;
};
Qgis::RasterAttributeTableType type() const;
%Docstring
Returns the Raster Attribute Table type.
%End
bool hasColor() const;
%Docstring
Returns ``True`` if the Raster Attribute Table has color RGBA
information.
.. seealso:: :py:func:`color`
.. seealso:: :py:func:`setColor`
.. seealso:: :py:func:`hasRamp`
.. seealso:: :py:func:`setRamp`
.. seealso:: :py:func:`ramp`
%End
bool setColor( const int row, const QColor &color );
%Docstring
Sets the color for the row at ``rowIndex`` to ``color``. ``returns``
``True`` on success.
.. seealso:: :py:func:`hasColor`
.. seealso:: :py:func:`setColor`
.. seealso:: :py:func:`hasRamp`
.. seealso:: :py:func:`setRamp`
.. seealso:: :py:func:`ramp`
%End
bool hasRamp() const;
%Docstring
Returns ``True`` if the Raster Attribute Table has ramp RGBA
information.
.. seealso:: :py:func:`setRamp`
.. seealso:: :py:func:`ramp`
.. seealso:: :py:func:`hasColor`
.. seealso:: :py:func:`setColor`
%End
bool setRamp( const int row, const QColor &colorMin, const QColor &colorMax );
%Docstring
Sets the color ramp for the row at ``rowIndex`` to ``colorMin`` and
``colorMax``. ``returns`` ``True`` on success.
.. seealso:: :py:func:`hasRamp`
.. seealso:: :py:func:`ramp`
.. seealso:: :py:func:`hasColor`
.. seealso:: :py:func:`setColor`
%End
QList<int> intUsages( ) const /PyName=usages/;
%Docstring
Returns the list of field usages.
%End
QColor color( int row ) const;
%Docstring
Returns the color of the rat ``row`` or an invalid color if row does not
exist or if there is no color definition.
.. seealso:: :py:func:`hasColor`
.. seealso:: :py:func:`setColor`
.. seealso:: :py:func:`hasRamp`
.. seealso:: :py:func:`setRamp`
.. seealso:: :py:func:`ramp`
%End
QgsGradientColorRamp ramp( int row ) const;
%Docstring
Returns the gradient color ramp of the rat ``row`` or a default
constructed gradient if row does not exist or if there is no color ramp
definition.
.. seealso:: :py:func:`hasRamp`
.. seealso:: :py:func:`setRamp`
.. seealso:: :py:func:`hasColor`
.. seealso:: :py:func:`setColor`
.. seealso:: :py:func:`color`
%End
QList<QgsRasterAttributeTable::Field> fields() const;
%Docstring
Returns the Raster Attribute Table fields.
.. seealso:: :py:func:`qgisFields`
%End
QgsFields qgisFields() const;
%Docstring
Returns the Raster Attribute Table fields as :py:class:`QgsFields`.
.. seealso:: :py:func:`fields`
%End
QgsFeatureList qgisFeatures( ) const;
%Docstring
Returns the Raster Attribute Table rows as a list of
:py:class:`QgsFeature`.
%End
bool isDirty() const;
%Docstring
Returns ``True`` if the Raster Attribute Table was modified from its
last reading from the storage.
%End
void setDirty( bool isDirty );
%Docstring
Sets the Raster Attribute Table dirty state to ``isDirty``;
%End
bool isValid( QString *errorMessage /Out/ = 0 ) const;
%Docstring
Returns ``True`` if the Raster Attribute Table is valid, optionally
reporting validity checks results in ``errorMessage``.
%End
bool insertField( int position, const QgsRasterAttributeTable::Field &field, QString *errorMessage /Out/ = 0 );
%Docstring
Inserts a new ``field`` at ``position``, optionally reporting any error
in ``errorMessage``, returns ``True`` on success.
.. note::
Out of range position is automatically clamped to a valid value.
%End
bool insertField( int position, const QString &name, const Qgis::RasterAttributeTableFieldUsage usage, const QMetaType::Type type, QString *errorMessage /Out/ = 0 );
%Docstring
Creates a new field from ``name``, ``usage`` and ``type`` and inserts it
at ``position``, optionally reporting any error in ``errorMessage``,
returns ``True`` on success.
%End
bool insertField( int position, const QString &name, const Qgis::RasterAttributeTableFieldUsage usage, const QVariant::Type type, QString *errorMessage /Out/ = 0 ) /Deprecated/;
%Docstring
Creates a new field from ``name``, ``usage`` and ``type`` and inserts it
at ``position``, optionally reporting any error in ``errorMessage``,
returns ``True`` on success.
.. deprecated:: 3.38
Use the method with a QMetaType.Type argument instead.
%End
bool insertColor( int position, QString *errorMessage /Out/ = 0 );
%Docstring
Create RGBA fields and inserts them at ``position``, optionally
reporting any error in ``errorMessage``, returns ``True`` on success.
%End
bool setFieldUsage( int fieldIndex, const Qgis::RasterAttributeTableFieldUsage usage );
%Docstring
Change the usage of the field at index ``fieldIndex`` to ``usage`` with
checks for allowed types.
:return: ``True`` on success.
%End
bool insertRamp( int position, QString *errorMessage /Out/ = 0 );
%Docstring
Create RGBA minimum and maximum fields and inserts them at ``position``,
optionally reporting any error in ``errorMessage``, returns ``True`` on
success.
%End
bool appendField( const QString &name, const Qgis::RasterAttributeTableFieldUsage usage, const QMetaType::Type type, QString *errorMessage /Out/ = 0 );
%Docstring
Creates a new field from ``name``, ``usage`` and ``type`` and appends it
to the fields, optionally reporting any error in ``errorMessage``,
returns ``True`` on success.
%End
bool appendField( const QString &name, const Qgis::RasterAttributeTableFieldUsage usage, const QVariant::Type type, QString *errorMessage /Out/ = 0 );
%Docstring
Creates a new field from ``name``, ``usage`` and ``type`` and appends it
to the fields, optionally reporting any error in ``errorMessage``,
returns ``True`` on success.
%End
bool appendField( const QgsRasterAttributeTable::Field &field, QString *errorMessage /Out/ = 0 );
%Docstring
Appends a new ``field``, optionally reporting any error in
``errorMessage``, returns ``True`` on success.
%End
bool removeField( const QString &name, QString *errorMessage /Out/ = 0 );
%Docstring
Removes the field with ``name``, optionally reporting any error in
``errorMessage``, returns ``True`` on success.
%End
bool insertRow( int position, const QVariantList &rowData, QString *errorMessage /Out/ = 0 );
%Docstring
Inserts a row of ``rowData`` in the Raster Attribute Table at
``position``, optionally reporting any error in ``errorMessage``,
returns ``True`` on success.
.. note::
Out of range position is automatically clamped to a valid value.
%End
bool removeRow( int position = 0, QString *errorMessage /Out/ = 0 );
%Docstring
Removes the row in the Raster Attribute Table at ``position``,
optionally reporting any error in ``errorMessage``, returns ``True`` on
success.
.. note::
position must be a valid position.
%End
bool appendRow( const QVariantList &data, QString *errorMessage /Out/ = 0 );
%Docstring
Appends a row of ``data`` to the RAT, optionally reporting any error in
``errorMessage``, returns ``True`` on success.
%End
bool writeToFile( const QString &path, QString *errorMessage /Out/ = 0 );
%Docstring
Writes the Raster Attribute Table to a DBF file specified by ``path``,
optionally reporting any error in ``errorMessage``, returns ``True`` on
success.
.. note::
".vat.dbf" extension is automatically added to the file path if not present.
%End
bool readFromFile( const QString &path, QString *errorMessage /Out/ = 0 );
%Docstring
Reads the Raster Attribute Table from a DBF file specified by ``path``,
optionally reporting any error in ``errorMessage``, returns ``True`` on
success.
%End
const QList<QList<QVariant>> data() const;
%Docstring
Returns the Raster Attribute Table rows.
%End
const QgsRasterAttributeTable::Field fieldByName( const QString name, bool *ok /Out/ = 0 ) const;
%Docstring
Returns a field by name or a default constructed field with empty name
if the field is not found.
:param name: of the field
:return: - the matching field or a default constructed one.
- ok: ``True`` if the field was found.
%End
const QList<QgsRasterAttributeTable::Field> fieldsByUsage( const Qgis::RasterAttributeTableFieldUsage fieldUsage ) const;
%Docstring
Returns the list of fields matching ``fieldUsage``.
%End
bool setValue( const int row, const int column, const QVariant &value );
%Docstring
Sets the ``value`` for ``row`` and ``column``.
:return: ``True`` on success.
%End
QVariant value( const int row, const int column ) const;
%Docstring
Returns the ``value`` for ``row`` and ``column``.
%End
double minimumValue( ) const;
%Docstring
Returns the minimum value of the MinMax (thematic) or Min (athematic)
column, returns NaN on errors.
%End
double maximumValue( ) const;
%Docstring
Returns the maximum value of the MinMax (thematic) or Max (athematic)
column, returns NaN on errors.
%End
QVariantList row( const double matchValue ) const;
%Docstring
Returns a row of data for the given ``matchValue`` or and empty row if
there is not match.
%End
QList<QgsRasterAttributeTable::MinMaxClass> minMaxClasses( const int classificationColumn = -1 ) const;
%Docstring
Returns the classes for a thematic Raster Attribute Table, classified by
``classificationColumn``, the default value of -1 makes the method guess
the classification column based on the field usage.
%End
QgsGradientColorRamp colorRamp( QStringList &labels /Out/, const int labelColumn = -1 ) const;
%Docstring
Returns the color ramp for an athematic Raster Attribute Table setting
the labels in ``labels``, optionally generated from ``labelColumn``.
%End
QgsRasterRenderer *createRenderer( QgsRasterDataProvider *provider, const int bandNumber, const int classificationColumn = -1 ) /Factory/;
%Docstring
Creates and returns a (possibly ``None``) raster renderer for the
specified ``provider`` and ``bandNumber`` and optionally reclassified by
``classificationColumn``, the default value of -1 makes the method guess
the classification column based on the field usage.
.. note::
athematic attribute tables with color ramps cannot be reclassified,
the renderer will still use the ``classificationColumn`` for
generating the class labels.
%End
QList<QList<QVariant>> orderedRows( ) const;
%Docstring
Returns the data rows ordered by the value column(s) in ascending order,
if the attribute table type is athematic the middle value for each row
range is considered for ordering. If the attribute table does not have
any value field (and hence is not valid), the current data are returned
without any change.
%End
static Qgis::RasterAttributeTableFieldUsage guessFieldUsage( const QString &name, const QMetaType::Type type );
%Docstring
Try to determine the field usage from its ``name`` and ``type``.
%End
static Qgis::RasterAttributeTableFieldUsage guessFieldUsage( const QString &name, const QVariant::Type type );
%Docstring
Try to determine the field usage from its ``name`` and ``type``.
%End
QString filePath() const;
%Docstring
Returns the (possibly empty) path of the file-based RAT, the path is set
when a RAT is read or written from/to a file.
.. seealso:: :py:func:`writeToFile`
.. seealso:: :py:func:`readFromFile`
%End
static QString usageName( const Qgis::RasterAttributeTableFieldUsage fieldusage );
%Docstring
Returns the translated human readable name of ``fieldUsage``.
.. seealso:: :py:func:`usageInformation`
%End
static QList<Qgis::RasterAttributeTableFieldUsage> valueAndColorFieldUsages();
%Docstring
Returns the list of field usages for colors and values.
%End
static QgsRasterAttributeTable *createFromRaster( QgsRasterLayer *rasterLayer, int *bandNumber /Out/ = 0 ) /Factory/;
%Docstring
Creates a new Raster Attribute Table from a raster layer, the renderer
must be Paletted or SingleBandPseudoColor, optionally reporting the
raster band from which the attribute table was created.
:param rasterLayer: raster layer
:return: - ``None`` in case of errors or unsupported renderer.
- bandNumber: band number
%End
static QHash<int, QgsRasterAttributeTable::UsageInformation> usageInformationInt( ) /PyName=usageInformation/;
%Docstring
Returns information about supported Raster Attribute Table usages.
.. seealso:: :py:func:`usageName`
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterattributetable.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|