QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
|
#include <QMetaEnum>
#include <cfloat>
#include <memory>
#include <cmath>
#include "qgis_core.h"
#include "qgis_sip.h"
Go to the source code of this file.
Classes | |
class | Qgis |
The Qgis class provides global constants for use throughout the application. More... | |
class | QgsSignalBlocker< Object > |
RAII signal blocking class. More... | |
Macros | |
#define | BUILTIN_UNREACHABLE |
#define | cast_to_fptr(f) f |
#define | CONSTLATIN1STRING constexpr QLatin1String |
#define | MAYBE_UNUSED |
#define | NODISCARD Q_REQUIRED_RESULT |
#define | Q_NOWARN_DEPRECATED_POP |
#define | Q_NOWARN_DEPRECATED_PUSH |
#define | Q_NOWARN_UNREACHABLE_POP |
#define | Q_NOWARN_UNREACHABLE_PUSH |
#define | QGISEXTERN extern "C" |
#define | QHASH_FOR_CLASS_ENUM(T) |
Typedefs | |
typedef unsigned long long | qgssize |
Qgssize is used instead of size_t, because size_t is stdlib type, unknown by SIP, and it would be hard to define size_t correctly in SIP. | |
typedef QMap< QString, QString > | QgsStringMap |
Functions | |
CONSTLATIN1STRING | geoEpsgCrsAuthId () |
Geographic coord sys from EPSG authority. | |
CONSTLATIN1STRING | geoNone () |
Constant that holds the string representation for "No ellips/No CRS". | |
CONSTLATIN1STRING | geoProj4 () |
PROJ4 string that represents a geographic coord sys. | |
CONSTLATIN1STRING | geoWkt () |
Wkt string that represents a geographic coord sys. | |
bool | operator< (const QVariant &v1, const QVariant &v2) |
Compares two QVariant values and returns whether the first is less than the second. | |
bool | operator> (const QVariant &v1, const QVariant &v2) |
Compares two QVariant values and returns whether the first is greater than the second. | |
bool | qgsDoubleNear (double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon()) |
Compare two doubles (but allow some difference) | |
bool | qgsDoubleNearSig (double a, double b, int significantDigits=10) |
Compare two doubles using specified number of significant digits. | |
QString | qgsDoubleToString (double a, int precision=17) |
Returns a string representation of a double. | |
template<class T > | |
T | qgsEnumKeyToValue (const QString &key, const T &defaultValue, bool tryValueAsKey=true, bool *returnOk=nullptr) |
Returns the value corresponding to the given key of an enum. | |
template<class T > | |
const QList< T > | qgsEnumList () |
Returns a list all enum entries. | |
template<class T > | |
const QMap< T, QString > | qgsEnumMap () |
Returns a map of all enum entries. | |
template<class T > | |
QString | qgsEnumValueToKey (const T &value, bool *returnOk=nullptr) |
Returns the value for the given key of an enum. | |
template<class T > | |
T | qgsFlagKeysToValue (const QString &keys, const T &defaultValue, bool tryValueAsKey=true, bool *returnOk=nullptr) |
Returns the value corresponding to the given keys of a flag. | |
template<class T > | |
QString | qgsFlagValueToKeys (const T &value, bool *returnOk=nullptr) |
Returns the value for the given keys of a flag. | |
bool | qgsFloatNear (float a, float b, float epsilon=4 *FLT_EPSILON) |
Compare two floats (but allow some difference) | |
void CORE_EXPORT | qgsFree (void *ptr) |
Frees the memory space pointed to by ptr. | |
void CORE_EXPORT * | qgsMalloc (size_t size) |
Allocates size bytes and returns a pointer to the allocated memory. | |
template<class Key , class Value > | |
QString | qgsMapJoinKeys (const QMap< Key, Value > &map, const QString &separator) |
Joins all the map keys into a single string with each element separated by the given separator. | |
template<class Key , class Value > | |
QString | qgsMapJoinValues (const QMap< Key, Value > &map, const QString &separator) |
Joins all the map values into a single string with each element separated by the given separator. | |
bool | qgsNanCompatibleEquals (double a, double b) |
Compare two doubles, treating nan values as equal. | |
template<typename T > | |
bool | qgsNumberNear (T a, T b, T epsilon=std::numeric_limits< T >::epsilon() *4) |
Compare two numbers of type T (but allow some difference) | |
CORE_EXPORT double | qgsPermissiveToDouble (QString string, bool &ok) |
Converts a string to a double in a permissive way, e.g., allowing for incorrect numbers of digits between thousand separators. | |
CORE_EXPORT int | qgsPermissiveToInt (QString string, bool &ok) |
Converts a string to an integer in a permissive way, e.g., allowing for incorrect numbers of digits between thousand separators. | |
CORE_EXPORT qlonglong | qgsPermissiveToLongLong (QString string, bool &ok) |
Converts a string to an qlonglong in a permissive way, e.g., allowing for incorrect numbers of digits between thousand separators. | |
double | qgsRound (double number, int places) |
Returns a double number, rounded (as close as possible) to the specified number of places. | |
template<class T > | |
QString | qgsSetJoin (const QSet< T > &set, const QString &separator) |
Joins all the set values into a single string with each element separated by the given separator. | |
CORE_EXPORT bool | qgsVariantEqual (const QVariant &lhs, const QVariant &rhs) |
Compares two QVariant values and returns whether they are equal, two NULL values are always treated as equal and 0 is not treated as equal with NULL. | |
CORE_EXPORT bool | qgsVariantGreaterThan (const QVariant &lhs, const QVariant &rhs) |
Compares two QVariant values and returns whether the first is greater than the second. | |
CORE_EXPORT bool | qgsVariantLessThan (const QVariant &lhs, const QVariant &rhs) |
Compares two QVariant values and returns whether the first is less than the second. | |
CORE_EXPORT QString | qgsVsiPrefix (const QString &path) |
CORE_EXPORT uint | qHash (const QVariant &variant) |
Hash for QVariant. | |
template<class Object > | |
QgsSignalBlocker< Object > | whileBlocking (Object *object) |
Temporarily blocks signals from a QObject while calling a single method from the object. | |
Variables | |
const double | DEFAULT_LINE_WIDTH = 0.26 |
const double | DEFAULT_POINT_SIZE = 2.0 |
Magic number that determines the default point size for point symbols. | |
const double | DEFAULT_SEGMENT_EPSILON = 1e-8 |
Default snapping tolerance for segments. | |
const long | GEO_EPSG_CRS_ID = 4326 |
Magic number for a geographic coord sys in EpsgCrsId ID format. | |
const long | GEOCRS_ID = 3452 |
Magic number for a geographic coord sys in QGIS srs.db tbl_srs.srs_id. | |
const long | GEOSRID = 4326 |
Magic number for a geographic coord sys in POSTGIS SRID. | |
const int | USER_CRS_START_ID = 100000 |
Magick number that determines whether a projection crsid is a system (srs.db) or user (~/.qgis.qgis.db) defined projection. | |
#define QHASH_FOR_CLASS_ENUM | ( | T | ) |
typedef unsigned long long qgssize |
Qgssize is used instead of size_t, because size_t is stdlib type, unknown by SIP, and it would be hard to define size_t correctly in SIP.
Currently used "unsigned long long" was introduced in C++11 (2011) but it was supported already before C++11 on common platforms. "unsigned long long int" gives syntax error in SIP. KEEP IN SYNC WITH qgssize defined in SIP!
typedef QMap<QString, QString> QgsStringMap |
CONSTLATIN1STRING geoEpsgCrsAuthId | ( | ) |
CONSTLATIN1STRING geoNone | ( | ) |
CONSTLATIN1STRING geoProj4 | ( | ) |
CONSTLATIN1STRING geoWkt | ( | ) |
|
inline |
Compares two QVariant values and returns whether the first is less than the second.
Useful for sorting lists of variants, correctly handling sorting of the various QVariant data types (such as strings, numeric values, dates and times)
Invalid < NULL < Values
|
inline |
Compares two QVariant values and returns whether the first is greater than the second.
Useful for sorting lists of variants, correctly handling sorting of the various QVariant data types (such as strings, numeric values, dates and times)
|
inline |
|
inline |
|
inline |
T qgsEnumKeyToValue | ( | const QString & | key, |
const T & | defaultValue, | ||
bool | tryValueAsKey = true , |
||
bool * | returnOk = nullptr |
||
) |
Returns the value corresponding to the given key of an enum.
If the key is invalid, it will return the defaultValue. If tryValueAsKey is true
, it will try to convert the string key to an enum value If returnOk is given, it defines if the key could be converted to the value or if it had returned the default
const QList< T > qgsEnumList | ( | ) |
const QMap< T, QString > qgsEnumMap | ( | ) |
QString qgsEnumValueToKey | ( | const T & | value, |
bool * | returnOk = nullptr |
||
) |
T qgsFlagKeysToValue | ( | const QString & | keys, |
const T & | defaultValue, | ||
bool | tryValueAsKey = true , |
||
bool * | returnOk = nullptr |
||
) |
Returns the value corresponding to the given keys of a flag.
If the keys are invalid, it will return the defaultValue. If tryValueAsKey is true
, it will try to convert the string key to an enum value. If returnOk is given, it defines if the key could be converted to the value or if it had returned the default
QString qgsFlagValueToKeys | ( | const T & | value, |
bool * | returnOk = nullptr |
||
) |
|
inline |
void CORE_EXPORT qgsFree | ( | void * | ptr | ) |
void CORE_EXPORT * qgsMalloc | ( | size_t | size | ) |
QString qgsMapJoinKeys | ( | const QMap< Key, Value > & | map, |
const QString & | separator | ||
) |
QString qgsMapJoinValues | ( | const QMap< Key, Value > & | map, |
const QString & | separator | ||
) |
|
inline |
|
inline |
CORE_EXPORT double qgsPermissiveToDouble | ( | QString | string, |
bool & | ok | ||
) |
Converts a string to a double in a permissive way, e.g., allowing for incorrect numbers of digits between thousand separators.
string | string to convert |
ok | will be set to true if conversion was successful |
CORE_EXPORT int qgsPermissiveToInt | ( | QString | string, |
bool & | ok | ||
) |
Converts a string to an integer in a permissive way, e.g., allowing for incorrect numbers of digits between thousand separators.
string | string to convert |
ok | will be set to true if conversion was successful |
CORE_EXPORT qlonglong qgsPermissiveToLongLong | ( | QString | string, |
bool & | ok | ||
) |
Converts a string to an qlonglong in a permissive way, e.g., allowing for incorrect numbers of digits between thousand separators.
string | string to convert |
ok | will be set to true if conversion was successful |
|
inline |
QString qgsSetJoin | ( | const QSet< T > & | set, |
const QString & | separator | ||
) |
CORE_EXPORT bool qgsVariantEqual | ( | const QVariant & | lhs, |
const QVariant & | rhs | ||
) |
CORE_EXPORT bool qgsVariantGreaterThan | ( | const QVariant & | lhs, |
const QVariant & | rhs | ||
) |
Compares two QVariant values and returns whether the first is greater than the second.
Useful for sorting lists of variants, correctly handling sorting of the various QVariant data types (such as strings, numeric values, dates and times)
CORE_EXPORT bool qgsVariantLessThan | ( | const QVariant & | lhs, |
const QVariant & | rhs | ||
) |
Compares two QVariant values and returns whether the first is less than the second.
Useful for sorting lists of variants, correctly handling sorting of the various QVariant data types (such as strings, numeric values, dates and times)
Invalid < NULL < Values
CORE_EXPORT uint qHash | ( | const QVariant & | variant | ) |
|
inline |
Temporarily blocks signals from a QObject while calling a single method from the object.
Usage: whileBlocking( checkBox )->setChecked( true ); whileBlocking( spinBox )->setValue( 50 );
No signals will be emitted when calling these methods.
const double DEFAULT_POINT_SIZE = 2.0 |
const double DEFAULT_SEGMENT_EPSILON = 1e-8 |
const long GEO_EPSG_CRS_ID = 4326 |
const long GEOCRS_ID = 3452 |
const long GEOSRID = 4326 |