]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
NPAL14167: Keep the parameters of the object after a transformation.
authorjfa <jfa@opencascade.com>
Wed, 2 Apr 2008 11:07:08 +0000 (11:07 +0000)
committerjfa <jfa@opencascade.com>
Wed, 2 Apr 2008 11:07:08 +0000 (11:07 +0000)
30 files changed:
idl/GEOM_Gen.idl
src/BooleanGUI/BooleanGUI_Dialog.cxx
src/BooleanGUI/BooleanGUI_Dialog.h
src/BuildGUI/BuildGUI_CompoundDlg.cxx
src/BuildGUI/BuildGUI_CompoundDlg.h
src/DlgRef/DlgRef_Skeleton_QTD.cxx
src/DlgRef/DlgRef_Skeleton_QTD.h
src/DlgRef/UIFiles/DlgRef_Skeleton_QTD.ui
src/GEOMBase/GEOMBase_Helper.cxx
src/GEOMBase/GEOMBase_Helper.h
src/GEOMBase/GEOMBase_Skeleton.cxx
src/GEOMGUI/GEOM_msg_en.po
src/GEOMImpl/GEOMImpl_IShapesOperations.cxx
src/GEOM_I/GEOM_Gen_i.cc
src/GEOM_I/GEOM_Gen_i.hh
src/GEOM_SWIG/geompyDC.py
src/OperationGUI/OperationGUI_PartitionDlg.cxx
src/OperationGUI/OperationGUI_PartitionDlg.h
src/TransformationGUI/TransformationGUI_MirrorDlg.cxx
src/TransformationGUI/TransformationGUI_MirrorDlg.h
src/TransformationGUI/TransformationGUI_OffsetDlg.cxx
src/TransformationGUI/TransformationGUI_OffsetDlg.h
src/TransformationGUI/TransformationGUI_PositionDlg.cxx
src/TransformationGUI/TransformationGUI_PositionDlg.h
src/TransformationGUI/TransformationGUI_RotationDlg.cxx
src/TransformationGUI/TransformationGUI_RotationDlg.h
src/TransformationGUI/TransformationGUI_ScaleDlg.cxx
src/TransformationGUI/TransformationGUI_ScaleDlg.h
src/TransformationGUI/TransformationGUI_TranslationDlg.cxx
src/TransformationGUI/TransformationGUI_TranslationDlg.h

index 82d6094b628706d0dca9b80c4896fa6d9e2696c5..a01948267d69fcb35b0277f2a815c6938efc5ec2 100644 (file)
@@ -2639,7 +2639,7 @@ module GEOM
     void Redo (in long theStudyID);
 
     /*!
-     * Publishing manangement
+     * Publishing management
      * Adds in theStudy a object theObject under with a name theName,
      * if theFather is not NULL the object is placed under thFather's SObject.
      * Returns a SObject where theObject is placed
@@ -2649,6 +2649,44 @@ module GEOM
                                  in string theName,
                                  in GEOM_Object theFather);
 
+    /*!
+     *  Publish sub-shapes, standing for arguments and sub-shapes of arguments
+     *  To be used from python scripts out of geompy.addToStudy (non-default usage)
+     *  \param theStudy  the study, in which theObject is published already,
+     *                   and in which the arguments will be published
+     *  \param theObject published GEOM object, arguments of which will be published
+     *  \param theArgs   list of GEOM_Object, operation arguments to be published.
+     *                   If this list is empty, all operation arguments will be published
+     *  \param isTrsf    If True, search sub-shapes by indices, as in case of
+     *                   transformation they cannot be found by GetInPlace.
+     *                   The argument itself is not published in this case,
+     *                   because the whole shape corresponds to the argument.
+     *  \return True in case of success, False otherwise.
+     */
+    boolean RestoreSubShapesO (in SALOMEDS::Study   theStudy,
+                              in GEOM_Object       theObject,
+                              in ListOfGO          theArgs,
+                              in boolean           isTrsf);
+
+    /*!
+     *  Publish sub-shapes, standing for arguments and sub-shapes of arguments
+     *  To be used from GUI and from geompy.addToStudy
+     *  \param theStudy   the study, in which theObject is published already,
+     *                    and in which the arguments will be published
+     *  \param theSObject study object, referencing GEOM object, arguments of which will be published
+     *  \param theArgs    list of GEOM_Object, operation arguments to be published.
+     *                    If this list is empty, all operation arguments will be published
+     *  \param isTrsf    If True, search sub-shapes by indices, as in case of
+     *                   transformation they cannot be found by GetInPlace.
+     *                   The argument itself is not published in this case,
+     *                   because the whole shape corresponds to the argument.
+     *  \return True in case of success, False otherwise.
+     */
+    boolean RestoreSubShapesSO (in SALOMEDS::Study   theStudy,
+                               in SALOMEDS::SObject theSObject,
+                               in ListOfGO          theArgs,
+                               in boolean           isTrsf);
+
     /*!
      *  Methods to access interfaces for objects creation and transformation
      */
index 39826043a23424f004dcdc5446a2f802130d15a6..b611f35d4e8b2e869d3950ae6e45cb2bf94577e5 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
@@ -35,6 +35,7 @@
 #include "LightApp_SelectionMgr.h"
 
 #include <qlabel.h>
+#include <qcheckbox.h>
 
 using namespace std;
 
@@ -130,6 +131,8 @@ BooleanGUI_Dialog::~BooleanGUI_Dialog()
 //=================================================================================
 void BooleanGUI_Dialog::Init()
 {
+  GroupBoxPublish->show();
+
   /* init variables */
   myEditCurrentArgument = myGroup->LineEdit1;
 
@@ -306,3 +309,16 @@ bool BooleanGUI_Dialog::execute( ObjectList& objects )
 
   return true;
 }
+
+//=================================================================================
+// function : restoreSubShapes
+// purpose  :
+//=================================================================================
+void BooleanGUI_Dialog::restoreSubShapes (SALOMEDS::Study_ptr   theStudy,
+                                          SALOMEDS::SObject_ptr theSObject)
+{
+  if (CheckBoxRestoreSS->isChecked()) {
+    // empty list of arguments means that all arguments should be restored
+    getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(), /*isTrsf=*/false);
+  }
+}
index e42fd2be241e4d639237eecd985ab312b38dc9e0..65bf4d8808325984c31253ebd4a861d313ddecdf 100644 (file)
@@ -52,6 +52,7 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
+    virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
 
 private:
     int myOperation;
index 4ea4ca69650137b7f65533e40deb865920884a00..8daea75f410f1e099a014e768cab52fc37375ec6 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
@@ -34,6 +34,7 @@
 #include "LightApp_SelectionMgr.h"
 
 #include <qlabel.h>
+#include <qcheckbox.h>
 
 //=================================================================================
 // class    : BuildGUI_CompoundDlg()
@@ -96,6 +97,8 @@ void BuildGUI_CompoundDlg::Init()
   
   myOkShapes = false;
 
+  GroupBoxPublish->show();
+
   /* signals and slots connections */
   connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
   connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
@@ -229,3 +232,16 @@ bool BuildGUI_CompoundDlg::execute( ObjectList& objects )
 
   return true;
 }
+
+//=================================================================================
+// function : restoreSubShapes
+// purpose  :
+//=================================================================================
+void BuildGUI_CompoundDlg::restoreSubShapes (SALOMEDS::Study_ptr   theStudy,
+                                             SALOMEDS::SObject_ptr theSObject)
+{
+  if (CheckBoxRestoreSS->isChecked()) {
+    // empty list of arguments means that all arguments should be restored
+    getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(), /*isTrsf=*/false);
+  }
+}
index 31182622c2d74fb2e1de4115601113a91e1d366a..0d93fda82db74405487c789a1a1181e13c633fcb 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
@@ -51,6 +51,7 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& msg );
     virtual bool execute( ObjectList& objects );
+    virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
 
 private:
     void Init();
index c1ee25cebc8ee61b5745cf96be2331d4a5ed16cd..9ff558c8caf19d0e46b5efbd26b34e001808e392 100644 (file)
@@ -1,7 +1,7 @@
 /****************************************************************************
 ** Form implementation generated from reading ui file 'DlgRef_Skeleton_QTD.ui'
 **
-** Created: Wed Feb 13 17:37:30 2008
+** Created: Wed Mar 26 12:14:14 2008
 **      by: The User Interface Compiler ($Id$)
 **
 ** WARNING! All changes made in this file will be lost!
 
 #include <qvariant.h>
 #include <qpushbutton.h>
-#include <qgroupbox.h>
 #include <qbuttongroup.h>
 #include <qradiobutton.h>
-#include <qlineedit.h>
+#include <qgroupbox.h>
 #include <qlabel.h>
+#include <qlineedit.h>
+#include <qcheckbox.h>
 #include <qlayout.h>
 #include <qtooltip.h>
 #include <qwhatsthis.h>
@@ -38,37 +39,6 @@ DlgRef_Skeleton_QTD::DlgRef_Skeleton_QTD( QWidget* parent, const char* name, boo
 
     Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); 
 
-    GroupButtons = new QGroupBox( this, "GroupButtons" );
-    GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) );
-    GroupButtons->setColumnLayout(0, Qt::Vertical );
-    GroupButtons->layout()->setSpacing( 6 );
-    GroupButtons->layout()->setMargin( 11 );
-    GroupButtonsLayout = new QVBoxLayout( GroupButtons->layout() );
-    GroupButtonsLayout->setAlignment( Qt::AlignTop );
-
-    layout3 = new QGridLayout( 0, 1, 1, 0, 6, "layout3"); 
-    Spacer1 = new QSpacerItem( 90, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
-    layout3->addItem( Spacer1, 0, 3 );
-
-    buttonOk = new QPushButton( GroupButtons, "buttonOk" );
-
-    layout3->addWidget( buttonOk, 0, 2 );
-
-    buttonApply = new QPushButton( GroupButtons, "buttonApply" );
-
-    layout3->addWidget( buttonApply, 0, 0 );
-
-    buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
-
-    layout3->addWidget( buttonCancel, 0, 1 );
-
-    buttonHelp = new QPushButton( GroupButtons, "buttonHelp" );
-
-    layout3->addWidget( buttonHelp, 0, 4 );
-    GroupButtonsLayout->addLayout( layout3 );
-
-    Layout1->addWidget( GroupButtons, 3, 0 );
-
     GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
     GroupConstructors->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth() ) );
     GroupConstructors->setColumnLayout(0, Qt::Vertical );
@@ -101,20 +71,68 @@ DlgRef_Skeleton_QTD::DlgRef_Skeleton_QTD( QWidget* parent, const char* name, boo
     GroupBoxNameLayout = new QGridLayout( GroupBoxName->layout() );
     GroupBoxNameLayout->setAlignment( Qt::AlignTop );
 
-    Layout66 = new QGridLayout( 0, 1, 1, 0, 6, "Layout66"); 
+    Layout4 = new QGridLayout( 0, 1, 1, 0, 6, "Layout4"); 
 
-    ResultName = new QLineEdit( GroupBoxName, "ResultName" );
+    NameLabel = new QLabel( GroupBoxName, "NameLabel" );
 
-    Layout66->addWidget( ResultName, 0, 1 );
+    Layout4->addWidget( NameLabel, 0, 0 );
 
-    NameLabel = new QLabel( GroupBoxName, "NameLabel" );
+    ResultName = new QLineEdit( GroupBoxName, "ResultName" );
 
-    Layout66->addWidget( NameLabel, 0, 0 );
+    Layout4->addWidget( ResultName, 0, 1 );
 
-    GroupBoxNameLayout->addLayout( Layout66, 0, 0 );
+    GroupBoxNameLayout->addLayout( Layout4, 0, 0 );
 
     Layout1->addWidget( GroupBoxName, 1, 0 );
 
+    GroupBoxPublish = new QGroupBox( this, "GroupBoxPublish" );
+    GroupBoxPublish->setColumnLayout(0, Qt::Vertical );
+    GroupBoxPublish->layout()->setSpacing( 6 );
+    GroupBoxPublish->layout()->setMargin( 11 );
+    GroupBoxPublishLayout = new QGridLayout( GroupBoxPublish->layout() );
+    GroupBoxPublishLayout->setAlignment( Qt::AlignTop );
+
+    Layout5 = new QGridLayout( 0, 1, 1, 0, 6, "Layout5"); 
+
+    CheckBoxRestoreSS = new QCheckBox( GroupBoxPublish, "CheckBoxRestoreSS" );
+
+    Layout5->addWidget( CheckBoxRestoreSS, 0, 0 );
+
+    GroupBoxPublishLayout->addLayout( Layout5, 0, 0 );
+
+    Layout1->addWidget( GroupBoxPublish, 3, 0 );
+
+    GroupButtons = new QGroupBox( this, "GroupButtons" );
+    GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) );
+    GroupButtons->setColumnLayout(0, Qt::Vertical );
+    GroupButtons->layout()->setSpacing( 6 );
+    GroupButtons->layout()->setMargin( 11 );
+    GroupButtonsLayout = new QVBoxLayout( GroupButtons->layout() );
+    GroupButtonsLayout->setAlignment( Qt::AlignTop );
+
+    Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); 
+
+    buttonApply = new QPushButton( GroupButtons, "buttonApply" );
+
+    Layout3->addWidget( buttonApply, 0, 0 );
+
+    buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
+
+    Layout3->addWidget( buttonCancel, 0, 1 );
+
+    buttonOk = new QPushButton( GroupButtons, "buttonOk" );
+
+    Layout3->addWidget( buttonOk, 0, 2 );
+    Spacer1 = new QSpacerItem( 90, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+    Layout3->addItem( Spacer1, 0, 3 );
+
+    buttonHelp = new QPushButton( GroupButtons, "buttonHelp" );
+
+    Layout3->addWidget( buttonHelp, 0, 4 );
+    GroupButtonsLayout->addLayout( Layout3 );
+
+    Layout1->addWidget( GroupButtons, 4, 0 );
+
     DlgRef_Skeleton_QTDLayout->addLayout( Layout1, 0, 0 );
     languageChange();
     resize( QSize(615, 682).expandedTo(minimumSizeHint()) );
@@ -135,17 +153,5 @@ DlgRef_Skeleton_QTD::~DlgRef_Skeleton_QTD()
  */
 void DlgRef_Skeleton_QTD::languageChange()
 {
-    setCaption( tr( "DlgRef_Skeleton_QTD" ) );
-    GroupButtons->setTitle( QString::null );
-    buttonOk->setText( QString::null );
-    buttonApply->setText( QString::null );
-    buttonCancel->setText( QString::null );
-    buttonHelp->setText( QString::null );
-    GroupConstructors->setTitle( QString::null );
-    RadioButton1->setText( QString::null );
-    RadioButton2->setText( QString::null );
-    RadioButton3->setText( QString::null );
-    RadioButton4->setText( QString::null );
-    GroupBoxName->setTitle( QString::null );
 }
 
