Salome HOME
PAL16617 (Modification/Transformation operations with copy don't create a new mesh)
authoreap <eap@opencascade.com>
Wed, 19 Dec 2007 15:05:31 +0000 (15:05 +0000)
committereap <eap@opencascade.com>
Wed, 19 Dec 2007 15:05:31 +0000 (15:05 +0000)
+    SMESH_Mesh MirrorMakeMesh (in long_array IDsOfElements,
+    SMESH_Mesh MirrorObjectMakeMesh (in SMESH_IDSource theObject,
+    SMESH_Mesh TranslateMakeMesh (in long_array IDsOfElements,
+    SMESH_Mesh TranslateObjectMakeMesh (in SMESH_IDSource theObject,
+    SMESH_Mesh RotateMakeMesh (in long_array IDsOfElements,
+    SMESH_Mesh RotateObjectMakeMesh (in SMESH_IDSource theObject,

idl/SMESH_MeshEditor.idl
src/SMESHGUI/SMESHGUI_RotationDlg.cxx
src/SMESHGUI/SMESHGUI_RotationDlg.h
src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx
src/SMESHGUI/SMESHGUI_SymmetryDlg.h
src/SMESHGUI/SMESHGUI_TranslationDlg.cxx
src/SMESHGUI/SMESHGUI_TranslationDlg.h
src/SMESH_I/SMESH_MeshEditor_i.cxx
src/SMESH_I/SMESH_MeshEditor_i.hxx

index f5a8cc421006235d98adabd07f774fefab12bddb..121f8a307bbcdc023e62cbd537f1a35477b35f5c 100644 (file)
@@ -418,31 +418,49 @@ module SMESH
 
     void Mirror (in long_array IDsOfElements,
                  in AxisStruct Mirror,
-                 in MirrorType theMirrorType,
+                 in MirrorType Type,
                  in boolean    Copy);
     ListOfGroups MirrorMakeGroups (in long_array IDsOfElements,
                                    in AxisStruct Mirror,
-                                   in MirrorType theMirrorType);
+                                   in MirrorType Type);
+    SMESH_Mesh MirrorMakeMesh (in long_array IDsOfElements,
+                               in AxisStruct Mirror,
+                               in MirrorType Type,
+                               in boolean    CopyGroups,
+                               in string     MeshName);
 
     void MirrorObject (in SMESH_IDSource theObject,
                       in AxisStruct     Mirror,
-                      in MirrorType     theMirrorType,
+                      in MirrorType     Type,
                       in boolean        Copy);
     ListOfGroups MirrorObjectMakeGroups (in SMESH_IDSource theObject,
                                          in AxisStruct     Mirror,
-                                         in MirrorType     theMirrorType);
+                                         in MirrorType     Type);
+    SMESH_Mesh MirrorObjectMakeMesh (in SMESH_IDSource theObject,
+                                     in AxisStruct     Mirror,
+                                     in MirrorType     Type,
+                                     in boolean        CopyGroups,
+                                     in string         MeshName);
 
     void Translate (in long_array IDsOfElements,
                     in DirStruct  Vector,
                     in boolean    Copy);
     ListOfGroups TranslateMakeGroups (in long_array IDsOfElements,
                                       in DirStruct  Vector);
+    SMESH_Mesh TranslateMakeMesh (in long_array IDsOfElements,
+                                  in DirStruct  Vector,
+                                  in boolean    CopyGroups,
+                                  in string     MeshName);
 
     void TranslateObject (in SMESH_IDSource theObject,
                          in DirStruct      Vector,
                          in boolean        Copy);
     ListOfGroups TranslateObjectMakeGroups (in SMESH_IDSource theObject,
                                             in DirStruct      Vector);
+    SMESH_Mesh TranslateObjectMakeMesh (in SMESH_IDSource theObject,
+                                        in DirStruct      Vector,
+                                        in boolean        CopyGroups,
+                                        in string         MeshName);
 
     void Rotate (in long_array IDsOfElements,
                  in AxisStruct Axis,
@@ -451,6 +469,11 @@ module SMESH
     ListOfGroups RotateMakeGroups (in long_array IDsOfElements,
                                    in AxisStruct Axis,
                                    in double     AngleInRadians);
+    SMESH_Mesh RotateMakeMesh (in long_array IDsOfElements,
+                               in AxisStruct Axis,
+                               in double     AngleInRadians,
+                               in boolean    CopyGroups,
+                               in string     MeshName);
 
     void RotateObject (in SMESH_IDSource theObject,
                       in AxisStruct     Axis,
@@ -459,6 +482,11 @@ module SMESH
     ListOfGroups RotateObjectMakeGroups (in SMESH_IDSource theObject,
                                          in AxisStruct     Axis,
                                          in double         AngleInRadians);
+    SMESH_Mesh RotateObjectMakeMesh (in SMESH_IDSource theObject,
+                                     in AxisStruct     Axis,
+                                     in double         AngleInRadians,
+                                     in boolean        CopyGroups,
+                                     in string         MeshName);
 
     void FindCoincidentNodes (in  double              Tolerance,
                               out array_of_long_array GroupsOfNodes);
index 0c11ee6c358d02c8e709e79a6ad607445a76d582..d587855d3d6bc16cc6b153fa695af308df9196e7 100644 (file)
@@ -51,6 +51,7 @@
 #include "SVTK_Selector.h"
 #include "SVTK_Selection.h"
 #include "SALOME_ListIO.hxx"
+#include "SALOMEDSClient_SObject.hxx"
 
 #include "utilities.h"
 
@@ -77,6 +78,8 @@
 
 using namespace std;
 
+enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action type
+
 //=================================================================================
 // class    : SMESHGUI_RotationDlg()
 // purpose  :
@@ -175,7 +178,7 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule, const char* nam
   // Controls for elements selection
   TextLabelElements  = new QLabel(GroupArguments, "TextLabelElements");
   TextLabelElements->setText(tr("SMESH_ID_ELEMENTS" ));
-  TextLabelElements->setFixedWidth(74);
+  //TextLabelElements->setFixedWidth(74);
   GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
 
   SelectElementsButton  = new QPushButton(GroupArguments, "SelectElementsButton");
@@ -184,14 +187,14 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule, const char* nam
   SelectElementsButton->setToggleButton(FALSE);
   GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
 
-  LineEditElements  = new QLineEdit(GroupArguments, "LineEditElements");
+  LineEditElements = new QLineEdit(GroupArguments, "LineEditElements");
   LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator"));
-  GroupArgumentsLayout->addWidget(LineEditElements, 0, 2);
+  GroupArgumentsLayout->addMultiCellWidget(LineEditElements, 0, 0, 2, 3);
 
   // Control for the whole mesh selection
   CheckBoxMesh = new QCheckBox(GroupArguments, "CheckBoxMesh");
   CheckBoxMesh->setText(tr("SMESH_SELECT_WHOLE_MESH" ));
-  GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 2);
+  GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 3);
 
   // Controls for axis defining
   GroupAxis = new QGroupBox(GroupArguments, "GroupAxis");
@@ -268,24 +271,31 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule, const char* nam
   SpinBox_DZ = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_DZ");
   GroupAxisLayout->addWidget(SpinBox_DZ, 1, 7);
 
-  GroupArgumentsLayout->addMultiCellWidget(GroupAxis, 2, 2, 0, 2);
+  GroupArgumentsLayout->addMultiCellWidget(GroupAxis, 2, 2, 0, 3);
 
   // Controls for angle defining
   TextLabelAngle = new QLabel(GroupArguments, "TextLabelAngle");
   TextLabelAngle->setText(tr("SMESH_ANGLE"));
-  GroupArgumentsLayout->addMultiCellWidget(TextLabelAngle, 3, 3, 0, 1);
+  GroupArgumentsLayout->addMultiCellWidget(TextLabelAngle, 3, 3, 0, 2);
 
   SpinBox_Angle = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Angle");
   GroupArgumentsLayout->addWidget(SpinBox_Angle, 3, 2);
 
-  // Controls for "Create a copy" option
-  CheckBoxCopy = new QCheckBox(GroupArguments, "CheckBoxCopy");
-  CheckBoxCopy->setText(tr("SMESH_CREATE_COPY"));
-  GroupArgumentsLayout->addMultiCellWidget(CheckBoxCopy, 4, 4, 0, 2);
+  // action switch
+  ActionGroup = new QButtonGroup(1, Qt::Horizontal, GroupArguments, "ActionGroup");
+  ActionGroup->setExclusive(true);
+  ActionGroup->insert(new QRadioButton(tr("SMESH_MOVE_ELEMENTS"),ActionGroup), MOVE_ELEMS_BUTTON);
+  ActionGroup->insert(new QRadioButton(tr("SMESH_COPY_ELEMENTS"),ActionGroup), COPY_ELEMS_BUTTON);
+  ActionGroup->insert(new QRadioButton(tr("SMESH_CREATE_MESH"  ),ActionGroup), MAKE_MESH_BUTTON);
+  GroupArgumentsLayout->addMultiCellWidget(ActionGroup, 4, 6, 0, 2);
 
   // CheckBox for groups generation
   MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
-  GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 5, 5, 0, 2);
+  GroupArgumentsLayout->addWidget(MakeGroupsCheck, 5, 3);
+
+  // Name of a mesh to create
+  LineEditNewMesh = new QLineEdit(GroupArguments, "LineEditNewMesh");
+  GroupArgumentsLayout->addWidget(LineEditNewMesh, 6, 3);
 
   SMESHGUI_RotationDlgLayout->addWidget(GroupArguments, 1, 0);
 
@@ -343,11 +353,13 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule, const char* nam
   connect(mySMESHGUI,       SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
   connect(LineEditElements, SIGNAL(textChanged(const QString&)),    SLOT(onTextChange(const QString&)));
   connect(CheckBoxMesh,     SIGNAL(toggled(bool)),                  SLOT(onSelectMesh(bool)));
-  connect(CheckBoxCopy,     SIGNAL(toggled(bool)),                  SLOT(onCopyChecked(bool)));
+  connect(ActionGroup,      SIGNAL(clicked(int)),                   SLOT(onActionClicked(int)));
 
   this->show(); /* displays Dialog */
 
   ConstructorsClicked(0);
+  //SelectionIntoArgument();
+  onActionClicked(MOVE_ELEMS_BUTTON);
   resize(0,0); // ??
 }
 
@@ -389,10 +401,11 @@ void SMESHGUI_RotationDlg::Init (bool ResetControls)
 
     SpinBox_Angle->SetValue(45);
 
-    CheckBoxCopy->setChecked(false);
+    ((QRadioButton*) ActionGroup->find( MOVE_ELEMS_BUTTON ))->setChecked(TRUE);
     CheckBoxMesh->setChecked(false);
-    MakeGroupsCheck->setChecked(false);
-    MakeGroupsCheck->setEnabled(false);
+//     MakeGroupsCheck->setChecked(false);
+//     MakeGroupsCheck->setEnabled(false);
+//    onSelectMesh(false);
   }
 
   onSelectMesh(CheckBoxMesh->isChecked());
@@ -434,24 +447,37 @@ void SMESHGUI_RotationDlg::ClickOnApply()
     anAxis.vz = SpinBox_DZ->GetValue();
 
     double anAngle = (SpinBox_Angle->GetValue())*PI/180;
-    bool toCreateCopy = CheckBoxCopy->isChecked();
-
+    int actionButton = ActionGroup->id( ActionGroup->selected() );
+    bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
     try {
       SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
       QApplication::setOverrideCursor(Qt::waitCursor);
-      if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
-        SMESH::ListOfGroups_var groups = 
-          aMeshEditor->RotateMakeGroups(anElementsId.inout(), anAxis, anAngle);
-      else
-        aMeshEditor->Rotate(anElementsId.inout(), anAxis, anAngle, toCreateCopy);
+      switch ( actionButton ) {
+      case MOVE_ELEMS_BUTTON:
+        aMeshEditor->Rotate(anElementsId, anAxis, anAngle, false);
+        break;
+      case COPY_ELEMS_BUTTON:
+        if ( makeGroups )
+          SMESH::ListOfGroups_var groups = 
+            aMeshEditor->RotateMakeGroups(anElementsId, anAxis, anAngle);
+        else
+          aMeshEditor->Rotate(anElementsId, anAxis, anAngle, true);
+        break;
+      case MAKE_MESH_BUTTON:
+        SMESH::SMESH_Mesh_var mesh = 
+          aMeshEditor->RotateMakeMesh(anElementsId, anAxis, anAngle, makeGroups,
+                                      LineEditNewMesh->text().latin1());
+      }
       QApplication::restoreOverrideCursor();
     } catch (...) {
     }
 
     SMESH::UpdateView();
-    if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
+    if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
+         actionButton == MAKE_MESH_BUTTON )
       mySMESHGUI->updateObjBrowser(true); // new groups may appear
     Init(false);
+    //ConstructorsClicked(GetConstructorId());
     SelectionIntoArgument();
   }
 }
