QGIS API Documentation  3.21.0-Master (909859188c)
qgis.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgis.h - QGIS namespace
3  -------------------
4  begin : Sat Jun 30 2002
5  copyright : (C) 2002 by Gary E.Sherman
6  email : sherman at mrcc.com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGIS_H
19 #define QGIS_H
20 
21 
22 #include <QMetaEnum>
23 #include <cfloat>
24 #include <memory>
25 #include <cmath>
26 
27 #include "qgstolerance.h"
28 #include "qgis_core.h"
29 #include "qgis_sip.h"
30 
31 #ifdef SIP_RUN
32 % ModuleHeaderCode
33 #include <qgis.h>
34 % End
35 
36 % ModuleCode
37 int QgisEvent = QEvent::User + 1;
38 % End
39 #endif
40 
47  {
51  MeshLayer,
55 };
56 
57 
62 class CORE_EXPORT Qgis
63 {
64  Q_GADGET
65  public:
66 
72  static QString version();
73 
79  static int versionInt();
80 
86  static QString releaseName();
87 
89  static const char *QGIS_DEV_VERSION;
90 
96  static QString devVersion();
97 
98  // Enumerations
99  //
100 
106  {
107  Info = 0,
108  Warning = 1,
109  Critical = 2,
110  Success = 3,
111  NoLevel = 4,
112  };
113  Q_ENUM( MessageLevel )
114 
115 
120  {
121  UnknownDataType = 0,
122  Byte = 1,
123  UInt16 = 2,
124  Int16 = 3,
125  UInt32 = 4,
126  Int32 = 5,
127  Float32 = 6,
128  Float64 = 7,
129  CInt16 = 8,
130  CInt32 = 9,
131  CFloat32 = 10,
132  CFloat64 = 11,
133  ARGB32 = 12,
134  ARGB32_Premultiplied = 13
135  };
136  Q_ENUM( DataType )
137 
138 
143  {
144  Never = 0,
145  Ask = 1,
146  SessionOnly = 2,
147  Always = 3,
148  NotForThisSession,
149  };
150  Q_ENUM( PythonMacroMode )
151 
152 
158  {
159  Uncounted = -2,
160  UnknownCount = -1,
161  };
162  Q_ENUM( FeatureCountState )
163 
164 
169  {
170  Marker,
171  Line,
172  Fill,
173  Hybrid
174  };
175  Q_ENUM( SymbolType )
176 
177 
183  {
184  ScaleArea,
185  ScaleDiameter
186  };
187  Q_ENUM( ScaleMethod )
188 
189 
195  {
196  DynamicRotation = 2,
197  };
198  Q_ENUM( SymbolRenderHint )
199  Q_DECLARE_FLAGS( SymbolRenderHints, SymbolRenderHint )
200 
201 
206  enum class SymbolFlag : int
207  {
208  RendererShouldUseSymbolLevels = 1 << 0,
209  };
210  Q_ENUM( SymbolFlag )
211  Q_DECLARE_FLAGS( SymbolFlags, SymbolFlag )
212 
213 
219  {
220  FlagIncludeCrosshairsForMarkerSymbols = 1 << 0,
221  };
222  Q_ENUM( SymbolPreviewFlag )
223  Q_DECLARE_FLAGS( SymbolPreviewFlags, SymbolPreviewFlag )
224 
225 
231  {
232  Collection,
233  Directory,
234  Layer,
235  Error,
236  Favorites,
237  Project,
238  Custom,
239  Fields,
240  Field,
241  };
242  Q_ENUM( BrowserItemType )
243 
244 
250  {
251  NotPopulated,
252  Populating,
253  Populated,
254  };
255  Q_ENUM( BrowserItemState )
256 
257 
263  {
264  NoCapabilities = 0,
265  SetCrs = 1 << 0,
266  Fertile = 1 << 1,
267  Fast = 1 << 2,
268  Collapse = 1 << 3,
269  Rename = 1 << 4,
270  Delete = 1 << 5,
271  ItemRepresentsFile = 1 << 6,
272  };
273  Q_ENUM( BrowserItemCapability )
274  Q_DECLARE_FLAGS( BrowserItemCapabilities, BrowserItemCapability )
275 
276 
282  {
283  NoType,
284  Vector,
285  Raster,
286  Point,
287  Line,
288  Polygon,
289  TableLayer,
290  Database,
291  Table,
292  Plugin,
293  Mesh,
294  VectorTile,
295  PointCloud
296  };
297  Q_ENUM( BrowserLayerType )
298 
299 
304  enum class BrowserDirectoryMonitoring : int
305  {
306  Default,
307  NeverMonitor,
308  AlwaysMonitor,
309  };
310  Q_ENUM( BrowserDirectoryMonitoring )
311 
312 
316  enum class HttpMethod : int
317  {
318  Get = 0,
319  Post = 1
320  };
321  Q_ENUM( HttpMethod )
322 
323 
329  {
330  Success SIP_MONKEYPATCH_COMPAT_NAME( NoError ) = 0,
331  ErrorCreatingDataSource SIP_MONKEYPATCH_COMPAT_NAME( ErrCreateDataSource ),
332  ErrorCreatingLayer SIP_MONKEYPATCH_COMPAT_NAME( ErrCreateLayer ),
333  ErrorAttributeTypeUnsupported SIP_MONKEYPATCH_COMPAT_NAME( ErrAttributeTypeUnsupported ),
334  ErrorAttributeCreationFailed SIP_MONKEYPATCH_COMPAT_NAME( ErrAttributeCreationFailed ),
335  ErrorProjectingFeatures SIP_MONKEYPATCH_COMPAT_NAME( ErrProjection ),
336  ErrorFeatureWriteFailed SIP_MONKEYPATCH_COMPAT_NAME( ErrFeatureWriteFailed ),
337  ErrorInvalidLayer SIP_MONKEYPATCH_COMPAT_NAME( ErrInvalidLayer ),
338  ErrorInvalidProvider SIP_MONKEYPATCH_COMPAT_NAME( ErrInvalidProvider ),
339  ErrorProviderUnsupportedFeature SIP_MONKEYPATCH_COMPAT_NAME( ErrProviderUnsupportedFeature ),
340  ErrorConnectionFailed SIP_MONKEYPATCH_COMPAT_NAME( ErrConnectionFailed ),
341  UserCanceled SIP_MONKEYPATCH_COMPAT_NAME( ErrUserCanceled ),
342  };
343  Q_ENUM( VectorExportResult )
344 
345 
350  {
351  SubsetStringFilter = 1 << 1,
352  GeometryColumn = 1 << 2,
353  PrimaryKeys = 1 << 3,
354  UnstableFeatureIds = 1 << 4
355  };
356  Q_ENUM( SqlLayerDefinitionCapability )
357  Q_DECLARE_FLAGS( SqlLayerDefinitionCapabilities, SqlLayerDefinitionCapability )
358 
359 
364  enum class SqlKeywordCategory : int
365  {
366  Keyword,
367  Constant,
368  Function,
369  Geospatial,
370  Operator,
371  Math,
372  Aggregate,
373  String,
374  Identifier
375  };
376  Q_ENUM( SqlKeywordCategory )
377 
378 
382  enum class DriveType : int
383  {
384  Unknown,
385  Invalid,
386  Removable,
387  Fixed,
388  Remote,
389  CdRom,
390  RamDisk,
391  };
392  Q_ENUM( DriveType )
393 
394 
399  {
400  Deferred SIP_MONKEYPATCH_COMPAT_NAME( DownloadLater ),
401  Immediate SIP_MONKEYPATCH_COMPAT_NAME( DownloadImmediately ),
402  };
403  Q_ENUM( ActionStart )
404 
405 
410  enum class UnplacedLabelVisibility : int
411  {
412  FollowEngineSetting,
413  NeverShow,
414  };
415  Q_ENUM( UnplacedLabelVisibility )
416 
417 
422  enum class SublayerQueryFlag : int
423  {
424  FastScan = 1 << 0,
425  ResolveGeometryType = 1 << 1,
426  CountFeatures = 1 << 2,
427  IncludeSystemTables = 1 << 3,
428  };
429  Q_DECLARE_FLAGS( SublayerQueryFlags, SublayerQueryFlag )
430  Q_ENUM( SublayerQueryFlag )
431 
432 
437  enum class SublayerFlag : int
438  {
439  SystemTable = 1 << 0,
440  };
441  Q_DECLARE_FLAGS( SublayerFlags, SublayerFlag )
442  Q_ENUM( SublayerFlag )
443 
444 
450  {
451  Unknown SIP_MONKEYPATCH_COMPAT_NAME( UnknownRole ) = 0,
452  Provider SIP_MONKEYPATCH_COMPAT_NAME( ProviderRole ) = 1,
453  Renderer SIP_MONKEYPATCH_COMPAT_NAME( RendererRole ) = 2,
454  Brightness SIP_MONKEYPATCH_COMPAT_NAME( BrightnessRole ) = 3,
455  Resampler SIP_MONKEYPATCH_COMPAT_NAME( ResamplerRole ) = 4,
456  Projector SIP_MONKEYPATCH_COMPAT_NAME( ProjectorRole ) = 5,
457  Nuller SIP_MONKEYPATCH_COMPAT_NAME( NullerRole ) = 6,
458  HueSaturation SIP_MONKEYPATCH_COMPAT_NAME( HueSaturationRole ) = 7,
459  };
460  Q_ENUM( RasterPipeInterfaceRole )
461 
462 
467  {
469  ResampleFilter,
471  Provider
472  };
473  Q_ENUM( RasterResamplingStage )
474 
475 
480  enum class MeshEditingErrorType : int
481  {
482  NoError,
483  InvalidFace,
484  TooManyVerticesInFace,
485  FlatFace,
486  UniqueSharedVertex,
487  InvalidVertex,
488  ManifoldFace,
489  };
490  Q_ENUM( MeshEditingErrorType )
491 
492 
497  enum class FilePathType : int
498  {
499  Absolute,
500  Relative,
501  };
502  Q_ENUM( FilePathType )
503 
504 
509  enum class SublayerPromptMode : int
510  {
511  AlwaysAsk,
512  AskExcludingRasterBands,
513  NeverAskSkip,
514  NeverAskLoadAll,
515  };
516  Q_ENUM( SublayerPromptMode )
517 
518 
524  {
525  SetSelection,
526  AddToSelection,
527  IntersectSelection,
528  RemoveFromSelection,
529  };
530  Q_ENUM( SelectBehavior )
531 
532 
538  {
539  Success = 0,
540  EmptyGeometry = 1,
541  EditFailed = 2,
542  FetchFeatureFailed = 3,
543  InvalidLayer = 4,
544  };
545  Q_ENUM( VectorEditResult )
546 
547 
553  {
554  SemiTransparentCircle,
555  Cross,
556  NoMarker,
557  };
558  Q_ENUM( VertexMarkerType )
559 
560 
564  enum class ContentStatus : int
565  {
566  NotStarted,
567  Running,
568  Finished,
569  Failed,
570  Canceled,
571  };
572  Q_ENUM( ContentStatus )
573 
574 
579  enum class BabelFormatCapability : int
580  {
581  Import = 1 << 0,
582  Export = 1 << 1,
583  Waypoints = 1 << 2,
584  Routes = 1 << 3,
585  Tracks = 1 << 4,
586  };
587  Q_DECLARE_FLAGS( BabelFormatCapabilities, BabelFormatCapability )
588  Q_ENUM( BabelFormatCapability )
589 
590 
596  enum class BabelCommandFlag : int
597  {
598  QuoteFilePaths = 1 << 0,
599  };
600  Q_DECLARE_FLAGS( BabelCommandFlags, BabelCommandFlag )
601  Q_ENUM( BabelCommandFlag )
602 
603 
608  enum class GpsFeatureType : int
609  {
610  Waypoint,
611  Route,
612  Track,
613  };
614  Q_ENUM( GpsFeatureType )
615 
616 
624  {
625  Success = 0,
626  NothingHappened = 1000,
627  InvalidBaseGeometry,
628  InvalidInputGeometryType,
629  SelectionIsEmpty,
630  SelectionIsGreaterThanOne,
631  GeometryEngineError,
632  LayerNotEditable,
633  /* Add part issues */
634  AddPartSelectedGeometryNotFound,
635  AddPartNotMultiGeometry,
636  /* Add ring issues*/
637  AddRingNotClosed,
638  AddRingNotValid,
639  AddRingCrossesExistingRings,
640  AddRingNotInExistingFeature,
641  /* Split features */
642  SplitCannotSplitPoint,
643  };
644  Q_ENUM( GeometryOperationResult )
645 
646 
652  {
653  AllowSelfTouchingHoles SIP_MONKEYPATCH_COMPAT_NAME( FlagAllowSelfTouchingHoles ) = 1 << 0,
654  };
655  Q_DECLARE_FLAGS( GeometryValidityFlags, GeometryValidityFlag )
656  Q_ENUM( GeometryValidityFlag )
657 
658 
663  {
664  QgisInternal SIP_MONKEYPATCH_COMPAT_NAME( ValidatorQgisInternal ),
665  Geos SIP_MONKEYPATCH_COMPAT_NAME( ValidatorGeos ),
666  };
667  Q_ENUM( GeometryValidationEngine )
668 
669 
675  {
676  Left SIP_MONKEYPATCH_COMPAT_NAME( SideLeft ) = 0,
677  Right SIP_MONKEYPATCH_COMPAT_NAME( SideRight ),
678  };
679  Q_ENUM( BufferSide )
680 
681 
687  {
688  Round SIP_MONKEYPATCH_COMPAT_NAME( CapRound ) = 1,
689  Flat SIP_MONKEYPATCH_COMPAT_NAME( CapFlat ),
690  Square SIP_MONKEYPATCH_COMPAT_NAME( CapSquare ),
691  };
692  Q_ENUM( EndCapStyle )
693 
694 
700  {
701  Round SIP_MONKEYPATCH_COMPAT_NAME( JoinStyleRound ) = 1,
702  Miter SIP_MONKEYPATCH_COMPAT_NAME( JoinStyleMiter ),
703  Bevel SIP_MONKEYPATCH_COMPAT_NAME( JoinStyleBevel ),
704  };
705  Q_ENUM( JoinStyle )
706 
707 
712  enum class SpatialFilterType : int
713  {
714  NoFilter,
715  BoundingBox,
716  DistanceWithin,
717  };
718  Q_ENUM( SpatialFilterType )
719 
720 
725  enum class FileOperationFlag : int
726  {
727  IncludeMetadataFile = 1 << 0,
728  IncludeStyleFile = 1 << 1,
729  };
730  Q_DECLARE_FLAGS( FileOperationFlags, FileOperationFlag )
731  Q_ENUM( FileOperationFlag )
732 
733 
738  enum class MapLayerProperty : int
739  {
740  UsersCannotToggleEditing = 1 << 0,
741  };
742  Q_DECLARE_FLAGS( MapLayerProperties, MapLayerProperty )
743  Q_ENUM( MapLayerProperty )
744 
745 
750  enum class AnnotationItemFlag : int
751  {
752  ScaleDependentBoundingBox = 1 << 0,
753  };
754  Q_DECLARE_FLAGS( AnnotationItemFlags, AnnotationItemFlag )
755  Q_ENUM( AnnotationItemFlag )
756 
757 
762  enum class AnnotationItemGuiFlag : int
763  {
764  FlagNoCreationTools = 1 << 0,
765  };
766  Q_DECLARE_FLAGS( AnnotationItemGuiFlags, AnnotationItemGuiFlag )
767  Q_ENUM( AnnotationItemGuiFlag )
768 
769 
774  enum class AnnotationItemNodeType : int
775  {
776  VertexHandle,
777  };
778  Q_ENUM( AnnotationItemNodeType )
779 
780 
786  {
787  Success,
788  Invalid,
789  ItemCleared,
790  };
791  Q_ENUM( AnnotationItemEditOperationResult )
792 
793 
799  {
800  FixedTemporalRange SIP_MONKEYPATCH_COMPAT_NAME( ModeFixedTemporalRange ) = 0,
801  FeatureDateTimeInstantFromField SIP_MONKEYPATCH_COMPAT_NAME( ModeFeatureDateTimeInstantFromField ),
802  FeatureDateTimeStartAndEndFromFields SIP_MONKEYPATCH_COMPAT_NAME( ModeFeatureDateTimeStartAndEndFromFields ),
803  FeatureDateTimeStartAndDurationFromFields SIP_MONKEYPATCH_COMPAT_NAME( ModeFeatureDateTimeStartAndDurationFromFields ),
804  FeatureDateTimeStartAndEndFromExpressions SIP_MONKEYPATCH_COMPAT_NAME( ModeFeatureDateTimeStartAndEndFromExpressions ),
805  RedrawLayerOnly SIP_MONKEYPATCH_COMPAT_NAME( ModeRedrawLayerOnly ),
806  };
807  Q_ENUM( VectorTemporalMode )
808 
809 
814  enum class VectorTemporalLimitMode : int
815  {
816  IncludeBeginExcludeEnd = 0,
817  IncludeBeginIncludeEnd,
818  };
819  Q_ENUM( VectorTemporalLimitMode )
820 
821 
827  {
828  HasFixedTemporalRange SIP_MONKEYPATCH_COMPAT_NAME( ProviderHasFixedTemporalRange ) = 0,
829  StoresFeatureDateTimeInstantInField SIP_MONKEYPATCH_COMPAT_NAME( ProviderStoresFeatureDateTimeInstantInField ),
830  StoresFeatureDateTimeStartAndEndInSeparateFields SIP_MONKEYPATCH_COMPAT_NAME( ProviderStoresFeatureDateTimeStartAndEndInSeparateFields ),
831  };
832  Q_ENUM( VectorDataProviderTemporalMode )
833 
834 
840  {
841  FixedTemporalRange SIP_MONKEYPATCH_COMPAT_NAME( ModeFixedTemporalRange ) = 0,
842  TemporalRangeFromDataProvider SIP_MONKEYPATCH_COMPAT_NAME( ModeTemporalRangeFromDataProvider ) = 1,
843  RedrawLayerOnly SIP_MONKEYPATCH_COMPAT_NAME( ModeRedrawLayerOnly ) = 2,
844  };
845  Q_ENUM( RasterTemporalMode )
846 
847 
853  {
854  MatchUsingWholeRange,
855  MatchExactUsingStartOfRange,
856  MatchExactUsingEndOfRange,
857  FindClosestMatchToStartOfRange,
858  FindClosestMatchToEndOfRange
859  };
860  Q_ENUM( TemporalIntervalMatchMethod )
861 
862 
866  static const double DEFAULT_SEARCH_RADIUS_MM;
867 
869  static const float DEFAULT_MAPTOPIXEL_THRESHOLD;
870 
877  static const QColor DEFAULT_HIGHLIGHT_COLOR;
878 
883  static const double DEFAULT_HIGHLIGHT_BUFFER_MM;
884 
889  static const double DEFAULT_HIGHLIGHT_MIN_WIDTH_MM;
890 
897  static const double SCALE_PRECISION;
898 
904  static const double DEFAULT_Z_COORDINATE;
905 
911  static const double DEFAULT_M_COORDINATE;
912 
918  static const double UI_SCALE_FACTOR;
919 
924  static const double DEFAULT_SNAP_TOLERANCE;
925 
930  static const QgsTolerance::UnitType DEFAULT_SNAP_UNITS;
931 
937  static QString defaultProjectScales();
938 
944  static int geosVersionInt();
945 
951  static int geosVersionMajor();
952 
958  static int geosVersionMinor();
959 
965  static int geosVersionPatch();
966 
972  static QString geosVersion();
973 };
974 
975 Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::SymbolRenderHints )
976 Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::SymbolFlags )
977 Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::SymbolPreviewFlags )
978 Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::BrowserItemCapabilities )
979 Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::SublayerQueryFlags )
980 Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::SublayerFlags )
981 Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::SqlLayerDefinitionCapabilities )
982 Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::BabelFormatCapabilities )
983 Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::BabelCommandFlags )
984 Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::GeometryValidityFlags )
985 Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::FileOperationFlags )
986 Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::AnnotationItemFlags )
987 Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::AnnotationItemGuiFlags )
988 
989 // hack to workaround warnings when casting void pointers
990 // retrieved from QLibrary::resolve to function pointers.
991 // It's assumed that this works on all systems supporting
992 // QLibrary
993 #define cast_to_fptr(f) f
994 
995 
1004 // based on Boojum's code from http://stackoverflow.com/questions/3556687/prevent-firing-signals-in-qt
1005 template<class Object> class QgsSignalBlocker SIP_SKIP SIP_SKIP // clazy:exclude=rule-of-three
1006 {
1007  public:
1008 
1013  explicit QgsSignalBlocker( Object * object )
1014  : mObject( object )
1015  , mPreviousState( object->blockSignals( true ) )
1016  {}
1017 
1019  {
1020  mObject->blockSignals( mPreviousState );
1021  }
1022 
1024  Object *operator->() { return mObject; }
1025 
1026  private:
1027 
1028  Object *mObject = nullptr;
1029  bool mPreviousState;
1030 
1031 };
1032 
1046 // based on Boojum's code from http://stackoverflow.com/questions/3556687/prevent-firing-signals-in-qt
1047 template<class Object> inline QgsSignalBlocker<Object> whileBlocking( Object *object ) SIP_SKIP SIP_SKIP
1048 {
1049  return QgsSignalBlocker<Object>( object );
1050 }
1051 
1053 CORE_EXPORT uint qHash( const QVariant &variant );
1054 
1060 inline QString qgsDoubleToString( double a, int precision = 17 )
1061 {
1062  QString str = QString::number( a, 'f', precision );
1063  if ( precision )
1064  {
1065  if ( str.contains( QLatin1Char( '.' ) ) )
1066  {
1067  // remove ending 0s
1068  int idx = str.length() - 1;
1069  while ( str.at( idx ) == '0' && idx > 1 )
1070  {
1071  idx--;
1072  }
1073  if ( idx < str.length() - 1 )
1074  str.truncate( str.at( idx ) == '.' ? idx : idx + 1 );
1075  }
1076  }
1077  // avoid printing -0
1078  // see https://bugreports.qt.io/browse/QTBUG-71439
1079  if ( str == QLatin1String( "-0" ) )
1080  {
1081  return QLatin1String( "0" );
1082  }
1083  return str;
1084 }
1085 
1092 inline bool qgsNanCompatibleEquals( double a, double b )
1093 {
1094  const bool aIsNan = std::isnan( a );
1095  const bool bIsNan = std::isnan( b );
1096  if ( aIsNan || bIsNan )
1097  return aIsNan && bIsNan;
1098 
1099  return a == b;
1100 }
1101 
1108 inline bool qgsDoubleNear( double a, double b, double epsilon = 4 * std::numeric_limits<double>::epsilon() )
1109 {
1110  const bool aIsNan = std::isnan( a );
1111  const bool bIsNan = std::isnan( b );
1112  if ( aIsNan || bIsNan )
1113  return aIsNan && bIsNan;
1114 
1115  const double diff = a - b;
1116  return diff > -epsilon && diff <= epsilon;
1117 }
1118 
1125 inline bool qgsFloatNear( float a, float b, float epsilon = 4 * FLT_EPSILON )
1126 {
1127  const bool aIsNan = std::isnan( a );
1128  const bool bIsNan = std::isnan( b );
1129  if ( aIsNan || bIsNan )
1130  return aIsNan && bIsNan;
1131 
1132  const float diff = a - b;
1133  return diff > -epsilon && diff <= epsilon;
1134 }
1135 
1137 inline bool qgsDoubleNearSig( double a, double b, int significantDigits = 10 )
1138 {
1139  const bool aIsNan = std::isnan( a );
1140  const bool bIsNan = std::isnan( b );
1141  if ( aIsNan || bIsNan )
1142  return aIsNan && bIsNan;
1143 
1144  // The most simple would be to print numbers as %.xe and compare as strings
1145  // but that is probably too costly
1146  // Then the fastest would be to set some bits directly, but little/big endian
1147  // has to be considered (maybe TODO)
1148  // Is there a better way?
1149  int aexp, bexp;
1150  const double ar = std::frexp( a, &aexp );
1151  const double br = std::frexp( b, &bexp );
1152 
1153  return aexp == bexp &&
1154  std::round( ar * std::pow( 10.0, significantDigits ) ) == std::round( br * std::pow( 10.0, significantDigits ) );
1155 }
1156 
1162 inline double qgsRound( double number, int places )
1163 {
1164  const double m = ( number < 0.0 ) ? -1.0 : 1.0;
1165  const double scaleFactor = std::pow( 10.0, places );
1166  return ( std::round( number * m * scaleFactor ) / scaleFactor ) * m;
1167 }
1168 
1169 
1170 #ifndef SIP_RUN
1171 
1173 
1183 namespace qgis
1184 {
1185 
1198  template<typename To, typename From> inline To down_cast( From *f )
1199  {
1200  static_assert(
1201  ( std::is_base_of<From,
1202  typename std::remove_pointer<To>::type>::value ),
1203  "target type not derived from source type" );
1204  Q_ASSERT( f == nullptr || dynamic_cast<To>( f ) != nullptr );
1205  return static_cast<To>( f );
1206  }
1207 
1208  template<class T>
1209  QSet<T> listToSet( const QList<T> &list )
1210  {
1211 #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
1212  return list.toSet();
1213 #else
1214  return QSet<T>( list.begin(), list.end() );
1215 #endif
1216  }
1217 
1218  template<class T>
1219  QList<T> setToList( const QSet<T> &set )
1220  {
1221 #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
1222  return set.toList();
1223 #else
1224  return QList<T>( set.begin(), set.end() );
1225 #endif
1226  }
1227 }
1228 
1229 #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
1230 namespace std
1231 {
1232  template<> struct hash<QString>
1233  {
1234  std::size_t operator()( const QString &s ) const noexcept
1235  {
1236  return ( size_t ) qHash( s );
1237  }
1238  };
1239 }
1240 #endif
1241 
1243 #endif
1244 
1250 template<class T> const QMap<T, QString> qgsEnumMap() SIP_SKIP
1251 {
1252  const QMetaEnum metaEnum = QMetaEnum::fromType<T>();
1253  Q_ASSERT( metaEnum.isValid() );
1254  QMap<T, QString> enumMap;
1255  for ( int idx = 0; idx < metaEnum.keyCount(); ++idx )
1256  {
1257  const char *enumKey = metaEnum.key( idx );
1258  enumMap.insert( static_cast<T>( metaEnum.keyToValue( enumKey ) ), QString( enumKey ) );
1259  }
1260  return enumMap;
1261 }
1262 
1267 template<class T> QString qgsEnumValueToKey( const T &value ) SIP_SKIP
1268 {
1269  const QMetaEnum metaEnum = QMetaEnum::fromType<T>();
1270  Q_ASSERT( metaEnum.isValid() );
1271  return QString::fromUtf8( metaEnum.valueToKey( static_cast<int>( value ) ) );
1272 }
1273 
1280 template<class T> T qgsEnumKeyToValue( const QString &key, const T &defaultValue, bool tryValueAsKey = true ) SIP_SKIP
1281 {
1282  const QMetaEnum metaEnum = QMetaEnum::fromType<T>();
1283  Q_ASSERT( metaEnum.isValid() );
1284  bool ok = false;
1285  T v = static_cast<T>( metaEnum.keyToValue( key.toUtf8().data(), &ok ) );
1286  if ( ok )
1287  {
1288  return v;
1289  }
1290  else
1291  {
1292  // if conversion has failed, try with conversion from int value
1293  if ( tryValueAsKey )
1294  {
1295  bool canConvert = false;
1296  const int intValue = key.toInt( &canConvert );
1297  if ( canConvert && metaEnum.valueToKey( intValue ) )
1298  {
1299  return static_cast<T>( intValue );
1300  }
1301  }
1302  }
1303  return defaultValue;
1304 }
1305 
1310 template<class T> QString qgsFlagValueToKeys( const T &value ) SIP_SKIP
1311 {
1312  const QMetaEnum metaEnum = QMetaEnum::fromType<T>();
1313  Q_ASSERT( metaEnum.isValid() );
1314  return QString::fromUtf8( metaEnum.valueToKeys( static_cast<int>( value ) ) );
1315 }
1316 
1322 template<class T> T qgsFlagKeysToValue( const QString &keys, const T &defaultValue ) SIP_SKIP
1323 {
1324  const QMetaEnum metaEnum = QMetaEnum::fromType<T>();
1325  Q_ASSERT( metaEnum.isValid() );
1326  bool ok = false;
1327  T v = static_cast<T>( metaEnum.keysToValue( keys.toUtf8().constData(), &ok ) );
1328  if ( ok )
1329  return v;
1330  else
1331  return defaultValue;
1332 }
1333 
1334 
1344 CORE_EXPORT double qgsPermissiveToDouble( QString string, bool &ok );
1345 
1355 CORE_EXPORT int qgsPermissiveToInt( QString string, bool &ok );
1356 
1366 CORE_EXPORT qlonglong qgsPermissiveToLongLong( QString string, bool &ok );
1367 
1377 CORE_EXPORT bool qgsVariantLessThan( const QVariant &lhs, const QVariant &rhs );
1378 
1387 CORE_EXPORT bool qgsVariantEqual( const QVariant &lhs, const QVariant &rhs );
1388 
1395 CORE_EXPORT bool qgsVariantGreaterThan( const QVariant &lhs, const QVariant &rhs );
1396 
1397 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
1398 
1405 inline bool operator> ( const QVariant &v1, const QVariant &v2 )
1406 {
1407  return qgsVariantGreaterThan( v1, v2 );
1408 }
1409 
1419 inline bool operator< ( const QVariant &v1, const QVariant &v2 )
1420 {
1421  return qgsVariantLessThan( v1, v2 );
1422 }
1423 #endif
1424 
1425 
1426 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
1427 
1431 template<> CORE_EXPORT bool qMapLessThanKey<QVariantList>( const QVariantList &key1, const QVariantList &key2 ) SIP_SKIP;
1432 #endif
1433 
1434 CORE_EXPORT QString qgsVsiPrefix( const QString &path );
1435 
1441 void CORE_EXPORT *qgsMalloc( size_t size ) SIP_SKIP;
1442 
1450 void CORE_EXPORT *qgsCalloc( size_t nmemb, size_t size ) SIP_SKIP;
1451 
1456 void CORE_EXPORT qgsFree( void *ptr ) SIP_SKIP;
1457 
1458 #ifndef SIP_RUN
1459 
1460 #ifdef _MSC_VER
1461 #define CONSTLATIN1STRING inline const QLatin1String
1462 #else
1463 #define CONSTLATIN1STRING constexpr QLatin1String
1464 #endif
1465 
1467 class ScopedIntIncrementor
1468 {
1469  public:
1470 
1471  ScopedIntIncrementor( int *variable )
1472  : mVariable( variable )
1473  {
1474  ( *mVariable )++;
1475  }
1476 
1477  ScopedIntIncrementor( const ScopedIntIncrementor &other ) = delete;
1478  ScopedIntIncrementor &operator=( const ScopedIntIncrementor &other ) = delete;
1479 
1480  void release()
1481  {
1482  if ( mVariable )
1483  ( *mVariable )--;
1484 
1485  mVariable = nullptr;
1486  }
1487 
1488  ~ScopedIntIncrementor()
1489  {
1490  release();
1491  }
1492 
1493  private:
1494  int *mVariable = nullptr;
1495 };
1497 
1503 {
1504  return QLatin1String(
1505  R"""(GEOGCRS["WGS 84",DATUM["World Geodetic System 1984",ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["unknown"],AREA["World"],BBOX[-90,-180,90,180]],ID["EPSG",4326]] )"""
1506  );
1507 }
1508 
1511 {
1512  return QLatin1String( "+proj=longlat +datum=WGS84 +no_defs" );
1513 }
1514 
1517 {
1518  return QLatin1String( "EPSG:4326" );
1519 }
1520 
1523 {
1524  return QLatin1String( "NONE" );
1525 }
1526 
1528 
1530 const int PREVIEW_JOB_DELAY_MS = 250;
1531 
1533 const int MAXIMUM_LAYER_PREVIEW_TIME_MS = 250;
1534 
1536 
1537 #endif
1538 
1540 const long GEOSRID = 4326;
1541 
1543 const long GEOCRS_ID = 3452;
1544 
1546 const long GEO_EPSG_CRS_ID = 4326;
1547 
1552 const int USER_CRS_START_ID = 100000;
1553 
1554 //
1555 // Constants for point symbols
1556 //
1557 
1559 const double DEFAULT_POINT_SIZE = 2.0;
1560 const double DEFAULT_LINE_WIDTH = 0.26;
1561 
1563 const double DEFAULT_SEGMENT_EPSILON = 1e-8;
1564 
1565 typedef QMap<QString, QString> QgsStringMap SIP_SKIP;
1566 
1575 typedef unsigned long long qgssize;
1576 
1577 #ifndef SIP_RUN
1578 #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) || defined(__clang__)
1579 
1580 #define Q_NOWARN_DEPRECATED_PUSH \
1581  _Pragma("GCC diagnostic push") \
1582  _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"");
1583 #define Q_NOWARN_DEPRECATED_POP \
1584  _Pragma("GCC diagnostic pop");
1585 #define Q_NOWARN_UNREACHABLE_PUSH
1586 #define Q_NOWARN_UNREACHABLE_POP
1587 
1588 #elif defined(_MSC_VER)
1589 
1590 #define Q_NOWARN_DEPRECATED_PUSH \
1591  __pragma(warning(push)) \
1592  __pragma(warning(disable:4996))
1593 #define Q_NOWARN_DEPRECATED_POP \
1594  __pragma(warning(pop))
1595 #define Q_NOWARN_UNREACHABLE_PUSH \
1596  __pragma(warning(push)) \
1597  __pragma(warning(disable:4702))
1598 #define Q_NOWARN_UNREACHABLE_POP \
1599  __pragma(warning(pop))
1600 
1601 #else
1602 
1603 #define Q_NOWARN_DEPRECATED_PUSH
1604 #define Q_NOWARN_DEPRECATED_POP
1605 #define Q_NOWARN_UNREACHABLE_PUSH
1606 #define Q_NOWARN_UNREACHABLE_POP
1607 
1608 #endif
1609 #endif
1610 
1611 #ifndef QGISEXTERN
1612 #ifdef Q_OS_WIN
1613 # define QGISEXTERN extern "C" __declspec( dllexport )
1614 #else
1615 # if defined(__GNUC__) || defined(__clang__)
1616 # define QGISEXTERN extern "C" __attribute__ ((visibility ("default")))
1617 # else
1618 # define QGISEXTERN extern "C"
1619 # endif
1620 #endif
1621 #endif
1622 #endif
1623 
1624 #if __cplusplus >= 201500
1625 #define FALLTHROUGH [[fallthrough]];
1626 #elif defined(__clang__)
1627 #define FALLTHROUGH [[clang::fallthrough]];
1628 #elif defined(__GNUC__) && __GNUC__ >= 7
1629 #define FALLTHROUGH [[gnu::fallthrough]];
1630 #else
1631 #define FALLTHROUGH
1632 #endif
1633 
1634 // see https://infektor.net/posts/2017-01-19-using-cpp17-attributes-today.html#using-the-nodiscard-attribute
1635 #if __cplusplus >= 201703L
1636 #define NODISCARD [[nodiscard]]
1637 #elif defined(__clang__)
1638 #define NODISCARD [[nodiscard]]
1639 #elif defined(_MSC_VER)
1640 #define NODISCARD // no support
1641 #elif defined(__has_cpp_attribute)
1642 #if __has_cpp_attribute(nodiscard)
1643 #define NODISCARD [[nodiscard]]
1644 #elif __has_cpp_attribute(gnu::warn_unused_result)
1645 #define NODISCARD [[gnu::warn_unused_result]]
1646 #else
1647 #define NODISCARD Q_REQUIRED_RESULT
1648 #endif
1649 #else
1650 #define NODISCARD Q_REQUIRED_RESULT
1651 #endif
1652 
1653 #if __cplusplus >= 201703L
1654 #define MAYBE_UNUSED [[maybe_unused]]
1655 #elif defined(__clang__)
1656 #define MAYBE_UNUSED [[maybe_unused]]
1657 #elif defined(_MSC_VER)
1658 #define MAYBE_UNUSED // no support
1659 #elif defined(__has_cpp_attribute)
1660 #if __has_cpp_attribute(gnu::unused)
1661 #define MAYBE_UNUSED [[gnu::unused]]
1662 #else
1663 #define MAYBE_UNUSED
1664 #endif
1665 #else
1666 #define MAYBE_UNUSED
1667 #endif
1668 
1669 #ifndef FINAL
1670 #define FINAL final
1671 #endif
1672 
1673 #ifndef SIP_RUN
1674 #if defined(__GNUC__) && !defined(__clang__)
1675 // Workaround a GCC bug where a -Wreturn-type warning is emitted in constructs
1676 // like:
1677 // switch( mVariableThatCanOnlyBeXorY )
1678 // {
1679 // case X:
1680 // return "foo";
1681 // case Y:
1682 // return "foo";
1683 // }
1684 // See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87951
1685 #define DEFAULT_BUILTIN_UNREACHABLE \
1686  default: \
1687  __builtin_unreachable();
1688 #else
1689 #define DEFAULT_BUILTIN_UNREACHABLE
1690 #endif
1691 #endif // SIP_RUN
1692 
1693 #ifdef SIP_RUN
1694 
1699 QString CORE_EXPORT geoWkt();
1700 
1702 QString CORE_EXPORT geoProj4();
1703 
1705 QString CORE_EXPORT geoEpsgCrsAuthId();
1706 
1708 QString CORE_EXPORT geoNone();
1709 
1710 #endif
The Qgis class provides global constants for use throughout the application.
Definition: qgis.h:63
GeometryValidityFlag
Geometry validity check flags.
Definition: qgis.h:652
MapLayerProperty
Generic map layer properties.
Definition: qgis.h:739
BufferSide
Side of line to buffer.
Definition: qgis.h:675
RasterResamplingStage
Stage at which raster resampling occurs.
Definition: qgis.h:467
VectorTemporalMode
Vector layer temporal feature modes.
Definition: qgis.h:799
SublayerFlag
Flags which reflect the properties of sublayers in a dataset.
Definition: qgis.h:438
AnnotationItemNodeType
Annotation item node types.
Definition: qgis.h:775
static const char * QGIS_DEV_VERSION
The development version.
Definition: qgis.h:89
DriveType
Drive types.
Definition: qgis.h:383
ContentStatus
Status for fetched or stored content.
Definition: qgis.h:565
GeometryOperationResult
Success or failure of a geometry operation.
Definition: qgis.h:624
BrowserItemState
Browser item states.
Definition: qgis.h:250
AnnotationItemFlag
Flags for annotation items.
Definition: qgis.h:751
SymbolRenderHint
Flags controlling behavior of symbols during rendering.
Definition: qgis.h:195
BrowserItemCapability
Browser item capabilities.
Definition: qgis.h:263
BrowserDirectoryMonitoring
Browser directory item monitoring switches.
Definition: qgis.h:305
VectorExportResult
Vector layer export result codes.
Definition: qgis.h:329
ScaleMethod
Scale methods.
Definition: qgis.h:183
FilePathType
File path types.
Definition: qgis.h:498
GeometryValidationEngine
Available engines for validating geometries.
Definition: qgis.h:663
FileOperationFlag
File operation flags.
Definition: qgis.h:726
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition: qgis.h:106
SqlKeywordCategory
SqlKeywordCategory enum represents the categories of the SQL keywords used by the SQL query editor.
Definition: qgis.h:365
MeshEditingErrorType
Type of error that can occur during mesh frame editing.
Definition: qgis.h:481
AnnotationItemEditOperationResult
Results from an edit operation on an annotation item.
Definition: qgis.h:786
ActionStart
Enum to determine when an operation would begin.
Definition: qgis.h:399
TemporalIntervalMatchMethod
Method to use when resolving a temporal range to a data provider layer or band.
Definition: qgis.h:853
SublayerQueryFlag
Flags which control how data providers will scan for sublayers in a dataset.
Definition: qgis.h:423
PythonMacroMode
Authorisation to run Python Macros.
Definition: qgis.h:143
UnplacedLabelVisibility
Unplaced label visibility.
Definition: qgis.h:411
SpatialFilterType
Feature request spatial filter types.
Definition: qgis.h:713
BrowserItemType
Browser item types.
Definition: qgis.h:231
RasterTemporalMode
Raster layer temporal modes.
Definition: qgis.h:840
JoinStyle
Join styles for buffers.
Definition: qgis.h:700
BrowserLayerType
Browser item layer types.
Definition: qgis.h:282
VectorDataProviderTemporalMode
Vector data provider temporal handling modes.
Definition: qgis.h:827
DataType
Raster data types.
Definition: qgis.h:120
EndCapStyle
End cap styles for buffers.
Definition: qgis.h:687
BabelCommandFlag
Babel command flags, which control how commands and arguments are generated for executing GPSBabel pr...
Definition: qgis.h:597
RasterPipeInterfaceRole
Raster pipe interface roles.
Definition: qgis.h:450
SymbolPreviewFlag
Flags for controlling how symbol preview images are generated.
Definition: qgis.h:219
AnnotationItemGuiFlag
Flags for controlling how an annotation item behaves in the GUI.
Definition: qgis.h:763
VertexMarkerType
Editing vertex markers, used for showing vertices during a edit operation.
Definition: qgis.h:553
SublayerPromptMode
Specifies how to handle layer sources with multiple sublayers.
Definition: qgis.h:510
GpsFeatureType
GPS feature types.
Definition: qgis.h:609
VectorTemporalLimitMode
Mode for the handling of the limits of the filtering timeframe for vector features.
Definition: qgis.h:815
SqlLayerDefinitionCapability
SqlLayerDefinitionCapability enum lists the arguments supported by the provider when creating SQL que...
Definition: qgis.h:350
VectorEditResult
Specifies the result of a vector layer edit operation.
Definition: qgis.h:538
SymbolType
Symbol types.
Definition: qgis.h:169
BabelFormatCapability
Babel GPS format capabilities.
Definition: qgis.h:580
SymbolFlag
Flags controlling behavior of symbols.
Definition: qgis.h:207
HttpMethod
Different methods of HTTP requests.
Definition: qgis.h:317
SelectBehavior
Specifies how a selection should be applied.
Definition: qgis.h:524
Base class for all items in the model.
Definition: qgsdataitem.h:46
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:124
Item that represents a layer that can be opened with one of the providers.
Definition: qgslayeritem.h:30
Base class for all map layer types.
Definition: qgsmaplayer.h:72
Registry for temporary fetched files.
Implementation of data provider temporal properties for QgsRasterDataProviders.
Implementation of map layer temporal properties for raster layers.
Contains a pipeline of raster interfaces for sequential raster processing.
Definition: qgsrasterpipe.h:50
RAII signal blocking class.
Definition: qgis.h:1006
~QgsSignalBlocker()
Definition: qgis.h:1018
QgsSignalBlocker(Object *object)
Constructor for QgsSignalBlocker.
Definition: qgis.h:1013
Object * operator->()
Returns pointer to blocked QObject.
Definition: qgis.h:1024
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:38
This is the class is providing tolerance value in map unit values.
Definition: qgstolerance.h:33
Implementation of data provider temporal properties for QgsVectorDataProviders.
This is the base class for vector data providers.
A convenience class for exporting vector layers to a destination data provider.
Implementation of map layer temporal properties for vector layers.
Represents a vector layer which manages a vector based data sets.
FeatureCountState
Enumeration of feature count states.
Definition: qgis.h:158
QgsMapLayerType
Types of layers that can be added to a map.
Definition: qgis.h:47
@ PointCloudLayer
Added in 3.18.
@ MeshLayer
Added in 3.2.
@ VectorTileLayer
Added in 3.14.
@ AnnotationLayer
Contains freeform, georeferenced annotations. Added in QGIS 3.16.
int significantDigits(const Qgis::DataType rasterDataType)
Returns the maximum number of significant digits a for the given rasterDataType.
#define str(x)
Definition: qgis.cpp:37
CONSTLATIN1STRING geoNone()
Constant that holds the string representation for "No ellips/No CRS".
Definition: qgis.h:1522
const double DEFAULT_LINE_WIDTH
Definition: qgis.h:1560
CORE_EXPORT uint qHash(const QVariant &variant)
Hash for QVariant.
Definition: qgis.cpp:225
bool operator>(const QVariant &v1, const QVariant &v2)
Compares two QVariant values and returns whether the first is greater than the second.
Definition: qgis.h:1405
void CORE_EXPORT * qgsCalloc(size_t nmemb, size_t size)
Allocates memory for an array of nmemb elements of size bytes each and returns a pointer to the alloc...
Definition: qgis.cpp:107
CORE_EXPORT QString qgsVsiPrefix(const QString &path)
Definition: qgis.cpp:200
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 a...
Definition: qgis.cpp:274
void CORE_EXPORT * qgsMalloc(size_t size)
Allocates size bytes and returns a pointer to the allocated memory.
Definition: qgis.cpp:92
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
Definition: qgis.h:1060
QString qgsEnumValueToKey(const T &value)
Returns the value for the given key of an enum.
Definition: qgis.h:1267
const QMap< T, QString > qgsEnumMap()
Returns a map of all enum entries.
Definition: qgis.h:1250
const long GEO_EPSG_CRS_ID
Magic number for a geographic coord sys in EpsgCrsId ID format.
Definition: qgis.h:1546
CORE_EXPORT 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:195
unsigned long long qgssize
Qgssize is used instead of size_t, because size_t is stdlib type, unknown by SIP, and it would be har...
Definition: qgis.h:1575
bool qgsFloatNear(float a, float b, float epsilon=4 *FLT_EPSILON)
Compare two floats (but allow some difference)
Definition: qgis.h:1125
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 bet...
Definition: qgis.cpp:71
double qgsRound(double number, int places)
Returns a double number, rounded (as close as possible) to the specified number of places.
Definition: qgis.h:1162
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
Definition: qgis.h:1108
CONSTLATIN1STRING geoProj4()
PROJ4 string that represents a geographic coord sys.
Definition: qgis.h:1510
T qgsFlagKeysToValue(const QString &keys, const T &defaultValue)
Returns the value corresponding to the given keys of a flag.
Definition: qgis.h:1322
bool qgsNanCompatibleEquals(double a, double b)
Compare two doubles, treating nan values as equal.
Definition: qgis.h:1092
const double DEFAULT_SEGMENT_EPSILON
Default snapping tolerance for segments.
Definition: qgis.h:1563
QMap< QString, QString > QgsStringMap
Definition: qgis.h:1565
#define CONSTLATIN1STRING
Definition: qgis.h:1463
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
Definition: qgis.h:1047
CONSTLATIN1STRING geoWkt()
Wkt string that represents a geographic coord sys.
Definition: qgis.h:1502
bool qgsDoubleNearSig(double a, double b, int significantDigits=10)
Compare two doubles using specified number of significant digits.
Definition: qgis.h:1137
const int USER_CRS_START_ID
Magick number that determines whether a projection crsid is a system (srs.db) or user (~/....
Definition: qgis.h:1552
QString qgsFlagValueToKeys(const T &value)
Returns the value for the given keys of a flag.
Definition: qgis.h:1310
void CORE_EXPORT qgsFree(void *ptr)
Frees the memory space pointed to by ptr.
Definition: qgis.cpp:122
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...
Definition: qgis.cpp:85
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 b...
Definition: qgis.cpp:78
CORE_EXPORT 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:127
const long GEOSRID
Magic number for a geographic coord sys in POSTGIS SRID.
Definition: qgis.h:1540
bool operator<(const QVariant &v1, const QVariant &v2)
Compares two QVariant values and returns whether the first is less than the second.
Definition: qgis.h:1419
CONSTLATIN1STRING geoEpsgCrsAuthId()
Geographic coord sys from EPSG authority.
Definition: qgis.h:1516
const long GEOCRS_ID
Magic number for a geographic coord sys in QGIS srs.db tbl_srs.srs_id.
Definition: qgis.h:1543
T qgsEnumKeyToValue(const QString &key, const T &defaultValue, bool tryValueAsKey=true)
Returns the value corresponding to the given key of an enum.
Definition: qgis.h:1280
const double DEFAULT_POINT_SIZE
Magic number that determines the default point size for point symbols.
Definition: qgis.h:1559
#define SIP_SKIP
Definition: qgis_sip.h:126
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition: qgis_sip.h:257
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)
Definition: qgis_sip.h:258
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.
int precision