index 2afaefc84a7e6cd0b6c75c8458139b7904cc6630..f197e914c45fce8236c211d4d541c8ec3392e3b3 100644 (file)
@@ -1,7 +1,7 @@
 /****************************************************************************
 ** Form interface generated from reading ui file 'DlgRef_Skeleton_QTD.ui'
 **
-** Created: Wed Feb 13 17:37:30 2008
+** Created: Wed Mar 26 12:14:12 2008
 **      by: The User Interface Compiler ($Id$)
 **
 ** WARNING! All changes made in this file will be lost!
@@ -17,12 +17,13 @@ class QVBoxLayout;
 class QHBoxLayout;
 class QGridLayout;
 class QSpacerItem;
-class QGroupBox;
-class QPushButton;
 class QButtonGroup;
 class QRadioButton;
-class QLineEdit;
+class QGroupBox;
 class QLabel;
+class QLineEdit;
+class QCheckBox;
+class QPushButton;
 
 class DlgRef_Skeleton_QTD : public QDialog
 {
@@ -32,30 +33,34 @@ public:
     DlgRef_Skeleton_QTD( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
     ~DlgRef_Skeleton_QTD();
 
-    QGroupBox* GroupButtons;
-    QPushButton* buttonOk;
-    QPushButton* buttonApply;
-    QPushButton* buttonCancel;
-    QPushButton* buttonHelp;
     QButtonGroup* GroupConstructors;
     QRadioButton* RadioButton1;
     QRadioButton* RadioButton2;
     QRadioButton* RadioButton3;
     QRadioButton* RadioButton4;
     QGroupBox* GroupBoxName;
-    QLineEdit* ResultName;
     QLabel* NameLabel;
+    QLineEdit* ResultName;
+    QGroupBox* GroupBoxPublish;
+    QCheckBox* CheckBoxRestoreSS;
+    QGroupBox* GroupButtons;
+    QPushButton* buttonApply;
+    QPushButton* buttonCancel;
+    QPushButton* buttonOk;
+    QPushButton* buttonHelp;
 
 protected:
     QGridLayout* DlgRef_Skeleton_QTDLayout;
     QGridLayout* Layout1;
-    QVBoxLayout* GroupButtonsLayout;
-    QGridLayout* layout3;
-    QSpacerItem* Spacer1;
     QHBoxLayout* GroupConstructorsLayout;
     QHBoxLayout* Layout2;
     QGridLayout* GroupBoxNameLayout;
-    QGridLayout* Layout66;
+    QGridLayout* Layout4;
+    QGridLayout* GroupBoxPublishLayout;
+    QGridLayout* Layout5;
+    QVBoxLayout* GroupButtonsLayout;
+    QGridLayout* Layout3;
+    QSpacerItem* Spacer1;
 
 protected slots:
     virtual void languageChange();
index 99a216a36733f2810163e10a520fcde6cac246b6..4e6826996ea4a2a359a5e805c10ae96ac948e505 100644 (file)
@@ -20,9 +20,6 @@
             <verstretch>0</verstretch>
         </sizepolicy>
     </property>
-    <property name="caption">
-        <string>DlgRef_Skeleton_QTD</string>
-    </property>
     <property name="sizeGripEnabled">
         <bool>true</bool>
     </property>
                 <property name="spacing">
                     <number>6</number>
                 </property>
-                <widget class="QGroupBox" row="3" column="0">
+                <widget class="QButtonGroup" row="0" column="0">
                     <property name="name">
-                        <cstring>GroupButtons</cstring>
+                        <cstring>GroupConstructors</cstring>
                     </property>
                     <property name="sizePolicy">
                         <sizepolicy>
-                            <hsizetype>7</hsizetype>
+                            <hsizetype>5</hsizetype>
                             <vsizetype>0</vsizetype>
                             <horstretch>0</horstretch>
                             <verstretch>0</verstretch>
                         </sizepolicy>
                     </property>
-                    <property name="title">
-                        <string></string>
-                    </property>
-                    <vbox>
+                    <hbox>
                         <property name="name">
                             <cstring>unnamed</cstring>
                         </property>
                         </property>
                         <widget class="QLayoutWidget">
                             <property name="name">
-                                <cstring>layout3</cstring>
+                                <cstring>Layout2</cstring>
                             </property>
-                            <grid>
+                            <hbox>
                                 <property name="name">
                                     <cstring>unnamed</cstring>
                                 </property>
-                                <spacer row="0" column="3">
-                                    <property name="name">
-                                        <cstring>Spacer1</cstring>
-                                    </property>
-                                    <property name="orientation">
-                                        <enum>Horizontal</enum>
-                                    </property>
-                                    <property name="sizeType">
-                                        <enum>Expanding</enum>
-                                    </property>
-                                    <property name="sizeHint">
-                                        <size>
-                                            <width>90</width>
-                                            <height>20</height>
-                                        </size>
-                                    </property>
-                                </spacer>
-                                <widget class="QPushButton" row="0" column="2">
+                                <property name="margin">
+                                    <number>0</number>
+                                </property>
+                                <property name="spacing">
+                                    <number>6</number>
+                                </property>
+                                <widget class="QRadioButton">
                                     <property name="name">
-                                        <cstring>buttonOk</cstring>
-                                    </property>
-                                    <property name="text">
-                                        <string></string>
+                                        <cstring>RadioButton1</cstring>
                                     </property>
                                 </widget>
-                                <widget class="QPushButton" row="0" column="0">
+                                <widget class="QRadioButton">
                                     <property name="name">
-                                        <cstring>buttonApply</cstring>
-                                    </property>
-                                    <property name="text">
-                                        <string></string>
+                                        <cstring>RadioButton2</cstring>
                                     </property>
                                 </widget>
-                                <widget class="QPushButton" row="0" column="1">
+                                <widget class="QRadioButton">
                                     <property name="name">
-                                        <cstring>buttonCancel</cstring>
-                                    </property>
-                                    <property name="text">
-                                        <string></string>
+                                        <cstring>RadioButton3</cstring>
                                     </property>
                                 </widget>
-                                <widget class="QPushButton" row="0" column="4">
+                                <widget class="QRadioButton">
                                     <property name="name">
-                                        <cstring>buttonHelp</cstring>
-                                    </property>
-                                    <property name="text">
-                                        <string></string>
+                                        <cstring>RadioButton4</cstring>
                                     </property>
                                 </widget>
-                            </grid>
+                            </hbox>
                         </widget>
-                    </vbox>
+                    </hbox>
                 </widget>
-                <widget class="QButtonGroup" row="0" column="0">
+                <widget class="QGroupBox" row="1" column="0">
                     <property name="name">
-                        <cstring>GroupConstructors</cstring>
-                    </property>
-                    <property name="sizePolicy">
-                        <sizepolicy>
-                            <hsizetype>5</hsizetype>
-                            <vsizetype>0</vsizetype>
-                            <horstretch>0</horstretch>
-                            <verstretch>0</verstretch>
-                        </sizepolicy>
-                    </property>
-                    <property name="title">
-                        <string></string>
+                        <cstring>GroupBoxName</cstring>
                     </property>
-                    <hbox>
+                    <grid>
                         <property name="name">
                             <cstring>unnamed</cstring>
                         </property>
                         <property name="spacing">
                             <number>6</number>
                         </property>
-                        <widget class="QLayoutWidget">
+                        <widget class="QLayoutWidget" row="0" column="0">
                             <property name="name">
-                                <cstring>Layout2</cstring>
+                                <cstring>Layout4</cstring>
                             </property>
-                            <hbox>
+                            <grid>
                                 <property name="name">
                                     <cstring>unnamed</cstring>
                                 </property>
                                 <property name="spacing">
                                     <number>6</number>
                                 </property>
-                                <widget class="QRadioButton">
-                                    <property name="name">
-                                        <cstring>RadioButton1</cstring>
-                                    </property>
-                                    <property name="text">
-                                        <string></string>
-                                    </property>
-                                </widget>
-                                <widget class="QRadioButton">
-                                    <property name="name">
-                                        <cstring>RadioButton2</cstring>
-                                    </property>
-                                    <property name="text">
-                                        <string></string>
-                                    </property>
-                                </widget>
-                                <widget class="QRadioButton">
+                                <widget class="QLabel" row="0" column="0">
                                     <property name="name">
-                                        <cstring>RadioButton3</cstring>
-                                    </property>
-                                    <property name="text">
-                                        <string></string>
+                                        <cstring>NameLabel</cstring>
                                     </property>
                                 </widget>
-                                <widget class="QRadioButton">
+                                <widget class="QLineEdit" row="0" column="1">
                                     <property name="name">
-                                        <cstring>RadioButton4</cstring>
-                                    </property>
-                                    <property name="text">
-                                        <string></string>
+                                        <cstring>ResultName</cstring>
                                     </property>
                                 </widget>
-                            </hbox>
+                            </grid>
                         </widget>
-                    </hbox>
+                    </grid>
                 </widget>
-                <widget class="QGroupBox" row="1" column="0">
+                <widget class="QGroupBox" row="3" column="0">
                     <property name="name">
-                        <cstring>GroupBoxName</cstring>
-                    </property>
-                    <property name="title">
-                        <string></string>
+                        <cstring>GroupBoxPublish</cstring>
                     </property>
                     <grid>
                         <property name="name">
                         </property>
                         <widget class="QLayoutWidget" row="0" column="0">
                             <property name="name">
-                                <cstring>Layout66</cstring>
+                                <cstring>Layout5</cstring>
                             </property>
                             <grid>
                                 <property name="name">
                                 <property name="spacing">
                                     <number>6</number>
                                 </property>
-                                <widget class="QLineEdit" row="0" column="1">
+                                <widget class="QCheckBox" row="0" column="0">
                                     <property name="name">
-                                        <cstring>ResultName</cstring>
+                                        <cstring>CheckBoxRestoreSS</cstring>
                                     </property>
                                 </widget>
-                                <widget class="QLabel" row="0" column="0">
+                            </grid>
+                        </widget>
+                    </grid>
+                </widget>
+                <widget class="QGroupBox" row="4" column="0">
+                    <property name="name">
+                        <cstring>GroupButtons</cstring>
+                    </property>
+                    <property name="sizePolicy">
+                        <sizepolicy>
+                            <hsizetype>7</hsizetype>
+                            <vsizetype>0</vsizetype>
+                            <horstretch>0</horstretch>
+                            <verstretch>0</verstretch>
+                        </sizepolicy>
+                    </property>
+                    <vbox>
+                        <property name="name">
+                            <cstring>unnamed</cstring>
+                        </property>
+                        <property name="margin">
+                            <number>11</number>
+                        </property>
+                        <property name="spacing">
+                            <number>6</number>
+                        </property>
+                        <widget class="QLayoutWidget">
+                            <property name="name">
+                                <cstring>Layout3</cstring>
+                            </property>
+                            <grid>
+                                <property name="name">
+                                    <cstring>unnamed</cstring>
+                                </property>
+                                <widget class="QPushButton" row="0" column="0">
                                     <property name="name">
-                                        <cstring>NameLabel</cstring>
+                                        <cstring>buttonApply</cstring>
+                                    </property>
+                                </widget>
+                                <widget class="QPushButton" row="0" column="1">
+                                    <property name="name">
+                                        <cstring>buttonCancel</cstring>
+                                    </property>
+                                </widget>
+                                <widget class="QPushButton" row="0" column="2">
+                                    <property name="name">
+                                        <cstring>buttonOk</cstring>
+                                    </property>
+                                </widget>
+                                <spacer row="0" column="3">
+                                    <property name="name">
+                                        <cstring>Spacer1</cstring>
+                                    </property>
+                                    <property name="orientation">
+                                        <enum>Horizontal</enum>
+                                    </property>
+                                    <property name="sizeType">
+                                        <enum>Expanding</enum>
+                                    </property>
+                                    <property name="sizeHint">
+                                        <size>
+                                            <width>90</width>
+                                            <height>20</height>
+                                        </size>
+                                    </property>
+                                </spacer>
+                                <widget class="QPushButton" row="0" column="4">
+                                    <property name="name">
+                                        <cstring>buttonHelp</cstring>
                                     </property>
                                 </widget>
                             </grid>
                         </widget>
-                    </grid>
+                    </vbox>
                 </widget>
             </grid>
         </widget>
index 32f321691da55faa8468598f4da353f51dcc63ea..a882d39c4c6a3db50e5e71fa5f2d3197de1cbe04 100755 (executable)
@@ -523,10 +523,31 @@ void GEOMBase_Helper::addInStudy( GEOM::GEOM_Object_ptr theObj, const char* theN
   if ( !aStudy || theObj->_is_nil() )
     return;
 
+  SALOMEDS::Study_var aStudyDS = GeometryGUI::ClientStudyToStudy(aStudy);
+
   GEOM::GEOM_Object_ptr aFatherObj = getFather( theObj );
 
-  getGeomEngine()->AddInStudy(GeometryGUI::ClientStudyToStudy(aStudy),
-                              theObj, theName, aFatherObj);
+  SALOMEDS::SObject_var aSO =
+    getGeomEngine()->AddInStudy(aStudyDS, theObj, theName, aFatherObj);
+
+  // Each dialog is responsible for this method implementation,
+  // default implementation does nothing
+  restoreSubShapes(aStudyDS, aSO);
+}
+
+//================================================================
+// Function : restoreSubShapes
+// Purpose  : restore tree of argument's sub-shapes under the resulting shape
+//================================================================
+void GEOMBase_Helper::restoreSubShapes (SALOMEDS::Study_ptr   /*theStudy*/,
+                                        SALOMEDS::SObject_ptr /*theSObject*/)
+{
+  // do nothing by default
+
+  // example of implementation in particular dialog:
+  // GEOM::ListOfGO anArgs;
+  // anArgs.length(0); // empty list means that all arguments should be restored
+  // getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs, /*isTrsf=*/false);
 }
 
 //================================================================
