5257 Commits

Author SHA1 Message Date
Nyall Dawson
e6ec1ec53e [FEATURE][API] Add iterator for QgsGeometryCollection
Iterates over the geometries in the collection, allowing this type
of code:

  gc = QgsGeometryCollection()
  gc.fromWkt('GeometryCollection( Point(1 2), Point(11 12), LineString(33 34, 44 45))')
  for part in gc:
    print(part.asWkt())
2018-12-07 05:51:27 +10:00
Nyall Dawson
e23527bf92 Use TypeHint annotation to indicate correct return type when sip code returns SIP_PYOBJECT
Provides correct return type hints to IDEs (and hopefully PyQGIS docs too!)
2018-12-07 05:51:27 +10:00
Nyall Dawson
4bba8ae64d [FEATURE][API] Add some nice PyQGIS API for working with geometry collections
- Calling removeGeometry with an invalid index will now raise an IndexError
- Calling collection[0] will return the first geometry in the collection,
collection[1] the second, etc. And negative indices return from the end
of the collection, so collection[-1] returns the last geometry in the collection.
- Geometries can be deleted by calling `del collection[1]` (deletes the
second geometry from the collection). Also supports negative indices
to count from the end of the collection.
2018-12-07 05:51:27 +10:00
nirvn
c6425338ee [FEATURE] Raster image marker 2018-12-05 15:44:44 +07:00
nirvn
60442980dd Add dox comment, fix travis 2018-12-05 11:14:13 +07:00
nirvn
ad4b876866 Add opacity parameter to image cache 2018-12-05 11:14:13 +07:00
Nyall Dawson
c1df802769 Add method to QgsImageCache to retrieve original image size 2018-12-05 11:14:13 +07:00
Nyall Dawson
84838d1ec6 [FEATURE][API] Add a content cache for raster images
This new class QgsImageCache is the equivalent of QgsSvgCache
but for raster images.

QgsImageCache stores pre-rendered resampled versions of raster
image files, allowing efficient reuse without incurring the
cost of resampling on every render.

Additionally, it offers the other benefits QgsSvgCache has,
such as thread safety, ability to transparently download remote
images, and support for base64 encoded strings.
2018-12-05 11:14:13 +07:00
Nyall Dawson
cdba8f5621 Use QgsAbstractContentCache base class for QgsSvgCache 2018-12-05 11:14:13 +07:00
Nyall Dawson
22496dc139 Create a new abtract base class for file content caches (e.g. QgsSvgCache)
Generalise QgsSvgCache and split off into a common base class so
that we can re-use code with alternative similar caches, e.g. a
raster image cache.
2018-12-05 11:14:13 +07:00
Nyall Dawson
ff786f2223 Add group method to QgsSettings
Is present in the QSettings API, but missing from QgsSettings
2018-12-05 04:46:58 +10:00
Nyall Dawson
4bca7838bf [processing] Add method for providers to specify a different list
of supported output formats when an output has no geometry
2018-12-03 18:11:24 +10:00
Denis Rouzaud
dde309439c
Merge pull request #8560 from 3nids/locator_context
Add context menu for locator filter results
2018-11-29 15:28:30 -04:00
Nyall Dawson
d72c4d001f [processing] Allow parameter metadata to set the number of decimal places
to show in numeric/distance widgets

E.g. to only show 2 decimal places:

  # only show two decimal places in parameter's widgets, not 6:
  param.setMetadata( {'widget_wrapper':
    { 'decimals': 2 }
  })
2018-11-30 05:02:59 +10:00
Denis Rouzaud
157c8f4987 more doc 2018-11-29 14:28:14 -04:00
Denis Rouzaud
c13b419d21 fix python bindings 2018-11-29 12:50:48 -04:00
Denis Rouzaud
e03537a4cf fix typo 2018-11-29 08:27:15 -04:00
Denis Rouzaud
f24daa2b69 allow to use icons too 2018-11-29 08:15:12 -04:00
Denis Rouzaud
d272f3cf2a do not use qaction in the result, build context menu in the widget 2018-11-29 08:02:37 -04:00
Denis Rouzaud
c48a706e49 use int as IDs to recognize context menu entries 2018-11-28 08:34:09 -04:00
Denis Rouzaud
91736fd9f6 fix doc 2018-11-28 07:46:24 -04:00
Denis Rouzaud
1bc0fbf9d4 [locator] allow to have context menu entries for results 2018-11-28 07:46:24 -04:00
Juergen E. Fischer
60ea432cbc fix windows build (partly reverts 1a199d095) 2018-11-27 23:16:03 +01:00
Nyall Dawson
6cc41a9474 Remove an incorrect /Transfer/ annotation, add a missing /Transfer/ annotation 2018-11-27 19:07:06 +10:00
Nyall Dawson
f595d53d0a Negative indices count from back of linestring 2018-11-27 09:29:13 +10:00
Nyall Dawson
1e5479964f [FEATURE][API] Add some nice PyQGIS methods and exceptions to QgsLineString
- len(QgsCurve) returns number of points in curve
- raise IndexErrors when calling pointN, xAt, yAt, zAt, mAt, setXAt, setYAt,
setMAt, setZAt with invalid vertex indices
- Add [] getter for retrieving specific vertices, eg. ls[0] returns QgsPoint(...)
- Add [] setter for setting specific (existing) vertices, e.g. ls[1] = QgsPoint(1,2)
- Add del support for removing vertices, e.g. del ls[1] removes the second vertex
2018-11-27 09:29:13 +10:00
Nyall Dawson
1072ebb621 [browser] Add API to access the drive data items 2018-11-26 18:20:08 +10:00
Mathieu Pellerin
4e1d6841ae Avoid more needless project dirtying 2018-11-21 21:46:50 +07:00
Denis Rouzaud
d1d3a51efb
Merge pull request #8429 from lbartoletti/extendMapTool
[needs-docs][FEATURE] Trim/extend
2018-11-21 06:36:08 +01:00
Nyall Dawson
5603546c26 Dox 2018-11-21 08:48:55 +11:00
Nyall Dawson
e21ea25c66 Add method to set QgsFeature geometry directly from QgsAbstractGeometry
Allows

    feat.setGeometry(QgsPoint(1,2))

