QgsPathResolver::setPathPreprocessor allows setting a custom path pre-processor
function, which allows for manipulation of paths and data sources prior
to resolving them to file references or layer sources.
The processor function must accept a single string argument (representing the
original file path or data source), and return a processed version of this path.
The path pre-processor function is called before any bad layer handler.
Example - replace an outdated folder path with a new one:
def my_processor(path):
return path.replace('c:/Users/ClintBarton/Documents/Projects', 'x:/Projects/')
QgsPathResolver.setPathPreprocessor(my_processor)
Example - replace a stored database host with a new one:
def my_processor(path):
return path.replace('host=10.1.1.115', 'host=10.1.1.116')
QgsPathResolver.setPathPreprocessor(my_processor)
Example - replace stored database credentials with new ones:
def my_processor(path):
path= path.replace("user='gis_team'", "user='team_awesome'")
path = path.replace("password='cats'", "password='g7as!m*'")
return path
QgsPathResolver.setPathPreprocessor(my_processor)
Attempts to allocate memory for at least the specified number of geometries.
If the number of geometries is known in advance, calling this function
prior to adding geometries will prevent reallocations and memory fragmentation.
which controls a distance from the feature where callout lines end
Makes for visually more appealing callouts vs drawing them right
up against the edges of features
that these are automatically respected whenever the format is
rendered using QgsTextRenderer
This is done transparently to the caller - so by porting away
from the raw QPainter text apis to use QgsTextRenderer instead,
then they immediately gain the ability to use data defined
properties in their text formats.
display of unplaced labels
This is independant from the main canvas setting, and can be used
to determine whether labels are missing from a particular layout map
methods
While unused for now, this gives us flexibility in future to specify
additional useful contextual information about how a callout should
be rendered without breaking API (e.g. label text alignment, label
font settings, etc)
The extent reported by raster layers may be smaller than the area
which can be rendered.
Notably for WMS with symbology that takes more space than the data.
Fix#30251
Hopefully this will prevent additional items being added to the cache
after we've gracefully finalised proj operations, which results
in the infamous crash-on-exit fiasco...
methods
While unused for now, this gives us flexibility in future to specify
additional useful contextual information about how a callout should
be rendered without breaking API (e.g. label text alignment, label
font settings, etc)
...instead of being rendered on top of some. For this callout style,
we don't want callouts overlapping labels (rather the opposite). But
leave API in place to allow other callout styles to render below
their associated labels only, as this may be wanted for some styles
(e.g. balloon style callouts)
raised by a Python algorithm
This is too noisy for these expected exceptions -- instead, only
show the traceback for other exceptions (Which are likely a result
of Python coding errors, so they are useful for debugging)