@@ -751,10 +772,11 @@ bool GEOMBase_Helper::checkViewWindow()
 //            It perfroms user input validation, then it
 //            performs a proper operation and manages transactions, etc.
 //================================================================
-bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction )
+bool GEOMBase_Helper::onAccept (const bool publish, const bool useTransaction)
 {
-  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
-  if ( !appStudy ) return false;
+  SalomeApp_Study* appStudy =
+    dynamic_cast<SalomeApp_Study*>(SUIT_Session::session()->activeApplication()->activeStudy());
+  if (!appStudy) return false;
   _PTR(Study) aStudy = appStudy->studyDS();
 
   bool aLocked = (_PTR(AttributeStudyProperties) (aStudy->GetProperties()))->IsLocked();
index 62d1f2bb0f5d3a983dc2df6ef8a730fc321b935f..6ae7318ca45131fd143f3d21256a9ac9498a61b9 100755 (executable)
@@ -106,7 +106,7 @@ protected:
   void prepareSelection( const ObjectList&, const int );
   void prepareSelection( GEOM::GEOM_Object_ptr, const int );
 
-  void addInStudy      ( GEOM::GEOM_Object_ptr, const char* theName ); 
+  void addInStudy      ( GEOM::GEOM_Object_ptr, const char* theName );
 
   bool openCommand     ();
   bool abortCommand    ();
@@ -171,6 +171,9 @@ protected:
   // It should perform the required operation and put all new or modified objects into 
   // <objects> argument.Should return <false> if some error occurs during its execution. 
 
+  virtual void restoreSubShapes (SALOMEDS::Study_ptr theStudy, SALOMEDS::SObject_ptr theSObject);
+  // This method is called by addInStudy().
+
   virtual GEOM::GEOM_Object_ptr getFather( GEOM::GEOM_Object_ptr theObj );
   // This method is called by addInStudy(). It should return a father object
   // for <theObj> or a nil reference if <theObj> should be published
index 32f3ff2af2a45ac5de949636d3ea5a235c04fabb..4507dc64415143bd2a1d73c40e1fec6172ab46a3 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
 
 #include <qlabel.h>
 #include <qpushbutton.h>
+#include <qcheckbox.h>
 
 using namespace std;
 
 //=================================================================================
 // class    : GEOMBase_Skeleton()
-// purpose  : Constructs a GEOMBase_Skeleton which is a child of 'parent', with the 
+// purpose  : Constructs a GEOMBase_Skeleton which is a child of 'parent', with the
 //            name 'name' and widget flags set to 'f'.
 //            The dialog will by default be modeless, unless you set 'modal' to
 //            TRUE to construct a modal dialog.
 //=================================================================================
-GEOMBase_Skeleton::GEOMBase_Skeleton(GeometryGUI* theGeometryGUI, QWidget* parent,
-                                     const char* name, bool modal, WFlags fl)
+GEOMBase_Skeleton::GEOMBase_Skeleton (GeometryGUI* theGeometryGUI, QWidget* parent,
+                                      const char* name, bool modal, WFlags fl)
   : DlgRef_Skeleton_QTD( parent, name, modal, WStyle_Customize | WStyle_NormalBorder
-                         | WStyle_Title | WStyle_SysMenu | WDestructiveClose ), 
+                         | WStyle_Title | WStyle_SysMenu | WDestructiveClose ),
    GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( parent ) ),
    myGeomGUI( theGeometryGUI )
 {
@@ -61,6 +62,9 @@ GEOMBase_Skeleton::GEOMBase_Skeleton(GeometryGUI* theGeometryGUI, QWidget* paren
   GroupBoxName->setTitle(tr("GEOM_RESULT_NAME_GRP"));
   NameLabel->setText(tr("GEOM_RESULT_NAME_LBL"));
 
+  GroupBoxPublish->setTitle(tr("GEOM_PUBLISH_RESULT_GRP"));
+  CheckBoxRestoreSS->setText(tr("GEOM_RESTORE_SUB_SHAPES"));
+
   buttonCancel->setText(tr("GEOM_BUT_CLOSE"));
   buttonOk->setText(tr("GEOM_BUT_APPLY_AND_CLOSE"));
   buttonApply->setText(tr("GEOM_BUT_APPLY"));
@@ -71,7 +75,6 @@ GEOMBase_Skeleton::GEOMBase_Skeleton(GeometryGUI* theGeometryGUI, QWidget* paren
   Init();
 }
 
-
 //=================================================================================
 // function : ~GEOMBase_Skeleton()
 // purpose  : Destroys the object and frees any allocated resources
@@ -82,7 +85,6 @@ GEOMBase_Skeleton::~GEOMBase_Skeleton()
     myGeomGUI->SetActiveDialogBox( 0 );
 }
 
-
 //=================================================================================
 // function : Init()
 // purpose  :
@@ -94,11 +96,12 @@ void GEOMBase_Skeleton::Init()
     myGeomGUI = dynamic_cast<GeometryGUI*>( app->module( "Geometry" ) );
 
   /* init variables */
-  myGeomGUI->SetActiveDialogBox(this);
+  if (myGeomGUI)
+    myGeomGUI->SetActiveDialogBox(this);
 
   /* signals and slots connections */
   connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
-  if (myGeomGUI) 
+  if (myGeomGUI)
   {
     connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
     connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
@@ -111,10 +114,10 @@ void GEOMBase_Skeleton::Init()
   RadioButton1->setChecked(TRUE);
   RadioButton4->hide();
 
-  return;
+  CheckBoxRestoreSS->setChecked(FALSE);
+  GroupBoxPublish->hide();
 }
 
-
 //=================================================================================
 // function : ClickOnCancel()
 // purpose  :
@@ -124,7 +127,6 @@ void GEOMBase_Skeleton::ClickOnCancel()
   close();
 }
 
-
 //=================================================================================
 // function : LineEditReturnPressed()
 // purpose  :
@@ -139,14 +141,11 @@ void GEOMBase_Skeleton::LineEditReturnPressed()
   /* so SelectionIntoArgument() is automatically called.           */
   const QString objectUserName = myEditCurrentArgument->text();
   QWidget* thisWidget = (QWidget*)this;
-  
+
   if(GEOMBase::SelectionByNameInDialogs(thisWidget, objectUserName, selectedIO()))
      myEditCurrentArgument->setText(objectUserName);
-
-  return;
 }
 
-
 //=================================================================================
 // function : DeactivateActiveDialog()
 // purpose  :
@@ -155,13 +154,12 @@ void GEOMBase_Skeleton::DeactivateActiveDialog()
 {
   this->setEnabled(false);
   globalSelection();
-  disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0);
-  if (myGeomGUI) myGeomGUI->SetActiveDialogBox(0);
-    
-  return;
+  if (myGeomGUI) {
+    myGeomGUI->SetActiveDialogBox(0);
+    disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+  }
 }
 
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -172,20 +170,17 @@ void GEOMBase_Skeleton::ActivateThisDialog()
   if (myGeomGUI) myGeomGUI->EmitSignalDeactivateDialog();
   this->setEnabled(true);
   if (myGeomGUI) myGeomGUI->SetActiveDialogBox((QDialog*)this);
-  return;
 }
 
-
 //=================================================================================
 // function : closeEvent()
 // purpose  : same than click on cancel button
 //=================================================================================
 void GEOMBase_Skeleton::closeEvent(QCloseEvent* e)
 {
-  SalomeApp_Application* app = (SalomeApp_Application*)(SUIT_Session::session()->activeApplication());
-  if(app) {
-    disconnect( app->selectionMgr(), 0, this, 0);
-    app->updateActions();
+  if (myGeomGUI) {
+    disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+    myGeomGUI->getApp()->updateActions();
   }
   QDialog::closeEvent( e );
 }
@@ -228,14 +223,14 @@ int GEOMBase_Skeleton::getConstructorId() const
 void GEOMBase_Skeleton::ClickOnHelp()
 {
   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
-  if (app) 
+  if (app)
     app->onHelpContextModule(myGeomGUI ? app->moduleName(myGeomGUI->moduleName()) : QString(""), myHelpFileName);
   else {
-               QString platform;
+    QString platform;
 #ifdef WIN32
-               platform = "winapplication";
+    platform = "winapplication";
 #else
-               platform = "application";
+    platform = "application";
 #endif
     SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
                           QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
@@ -243,11 +238,11 @@ void GEOMBase_Skeleton::ClickOnHelp()
                           QObject::tr("BUT_OK"));
   }
 }
+
 //=================================================================================
 //  function : setHelpFileName()
 //  purpose  : set name for help file html
 //=================================================================================
-
 void GEOMBase_Skeleton::setHelpFileName(const QString& theName)
 {
     myHelpFileName = theName;
@@ -264,8 +259,8 @@ void GEOMBase_Skeleton::keyPressEvent( QKeyEvent* e )
     return;
 
   if ( e->key() == Key_F1 )
-    {
-      e->accept();
-      ClickOnHelp();
-    }
+  {
+    e->accept();
+    ClickOnHelp();
+  }
 }
index d18ef12d5e890d19f1d2aea32bffbb2489d0ddf2..c694fae09ece027ccf934fdf87330fdc14c42c19 100644 (file)
@@ -15,7 +15,7 @@
 #  License along with this library; if not, write to the Free Software
 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 #
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 # This is a Qt message file in .po format.  Each msgid starts with
 # a scope.  This scope should *NOT* be translated - eg. translating
@@ -3129,6 +3129,12 @@ msgstr "Result name"
 msgid "GEOM_RESULT_NAME_LBL"
 msgstr "Name"
 
+msgid "GEOM_PUBLISH_RESULT_GRP"
+msgstr "Advanced options"
+
+msgid "GEOM_RESTORE_SUB_SHAPES"
+msgstr "Set presentation parameters and subshapes from arguments"
+
 msgid "GEOM_ERR_GET_ENGINE"
 msgstr "Failed to obtain GEOM Engine component.  Reload Geometry module and try again."
 
index b94d8f5697a33aba7727e8710254a8d4bd705181..e4487ec49d32d906c096d6df304ebc8a995a4a40 100644 (file)
@@ -68,6 +68,7 @@ using namespace std;
 #include <TDF_Tool.hxx>
 
 #include <BRepExtrema_ExtCF.hxx>