@@ -610,7 +636,7 @@ void SMESHGUI_RotationDlg::SelectionIntoArgument()
       MakeGroupsCheck->setChecked(false);
       MakeGroupsCheck->setEnabled(false);
     }
-    else if (CheckBoxCopy->isChecked() ) {
+    else if ( ActionGroup->id( ActionGroup->selected() ) != MOVE_ELEMS_BUTTON ) {
       MakeGroupsCheck->setEnabled(true);
     }
     if (CheckBoxMesh->isChecked()) {
@@ -693,8 +719,10 @@ void SMESHGUI_RotationDlg::SelectionIntoArgument()
   }
 
   myBusy = true;
-  if (myEditCurrentArgument == (QWidget*)LineEditElements)
+  if (myEditCurrentArgument == (QWidget*)LineEditElements) {
     LineEditElements->setText(aString);
+    setNewMeshName();
+  }
   myBusy = false;
 
   // OK
@@ -875,17 +903,59 @@ void SMESHGUI_RotationDlg::onVectorChanged()
   }
 }
 
+
 //=======================================================================
-//function : onCopyChecked
-//purpose  : slot called when Copy checkBox is checked
+//function : onActionClicked
+//purpose  : slot called when an action type changed
 //=======================================================================
 
-void SMESHGUI_RotationDlg::onCopyChecked(bool isOn)
+void SMESHGUI_RotationDlg::onActionClicked(int button)
 {
-  // enable "MakeGroupsCheck"
-  if ( !myMesh->_is_nil() && myMesh->NbGroups() == 0)
-    isOn = false;
-  MakeGroupsCheck->setEnabled(isOn);
+  switch ( button ) {
+  case MOVE_ELEMS_BUTTON:
+    MakeGroupsCheck->setEnabled(false);
+    LineEditNewMesh->setEnabled(false);
+    break;
+  case COPY_ELEMS_BUTTON:
+    LineEditNewMesh->setEnabled(false);
+    MakeGroupsCheck->setText( tr("SMESH_MAKE_GROUPS"));
+    if ( myMesh->_is_nil() || myMesh->NbGroups() > 0)
+      MakeGroupsCheck->setEnabled(true);
+    else
+      MakeGroupsCheck->setEnabled(false);
+    break;
+  case MAKE_MESH_BUTTON:
+    LineEditNewMesh->setEnabled(true);
+    MakeGroupsCheck->setText( tr("SMESH_COPY_GROUPS"));
+    if ( myMesh->_is_nil() || myMesh->NbGroups() > 0)
+      MakeGroupsCheck->setEnabled(true);
+    else
+      MakeGroupsCheck->setEnabled(false);
+    break;
+  }
+  setNewMeshName();
+}
+
+//=======================================================================
+//function : setNewMeshName
+//purpose  : update contents of LineEditNewMesh
+//=======================================================================
+
+void SMESHGUI_RotationDlg::setNewMeshName()
+{
+  LineEditNewMesh->setText("");
+  if ( LineEditNewMesh->isEnabled() && !myMesh->_is_nil() ) {
+    QString name;
+    if ( CheckBoxMesh->isChecked() ) {
+      name = LineEditElements->text();
+    }
+    else {
+      _PTR(SObject) meshSO = SMESH::FindSObject( myMesh );
+      name = meshSO->GetName();
+    }
+    if ( !name.isEmpty() )
+      LineEditNewMesh->setText( SMESH::UniqueMeshName( name.latin1(), "rotated"));
+  }
 }
 
 //=================================================================================
