IMP 0020670: Be able to keep the same names for the 'Set ... subshapes arguments' option.

This commit is contained in:
jfa 2010-03-12 10:24:14 +00:00
parent a3a3e581e4
commit 8c3982597d
19 changed files with 111 additions and 51 deletions

View File

@ -3179,13 +3179,16 @@ module GEOM
* operations, where only the first argument has to be considered.
* If theObject has only one argument shape, this flag is automatically
* considered as True, not regarding really passed value.
* \param theAddPrefix add prefix "from_" to names of restored sub-shapes,
* and prefix "from_subshapes_of_" to names of partially restored subshapes.
* \return list of published sub-shapes
*/
ListOfGO RestoreSubShapesO (in SALOMEDS::Study theStudy,
in GEOM_Object theObject,
in ListOfGO theArgs,
in find_shape_method theFindMethod,
in boolean theInheritFirstArg);
in boolean theInheritFirstArg,
in boolean theAddPrefix);
/*!
* Publish sub-shapes, standing for arguments and sub-shapes of arguments
@ -3197,7 +3200,8 @@ module GEOM
in SALOMEDS::SObject theSObject,
in ListOfGO theArgs,
in find_shape_method theFindMethod,
in boolean theInheritFirstArg);
in boolean theInheritFirstArg,
in boolean theAddPrefix);
/*!
* Methods to access interfaces for objects creation and transformation

View File

@ -348,6 +348,7 @@ void BooleanGUI_Dialog::restoreSubShapes (SALOMEDS::Study_ptr theStudy,
// empty list of arguments means that all arguments should be restored
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(),
/*theFindMethod=*/GEOM::FSM_GetInPlace, // ? GEOM::FSM_GetSame
/*theInheritFirstArg=*/myOperation == BooleanGUI::CUT); // ? false
/*theInheritFirstArg=*/myOperation == BooleanGUI::CUT,
mainFrame()->CheckBoxAddPrefix->isChecked()); // ? false
}
}

View File

@ -250,6 +250,7 @@ void BuildGUI_CompoundDlg::restoreSubShapes( SALOMEDS::Study_ptr theStudy,
// empty list of arguments means that all arguments should be restored
getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(),
/*theFindMethod=*/GEOM::FSM_GetInPlace, // ? GEOM::FSM_GetSame
/*theInheritFirstArg=*/false );
/*theInheritFirstArg=*/false,
mainFrame()->CheckBoxAddPrefix->isChecked() );
}
}

View File

@ -121,7 +121,7 @@
<property name="title" >
<string/>
</property>
<layout class="QHBoxLayout" >
<layout class="QVBoxLayout" >
<item>
<widget class="QCheckBox" name="CheckBoxRestoreSS" >
<property name="text" >
@ -129,6 +129,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="CheckBoxAddPrefix" >
<property name="text" >
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -210,6 +217,7 @@
</widget>
<tabstops>
<tabstop>CheckBoxRestoreSS</tabstop>
<tabstop>CheckBoxAddPrefix</tabstop>
<tabstop>buttonOk</tabstop>
<tabstop>buttonApply</tabstop>
<tabstop>buttonCancel</tabstop>

View File

@ -71,6 +71,7 @@ GEOMBase_Skeleton::GEOMBase_Skeleton( GeometryGUI* theGeometryGUI, QWidget* pare
myMainFrame->GroupBoxPublish->setTitle( tr( "GEOM_PUBLISH_RESULT_GRP" ) );
myMainFrame->CheckBoxRestoreSS->setText( tr( "GEOM_RESTORE_SUB_SHAPES" ) );
myMainFrame->CheckBoxAddPrefix->setText( tr( "GEOM_RSS_ADD_FREFIX" ) );
buttonCancel()->setText( tr( "GEOM_BUT_CLOSE" ) );
buttonOk()->setText( tr( "GEOM_BUT_APPLY_AND_CLOSE" ) );
@ -129,6 +130,7 @@ void GEOMBase_Skeleton::Init()
myMainFrame->RadioButton5->hide();
myMainFrame->CheckBoxRestoreSS->setChecked( false );
myMainFrame->CheckBoxAddPrefix->setChecked( true );
myMainFrame->GroupBoxPublish->hide();
}

View File

@ -3939,6 +3939,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_RESTORE_SUB_SHAPES</source>
<translation>Set presentation parameters and subshapes from arguments</translation>
</message>
<message>
<source>GEOM_RSS_ADD_FREFIX</source>
<translation>Add prefix to names of restored subshapes</translation>
</message>
<message>
<source>GEOM_ALL_IMPORT_FILES</source>
<translation>All supported formats ( %1 )</translation>

View File