+#include <BRepExtrema_DistShapeShape.hxx>
 
 #include <BRep_Tool.hxx>
 #include <BRep_Builder.hxx>
@@ -2812,19 +2813,17 @@ static bool GetInPlaceOfShape (const Handle(GEOM_Function)& theWhereFunction,
 void GEOMImpl_IShapesOperations::GetShapeProperties( const TopoDS_Shape aShape, Standard_Real tab[],
                                                      gp_Pnt & aVertex )
 {
-  GProp_GProps SProps, VProps;
+  GProp_GProps theProps;
   gp_Pnt aCenterMass;
   TopoDS_Shape aPntShape;
   Standard_Real aShapeSize;
 
-  BRepGProp::VolumeProperties(aShape, VProps);
-  aCenterMass = VProps.CentreOfMass();
-  aShapeSize  = VProps.Mass();
-  if (aShape.ShapeType() == TopAbs_FACE) {
-    BRepGProp::SurfaceProperties(aShape, SProps);
-    aCenterMass = SProps.CentreOfMass();
-    aShapeSize  = SProps.Mass();
-  }
+  if      (aShape.ShapeType() == TopAbs_EDGE) BRepGProp::LinearProperties(aShape,  theProps);
+  else if (aShape.ShapeType() == TopAbs_FACE) BRepGProp::SurfaceProperties(aShape, theProps);
+  else                                        BRepGProp::VolumeProperties(aShape,  theProps);
+
+  aCenterMass = theProps.CentreOfMass();
+  aShapeSize  = theProps.Mass();
 
   aPntShape = BRepBuilderAPI_MakeVertex(aCenterMass).Shape();
   aVertex   = BRep_Tool::Pnt( TopoDS::Vertex( aPntShape ) );
@@ -2849,6 +2848,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object)
 
   TopoDS_Shape aWhere = theShapeWhere->GetValue();
   TopoDS_Shape aWhat  = theShapeWhat->GetValue();
+  TopoDS_Shape aPntShape;
+  TopoDS_Vertex aVertex;
 
   if (aWhere.IsNull() || aWhat.IsNull()) {
     SetErrorCode("Error: aWhere and aWhat TopoDS_Shape are Null.");
@@ -2871,6 +2872,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object)
 
   bool isFound = false;
   Standard_Integer iType = TopAbs_SOLID;
+  Standard_Integer compType = TopAbs_SOLID;
   Standard_Real    aWhat_Mass = 0., aWhere_Mass = 0.;
   Standard_Real    tab_aWhat[4],    tab_aWhere[4];
   Standard_Real    dl_l = 1e-3;
@@ -2878,15 +2880,23 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object)
   gp_Pnt           aPnt, aPnt_aWhat;
   GProp_GProps     aProps;
 
-  // 2D or 3D shapes
-  if ( aWhat.ShapeType() == TopAbs_COMPOUND  ||
-       aWhat.ShapeType() == TopAbs_SHELL     ||
-       aWhat.ShapeType() == TopAbs_COMPSOLID ) {
-    TopExp_Explorer Exp( aWhat, TopAbs_ShapeEnum( iType ) );
-    if ( ! Exp.More() ) iType = TopAbs_FACE;
+  // Find the iType of the aWhat shape
+  if      ( aWhat.ShapeType() == TopAbs_EDGE  || aWhat.ShapeType() == TopAbs_WIRE )      iType = TopAbs_EDGE;
+  else if ( aWhat.ShapeType() == TopAbs_FACE  || aWhat.ShapeType() == TopAbs_SHELL )     iType = TopAbs_FACE;
+  else if ( aWhat.ShapeType() == TopAbs_SOLID || aWhat.ShapeType() == TopAbs_COMPSOLID ) iType = TopAbs_SOLID;
+  else if ( aWhat.ShapeType() == TopAbs_COMPOUND ) {
+    // Only the iType of the first shape in the compound is taken into account
+    TopoDS_Iterator It (aWhat, Standard_True, Standard_True);
+    compType = It.Value().ShapeType();
+    if      ( compType == TopAbs_EDGE  || compType == TopAbs_WIRE )     iType = TopAbs_EDGE;
+    else if ( compType == TopAbs_FACE  || compType == TopAbs_SHELL)     iType = TopAbs_FACE;
+    else if ( compType == TopAbs_SOLID || compType == TopAbs_COMPSOLID) iType = TopAbs_SOLID;
+  }
+  else {
+    cout << endl;
+    cout << "WARNING : shape to be extracted is of unknown type !" << endl;
+    cout << endl;
   }
-  else if ( aWhat.ShapeType() == TopAbs_FACE )
-    iType = TopAbs_FACE;
 
   TopExp_Explorer Exp_aWhat( aWhat,   TopAbs_ShapeEnum( iType ) );
   TopExp_Explorer Exp_aWhere( aWhere, TopAbs_ShapeEnum( iType ) );
@@ -2905,29 +2915,31 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object)
   Tol_3D = dl_l * ( min_l * min_l * min_l ) * ( 3. + (3 * dl_l) + (dl_l * dl_l) );
 
   Tol_Mass = Tol_3D;
-  if ( iType == TopAbs_FACE ) Tol_Mass = Tol_2D;
+  if      ( iType == TopAbs_EDGE ) Tol_Mass = Tol_1D;
+  else if ( iType == TopAbs_FACE ) Tol_Mass = Tol_2D;
 
   // Compute the ShapeWhat Mass
   for ( ; Exp_aWhat.More(); Exp_aWhat.Next() ) {
-    if      ( iType == TopAbs_SOLID ) BRepGProp::VolumeProperties(Exp_aWhat.Current(), aProps);
-    else if ( iType == TopAbs_FACE )  BRepGProp::SurfaceProperties(Exp_aWhat.Current(), aProps);
+    if      ( iType == TopAbs_EDGE ) BRepGProp::LinearProperties(Exp_aWhat.Current(),  aProps);
+    else if ( iType == TopAbs_FACE ) BRepGProp::SurfaceProperties(Exp_aWhat.Current(), aProps);
+    else                             BRepGProp::VolumeProperties(Exp_aWhat.Current(),  aProps);
     aWhat_Mass += aProps.Mass();
   }
 
