NPAL14167: Parameter isTrsf replaced by two: theFindMethod and theInheritFirstArg.

This commit is contained in:
jfa 2008-04-09 12:05:30 +00:00
parent 2129bb2430
commit b6b64d0b19
18 changed files with 404 additions and 276 deletions

View File

@ -76,6 +76,32 @@ module GEOM
ST_ONIN
};
/*!
* Kind of method to find inside one main shape some subshapes,
* corresponding to other given shape (its argument)
* Is used in functions GEOM_Gen.RestoreSubShapes<xxx>()
*/
enum find_shape_method
{
/*! Use GetInPlace functionality. Suits all cases, except transformations */
FSM_GetInPlace,
/*! To be used only for transformation result, to find subshapes of argument.
* Only this method can be used after transformation.
*/
FSM_Transformed,
/*! To find only shared subshapes, not modified by the operation */
FSM_GetSame,
/*! Use GetShapesOnShape method (can work only on solids) */
FSM_GetShapesOnShape,
/*! Use GetInPlaceByHistory method (can work only after Partition) */
FSM_GetInPlaceByHistory
};
typedef sequence<string> string_array;
typedef sequence<short> short_array;
typedef sequence<long> ListOfLong;
@ -2722,35 +2748,36 @@ module GEOM
* \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.
* \param theFindMethod method to search subshapes, corresponding to arguments and
* their subshapes. Value from enumeration GEOM::find_shape_method.
* \param theInheritFirstArg set properties of the first argument for \a theObject.
* Do not publish subshapes in place of arguments, but only
* in place of subshapes of the first argument,
* because the whole shape corresponds to the first argument.
* Mainly to be used after transformations, but it also can be
* usefull after partition with one object shape, and some other
* 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.
* \return True in case of success, False otherwise.
*/
boolean RestoreSubShapesO (in SALOMEDS::Study theStudy,
in GEOM_Object theObject,
in ListOfGO theArgs,
in boolean isTrsf);
in find_shape_method theFindMethod,
in boolean theInheritFirstArg);
/*!
* 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
* To be used from GUI and from geompy.addToStudy.
* Work like the above method, but accepts study object theSObject instead of GEOM_Object.
* \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);
in find_shape_method theFindMethod,
in boolean theInheritFirstArg);
/*!
* Methods to access interfaces for objects creation and transformation

View File

@ -303,7 +303,8 @@ bool BooleanGUI_Dialog::execute( ObjectList& objects )
{
GEOM::GEOM_Object_var anObj;
anObj = GEOM::GEOM_IBooleanOperations::_narrow( getOperation() )->MakeBoolean( myObject1, myObject2, myOperation );
anObj = GEOM::GEOM_IBooleanOperations::_narrow( getOperation() )->
MakeBoolean( myObject1, myObject2, myOperation );
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
@ -319,6 +320,8 @@ void BooleanGUI_Dialog::restoreSubShapes (SALOMEDS::Study_ptr theStudy,
{
if (CheckBoxRestoreSS->isChecked()) {
// empty list of arguments means that all arguments should be restored
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(), /*isTrsf=*/false);
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(),
/*theFindMethod=*/GEOM::FSM_GetInPlace, // ? GEOM::FSM_GetSame
/*theInheritFirstArg=*/myOperation==BooleanGUI::CUT); // ? false
}
}

View File

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

View File

@ -547,7 +547,9 @@ void GEOMBase_Helper::restoreSubShapes (SALOMEDS::Study_ptr /*theStudy*/,
// 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);
// getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs,
// /*theFindMethod=*/GEOM::FSM_GetInPlace,
// /*theInheritFirstArg=*/false);
}
//================================================================

View File