index 05f1000c29b720c9a3c6db5885d043fd735c904a..51a5e141a87497532246ee2d8c2cb1077beda51b 100644 (file)
@@ -81,6 +81,7 @@ private:
     void hideEvent (QHideEvent*);                       /* ESC key */
     void keyPressEvent(QKeyEvent*);
     bool IsAxisOk();
+    void setNewMeshName();
 
     SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
     LightApp_SelectionMgr*        mySelectionMgr;          /* User shape selection */
@@ -128,8 +129,10 @@ private:
 
     QLabel* TextLabelAngle;
     SMESHGUI_SpinBox* SpinBox_Angle;
-    QCheckBox* CheckBoxCopy;
+    //QCheckBox* CheckBoxCopy;
+    QButtonGroup* ActionGroup;
     QCheckBox* MakeGroupsCheck;
+    QLineEdit* LineEditNewMesh;
 
     QString myHelpFileName;
 
@@ -147,7 +150,7 @@ private slots:
     void onTextChange (const QString&);
     void onSelectMesh (bool toSelectMesh);
     void onVectorChanged();
-    void onCopyChecked(bool isOn);
+    void onActionClicked(int button);
 
 protected:
     QGridLayout* SMESHGUI_RotationDlgLayout;
index 1896683090ae04ac464f4d014ec47dc918ce0cd9..0bf92e0d8e859e8c377ddeec98a8911fe4ef0257 100644 (file)
@@ -52,6 +52,7 @@
 #include "SVTK_Selector.h"
 #include "SVTK_Selection.h"
 #include "SALOME_ListIO.hxx"
+#include "SALOMEDSClient_SObject.hxx"
 
 #include "utilities.h"
 
 
 using namespace std;
 
+enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action type
+
 //=================================================================================
 // class    : SMESHGUI_SymmetryDlg()
 // purpose  :
 //=================================================================================
+
 SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule, const char* name,
                                             bool modal, WFlags fl)
      : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
@@ -182,8 +186,9 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule, const char* nam
   // Controls for elements selection
   TextLabelElements  = new QLabel(GroupArguments, "TextLabelElements");
   TextLabelElements->setText(tr("SMESH_ID_ELEMENTS" ));
-  TextLabelElements->setFixedWidth(74);
+  //TextLabelElements->setFixedWidth(74);
   GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0);
+  //GroupArgumentsLayout->addMultiCellWidget(TextLabelElements, 0, 0, 0, 1);
 
   SelectElementsButton  = new QPushButton(GroupArguments, "SelectElementsButton");
   SelectElementsButton->setText(tr("" ));
@@ -191,14 +196,15 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule, const char* nam
   SelectElementsButton->setToggleButton(FALSE);
   GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
 
-  LineEditElements  = new QLineEdit(GroupArguments, "LineEditElements");
+  LineEditElements = new QLineEdit(GroupArguments, "LineEditElements");
   LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator"));
-  GroupArgumentsLayout->addWidget(LineEditElements, 0, 2);
+  //GroupArgumentsLayout->addWidget(LineEditElements, 0, 3);
+  GroupArgumentsLayout->addMultiCellWidget(LineEditElements, 0, 0, 2, 4);
 
   // Control for the whole mesh selection
   CheckBoxMesh = new QCheckBox(GroupArguments, "CheckBoxMesh");
   CheckBoxMesh->setText(tr("SMESH_SELECT_WHOLE_MESH" ));
-  GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 2);
+  GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 4);
 
   // Controls for mirror selection
   GroupMirror = new QGroupBox(GroupArguments, "GroupMirror");
@@ -251,6 +257,7 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule, const char* nam
 
   TextLabelDX = new QLabel(GroupMirror, "TextLabelDX");
   TextLabelDX->setText(tr("SMESH_DX"));
+  TextLabelDX->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
   GroupMirrorLayout->addWidget(TextLabelDX, 1, 2);
 
   SpinBox_DX = new SMESHGUI_SpinBox(GroupMirror, "SpinBox_DX");
@@ -258,6 +265,7 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule, const char* nam
 
   TextLabelDY = new QLabel(GroupMirror, "TextLabelDY");
   TextLabelDY->setText(tr("SMESH_DY"));
+  TextLabelDY->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
   GroupMirrorLayout->addWidget(TextLabelDY, 1, 4);
 
   SpinBox_DY = new SMESHGUI_SpinBox(GroupMirror, "SpinBox_DY");
@@ -265,22 +273,30 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule, const char* nam
 
   TextLabelDZ = new QLabel(GroupMirror, "TextLabelDZ");
   TextLabelDZ->setText(tr("SMESH_DZ"));
+  TextLabelDZ->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
   GroupMirrorLayout->addWidget(TextLabelDZ, 1, 6);
 
   SpinBox_DZ = new SMESHGUI_SpinBox(GroupMirror, "SpinBox_DZ");
   GroupMirrorLayout->addWidget(SpinBox_DZ, 1, 7);
 
-  GroupArgumentsLayout->addMultiCellWidget(GroupMirror, 2, 2, 0, 2);
+  GroupArgumentsLayout->addMultiCellWidget(GroupMirror, 2, 2, 0, 4);
 
