]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0021394: EDF 1637 GEOM: Function 'MinDistance' with creation of vertices
authorjfa <jfa@opencascade.com>
Tue, 12 Feb 2013 08:42:14 +0000 (08:42 +0000)
committerjfa <jfa@opencascade.com>
Tue, 12 Feb 2013 08:42:14 +0000 (08:42 +0000)
src/GEOMGUI/GEOM_msg_en.ts
src/GEOMGUI/GEOM_msg_fr.ts
src/MeasureGUI/MeasureGUI_DistanceDlg.cxx

index dfe43b5737291c12b3ade4320de77090f49fcf22..87d23adbeb983fd4c7a3f55473b41b78fc0dc2a9 100644 (file)
@@ -1080,12 +1080,20 @@ Please, select face, shell or solid and try again</translation>
     </message>
     <message>
         <source>GEOM_MINDIST_NO_SOL</source>
-        <translation>No solution found</translation>
+        <translation type="unfinished">No solution found</translation>
     </message>
     <message>
         <source>GEOM_MINDIST_OBJ</source>
         <translation>Objects And Results</translation>
     </message>
+    <message>
+        <source>GEOM_MINDIST_PUBLISH_TITLE</source>
+        <translation type="unfinished">Multiple solutions found</translation>
+    </message>
+    <message>
+        <source>GEOM_MINDIST_PUBLISH_TEXT</source>
+        <translation type="unfinished">Do you want to publish in the study all found solutions? If No, only the currently selected solution will be published.</translation>
+    </message>
     <message>
         <source>GEOM_MINDIST_TITLE</source>
         <translation>Minimun Distance Between Two Objects</translation>
index 81418e0c8362a0da69003347c3ebf6b54b240b9e..d07b791f53cd232ffc3565bad00f547e74201e36 100644 (file)
@@ -1070,10 +1070,26 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
         <source>GEOM_MIN</source>
         <translation>Min :</translation>
     </message>
+    <message>
+        <source>GEOM_MINDIST_NAME</source>
+        <translation type="unfinished">MinDist</translation>
+    </message>
+    <message>
+        <source>GEOM_MINDIST_NO_SOL</source>
+        <translation type="unfinished">No solution found</translation>
+    </message>
     <message>
         <source>GEOM_MINDIST_OBJ</source>
         <translation>Objets et résultats</translation>
     </message>
+    <message>
+        <source>GEOM_MINDIST_PUBLISH_TITLE</source>
+        <translation type="unfinished">Multiple solutions found</translation>
+    </message>
+    <message>
+        <source>GEOM_MINDIST_PUBLISH_TEXT</source>
+        <translation type="unfinished">Do you want to publish in the study all found solutions? If No, only the currently selected solution will be published.</translation>
+    </message>
     <message>
         <source>GEOM_MINDIST_TITLE</source>
         <translation>Distance minimale entre deux objets</translation>
index a49f2789d008dc7798ceeeb4da2f13ff66fdd367..d46f94206cb96ae95025add1641e6e97437247d4 100644 (file)
@@ -36,6 +36,7 @@
 #include <SUIT_ViewWindow.h>
 #include <SUIT_ViewManager.h>
 #include <SUIT_OverrideCursor.h>
+#include <SUIT_MessageBox.h>
 #include <SOCC_Prs.h>
 #include <SOCC_ViewModel.h>
 #include <SalomeApp_Tools.h>
@@ -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());