@ -563,14 +563,15 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::AddInStudy (SALOMEDS::Study_ptr theStudy,
}
//============================================================================
// function : RestoreSubShapes
// function : RestoreSubShapesO
// 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)
CORBA::Boolean 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)
{
if (CORBA::is_nil(theStudy) || CORBA::is_nil(theObject))
return false;
@ -581,18 +582,19 @@ CORBA::Boolean GEOM_Gen_i::RestoreSubShapesO (SALOMEDS::Study_ptr theStudy,
if (CORBA::is_nil(aSO))
return false;
return RestoreSubShapes(theStudy, theObject, aSO, theArgs, isTrsf);
return RestoreSubShapes(theStudy, theObject, aSO, theArgs, theFindMethod, theInheritFirstArg);
}
//============================================================================
// function : RestoreSubShapes
// function : RestoreSubShapesSO
// 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)
CORBA::Boolean GEOM_Gen_i::RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy,
SALOMEDS::SObject_ptr theSObject,
const GEOM::ListOfGO& theArgs,
GEOM::find_shape_method theFindMethod,
CORBA::Boolean theInheritFirstArg)
{
if (CORBA::is_nil(theStudy) || CORBA::is_nil(theSObject))
return false;
@ -609,7 +611,7 @@ CORBA::Boolean GEOM_Gen_i::RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy,
if (CORBA::is_nil(anO))
return false;
return RestoreSubShapes(theStudy, anO, theSObject, theArgs, isTrsf);
return RestoreSubShapes(theStudy, anO, theSObject, theArgs, theFindMethod, theInheritFirstArg);
}
//============================================================================
@ -617,20 +619,16 @@ CORBA::Boolean GEOM_Gen_i::RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy,
// 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)
CORBA::Boolean GEOM_Gen_i::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)
{
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;
@ -655,8 +653,8 @@ CORBA::Boolean GEOM_Gen_i::RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
if (aLength < 1)
return false;
if (isTrsf) {
// In case of transformation we do not publish argument's reflection,
if (theInheritFirstArg || (nbArgsActual == 1)) {
// Do not publish argument's reflection,
// but only reconstruct its published sub-shapes
GEOM::GEOM_Object_var anArgO = aList[0];
@ -664,25 +662,17 @@ CORBA::Boolean GEOM_Gen_i::RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
SALOMEDS::SObject_var anArgSO = theStudy->FindObjectIOR(anIOR.in());
GEOM::ListOfGO_var aParts =
RestoreSubShapesOneLevel(theStudy, anArgSO, theSObject, theObject, isTrsf);
RestoreSubShapesOneLevel(theStudy, anArgSO, theSObject, theObject, theFindMethod);
// 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
// Get interface, containing method, 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 arguments and tree of sub-shapes of the arguments
CORBA::String_var anIOR;
@ -703,7 +693,53 @@ CORBA::Boolean GEOM_Gen_i::RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
}
// Find a sub-shape of theObject in place of the argument
GEOM::GEOM_Object_var aSubO = aShapesOp->GetInPlace(theObject, anArgO);
GEOM::GEOM_Object_var aSubO;
switch (theFindMethod) {
case GEOM::FSM_GetInPlace:
{
// Use GetInPlace
aSubO = aShapesOp->GetInPlace(theObject, anArgO);
}
break;
case GEOM::FSM_Transformed:
{
// transformation, cannot use GetInPlace, operate with indices
GEOM::ListOfLong_var anIDs = anArgO->GetSubShapeIndices();
if (anIDs->length() > 1) {
// group
aSubO = aGroupOp->CreateGroup(theObject, aGroupOp->GetType(anArgO));
if (!CORBA::is_nil(aSubO))
aGroupOp->UnionIDs(aSubO, anIDs);
}
else {
// single sub-shape
aSubO = aShapesOp->GetSubShape(theObject, anIDs[0]);
}
}
break;
case GEOM::FSM_GetSame:
{
// Use GetSame
aSubO = aShapesOp->GetSame(theObject, anArgO);
}
break;
case GEOM::FSM_GetShapesOnShape:
{
// Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids
aSubO = aShapesOp->GetShapesOnShapeAsCompound(anArgO, theObject,
(short)GEOM::SOLID, GEOM::ST_ONIN);
}
break;
case GEOM::FSM_GetInPlaceByHistory:
{
// Use GetInPlaceByHistory
aSubO = aShapesOp->GetInPlaceByHistory(theObject, anArgO);
}
break;
default:
{}
}
if (!CORBA::is_nil(aSubO)) {
// Publish the sub-shape
TCollection_AsciiString aSubName ("from_");
@ -715,7 +751,11 @@ CORBA::Boolean GEOM_Gen_i::RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
if (!CORBA::is_nil(anArgSO)) {
// Restore published sub-shapes of the argument
RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, aSubO, isTrsf);
if (theFindMethod == GEOM::FSM_GetInPlaceByHistory)
// pass theObject, because only it has the history
RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, theObject, theFindMethod);
else
RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, aSubO, theFindMethod);
}
}
else { // GetInPlace failed, try to build from published parts
@ -724,7 +764,7 @@ CORBA::Boolean GEOM_Gen_i::RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
// Restore published sub-shapes of the argument
GEOM::ListOfGO_var aParts =
RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, theObject, isTrsf);
RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, theObject, theFindMethod);
if (aParts->length() > 0) {
// try to build an argument from a set of its sub-shapes,
@ -760,11 +800,11 @@ CORBA::Boolean GEOM_Gen_i::RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
// 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)
GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr theStudy,
SALOMEDS::SObject_ptr theOldSO,
SALOMEDS::SObject_ptr theNewSO,
GEOM::GEOM_Object_ptr theNewO,
GEOM::find_shape_method theFindMethod)
{
int i = 0;
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
@ -774,7 +814,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr theS
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
// Get interface, containing method GetInPlace, which we will use to reconstruct sub-shapes
// Get interface, containing method, which we will use to reconstruct sub-shapes
GEOM::GEOM_IShapesOperations_var aShapesOp = GetIShapesOperations(theStudy->StudyId());
GEOM::GEOM_IGroupOperations_var aGroupOp = GetIGroupOperations(theStudy->StudyId());
@ -800,23 +840,50 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr theS
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);
switch (theFindMethod) {
case GEOM::FSM_GetInPlace:
{
// Use GetInPlace
aNewSubO = aShapesOp->GetInPlace(theNewO, anOldSubO);
}
else {
// single sub-shape
aNewSubO = aShapesOp->GetSubShape(theNewO, anIDs[0]);
break;
case GEOM::FSM_Transformed:
{
// 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);
break;
case GEOM::FSM_GetSame:
{
// Use GetSame
aNewSubO = aShapesOp->GetSame(theNewO, anOldSubO);
}
break;
case GEOM::FSM_GetShapesOnShape:
{
// Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids
aNewSubO = aShapesOp->GetShapesOnShapeAsCompound(anOldSubO, theNewO,
(short)GEOM::SOLID, GEOM::ST_ONIN);
}
break;
case GEOM::FSM_GetInPlaceByHistory:
{
// Use GetInPlaceByHistory
aNewSubO = aShapesOp->GetInPlaceByHistory(theNewO, anOldSubO);
}
break;
default:
{}
}
if (!CORBA::is_nil(aNewSubO)) {
@ -833,14 +900,18 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr theS
aNewSubO->SetColor(anOldSubO->GetColor());
// Restore published sub-shapes of the argument
RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, aNewSubO, isTrsf);
if (theFindMethod == GEOM::FSM_GetInPlaceByHistory)
// pass the main shape as Object, because only it has the history
RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, theNewO, theFindMethod);
else
RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, aNewSubO, theFindMethod);
}
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);
RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, theNewO, theFindMethod);
if (aParts->length() > 0) {
// try to build an object from a set of its sub-shapes,

View File

@ -136,18 +136,20 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
/*! \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);
CORBA::Boolean RestoreSubShapesO (SALOMEDS::Study_ptr theStudy,
GEOM::GEOM_Object_ptr theObject,
const GEOM::ListOfGO& theArgs,
GEOM::find_shape_method theFindMethod,
CORBA::Boolean theInheritFirstArg);
/*! \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);
CORBA::Boolean RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy,
SALOMEDS::SObject_ptr theSObject,
const GEOM::ListOfGO& theArgs,
GEOM::find_shape_method theFindMethod,
CORBA::Boolean theInheritFirstArg);
//-----------------------------------------------------------------------//
// Transaction methods //
@ -236,17 +238,18 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
virtual GEOM::GEOM_Object_ptr GetObject(CORBA::Long theStudyID, const char* theEntry);
private:
GEOM::ListOfGO* RestoreSubShapesOneLevel (SALOMEDS::Study_ptr theStudy,
SALOMEDS::SObject_ptr theOldSO,
SALOMEDS::SObject_ptr theNewSO,
GEOM::GEOM_Object_ptr theNewO,
CORBA::Boolean isTrsf);
GEOM::ListOfGO* RestoreSubShapesOneLevel (SALOMEDS::Study_ptr theStudy,
SALOMEDS::SObject_ptr theOldSO,
SALOMEDS::SObject_ptr theNewSO,
GEOM::GEOM_Object_ptr theNewO,
GEOM::find_shape_method theFindMethod);
CORBA::Boolean RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
GEOM::GEOM_Object_ptr theObject,
SALOMEDS::SObject_ptr theSObject,
const GEOM::ListOfGO& theArgs,
CORBA::Boolean isTrsf);
CORBA::Boolean 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);
private:

View File

@ -131,16 +131,18 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# \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
# \param theArgs,theFindMethod,theInheritFirstArg 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,
doRestoreSubShapes=False, theArgs=[], isTrsf=False):
def addToStudy(self, aShape, aName, doRestoreSubShapes=False,
theArgs=[], theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
try:
aSObject = self.AddInStudy(self.myStudy, aShape, aName, None)
if doRestoreSubShapes:
self.RestoreSubShapesSO(self.myStudy, aSObject, theArgs, isTrsf)
self.RestoreSubShapesSO(self.myStudy, aSObject, theArgs,
theFindMethod, theInheritFirstArg)
except:
print "addToStudy() failed"
return ""
@ -164,15 +166,24 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# \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.
# \param theFindMethod method to search subshapes, corresponding to arguments and
# their subshapes. Value from enumeration GEOM::find_shape_method.
# \param theInheritFirstArg set properties of the first argument for \a theObject.
# Do not publish subshapes in place of arguments, but only
# in place of subshapes of the first argument,
# because the whole shape corresponds to the first argument.
# Mainly to be used after transformations, but it also can be
# usefull after partition with one object shape, and some other
# 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.
# \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)
def RestoreSubShapes (self, theObject, theArgs=[],
theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
return self.RestoreSubShapesO(self.myStudy, theObject, theArgs,
theFindMethod, theInheritFirstArg)
# -----------------------------------------------------------------------------
# Basic primitives

View File

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

View File

@ -1,4 +1,4 @@
// GEOM GEOMGUI : GUI for Geometry component
// GEOM RepairGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
@ -87,16 +87,16 @@ RepairGUI_GlueDlg::RepairGUI_GlueDlg(GeometryGUI* theGeometryGUI, QWidget* paren
GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
GroupPoints->PushButton1->setPixmap(image1);
GroupPoints->LineEdit1->setReadOnly( true );
int aWidth = GroupPoints->TextLabel1->sizeHint().width() +
GroupPoints->PushButton1->sizeHint().width() +
int aWidth = GroupPoints->TextLabel1->sizeHint().width() +
GroupPoints->PushButton1->sizeHint().width() +
GroupPoints->getGroupBoxLayout()->spacing();
Layout1->addWidget(GroupPoints, 2, 0);
QHBox* aHBox = new QHBox( GroupPoints->GroupBox1 );
aHBox->setSpacing( 5 );
(new QLabel( tr( "GEOM_TOLERANCE" ), aHBox ))->setFixedWidth( aWidth );
myTolEdt = new QtxDblSpinBox( 0, 100, 1e-7, aHBox );
myTolEdt->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
@ -127,9 +127,9 @@ RepairGUI_GlueDlg::RepairGUI_GlueDlg(GeometryGUI* theGeometryGUI, QWidget* paren
/***************************************************************/
setHelpFileName("glue_faces_operation_page.html");
// Disable second way of gluing if OCC viewer is not active one
if (SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType()
if (myGeomGUI->getApp()->desktop()->activeWindow()->getViewManager()->getType()
!= OCCViewer_Viewer::Type())
RadioButton2->setEnabled(false);
@ -160,6 +160,8 @@ void RepairGUI_GlueDlg::Init()
//myGeomGUI->SetState( 0 );
//globalSelection( GEOM_COMPOUND );
GroupBoxPublish->show();
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
@ -173,7 +175,7 @@ void RepairGUI_GlueDlg::Init()
connect( myTolEdt2, SIGNAL( valueChanged( double ) ), this, SLOT( onTolerChanged( double ) ) );
connect( mySubShapesChk, SIGNAL( stateChanged( int ) ), this, SLOT( onSubShapesChk() ) );
connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) );
connect(myDetectBtn, SIGNAL(clicked()), this, SLOT(onDetect()));
@ -181,7 +183,7 @@ void RepairGUI_GlueDlg::Init()
initName( tr( "GLUE_NEW_OBJ_NAME" ) );
ConstructorsClicked(0);
activateSelection();
updateButtonState();
}
@ -195,9 +197,9 @@ void RepairGUI_GlueDlg::ConstructorsClicked( int constructorId )
{
if ( myCurrConstrId == constructorId )
return;
disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0);
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
switch ( constructorId )
{
case 0:
@ -207,13 +209,13 @@ void RepairGUI_GlueDlg::ConstructorsClicked( int constructorId )
GroupPoints->show();
GroupPoints->LineEdit1->setText( "" );
myEditCurrentArgument = GroupPoints->LineEdit1;
if ( myCurrConstrId >= 0 ) // i.e. it is not initialisation
{
// copy tolerance from previous tolerance field
myTolEdt->setValue( myTolEdt2->value() );
}
break;
}
case 1:
@ -223,7 +225,7 @@ void RepairGUI_GlueDlg::ConstructorsClicked( int constructorId )
GroupPoints2->show();
GroupPoints->LineEdit1->setText("");
myEditCurrentArgument = GroupPoints2->LineEdit1;
if ( myCurrConstrId >= 0 ) // i.e. it is not initialisation
{
// copy tolerance from previous tolerance field
@ -231,23 +233,23 @@ void RepairGUI_GlueDlg::ConstructorsClicked( int constructorId )
mySubShapesChk->setChecked( false );
clearTemporary();
}
break;
}
}
myCurrConstrId = constructorId;
myCurrConstrId = constructorId;
myEditCurrentArgument->setFocus();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
qApp->processEvents();
updateGeometry();
QSize aSize = minimumSizeHint();
resize( width(), aSize.height() );
displayPreview();
updateButtonState();
activateSelection();
@ -298,7 +300,7 @@ void RepairGUI_GlueDlg::SelectionIntoArgument()
updateButtonState();
return;
}
erasePreview();
myEditCurrentArgument->setText("");
myObject = GEOM::GEOM_Object::_nil();
@ -352,7 +354,7 @@ void RepairGUI_GlueDlg::LineEditReturnPressed()
void RepairGUI_GlueDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
connect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
//GroupPoints->LineEdit1->setText("");
@ -375,17 +377,6 @@ void RepairGUI_GlueDlg::enterEvent(QEvent* e)
ActivateThisDialog();
}
//=================================================================================
// function : closeEvent()
// purpose :
//=================================================================================
void RepairGUI_GlueDlg::closeEvent(QCloseEvent* e)
{
//myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e );
}
//=================================================================================
// function : createOperation
// purpose :
@ -441,14 +432,14 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects )
// Get names of selected objects
SALOME_ListIteratorOfListIO it ( selectedIO() );
for (; it.More(); it.Next())
for (; it.More(); it.Next())
selected.insert( it.Value()->getName(), 0 );
// Iterate through result and select objects with names from selection
// ObjectList toRemoveFromEnggine;
ObjectList toGlue;
ObjectList::iterator anIter;
for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter)
for (anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter)
{
if ( selected.contains( myGeomGUI->getApp()->orb()->object_to_string(*anIter) ) )
toGlue.push_back(*anIter);
@ -480,10 +471,27 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects )
return aResult;
}
//=================================================================================
// function : restoreSubShapes
// purpose :
//=================================================================================
void RepairGUI_GlueDlg::restoreSubShapes (SALOMEDS::Study_ptr theStudy,
SALOMEDS::SObject_ptr theSObject)
{
if (CheckBoxRestoreSS->isChecked()) {
GEOM::find_shape_method aFindMethod = GEOM::FSM_GetInPlace;
if (getConstructorId() == 0) // MakeGlueFaces
aFindMethod = GEOM::FSM_GetInPlaceByHistory;
// empty list of arguments means that all arguments should be restored
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(),
aFindMethod, /*theInheritFirstArg=*/true);
}
}
//================================================================
// Function : clearShapeBufferLocal
// Purpose :
// Purpose :
//================================================================
void RepairGUI_GlueDlg::clearShapeBufferLocal( GEOM::GEOM_Object_ptr theObj )
{
@ -508,7 +516,7 @@ void RepairGUI_GlueDlg::clearShapeBufferLocal( GEOM::GEOM_Object_ptr theObj )
if ( anIt->Value()->FindAttribute(anAttr, "AttributeIOR") ) {
_PTR(AttributeIOR) anIOR ( anAttr );
TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() );
myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( asciiIOR );
myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( asciiIOR );
}
}
}
@ -516,7 +524,7 @@ void RepairGUI_GlueDlg::clearShapeBufferLocal( GEOM::GEOM_Object_ptr theObj )
//================================================================
// Function : onAccept
// Purpose : This method should be called from dialog's slots onOk() and onApply()
// It perfroms user input validation, then it
// It perfroms user input validation, then it
// performs a proper operation and manages transactions, etc.
//================================================================
bool RepairGUI_GlueDlg::onAcceptLocal()
@ -527,16 +535,16 @@ bool RepairGUI_GlueDlg::onAcceptLocal()
_PTR(Study) aStudy = getStudy()->studyDS();
bool aLocked = aStudy->GetProperties()->IsLocked();
if ( aLocked )
if ( aLocked )
{
MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked");
SUIT_MessageBox::warn1 ( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()),
SUIT_MessageBox::warn1 ( (QWidget*)(myGeomGUI->getApp()->desktop()),
QObject::tr("WRN_WARNING"), QObject::tr("WRN_STUDY_LOCKED"), QObject::tr("BUT_OK") );
return false;
}
QString msg;
if ( !isValid( msg ) )
if ( !isValid( msg ) )
{
showError( msg );
return false;
@ -544,65 +552,64 @@ bool RepairGUI_GlueDlg::onAcceptLocal()
erasePreview( false );
try
try
{
if ( openCommand() )
if ( openCommand() )
{
SUIT_OverrideCursor wc;
SUIT_Session::session()->activeApplication()->putInfo( "" );
myGeomGUI->getApp()->putInfo( "" );
ObjectList objects;
if ( !execute( objects ) )
{
if ( !execute( objects ) )
{
wc.suspend();
abortCommand();
showError();
}
else
else
{
const int nbObjs = objects.size();
bool withChildren = false;
for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it )
for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it )
{
QString aName("");
QString aName = getNewObjectName();
if ( nbObjs > 1 )
{
aName = strlen( getNewObjectName() ) ? GEOMBase::GetDefaultName( getNewObjectName() ) : GEOMBase::GetDefaultName( getPrefix( *it ) );
if (aName.isEmpty())
aName = getPrefix(*it);
aName = GEOMBase::GetDefaultName(aName);
}
else
else
{
aName = getNewObjectName();
// PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName()
if ( aName.isEmpty() )
if (aName.isEmpty())
aName = GEOMBase::GetDefaultName( getPrefix( *it ) );
}
addInStudy( *it, aName.latin1() );
withChildren = false;
display( *it, false );
}
if ( nbObjs )
if ( nbObjs )
{
commitCommand();
updateObjBrowser();
SUIT_Session::session()->activeApplication()->putInfo( QObject::tr("GEOM_PRP_DONE") );
myGeomGUI->getApp()->putInfo( QObject::tr("GEOM_PRP_DONE") );
}
else
else
{
abortCommand();
}
// JFA 28.12.2004 BEGIN // To enable warnings
if ( !getOperation()->_is_nil() )
if ( !getOperation()->_is_nil() )
{
if ( !getOperation()->IsDone() )
if ( !getOperation()->IsDone() )
{
wc.suspend();
QString msgw = QObject::tr( getOperation()->GetErrorCode() );
SUIT_MessageBox::warn1((QWidget*)(SUIT_Session::session()->activeApplication()->desktop()),
QObject::tr( "WRN_WARNING" ),
msgw,
SUIT_MessageBox::warn1((QWidget*)(myGeomGUI->getApp()->desktop()),
QObject::tr( "WRN_WARNING" ),
msgw,
QObject::tr( "BUT_OK" ));
}
}
@ -610,7 +617,7 @@ bool RepairGUI_GlueDlg::onAcceptLocal()
}
}
}
catch( const SALOME::SALOME_Exception& e )
catch( const SALOME::SALOME_Exception& e )
{
SalomeApp_Tools::QtCatchCorbaException( e );
abortCommand();
@ -643,10 +650,10 @@ void RepairGUI_GlueDlg::onDetect()
GEOM::ListOfGO_var aList = GEOM::GEOM_IShapesOperations::_narrow
( getOperation() )->GetGlueFaces( myObject, myTolEdt2->value() );
for (int i = 0, n = aList->length(); i < n; i++)
for (int i = 0, n = aList->length(); i < n; i++)
myTmpObjs.push_back(GEOM::GEOM_Object::_duplicate(aList[i]));
if ( myTmpObjs.size() > 0 )
{
msg = tr( "FACES_FOR_GLUING_ARE_DETECTED" ).arg( myTmpObjs.size() );
@ -656,9 +663,9 @@ void RepairGUI_GlueDlg::onDetect()
{
msg = tr( "THERE_ARE_NO_FACES_FOR_GLUING" );
}
connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ;
connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) );
SUIT_MessageBox::info1( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, "Close" );
updateButtonState();
activateSelection();
@ -671,40 +678,40 @@ void RepairGUI_GlueDlg::onDetect()
void RepairGUI_GlueDlg::activateSelection()
{
erasePreview(false);
int anId = getConstructorId();
if ( anId == 0 ) // Case of whole gluing
{
disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ;
disconnect( myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()) );
globalSelection( GEOM_ALLSHAPES );
if (myObject->_is_nil())
if (myObject->_is_nil())
SelectionIntoArgument();
connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ;
}
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()) );
}
else // Second case of gluing
{
if ( !mySubShapesChk->isChecked() )
if ( !mySubShapesChk->isChecked() )
globalSelection( GEOM_ALLSHAPES );
else
else
{
displayPreview( true, false, false, 2/*line width*/, 1/*display mode*/, Quantity_NOC_RED );
disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ;
disconnect(myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) );
globalSelection( GEOM_PREVIEW );
connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ;
}
connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) );
}
}
updateViewer();
}
//=================================================================================
// function : updateButtonState
// purpose : Update button state
// purpose : Update button state
//=================================================================================
void RepairGUI_GlueDlg::updateButtonState()
{
@ -776,42 +783,3 @@ void RepairGUI_GlueDlg::ClickOnCancel()
clearTemporary();
GEOMBase_Skeleton::ClickOnCancel();
}
//================================================================
// Function : getEntry
// Purpose :
//================================================================
static string getEntry( GEOM::GEOM_Object_ptr object )
{
SUIT_Session* session = SUIT_Session::session();
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
if ( app )
{
string IOR = app->orb()->object_to_string( object );
if ( IOR != "" )
{
SalomeApp_Study* study = ( SalomeApp_Study* )app->activeStudy();
_PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) );
if ( SO )
return SO->GetID();
}
}
return "";
}

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
@ -52,11 +52,11 @@ protected:
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
private:
void Init();
void enterEvent(QEvent* e);
void closeEvent(QCloseEvent* e);
void initSelection();
void clearTemporary();