-  // Controls for "Create a copy" option
-  CheckBoxCopy = new QCheckBox(GroupArguments, "CheckBoxCopy");
-  CheckBoxCopy->setText(tr("SMESH_CREATE_COPY"));
-  GroupArgumentsLayout->addMultiCellWidget(CheckBoxCopy, 3, 3, 0, 2);
+  // switch of action type
+  ActionGroup = new QButtonGroup(1, Qt::Horizontal, GroupArguments, "ActionGroup");
+  ActionGroup->setExclusive(true);
+  ActionGroup->insert(new QRadioButton(tr("SMESH_MOVE_ELEMENTS"),ActionGroup), MOVE_ELEMS_BUTTON);
+  ActionGroup->insert(new QRadioButton(tr("SMESH_COPY_ELEMENTS"),ActionGroup), COPY_ELEMS_BUTTON);
+  ActionGroup->insert(new QRadioButton(tr("SMESH_CREATE_MESH"  ),ActionGroup), MAKE_MESH_BUTTON);
+  GroupArgumentsLayout->addMultiCellWidget(ActionGroup, 3, 5, 0, 3);
 
   // CheckBox for groups generation
   MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
   MakeGroupsCheck->setChecked(false);
-  GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 4, 4, 0, 2);
+  GroupArgumentsLayout->addWidget(MakeGroupsCheck, 4, 4);
+
+  // Name of a mesh to create
+  LineEditNewMesh = new QLineEdit(GroupArguments, "LineEditNewMesh");
+  GroupArgumentsLayout->addWidget(LineEditNewMesh, 5, 4);
 
   SMESHGUI_SymmetryDlgLayout->addWidget(GroupArguments, 1, 0);
 
@@ -335,12 +351,13 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule, const char* nam
   connect(mySMESHGUI,       SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
   connect(LineEditElements, SIGNAL(textChanged(const QString&)),   SLOT(onTextChange(const QString&)));
   connect(CheckBoxMesh,     SIGNAL(toggled(bool)),                 SLOT(onSelectMesh(bool)));
-  connect(CheckBoxCopy,     SIGNAL(toggled(bool)),                 SLOT(onCopyChecked(bool)));
+  connect(ActionGroup,      SIGNAL(clicked(int)),                   SLOT(onActionClicked(int)));
 
   this->show(); /* displays Dialog */
 
   ConstructorsClicked(0);
   SelectionIntoArgument();
+  onActionClicked(MOVE_ELEMS_BUTTON);
   resize(0,0); // ??
 }
 
@@ -380,10 +397,10 @@ void SMESHGUI_SymmetryDlg::Init (bool ResetControls)
     SpinBox_DY->SetValue(0.0);
     SpinBox_DZ->SetValue(0.0);
 
-    CheckBoxCopy->setChecked(false);
+    ((QRadioButton*) ActionGroup->find( MOVE_ELEMS_BUTTON ))->setChecked(TRUE);
     CheckBoxMesh->setChecked(false);
-    MakeGroupsCheck->setChecked(false);
-    MakeGroupsCheck->setEnabled(false);
+//     MakeGroupsCheck->setChecked(false);
+//     MakeGroupsCheck->setEnabled(false);
     onSelectMesh(false);
   }
 }
@@ -485,7 +502,6 @@ void SMESHGUI_SymmetryDlg::ClickOnApply()
       aMirror.vz = SpinBox_DZ->GetValue();
     }
 
-    bool toCreateCopy = CheckBoxCopy->isChecked();
 
     SMESH::SMESH_MeshEditor::MirrorType aMirrorType;
 
@@ -496,20 +512,35 @@ void SMESHGUI_SymmetryDlg::ClickOnApply()
     if (GetConstructorId() == 2)
       aMirrorType = SMESH::SMESH_MeshEditor::PLANE;
 
+    int actionButton = ActionGroup->id( ActionGroup->selected() );
+    bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
+
     try {
       SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
       QApplication::setOverrideCursor(Qt::waitCursor);
-      if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
-        SMESH::ListOfGroups_var groups = 
-          aMeshEditor->MirrorMakeGroups(anElementsId, aMirror, aMirrorType);
-      else
-        aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, toCreateCopy);
+      switch ( actionButton ) {
+      case MOVE_ELEMS_BUTTON:
+        aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, false );
+        break;
+      case COPY_ELEMS_BUTTON:
+        if ( makeGroups )
+          SMESH::ListOfGroups_var groups = 
+            aMeshEditor->MirrorMakeGroups(anElementsId, aMirror, aMirrorType);
+        else
+          aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, true);
+        break;
+      case MAKE_MESH_BUTTON:
+        SMESH::SMESH_Mesh_var mesh = 
+          aMeshEditor->MirrorMakeMesh(anElementsId, aMirror, aMirrorType, makeGroups,
+                                      LineEditNewMesh->text().latin1());
+      }
       QApplication::restoreOverrideCursor();
     } catch (...) {
     }
 
     SMESH::UpdateView();
-    if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
+    if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
+         actionButton == MAKE_MESH_BUTTON )
       mySMESHGUI->updateObjBrowser(true); // new groups may appear
     Init(false);
     ConstructorsClicked(GetConstructorId());
@@ -672,7 +703,7 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
       MakeGroupsCheck->setChecked(false);
       MakeGroupsCheck->setEnabled(false);
     }
-    else if (CheckBoxCopy->isChecked() ) {
+    else if ( ActionGroup->id( ActionGroup->selected() ) != MOVE_ELEMS_BUTTON ) {
       MakeGroupsCheck->setEnabled(true);
     }
     if (CheckBoxMesh->isChecked()) {
@@ -755,8 +786,10 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
   }
 
   myBusy = true;
-  if (myEditCurrentArgument == (QWidget*)LineEditElements)
+  if (myEditCurrentArgument == (QWidget*)LineEditElements) {
     LineEditElements->setText(aString);
+    setNewMeshName();
+  }
   myBusy = false;
 
   // OK
@@ -949,16 +982,57 @@ void SMESHGUI_SymmetryDlg::onVectorChanged()
 }
 
 //=======================================================================
-//function : onCopyChecked
-//purpose  : slot called when Copy checkBox is checked
+//function : onActionClicked
+//purpose  : slot called when an action type changed
 //=======================================================================
 
-void SMESHGUI_SymmetryDlg::onCopyChecked(bool isOn)
+void SMESHGUI_SymmetryDlg::onActionClicked(int button)
 {
-  // enable "MakeGroupsCheck"
-  if ( !myMesh->_is_nil() && myMesh->NbGroups() == 0)
-    isOn = false;
-  MakeGroupsCheck->setEnabled(isOn);
+  switch ( button ) {
+  case MOVE_ELEMS_BUTTON:
+    MakeGroupsCheck->setEnabled(false);
+    LineEditNewMesh->setEnabled(false);
+    break;
+  case COPY_ELEMS_BUTTON:
+    LineEditNewMesh->setEnabled(false);
+    MakeGroupsCheck->setText( tr("SMESH_MAKE_GROUPS"));
+    if ( myMesh->_is_nil() || myMesh->NbGroups() > 0)
+      MakeGroupsCheck->setEnabled(true);
+    else
+      MakeGroupsCheck->setEnabled(false);
+    break;
+  case MAKE_MESH_BUTTON:
+    LineEditNewMesh->setEnabled(true);
+    MakeGroupsCheck->setText( tr("SMESH_COPY_GROUPS"));
+    if ( myMesh->_is_nil() || myMesh->NbGroups() > 0)
+      MakeGroupsCheck->setEnabled(true);
+    else
+      MakeGroupsCheck->setEnabled(false);
+    break;
+  }
+  setNewMeshName();
+}
+
+//=======================================================================
+//function : setNewMeshName
+//purpose  : update contents of LineEditNewMesh
+//=======================================================================
+
+void SMESHGUI_SymmetryDlg::setNewMeshName()
+{
+  LineEditNewMesh->setText("");
+  if ( LineEditNewMesh->isEnabled() && !myMesh->_is_nil() ) {
+    QString name;
+    if ( CheckBoxMesh->isChecked() ) {
+      name = LineEditElements->text();
+    }
+    else {
+      _PTR(SObject) meshSO = SMESH::FindSObject( myMesh );
+      name = meshSO->GetName();
+    }
+    if ( !name.isEmpty() )
+      LineEditNewMesh->setText( SMESH::UniqueMeshName( name.latin1(), "mirrored"));
+  }
 }
 
 //=================================================================================
