QgsPoint QgsMapToolCapture::mapPoint( const QgsMapMouseEvent &e ) const { QgsPoint newPoint = mapPoint( e.mapPoint() ); // set z value from snapped point if necessary if ( QgsWkbTypes::hasZ( newPoint.wkbType() ) ) { // if snapped, z dimension is taken from the corresponding snapped // point. if ( e.isSnapped() ) { const QgsPointLocator::Match match = e.mapPointMatch(); if ( match.layer() && QgsWkbTypes::hasZ( match.layer()->wkbType() ) ) { const QgsFeature ft = match.layer()->getFeature( match.featureId() ); newPoint.setZ( ft.geometry().vertexAt( match.vertexIndex() ).z() ); } } } return newPoint; }