View File

@ -1,21 +1,30 @@
//
// 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
// GEOM RepairGUI : 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
//
//
//
// File : RepairGUI_RemoveExtraEdgesDlg.cxx
// Author : Michael Zorin
// Module : GEOM
// $Header:
// $Header$
#include "RepairGUI_RemoveExtraEdgesDlg.h"
@ -28,8 +37,7 @@
#include <TColStd_MapOfInteger.hxx>
#include <qlabel.h>
using namespace std;
#include <qcheckbox.h>
//=================================================================================
// class : RepairGUI_RemoveExtraEdgesDlg()
@ -43,9 +51,10 @@ RepairGUI_RemoveExtraEdgesDlg::RepairGUI_RemoveExtraEdgesDlg(GeometryGUI* theGeo
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_REMOVE_EXTRA_EDGES")));
QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
QPixmap image0(aResMgr->loadPixmap("GEOM",tr("ICON_DLG_REMOVE_EXTRA_EDGES")));
QPixmap image1(aResMgr->loadPixmap("GEOM",tr("ICON_SELECT")));
setCaption(tr("GEOM_REMOVE_EXTRA_EDGES_TITLE"));
/***************************************************************/
@ -62,7 +71,7 @@ RepairGUI_RemoveExtraEdgesDlg::RepairGUI_RemoveExtraEdgesDlg(GeometryGUI* theGeo
Layout1->addWidget(GroupPoints, 2, 0);
/***************************************************************/
setHelpFileName("remove_extra_edges_operation_page.html");
Init();
@ -86,11 +95,13 @@ void RepairGUI_RemoveExtraEdgesDlg::Init()
{
/* init variables */
myEditCurrentArgument = GroupPoints->LineEdit1;
myOkObject = false;
activateSelection();
GroupBoxPublish->show();
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
@ -98,8 +109,8 @@ void RepairGUI_RemoveExtraEdgesDlg::Init()
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
initName( tr( "REMOVE_EXTRA_EDGES_NEW_OBJ_NAME" ) );
}
@ -128,7 +139,7 @@ bool RepairGUI_RemoveExtraEdgesDlg::ClickOnApply()
myEditCurrentArgument->setText("");
myObject = GEOM::GEOM_Object::_nil();
activateSelection();
return true;
@ -144,7 +155,7 @@ void RepairGUI_RemoveExtraEdgesDlg::SelectionIntoArgument()
{
myEditCurrentArgument->setText("");
QString aName;
if(myEditCurrentArgument == GroupPoints->LineEdit1) {
if (IObjectCount() != 1) {
if (myEditCurrentArgument == GroupPoints->LineEdit1)
@ -152,7 +163,7 @@ void RepairGUI_RemoveExtraEdgesDlg::SelectionIntoArgument()
return;
}
}
// nbSel == 1
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_ptr aSelectedObject =
@ -160,7 +171,7 @@ void RepairGUI_RemoveExtraEdgesDlg::SelectionIntoArgument()
if (!testResult)
return;
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
myObject = aSelectedObject;
myOkObject = true;
@ -205,8 +216,8 @@ void RepairGUI_RemoveExtraEdgesDlg::LineEditReturnPressed()
void RepairGUI_RemoveExtraEdgesDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
activateSelection();
}
@ -269,11 +280,26 @@ bool RepairGUI_RemoveExtraEdgesDlg::isValid( QString& msg )
bool RepairGUI_RemoveExtraEdgesDlg::execute( ObjectList& objects )
{
GEOM::GEOM_Object_var anObj;
anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())->RemoveExtraEdges(myObject);
if ( !anObj->_is_nil() )
objects.push_back( anObj._retn() );
return true;
}
//=================================================================================
// function : restoreSubShapes
// purpose :
//=================================================================================
void RepairGUI_RemoveExtraEdgesDlg::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(),
/*theFindMethod=*/GEOM::FSM_GetInPlace, // ? GetInPlaceByHistory
/*theInheritFirstArg=*/true);
}
}

View File

@ -17,7 +17,7 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
@ -49,6 +49,7 @@ protected:
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& objects );
virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
private :
void Init();

View File

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

View File

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

View File

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

View File

@ -513,7 +513,9 @@ void TransformationGUI_RotationDlg::restoreSubShapes (SALOMEDS::Study_ptr theS
{
if (CheckBoxRestoreSS->isChecked()) {
// empty list of arguments means that all arguments should be restored
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(), /*isTrsf=*/true);
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(),
/*theFindMethod=*/GEOM::FSM_Transformed,
/*theInheritFirstArg=*/true);
}
}

View File

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

View File

@ -590,7 +590,9 @@ void TransformationGUI_TranslationDlg::restoreSubShapes (SALOMEDS::Study_ptr t
{
if (CheckBoxRestoreSS->isChecked()) {
// empty list of arguments means that all arguments should be restored
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(), /*isTrsf=*/true);
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(),
/*theFindMethod=*/GEOM::FSM_Transformed,
/*theInheritFirstArg=*/true);
}
}