File indexing completed on 2024-04-14 03:48:49

0001 #include "NearestNeighborInterpolation.h"
0002 
0003 #include "ReadOnlyMapImage.h"
0004 
0005 #include <cmath>
0006 
0007 NearestNeighborInterpolation::NearestNeighborInterpolation( ReadOnlyMapImage * const mapImage )
0008     : InterpolationMethod( mapImage )
0009 {
0010 }
0011 
0012 QRgb NearestNeighborInterpolation::interpolate( double const x, double const y )
0013 {
0014     int const xr = round( x );
0015     int const yr = round( y );
0016     return m_mapImage->pixel( xr, yr );
0017 }