index 686e8a32995da3d305589f77b71fc3e07441f0cf..3f33ab4c10106c1c48ee96018a819395902ca0fd 100644 (file)
@@ -81,6 +81,7 @@ private:
     void keyPressEvent(QKeyEvent*);
     int GetConstructorId();
     bool IsMirrorOk();
+    void setNewMeshName();
 
     SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
     LightApp_SelectionMgr*        mySelectionMgr;          /* User shape selection */
@@ -128,8 +129,10 @@ private:
     QLabel* TextLabelDZ;
     SMESHGUI_SpinBox* SpinBox_DZ;
     
-    QCheckBox* CheckBoxCopy;
+    //QCheckBox* CheckBoxCopy;
+    QButtonGroup* ActionGroup;
     QCheckBox* MakeGroupsCheck;
+    QLineEdit* LineEditNewMesh;
 
     QString myHelpFileName;
    
@@ -147,7 +150,7 @@ private:
     void onTextChange(const QString&);
     void onSelectMesh(bool toSelectMesh);
     void onVectorChanged();
-    void onCopyChecked(bool isOn);
+    void onActionClicked(int button);
 
 protected:
     QGridLayout* SMESHGUI_SymmetryDlgLayout;
index eebadb3b42efe99f026dc0da0d9c6f9465ea1d32..56cae0c67daab7ecc450a73c12d7f526aeef25e2 100644 (file)
@@ -52,6 +52,7 @@
 #include "SVTK_ViewWindow.h"
 #include "SVTK_Selector.h"
 #include "SALOME_ListIO.hxx"
+#include "SALOMEDSClient_SObject.hxx"
 
 #include "utilities.h"
 
@@ -79,6 +80,8 @@
 
 using namespace std;
 
+enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action type
+
 //=================================================================================
 // class    : SMESHGUI_TranslationDlg()
 // purpose  :
@@ -181,7 +184,7 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule, const cha
   SelectElementsButton->setToggleButton(FALSE);
   GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
 
-  LineEditElements  = new QLineEdit(GroupArguments, "LineEditElements");
+  LineEditElements = new QLineEdit(GroupArguments, "LineEditElements");
   LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator"));
   GroupArgumentsLayout->addMultiCellWidget(LineEditElements, 0, 0, 2, 7);
 
@@ -256,14 +259,26 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule, const cha
   GroupArgumentsLayout->addWidget(SpinBox2_3, 3, 7);
 
   // Controls for "Create a copy" option
-  CheckBoxCopy = new QCheckBox(GroupArguments, "CheckBoxCopy");
-  CheckBoxCopy->setText(tr("SMESH_CREATE_COPY"));
-  GroupArgumentsLayout->addMultiCellWidget(CheckBoxCopy, 4, 4, 0, 2);
+//   CheckBoxCopy = new QCheckBox(GroupArguments, "CheckBoxCopy");
+//   CheckBoxCopy->setText(tr("SMESH_CREATE_COPY"));
+//   GroupArgumentsLayout->addMultiCellWidget(CheckBoxCopy, 4, 4, 0, 2);
+
+  // switch of action type
+  ActionGroup = new QButtonGroup(1, Qt::Horizontal, GroupArguments, "ActionGroup");
+  ActionGroup->setExclusive(true);
+  ActionGroup->insert(new QRadioButton(tr("SMESH_MOVE_ELEMENTS"),ActionGroup), MOVE_ELEMS_BUTTON);
+  ActionGroup->insert(new QRadioButton(tr("SMESH_COPY_ELEMENTS"),ActionGroup), COPY_ELEMS_BUTTON);
+  ActionGroup->insert(new QRadioButton(tr("SMESH_CREATE_MESH"  ),ActionGroup), MAKE_MESH_BUTTON);
+  GroupArgumentsLayout->addMultiCellWidget(ActionGroup, 4, 6, 0, 3);
 
   // CheckBox for groups generation
   MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
   MakeGroupsCheck->setChecked(false);
-  GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 5, 5, 0, 2);
+  GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 5, 5, 4, 7);
+
+  // Name of a mesh to create
+  LineEditNewMesh = new QLineEdit(GroupArguments, "LineEditNewMesh");
+  GroupArgumentsLayout->addMultiCellWidget(LineEditNewMesh, 6, 6, 4, 7);
 
   SMESHGUI_TranslationDlgLayout->addWidget(GroupArguments, 1, 0);
 
@@ -314,12 +329,13 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule, const cha
   connect(mySMESHGUI,       SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
   connect(LineEditElements, SIGNAL(textChanged(const QString&)),    SLOT(onTextChange(const QString&)));
   connect(CheckBoxMesh,     SIGNAL(toggled(bool)),                  SLOT(onSelectMesh(bool)));
-  connect(CheckBoxCopy,     SIGNAL(toggled(bool)),                  SLOT(onCopyChecked(bool)));
+  connect(ActionGroup,      SIGNAL(clicked(int)),                   SLOT(onActionClicked(int)));
 
   this->show(); /* displays Dialog */
 
   ConstructorsClicked(0);
   SelectionIntoArgument();
+  onActionClicked(MOVE_ELEMS_BUTTON);
   resize(0,0); // ??
 }
 
@@ -359,10 +375,10 @@ void SMESHGUI_TranslationDlg::Init (bool ResetControls)
     SpinBox2_2->SetValue(0.0);
     SpinBox2_3->SetValue(0.0);
 
-    CheckBoxCopy->setChecked(false);
+    ((QRadioButton*) ActionGroup->find( MOVE_ELEMS_BUTTON ))->setChecked(TRUE);
     CheckBoxMesh->setChecked(false);
-    MakeGroupsCheck->setChecked(false);
-    MakeGroupsCheck->setEnabled(false);
+//     MakeGroupsCheck->setChecked(false);
+//     MakeGroupsCheck->setEnabled(false);
     onSelectMesh(false);
   }
 }
@@ -459,22 +475,34 @@ void SMESHGUI_TranslationDlg::ClickOnApply()
       aVector.PS.z = SpinBox1_3->GetValue();
     }
 
-    bool toCreateCopy = CheckBoxCopy->isChecked();
-
+    int actionButton = ActionGroup->id( ActionGroup->selected() );
+    bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
     try {
       SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
       QApplication::setOverrideCursor(Qt::waitCursor);
-      if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
-        SMESH::ListOfGroups_var groups = 
-          aMeshEditor->TranslateMakeGroups(anElementsId.inout(), aVector);
-      else
-        aMeshEditor->Translate(anElementsId.inout(), aVector, toCreateCopy);
+      switch ( actionButton ) {
+      case MOVE_ELEMS_BUTTON:
+        aMeshEditor->Translate(anElementsId, aVector, false);
+        break;
+      case COPY_ELEMS_BUTTON:
+        if ( makeGroups )
+          SMESH::ListOfGroups_var groups = 
+            aMeshEditor->TranslateMakeGroups(anElementsId, aVector);
+        else
+          aMeshEditor->Translate(anElementsId, aVector, true);
+        break;
+      case MAKE_MESH_BUTTON:
+        SMESH::SMESH_Mesh_var mesh = 
+          aMeshEditor->TranslateMakeMesh(anElementsId, aVector, makeGroups,
+                                         LineEditNewMesh->text().latin1());
+      }
       QApplication::restoreOverrideCursor();
     } catch (...) {
     }
 
     SMESH::UpdateView();
-    if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
+    if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
+         actionButton == MAKE_MESH_BUTTON )
       mySMESHGUI->updateObjBrowser(true); // new groups may appear
     Init(false);
     ConstructorsClicked(GetConstructorId());
@@ -637,7 +665,7 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument()
       MakeGroupsCheck->setChecked(false);
       MakeGroupsCheck->setEnabled(false);
     }
-    else if (CheckBoxCopy->isChecked() ) {
+    else if ( ActionGroup->id( ActionGroup->selected() ) != MOVE_ELEMS_BUTTON ) {
       MakeGroupsCheck->setEnabled(true);
     }
 
@@ -721,8 +749,10 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument()
   }
 
   myBusy = true;
-  if (myEditCurrentArgument == (QWidget*)LineEditElements)
+  if (myEditCurrentArgument == (QWidget*)LineEditElements) {
     LineEditElements->setText(aString);
+    setNewMeshName();
+  }
   myBusy = false;
 
   // OK
@@ -875,16 +905,57 @@ void SMESHGUI_TranslationDlg::onSelectMesh (bool toSelectMesh)
 }
 
 //=======================================================================
-//function : onCopyChecked
-//purpose  : slot called when Copy checkBox is checked
+//function : onActionClicked
+//purpose  : slot called when an action type changed
+//=======================================================================
+
+void SMESHGUI_TranslationDlg::onActionClicked(int button)
+{
+  switch ( button ) {
+  case MOVE_ELEMS_BUTTON:
+    MakeGroupsCheck->setEnabled(false);
+    LineEditNewMesh->setEnabled(false);
+    break;
+  case COPY_ELEMS_BUTTON:
+    LineEditNewMesh->setEnabled(false);
+    MakeGroupsCheck->setText( tr("SMESH_MAKE_GROUPS"));
+    if ( myMesh->_is_nil() || myMesh->NbGroups() > 0)
+      MakeGroupsCheck->setEnabled(true);
+    else
+      MakeGroupsCheck->setEnabled(false);
+    break;
+  case MAKE_MESH_BUTTON:
+    LineEditNewMesh->setEnabled(true);
+    MakeGroupsCheck->setText( tr("SMESH_COPY_GROUPS"));
+    if ( myMesh->_is_nil() || myMesh->NbGroups() > 0)
+      MakeGroupsCheck->setEnabled(true);
+    else
+      MakeGroupsCheck->setEnabled(false);
+    break;
+  }
+  setNewMeshName();
+}
+
+//=======================================================================
+//function : setNewMeshName
+//purpose  : update contents of LineEditNewMesh
 //=======================================================================
 
-void SMESHGUI_TranslationDlg::onCopyChecked(bool isOn)
+void SMESHGUI_TranslationDlg::setNewMeshName()
 {
-  // enable "MakeGroupsCheck"
-  if ( !myMesh->_is_nil() && myMesh->NbGroups() == 0)
-    isOn = false;
-  MakeGroupsCheck->setEnabled(isOn);
+  LineEditNewMesh->setText("");
+  if ( LineEditNewMesh->isEnabled() && !myMesh->_is_nil() ) {
+    QString name;
+    if ( CheckBoxMesh->isChecked() ) {
+      name = LineEditElements->text();
+    }
+    else {
+      _PTR(SObject) meshSO = SMESH::FindSObject( myMesh );
+      name = meshSO->GetName();
+    }
+    if ( !name.isEmpty() )
+      LineEditNewMesh->setText( SMESH::UniqueMeshName( name.latin1(), "translated"));
+  }
 }
 
 //=================================================================================
index d0d627dbe9588763d305d890aec64453f5c48792..31ebe1b5c67f6283d040a4f75aceee886fa95ad2 100644 (file)
@@ -79,6 +79,7 @@ private:
     void hideEvent (QHideEvent*);                          /* ESC key */
     void keyPressEvent(QKeyEvent*);
     int GetConstructorId();
+    void setNewMeshName();
 
     SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
     LightApp_SelectionMgr*        mySelectionMgr;          /* User shape selection */
@@ -123,8 +124,10 @@ private:
     SMESHGUI_SpinBox* SpinBox2_2;
     QLabel* TextLabel2_3;
     SMESHGUI_SpinBox* SpinBox2_3;
-    QCheckBox* CheckBoxCopy;
+    //QCheckBox* CheckBoxCopy;
+    QButtonGroup* ActionGroup;
     QCheckBox* MakeGroupsCheck;
+    QLineEdit* LineEditNewMesh;
 
     QString myHelpFileName;
    
@@ -141,7 +144,7 @@ private:
     void ActivateThisDialog() ;
     void onTextChange(const QString&);
     void onSelectMesh(bool toSelectMesh);
-    void onCopyChecked(bool isOn);
+    void onActionClicked(int button);
     
 protected:
     QGridLayout* SMESHGUI_TranslationDlgLayout;
index 7c8d3197a2464831b156c2ea482f59c4da1744ff..c9f00811c2ba18111b6b757fcf8933d8c2a206c1 100644 (file)
@@ -2103,7 +2103,8 @@ SMESH_MeshEditor_i::mirror(const SMESH::long_array &           theIDsOfElements,
                            const SMESH::AxisStruct &           theAxis,
                            SMESH::SMESH_MeshEditor::MirrorType theMirrorType,
                            CORBA::Boolean                      theCopy,
-                           const bool                          theMakeGroups)
+                           const bool                          theMakeGroups,
+                           ::SMESH_Mesh*                       theTargetMesh)
 {
   initData();
 
@@ -2127,7 +2128,7 @@ SMESH_MeshEditor_i::mirror(const SMESH::long_array &           theIDsOfElements,
 
   ::SMESH_MeshEditor anEditor( myMesh );
   ::SMESH_MeshEditor::PGroupIDs groupIds =
-      anEditor.Transform (elements, aTrsf, theCopy, theMakeGroups);
+      anEditor.Transform (elements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
 
   if(theCopy) {
     storeResult(anEditor);
@@ -2216,6 +2217,71 @@ SMESH_MeshEditor_i::MirrorObjectMakeGroups(SMESH::SMESH_IDSource_ptr           t
   return mirror(anElementsId, theMirror, theMirrorType, true, true);
 }
 
+//=======================================================================
+//function : MirrorMakeMesh
+//purpose  : 
+//=======================================================================
+
+SMESH::SMESH_Mesh_ptr
+SMESH_MeshEditor_i::MirrorMakeMesh(const SMESH::long_array&            theIDsOfElements,
+                                   const SMESH::AxisStruct&            theMirror,
+                                   SMESH::SMESH_MeshEditor::MirrorType theMirrorType,
+                                   CORBA::Boolean                      theCopyGroups,
+                                   const char*                         theMeshName)
+{
+  TPythonDump pydump; // to prevent dump at mesh creation
+
+  SMESH::SMESH_Mesh_var mesh = makeMesh( theMeshName );
+  if ( SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh ))
+  {
+    mirror(theIDsOfElements, theMirror, theMirrorType,
+           false, theCopyGroups, & mesh_i->GetImpl());
+    mesh_i->CreateGroupServants();
+  }
+
+  if ( !myPreviewMode ) {
+    pydump << mesh << " = " << this << ".MirrorMakeMesh( "
+           << theIDsOfElements << ", "
+           << theMirror   << ", "
+           << mirrorTypeName(theMirrorType) << ", "
+           << theCopyGroups << ", '"
+           << theMeshName << "' )";
+  }
+  return mesh._retn();
+}
+
+//=======================================================================
+//function : MirrorObjectMakeMesh
+//purpose  : 
+//=======================================================================
+
+SMESH::SMESH_Mesh_ptr
+SMESH_MeshEditor_i::MirrorObjectMakeMesh(SMESH::SMESH_IDSource_ptr           theObject,
+                                         const SMESH::AxisStruct&            theMirror,
+                                         SMESH::SMESH_MeshEditor::MirrorType theMirrorType,
+                                         CORBA::Boolean                      theCopyGroups,
+                                         const char*                         theMeshName)
+{
+  TPythonDump pydump; // to prevent dump at mesh creation
+
+  SMESH::SMESH_Mesh_var mesh = makeMesh( theMeshName );
+  if ( SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh ))
+  {
+    SMESH::long_array_var anElementsId = theObject->GetIDs();
+    mirror(anElementsId, theMirror, theMirrorType,
+           false, theCopyGroups, & mesh_i->GetImpl());
+    mesh_i->CreateGroupServants();
+  }
+  if ( !myPreviewMode ) {
+    pydump << mesh << " = " << this << ".MirrorObjectMakeMesh( "
+           << theObject << ", "
+           << theMirror   << ", "
+           << mirrorTypeName(theMirrorType) << ", "
+           << theCopyGroups << ", '"
+           << theMeshName << "' )";
+  }
+  return mesh._retn();
+}
 
 //=======================================================================
 //function : translate
@@ -2226,7 +2292,8 @@ SMESH::ListOfGroups*
 SMESH_MeshEditor_i::translate(const SMESH::long_array & theIDsOfElements,
                               const SMESH::DirStruct &  theVector,
                               CORBA::Boolean            theCopy,
-                              const bool                theMakeGroups)
+                              const bool                theMakeGroups,
+                              ::SMESH_Mesh*             theTargetMesh)
 {
   initData();
 
@@ -2239,7 +2306,7 @@ SMESH_MeshEditor_i::translate(const SMESH::long_array & theIDsOfElements,
 
   ::SMESH_MeshEditor anEditor( myMesh );
   ::SMESH_MeshEditor::PGroupIDs groupIds =
-      anEditor.Transform (elements, aTrsf, theCopy, theMakeGroups);
+      anEditor.Transform (elements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
 
   if(theCopy)
     storeResult(anEditor);
@@ -2319,6 +2386,7 @@ SMESH_MeshEditor_i::TranslateObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObjec
                                               const SMESH::DirStruct&   theVector)
 {
   if ( !myPreviewMode ) {
+    TPythonDump() << "vector = " << theVector;
     TPythonDump() << this << ".TranslateObjectMakeGroups( "
                   << theObject
                   << ", vector )";
@@ -2327,6 +2395,65 @@ SMESH_MeshEditor_i::TranslateObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObjec
   return translate(anElementsId, theVector, true, true);
 }
 
+//=======================================================================
+//function : TranslateMakeMesh
+//purpose  : 
+//=======================================================================
+
+SMESH::SMESH_Mesh_ptr
+SMESH_MeshEditor_i::TranslateMakeMesh(const SMESH::long_array& theIDsOfElements,
+                                      const SMESH::DirStruct&  theVector,
+                                      CORBA::Boolean           theCopyGroups,
+                                      const char*              theMeshName)
+{
+  TPythonDump pydump; // to prevent dump at mesh creation
+  SMESH::SMESH_Mesh_var mesh = makeMesh( theMeshName );
+
+  if ( SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh )) {
+    translate(theIDsOfElements, theVector,
+              false, theCopyGroups, & mesh_i->GetImpl());
+    mesh_i->CreateGroupServants();
+  }
+  if ( !myPreviewMode ) {
+    pydump << mesh << " = " << this << ".TranslateMakeMesh( "
+           << theIDsOfElements << ", "
+           << theVector   << ", "
+           << theCopyGroups << ", '"
+           << theMeshName << "' )";
+  }
+  return mesh._retn();
+}
+
+//=======================================================================
+//function : TranslateObjectMakeMesh
+//purpose  : 
+//=======================================================================
+
+SMESH::SMESH_Mesh_ptr
+SMESH_MeshEditor_i::TranslateObjectMakeMesh(SMESH::SMESH_IDSource_ptr theObject,
+                                            const SMESH::DirStruct&   theVector,
+                                            CORBA::Boolean            theCopyGroups,
+                                            const char*               theMeshName)
+{
+  TPythonDump pydump; // to prevent dump at mesh creation
+  SMESH::SMESH_Mesh_var mesh = makeMesh( theMeshName );
+
+  if ( SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh )) {
+    SMESH::long_array_var anElementsId = theObject->GetIDs();
+    translate(anElementsId, theVector,
+              false, theCopyGroups, & mesh_i->GetImpl());
+    mesh_i->CreateGroupServants();
+  }
+  if ( !myPreviewMode ) {
+    pydump << mesh << " = " << this << ".TranslateObjectMakeMesh( "
+           << theObject << ", "
+           << theVector   << ", "
+           << theCopyGroups << ", '"
+           << theMeshName << "' )";
+  }
+  return mesh._retn();
+}
+
 //=======================================================================
 //function : rotate
 //purpose  : 
@@ -2337,7 +2464,8 @@ SMESH_MeshEditor_i::rotate(const SMESH::long_array & theIDsOfElements,
                            const SMESH::AxisStruct & theAxis,
                            CORBA::Double             theAngle,
                            CORBA::Boolean            theCopy,
-                           const bool                theMakeGroups)
+                           const bool                theMakeGroups,
+                           ::SMESH_Mesh*             theTargetMesh)
 {
   initData();
 
@@ -2352,7 +2480,7 @@ SMESH_MeshEditor_i::rotate(const SMESH::long_array & theIDsOfElements,
 
   ::SMESH_MeshEditor anEditor( myMesh );
   ::SMESH_MeshEditor::PGroupIDs groupIds =
-      anEditor.Transform (elements, aTrsf, theCopy, theMakeGroups);
+      anEditor.Transform (elements, aTrsf, theCopy, theMakeGroups, theTargetMesh);
 
   if(theCopy) {
     storeResult(anEditor);
@@ -2452,6 +2580,69 @@ SMESH_MeshEditor_i::RotateObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
   return rotate(anElementsId,theAxis,theAngle,true,true);
 }
 
+//=======================================================================
+//function : RotateMakeMesh
+//purpose  : 
+//=======================================================================
+
+SMESH::SMESH_Mesh_ptr 
+SMESH_MeshEditor_i::RotateMakeMesh(const SMESH::long_array& theIDsOfElements,
+                                   const SMESH::AxisStruct& theAxis,
+                                   CORBA::Double            theAngleInRadians,
+                                   CORBA::Boolean           theCopyGroups,
+                                   const char*              theMeshName)
+{
+  TPythonDump pydump; // to prevent dump at mesh creation
+  SMESH::SMESH_Mesh_var mesh = makeMesh( theMeshName );
+
+  if ( SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh )) {
+    rotate(theIDsOfElements, theAxis, theAngleInRadians,
+           false, theCopyGroups, & mesh_i->GetImpl());
+    mesh_i->CreateGroupServants();
+  }
+  if ( !myPreviewMode ) {
+    pydump << mesh << " = " << this << ".RotateMakeMesh( "
+           << theIDsOfElements << ", "
+           << theAxis << ", "
+           << theAngleInRadians   << ", "
+           << theCopyGroups << ", '"
+           << theMeshName << "' )";
+  }
+  return mesh._retn();
+}
+
+//=======================================================================
+//function : RotateObjectMakeMesh
+//purpose  : 
+//=======================================================================
+
+SMESH::SMESH_Mesh_ptr 
+SMESH_MeshEditor_i::RotateObjectMakeMesh(SMESH::SMESH_IDSource_ptr theObject,
+                                         const SMESH::AxisStruct&  theAxis,
+                                         CORBA::Double             theAngleInRadians,
+                                         CORBA::Boolean            theCopyGroups,
+                                         const char*               theMeshName)
+{
+  TPythonDump pydump; // to prevent dump at mesh creation
+  SMESH::SMESH_Mesh_var mesh = makeMesh( theMeshName );
+
+  if ( SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh )) {
+    SMESH::long_array_var anElementsId = theObject->GetIDs();
+    rotate(anElementsId, theAxis, theAngleInRadians,
+           false, theCopyGroups, & mesh_i->GetImpl());
+    mesh_i->CreateGroupServants();
+  }
+  if ( !myPreviewMode ) {
+    pydump << mesh << " = " << this << ".RotateObjectMakeMesh( "
+           << theObject << ", "
+           << theAxis << ", "
+           << theAngleInRadians   << ", "
+           << theCopyGroups << ", '"
+           << theMeshName << "' )";
+  }
+  return mesh._retn();
+}
+
 //=======================================================================
 //function : FindCoincidentNodes
 //purpose  :
@@ -3191,3 +3382,24 @@ CORBA::Boolean SMESH_MeshEditor_i::ConvertFromQuadratic()
   TPythonDump() << this << ".ConvertFromQuadratic()";
   return isDone;
 }
+
+//=======================================================================
+//function : makeMesh
+//purpose  : create a named imported mesh 
+//=======================================================================
+
+SMESH::SMESH_Mesh_ptr SMESH_MeshEditor_i::makeMesh(const char* theMeshName)
+{
+  SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen();
+  SMESH::SMESH_Mesh_var mesh = gen->CreateEmptyMesh();
+  SALOMEDS::Study_var study = gen->GetCurrentStudy();
+  SALOMEDS::SObject_var meshSO = gen->ObjectToSObject( study, mesh );
+  gen->SetName( meshSO, theMeshName, "Mesh" );
+
+  SALOMEDS::StudyBuilder_var builder = study->NewBuilder();
+  SALOMEDS::GenericAttribute_var anAttr
+    = builder->FindOrCreateAttribute( meshSO, "AttributePixMap" );
+  SALOMEDS::AttributePixMap::_narrow( anAttr )->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" );
+
+  return mesh._retn();
+}
index b3b3811092e781667ae7ccb2ffdb93aadc697b42..85d7b6cfdf6d2de7182ffc550aa5327dfc01c062 100644 (file)
@@ -311,6 +311,35 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
                                               const SMESH::AxisStruct&  Axis,
                                               CORBA::Double             AngleInRadians);
 
+  SMESH::SMESH_Mesh_ptr MirrorMakeMesh(const SMESH::long_array&            IDsOfElements,
+                                       const SMESH::AxisStruct&            Mirror,
+                                       SMESH::SMESH_MeshEditor::MirrorType MirrorType,
+                                       CORBA::Boolean                      CopyGroups,
+                                       const char*                         MeshName);
+  SMESH::SMESH_Mesh_ptr MirrorObjectMakeMesh(SMESH::SMESH_IDSource_ptr           Object,
+                                             const SMESH::AxisStruct&            Mirror,
+                                             SMESH::SMESH_MeshEditor::MirrorType MirrorType,
+                                             CORBA::Boolean                      CopyGroups,
+                                             const char*                         MeshName);
+  SMESH::SMESH_Mesh_ptr TranslateMakeMesh(const SMESH::long_array& IDsOfElements,
+                                          const SMESH::DirStruct&  Vector,
+                                          CORBA::Boolean           CopyGroups,
+                                          const char*              MeshName);
+  SMESH::SMESH_Mesh_ptr TranslateObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
+                                                const SMESH::DirStruct&   Vector,
+                                                CORBA::Boolean            CopyGroups,
+                                                const char*               MeshName);
+  SMESH::SMESH_Mesh_ptr RotateMakeMesh(const SMESH::long_array& IDsOfElements,
+                                       const SMESH::AxisStruct& Axis,
+                                       CORBA::Double            AngleInRadians,
+                                       CORBA::Boolean           CopyGroups,
+                                       const char*              MeshName);
+  SMESH::SMESH_Mesh_ptr RotateObjectMakeMesh(SMESH::SMESH_IDSource_ptr Object,
+                                             const SMESH::AxisStruct&  Axis,
+                                             CORBA::Double             AngleInRadians,
+                                             CORBA::Boolean            CopyGroups,
+                                             const char*               MeshName);
+
   void FindCoincidentNodes (CORBA::Double                  Tolerance,
                             SMESH::array_of_long_array_out GroupsOfNodes);
   void FindCoincidentNodesOnPart(SMESH::SMESH_IDSource_ptr      Object,
@@ -442,16 +471,21 @@ private: //!< private methods
                               const SMESH::AxisStruct &           Axis,
                               SMESH::SMESH_MeshEditor::MirrorType MirrorType,
                               CORBA::Boolean                      Copy,
-                              const bool                          MakeGroups);
+                              const bool                          MakeGroups,
+                              ::SMESH_Mesh*                       TargetMesh=0);
   SMESH::ListOfGroups* translate(const SMESH::long_array & IDsOfElements,
                                  const SMESH::DirStruct &  Vector,
                                  CORBA::Boolean            Copy,
-                                 const bool                MakeGroups);
+                                 const bool                MakeGroups,
+                                 ::SMESH_Mesh*             TargetMesh=0);
   SMESH::ListOfGroups* rotate(const SMESH::long_array & IDsOfElements,
                               const SMESH::AxisStruct &  Axis,
                               CORBA::Double             Angle,
                               CORBA::Boolean            Copy,
-                              const bool                MakeGroups);
+                              const bool                MakeGroups,
+                              ::SMESH_Mesh*             TargetMesh=0);
+
+  SMESH::SMESH_Mesh_ptr makeMesh(const char* theMeshName);
 
 private: //!< fields