diff options
author | Mikhail Gorbushin <m.gorbushin@corp.mail.ru> | 2019-06-15 19:02:36 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2019-06-17 16:40:55 +0300 |
commit | c57ed6add93b062d19090303a4164ca28544fae6 (patch) | |
tree | a2c179ac4ccd2bd659937d13e5cdcec747b3ea06 /qt/mainwindow.cpp | |
parent | 4025f9f9f16c216983f08b1854f918bcb539efa8 (diff) |
[qt] add box mode
Diffstat (limited to 'qt/mainwindow.cpp')
-rw-r--r-- | qt/mainwindow.cpp | 73 |
1 files changed, 41 insertions, 32 deletions
diff --git a/qt/mainwindow.cpp b/qt/mainwindow.cpp index 0b65131be2..d352c33887 100644 --- a/qt/mainwindow.cpp +++ b/qt/mainwindow.cpp @@ -60,6 +60,44 @@ #endif // NO_DOWNLOADER +namespace +{ +using namespace qt; + +DrawWidget::SelectionMode ConvertFromMwmsBordersSelection(qt::MwmsBordersSelection::Response mode) +{ + switch (mode) + { + case MwmsBordersSelection::Response::MwmsBordersByPolyFiles: + { + return DrawWidget::SelectionMode::MwmsBordersByPolyFiles; + } + case MwmsBordersSelection::Response::MwmsBordersWithVerticesByPolyFiles: + { + return DrawWidget::SelectionMode::MwmsBordersWithVerticesByPolyFiles; + } + case MwmsBordersSelection::Response::MwmsBordersByPackedPolygon: + { + return DrawWidget::SelectionMode::MwmsBordersByPackedPolygon; + } + case MwmsBordersSelection::Response::MwmsBordersWithVerticesByPackedPolygon: + { + return DrawWidget::SelectionMode::MwmsBordersWithVerticesByPackedPolygon; + } + case MwmsBordersSelection::Response::BoundingBoxByPolyFiles: + { + return DrawWidget::SelectionMode::BoundingBoxByPolyFiles; + } + case MwmsBordersSelection::Response::BoundingBoxByPackedPolygon: + { + return DrawWidget::SelectionMode::BoundingBoxByPackedPolygon; + } + default: + UNREACHABLE(); + } +} +} // namespace + namespace qt { // Defined in osm_auth_dialog.cpp. @@ -275,9 +313,9 @@ void FormatMapSize(uint64_t sizeInBytes, string & units, size_t & sizeToDownload bool IsMwmsBordersSelectionMode(DrawWidget::SelectionMode mode) { return mode == DrawWidget::SelectionMode::MwmsBordersByPolyFiles || - mode == DrawWidget::SelectionMode::MwmsBordersWithPointsByPolyFiles || + mode == DrawWidget::SelectionMode::MwmsBordersWithVerticesByPolyFiles || mode == DrawWidget::SelectionMode::MwmsBordersByPackedPolygon || - mode == DrawWidget::SelectionMode::MwmsBordersWithPointsByPackedPolygon; + mode == DrawWidget::SelectionMode::MwmsBordersWithVerticesByPackedPolygon; } } // namespace @@ -659,42 +697,13 @@ void MainWindow::OnSwitchMwmsBordersSelectionMode() return; } - CHECK(response == MwmsBordersSelection::Response::JustBordersByPolyFiles || - response == MwmsBordersSelection::Response::WithPointsAndBordersByPolyFiles || - response == MwmsBordersSelection::Response::JustBordersByPackedPolygon || - response == MwmsBordersSelection::Response::WithPointsAndBordersByPackedPolygon, ()); - m_selectionMode->setChecked(false); m_selectionCityBoundariesMode->setChecked(false); m_selectionCityRoadsMode->setChecked(false); m_selectionMwmsBordersMode->setChecked(true); - switch (response) - { - case MwmsBordersSelection::Response::JustBordersByPolyFiles: - { - m_pDrawWidget->SetSelectionMode(DrawWidget::SelectionMode::MwmsBordersByPolyFiles); - break; - } - case MwmsBordersSelection::Response::WithPointsAndBordersByPolyFiles: - { - m_pDrawWidget->SetSelectionMode(DrawWidget::SelectionMode::MwmsBordersWithPointsByPolyFiles); - break; - } - case MwmsBordersSelection::Response::JustBordersByPackedPolygon: - { - m_pDrawWidget->SetSelectionMode(DrawWidget::SelectionMode::MwmsBordersByPackedPolygon); - break; - } - case MwmsBordersSelection::Response::WithPointsAndBordersByPackedPolygon: - { - m_pDrawWidget->SetSelectionMode(DrawWidget::SelectionMode::MwmsBordersWithPointsByPackedPolygon); - break; - } - default: - UNREACHABLE(); - } + m_pDrawWidget->SetSelectionMode(ConvertFromMwmsBordersSelection(response)); } void MainWindow::OnClearSelection() |