instead of the more obscure

    feat.setGeometry(QgsGeometry(QgsPoint(1,2)))
2018-11-21 08:48:55 +11:00
Nyall Dawson
a22422c4bf [FEATURE][API] Add parts iterators to QgsGeometry
This allows easy iteration over all the parts of a geometry,
regardless of the geometry's type. E.g.

geometry = QgsGeometry.fromWkt( 'MultiPoint( 0 0, 1 1, 2 2)' )
for part in geometry.parts():
  print(part.asWkt())

geometry = QgsGeometry.fromWkt( 'LineString( 0 0, 10 10 )' )
for part in geometry.parts():
  print(part.asWkt())

There are two iterators available. QgsGeometry.parts() gives
a non-const iterator, allowing the parts to be modified in place:

geometry = QgsGeometry.fromWkt( 'MultiPoint( 0 0, 1 1, 2 2)' )
for part in geometry.parts():
   part.transform(ct)

For a const iteration, calling .const_parts() gives a const
iterator, which cannot edit the parts but avoids a potentially expensive
QgsGeometry detach and clone

geometry = QgsGeometry.fromWkt( 'MultiPoint( 0 0, 1 1, 2 2)' )
for part in geometry.const_parts():
   print(part.x())
2018-11-20 05:05:37 +11:00
Nyall Dawson
f5a6aef55f Raise IndexError in PyQGIS when calling geometryN on a collection
with an invalid geometry index

And add len operator to QgsGeometryCollection
2018-11-20 05:05:37 +11:00
Blottiere Paul
50e2b76ae7
Merge pull request #8005 from lbartoletti/bugfix_18902
Fixes #18902 Snapping and tracing inconsistent behaviour
2018-11-19 04:49:03 +00:00
lbartoletti
c292e69e49
Merge branch 'master' into extendMapTool 2018-11-15 11:37:26 +01:00
lbartoletti
574a57f2e4 Merge branch 'extendMapTool' of github.com:lbartoletti/QGIS into extendMapTool 2018-11-13 13:39:56 +01:00
Peter Petrik
0e413c04bc sipify 2018-11-13 10:48:02 +01:00
Peter Petrik
7564276994 QPrinter is unavailable on some platforms 2018-11-13 10:48:02 +01:00
Peter Petrik
1559013270 support platforms that does not have QProcess support (iOS) 2018-11-13 10:48:02 +01:00
lbartoletti
a8f865917e Nyall's review 2018-11-13 09:03:26 +01:00
lbartoletti
abcf2aa4cf init trim/extend feature 2018-11-13 09:03:26 +01:00
Denis Rouzaud
30cf2d37bc
Merge pull request #8404 from 3nids/locator_core
Move parts of QgsLocatorFilter to core
2018-11-09 12:18:27 +00:00
Denis Rouzaud
f4f5d1ef5b missing destructor 2018-11-09 10:01:38 +00:00
Denis Rouzaud
31cd1644c3 also move triggering of results to core 2018-11-09 10:01:29 +00:00
Nyall Dawson
ba17b130f8 Move forceRHR to QgsGeometry, avoid duplicate code 2018-11-09 19:06:48 +10:00
Nyall Dawson
30214538c2 [FEATURE] Add option to simple line and marker line to only
render exterior ring or interior rings

This option is shown whenever a simple line symbol or
marker line symbol is used as part of a fill symbol for
rendering polygons.

The default behavior is to render both interior and exterior
rings, but this new setting allows users to set the symbol
layer to render only for the exterior ring OR only
for interior rings.

This allows for symbolisation which wasn't directly possible
before, such as a marker line with markers for interior
rings angled toward the interior of the polygon.

Sponsored by the German QGIS User Group

Fixes #12652
2018-11-09 19:06:48 +10:00
Nyall Dawson
a947bb3b9b Dox++ 2018-11-09 19:06:48 +10:00
Nyall Dawson
73d0ced5df [FEATURE] Add option to force right-hand-rule during polygon symbol rendering
This new option, available under the "Advanced" button for fill symbols,
allows forcing rendered polygons to follow the standard "right hand
rule" for ring orientation (where exterior ring is clockwise, and
interior rings are all counter-clockwise).

The orientation fix is applied while rendering only, and the original
feature geometry is unchanged.

This allows for creation of fill symbols with consistent appearance,
regardless of the dataset being rendered and the ring orientation
of individual features.

Refs #12652
2018-11-09 19:06:48 +10:00
Nyall Dawson
27e1ef5c1c Add method to QgsCurvePolygon to force RHR, ensuring standard ring orientation 2018-11-09 19:06:48 +10:00
Nyall Dawson
c22364d45e Add method to determine orientation of closed curves 2018-11-09 19:06:48 +10:00