| 516 | } |
| 517 | |
| 518 | void Map::changeScale(unsigned int new_scale_denominator, double additional_stretch, const MapCoord& scaling_center, bool scale_symbols, bool scale_objects, bool scale_georeferencing, bool scale_templates) |
| 519 | { |
| 520 | if (new_scale_denominator == getScaleDenominator() && additional_stretch == 1.0) |
| 521 | return; |
| 522 | |
| 523 | double factor = (getScaleDenominator() / (double)new_scale_denominator) * additional_stretch; |
| 524 | |
| 525 | if (scale_symbols) |
| 526 | scaleAllSymbols(factor); |
| 527 | if (scale_objects) |
| 528 | { |
| 529 | undo_manager->clear(); |
| 530 | scaleAllObjects(factor, scaling_center); |
| 531 | if (hasPrinterConfig()) |
| 532 | { |
| 533 | auto print_area = printer_config->print_area; |
| 534 | auto center = QPointF(scaling_center); |
| 535 | print_area.setTopLeft(center + factor * (print_area.topLeft() - center)); |
| 536 | print_area.setBottomRight(center + factor * (print_area.bottomRight() - center)); |
| 537 | printer_config->print_area = print_area; |
| 538 | } |
| 539 | } |
| 540 | if (scale_georeferencing) |
| 541 | georeferencing->setMapRefPoint(scaling_center + factor * (georeferencing->getMapRefPoint() - scaling_center)); |
| 542 | if (scale_templates) |
| 543 | { |
| 544 | for (int i = 0; i < getNumTemplates(); ++i) |
| 545 | { |
| 546 | Template* temp = getTemplate(i); |
| 547 | if (temp->isTemplateGeoreferenced()) |
| 548 | continue; |
| 549 | setTemplateAreaDirty(i); |
| 550 | temp->scale(factor, scaling_center); |
| 551 | setTemplateAreaDirty(i); |
| 552 | } |
| 553 | for (int i = 0; i < getNumClosedTemplates(); ++i) |
| 554 | { |
| 555 | Template* temp = getClosedTemplate(i); |
| 556 | if (temp->isTemplateGeoreferenced()) |
| 557 | continue; |
| 558 | temp->scale(factor, scaling_center); |
| 559 | } |
| 560 | } |
| 561 | |
| 562 | setScaleDenominator(new_scale_denominator); |
| 563 | setOtherDirty(); |
| 564 | updateAllMapWidgets(); |
| 565 | } |
| 566 | |
| 567 | void Map::rotateMap(double rotation, const MapCoord& center, bool adjust_georeferencing, bool adjust_declination, bool adjust_templates) |
| 568 | { |
no test coverage detected