MCPcopy Create free account
hub / github.com/CloudCompare/CloudCompare / doImportPolylinesFromDB

Method doImportPolylinesFromDB

qCC/ccSectionExtractionTool.cpp:920–965  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

918}
919
920void 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
967void ccSectionExtractionTool::cancel()
968{

Callers

nothing calls this directly

Calls 7

SelectEntitiesFunction · 0.85
addPolylineFunction · 0.85
filterChildrenMethod · 0.80
backMethod · 0.80
redrawMethod · 0.80
dbRootObjectMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected