]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0022289: EDF 2623 GEOM: Make "MakePipeWithDifferentsSections" available from GUI
authorkga <kga@opencascade.com>
Wed, 30 Oct 2013 09:48:10 +0000 (09:48 +0000)
committerkga <kga@opencascade.com>
Wed, 30 Oct 2013 09:48:10 +0000 (09:48 +0000)
resources/CMakeLists.txt
resources/pipesections.png [new file with mode: 0644]
src/GEOMGUI/GEOM_images.ts
src/GEOMGUI/GEOM_msg_en.ts
src/GEOMGUI/GEOM_msg_fr.ts
src/GenerationGUI/GenerationGUI_PipeDlg.cxx
src/GenerationGUI/GenerationGUI_PipeDlg.h

index 937bc6e60dfd2f920c90b55e174a3c6edde93285..4e4074c29f1593e00fcb720b1f0d122f2080563f 100755 (executable)
@@ -125,6 +125,7 @@ SET( _res_files
   partitionplane.png
   pipe.png
   pipebinormal.png
+  pipesections.png
   plane.png
   planeWorking.png
   plane3points.png
diff --git a/resources/pipesections.png b/resources/pipesections.png
new file mode 100644 (file)
index 0000000..4102822
Binary files /dev/null and b/resources/pipesections.png differ
index 97faa85cf62923c6f181318ef2241a7a725b1e14..90d8f28ee4adc16bb02b14b76ab37f0b08fd7d03 100644 (file)
             <source>ICON_DLG_PIPE_BINORMAL</source>
             <translation>pipebinormal.png</translation>
         </message>
+        <message>
+            <source>ICON_DLG_PIPE_SECTION</source>
+            <translation>pipesections.png</translation>
+        </message>
         <message>
             <source>ICON_DLG_PLANE_3PNTS</source>
             <translation>plane3points.png</translation>
index 9ab089610bc91c292786a582954f8eb6c3954524..2a878f5ba52c655b1c0ac082d9abbd896ed1ce3a 100644 (file)
@@ -675,6 +675,10 @@ Please, select face, shell or solid and try again</translation>
         <source>GEOM_LCS</source>
         <translation>Local coordinate system</translation>
     </message>
+    <message>
+        <source>GEOM_LOCATIONS</source>
+        <translation>Locations</translation>
+    </message>
     <message>
         <source>GEOM_FACES</source>
         <translation>Faces</translation>
@@ -1216,6 +1220,14 @@ Please, select face, shell or solid and try again</translation>
         <source>GEOM_TARGET_OBJECT</source>
         <translation>Target face</translation>
     </message>
+    <message>
+        <source>GEOM_WITH_CONTACT</source>
+        <translation>With contact</translation>
+    </message>
+    <message>
+        <source>GEOM_WITH_CORRECTION</source>
+        <translation>With correction</translation>
+    </message>
     <message>
         <source>GEOM_OPERATIONS</source>
         <translation>Operations</translation>
index 0e6ad23e1a4a3899d9183c0e9458837ec33cdd01..edcad8e0a56d6d653d1a18b67b561a5cebfe055f 100644 (file)
@@ -681,6 +681,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
         <source>GEOM_LCS</source>
         <translation>Système de coordonnées local</translation>
     </message>
+    <message>
+        <source>GEOM_LOCATIONS</source>
+        <translation type="unfinished">Locations</translation>
+    </message>
     <message>
         <source>GEOM_FACES</source>
         <translation>Faces</translation>
@@ -1222,6 +1226,14 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
         <source>GEOM_TARGET_OBJECT</source>
         <translation>Face d&apos;objectif</translation>
     </message>
+    <message>
+        <source>GEOM_WITH_CONTACT</source>
+        <translation type="unfinished">With contact</translation>
+    </message>
+    <message>
+        <source>GEOM_WITH_CORRECTION</source>
+        <translation type="unfinished">With correction</translation>
+    </message>
     <message>
         <source>GEOM_OPERATIONS</source>
         <translation>Opérations</translation>
index a5f81be42160f834399353208733374096621796..76c23f9e07a679da712e2d3b90e363ed478827c1 100644 (file)
@@ -59,6 +59,7 @@ GenerationGUI_PipeDlg::GenerationGUI_PipeDlg (GeometryGUI* theGeometryGUI, QWidg
   QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPE")));
   QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
   QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPE_BINORMAL")));
+  QPixmap image3 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPE_SECTION")));
 
   setWindowTitle(tr("GEOM_PIPE_TITLE"));
 
@@ -66,8 +67,9 @@ GenerationGUI_PipeDlg::GenerationGUI_PipeDlg (GeometryGUI* theGeometryGUI, QWidg
   mainFrame()->GroupConstructors->setTitle(tr("GEOM_PIPE"));
   mainFrame()->RadioButton1->setIcon(image0);
   mainFrame()->RadioButton2->setIcon(image2);
-  mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
-  mainFrame()->RadioButton3->close();
+  mainFrame()->RadioButton3->setIcon(image3);
+  // mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
+  // mainFrame()->RadioButton3->close();
 
   GroupPoints = new DlgRef_3Sel1Check(centralWidget());
 
@@ -80,9 +82,28 @@ GenerationGUI_PipeDlg::GenerationGUI_PipeDlg (GeometryGUI* theGeometryGUI, QWidg
   GroupPoints->PushButton3->setIcon(image1);
   GroupPoints->CheckButton1->setText(tr("GEOM_SELECT_UNPUBLISHED_EDGES"));
 
+  GroupMakePoints = new DlgRef_3Sel2Check3Spin(centralWidget());
+
+  GroupMakePoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
+  GroupMakePoints->TextLabel1->setText(tr("GEOM_BASE_OBJECT"));
+  GroupMakePoints->TextLabel2->setText(tr("GEOM_LOCATIONS"));
+  GroupMakePoints->TextLabel3->setText(tr("GEOM_PATH_OBJECT"));
+  GroupMakePoints->PushButton1->setIcon(image1);
+  GroupMakePoints->PushButton2->setIcon(image1);
+  GroupMakePoints->PushButton3->setIcon(image1);
+  GroupMakePoints->CheckBox1->setText(tr("GEOM_WITH_CONTACT"));
+  GroupMakePoints->CheckBox2->setText(tr("GEOM_WITH_CORRECTION"));
+  GroupMakePoints->SpinBox1->close();
+  GroupMakePoints->SpinBox2->close();
+  GroupMakePoints->SpinBox3->close();
+  GroupMakePoints->TextLabel4->close();
+  GroupMakePoints->TextLabel5->close();
+  GroupMakePoints->TextLabel6->close();
+
   QVBoxLayout* layout = new QVBoxLayout(centralWidget());
   layout->setMargin(0); layout->setSpacing(6);
   layout->addWidget(GroupPoints);
+  layout->addWidget(GroupMakePoints);
   /***************************************************************/
 
   setHelpFileName("create_extrusion_alongpath_page.html");
@@ -119,6 +140,14 @@ void GenerationGUI_PipeDlg::Init()
 
   GroupPoints->CheckButton1->setEnabled(false);
 
+  GroupMakePoints->LineEdit1->setReadOnly(true);
+  GroupMakePoints->LineEdit2->setReadOnly(true);
+  GroupMakePoints->LineEdit3->setReadOnly(true);
+
+  GroupMakePoints->LineEdit1->setText("");
+  GroupMakePoints->LineEdit2->setText("");
+  GroupMakePoints->LineEdit3->setText("");
+
   showOnlyPreviewControl();
 
   // signals and slots connections
@@ -133,6 +162,10 @@ void GenerationGUI_PipeDlg::Init()
 
   connect(GroupPoints->CheckButton1,   SIGNAL(toggled(bool)), this, SLOT(SelectionTypeButtonClicked()));
 
+  connect(GroupMakePoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+  connect(GroupMakePoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+  connect(GroupMakePoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+
   initName(tr("GEOM_PIPE"));
   resize(100,100);
 
@@ -155,15 +188,25 @@ void GenerationGUI_PipeDlg::ConstructorsClicked( int constructorId )
 
   switch (constructorId) {
   case 0:
+    GroupMakePoints->hide();
+    GroupPoints->show();
     GroupPoints->TextLabel3->hide();
     GroupPoints->PushButton3->hide();
     GroupPoints->LineEdit3->hide();
     GroupPoints->PushButton1->click();
     break;
   case 1:
+    GroupMakePoints->hide();
+    GroupPoints->show();
     GroupPoints->TextLabel3->show();
     GroupPoints->PushButton3->show();
     GroupPoints->LineEdit3->show();
+    GroupPoints->PushButton1->click();
+    break;
+  case 2:
+    GroupPoints->hide();
+    GroupMakePoints->show();
+    GroupMakePoints->PushButton1->click();
     break;
   default:
     break;
@@ -224,7 +267,7 @@ bool GenerationGUI_PipeDlg::ClickOnApply()
   if ( getConstructorId() != 1 )
     ConstructorsClicked( getConstructorId() );
   // activate selection and connect selection manager
-  GroupPoints->PushButton1->click();
+  //   GroupPoints->PushButton1->click();
   return true;
 }
 
@@ -277,6 +320,43 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
         GroupPoints->PushButton2->click();
     }
   }
+  else if ( myEditCurrentArgument == GroupMakePoints->LineEdit1 ) {
+    myBaseObjects.clear();
+    QList<GEOM::GeomObjPtr> objects = getSelected( TopAbs_SHAPE, -1 );
+    for ( int i = 0; i < objects.count(); i++ ) {
+      GEOM::shape_type stype = objects[i]->GetMaxShapeType();
+      if ( stype < GEOM::SHELL || stype > GEOM::VERTEX )
+        continue;
+      myBaseObjects << objects[i];
+    }
+    if ( !myBaseObjects.isEmpty() ) {
+      QString aName = myBaseObjects.count() > 1 ? QString( "%1_objects").arg( myBaseObjects.count() ) : GEOMBase::GetName( myBaseObjects[0].get() );
+      myEditCurrentArgument->setText( aName );
+    }
+  }
+  else if ( myEditCurrentArgument == GroupMakePoints->LineEdit2 ) {
+    myLocations.clear();
+    QList<GEOM::GeomObjPtr> objects = getSelected( TopAbs_SHAPE, -1 );
+    for ( int i = 0; i < objects.count(); i++ ) {
+      GEOM::shape_type stype = objects[i]->GetMaxShapeType();
+      if ( stype < GEOM::SHELL || stype > GEOM::VERTEX )
+        continue;
+      myLocations << objects[i];
+    }
+    if ( !myLocations.isEmpty() ) {
+      QString aName = myLocations.count() > 1 ? QString( "%1_objects").arg( myLocations.count() ) : GEOMBase::GetName( myLocations[0].get() );
+      myEditCurrentArgument->setText( aName );
+    }
+  }
+  else if ( myEditCurrentArgument == GroupMakePoints->LineEdit3 ) {
+    QList<TopAbs_ShapeEnum> types;
+    types << TopAbs_EDGE << TopAbs_WIRE;
+    myPath = getSelected( types );
+    if ( myPath ) {
+      QString aName = GEOMBase::GetName( myPath.get() );
+      myEditCurrentArgument->setText( aName );
+    }
+  }
 
   processPreview();
 }
@@ -320,6 +400,23 @@ void GenerationGUI_PipeDlg::SetEditCurrentArgument()
     GroupPoints->CheckButton1->setEnabled(false);
     localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
   }
+
+  GroupMakePoints->PushButton1->setDown(false);
+  GroupMakePoints->PushButton2->setDown(false);
+  GroupMakePoints->PushButton3->setDown(false);
+  GroupMakePoints->LineEdit1->setEnabled(false);
+  GroupMakePoints->LineEdit2->setEnabled(false);
+  GroupMakePoints->LineEdit3->setEnabled(false);
+  if (send == GroupMakePoints->PushButton1) {
+    myEditCurrentArgument = GroupMakePoints->LineEdit1;
+  }
+  else if(send == GroupMakePoints->PushButton2) {
+    myEditCurrentArgument = GroupMakePoints->LineEdit2;
+  }
+  else if (send == GroupMakePoints->PushButton3) {
+    myEditCurrentArgument = GroupMakePoints->LineEdit3;
+  }
+
   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
           this, SLOT(SelectionIntoArgument()));
 
@@ -379,6 +476,9 @@ bool GenerationGUI_PipeDlg::isValid (QString&)
   case 1 :
     ok = !myBaseObjects.isEmpty() && myPath && myVec;
     break;
+  case 2 :
+    ok = !myBaseObjects.isEmpty() && ( myLocations.isEmpty() || myBaseObjects.count() == myLocations.count() ) && myPath;
+    break;
   default:
     break;
   }
@@ -394,19 +494,41 @@ bool GenerationGUI_PipeDlg::execute (ObjectList& objects)
   GEOM::GEOM_Object_var anObj;
 
   GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
-
-  for (int i = 0; i < myBaseObjects.count(); i++) {
-    switch ( getConstructorId() ) {
-    case 0 :
-      anObj = anOper->MakePipe(myBaseObjects[i].get(), myPath.get());
-      break;
-    case 1 :
-      anObj = anOper->MakePipeBiNormalAlongVector(myBaseObjects[i].get(), myPath.get(), myVec.get());
-      break;
-    }
+  switch( getConstructorId() ) {
+  case 0:
+  case 1:
+    for (int i = 0; i < myBaseObjects.count(); i++) {
+      switch ( getConstructorId() ) {
+      case 0 :
+       anObj = anOper->MakePipe(myBaseObjects[i].get(), myPath.get());
+       break;
+      case 1 :
+       anObj = anOper->MakePipeBiNormalAlongVector(myBaseObjects[i].get(), myPath.get(), myVec.get());
+       break;
+      }
     
+      if (!anObj->_is_nil())
+       objects.push_back(anObj._retn());
+    }
+    break;
+  case 2:
+    GEOM::ListOfGO_var myBaseGO = new GEOM::ListOfGO();
+    GEOM::ListOfGO_var myLocationsGO = new GEOM::ListOfGO();
+    myBaseGO->length( myBaseObjects.count() );
+    myLocationsGO->length( myLocations.count() );
+    for (int i = 0; i < myBaseObjects.count(); i++) {
+      myBaseGO[i] = myBaseObjects[i].copy();
+    }
+    for (int i = 0; i < myLocations.count(); i++) {
+      myLocationsGO[i] = myLocations[i].copy();
+    }
+
+    anObj = anOper->MakePipeWithDifferentSections(myBaseGO.in(), myLocationsGO.in(), myPath.get(), GroupMakePoints->CheckBox1->isChecked(), GroupMakePoints->CheckBox2->isChecked());
     if (!anObj->_is_nil())
       objects.push_back(anObj._retn());
+    break;
+  default:
+    break;
   }
   return true;
 }
index c776cc3595b0bb3860fa7bc68001c8b7e58a9f91..c6a263e707173ca2a7d4f62eb95038ef46fec5c5 100644 (file)
@@ -31,6 +31,7 @@
 #include "GEOM_GenericObjPtr.h"
 
 class DlgRef_3Sel1Check;
+class DlgRef_3Sel2Check3Spin;
 
 //=================================================================================
 // class    : GenerationGUI_PipeDlg
@@ -60,8 +61,10 @@ private:
   QList<GEOM::GeomObjPtr>            myBaseObjects;  /* Base shapes */
   GEOM::GeomObjPtr                   myPath; /* Shape, defining the path */
   GEOM::GeomObjPtr                   myVec;  /* Vector, defining the constant binormal direction */
+  QList<GEOM::GeomObjPtr>            myLocations; /* Locations on the path corresponding specified list of the Base shapes */
   
   DlgRef_3Sel1Check*                 GroupPoints;
+  DlgRef_3Sel2Check3Spin*            GroupMakePoints;
 
 private slots:
   void                               ClickOnOk();