@ -775,7 +775,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesO (SALOMEDS::Study_ptr theStudy,
GEOM::GEOM_Object_ptr theObject,
const GEOM::ListOfGO& theArgs,
GEOM::find_shape_method theFindMethod,
CORBA::Boolean theInheritFirstArg)
CORBA::Boolean theInheritFirstArg,
CORBA::Boolean theAddPrefix)
{
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
if (CORBA::is_nil(theStudy) || CORBA::is_nil(theObject))
@ -789,7 +790,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesO (SALOMEDS::Study_ptr theStudy,
// if (CORBA::is_nil(aSO))
// return aParts._retn();
aParts = RestoreSubShapes(theStudy, theObject, aSO, theArgs, theFindMethod, theInheritFirstArg);
aParts = RestoreSubShapes(theStudy, theObject, aSO, theArgs,
theFindMethod, theInheritFirstArg, theAddPrefix);
aSO->Destroy();
return aParts._retn();
}
@ -803,7 +805,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy,
SALOMEDS::SObject_ptr theSObject,
const GEOM::ListOfGO& theArgs,
GEOM::find_shape_method theFindMethod,
CORBA::Boolean theInheritFirstArg)
CORBA::Boolean theInheritFirstArg,
CORBA::Boolean theAddPrefix)
{
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
if (CORBA::is_nil(theStudy) || CORBA::is_nil(theSObject))
@ -821,7 +824,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy,
if (CORBA::is_nil(anO))
return aParts._retn();
aParts = RestoreSubShapes(theStudy, anO, theSObject, theArgs, theFindMethod, theInheritFirstArg);
aParts = RestoreSubShapes(theStudy, anO, theSObject, theArgs,
theFindMethod, theInheritFirstArg, theAddPrefix);
return aParts._retn();
}
@ -861,7 +865,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr theStudy,
SALOMEDS::SObject_ptr theSObject,
const GEOM::ListOfGO& theArgs,
GEOM::find_shape_method theFindMethod,
CORBA::Boolean theInheritFirstArg)
CORBA::Boolean theInheritFirstArg,
CORBA::Boolean theAddPrefix)
{
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
//PTv, IMP 0020001, The salome object <theSObject>
@ -900,7 +905,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr theStudy,
CORBA::String_var anIOR = _orb->object_to_string(aList[0]);
SALOMEDS::SObject_var anArgSO = theStudy->FindObjectIOR(anIOR.in());
aParts = RestoreSubShapesOneLevel(theStudy, anArgSO, theSObject, theObject, theFindMethod);
aParts = RestoreSubShapesOneLevel(theStudy, anArgSO, theSObject, theObject, theFindMethod, theAddPrefix);
// set the color of the transformed shape to the color of initial shape
theObject->SetColor(aList[0]->GetColor());
@ -984,7 +989,10 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr theStudy,
// Publish the sub-shape
SALOMEDS::SObject_var aSubSO;
if (!CORBA::is_nil(theSObject)) {
TCollection_AsciiString aSubName ("from_");
TCollection_AsciiString aSubName;
if (theAddPrefix) {
aSubName = "from_";
}
aSubName += anArgName;
aSubSO = aStudyBuilder->NewObject(theSObject);
aSubSO = PublishInStudy(theStudy, aSubSO, aSubO, aSubName.ToCString());
@ -997,9 +1005,11 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr theStudy,
GEOM::ListOfGO_var aSubParts;
if (theFindMethod == GEOM::FSM_GetInPlaceByHistory)
// pass theObject, because only it has the history
aSubParts = RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, theObject, theFindMethod);
aSubParts = RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO,
theObject, theFindMethod, theAddPrefix);
else
aSubParts = RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, aSubO, theFindMethod);
aSubParts = RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO,
aSubO, theFindMethod, theAddPrefix);
// add to parts list
addToListOfGO( aSubParts, aParts );
}
@ -1012,7 +1022,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr theStudy,
// Restore published sub-shapes of the argument
GEOM::ListOfGO_var aSubParts =
RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, theObject, theFindMethod);
RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO,
theObject, theFindMethod, theAddPrefix);
// add to parts list
addToListOfGO( aSubParts, aParts );
@ -1030,7 +1041,10 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr theStudy,
}
if (!CORBA::is_nil(aSubO) && !CORBA::is_nil(aSubSO)) {
// Publish the sub-shape
TCollection_AsciiString aSubName ("from_parts_of_");
TCollection_AsciiString aSubName;
if (theAddPrefix) {
aSubName = "from_parts_of_";
}
aSubName += anArgName;
aSubSO = PublishInStudy(theStudy, aSubSO, aSubO, aSubName.ToCString());
// Restore color
@ -1106,7 +1120,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(SALOMEDS::Study_ptr theStudy,
default:
pd << "FSM_GetInPlaceByHistory"; break;
}
pd << ", " << theInheritFirstArg << ")";
pd << ", " << theInheritFirstArg << ", " << theAddPrefix << ")";
}
aResParts->length(nbRes);
return aResParts._retn();
@ -1120,7 +1134,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr th
SALOMEDS::SObject_ptr theOldSO,
SALOMEDS::SObject_ptr theNewSO,
GEOM::GEOM_Object_ptr theNewO,
GEOM::find_shape_method theFindMethod)
GEOM::find_shape_method theFindMethod,
CORBA::Boolean theAddPrefix)
{
int i = 0;
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
@ -1213,7 +1228,10 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr th
SALOMEDS::SObject_var aNewSubSO;
if (!CORBA::is_nil(theNewSO)) {
// Publish the sub-shape
TCollection_AsciiString aSubName ("from_");
TCollection_AsciiString aSubName;
if (theAddPrefix) {
aSubName = "from_";
}
aSubName += anArgName;
aNewSubSO = aStudyBuilder->NewObject(theNewSO);
aNewSubSO = PublishInStudy(theStudy, aNewSubSO, aNewSubO, aSubName.ToCString());
@ -1224,9 +1242,11 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr th
GEOM::ListOfGO_var aSubParts;
if (theFindMethod == GEOM::FSM_GetInPlaceByHistory)
// pass the main shape as Object, because only it has the history
aSubParts = RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, theNewO, theFindMethod);
aSubParts = RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO,
theNewO, theFindMethod, theAddPrefix);
else
aSubParts = RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, aNewSubO, theFindMethod);
aSubParts = RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO,
aNewSubO, theFindMethod, theAddPrefix);
// add to parts list
addToListOfGO( aSubParts, aNewParts );
}
@ -1237,7 +1257,8 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr th
// Restore published sub-shapes of the argument
GEOM::ListOfGO_var aSubParts =
RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, theNewO, theFindMethod);
RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO,
theNewO, theFindMethod, theAddPrefix);
// add to parts list
addToListOfGO( aSubParts, aNewParts );
@ -1260,7 +1281,10 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr th
// Publish the sub-shape
if (!CORBA::is_nil(aNewSubSO)) {
TCollection_AsciiString aSubName = "from_parts_of_";
TCollection_AsciiString aSubName;
if (theAddPrefix) {
aSubName = "from_parts_of_";
}
aSubName += anArgName;
aNewSubSO = PublishInStudy(theStudy, aNewSubSO, aNewSubO, aSubName.ToCString());
// Restore color

View File

@ -148,7 +148,8 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
GEOM::GEOM_Object_ptr theObject,
const GEOM::ListOfGO& theArgs,
GEOM::find_shape_method theFindMethod,
CORBA::Boolean theInheritFirstArg);
CORBA::Boolean theInheritFirstArg,
CORBA::Boolean theAddPrefix);
/*! \brief Publish sub-shapes, standing for arguments and sub-shapes of arguments.
* To be used from GUI and from geompy.addToStudy
@ -157,7 +158,8 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
SALOMEDS::SObject_ptr theSObject,
const GEOM::ListOfGO& theArgs,
GEOM::find_shape_method theFindMethod,
CORBA::Boolean theInheritFirstArg);
CORBA::Boolean theInheritFirstArg,
CORBA::Boolean theAddPrefix);
//-----------------------------------------------------------------------//
// Transaction methods //
@ -258,14 +260,16 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
SALOMEDS::SObject_ptr theOldSO,
SALOMEDS::SObject_ptr theNewSO,
GEOM::GEOM_Object_ptr theNewO,
GEOM::find_shape_method theFindMethod);
GEOM::find_shape_method theFindMethod,
CORBA::Boolean theAddPrefix);
GEOM::ListOfGO* RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
GEOM::GEOM_Object_ptr theObject,
SALOMEDS::SObject_ptr theSObject,
const GEOM::ListOfGO& theArgs,
GEOM::find_shape_method theFindMethod,
CORBA::Boolean theInheritFirstArg);
CORBA::Boolean theInheritFirstArg,
CORBA::Boolean theAddPrefix);
// auxilary for PublishNamedShapesInStudy
void CreateAndPublishGroup(SALOMEDS::Study_ptr theStudy,

View File

@ -391,14 +391,16 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# operations, where only the first argument has to be considered.
# If theObject has only one argument shape, this flag is automatically
# considered as True, not regarding really passed value.
# \param theAddPrefix add prefix "from_" to names of restored sub-shapes,
# and prefix "from_subshapes_of_" to names of partially restored subshapes.
# \return list of published sub-shapes
#
# @ref tui_restore_prs_params "Example"
def RestoreSubShapes (self, theObject, theArgs=[],
theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
def RestoreSubShapes (self, theObject, theArgs=[], theFindMethod=GEOM.FSM_GetInPlace,
theInheritFirstArg=False, theAddPrefix=True):
# Example: see GEOM_TestAll.py
return self.RestoreSubShapesO(self.myStudy, theObject, theArgs,
theFindMethod, theInheritFirstArg)
theFindMethod, theInheritFirstArg, theAddPrefix)
# end of l3_restore_ss
## @}

View File

@ -438,7 +438,8 @@ void OperationGUI_PartitionDlg::restoreSubShapes( SALOMEDS::Study_ptr theStudy
// empty list of arguments means that all arguments should be restored
getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(),
/*theFindMethod=*/GEOM::FSM_GetInPlaceByHistory,
/*theInheritFirstArg=*/myListShapes.length() == 1 ); // ? false
/*theInheritFirstArg=*/myListShapes.length() == 1,
mainFrame()->CheckBoxAddPrefix->isChecked() ); // ? false
}
}

