Skip to content

Commit c391abd

Browse files
committedJan 21, 2015
Fix todo in QgsMapMouseEvent
1 parent 6a080ba commit c391abd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed
 

‎src/app/qgsmapmouseevent.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ QgsPoint QgsMapMouseEvent::mapPoint( bool* snappedPoint ) const
7878
return mMapPoint;
7979
}
8080

81+
struct EdgesOnlyFilter : public QgsPointLocator::MatchFilter
82+
{
83+
bool acceptMatch( const QgsPointLocator::Match& m ) { return m.hasEdge(); }
84+
};
85+
8186
QList<QgsPoint> QgsMapMouseEvent::snappedSegment( bool* snapped ) const
8287
{
8388
QList<QgsPoint> segment = QList<QgsPoint>();
@@ -89,7 +94,9 @@ QList<QgsPoint> QgsMapMouseEvent::snappedSegment( bool* snapped ) const
8994
}
9095
else
9196
{
92-
// TODO: run snapToMap with only segments (resp. all hits)
97+
// run snapToMap with only segments
98+
EdgesOnlyFilter filter;
99+
mMapTool->canvas()->snappingUtils()->snapToMap( mMapPoint, &filter );
93100
}
94101

95102
if ( snapped )

0 commit comments

Comments
 (0)
Please sign in to comment.