-  // Finding the Sub-ShapeWhere
+  // Searching for the sub-shapes inside the ShapeWhere shape
   for ( Exp_aWhere.ReInit(); Exp_aWhere.More(); Exp_aWhere.Next() ) {
     GetShapeProperties( Exp_aWhere.Current(), tab_aWhere, aPnt );
     for ( Exp_aWhat.ReInit(); Exp_aWhat.More(); Exp_aWhat.Next() ) {
       GetShapeProperties( Exp_aWhat.Current(), tab_aWhat, aPnt_aWhat );
-      if ( fabs(tab_aWhat[3] - tab_aWhere[3]) <= Tol_Mass && aPnt_aWhat.Distance(aPnt) <= Tol_1D )
-        isFound = true;
-      else if ( tab_aWhat[3] - ( tab_aWhere[3] > Tol_Mass) ) {
-        BRepClass3d_SolidClassifier SC_aWhere (Exp_aWhere.Current(), aPnt, Precision::Confusion());
-        BRepClass3d_SolidClassifier SC_aWhat  (Exp_aWhat.Current(),  aPnt, Precision::Confusion());
-        // Block construction 3D
-        if      ( SC_aWhere.State() == TopAbs_IN && SC_aWhat.State() == TopAbs_IN ) isFound = true;
-        // Block construction 2D
-        else if ( SC_aWhere.State() == TopAbs_ON && SC_aWhat.State() == TopAbs_ON ) isFound = true;
+      if ( fabs(tab_aWhat[3] - tab_aWhere[3]) <= Tol_Mass && aPnt_aWhat.Distance(aPnt) <= Tol_1D ) isFound = true;
+      else {
+        if ( (tab_aWhat[3] - tab_aWhere[3]) > Tol_Mass ) {
+          aPntShape = BRepBuilderAPI_MakeVertex( aPnt ).Shape();
+          aVertex   = TopoDS::Vertex( aPntShape );
+          BRepExtrema_DistShapeShape aWhereDistance ( aVertex, Exp_aWhere.Current() );
+          BRepExtrema_DistShapeShape aWhatDistance  ( aVertex, Exp_aWhat.Current() );
+          if ( fabs(aWhereDistance.Value() - aWhatDistance.Value()) <= Tol_1D ) isFound = true;
+        }
       }
       if ( isFound ) {
         aWhereIndex = aWhereIndices.FindIndex(Exp_aWhere.Current());
index b41b07f8b70b9c8f735c4739c5bb0b846c15aac2..2515aad8865a5f6cdaff8c027774ee5f572f75a7 100644 (file)
@@ -522,7 +522,10 @@ char* GEOM_Gen_i::ComponentDataType()
 // function : AddInStudy
 // purpose  :
 //============================================================================
-SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy(SALOMEDS::Study_ptr theStudy, GEOM::GEOM_Object_ptr theObject, const char* theName, GEOM::GEOM_Object_ptr theFather)
+SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy (SALOMEDS::Study_ptr theStudy,
+                                             GEOM::GEOM_Object_ptr theObject,
+                                             const char* theName,
+                                             GEOM::GEOM_Object_ptr theFather)
 {
   SALOMEDS::SObject_var aResultSO;
   if(theObject->_is_nil() || theStudy->_is_nil()) return aResultSO;
@@ -559,6 +562,322 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy(SALOMEDS::Study_ptr theStudy, GEOM:
   return aResultSO._retn();
 }
 
+//============================================================================
+// function : RestoreSubShapes
+// purpose  : Publish sub-shapes, standing for arguments and sub-shapes of arguments.
+//            To be used from python scripts out of geompy.addToStudy (non-default usage)
+//============================================================================
+CORBA::Boolean GEOM_Gen_i::RestoreSubShapesO (SALOMEDS::Study_ptr   theStudy,
+                                             GEOM::GEOM_Object_ptr theObject,
+                                             const GEOM::ListOfGO& theArgs,
+                                             CORBA::Boolean        isTrsf)
+{
+  if (CORBA::is_nil(theStudy) || CORBA::is_nil(theObject))
+    return false;
+
+  // find SObject in the study
+  CORBA::String_var anIORo = _orb->object_to_string(theObject);
+  SALOMEDS::SObject_var aSO = theStudy->FindObjectIOR(anIORo.in());
+  if (CORBA::is_nil(aSO))
+    return false;
+
+  return RestoreSubShapes(theStudy, theObject, aSO, theArgs, isTrsf);
+}
+
+//============================================================================
+// function : RestoreSubShapes
+// purpose  : Publish sub-shapes, standing for arguments and sub-shapes of arguments.
+//            To be used from GUI and from geompy.addToStudy
+//============================================================================
+CORBA::Boolean GEOM_Gen_i::RestoreSubShapesSO (SALOMEDS::Study_ptr   theStudy,
+                                              SALOMEDS::SObject_ptr theSObject,
+                                              const GEOM::ListOfGO& theArgs,
+                                              CORBA::Boolean        isTrsf)
+{
+  if (CORBA::is_nil(theStudy) || CORBA::is_nil(theSObject))
+    return false;
+
+  SALOMEDS::GenericAttribute_var anAttr;
+  if (!theSObject->FindAttribute(anAttr, "AttributeIOR"))
+    return false;
+
+  SALOMEDS::AttributeIOR_var anAttrIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+  CORBA::String_var anIORso = anAttrIOR->Value();
+
+  // get Object from SObject
+  GEOM::GEOM_Object_var anO = GEOM::GEOM_Object::_narrow(_orb->string_to_object(anIORso));
+  if (CORBA::is_nil(anO))
+    return false;
+
+  return RestoreSubShapes(theStudy, anO, theSObject, theArgs, isTrsf);
+}
+
+//============================================================================
+// function : RestoreSubShapes
+// purpose  : Private method. Works only if both theObject and theSObject
+//            are defined, and does not check, if they correspond to each other.
+//============================================================================
+CORBA::Boolean GEOM_Gen_i::RestoreSubShapes (SALOMEDS::Study_ptr   theStudy,
+                                            GEOM::GEOM_Object_ptr theObject,
+                                            SALOMEDS::SObject_ptr theSObject,
+                                            const GEOM::ListOfGO& theArgs,
+                                            CORBA::Boolean        isTrsf)
+{
+  if (CORBA::is_nil(theStudy) || CORBA::is_nil(theObject) || CORBA::is_nil(theSObject))
+    return false;
+
+  if (isTrsf && theArgs.length() > 1)
+    // only one (the first) argument of transformation
+    // (the transformed shape) can be restored
+    return false;
+
+  // Arguments to be published
+  GEOM::ListOfGO_var aList;
+
+  // If theArgs list is empty, we try to publish all arguments,
+  // otherwise publish only passed args
+  Standard_Integer nbArgsActual = -1; // -1 means unknown
+  Standard_Integer aLength = theArgs.length();
+  if (aLength > 0) {
+    aList = new GEOM::ListOfGO;
+    aList->length(aLength);
+    for (int i = 0; i < aLength; i++) {
+      aList[i] = theArgs[i];
+    }
+  }
+  else {
+    // Get all arguments
+    aList = theObject->GetDependency();
+    aLength = aList->length();
+    nbArgsActual = aLength;
+  }
+
+  if (aLength < 1)
+    return false;
+
+  if (isTrsf) {
+    // In case of transformation we do not publish argument's reflection,
+    // but only reconstruct its published sub-shapes
+
+    GEOM::GEOM_Object_var anArgO = aList[0];
+    CORBA::String_var anIOR = _orb->object_to_string(anArgO);
+    SALOMEDS::SObject_var anArgSO = theStudy->FindObjectIOR(anIOR.in());
+
+    GEOM::ListOfGO_var aParts =
+      RestoreSubShapesOneLevel(theStudy, anArgSO, theSObject, theObject, isTrsf);
+
+    // set the color of the transformed shape to the color of initial shape
+    theObject->SetColor(aList[0]->GetColor());
+
+    return (aParts->length() > 0);
+  }
+  else {
+    // in this case (not a transformation) we cannot detect, if the final
+    // shape should have the same color, as one of arguments, and we apply
+    // the same color only in case of single argument
+    if (nbArgsActual == 1) {
+      // set the color of the new shape to the color of its single argument
+      theObject->SetColor(aList[0]->GetColor());
+    }
+  }
+
+  // Get interface, containing method GetInPlace, which we will use to reconstruct sub-shapes
+  GEOM::GEOM_IShapesOperations_var aShapesOp = GetIShapesOperations(theStudy->StudyId());
+
+  // Reconstruct arguments and tree of sub-shapes of the arguments
+  CORBA::String_var anIOR;
+  SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
+  for (Standard_Integer i = 0; i < aLength; i++)
+  {
+    GEOM::GEOM_Object_var anArgO = aList[i];
+    if (!CORBA::is_nil(anArgO)) {
+      anIOR = _orb->object_to_string(anArgO);
+      SALOMEDS::SObject_var anArgSO = theStudy->FindObjectIOR(anIOR.in());
+      TCollection_AsciiString anArgName;
+      if (CORBA::is_nil(anArgSO)) {
+       anArgName = "arg_";
+       anArgName += TCollection_AsciiString(i);
+      }
+      else {
+       anArgName = anArgSO->GetName();
+      }
+
+      // Find a sub-shape of theObject in place of the argument
+      GEOM::GEOM_Object_var aSubO = aShapesOp->GetInPlace(theObject, anArgO);
+      if (!CORBA::is_nil(aSubO)) {
+       // Publish the sub-shape
+       TCollection_AsciiString aSubName ("from_");
+       aSubName += anArgName;
+       SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(theSObject);
+       aSubSO = PublishInStudy(theStudy, aSubSO, aSubO, aSubName.ToCString());
+       // Restore color
+       aSubO->SetColor(anArgO->GetColor());
+
+       if (!CORBA::is_nil(anArgSO)) {
+         // Restore published sub-shapes of the argument
+         RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, aSubO, isTrsf);
+       }
+      }
+      else { // GetInPlace failed, try to build from published parts
+       if (!CORBA::is_nil(anArgSO)) {
+         SALOMEDS::SObject_var aSubSO = aStudyBuilder->NewObject(theSObject);
+
+         // Restore published sub-shapes of the argument
+         GEOM::ListOfGO_var aParts =
+           RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, theObject, isTrsf);
+
+         if (aParts->length() > 0) {
+           // try to build an argument from a set of its sub-shapes,
+           // that published and will be reconstructed
+           if (aParts->length() > 1) {
+             aSubO = aShapesOp->MakeCompound(aParts);
+           }
+           else {
+             aSubO = aParts[0];
+           }
+           if (!CORBA::is_nil(aSubO)) {
+             // Publish the sub-shape
+             TCollection_AsciiString aSubName ("from_parts_of_");
+             aSubName += anArgName;
+             aSubSO = PublishInStudy(theStudy, aSubSO, aSubO, aSubName.ToCString());
+             // Restore color
+             aSubO->SetColor(anArgO->GetColor());
+           }
+         }
+         else {
+           // remove created aSubSO, because no parts have been found
+           aStudyBuilder->RemoveObject(aSubSO);
+         }
+       }
+      } // try to build from published parts
+    }
+  } // process arguments
+
+  return true;
+}
+
+//============================================================================
+// function : RestoreSubShapesOneLevel
+// purpose  : Private method
+//============================================================================
+GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr   theStudy,
+                                                     SALOMEDS::SObject_ptr theOldSO,
+                                                     SALOMEDS::SObject_ptr theNewSO,
+                                                     GEOM::GEOM_Object_ptr theNewO,
+                                                     CORBA::Boolean        isTrsf)
+{
+  int i = 0;
+  GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
+  if (CORBA::is_nil(theStudy) || CORBA::is_nil(theOldSO) ||
+      CORBA::is_nil(theNewO) || CORBA::is_nil(theNewSO))
+    return aParts._retn();
+
+  SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
+
+  // Get interface, containing method GetInPlace, which we will use to reconstruct sub-shapes
+  GEOM::GEOM_IShapesOperations_var aShapesOp = GetIShapesOperations(theStudy->StudyId());
+  GEOM::GEOM_IGroupOperations_var  aGroupOp  = GetIGroupOperations(theStudy->StudyId());
+
+  // Reconstruct published sub-shapes
+  SALOMEDS::ChildIterator_var it = theStudy->NewChildIterator(theOldSO);
+
+  int aLen = 0;
+  for (it->Init(); it->More(); it->Next()) {
+    aLen++;
+  }
+  aParts->length(aLen);
+
+  for (it->Init(); it->More(); it->Next()) {
+    SALOMEDS::SObject_var anOldSubSO = it->Value();
+
+    TCollection_AsciiString anArgName = anOldSubSO->GetName();
+
+    SALOMEDS::GenericAttribute_var anAttr;
+    if (anOldSubSO->FindAttribute(anAttr, "AttributeIOR")) {
+      SALOMEDS::AttributeIOR_var anAttrIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+      GEOM::GEOM_Object_var anOldSubO =
+       GEOM::GEOM_Object::_narrow(_orb->string_to_object(anAttrIOR->Value()));
+      if (!CORBA::is_nil(anOldSubO)) {
+       // Find a sub-shape of theNewO in place of anOldSubO
+       GEOM::GEOM_Object_var aNewSubO;
+       if (isTrsf) {
+         // transformation, cannot use GetInPlace, operate with indices
+         GEOM::ListOfLong_var anIDs = anOldSubO->GetSubShapeIndices();
+         if (anIDs->length() > 1) {
+           // group
+           aNewSubO = aGroupOp->CreateGroup(theNewO, aGroupOp->GetType(anOldSubO));
+           if (!CORBA::is_nil(aNewSubO))
+             aGroupOp->UnionIDs(aNewSubO, anIDs);
+         }
+         else {
+           // single sub-shape
+           aNewSubO = aShapesOp->GetSubShape(theNewO, anIDs[0]);
+         }
+       }
+       else {
+         // not a transformation, so use GetInPlace
+         aNewSubO = aShapesOp->GetInPlace(theNewO, anOldSubO);
+       }
+
+       if (!CORBA::is_nil(aNewSubO)) {
+         // add the part to the list
+         aParts[i] = aNewSubO;
+         i++;
+
+         // Publish the sub-shape
+         TCollection_AsciiString aSubName ("from_");
+         aSubName += anArgName;
+         SALOMEDS::SObject_var aNewSubSO = aStudyBuilder->NewObject(theNewSO);
+         aNewSubSO = PublishInStudy(theStudy, aNewSubSO, aNewSubO, aSubName.ToCString());
+         // Restore color
+         aNewSubO->SetColor(anOldSubO->GetColor());
+
+         // Restore published sub-shapes of the argument
+         RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, aNewSubO, isTrsf);
+       }
+       else { // GetInPlace failed, try to build from published parts
+         SALOMEDS::SObject_var aNewSubSO = aStudyBuilder->NewObject(theNewSO);
+
+         // Restore published sub-shapes of the argument
+         GEOM::ListOfGO_var aParts =
+           RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, theNewO, isTrsf);
+
+         if (aParts->length() > 0) {
+           // try to build an object from a set of its sub-shapes,
+           // that published and will be reconstructed
+           if (aParts->length() > 1) {
+             aNewSubO = aShapesOp->MakeCompound(aParts);
+           }
+           else {
+             aNewSubO = aParts[0];
+           }
+
+           if (!CORBA::is_nil(aNewSubO)) {
+             // add the part to the list
+             aParts[i] = aNewSubO;
+             i++;
+
+             // Publish the sub-shape
+             TCollection_AsciiString aSubName = "from_parts_of_";
+             aSubName += anArgName;
+             aNewSubSO = PublishInStudy(theStudy, aNewSubSO, aNewSubO, aSubName.ToCString());
+             // Restore color
+             aNewSubO->SetColor(anOldSubO->GetColor());
+           }
+         }
+         else {
+           // remove created aSubSO, because no parts have been found
+           aStudyBuilder->RemoveObject(aNewSubSO);
+         }
+       } // try to build from published parts
+      }
+    }
+  } // iterate on published sub-shapes
+
+  aParts->length(i);
+  return aParts._retn();
+}
+
 //============================================================================
 // function : register()
 // purpose  : register 'name' in 'name_service'
index 30188801f881fbf41ba1eeff98d1d91f9eeea735..b1a9ef48edabc758ac9ada5a40e8e691919c5f0a 100644 (file)
@@ -133,6 +133,22 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
                                    const char* theName,
                                    GEOM::GEOM_Object_ptr theFather);
 
+  /*! \brief Publish sub-shapes, standing for arguments and sub-shapes of arguments.
+   *         To be used from python scripts out of geompy.addToStudy (non-default usage)
+   */
+  CORBA::Boolean RestoreSubShapesO (SALOMEDS::Study_ptr   theStudy,
+                                   GEOM::GEOM_Object_ptr theObject,
+                                   const GEOM::ListOfGO& theArgs,
+                                   CORBA::Boolean        isTrsf);
+
+  /*! \brief Publish sub-shapes, standing for arguments and sub-shapes of arguments.
+   *         To be used from GUI and from geompy.addToStudy
+   */
+  CORBA::Boolean RestoreSubShapesSO (SALOMEDS::Study_ptr   theStudy,
+                                    SALOMEDS::SObject_ptr theSObject,
+                                    const GEOM::ListOfGO& theArgs,
+                                    CORBA::Boolean        isTrsf);
+
   //-----------------------------------------------------------------------//
   // Transaction methods                                                   //
   //-----------------------------------------------------------------------//
@@ -219,6 +235,19 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
 
   virtual GEOM::GEOM_Object_ptr GetObject(CORBA::Long theStudyID, const char* theEntry);
 
+ private:
+  GEOM::ListOfGO* RestoreSubShapesOneLevel (SALOMEDS::Study_ptr   theStudy,
+                                           SALOMEDS::SObject_ptr theOldSO,
+                                           SALOMEDS::SObject_ptr theNewSO,
+                                           GEOM::GEOM_Object_ptr theNewO,
+                                           CORBA::Boolean        isTrsf);
+
+  CORBA::Boolean RestoreSubShapes (SALOMEDS::Study_ptr   theStudy,
+                                  GEOM::GEOM_Object_ptr theObject,
+                                  SALOMEDS::SObject_ptr theSObject,
+                                  const GEOM::ListOfGO& theArgs,
+                                  CORBA::Boolean        isTrsf);
+
  private:
 
    ::GEOMImpl_Gen* _impl;
index d9160b6b7067bf0d41f97982a6612eaeae633778..4b0a0c8e45236e407b64c61c827f70d87d6ed4a8 100644 (file)
@@ -123,29 +123,57 @@ class geompyDC(GEOM._objref_GEOM_Gen):
             index = self.ShapesOp.GetTopologyIndex(aMainObj, aSubObj)
             name = self.ShapesOp.GetShapeTypeString(aSubObj) + "_%d"%(index)
             return name
-    
+
         ## Publish in study aShape with name aName
         #
+        #  \param aShape the shape to be published
+        #  \param aName  the name for the shape
+        #  \param doRestoreSubShapes if True, finds and publishes also
+        #         sub-shapes of \a aShape, corresponding to its arguments
+        #         and published sub-shapes of arguments
+        #  \param theArgs,isTrsf see geompy.RestoreSubShapes for these arguments description
+        #  \return study entry of the published shape in form of string
+        #
         #  Example: see GEOM_TestAll.py
-        def addToStudy(self,aShape, aName):
+        def addToStudy(self, aShape, aName,
+                       doRestoreSubShapes=False, theArgs=[], isTrsf=False):
             try:
                 aSObject = self.AddInStudy(self.myStudy, aShape, aName, None)