View File

@ -502,7 +502,8 @@ void RepairGUI_GlueDlg::restoreSubShapes( SALOMEDS::Study_ptr theStudy,
// empty list of arguments means that all arguments should be restored
getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(),
aFindMethod, /*theInheritFirstArg=*/true );
aFindMethod, /*theInheritFirstArg=*/true,
mainFrame()->CheckBoxAddPrefix->isChecked() );
}
}

View File

@ -308,6 +308,7 @@ void RepairGUI_RemoveExtraEdgesDlg::restoreSubShapes( SALOMEDS::Study_ptr theS
// empty list of arguments means that all arguments should be restored
getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(),
/*theFindMethod=*/GEOM::FSM_GetInPlace, // ? GetInPlaceByHistory
/*theInheritFirstArg=*/true );
/*theInheritFirstArg=*/true,
mainFrame()->CheckBoxAddPrefix->isChecked() );
}
}

View File

@ -397,6 +397,7 @@ void RepairGUI_SuppressFacesDlg::restoreSubShapes (SALOMEDS::Study_ptr theStud
// empty list of arguments means that all arguments should be restored
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(),
/*theFindMethod=*/GEOM::FSM_GetInPlace,
/*theInheritFirstArg=*/true);
/*theInheritFirstArg=*/true,
mainFrame()->CheckBoxAddPrefix->isChecked());
}
}

