[QGIS-Developer] API break: snapSegment

Martin Dobias wonder.sk at gmail.com
Fri Sep 29 00:15:19 PDT 2017


Hi Loïc

On Tue, Sep 26, 2017 at 11:08 PM, L.Bartoletti
<lbartoletti at tuxfamily.org> wrote:
> Hi,
>
> For a few days now QgsMapMouseEvent:: snapSegment is no longer usable
> (moved). I need these tools to create circles with tangents
> (https://github.com/qgis/QGIS/pull/4947).
>
> Is there another way to get segments by snapping?

Yes - here's the code you need to snap to segments - equivalent to a
snapSegment() call:

struct EdgesOnlyFilter : public QgsPointLocator::MatchFilter
{
  bool acceptMatch( const QgsPointLocator::Match &m ) override {
return m.hasEdge(); }
};

EdgesOnlyFilter filter;
match = mapCanvas->snappingUtils()->snapToMap( mapPoint, &filter );

Regards
Martin


More information about the QGIS-Developer mailing list