+                if doRestoreSubShapes:
+                    self.RestoreSubShapesSO(self.myStudy, aSObject, theArgs, isTrsf)
             except:
                 print "addToStudy() failed"
                 return ""
             return aShape.GetStudyEntry()
-        
+
         ## Publish in study aShape with name aName as sub-object of previously published aFather
         #
         #  Example: see GEOM_TestAll.py
-        def addToStudyInFather(self,aFather, aShape, aName):
+        def addToStudyInFather(self, aFather, aShape, aName):
             try:
                 aSObject = self.AddInStudy(myStudy, aShape, aName, aFather)
             except:
                 print "addToStudyInFather() failed"
                 return ""
             return aShape.GetStudyEntry()
-        
+
+        ## Publish sub-shapes, standing for arguments and sub-shapes of arguments
+        #  To be used from python scripts out of geompy.addToStudy (non-default usage)
+        #  \param theStudy  the study, in which theObject is published already,
+        #                   and in which the arguments will be published
+        #  \param theObject published GEOM object, arguments of which will be published
+        #  \param theArgs   list of GEOM_Object, operation arguments to be published.
+        #                   If this list is empty, all operation arguments will be published
+        #  \param isTrsf    If True, search sub-shapes by indices, as in case of
+        #                   transformation they cannot be found by GetInPlace.
+        #                   The argument itself is not published in this case,
+        #                   because the whole shape corresponds to the argument.
+        #  \return True in case of success, False otherwise.
+        #
+        #  Example: see GEOM_TestAll.py
+        def RestoreSubShapes (self, theObject, theArgs=[], isTrsf=False):
+            return self.RestoreSubShapesO(self.myStudy, theObject, theArgs, isTrsf)
+
         # -----------------------------------------------------------------------------
         # Basic primitives
         # -----------------------------------------------------------------------------
index 2c736f5b705d47de091fdc004983a895b40af56e..a65e88de146cc9fc8eb7d5fb6d7538f42ef613f2 100644 (file)
@@ -1,22 +1,22 @@
 //  GEOM GEOMGUI : GUI for Geometry component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
@@ -36,6 +36,7 @@
 #include "LightApp_SelectionMgr.h"
 
 #include <qcheckbox.h>
+#include <qradiobutton.h>
 #include <qcombobox.h>
 #include <qlabel.h>
 
@@ -43,7 +44,7 @@
 
 //=================================================================================
 // class    : OperationGUI_PartitionDlg()
-// purpose  : Constructs a OperationGUI_PartitionDlg which is a child of 'parent', with the 
+// purpose  : Constructs a OperationGUI_PartitionDlg which is a child of 'parent', with the
 //            name 'name' and widget flags set to 'f'.
 //            The dialog will by default be modeless, unless you set 'modal' to
 //            TRUE to construct a modal dialog.
@@ -111,24 +112,24 @@ void OperationGUI_PartitionDlg::Init()
   GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_VERTEX"));
   GroupPoints->radioButton4->setChecked(FALSE);
 
+  GroupBoxPublish->show();
+
   /* signals and slots connections */
   connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
   connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
   connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
-  
+
   connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
   connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
-  
+
   connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
   connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-  
+
   connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged()));
-  
-  connect(GroupPoints->radioButton4, SIGNAL(stateChanged(int)), this, SLOT(ReverseSense(int)));
 
   connect(myGeomGUI->getApp()->selectionMgr(),
          SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-  
+
   initName( tr( "GEOM_PARTITION" ) );
   ConstructorsClicked( 0 );
 }
@@ -142,7 +143,7 @@ void OperationGUI_PartitionDlg::ConstructorsClicked(int constructorId)
 {
   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
   globalSelection();
-  
+
   myListShapes.length(0);
   myListTools.length(0);
   myListKeepInside.length(0);
@@ -203,9 +204,9 @@ void OperationGUI_PartitionDlg::ClickOnOk()
 //=================================================================================
 bool OperationGUI_PartitionDlg::ClickOnApply()
 {
-  if ( !onAccept() )
+  if (!onAccept())
     return false;
-  
+
   initName();
   ConstructorsClicked( getConstructorId() );
   return true;
@@ -220,7 +221,7 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument()
 {
   myEditCurrentArgument->setText( "" );
   QString aString = "";
-  
+
   int nbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aString, true );
 
   if ( nbSel < 1 )
@@ -233,15 +234,15 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument()
     else if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
       myListTools.length( 0 );
   }
-  
+
   // One and only one plane can be selected
-  
+
   if ( getConstructorId() == 1 && myEditCurrentArgument == GroupPoints->LineEdit2 && nbSel != 1 )
   {
     myListTools.length( 0 );
     return;
   }
-  
+
   if ( myEditCurrentArgument == GroupPoints->LineEdit1 )
   {
     GEOMBase::ConvertListOfIOInListOfGO( selectedIO(), myListShapes, true );
@@ -255,7 +256,7 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument()
     if ( !myListTools.length() )
       return;
   }
-  
+
   myEditCurrentArgument->setText( aString );
 }
 
@@ -267,7 +268,7 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument()
 void OperationGUI_PartitionDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
-  
+
   if(send == GroupPoints->PushButton1)
     myEditCurrentArgument = GroupPoints->LineEdit1;
   else if(send == GroupPoints->PushButton2)
@@ -276,7 +277,7 @@ void OperationGUI_PartitionDlg::SetEditCurrentArgument()
     if( getConstructorId()==1 )
       globalSelection( GEOM_PLANE  );
   }
+
   globalSelection( GEOM_ALLSHAPES );
 
   myEditCurrentArgument->setFocus();
@@ -389,20 +390,22 @@ bool OperationGUI_PartitionDlg::execute( ObjectList& objects )
   return res;
 }
 
-
 //=================================================================================
-// function : closeEvent
+// function : restoreSubShapes
 // purpose  :
 //=================================================================================
-void OperationGUI_PartitionDlg::closeEvent( QCloseEvent* e )
+void OperationGUI_PartitionDlg::restoreSubShapes (SALOMEDS::Study_ptr   theStudy,
+                                                  SALOMEDS::SObject_ptr theSObject)
 {
-  GEOMBase_Skeleton::closeEvent( e );
+  if (CheckBoxRestoreSS->isChecked()) {
+    // empty list of arguments means that all arguments should be restored
+    getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(), /*isTrsf=*/false);
+  }
 }
 
-
 //=======================================================================
 //function : ComboTextChanged
-//purpose  : 
+//purpose  :
 //=======================================================================
 void OperationGUI_PartitionDlg::ComboTextChanged()
 {
@@ -415,10 +418,9 @@ void OperationGUI_PartitionDlg::ComboTextChanged()
   //GroupPoints->PushButton4->setEnabled(IsEnabled);
 }
 
-
 //=================================================================================
 // function : GetLimit()
