QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
qgis.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgis.cpp
3
4 -------------------
5 begin : 2007
6 copyright : (C) 2007 by Gary E. Sherman
8***************************************************************************/
9
10/***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18#include "qgis.h"
19
20#include "moc_qgis.cpp"
21
22#ifndef QGSVERSION
23#include "qgsversion.h"
24#endif
25#include <QCoreApplication>
26#include <QColor>
27#include <QDate>
28#include <QTime>
29#include <QLocale>
30#include <QDateTime>
31#include "qgsconfig.h"
32#include "qgslogger.h"
33#include "qgsgdalutils.h"
34#include "qgswkbtypes.h"
35
36#include <gdal.h>
37#include <geos_c.h>
38#include <ogr_api.h>
39
40#define qgis_xstr(x) qgis_str(x)
41#define qgis_str(x) #x
42
43// Version constants
44//
45
46// development version
47const char *Qgis::QGIS_DEV_VERSION = QGSVERSION;
48
49const double Qgis::DEFAULT_SEARCH_RADIUS_MM = 2.;
50
51const float Qgis::DEFAULT_MAPTOPIXEL_THRESHOLD = 1.0f;
52
53const QColor Qgis::DEFAULT_HIGHLIGHT_COLOR = QColor( 255, 0, 0, 128 );
54
55const double Qgis::DEFAULT_HIGHLIGHT_BUFFER_MM = 0.5;
56
58
59const double Qgis::SCALE_PRECISION = 0.9999999999;
60
61const double Qgis::DEFAULT_Z_COORDINATE = 0.0;
62
63const double Qgis::DEFAULT_M_COORDINATE = 0.0;
64
65const double Qgis::DEFAULT_SNAP_TOLERANCE = 12.0;
66
68
69const int Qgis::USER_CRS_START_ID = 100000;
70const double Qgis::DEFAULT_POINT_SIZE = 2.0;
71const double Qgis::DEFAULT_LINE_WIDTH = 0.26;
72const double Qgis::DEFAULT_SEGMENT_EPSILON = 1e-8;
73
74const int Qgis::PREVIEW_JOB_DELAY_MS = 250;
76
77#ifdef Q_OS_WIN
78const double Qgis::UI_SCALE_FACTOR = 1.5;
79#else
80const double Qgis::UI_SCALE_FACTOR = 1;
81#endif
82
83double qgsPermissiveToDouble( QString string, bool &ok )
84{
85 //remove any thousands separators
86 string.remove( QLocale().groupSeparator() );
87 return QLocale().toDouble( string, &ok );
88}
89
90int qgsPermissiveToInt( QString string, bool &ok )
91{
92 //remove any thousands separators
93 string.remove( QLocale().groupSeparator() );
94 return QLocale().toInt( string, &ok );
95}
96
97qlonglong qgsPermissiveToLongLong( QString string, bool &ok )
98{
99 //remove any thousands separators
100 string.remove( QLocale().groupSeparator() );
101 return QLocale().toLongLong( string, &ok );
102}
103
104void *qgsMalloc( size_t size )
105{
106 if ( size == 0 )
107 {
108 QgsDebugError( QStringLiteral( "Zero size requested" ) );
109 return nullptr;
110 }
111
112 if ( ( size >> ( 8 * sizeof( size ) - 1 ) ) != 0 )
113 {
114 QgsDebugError( QStringLiteral( "qgsMalloc - bad size requested: %1" ).arg( size ) );
115 return nullptr;
116 }
117
118 void *p = malloc( size );
119 if ( !p )
120 {
121 QgsDebugError( QStringLiteral( "Allocation of %1 bytes failed." ).arg( size ) );
122 }
123 return p;
124}
125
126void qgsFree( void *ptr )
127{
128 free( ptr );
129}
130
131int qgsVariantCompare( const QVariant &lhs, const QVariant &rhs, bool strictTypeCheck )
132{
133 // invalid < NULL < any value
134 if ( !lhs.isValid() )
135 {
136 return rhs.isValid() ? -1 : 0;
137 }
138 else if ( lhs.isNull() )
139 {
140 if ( !rhs.isValid() )
141 return 1;
142 if ( rhs.isNull() )
143 return 0;
144 return -1;
145 }
146 else if ( !rhs.isValid() || rhs.isNull() )
147 {
148 return 1;
149 }
150
151 if ( strictTypeCheck && lhs.userType() != rhs.userType() )
152 {
153 return lhs.userType() < rhs.userType() ? -1 : 1;
154 }
155
156 // both valid
157 switch ( lhs.userType() )
158 {
159 case QMetaType::Type::Int:
160 case QMetaType::Type::Char:
161 case QMetaType::Type::Short:
162 {
163 switch ( rhs.userType() )
164 {
165 case QMetaType::Type::Int:
166 case QMetaType::Type::Char:
167 case QMetaType::Type::Short:
168 {
169 const int lhsInt = lhs.toInt();
170 const int rhsInt = rhs.toInt();
171 return lhsInt < rhsInt ? -1 : ( lhsInt == rhsInt ? 0 : 1 );
172 }
173
174 case QMetaType::Type::Long:
175 case QMetaType::Type::LongLong:
176 {
177 const long long lhsInt = lhs.toLongLong();
178 const long long rhsInt = rhs.toLongLong();
179 return lhsInt < rhsInt ? -1 : ( lhsInt == rhsInt ? 0 : 1 );
180 }
181
182 case QMetaType::Type::Double:
183 case QMetaType::Type::Float:
184 {
185 const double lhsDouble = static_cast< double >( lhs.toInt() );
186 const double rhsDouble = rhs.toDouble();
187
188 // consider NaN < any non-NaN
189 const bool lhsIsNan = std::isnan( lhsDouble );
190 const bool rhsIsNan = std::isnan( rhsDouble );
191 if ( lhsIsNan )
192 {
193 return rhsIsNan ? 0 : -1;
194 }
195 else if ( rhsIsNan )
196 {
197 return 1;
198 }
199
200 return lhsDouble < rhsDouble ? -1 : ( lhsDouble == rhsDouble ? 0 : 1 );
201 }
202
203 case QMetaType::Type::QString:
204 {
205 bool ok = false;
206 const double rhsDouble = rhs.toDouble( &ok );
207 if ( ok )
208 {
209 const double lhsDouble = static_cast< double >( lhs.toInt() );
210 return lhsDouble < rhsDouble ? -1 : ( lhsDouble == rhsDouble ? 0 : 1 );
211 }
212 break;
213 }
214
215 default:
216 break;
217 }
218 break;
219 }
220
221 case QMetaType::Type::UInt:
222 case QMetaType::Type::UChar:
223 case QMetaType::Type::UShort:
224 {
225 switch ( rhs.userType() )
226 {
227 case QMetaType::Type::UInt:
228 case QMetaType::Type::UChar:
229 case QMetaType::Type::UShort:
230 {
231 const uint lhsUInt = lhs.toUInt();
232 const uint rhsUInt = rhs.toUInt();
233 return lhsUInt < rhsUInt ? -1 : ( lhsUInt == rhsUInt ? 0 : 1 );
234 }
235
236 case QMetaType::Type::ULong:
237 case QMetaType::Type::ULongLong:
238 {
239 const qulonglong lhsInt = lhs.toULongLong();
240 const qulonglong rhsInt = rhs.toULongLong();
241 return lhsInt < rhsInt ? -1 : ( lhsInt == rhsInt ? 0 : 1 );
242 }
243
244 case QMetaType::Type::Double:
245 case QMetaType::Type::Float:
246 {
247 const double lhsDouble = static_cast< double >( lhs.toUInt() );
248 const double rhsDouble = rhs.toDouble();
249
250 // consider NaN < any non-NaN
251 const bool lhsIsNan = std::isnan( lhsDouble );
252 const bool rhsIsNan = std::isnan( rhsDouble );
253 if ( lhsIsNan )
254 {
255 return rhsIsNan ? 0 : -1;
256 }
257 else if ( rhsIsNan )
258 {
259 return 1;
260 }
261
262 return lhsDouble < rhsDouble ? -1 : ( lhsDouble == rhsDouble ? 0 : 1 );
263 }
264
265 case QMetaType::Type::QString:
266 {
267 bool ok = false;
268 const double rhsDouble = rhs.toDouble( &ok );
269 if ( ok )
270 {
271 const double lhsDouble = static_cast< double >( lhs.toUInt() );
272 return lhsDouble < rhsDouble ? -1 : ( lhsDouble == rhsDouble ? 0 : 1 );
273 }
274 break;
275 }
276
277 default:
278 break;
279 }
280 break;
281 }
282
283 case QMetaType::Type::LongLong:
284 case QMetaType::Type::Long:
285 {
286 switch ( rhs.userType() )
287 {
288 case QMetaType::Type::Int:
289 case QMetaType::Type::Char:
290 case QMetaType::Type::Short:
291 case QMetaType::Type::LongLong:
292 case QMetaType::Type::Long:
293 {
294 const qlonglong lhsLongLong = lhs.toLongLong();
295 const qlonglong rhsLongLong = rhs.toLongLong();
296 return lhsLongLong < rhsLongLong ? -1 : ( lhsLongLong == rhsLongLong ? 0 : 1 );
297 }
298
299 case QMetaType::Type::Double:
300 case QMetaType::Type::Float:
301 {
302 const double lhsDouble = static_cast< double >( lhs.toLongLong() );
303 const double rhsDouble = rhs.toDouble();
304
305 // consider NaN < any non-NaN
306 const bool lhsIsNan = std::isnan( lhsDouble );
307 const bool rhsIsNan = std::isnan( rhsDouble );
308 if ( lhsIsNan )
309 {
310 return rhsIsNan ? 0 : -1;
311 }
312 else if ( rhsIsNan )
313 {
314 return 1;
315 }
316
317 return lhsDouble < rhsDouble ? -1 : ( lhsDouble == rhsDouble ? 0 : 1 );
318 }
319
320 case QMetaType::Type::QString:
321 {
322 bool ok = false;
323 const double rhsDouble = rhs.toDouble( &ok );
324 if ( ok )
325 {
326 const double lhsDouble = static_cast< double >( lhs.toLongLong() );
327 return lhsDouble < rhsDouble ? -1 : ( lhsDouble == rhsDouble ? 0 : 1 );
328 }
329 break;
330 }
331
332 default:
333 break;
334 }
335 break;
336 }
337
338 case QMetaType::Type::ULongLong:
339 case QMetaType::Type::ULong:
340 {
341 switch ( rhs.userType() )
342 {
343 case QMetaType::Type::UInt:
344 case QMetaType::Type::UChar:
345 case QMetaType::Type::UShort:
346 case QMetaType::Type::ULongLong:
347 case QMetaType::Type::ULong:
348 {
349 const qulonglong lhsULongLong = lhs.toULongLong();
350 const qulonglong rhsULongLong = rhs.toULongLong();
351 return lhsULongLong < rhsULongLong ? -1 : ( lhsULongLong == rhsULongLong ? 0 : 1 );
352 }
353
354 default:
355 break;
356 }
357 break;
358 }
359
360 case QMetaType::Type::Double:
361 {
362 switch ( rhs.userType() )
363 {
364 case QMetaType::Type::Int:
365 case QMetaType::Type::Char:
366 case QMetaType::Type::Short:
367 case QMetaType::Type::Double:
368 case QMetaType::Type::Float:
369 case QMetaType::Type::LongLong:
370 case QMetaType::Type::Long:
371 case QMetaType::Type::ULongLong:
372 case QMetaType::Type::ULong:
373 case QMetaType::Type::QString:
374 {
375 const double lhsDouble = lhs.toDouble();
376 bool rhsIsDoubleCompatible = false;
377 const double rhsDouble = rhs.toDouble( &rhsIsDoubleCompatible );
378 if ( rhsIsDoubleCompatible )
379 {
380 // consider NaN < any non-NaN
381 const bool lhsIsNan = std::isnan( lhsDouble );
382 const bool rhsIsNan = std::isnan( rhsDouble );
383 if ( lhsIsNan )
384 {
385 return rhsIsNan ? 0 : -1;
386 }
387 else if ( rhsIsNan )
388 {
389 return 1;
390 }
391
392 return lhsDouble < rhsDouble ? -1 : ( lhsDouble == rhsDouble ? 0 : 1 );
393 }
394 break;
395 }
396
397 default:
398 break;
399 }
400 break;
401 }
402
403 case QMetaType::Type::Float:
404 {
405 switch ( rhs.userType() )
406 {
407 case QMetaType::Type::Int:
408 case QMetaType::Type::Char:
409 case QMetaType::Type::Short:
410 case QMetaType::Type::Double:
411 case QMetaType::Type::Float:
412 case QMetaType::Type::LongLong:
413 case QMetaType::Type::Long:
414 case QMetaType::Type::ULongLong:
415 case QMetaType::Type::ULong:
416 case QMetaType::Type::QString:
417 {
418 const float lhsFloat = lhs.toFloat();
419 bool rhsIsFloatCompatible = false;
420 const float rhsFloat = rhs.toFloat( &rhsIsFloatCompatible );
421 if ( rhsIsFloatCompatible )
422 {
423 // consider NaN < any non-NaN
424 const bool lhsIsNan = std::isnan( lhsFloat );
425 const bool rhsIsNan = std::isnan( rhsFloat );
426 if ( lhsIsNan )
427 {
428 return rhsIsNan ? 0 : -1;
429 }
430 else if ( rhsIsNan )
431 {
432 return 1;
433 }
434
435 return lhsFloat < rhsFloat ? -1 : ( lhsFloat == rhsFloat ? 0 : 1 );
436 }
437 break;
438 }
439 default:
440 break;
441 }
442 break;
443 }
444
445 case QMetaType::Type::QChar:
446 {
447 if ( rhs.userType() == QMetaType::Type::QChar )
448 {
449 const QChar lhsChar = lhs.toChar();
450 const QChar rhsChar = rhs.toChar();
451 return lhsChar < rhsChar ? -1 : ( lhsChar == rhsChar ? 0 : 1 );
452 }
453 break;
454 }
455
456 case QMetaType::Type::QDate:
457 {
458 if ( rhs.userType() == QMetaType::Type::QDate )
459 {
460 const QDate lhsDate = lhs.toDate();
461 const QDate rhsDate = rhs.toDate();
462 return lhsDate < rhsDate ? -1 : ( lhsDate == rhsDate ? 0 : 1 );
463 }
464 break;
465 }
466
467 case QMetaType::Type::QTime:
468 {
469 if ( rhs.userType() == QMetaType::Type::QTime )
470 {
471 const QTime lhsTime = lhs.toTime();
472 const QTime rhsTime = rhs.toTime();
473 return lhsTime < rhsTime ? -1 : ( lhsTime == rhsTime ? 0 : 1 );
474 }
475 break;
476 }
477
478 case QMetaType::Type::QDateTime:
479 {
480 if ( rhs.userType() == QMetaType::Type::QDateTime )
481 {
482 const QDateTime lhsTime = lhs.toDateTime();
483 const QDateTime rhsTime = rhs.toDateTime();
484 return lhsTime < rhsTime ? -1 : ( lhsTime == rhsTime ? 0 : 1 );
485 }
486 break;
487 }
488
489 case QMetaType::Type::Bool:
490 {
491 if ( rhs.userType() == QMetaType::Type::Bool )
492 {
493 const bool lhsBool = lhs.toBool();
494 const bool rhsBool = rhs.toBool();
495 return lhsBool == rhsBool ? 0 : ( lhsBool ? 1 : -1 );
496 }
497 break;
498 }
499
500 case QMetaType::Type::QVariantList:
501 {
502 if ( rhs.userType() == QMetaType::Type::QVariantList )
503 {
504 const QList<QVariant> &lhsl = lhs.toList();
505 const QList<QVariant> &rhsl = rhs.toList();
506
507 int i, n = std::min( lhsl.size(), rhsl.size() );
508 for ( i = 0; i < n && lhsl[i].userType() == rhsl[i].userType() && qgsVariantCompare( lhsl[i], rhsl[i] ) == 0; i++ )
509 ;
510
511 if ( i == n )
512 return lhsl.size() < rhsl.size() ? -1 : ( lhsl.size() > rhsl.size() ? 1 : 0 );
513 else
514 return qgsVariantCompare( lhsl[i], rhsl[i] );
515 }
516 break;
517 }
518
519 case QMetaType::Type::QStringList:
520 {
521 if ( rhs.userType() == QMetaType::Type::QStringList )
522 {
523 const QStringList &lhsl = lhs.toStringList();
524 const QStringList &rhsl = rhs.toStringList();
525
526 int i, n = std::min( lhsl.size(), rhsl.size() );
527 for ( i = 0; i < n && lhsl[i] == rhsl[i]; i++ )
528 ;
529
530 if ( i == n )
531 return lhsl.size() < rhsl.size() ? -1 : ( lhsl.size() > rhsl.size() ? 1 : 0 );
532 else
533 return lhsl[i] < rhsl[i] ? -1 : ( lhsl[i] == rhsl[i] ? 0 : 1 );
534 }
535 break;
536 }
537
538 case QMetaType::Type::QString:
539 {
540 switch ( rhs.userType() )
541 {
542 case QMetaType::Type::Int:
543 case QMetaType::Type::Char:
544 case QMetaType::Type::Short:
545 case QMetaType::Type::Double:
546 case QMetaType::Type::Float:
547 case QMetaType::Type::LongLong:
548 case QMetaType::Type::Long:
549 case QMetaType::Type::ULongLong:
550 case QMetaType::Type::ULong:
551 {
552 // try string to numeric conversion
553 bool lhsIsDoubleCompatible = false;
554 const double lhsDouble = lhs.toDouble( &lhsIsDoubleCompatible );
555 if ( lhsIsDoubleCompatible )
556 {
557 const double rhsDouble = rhs.toDouble();
558 // consider NaN < any non-NaN
559 const bool lhsIsNan = std::isnan( lhsDouble );
560 const bool rhsIsNan = std::isnan( rhsDouble );
561 if ( lhsIsNan )
562 {
563 return rhsIsNan ? 0 : -1;
564 }
565 else if ( rhsIsNan )
566 {
567 return 1;
568 }
569
570 return lhsDouble < rhsDouble ? -1 : ( lhsDouble == rhsDouble ? 0 : 1 );
571 }
572 break;
573 }
574
575 default:
576 break;
577 }
578
579 break;
580 }
581
582 default:
583 break;
584 }
585 return std::clamp( QString::localeAwareCompare( lhs.toString(), rhs.toString() ), -1, 1 );
586}
587
588bool qgsVariantLessThan( const QVariant &lhs, const QVariant &rhs )
589{
590 return qgsVariantCompare( lhs, rhs ) < 0;
591}
592
593bool qgsVariantGreaterThan( const QVariant &lhs, const QVariant &rhs )
594{
595 return qgsVariantCompare( lhs, rhs ) > 0;
596}
597
598QString qgsVsiPrefix( const QString &path )
599{
600 return QgsGdalUtils::vsiPrefixForPath( path );
601}
602
603uint qHash( const QVariant &variant )
604{
605 if ( !variant.isValid() || variant.isNull() )
606 return std::numeric_limits<uint>::max();
607
608 switch ( variant.userType() )
609 {
610 case QMetaType::Type::Int:
611 return qHash( variant.toInt() );
612 case QMetaType::Type::UInt:
613 return qHash( variant.toUInt() );
614 case QMetaType::Type::Bool:
615 return qHash( variant.toBool() );
616 case QMetaType::Type::Double:
617 return qHash( variant.toDouble() );
618 case QMetaType::Type::LongLong:
619 return qHash( variant.toLongLong() );
620 case QMetaType::Type::ULongLong:
621 return qHash( variant.toULongLong() );
622 case QMetaType::Type::QString:
623 return qHash( variant.toString() );
624 case QMetaType::Type::QChar:
625 return qHash( variant.toChar() );
626 case QMetaType::Type::QVariantList:
627 return qHash( variant.toList() );
628 case QMetaType::Type::QStringList:
629 return qHash( variant.toStringList() );
630 case QMetaType::Type::QByteArray:
631 return qHash( variant.toByteArray() );
632 case QMetaType::Type::QDate:
633 return qHash( variant.toDate() );
634 case QMetaType::Type::QTime:
635 return qHash( variant.toTime() );
636 case QMetaType::Type::QDateTime:
637 return qHash( variant.toDateTime() );
638 case QMetaType::Type::QUrl:
639 case QMetaType::Type::QLocale:
640 case QMetaType::Type::QRegularExpression:
641#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
642 case QMetaType::Type::QRegExp:
643#endif
644 return qHash( variant.toString() );
645 default:
646 break;
647 }
648
649 return std::numeric_limits<uint>::max();
650}
651
652bool qgsVariantEqual( const QVariant &lhs, const QVariant &rhs )
653{
654 if ( lhs.isNull() == rhs.isNull() )
655 {
656 if ( lhs.type() == QVariant::String && rhs.type() == QVariant::String )
657 {
658 const QString lhsString = lhs.toString();
659 const QString rhsString = rhs.toString();
660 return lhsString.isNull() == rhsString.isNull()
661 && lhsString.isEmpty() == rhsString.isEmpty()
662 && lhsString == rhsString;
663 }
664 if ( lhs == rhs )
665 return true;
666 }
667
668 return ( lhs.isNull() && rhs.isNull() && lhs.isValid() && rhs.isValid() );
669}
670
672{
673 return QStringLiteral( "1:1000000,1:500000,1:250000,1:100000,1:50000,1:25000,"
674 "1:10000,1:5000,1:2500,1:1000,1:500" );
675}
676
678{
679 return QString::fromUtf8( VERSION );
680}
681
683{
684 // Version number used for comparing versions using the
685 // "Check QGIS Version" function
686 return VERSION_INT;
687}
688
690{
691 return QString::fromUtf8( RELEASE_NAME );
692}
693
695{
696 return QString::fromUtf8( QGIS_DEV_VERSION );
697}
698
700{
701 return GEOSversion();
702}
703
705{
706#ifdef WITH_SFCGAL
707 return true;
708#else
709 return false;
710#endif
711}
712
714{
715#ifdef WITH_SFCGAL
716 return SFCGAL_VERSION_MAJOR_INT * 10000 + SFCGAL_VERSION_MINOR_INT * 100 + SFCGAL_VERSION_PATCH_INT;
717#else
718 throw QgsNotSupportedException( QObject::tr( "This operation requires a QGIS build based SFCGAL." ) );
719#endif
720}
721
723{
724#ifdef WITH_QTWEBKIT
725 return true;
726#else
727 return false;
728#endif
729}
730
732{
733 static const int version = QStringLiteral( "%1%2%3" )
734 .arg( GEOS_VERSION_MAJOR, 2, 10, QChar( '0' ) )
735 .arg( GEOS_VERSION_MINOR, 2, 10, QChar( '0' ) )
736 .arg( geosVersionPatch(), 2, 10, QChar( '0' ) ).toInt()
737 ;
738 return version;
739}
740
742{
743 return GEOS_VERSION_MAJOR;
744}
745
747{
748 return GEOS_VERSION_MINOR;
749}
750
752{
753 static const int version = atoi( qgis_xstr( GEOS_VERSION_PATCH ) );
754 return version;
755}
756
757#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
758template<>
759bool qMapLessThanKey<QVariantList>( const QVariantList &key1, const QVariantList &key2 )
760{
761 // qt's built in qMapLessThanKey for QVariantList is broken and does a case-insensitive operation.
762 // this breaks QMap< QVariantList, ... >, where key matching incorrectly becomes case-insensitive..!!?!
763 return qgsVariantGreaterThan( key1, key2 ) && key1 != key2;
764}
765#endif
static const Qgis::MapToolUnit DEFAULT_SNAP_UNITS
Default snapping distance units.
Definition qgis.h:6232
MapToolUnit
Type of unit of tolerance value from settings.
Definition qgis.h:4981
@ Pixels
Pixels unit of tolerance.
Definition qgis.h:4983
static const double DEFAULT_LINE_WIDTH
The default width (in millimeters) for line symbols.
Definition qgis.h:6243
static const double DEFAULT_HIGHLIGHT_MIN_WIDTH_MM
Default highlight line/stroke minimum width in mm.
Definition qgis.h:6194
static QString version()
Version string.
Definition qgis.cpp:677
static const int PREVIEW_JOB_DELAY_MS
Delay between the scheduling of 2 preview jobs.
Definition qgis.h:6249
static const double DEFAULT_Z_COORDINATE
Default Z coordinate value.
Definition qgis.h:6209
static const char * QGIS_DEV_VERSION
The development version.
Definition qgis.h:84
static QString geosVersion()
GEOS string version linked.
Definition qgis.cpp:699
static const double DEFAULT_SNAP_TOLERANCE
Default snapping distance tolerance.
Definition qgis.h:6227
static const double DEFAULT_M_COORDINATE
Default M coordinate value.
Definition qgis.h:6216
static const double DEFAULT_HIGHLIGHT_BUFFER_MM
Default highlight buffer in mm.
Definition qgis.h:6189
static int geosVersionPatch()
GEOS Patch version number linked.
Definition qgis.cpp:751
static const QColor DEFAULT_HIGHLIGHT_COLOR
Default highlight color.
Definition qgis.h:6184
static Q_DECL_DEPRECATED const double SCALE_PRECISION
Fudge factor used to compare two scales.
Definition qgis.h:6203
static const int MAXIMUM_LAYER_PREVIEW_TIME_MS
Maximum rendering time for a layer of a preview job.
Definition qgis.h:6252
static bool hasQtWebkit()
Returns true if the QGIS build contains QtWebkit.
Definition qgis.cpp:722
static QString devVersion()
The development version.
Definition qgis.cpp:694
static QString releaseName()
Release name.
Definition qgis.cpp:689
static QString defaultProjectScales()
A string with default project scales.
Definition qgis.cpp:671
static const float DEFAULT_MAPTOPIXEL_THRESHOLD
Default threshold between map coordinates and device coordinates for map2pixel simplification.
Definition qgis.h:6177
static int geosVersionMajor()
GEOS Major version number linked.
Definition qgis.cpp:741
static bool hasSfcgal()
Returns true if the QGIS build contains SFCGAL.
Definition qgis.cpp:704
static int sfcgalVersionInt()
Returns the version of the SFCGAL library if QGIS is built with SFCGAL.
Definition qgis.cpp:713
static const double DEFAULT_SEARCH_RADIUS_MM
Identify search radius in mm.
Definition qgis.h:6174
static const double DEFAULT_SEGMENT_EPSILON
Default snapping tolerance for segments.
Definition qgis.h:6246
static int versionInt()
Version number used for comparing versions using the "Check QGIS Version" function.
Definition qgis.cpp:682
static const int USER_CRS_START_ID
Minimum ID number for a user-defined projection.
Definition qgis.h:6237
static int geosVersionMinor()
GEOS Minor version number linked.
Definition qgis.cpp:746
static int geosVersionInt()
GEOS version number linked.
Definition qgis.cpp:731
static const double UI_SCALE_FACTOR
UI scaling factor.
Definition qgis.h:6222
static const double DEFAULT_POINT_SIZE
The default size (in millimeters) for point marker symbols.
Definition qgis.h:6240
static QString vsiPrefixForPath(const QString &path)
Returns a the vsi prefix which corresponds to a file path, or an empty string if the path is not asso...
Custom exception class which is raised when an operation is not supported.
#define qgis_xstr(x)
Definition qgis.cpp:40
void * qgsMalloc(size_t size)
Allocates size bytes and returns a pointer to the allocated memory.
Definition qgis.cpp:104
qlonglong qgsPermissiveToLongLong(QString string, bool &ok)
Converts a string to an qlonglong in a permissive way, e.g., allowing for incorrect numbers of digits...
Definition qgis.cpp:97
bool qgsVariantEqual(const QVariant &lhs, const QVariant &rhs)
Compares two QVariant values and returns whether they are equal, two NULL values are always treated a...
Definition qgis.cpp:652
uint qHash(const QVariant &variant)
Hash for QVariant.
Definition qgis.cpp:603
double qgsPermissiveToDouble(QString string, bool &ok)
Converts a string to a double in a permissive way, e.g., allowing for incorrect numbers of digits bet...
Definition qgis.cpp:83
int qgsPermissiveToInt(QString string, bool &ok)
Converts a string to an integer in a permissive way, e.g., allowing for incorrect numbers of digits b...
Definition qgis.cpp:90
void qgsFree(void *ptr)
Frees the memory space pointed to by ptr.
Definition qgis.cpp:126
QString qgsVsiPrefix(const QString &path)
Returns a the vsi prefix which corresponds to a file path, or an empty string if the path is not asso...
Definition qgis.cpp:598
bool qgsVariantLessThan(const QVariant &lhs, const QVariant &rhs)
Compares two QVariant values and returns whether the first is less than the second.
Definition qgis.cpp:588
int qgsVariantCompare(const QVariant &lhs, const QVariant &rhs, bool strictTypeCheck)
Compares two QVariant values.
Definition qgis.cpp:131
bool qgsVariantGreaterThan(const QVariant &lhs, const QVariant &rhs)
Compares two QVariant values and returns whether the first is greater than the second.
Definition qgis.cpp:593
#define QgsDebugError(str)
Definition qgslogger.h:57