| 918 | } |
| 919 | |
| 920 | void ccSectionExtractionTool::doImportPolylinesFromDB() |
| 921 | { |
| 922 | MainWindow* mainWindow = MainWindow::TheInstance(); |
| 923 | if (!mainWindow) |
| 924 | return; |
| 925 | |
| 926 | ccHObject* root = mainWindow->dbRootObject(); |
| 927 | ccHObject::Container polylines; |
| 928 | if (root) |
| 929 | { |
| 930 | root->filterChildren(polylines, true, CC_TYPES::POLY_LINE); |
| 931 | } |
| 932 | |
| 933 | if (!polylines.empty()) |
| 934 | { |
| 935 | std::vector<int> indexes; |
| 936 | if (!ccItemSelectionDlg::SelectEntities(polylines, indexes, this)) |
| 937 | { |
| 938 | return; |
| 939 | } |
| 940 | |
| 941 | //set new 'undo' step |
| 942 | addUndoStep(); |
| 943 | |
| 944 | enableSectionEditingMode(false); |
| 945 | |
| 946 | for (int index : indexes) |
| 947 | { |
| 948 | assert(index >= 0 && index < static_cast<int>(polylines.size())); |
| 949 | assert(polylines[index]->isA(CC_TYPES::POLY_LINE)); |
| 950 | |
| 951 | ccPolyline* poly = static_cast<ccPolyline*>(polylines[index]); |
| 952 | addPolyline(poly, true); |
| 953 | } |
| 954 | |
| 955 | //auto-select the last one |
| 956 | if (!m_sections.empty()) |
| 957 | selectPolyline(&(m_sections.back())); |
| 958 | if (m_associatedWin) |
| 959 | m_associatedWin->redraw(); |
| 960 | } |
| 961 | else |
| 962 | { |
| 963 | ccLog::Error("No polyline in DB!"); |
| 964 | } |
| 965 | } |
| 966 | |
| 967 | void ccSectionExtractionTool::cancel() |
| 968 | { |
nothing calls this directly
no test coverage detected