View File

@ -488,7 +488,8 @@ void TransformationGUI_MirrorDlg::restoreSubShapes (SALOMEDS::Study_ptr theStu
// empty list of arguments means that all arguments should be restored
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(),
/*theFindMethod=*/GEOM::FSM_Transformed,
/*theInheritFirstArg=*/true);
/*theInheritFirstArg=*/true,
mainFrame()->CheckBoxAddPrefix->isChecked());
}
}

View File

@ -329,7 +329,8 @@ void TransformationGUI_OffsetDlg::restoreSubShapes( SALOMEDS::Study_ptr theStu
// empty list of arguments means that all arguments should be restored
getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(),
/*theFindMethod=*/GEOM::FSM_Transformed,
/*theInheritFirstArg=*/true );
/*theInheritFirstArg=*/true,
mainFrame()->CheckBoxAddPrefix->isChecked() );
}
}

View File

@ -665,7 +665,8 @@ void TransformationGUI_PositionDlg::restoreSubShapes (SALOMEDS::Study_ptr theS
// empty list of arguments means that all arguments should be restored
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(),
/*theFindMethod=*/GEOM::FSM_Transformed,
/*theInheritFirstArg=*/true);
/*theInheritFirstArg=*/true,
mainFrame()->CheckBoxAddPrefix->isChecked());
}
}

View File

@ -615,7 +615,8 @@ void TransformationGUI_RotationDlg::restoreSubShapes (SALOMEDS::Study_ptr theS
anArgs[0] = myCurrObject;
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs,
/*theFindMethod=*/GEOM::FSM_Transformed,
/*theInheritFirstArg=*/true);
/*theInheritFirstArg=*/true,
mainFrame()->CheckBoxAddPrefix->isChecked());
}
}

View File

@ -567,7 +567,8 @@ void TransformationGUI_ScaleDlg::restoreSubShapes (SALOMEDS::Study_ptr theStud
// empty list of arguments means that all arguments should be restored
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(),
/*theFindMethod=*/GEOM::FSM_Transformed,
/*theInheritFirstArg=*/true);
/*theInheritFirstArg=*/true,
mainFrame()->CheckBoxAddPrefix->isChecked());
}
}

View File

@ -678,7 +678,8 @@ void TransformationGUI_TranslationDlg::restoreSubShapes (SALOMEDS::Study_ptr t
anArgs[0] = myCurrObject;
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs,
/*theFindMethod=*/GEOM::FSM_Transformed,
/*theInheritFirstArg=*/true);
/*theInheritFirstArg=*/true,
mainFrame()->CheckBoxAddPrefix->isChecked());
}
}