Skip to content

Commit 6fad7a4

Browse files
Removal of redundant functions
1 parent 3db919e commit 6fad7a4

File tree

1 file changed

+0
-170
lines changed

1 file changed

+0
-170
lines changed

gui/src/Widgets/Actions.cpp

Lines changed: 0 additions & 170 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,6 @@ namespace HMP::Gui::Widgets
4141
{
4242
onExtrude(Dag::Extrude::ESource::Face);
4343
}
44-
else if (_key == c_kbExtrudeEdge)
45-
{
46-
onExtrude(Dag::Extrude::ESource::Edge);
47-
}
48-
else if (_key == c_kbExtrudeVertex)
49-
{
50-
onExtrude(Dag::Extrude::ESource::Vertex);
51-
}
5244
// extrude selected
5345
else if (_key == c_kbExtrudeSelectedFace)
5446
{
@@ -194,8 +186,6 @@ namespace HMP::Gui::Widgets
194186
void Actions::printUsage() const
195187
{
196188
cinolib::print_binding(c_kbExtrudeFace.name(), "extrude face");
197-
cinolib::print_binding(c_kbExtrudeEdge.name(), "extrude edge");
198-
cinolib::print_binding(c_kbExtrudeVertex.name(), "extrude vertex");
199189
cinolib::print_binding(c_kbExtrudeSelectedFace.name(), "extrude selected face");
200190
cinolib::print_binding(c_kbRefine.name(), "refine");
201191
cinolib::print_binding(c_kbDoubleRefine.name(), "refine twice");
@@ -874,168 +864,8 @@ namespace HMP::Gui::Widgets
874864

875865
if(index > 0)
876866
return;
877-
878-
879-
/*
880-
std::vector<unsigned int> allClickedFaces;
881-
allClickedFaces.reserve(cursorsOfClickedElements.size());
882-
for(App::Cursor cursor : cursorsOfClickedElements)
883-
{
884-
allClickedFaces.push_back(cursor.fid);
885-
}
886-
std::vector<std::tuple<App::Cursor, int>> clickedElementsWithAdjFaces;
887-
for(App::Cursor cursor : cursorsOfClickedElements)
888-
{
889-
std::vector<unsigned int> adjacentClickedFaces = intersectVectors(app().mesh.adj_f2f(cursor.fid), allClickedFaces);
890-
std::tuple<App::Cursor, int> tuple = std::make_tuple(cursor, static_cast<int>(adjacentClickedFaces.size()));
891-
clickedElementsWithAdjFaces.push_back(tuple);
892-
}
893-
std::sort(clickedElementsWithAdjFaces.begin(), clickedElementsWithAdjFaces.end(),
894-
[](const std::tuple<App::Cursor, int>& a, const std::tuple<App::Cursor, int>& b) {
895-
return std::get<1>(a) > std::get<1>(b);
896-
});
897-
std::vector<App::Cursor> sortedCursors;
898-
sortedCursors.reserve(clickedElementsWithAdjFaces.size());
899-
for(const auto tuple : clickedElementsWithAdjFaces)
900-
{
901-
sortedCursors.push_back(std::get<0>(tuple));
902-
}
903-
int index = 0;
904-
for (App::Cursor cursor : sortedCursors)
905-
{
906-
if(index == 0)
907-
{
908-
if(clickedExtrudeElements(_source, elements, fis, firstVi, clockwise, cursor.element, cursor))
909-
{
910-
if(checkIfClickedExtrudeIsPossible())
911-
{
912-
app().applyAction(*new HMP::Actions::Extrude{ elements, fis, firstVi, clockwise });
913-
}
914-
}
915-
} else
916-
{
917-
std::vector<unsigned int> adjFaces = intersectVectors(app().mesh.adj_f2f(cursor.fid), allClickedFaces);
918-
for(unsigned int fid : adjFaces)
919-
{
920-
std::vector<unsigned int> adjPids = app().mesh.adj_f2p(fid);
921-
std::vector<unsigned int> cursorPid = {cursor.pid};
922-
if(adjPids.size() == 2 && intersectVectors(cursorPid, adjPids).empty())
923-
{
924-
std::vector<unsigned int> adjEdgesFirst = app().mesh.adj_p2e(adjPids[0]);
925-
std::vector<unsigned int> adjEdgesSecond = app().mesh.adj_p2e(adjPids[1]);
926-
std::vector<unsigned int> intersectedEdgesFirst = intersectVectors(adjEdgesFirst, app().mesh.adj_f2e(cursor.fid));
927-
std::vector<unsigned int> intersectedEdgesSecond = intersectVectors(adjEdgesSecond, app().mesh.adj_f2e(cursor.fid));
928-
unsigned int edgeInCommon;
929-
if(intersectedEdgesFirst.size() == 1)
930-
{
931-
edgeInCommon = intersectedEdgesFirst[0];
932-
}
933-
else if(intersectedEdgesSecond.size() == 1)
934-
{
935-
edgeInCommon = intersectedEdgesSecond[0];
936-
}
937-
else
938-
return;
939-
940-
unsigned int vertexInCommon;
941-
cursor.eid = edgeInCommon;
942-
vertexInCommon = app().mesh.adj_e2v(edgeInCommon)[0];
943-
cursor.ei = Meshing::Utils::ei(cursor.element->vids, Meshing::Utils::eidVids(app().mesh, edgeInCommon));
944-
cursor.vid = vertexInCommon;
945-
cursor.vi = Meshing::Utils::vi(cursor.element->vids, vertexInCommon);
946-
if(clickedExtrudeEdgeElements(_source, elements, fis, firstVi, clockwise, cursor.element, cursor))
947-
{
948-
app().applyAction(*new HMP::Actions::Extrude{ elements, fis, firstVi, clockwise });
949-
}
950-
}
951-
else
952-
{
953-
if(clickedExtrudeElements(_source, elements, fis, firstVi, clockwise, cursor.element, cursor))
954-
{
955-
if(checkIfClickedExtrudeIsPossible())
956-
{
957-
app().applyAction(*new HMP::Actions::Extrude{ elements, fis, firstVi, clockwise });
958-
}
959-
}
960-
}
961-
}
962-
}
963-
index++;
964-
}
965-
966-
if(index > 0)
967-
return;*/
968-
969-
/*for (Dag::Element* element : app().clickedElements)
970-
{
971-
if(clickedExtrudeElements(_source, elements, fis, firstVi, clockwise, element, cursorsOfClickedElements[i]))
972-
{
973-
if(checkIfClickedExtrudeIsPossible())
974-
{
975-
app().applyAction(*new HMP::Actions::Extrude{ elements, fis, firstVi, clockwise });
976-
}
977-
}
978-
i++;
979-
}
980-
return;*/
981867
}
982868

983-
/*if(_source == Dag::Extrude::ESource::Face)
984-
{
985-
for (Dag::Element* element : app().clickedElements)
986-
{
987-
if(clickedExtrudeElements(_source, elements, fis, firstVi, clockwise, element, cursorsOfClickedElements[i]))
988-
{
989-
if(checkIfClickedExtrudeIsPossible())
990-
{
991-
app().applyAction(*new HMP::Actions::Extrude{ elements, fis, firstVi, clockwise });
992-
}
993-
}
994-
extrudedClickedElements = true;
995-
i++;
996-
}
997-
} else if (_source == Dag::Extrude::ESource::Edge)
998-
{
999-
std::optional<unsigned int> edgeInCommonOptional = getEdgeInCommon(app().clickedElements);
1000-
if(edgeInCommonOptional.has_value())
1001-
{
1002-
unsigned int edgeInCommon = edgeInCommonOptional.value();
1003-
unsigned int vertexInCommon;
1004-
App::Cursor cursor = app().cursorsOfClickedElements[0];
1005-
cursor.eid = edgeInCommon;
1006-
vertexInCommon = app().mesh.adj_e2v(edgeInCommon)[0];
1007-
cursor.ei = Meshing::Utils::ei(app().clickedElements[0]->vids, Meshing::Utils::eidVids(app().mesh, edgeInCommon));
1008-
cursor.vid = vertexInCommon;
1009-
cursor.vi = Meshing::Utils::vi(app().clickedElements[0]->vids, vertexInCommon);
1010-
if(clickedExtrudeEdgeElements(_source, elements, fis, firstVi, clockwise, app().clickedElements[0], cursor))
1011-
{
1012-
app().applyAction(*new HMP::Actions::Extrude{ elements, fis, firstVi, clockwise });
1013-
}
1014-
extrudedClickedElements = true;
1015-
}
1016-
}
1017-
else {
1018-
std::optional<unsigned int> vertexInCommonOptional = getVertexInCommon(app().clickedElements);
1019-
std::vector<Dag::Element*> firstTwoElements = app().clickedElements;
1020-
firstTwoElements.resize(2);
1021-
std::optional<unsigned int> edgeInCommonOptional = getEdgeInCommon(firstTwoElements);
1022-
if (vertexInCommonOptional.has_value() && edgeInCommonOptional.has_value()) {
1023-
unsigned int vertexInCommon = vertexInCommonOptional.value();
1024-
unsigned int edgeInCommon = edgeInCommonOptional.value();
1025-
App::Cursor cursor = app().cursorsOfClickedElements[0];
1026-
cursor.eid = edgeInCommon;
1027-
cursor.ei = Meshing::Utils::ei(app().clickedElements[0]->vids,
1028-
Meshing::Utils::eidVids(app().mesh, edgeInCommon));
1029-
cursor.vid = vertexInCommon;
1030-
cursor.vi = Meshing::Utils::vi(app().clickedElements[0]->vids, vertexInCommon);
1031-
if (clickedExtrudeVertexElements(_source, elements, fis, firstVi, clockwise, app().clickedElements[0],
1032-
cursor)) {
1033-
app().applyAction(*new HMP::Actions::Extrude{elements, fis, firstVi, clockwise});
1034-
}
1035-
extrudedClickedElements = true;
1036-
}
1037-
}
1038-
*/
1039869
if (hoveredExtrudeElements(_source, elements, fis, firstVi, clockwise))
1040870
{
1041871
app().applyAction(*new HMP::Actions::Extrude{ elements, fis, firstVi, clockwise });

0 commit comments

Comments
 (0)