From 44e3e406af03948043a5c92e76a9c3afaaa66b7b Mon Sep 17 00:00:00 2001 From: jfa Date: Tue, 12 Feb 2013 08:42:14 +0000 Subject: [PATCH] 0021394: EDF 1637 GEOM: Function 'MinDistance' with creation of vertices --- src/GEOMGUI/GEOM_msg_en.ts | 10 ++++++- src/GEOMGUI/GEOM_msg_fr.ts | 16 +++++++++++ src/MeasureGUI/MeasureGUI_DistanceDlg.cxx | 35 +++++++++++++++++++++-- 3 files changed, 57 insertions(+), 4 deletions(-) diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index dfe43b573..87d23adbe 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -1080,12 +1080,20 @@ Please, select face, shell or solid and try again GEOM_MINDIST_NO_SOL - No solution found + No solution found GEOM_MINDIST_OBJ Objects And Results + + GEOM_MINDIST_PUBLISH_TITLE + Multiple solutions found + + + GEOM_MINDIST_PUBLISH_TEXT + Do you want to publish in the study all found solutions? If No, only the currently selected solution will be published. + GEOM_MINDIST_TITLE Minimun Distance Between Two Objects diff --git a/src/GEOMGUI/GEOM_msg_fr.ts b/src/GEOMGUI/GEOM_msg_fr.ts index 81418e0c8..d07b791f5 100644 --- a/src/GEOMGUI/GEOM_msg_fr.ts +++ b/src/GEOMGUI/GEOM_msg_fr.ts @@ -1070,10 +1070,26 @@ Choisissez une face, une coque ou un solide et essayez de nouveau GEOM_MIN Min : + + GEOM_MINDIST_NAME + MinDist + + + GEOM_MINDIST_NO_SOL + No solution found + GEOM_MINDIST_OBJ Objets et résultats + + GEOM_MINDIST_PUBLISH_TITLE + Multiple solutions found + + + GEOM_MINDIST_PUBLISH_TEXT + Do you want to publish in the study all found solutions? If No, only the currently selected solution will be published. + GEOM_MINDIST_TITLE Distance minimale entre deux objets diff --git a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx index a49f2789d..d46f94206 100644 --- a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -433,9 +434,37 @@ bool MeasureGUI_DistanceDlg::execute (ObjectList& objects) int nbSols = anOper->ClosestPoints(myObj1, myObj2, aDbls); if (anOper->IsDone()) { - for (int i = 0; i < nbSols; i++) { - GEOM::GEOM_Object_var anObj1 = aBasicOper->MakePointXYZ(aDbls[i*6 + 0], aDbls[i*6 + 1], aDbls[i*6 + 2]); - GEOM::GEOM_Object_var anObj2 = aBasicOper->MakePointXYZ(aDbls[i*6 + 3], aDbls[i*6 + 4], aDbls[i*6 + 5]); + bool doPublishAll = true; + if (nbSols > 1) { + QMessageBox::StandardButton anAnswer = + SUIT_MessageBox::question(this, tr("GEOM_MINDIST_PUBLISH_TITLE"), + tr("GEOM_MINDIST_PUBLISH_TEXT"), + QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, + QMessageBox::No); + if (anAnswer == QMessageBox::No) + doPublishAll = false; + else if (anAnswer != QMessageBox::Yes) + return true; + } + if (doPublishAll) { + for (int i = 0; i < nbSols; i++) { + GEOM::GEOM_Object_var anObj1 = + aBasicOper->MakePointXYZ(aDbls[i*6 + 0], aDbls[i*6 + 1], aDbls[i*6 + 2]); + GEOM::GEOM_Object_var anObj2 = + aBasicOper->MakePointXYZ(aDbls[i*6 + 3], aDbls[i*6 + 4], aDbls[i*6 + 5]); + + if (!anObj1->_is_nil() && !anObj2->_is_nil()) { + objects.push_back(anObj1._retn()); + objects.push_back(anObj2._retn()); + } + } + } + else { + int i = myGrp->ComboBox1->currentIndex(); + GEOM::GEOM_Object_var anObj1 = + aBasicOper->MakePointXYZ(aDbls[i*6 + 0], aDbls[i*6 + 1], aDbls[i*6 + 2]); + GEOM::GEOM_Object_var anObj2 = + aBasicOper->MakePointXYZ(aDbls[i*6 + 3], aDbls[i*6 + 4], aDbls[i*6 + 5]); if (!anObj1->_is_nil() && !anObj2->_is_nil()) { objects.push_back(anObj1._retn()); -- 2.39.2