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