15 Commits

Author SHA1 Message Date
Nyall Dawson
48d2a37057 [FEATURE] New line symbol type: Hash line
This line symbol type is designed to replicate the ArcGIS Hash Line
symbol layer type. It allows for a repeating line segment to be
drawn over the length of a feature, with a line-sub symbol used
to render each individual segment.

To reduce code duplication, this is heavily based off the current
line marker symbol layer, since the functionality is almost
identical (draw some sub symbol at some interval along a line).
Accordingly, I've split off QgsMarkerLineSymbolLayer to move
as much of the common functionality as possible to a new abstract
base class, so that only the actual marker/line segment rendering
occurs in the marker line/hash line subclasses.

This also gives the hash line all the existing placement options
permissible for marker lines -- e.g. first/last vertex, mid points,
regular intervals, etc.

The hash line length and angle can have data defined overrides,
which are evaluated per-line segment, allowing for the hash line
to change size and angle over the length of a single rendered
feature.
2019-04-03 02:31:27 +10:00
Nyall Dawson
fdfe0cee23 [api][needs-docs] Allow registering PyQGIS using a nice decorator syntax
This allows nice and simple, elegant construction of checks for
Python.

To use, Python based checks should use the decorator syntax:

  from qgis.core import check

  @check.register(type=QgsAbstractValidityCheck.TypeLayoutCheck)
  def my_layout_check(context, feedback):
    results = ...
    return results

Or, a more complete example. This one throws a warning when attempting
to export a layout with a map item set to the Web Mercator projection:

  @check.register(type=QgsAbstractValidityCheck.TypeLayoutCheck)
  def layout_map_crs_choice_check(context, feedback):
    layout = context.layout
    results = []
    for i in layout.items():
      if isinstance(i, QgsLayoutItemMap) and i.crs().authid() == 'EPSG:3857':
        res = QgsValidityCheckResult()
        res.type = QgsValidityCheckResult.Warning
        res.title='Map projection is misleading'
        res.detailedDescription='The projection for the map item {} is set to <i>Web Mercator (EPSG:3857)</i> which misrepresents areas and shapes. Consider using an appropriate local projection instead.'.format(i.displayName())
        results.append(res)

    return results
2019-01-11 09:51:04 +10:00
Matthias Kuhn
a1b6a2cb7f Fix docs 2018-07-02 06:16:49 -05:00
Matthias Kuhn
45fdd0fb31 Add documentation for @qgsfunction 2018-07-01 06:31:26 -05:00
Matthias Kuhn
60730abba7 Add missing import 2018-06-30 09:40:13 -05:00
Matthias Kuhn
773138cf57 Add handlesnull parameter to @qgsfunction
Up to date it was not possible to create a function that handles NULL values with the
@qgsfunction decorator. As soon as any parameter was NULL, the return value would also
be NULL.

Example of a function that returns a value now with a NULL paramter and would have returned NULL before

```
@qgsfunction(args=-1, group='Custom', handlesnull=True)
def mean_value(vals, feature, parent):
    valid_vals = [val for val in vals if val != NULL]
    return sum(valid_vals)/len(valid_vals)
```

[FEATURE]
2018-06-30 09:40:13 -05:00
Denis Rouzaud
ad00020366 QgsSettings.enumValue cast to enum 2018-06-21 05:29:16 -08:00
Denis Rouzaud
01681aba89 fix missing import 2018-06-21 05:29:16 -08:00
Denis Rouzaud
7dfec1fde0 [pyqgis] add misssing QgsSettings.setEnumValue
also fix sections in enumValue and flagValue
2018-06-21 05:29:16 -08:00
Nyall Dawson
1395dc0e9c Add missing license headers 2018-06-04 11:30:32 +10:00
Denis Rouzaud
7cb18cd5f1 [sipify] allow to define python operator in headers
sipify will take care of injecting them in python/{module}/__init__.py
2018-06-03 11:07:09 -08:00
Denis Rouzaud
b4ec9a3190
[pyqgis] add QgsSettings.enumValue and flagValue to the bindings (#7024)
* [pyqgis] add QgsSettings.enumValue and flagValue to the bindings

these are done in pure Python since no implementation is possible in SIP

there is a dirty hack for flags since QgsMapLayerProxyModel.Filters.__qualname__
returns 'Filters' and not 'QgsMapLayerProxyModel.Filters'

* fix typo
2018-05-18 09:25:12 -08:00
Denis Rouzaud
deccf205cf
[pyqgis] add method to retrieve metaEnum from an enum value or type (#7023) 2018-05-18 06:47:18 -08:00
Denis Rouzaud
95ecea897a move additions from top __init__ to core.__init__ 2018-05-16 11:29:28 -04:00
Denis Rouzaud
6e33bdcdc4 [pyqgis] move qgis.core tricks to their own python file in additions folder
this makes the code much easier to read
2018-05-14 18:00:39 -04:00