| 571 | } |
| 572 | |
| 573 | void Object::rotateAround(const MapCoordF& center, qreal angle) |
| 574 | { |
| 575 | auto sin_angle = std::sin(angle); |
| 576 | auto cos_angle = std::cos(angle); |
| 577 | |
| 578 | for (auto& coord : coords) |
| 579 | { |
| 580 | auto const center_to_coord = MapCoordF(coord.x() - center.x(), coord.y() - center.y()); |
| 581 | coord.setX(center.x() + cos_angle * center_to_coord.x() + sin_angle * center_to_coord.y()); |
| 582 | coord.setY(center.y() - sin_angle * center_to_coord.x() + cos_angle * center_to_coord.y()); |
| 583 | } |
| 584 | |
| 585 | if (symbol->hasRotatableFillPattern()) |
| 586 | { |
| 587 | rotation += angle; |
| 588 | rotatePatternOrigin(center, sin_angle, cos_angle); |
| 589 | } |
| 590 | else if (symbol->isRotatable()) |
| 591 | { |
| 592 | rotation += angle; |
| 593 | } |
| 594 | setOutputDirty(); |
| 595 | } |
| 596 | |
| 597 | void Object::rotate(qreal angle) |
| 598 | { |
no test coverage detected