From: jfa Date: Fri, 18 Jan 2013 14:36:27 +0000 (+0000) Subject: Mantis issue 0021394: EDF 1637 GEOM: Function 'MinDistance' with creation of vertices X-Git-Tag: V6_main_FINAL~58 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=32ceab19f39b42d688ccfab72b9aaecab1b53b66;p=modules%2Fgeom.git Mantis issue 0021394: EDF 1637 GEOM: Function 'MinDistance' with creation of vertices --- diff --git a/doc/salome/gui/GEOM/input/min_distance.doc b/doc/salome/gui/GEOM/input/min_distance.doc index d329126b4..9653e2210 100644 --- a/doc/salome/gui/GEOM/input/min_distance.doc +++ b/doc/salome/gui/GEOM/input/min_distance.doc @@ -3,16 +3,29 @@ \page min_distance_page Min. Distance Returns the minimum distance between two geometrical objects and -the coordinates of the vector of distance and shows the vector in the viewer. +the coordinates of the vector of distance and shows the distance in +the viewer. + +\note The minimal distance searching task can have one or more +solutions, and also it can have an infinite set of solutions. All +found solutions are listed in dedicated combobox. When the user +selects any one of found solutions, presentation is displayed in the +OCC viewer and fields "Length", "DX", "DY" and "DZ" are filled with +corresponding values. If there are no solutions found, text "No +solution found" will be shown instead of solutions list; this could +mean what the task has an infinite number of solutions. + +\n \note Currently used OCCT functionality finds finite number of +solutions even in cases, where an infinite set of solutions exists. \n On \b Apply or Apply and Close it creates a set of closest -points of the shapes. +points of the shapes, corresponding to all found solutions. TUI Commands: \naDist = geompy.MinDistance(Shape1, Shape2), \n[aDist, DX, DY, DZ] = geompy.MinDistanceComponents(Shape1, Shape2), \n[nbSols, (x11, y11, z11, x21, y21, z21, ...)] = geompy.ClosestPoints(Shape1, Shape2), -where \em Shape1 and \em Shape2 are shapes between which the minimal +\n where \em Shape1 and \em Shape2 are shapes between which the minimal distance is computed. See also a \ref tui_min_distance_page "TUI example". diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index 8b0e0e82c..00c84861a 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -1074,6 +1074,14 @@ Please, select face, shell or solid and try again GEOM_MIN Min : + + GEOM_MINDIST_NAME + MinDist + + + GEOM_MINDIST_NO_SOL + No solution found + GEOM_MINDIST_OBJ Objects And Results @@ -1082,10 +1090,6 @@ Please, select face, shell or solid and try again GEOM_MINDIST_TITLE Minimun Distance Between Two Objects - - GEOM_MINDIST_NAME - MinDist - GEOM_MIRROR Mirror @@ -1210,6 +1214,10 @@ Please, select face, shell or solid and try again GEOM_SOLUTION Solution : + + GEOM_SOLUTION_I + Solution %1 + GEOM_TARGET_OBJECT Target face diff --git a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx index 8d670a9d0..a49f2789d 100644 --- a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx @@ -102,10 +102,6 @@ MeasureGUI_DistanceDlg::MeasureGUI_DistanceDlg (GeometryGUI* GUI, QWidget* paren myGrp->LineEdit4->setReadOnly(true); myGrp->LineEdit5->setReadOnly(true); myGrp->LineEdit6->setReadOnly(true); - - QVBoxLayout* layout = new QVBoxLayout (centralWidget()); - layout->setMargin(0); layout->setSpacing(6); - layout->addWidget(myGrp); /***************************************************************/ myHelpFileName = "min_distance_page.html"; @@ -129,6 +125,7 @@ MeasureGUI_DistanceDlg::~MeasureGUI_DistanceDlg() void MeasureGUI_DistanceDlg::Init() { myEditCurrentArgument = myGrp->LineEdit1; + myDbls = new GEOM::ListOfDouble(); // signals and slots connections connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); @@ -200,7 +197,7 @@ void MeasureGUI_DistanceDlg::enterEvent(QEvent*) //================================================================================= void MeasureGUI_DistanceDlg::SolutionSelected (int i) { - if (i < 0 || myDbls->length() <= i*6) { + if (i < 0 || myDbls->length() < (i+1)*6) { myGrp->LineEdit3->setText(""); myGrp->LineEdit4->setText(""); myGrp->LineEdit5->setText(""); @@ -303,6 +300,7 @@ void MeasureGUI_DistanceDlg::processObject() myGrp->LineEdit2->setText(!myObj2->_is_nil() ? GEOMBase::GetName(myObj2) : ""); myGrp->ComboBox1->clear(); + myDbls->length(0); erasePreview(); int nbSols = 0; @@ -319,9 +317,13 @@ void MeasureGUI_DistanceDlg::processObject() return; } - if (anOper->IsDone() && nbSols > 0) { + if (!anOper->IsDone()) + myGrp->ComboBox1->addItem(tr(anOper->GetErrorCode())); + else if (nbSols <= 0) + myGrp->ComboBox1->addItem(tr("GEOM_MINDIST_NO_SOL")); + else { for (int i = 0; i < nbSols; i++) { - myGrp->ComboBox1->addItem(QString("Solution %1").arg(i + 1)); + myGrp->ComboBox1->addItem(tr("GEOM_SOLUTION_I").arg(i + 1)); } myGrp->ComboBox1->setCurrentIndex(0); } @@ -337,7 +339,8 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs() int currSol = myGrp->ComboBox1->currentIndex(); - if (myObj1->_is_nil() || myObj2->_is_nil() || currSol == -1 || + if (myObj1->_is_nil() || myObj2->_is_nil() || + currSol == -1 || (currSol+1)*6 > myDbls->length() || vw->getViewManager()->getType() != OCCViewer_Viewer::Type()) return 0; diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx index 2dd8f51c6..5f22ed33a 100644 --- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx @@ -88,10 +88,6 @@ TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg GroupArgs->LineEdit2->setReadOnly(true); GroupArgs->SpinBox_DX1->setEnabled(isAngleStep); GroupArgs->CheckButton1->setEnabled(isAngleStep); - - QVBoxLayout* layout = new QVBoxLayout(centralWidget()); - layout->setMargin(0); layout->setSpacing(6); - layout->addWidget(GroupArgs); /***************************************************************/ setHelpFileName("multi_rotation_operation_page.html");