-// purpose  : 
+// purpose  :
 //=================================================================================
 int OperationGUI_PartitionDlg::GetLimit() const
 {
index ba321be37033aa2a9188f867f08212fc03768e12..32f55999ce6cdc78b093f83bb0ffd17c1cbfee20 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
@@ -36,7 +36,7 @@
 // purpose  :
 //=================================================================================
 class OperationGUI_PartitionDlg : public GEOMBase_Skeleton
-{ 
+{
     Q_OBJECT
 
 public:
@@ -54,8 +54,7 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
-
-    virtual void closeEvent( QCloseEvent* e );
+    virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
 
 private:
     void Init();
index 345ce98fe0bfedc91b2b253473f0f5d31634c5ae..ec455e172b91c6419b403c346f8094224e84f01f 100644 (file)
@@ -1,23 +1,23 @@
 //  GEOM GEOMGUI : GUI for Geometry component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
@@ -51,7 +51,7 @@ using namespace std;
 
 //=================================================================================
 // class    : TransformationGUI_MirrorDlg()
-// purpose  : Constructs a TransformationGUI_MirrorDlg which is a child of 'parent', with the 
+// purpose  : Constructs a TransformationGUI_MirrorDlg which is a child of 'parent', with the
 //            name 'name' and widget flags set to 'f'.
 //            The dialog will by default be modeless, unless you set 'modal' to
 //            TRUE to construct a modal dialog.
@@ -73,7 +73,7 @@ TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg(GeometryGUI* theGeometr
   RadioButton1->setPixmap(image0);
   RadioButton2->setPixmap(image1);
   RadioButton3->setPixmap(image2);
+
   GroupPoints = new DlgRef_2Sel1Spin2Check(this, "GroupPoints");
   GroupPoints->SpinBox_DX->hide();
   GroupPoints->TextLabel3->hide();
@@ -88,8 +88,8 @@ TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg(GeometryGUI* theGeometr
   Layout1->addWidget(GroupPoints, 2, 0);
   /***************************************************************/
 
-  setHelpFileName("mirror_operation_page.html");  
-  
+  setHelpFileName("mirror_operation_page.html");
+
   Init();
 }
 
@@ -99,7 +99,7 @@ TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg(GeometryGUI* theGeometr
 // purpose  : Destroys the object and frees any allocated resources
 //=================================================================================
 TransformationGUI_MirrorDlg::~TransformationGUI_MirrorDlg()
-{  
+{
   /* no need to delete child widgets, Qt does it all for us */
 }
 
@@ -109,18 +109,20 @@ TransformationGUI_MirrorDlg::~TransformationGUI_MirrorDlg()
 // purpose  :
 //=================================================================================
 void TransformationGUI_MirrorDlg::Init()
-{  
+{
   /* init variables */
   myEditCurrentArgument = GroupPoints->LineEdit1;
   GroupPoints->LineEdit1->setReadOnly(true);
   GroupPoints->LineEdit2->setReadOnly(true);
-  
+
   myArgument = GEOM::GEOM_Object::_nil();
-    
+
   // Activate Create a Copy mode
   GroupPoints->CheckButton1->setChecked(true);
   CreateCopyModeChanged(true);
 
+  GroupBoxPublish->show();
+
   /* signals and slots connections */
   connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
   connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
@@ -131,10 +133,10 @@ void TransformationGUI_MirrorDlg::Init()
 
   connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
   connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-  
+
   connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
-  
-  connect(myGeomGUI->getApp()->selectionMgr(), 
+
+  connect(myGeomGUI->getApp()->selectionMgr(),
          SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
 
   initName( tr( "GEOM_MIRROR" ) );
@@ -149,16 +151,16 @@ void TransformationGUI_MirrorDlg::Init()
 void TransformationGUI_MirrorDlg::ConstructorsClicked(int constructorId)
 {
   disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
-  
+
   globalSelection();
   myEditCurrentArgument = GroupPoints->LineEdit1;
   GroupPoints->LineEdit2->clear();
   myArgument = GEOM::GEOM_Object::_nil();
-  
+
   switch (constructorId)
     {
     case 0: /* mirror an object by point */
-      {        
+      {
        GroupPoints->TextLabel2->setText(tr("GEOM_POINT_MIRROR"));
        break;
       }
@@ -166,14 +168,14 @@ void TransformationGUI_MirrorDlg::ConstructorsClicked(int constructorId)
       {
        GroupPoints->TextLabel2->setText(tr("GEOM_AXE_MIRROR"));
        break;
-      } 
+      }
     case 2: /* mirror an object by plane */
       {
        GroupPoints->TextLabel2->setText(tr("GEOM_PLANE_MIRROR"));
        break;
       }
     }
-  connect(myGeomGUI->getApp()->selectionMgr(), 
+  connect(myGeomGUI->getApp()->selectionMgr(),
          SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
 }
 
@@ -198,7 +200,7 @@ bool TransformationGUI_MirrorDlg::ClickOnApply()
 {
   if ( !onAccept(GroupPoints->CheckButton1->isChecked()) )
     return false;
-  
+
   initName();
   ConstructorsClicked( getConstructorId() );
   return true;
@@ -253,7 +255,7 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument()
                aNeedType = TopAbs_EDGE;
              else if (getConstructorId() == 2)
                aNeedType = TopAbs_FACE;
-             
+
              LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
              TColStd_IndexedMapOfInteger aMap;
              aSelMgr->GetIndexes( firstIObject(), aMap );
@@ -264,10 +266,10 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument()
                      aName += QString(":vertex_%1").arg(anIndex);
                    else
                      aName += QString(":edge_%1").arg(anIndex);
-                   
+
                    //Find SubShape Object in Father
                    GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
-                   
+
                    if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
                      GEOM::GEOM_IShapesOperations_var aShapesOp =
                        getGeomEngine()->GetIShapesOperations( getStudyId() );
@@ -286,8 +288,8 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument()
        }
     }
   myEditCurrentArgument->setText( aName );
-   
-  displayPreview(); 
+
+  displayPreview();
 }
 
 
@@ -315,7 +317,7 @@ void TransformationGUI_MirrorDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
   globalSelection();
-  
+
   if(send == GroupPoints->PushButton1){
     myEditCurrentArgument = GroupPoints->LineEdit1;
   }
@@ -353,7 +355,7 @@ void TransformationGUI_MirrorDlg::SetEditCurrentArgument()
 void TransformationGUI_MirrorDlg::ActivateThisDialog()
 {
   GEOMBase_Skeleton::ActivateThisDialog();
-  connect(myGeomGUI->getApp()->selectionMgr(), 
+  connect(myGeomGUI->getApp()->selectionMgr(),
          SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
   ConstructorsClicked( getConstructorId() );
 }
@@ -398,24 +400,26 @@ bool  TransformationGUI_MirrorDlg::execute( ObjectList& objects )
 {
   bool res = false;
   bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked();
-  
+
   GEOM::GEOM_Object_var anObj;
-  
-  switch ( getConstructorId() ) 
+
+  switch ( getConstructorId() )
     {
     case 0 :
       {
        if (toCreateCopy)
          for (int i = 0; i < myObjects.length(); i++)
            {
-             anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPointCopy( myObjects[i], myArgument );
+             anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
+                MirrorPointCopy( myObjects[i], myArgument );
              if ( !anObj->_is_nil() )
                objects.push_back( anObj._retn() );
            }
        else
          for (int i = 0; i < myObjects.length(); i++)
            {
-             anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPoint( myObjects[i], myArgument );
+             anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
+                MirrorPoint( myObjects[i], myArgument );
              if ( !anObj->_is_nil() )
                objects.push_back( anObj._retn() );
            }
@@ -427,14 +431,16 @@ bool  TransformationGUI_MirrorDlg::execute( ObjectList& objects )
        if (toCreateCopy)
          for (int i = 0; i < myObjects.length(); i++)
            {
-             anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorAxisCopy( myObjects[i], myArgument );
+             anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
+                MirrorAxisCopy( myObjects[i], myArgument );
              if ( !anObj->_is_nil() )
                objects.push_back( anObj._retn() );
            }
        else
          for (int i = 0; i < myObjects.length(); i++)
            {
-             anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorAxis( myObjects[i], myArgument );
+             anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
+                MirrorAxis( myObjects[i], myArgument );
              if ( !anObj->_is_nil() )
                objects.push_back( anObj._retn() );
            }
@@ -446,14 +452,16 @@ bool  TransformationGUI_MirrorDlg::execute( ObjectList& objects )
        if (toCreateCopy)
           for (int i = 0; i < myObjects.length(); i++)
            {
-             anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPlaneCopy( myObjects[i], myArgument );
+             anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
+                MirrorPlaneCopy( myObjects[i], myArgument );
              if ( !anObj->_is_nil() )
                objects.push_back( anObj._retn() );
            }
        else
           for (int i = 0; i < myObjects.length(); i++)
            {
-             anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->MirrorPlane( myObjects[i], myArgument );
+             anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
+                MirrorPlane( myObjects[i], myArgument );
              if ( !anObj->_is_nil() )
                objects.push_back( anObj._retn() );
            }
@@ -461,20 +469,23 @@ bool  TransformationGUI_MirrorDlg::execute( ObjectList& objects )
        break;
       }
     }
-  
+
   return res;
 }
 
 //=================================================================================
-// function : closeEvent
+// function : restoreSubShapes
 // purpose  :
 //=================================================================================
-void  TransformationGUI_MirrorDlg::closeEvent( QCloseEvent* e )
+void TransformationGUI_MirrorDlg::restoreSubShapes (SALOMEDS::Study_ptr   theStudy,
+                                                    SALOMEDS::SObject_ptr theSObject)
 {
-  GEOMBase_Skeleton::closeEvent( e );
+  if (CheckBoxRestoreSS->isChecked()) {
+    // empty list of arguments means that all arguments should be restored
+    getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(), /*isTrsf=*/true);
+  }
 }
 
-
 //=================================================================================
 // function :  CreateCopyModeChanged()
 // purpose  :
index 25f5767396879c8671581418e991a34ff0180694..da101f7cb2189e56a27058da694cd159cd0d9b3c 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
 #include "DlgRef_2Sel1Spin2Check.h"
 
 #include "TransformationGUI.h"
-  
+
 
 //=================================================================================
 // class    : TransformationGUI_MirrorDlg
 // purpose  :
 //=================================================================================
 class TransformationGUI_MirrorDlg : public GEOMBase_Skeleton
-{ 
+{
     Q_OBJECT
 
 public:
@@ -53,18 +53,18 @@ protected:
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
     virtual void addSubshapesToStudy();
-    virtual void closeEvent( QCloseEvent* e );
+    virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
 
 private:
     void Init();
     void enterEvent(QEvent* e);
-    
+
     GEOM::GEOM_Object_var myArgument;
     GEOM::ListOfGO        myObjects;
-        
+
     DlgRef_2Sel1Spin2Check* GroupPoints;
-    
-private slots :
+
+private slots:
     void ClickOnOk();
     bool ClickOnApply();
     void ActivateThisDialog();
index 862faabe7349591d04b12f7fdea3ee741c750dc1..724381ac0c92713e6906b1970280c0366f48feec 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
@@ -115,6 +115,8 @@ void TransformationGUI_OffsetDlg::Init()
   GroupPoints->CheckButton1->setChecked(true);
   CreateCopyModeChanged(true);
 
+  GroupBoxPublish->show();
+
   /* signals and slots connections */
   connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
   connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
@@ -281,7 +283,6 @@ bool TransformationGUI_OffsetDlg::isValid( QString& msg )
   return true;
 }
 
-
 //=================================================================================
 // function : execute
 // purpose  :
@@ -315,16 +316,18 @@ bool TransformationGUI_OffsetDlg::execute( ObjectList& objects )
 }
 
 //=================================================================================
-// function : closeEvent
+// function : restoreSubShapes
 // purpose  :
 //=================================================================================
-void TransformationGUI_OffsetDlg::closeEvent( QCloseEvent* e )
+void TransformationGUI_OffsetDlg::restoreSubShapes (SALOMEDS::Study_ptr   theStudy,
+                                                    SALOMEDS::SObject_ptr theSObject)
 {
-  // myGeomGUI->SetState( -1 );
-  GEOMBase_Skeleton::closeEvent( e );
+  if (CheckBoxRestoreSS->isChecked()) {
+    // empty list of arguments means that all arguments should be restored
+    getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(), /*isTrsf=*/true);
+  }
 }
 
-
 //=================================================================================
 // function : GetOffset()
 // purpose  :
@@ -334,7 +337,6 @@ double TransformationGUI_OffsetDlg::GetOffset() const
   return GroupPoints->SpinBox_DX->GetValue();
 }
 
-
 //=================================================================================
 // function :  CreateCopyModeChanged()
 // purpose  :
index a49cdd87fbdb0e2e409cb88d05ebafabee724452..d034cc1b9f3e35c357a7dea7688d71668b60a971 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
 
 #include "GEOMBase_Skeleton.h"
 #include "DlgRef_1Sel1Spin1Check.h"
-  
-  
+
+
 //=================================================================================
 // class    : TransformationGUI_OffsetDlg
 // purpose  :
 //=================================================================================
 class TransformationGUI_OffsetDlg : public GEOMBase_Skeleton
-{ 
+{
     Q_OBJECT
 
 public:
@@ -50,18 +50,17 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
-
-    virtual void closeEvent( QCloseEvent* e );
+    virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
 
 private:
     void Init();
     void enterEvent(QEvent* e);
     double GetOffset() const;
-    
+
     GEOM::ListOfGO myObjects;
-    
+
     DlgRef_1Sel1Spin1Check* GroupPoints;
-    
+
 private slots:
     void ClickOnOk();
     bool ClickOnApply();
index 721f5b9d7335d46e820bf2ab0d4bf4ef6fd19e75..14c4df459d5e4e43e62b2cd553524c07a4bfa4f0 100644 (file)
@@ -1,8 +1,8 @@
 //  GEOM GEOMGUI : GUI for Geometry component
 //
 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
 //  This library is free software; you can redistribute it and/or 
 //  modify it under the terms of the GNU Lesser General Public 
 //  License as published by the Free Software Foundation; either 
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
@@ -46,7 +46,7 @@ using namespace std;
 
 //=================================================================================
 // class    : TransformationGUI_PositionDlg()
-// purpose  : Constructs a TransformationGUI_PositionDlg which is a child of 'parent', with the 
+// purpose  : Constructs a TransformationGUI_PositionDlg which is a child of 'parent', with the
 //            name 'name' and widget flags set to 'f'.
 //            The dialog will by default be modeless, unless you set 'modal' to
 //            TRUE to construct a modal dialog.
@@ -68,7 +68,7 @@ TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
   RadioButton1->setPixmap(image0);
   RadioButton2->setPixmap(image1);
   RadioButton3->close(TRUE);
+
   Group1 = new DlgRef_3Sel3Spin1Check(this, "Group1");
   Group1->SpinBox1->hide();
   Group1->SpinBox2->hide();
@@ -86,11 +86,11 @@ TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
   Group1->CheckBox1->setText(tr("GEOM_CREATE_COPY"));
 
   Layout1->addWidget(Group1, 2, 0);
-  
+
   /***************************************************************/
 
-  setHelpFileName("modify_location_operation_page.html");  
-  
+  setHelpFileName("modify_location_operation_page.html");
+
   Init();
 }
 
@@ -100,7 +100,7 @@ TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
 // purpose  : Destroys the object and frees any allocated resources
 //=================================================================================
 TransformationGUI_PositionDlg::~TransformationGUI_PositionDlg()
-{  
+{
   /* no need to delete child widgets, Qt does it all for us */
 }
 
@@ -110,19 +110,21 @@ TransformationGUI_PositionDlg::~TransformationGUI_PositionDlg()
 // purpose  :
 //=================================================================================
 void TransformationGUI_PositionDlg::Init()
-{  
+{
   /* init variables */
   Group1->LineEdit1->setReadOnly(true);
   Group1->LineEdit2->setReadOnly(true);
   Group1->LineEdit3->setReadOnly(true);
-  
+
   myStartLCS = GEOM::GEOM_Object::_nil();
   myEndLCS = GEOM::GEOM_Object::_nil();
-    
+
   // Activate Create a Copy mode
   Group1->CheckBox1->setChecked(true);
   CreateCopyModeChanged(true);
 
+  GroupBoxPublish->show();
+
   /* signals and slots connections */
   connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
   connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
@@ -135,10 +137,10 @@ void TransformationGUI_PositionDlg::Init()
   connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
   connect(Group1->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
   connect(Group1->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-  
+
   connect(Group1->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
-  
-  connect(myGeomGUI->getApp()->selectionMgr(), 
+
+  connect(myGeomGUI->getApp()->selectionMgr(),
          SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
 
   initName( tr( "GEOM_POSITION" ) );
@@ -154,14 +156,14 @@ void TransformationGUI_PositionDlg::Init()
 void TransformationGUI_PositionDlg::ConstructorsClicked(int constructorId)
 {
   disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
-  
+
   globalSelection();
   myEditCurrentArgument = Group1->LineEdit1;
   Group1->LineEdit2->clear();
   Group1->LineEdit3->clear();
   myStartLCS = GEOM::GEOM_Object::_nil();
   myEndLCS = GEOM::GEOM_Object::_nil();
-  
+
   switch (constructorId)
     {
     case 0:
@@ -179,7 +181,7 @@ void TransformationGUI_PositionDlg::ConstructorsClicked(int constructorId)
        break;
       }
     }
-  connect(myGeomGUI->getApp()->selectionMgr(), 
+  connect(myGeomGUI->getApp()->selectionMgr(),
          SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
   SelectionIntoArgument();
 }
@@ -204,7 +206,7 @@ bool TransformationGUI_PositionDlg::ClickOnApply()
 {
   if ( !onAccept(Group1->CheckBox1->isChecked()) )
     return false;
-  
+
   initName();
   ConstructorsClicked( getConstructorId() );
   return true;
@@ -254,7 +256,7 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument()
       displayPreview();
       return;
     }
-    
+
     Standard_Boolean testResult = Standard_False;
     myEndLCS = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
     if(!testResult || CORBA::is_nil( myEndLCS )) {
@@ -265,7 +267,7 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument()
   }
 
   myEditCurrentArgument->setText( aName );
-  displayPreview(); 
+  displayPreview();
 }
 
 
@@ -290,7 +292,7 @@ void TransformationGUI_PositionDlg::LineEditReturnPressed()
 void TransformationGUI_PositionDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
-  
+
   if(send == Group1->PushButton1){
     myEditCurrentArgument = Group1->LineEdit1;
     globalSelection();
@@ -322,7 +324,7 @@ void TransformationGUI_PositionDlg::SetEditCurrentArgument()
 void TransformationGUI_PositionDlg::ActivateThisDialog()
 {
   GEOMBase_Skeleton::ActivateThisDialog();
-  connect(myGeomGUI->getApp()->selectionMgr(), 
+  connect(myGeomGUI->getApp()->selectionMgr(),
          SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
   ConstructorsClicked( getConstructorId() );
 }
@@ -374,16 +376,18 @@ bool  TransformationGUI_PositionDlg::execute( ObjectList& objects )
   bool res = false;
   bool toCreateCopy = IsPreview() || Group1->CheckBox1->isChecked();
   GEOM::GEOM_Object_var anObj;
-  
+
   switch ( getConstructorId() )
     {
     case 0 :
       {
        for (int i = 0; i < myObjects.length(); i++) {
          if (toCreateCopy)
-           anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShapeCopy( myObjects[i], myObjects[i], myEndLCS );
+           anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
+              PositionShapeCopy( myObjects[i], myObjects[i], myEndLCS );
          else
-           anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShape( myObjects[i], myObjects[i], myEndLCS );
+           anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
+              PositionShape( myObjects[i], myObjects[i], myEndLCS );
 
          if ( !anObj->_is_nil() )
            objects.push_back( anObj._retn() );
@@ -395,9 +399,11 @@ bool  TransformationGUI_PositionDlg::execute( ObjectList& objects )
       {
        for (int i = 0; i < myObjects.length(); i++) {
          if (toCreateCopy)
-           anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShapeCopy( myObjects[i], myStartLCS, myEndLCS );
+           anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
+              PositionShapeCopy( myObjects[i], myStartLCS, myEndLCS );
          else
-           anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->PositionShape( myObjects[i], myStartLCS, myEndLCS );
+           anObj = GEOM::GEOM_ITransformOperations::_narrow( getOperation() )->
+              PositionShape( myObjects[i], myStartLCS, myEndLCS );
          if ( !anObj->_is_nil() )
            objects.push_back( anObj._retn() );
        }
@@ -405,20 +411,23 @@ bool  TransformationGUI_PositionDlg::execute( ObjectList& objects )
        break;
       }
     }
-  
+
   return res;
 }
 
 //=================================================================================
-// function : closeEvent
+// function : restoreSubShapes
 // purpose  :
 //=================================================================================
-void  TransformationGUI_PositionDlg::closeEvent( QCloseEvent* e )
+void TransformationGUI_PositionDlg::restoreSubShapes (SALOMEDS::Study_ptr   theStudy,
+                                                      SALOMEDS::SObject_ptr theSObject)
 {
-  GEOMBase_Skeleton::closeEvent( e );
+  if (CheckBoxRestoreSS->isChecked()) {
+    // empty list of arguments means that all arguments should be restored
+    getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(), /*isTrsf=*/true);
+  }
 }
 
-
 //=================================================================================
 // function :  CreateCopyModeChanged()
 // purpose  :
index 9ecfb2809422b91414a016a4b61cd692464352d6..3b6fd161a0757c6bc34b9a5310450119784783f3 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
 #include "DlgRef_3Sel3Spin1Check.h"
 
 #include "TransformationGUI.h"
-  
+
 
 //=================================================================================
 // class    : TransformationGUI_PositionDlg
 // purpose  :
 //=================================================================================
 class TransformationGUI_PositionDlg : public GEOMBase_Skeleton
-{ 
+{
     Q_OBJECT
 
 public:
@@ -52,19 +52,18 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
-
-    virtual void closeEvent( QCloseEvent* e );
+    virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
 
 private:
     void Init();
     void enterEvent(QEvent* e);
-    
+
     GEOM::GEOM_Object_var myStartLCS;
     GEOM::GEOM_Object_var myEndLCS;
     GEOM::ListOfGO        myObjects;
-        
+
     DlgRef_3Sel3Spin1Check* Group1;
-    
+
 private slots:
     void ClickOnOk();
     bool ClickOnApply();
index f0cca0130cedf71ef000d6efda4f318b7a295576..ee3e34ed20a8516522a3832233852b380d9b8abd 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
@@ -106,6 +106,8 @@ TransformationGUI_RotationDlg::TransformationGUI_RotationDlg
   GroupPoints->CheckButton1->setChecked(true);
   CreateCopyModeChanged(true);
 
+  GroupBoxPublish->show();
+
   /* signals and slots connections */
   connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
   connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
@@ -306,7 +308,7 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
            }
          }
        }
-     
+
       if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0)
        myAxis = aSelectedObject;
       else if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
@@ -502,17 +504,19 @@ bool TransformationGUI_RotationDlg::execute( ObjectList& objects )
   return res;
 }
 
-
 //=================================================================================
-// function : closeEvent
+// function : restoreSubShapes
 // purpose  :
 //=================================================================================
-void TransformationGUI_RotationDlg::closeEvent( QCloseEvent* e )
+void TransformationGUI_RotationDlg::restoreSubShapes (SALOMEDS::Study_ptr   theStudy,
+                                                      SALOMEDS::SObject_ptr theSObject)
 {
-  GEOMBase_Skeleton::closeEvent( e );
+  if (CheckBoxRestoreSS->isChecked()) {
+    // empty list of arguments means that all arguments should be restored
+    getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(), /*isTrsf=*/true);
+  }
 }
 
-
 //=================================================================================
 // function : GetAngle()
 // purpose  :
index 4ea6ea9e5e9748c1132f74cec3e36c3fa933f7fc..80fd4aad0fc88012c0250f866a0c4fe0fd229255 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
 
 #include "GEOMBase_Skeleton.h"
 #include "DlgRef_4Sel1Spin2Check.h"
-  
+
 //=================================================================================
 // class    : TransformationGUI_RotationDlg
 // purpose  :
 //=================================================================================
 class TransformationGUI_RotationDlg : public GEOMBase_Skeleton
-{ 
+{
     Q_OBJECT
 
 public:
@@ -50,16 +50,16 @@ protected:
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
     virtual void addSubshapesToStudy();
-    virtual void closeEvent( QCloseEvent* e );
+    virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
 
 private:
     void Init();
     void enterEvent(QEvent* e);
     double GetAngle() const;
-    
+
     GEOM::ListOfGO myObjects;
     GEOM::GEOM_Object_var myAxis, myCentPoint, myPoint1, myPoint2;
-    
+
     DlgRef_4Sel1Spin2Check* GroupPoints;
 
 private slots:
index 7a992b2aee701f778dd9b3a94559c3c90775fb0d..5177f4455487cb742d65fccabcc0f278cd2859e3 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
@@ -98,6 +98,8 @@ TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg(GeometryGUI* theGeometryG
   GroupPoints->CheckButton1->setChecked(true);
   CreateCopyModeChanged(true);
 
+  GroupBoxPublish->show();
+
   /* signals and slots connections */
   connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
   connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
@@ -202,7 +204,7 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument()
       Standard_Boolean testResult = Standard_False;
       GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
       aName = GEOMBase::GetName( aSelectedObject );
-      
+
       TopoDS_Shape aShape;
       if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
        {
@@ -216,7 +218,7 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument()
 
              //Find SubShape Object in Father
              GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
-             
+
              if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
                GEOM::GEOM_IShapesOperations_var aShapesOp =
                  getGeomEngine()->GetIShapesOperations( getStudyId() );
@@ -370,17 +372,19 @@ bool TransformationGUI_ScaleDlg::execute( ObjectList& objects )
   return res;
 }
 
-
 //=================================================================================
-// function : closeEvent
+// function : restoreSubShapes
 // purpose  :
 //=================================================================================
-void  TransformationGUI_ScaleDlg::closeEvent( QCloseEvent* e )
+void TransformationGUI_ScaleDlg::restoreSubShapes (SALOMEDS::Study_ptr   theStudy,
+                                                   SALOMEDS::SObject_ptr theSObject)
 {
-  GEOMBase_Skeleton::closeEvent( e );
+  if (CheckBoxRestoreSS->isChecked()) {
+    // empty list of arguments means that all arguments should be restored
+    getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(), /*isTrsf=*/true);
+  }
 }
 
-
 //=================================================================================
 // function : GetFactor()
 // purpose  :
index 7f77c6b42901118ad1e147c19abb2fb53e974689..ac700aac4571bf81458af90629d55057b22597a4 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
 
 #include "GEOMBase_Skeleton.h"
 #include "DlgRef_2Sel1Spin2Check.h"
-  
-  
+
+
 //=================================================================================
 // class    : TransformationGUI_ScaleDlg
 // purpose  :
 //=================================================================================
 class TransformationGUI_ScaleDlg : public GEOMBase_Skeleton
-{ 
+{
     Q_OBJECT
 
 public:
@@ -51,7 +51,7 @@ protected:
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
     virtual void addSubshapesToStudy();
-    virtual void closeEvent( QCloseEvent* e );
+    virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
 
 private :
     void Init();
@@ -60,7 +60,7 @@ private :
 
     GEOM::ListOfGO myObjects;
     GEOM::GEOM_Object_var myPoint;   /* Central Point */
-    
+
     DlgRef_2Sel1Spin2Check* GroupPoints;
 
 private slots:
index 86b57cb84c8e1d7f3361f34ec8765434060ff764..f197f92d463ce6632ff8e762c446b5af1275c954 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
@@ -128,6 +128,8 @@ void TransformationGUI_TranslationDlg::Init()
   GroupPoints->CheckBox2->setChecked(true);
   CreateCopyModeChanged(true);
 
+  GroupBoxPublish->show();
+
   /* Get setting of step value from file configuration */
   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
   double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100);
@@ -307,41 +309,42 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument()
     TopoDS_Shape aShape;
     aName = GEOMBase::GetName( aSelectedObject );
     if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+    {
+      TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+      if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
+        aNeedType = TopAbs_EDGE;
+
+      LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+      TColStd_IndexedMapOfInteger aMap;
+      aSelMgr->GetIndexes( firstIObject(), aMap );
+      if ( aMap.Extent() == 1 )
       {
-       TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
-       if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
-         aNeedType = TopAbs_EDGE;
-
-       LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
-       TColStd_IndexedMapOfInteger aMap;
-       aSelMgr->GetIndexes( firstIObject(), aMap );
-       if ( aMap.Extent() == 1 )
-         {
-           int anIndex = aMap( 1 );
-           if (aNeedType == TopAbs_EDGE)
-             aName += QString(":edge_%1").arg(anIndex);
-           else
-             aName += QString(":vertex_%1").arg(anIndex);
-
-           //Find SubShape Object in Father
-           GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
-           
-           if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
-             GEOM::GEOM_IShapesOperations_var aShapesOp =
-               getGeomEngine()->GetIShapesOperations( getStudyId() );
-             aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-           }
-           else
-             aSelectedObject = aFindedObject;
-         } else // Global Selection
-           {
-             if (aShape.ShapeType() != aNeedType) {
-               aSelectedObject = GEOM::GEOM_Object::_nil();
-               aName = "";
-             }
-           }
+        int anIndex = aMap( 1 );
+        if (aNeedType == TopAbs_EDGE)
+          aName += QString(":edge_%1").arg(anIndex);
+        else
+          aName += QString(":vertex_%1").arg(anIndex);
+
+        //Find SubShape Object in Father
+        GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
+
+        if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+          GEOM::GEOM_IShapesOperations_var aShapesOp =
+            getGeomEngine()->GetIShapesOperations( getStudyId() );
+          aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+        }
+        else
+          aSelectedObject = aFindedObject;
+      }
+      else // Global Selection
+      {
+        if (aShape.ShapeType() != aNeedType) {
+          aSelectedObject = GEOM::GEOM_Object::_nil();
+          aName = "";
+        }
       }
-    
+    }
+
     if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
       myPoint1 = aSelectedObject;
     else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
@@ -386,7 +389,7 @@ void TransformationGUI_TranslationDlg::SetEditCurrentArgument()
     myEditCurrentArgument = GroupPoints->LineEdit2;
     if (getConstructorId() == 1)
       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
-    else 
+    else
       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
   }
   else if (send == GroupPoints->PushButton3) {
@@ -578,6 +581,18 @@ bool TransformationGUI_TranslationDlg::execute( ObjectList& objects )
   return res;
 }
 
+//=================================================================================
+// function : restoreSubShapes
+// purpose  :
+//=================================================================================
+void TransformationGUI_TranslationDlg::restoreSubShapes (SALOMEDS::Study_ptr   theStudy,
+                                                         SALOMEDS::SObject_ptr theSObject)
+{
+  if (CheckBoxRestoreSS->isChecked()) {
+    // empty list of arguments means that all arguments should be restored
+    getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(), /*isTrsf=*/true);
+  }
+}
 
 //=================================================================================
 // function :  CreateCopyModeChanged()
index ea612c6be062708424b5ef0f6b461926e5a4c486..9aefe3c7672ece8ccc9ab8a578fd8fca496fc353 100644 (file)
@@ -17,7 +17,7 @@
 //  License along with this library; if not, write to the Free Software 
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 // 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
@@ -37,7 +37,7 @@
 // purpose  :
 //=================================================================================
 class TransformationGUI_TranslationDlg : public GEOMBase_Skeleton
-{ 
+{
     Q_OBJECT
 
 public:
@@ -51,6 +51,7 @@ protected:
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
     virtual void addSubshapesToStudy();
+    virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
 
 private:
     void Init();