[QGIS-Developer] QGIS 3 API - QgsVertexMarker and QgsRubberBand Inconsistency

Nyall Dawson nyall.dawson at gmail.com
Wed Oct 25 15:05:58 PDT 2017


On 26 October 2017 at 05:30, C Hamilton <adenaculture at gmail.com> wrote:
> I just found that an API changed made a break with Lat Lon Tools which  is
> OK because I understand it is in flux.
>
> A while back a change was made to use QgsPointXY with QgsVertexMarker and
> QgsRubberBand through QgsGeometry.fromPolyline(). In looking at the
> documentation there is now a fromPolylineXY(), but from the API breaks
> documentation it seems like the use of fromPolyline is preferred.
>

This is a perfectly valid use of fromPolylineXY - since the created
geometry is only for display and presence of Z/M will have no effect.

I think most of the purely-gui classes are now working with QgsPointXY
(unless they've explicitly added overrides for QgsPoint objects). If
you find a GUI/canvas class which *only* works with QgsPoint I'd say
that's a bug and should be fixed in the API.

Basically the rationale here is that we needed a really lightweight 2d
point class (since QgsPoint is a QgsAbstractGeometry and comes with
the associated overhead + complex api). Ideally we'd just use QPointF,
but unfortunately QPointF uses qreal which is float on some platforms
(and we need to be guaranteed a double for some use cases).

Nyall


More information about the QGIS-Developer mailing list