62 Commits

Author SHA1 Message Date
Nyall Dawson
078fd4f2ea Make IntFlag enum type opt-in, rather than opt-out
And make sipify handle this nicely. This means that all our non-flag
style enums correctly map across to IntFlag python enums on Qt 6,
fixing issues with negative enum values for these and providing
a better match for the original c++ enum.
2024-01-31 17:16:18 +10:00
Nyall Dawson
12f4ce5978 Use correct enum type for enum with negative values 2024-01-31 17:16:18 +10:00
Nyall Dawson
f1e3ba9e2d Use correct sip method
And use INDENT-OFF annotations to avoid astyle messing up
formatting of enum with inline macros
2024-01-31 13:48:49 +10:00
Nyall Dawson
2d4c569b9c Fix build 2024-01-31 13:48:49 +10:00
Nyall Dawson
b5aca7c0b5 Promote another enum to enum class 2024-01-31 13:48:49 +10:00
Nyall Dawson
09578d6a8f Use templates to avoid ugly static_cast 2024-01-31 13:48:49 +10:00
Nyall Dawson
23f3af4290 Use enum classes for QgsProperty property keys
Should fix usage on Qt 6 builds
2024-01-31 13:48:49 +10:00
Alessandro Pasotti
27824078ad Introduce QgsProcessingProvider::Flag::FlagCompatibleWithVirtualRaster 2024-01-31 10:37:52 +10:00
Alexander Bruy
0c338f1c09 address review 2024-01-30 14:55:58 +02:00
Alexander Bruy
81b1453b89 pass color ramp name to the color ramp transformer to generate correct
expression (fix #48889)
2024-01-30 14:55:27 +02:00
Nyall Dawson
6116319806 Move a processing enum to enum class in Qgis 2024-01-30 19:10:43 +10:00
Nyall Dawson
a36b203f30 Promote some processing enums to enum class, cleanups 2024-01-30 19:10:43 +10:00
Nyall Dawson
26798b84f4 Promote QgsFeatureRequest enums to enum class, move to Qgis 2024-01-30 19:10:43 +10:00
Nyall Dawson
2bef88b031 Correctly add int types to flag style enum classes 2024-01-29 09:44:41 +01:00
Alexander Bruy
79ccc22a5b
Merge pull request #55999 from alexbruy/mesh-renderer-settings-enum-fix
rename QgsMeshRendererScalarSettings.DataResampling enum value from None to NoResampling
2024-01-26 09:15:06 +02:00
Alexander Bruy
d8e21a8906 rename QgsMeshRendererScalarSettings enum value from None to NoResampling to avoid issues with Python bindings (fix #51033) 2024-01-24 14:52:19 +02:00
Nyall Dawson
3dc17faca6
Add utilities to convert between QMetaType::Type and QVariant::Type
While QVariant::Type can be directly static_cast to QMetaType::Type,
the reverse is not true and many QMetaType::Type values don't
have exact counterparts in QVariant::Type.

So we use the logic:

- If no conversion is possible, QVariant::UserType will be returned.
  Note that we don't use QVariant::Invalid, as the value DOES have
  a type, it's just one which needs special handling (just like user
  types do)
- Some conversions are lossy, in that the QVariant::Type cannot
  represent the full range of values possible in QMetaType::Type.
  In these cases the returned type will be an "expanded" type
  capable of storing the full range of values possible in the
  original type. Eg we map QMetaType::Type::Float to QVariant::Type::Double

QgsVariantUtils::variantTypeToMetaType is included for clarity/
completeness/future proof-ness, even though it currently can
be handled with just a simple static cast.
2024-01-24 09:49:43 +10:00
Nyall Dawson
4654ad3db5 Sipify 2024-01-23 08:32:38 +01:00
Nyall Dawson
28cc55a67c Make sip method code compatible with Qt6 2024-01-23 08:32:38 +01:00
Mathieu Pellerin
185724f892 Make QtPrinter support non-mandatory 2024-01-22 11:07:34 +10:00
Nyall Dawson
1092e6dd8b Add isDeprecated method to QgsCoordinateReferenceSystem 2024-01-20 12:11:30 +10:00
Nyall Dawson
f25a87ea3f Correctly deprecate method 2024-01-20 12:11:30 +10:00
Juergen E. Fischer
d0e006861c fix windows build 2024-01-19 14:18:28 +01:00
Denis Rouzaud
2d47d612ce
make QgsAnnotationItem::clone const (#55868) 2024-01-17 14:31:30 +00:00
Denis Rouzaud
681376675b
make item method const (#55858) 2024-01-17 13:24:16 +01:00
Denis Rouzaud
d296f0e513
add enabled state for annotation items (#55798) 2024-01-17 10:07:10 +00:00
Nyall Dawson
ef4f8efdcc Remove unused 2018 WKT variants, monkey patch for api compatibility 2024-01-17 10:16:32 +10:00
Nyall Dawson
20075f8809 Use consistent case 2024-01-17 10:16:32 +10:00
Nyall Dawson
6c7cf97d85 Add signals for recent crs changes
And move tests to correct file
2024-01-17 10:16:32 +10:00
Nyall Dawson
f2903c7935 Move QgsCoordinateReferenceSystem enums to qgis, promote to enum class 2024-01-17 10:16:32 +10:00
Nyall Dawson
25fb7cefe1 Move recent crs methods to QgsCoordinateReferenceSystemRegistry 2024-01-17 10:16:32 +10:00
Loïc Bartoletti
7bdf16d976 QgsAbstractGeometry: Update dox for fuzzyEqual and fix \see tags 2024-01-12 07:10:37 +10:00
Loïc Bartoletti
c16938c683 DOX: add a more descriptive information on fuzzyDistanceEqual. What is a 'distance comparison' 2024-01-12 07:10:37 +10:00
Loïc Bartoletti
c6eca9361f QgsAbstrcatGeometry and childs: Add fuzzyEqual and fuzzyDistanceEqual. Replaces operator== with fuzzyEqual and uses epsilon=1E-8
The comparisons among QGIS were conducted on coordinates using a fixed epsilon:
specifically, 1e-8 for QgsPoint and the default value for qgsDoubleNear: 4 *
DBL_EPSILON.

Initially, I've standardized its use to 1e-8 universally; it's already
significantly adequate for our Cartesian cases (1e-3 should suffice for many),
potentially fitting just right for geographical contexts.

Furthermore, in response to precision concerns, we're using the fuzzyEqual
and fuzzyDistanceEqual methods. These methods enable users/developers to
compare geometries more easily and with a given precision.

The API remains intact as operator==/equals() have been shifted into fuzzyEqual
(with an epsilon of 1e-8).

To consolidate the code between fuzzyEqual and fuzzyDistanceEqual, helper
functions, fuzzyHelpers, have been introduced following the logic of the
respective segments to be executed.
2024-01-12 07:10:37 +10:00
Loïc Bartoletti
c9d4a02d96 dox: Adds a \warning tag. Adds a mention about caller's responsibility and adds a \since tag 2024-01-11 05:23:39 +10:00
Loïc Bartoletti
a590b0e4c6 QgsGeometryUtils: add sqrDistance3D and distance3d for QgsPoint using QgsGeometryUtilsBase functions 2024-01-11 05:23:39 +10:00
Loïc Bartoletti
2fdcc3c01e QgsGeometryUtilsBase: add sqrDistance3D and distance3D
As for the sqrDistance and Distance 2D functions, this adds functions for 3D.
To maintain the lowest level, the specific case where a Z could be NaN
is not handled.
It is left to the responsibility of other methods using these functions.
2024-01-11 05:23:39 +10:00
Julien Cabieces
0e644d1889 [PyQt6] remove QTextCodec arg instead of removing the method 2024-01-11 04:52:01 +10:00
Julien Cabieces
062ce03b6d [PyQt6] remove QTextCodec and rename pyqt5_from_qvariant_by_type
QTextCodec is no longer existing in PyQt6 (only in QtCoreCompat in C++)
2024-01-11 04:52:01 +10:00
Nyall Dawson
13235351cd Perform backward compatibility of settings only for changed settings
The backward compatibility code is very expensive, as it triggers
a huge number of QSetting object creation and destruction.

We only need to perform this for settings which have changed,
so add API to flag changed settings and only perform backward
migration of changed settings.

This dramatically improves QgsApplication shutdown time (cuts
1.5 seconds off shutdown on a release build!!)
2024-01-10 18:19:56 +10:00
Nyall Dawson
976c86d03d Implement lazy initialization of default style library
Populating the style library from the database can be a time
consuming process, especially if a user has many symbols
present in their library.

But for many standalone scripts, and for qgis_process, the
style database may not be required.

Let's defer initialization of it until it's actually required,
saving the startup cost in qgis_process and 3rd party scripts.

On my system with a style database containing ~700 items this
cuts down qgis_process startup times by around 25%
2024-01-10 12:24:59 +10:00
Nyall Dawson
3c179214fc Use nicely formatted results in processing logs 2024-01-09 17:02:21 +10:00
Nyall Dawson
3e10cf9338 Add method to get HTML formatted versions of output values for
processing outputs
2024-01-09 17:02:21 +10:00
Nyall Dawson
b674a7c35d Add method to format processing output values as strings 2024-01-09 17:02:21 +10:00
Nyall Dawson
3e7d376953 Add method to push formatted text to Processing feedback
Provides a method for algorithms to push HTML contents to the log
(the other feedback methods all escape HTML strings to strip
formatting characters)
2024-01-09 17:02:21 +10:00
uclaros
c8468d45e0 cmon sip... 2024-01-08 05:20:26 -08:00
uclaros
02ab91329b address review 2024-01-08 05:20:26 -08:00
Nyall Dawson
50a31065ab Add framework to temporarily halt flushing of QgsSettings to ini
This adds a mechanism where flushes of QgsSettings to the underlying
ini storage file can be temporarily suspended. It is intended for
code paths where many settings entries are consecutively read/written,
to avoid the very expensive cost of constructing and destructing
multiple QgsSettings objects for each in turn.

When QgsSettings::holdFlush() is called, then a temporary thread local
QgsSettings object will be created and ALL access to settings entries
will use this same object (preventing flushing of it to ini files).
An accompanying QgsSettings::releaseFlush() call MUST be made from
the same thread to destroy the thread local QgsSettings, flush it
to disk, and resume normal operation.

This helps avoid the VERY costly backward migration of settings,
and cuts the run time for qgis_process commands like `qgis_process list`
by at least half (and considerably more in common setups).
2024-01-08 18:58:14 +10:00
Nyall Dawson
5ac17746de Lazy initialize authentication framework
QCA and SSL certificate initialize can be costly -- so defer
startup of authentication framework until it is actually required.

This has no effect on QGIS desktop, as the news feed request
and other startup network requests will immediately trigger
an initialization of the framework. The use case here is improving
the core application startup time to benefit non-app based clients,
eg. qgis_process.
2024-01-08 17:21:07 +10:00
Nyall Dawson
f6addcd0ca Promote 3d point symbol shape to enum class 2023-12-25 17:54:44 +10:00