| 659 | } |
| 660 | |
| 661 | void DrawWidget::ShowPlacePage() |
| 662 | { |
| 663 | place_page::Info const & info = m_framework.GetCurrentPlacePageInfo(); |
| 664 | search::ReverseGeocoder::Address address; |
| 665 | if (info.IsFeature()) |
| 666 | { |
| 667 | search::ReverseGeocoder const coder(m_framework.GetDataSource()); |
| 668 | coder.GetExactAddress(info.GetID(), address); |
| 669 | } |
| 670 | else |
| 671 | { |
| 672 | address = m_framework.GetAddressAtPoint(info.GetMercator()); |
| 673 | } |
| 674 | |
| 675 | std::unique_ptr<QDialog> placePageDialog = nullptr; |
| 676 | bool developerMode; |
| 677 | if (settings::Get(settings::kDeveloperMode, developerMode) && developerMode) |
| 678 | placePageDialog = std::make_unique<PlacePageDialogDeveloper>(this, info, address); |
| 679 | else |
| 680 | placePageDialog = std::make_unique<PlacePageDialogUser>(this, info, address); |
| 681 | |
| 682 | switch (placePageDialog->exec()) |
| 683 | { |
| 684 | case place_page_dialog::EditPlace: |
| 685 | { |
| 686 | osm::EditableMapObject emo; |
| 687 | if (m_framework.GetEditableMapObject(info.GetID(), emo)) |
| 688 | { |
| 689 | EditorDialog dlg(this, emo); |
| 690 | int const result = dlg.exec(); |
| 691 | if (result == QDialog::Accepted) |
| 692 | { |
| 693 | m_framework.SaveEditedMapObject(emo); |
| 694 | m_framework.UpdatePlacePageInfoForCurrentSelection(); |
| 695 | } |
| 696 | else if (result == QDialogButtonBox::DestructiveRole) |
| 697 | { |
| 698 | m_framework.DeleteFeature(info.GetID()); |
| 699 | } |
| 700 | } |
| 701 | else |
| 702 | { |
| 703 | LOG(LERROR, ("Error while trying to edit feature.")); |
| 704 | } |
| 705 | } |
| 706 | break; |
| 707 | case place_page_dialog::RouteFrom: |
| 708 | { |
| 709 | SetRoutePointAddMode(RouteMarkType::Start); |
| 710 | SubmitRoutingPoint(info.GetMercator(), true); |
| 711 | } |
| 712 | break; |
| 713 | case place_page_dialog::AddStop: |
| 714 | { |
| 715 | SetRoutePointAddMode(RouteMarkType::Intermediate); |
| 716 | SubmitRoutingPoint(info.GetMercator(), true); |
| 717 | } |
| 718 | break; |
nothing calls this directly
no test coverage detected