| 565 | } |
| 566 | |
| 567 | void Map::rotateMap(double rotation, const MapCoord& center, bool adjust_georeferencing, bool adjust_declination, bool adjust_templates) |
| 568 | { |
| 569 | if (std::fmod(rotation, 2 * M_PI) == 0) |
| 570 | return; |
| 571 | |
| 572 | undo_manager->clear(); |
| 573 | rotateAllObjects(rotation, center); |
| 574 | |
| 575 | if (adjust_georeferencing) |
| 576 | { |
| 577 | MapCoordF reference_point = MapCoordF(georeferencing->getMapRefPoint() - center); |
| 578 | reference_point.rotate(-rotation); |
| 579 | georeferencing->setMapRefPoint(MapCoord(MapCoordF(center) + reference_point)); |
| 580 | } |
| 581 | if (adjust_declination) |
| 582 | { |
| 583 | auto rotation_degrees = qRadiansToDegrees(rotation); |
| 584 | georeferencing->setDeclination(georeferencing->getDeclination() + rotation_degrees); |
| 585 | } |
| 586 | if (adjust_templates) |
| 587 | { |
| 588 | for (int i = 0; i < getNumTemplates(); ++i) |
| 589 | { |
| 590 | Template* temp = getTemplate(i); |
| 591 | if (temp->isTemplateGeoreferenced()) |
| 592 | continue; |
| 593 | setTemplateAreaDirty(i); |
| 594 | temp->rotate(rotation, center); |
| 595 | setTemplateAreaDirty(i); |
| 596 | } |
| 597 | for (int i = 0; i < getNumClosedTemplates(); ++i) |
| 598 | { |
| 599 | Template* temp = getClosedTemplate(i); |
| 600 | if (temp->isTemplateGeoreferenced()) |
| 601 | continue; |
| 602 | temp->rotate(rotation, center); |
| 603 | } |
| 604 | } |
| 605 | |
| 606 | setOtherDirty(); |
| 607 | updateAllMapWidgets(); |
| 608 | } |
| 609 | |
| 610 | void Map::setMapNotes(const QString& text) |
| 611 | { |
no test coverage detected