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
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
*/
// 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 "LightApp_SelectionMgr.h"
#include <qlabel.h>
+#include <qcheckbox.h>
using namespace std;
//=================================================================================
void BooleanGUI_Dialog::Init()
{
+ GroupBoxPublish->show();
+
/* init variables */
myEditCurrentArgument = myGroup->LineEdit1;
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);
+ }
+}
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;
// 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 "LightApp_SelectionMgr.h"
#include <qlabel.h>
+#include <qcheckbox.h>
//=================================================================================
// class : BuildGUI_CompoundDlg()
myOkShapes = false;
+ GroupBoxPublish->show();
+
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
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);
+ }
+}
// 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
//
//
//
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();
/****************************************************************************
** 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>
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 );
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()) );
*/
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 );
}
/****************************************************************************
** 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!
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
{
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();
<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>
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);
}
//================================================================
// 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();
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 ();
// 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
// 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 )
{
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"));
Init();
}
-
//=================================================================================
// function : ~GEOMBase_Skeleton()
// purpose : Destroys the object and frees any allocated resources
myGeomGUI->SetActiveDialogBox( 0 );
}
-
//=================================================================================
// function : Init()
// purpose :
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()));
RadioButton1->setChecked(TRUE);
RadioButton4->hide();
- return;
+ CheckBoxRestoreSS->setChecked(FALSE);
+ GroupBoxPublish->hide();
}
-
//=================================================================================
// function : ClickOnCancel()
// purpose :
close();
}
-
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
/* 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 :
{
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 :
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 );
}
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").
QObject::tr("BUT_OK"));
}
}
+
//=================================================================================
// function : setHelpFileName()
// purpose : set name for help file html
//=================================================================================
-
void GEOMBase_Skeleton::setHelpFileName(const QString& theName)
{
myHelpFileName = theName;
return;
if ( e->key() == Key_F1 )
- {
- e->accept();
- ClickOnHelp();
- }
+ {
+ e->accept();
+ ClickOnHelp();
+ }
}
# 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
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."
#include <TDF_Tool.hxx>
#include <BRepExtrema_ExtCF.hxx>
+#include <BRepExtrema_DistShapeShape.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
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 ) );
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.");
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;
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 ) );
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());
// 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;
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'
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 //
//-----------------------------------------------------------------------//
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 = 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
# -----------------------------------------------------------------------------
// 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
//
//
#include "LightApp_SelectionMgr.h"
#include <qcheckbox.h>
+#include <qradiobutton.h>
#include <qcombobox.h>
#include <qlabel.h>
//=================================================================================
// 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.
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 );
}
{
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
globalSelection();
-
+
myListShapes.length(0);
myListTools.length(0);
myListKeepInside.length(0);
//=================================================================================
bool OperationGUI_PartitionDlg::ClickOnApply()
{
- if ( !onAccept() )
+ if (!onAccept())
return false;
-
+
initName();
ConstructorsClicked( getConstructorId() );
return true;
{
myEditCurrentArgument->setText( "" );
QString aString = "";
-
+
int nbSel = GEOMBase::GetNameOfSelectedIObjects( selectedIO(), aString, true );
if ( nbSel < 1 )
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 );
if ( !myListTools.length() )
return;
}
-
+
myEditCurrentArgument->setText( aString );
}
void OperationGUI_PartitionDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
-
+
if(send == GroupPoints->PushButton1)
myEditCurrentArgument = GroupPoints->LineEdit1;
else if(send == GroupPoints->PushButton2)
if( getConstructorId()==1 )
globalSelection( GEOM_PLANE );
}
-
+
globalSelection( GEOM_ALLSHAPES );
myEditCurrentArgument->setFocus();
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()
{
//GroupPoints->PushButton4->setEnabled(IsEnabled);
}
-
//=================================================================================
// function : GetLimit()
-// purpose :
+// purpose :
//=================================================================================
int OperationGUI_PartitionDlg::GetLimit() const
{
// 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
//
//
//
// purpose :
//=================================================================================
class OperationGUI_PartitionDlg : public GEOMBase_Skeleton
-{
+{
Q_OBJECT
public:
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();
// 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
//
//
//
//=================================================================================
// 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.
RadioButton1->setPixmap(image0);
RadioButton2->setPixmap(image1);
RadioButton3->setPixmap(image2);
-
+
GroupPoints = new DlgRef_2Sel1Spin2Check(this, "GroupPoints");
GroupPoints->SpinBox_DX->hide();
GroupPoints->TextLabel3->hide();
Layout1->addWidget(GroupPoints, 2, 0);
/***************************************************************/
- setHelpFileName("mirror_operation_page.html");
-
+ setHelpFileName("mirror_operation_page.html");
+
Init();
}
// 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 */
}
// 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()));
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" ) );
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;
}
{
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()));
}
{
if ( !onAccept(GroupPoints->CheckButton1->isChecked()) )
return false;
-
+
initName();
ConstructorsClicked( getConstructorId() );
return true;
aNeedType = TopAbs_EDGE;
else if (getConstructorId() == 2)
aNeedType = TopAbs_FACE;
-
+
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes( firstIObject(), aMap );
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() );
}
}
myEditCurrentArgument->setText( aName );
-
- displayPreview();
+
+ displayPreview();
}
{
QPushButton* send = (QPushButton*)sender();
globalSelection();
-
+
if(send == GroupPoints->PushButton1){
myEditCurrentArgument = GroupPoints->LineEdit1;
}
void TransformationGUI_MirrorDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect(myGeomGUI->getApp()->selectionMgr(),
+ connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
ConstructorsClicked( getConstructorId() );
}
{
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() );
}
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() );
}
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() );
}
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 :
// 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:
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();
// 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
//
//
//
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()));
return true;
}
-
//=================================================================================
// function : execute
// purpose :
}
//=================================================================================
-// 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 :
return GroupPoints->SpinBox_DX->GetValue();
}
-
//=================================================================================
// function : CreateCopyModeChanged()
// purpose :
// 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:
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();
// 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
// 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
//
//
//
//=================================================================================
// 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.
RadioButton1->setPixmap(image0);
RadioButton2->setPixmap(image1);
RadioButton3->close(TRUE);
-
+
Group1 = new DlgRef_3Sel3Spin1Check(this, "Group1");
Group1->SpinBox1->hide();
Group1->SpinBox2->hide();
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();
}
// 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 */
}
// 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()));
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" ) );
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:
break;
}
}
- connect(myGeomGUI->getApp()->selectionMgr(),
+ connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
SelectionIntoArgument();
}
{
if ( !onAccept(Group1->CheckBox1->isChecked()) )
return false;
-
+
initName();
ConstructorsClicked( getConstructorId() );
return true;
displayPreview();
return;
}
-
+
Standard_Boolean testResult = Standard_False;
myEndLCS = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
if(!testResult || CORBA::is_nil( myEndLCS )) {
}
myEditCurrentArgument->setText( aName );
- displayPreview();
+ displayPreview();
}
void TransformationGUI_PositionDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
-
+
if(send == Group1->PushButton1){
myEditCurrentArgument = Group1->LineEdit1;
globalSelection();
void TransformationGUI_PositionDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect(myGeomGUI->getApp()->selectionMgr(),
+ connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
ConstructorsClicked( getConstructorId() );
}
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() );
{
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() );
}
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 :
// 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:
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();
// 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
//
//
//
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()));
}
}
}
-
+
if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0)
myAxis = aSelectedObject;
else if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
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 :
// 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:
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:
// 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
//
//
//
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()));
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() )
{
//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() );
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 :
// 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:
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();
GEOM::ListOfGO myObjects;
GEOM::GEOM_Object_var myPoint; /* Central Point */
-
+
DlgRef_2Sel1Spin2Check* GroupPoints;
private slots:
// 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
//
//
//
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);
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)
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) {
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()
// 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
//
//
//
// purpose :
//=================================================================================
class TransformationGUI_TranslationDlg : public GEOMBase_Skeleton
-{
+{
Q_OBJECT
public:
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
virtual void addSubshapesToStudy();
+ virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
private:
void Init();