MCPcopy Create free account
hub / github.com/OpenOrienteering/mapper / rotateMap

Method rotateMap

src/core/map.cpp:567–608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

565}
566
567void 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
610void Map::setMapNotes(const QString& text)
611{

Callers 2

templateRotationTestMethod · 0.80
makeRotationMethod · 0.80

Calls 9

getMapRefPointMethod · 0.80
setDeclinationMethod · 0.80
getDeclinationMethod · 0.80
MapCoordFClass · 0.70
MapCoordClass · 0.70
clearMethod · 0.45
rotateMethod · 0.45
setMapRefPointMethod · 0.45

Tested by

no test coverage detected