| 153 | } |
| 154 | |
| 155 | MapCoordF MapGrid::getClosestPointOnGrid(MapCoordF position, Map* map) const |
| 156 | { |
| 157 | double final_horz_spacing, final_vert_spacing; |
| 158 | double final_horz_offset, final_vert_offset; |
| 159 | double final_rotation; |
| 160 | calculateFinalParameters(final_horz_spacing, final_vert_spacing, final_horz_offset, final_vert_offset, final_rotation, map); |
| 161 | |
| 162 | position.rotate(final_rotation - M_PI / 2); |
| 163 | position.setX(qRound((position.x() - final_horz_offset) / final_horz_spacing) * final_horz_spacing + final_horz_offset); |
| 164 | position.setY(qRound((position.y() - final_vert_offset) / final_vert_spacing) * final_vert_spacing + final_vert_offset); |
| 165 | position.rotate(M_PI / 2 - final_rotation); |
| 166 | return position; |
| 167 | } |
| 168 | |
| 169 | |
| 170 | bool MapGrid::hasAlpha() const |