mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-25 08:50:36 +05:00
NPAL14167: Parameter isTrsf replaced by two: theFindMethod and theInheritFirstArg.
This commit is contained in:
parent
2129bb2430
commit
b6b64d0b19
@ -76,6 +76,32 @@ module GEOM
|
|||||||
ST_ONIN
|
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<string> string_array;
|
||||||
typedef sequence<short> short_array;
|
typedef sequence<short> short_array;
|
||||||
typedef sequence<long> ListOfLong;
|
typedef sequence<long> ListOfLong;
|
||||||
@ -2722,35 +2748,36 @@ module GEOM
|
|||||||
* \param theObject published GEOM object, arguments of which 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.
|
* \param theArgs list of GEOM_Object, operation arguments to be published.
|
||||||
* If this list is empty, all operation arguments will 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
|
* \param theFindMethod method to search subshapes, corresponding to arguments and
|
||||||
* transformation they cannot be found by GetInPlace.
|
* their subshapes. Value from enumeration GEOM::find_shape_method.
|
||||||
* The argument itself is not published in this case,
|
* \param theInheritFirstArg set properties of the first argument for \a theObject.
|
||||||
* because the whole shape corresponds to the argument.
|
* 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.
|
* \return True in case of success, False otherwise.
|
||||||
*/
|
*/
|
||||||
boolean RestoreSubShapesO (in SALOMEDS::Study theStudy,
|
boolean RestoreSubShapesO (in SALOMEDS::Study theStudy,
|
||||||
in GEOM_Object theObject,
|
in GEOM_Object theObject,
|
||||||
in ListOfGO theArgs,
|
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
|
* Publish sub-shapes, standing for arguments and sub-shapes of arguments
|
||||||
* To be used from GUI and from geompy.addToStudy
|
* To be used from GUI and from geompy.addToStudy.
|
||||||
* \param theStudy the study, in which theObject is published already,
|
* Work like the above method, but accepts study object theSObject instead of GEOM_Object.
|
||||||
* and in which the arguments will be published
|
|
||||||
* \param theSObject study object, referencing GEOM object, arguments of which 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,
|
boolean RestoreSubShapesSO (in SALOMEDS::Study theStudy,
|
||||||
in SALOMEDS::SObject theSObject,
|
in SALOMEDS::SObject theSObject,
|
||||||
in ListOfGO theArgs,
|
in ListOfGO theArgs,
|
||||||
in boolean isTrsf);
|
in find_shape_method theFindMethod,
|
||||||
|
in boolean theInheritFirstArg);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Methods to access interfaces for objects creation and transformation
|
* Methods to access interfaces for objects creation and transformation
|
||||||
|
@ -303,7 +303,8 @@ bool BooleanGUI_Dialog::execute( ObjectList& objects )
|
|||||||
{
|
{
|
||||||
GEOM::GEOM_Object_var anObj;
|
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() )
|
if ( !anObj->_is_nil() )
|
||||||
objects.push_back( anObj._retn() );
|
objects.push_back( anObj._retn() );
|
||||||
|
|
||||||
@ -319,6 +320,8 @@ void BooleanGUI_Dialog::restoreSubShapes (SALOMEDS::Study_ptr theStudy,
|
|||||||
{
|
{
|
||||||
if (CheckBoxRestoreSS->isChecked()) {
|
if (CheckBoxRestoreSS->isChecked()) {
|
||||||
// empty list of arguments means that all arguments should be restored
|
// 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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -242,6 +242,8 @@ void BuildGUI_CompoundDlg::restoreSubShapes (SALOMEDS::Study_ptr theStudy,
|
|||||||
{
|
{
|
||||||
if (CheckBoxRestoreSS->isChecked()) {
|
if (CheckBoxRestoreSS->isChecked()) {
|
||||||
// empty list of arguments means that all arguments should be restored
|
// 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -547,7 +547,9 @@ void GEOMBase_Helper::restoreSubShapes (SALOMEDS::Study_ptr /*theStudy*/,
|
|||||||
// example of implementation in particular dialog:
|
// example of implementation in particular dialog:
|
||||||
// GEOM::ListOfGO anArgs;
|
// GEOM::ListOfGO anArgs;
|
||||||
// anArgs.length(0); // empty list means that all arguments should be restored
|
// 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================
|
//================================================================
|
||||||
|
@ -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.
|
// 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)
|
// To be used from python scripts out of geompy.addToStudy (non-default usage)
|
||||||
//============================================================================
|
//============================================================================
|
||||||
CORBA::Boolean GEOM_Gen_i::RestoreSubShapesO (SALOMEDS::Study_ptr theStudy,
|
CORBA::Boolean GEOM_Gen_i::RestoreSubShapesO (SALOMEDS::Study_ptr theStudy,
|
||||||
GEOM::GEOM_Object_ptr theObject,
|
GEOM::GEOM_Object_ptr theObject,
|
||||||
const GEOM::ListOfGO& theArgs,
|
const GEOM::ListOfGO& theArgs,
|
||||||
CORBA::Boolean isTrsf)
|
GEOM::find_shape_method theFindMethod,
|
||||||
|
CORBA::Boolean theInheritFirstArg)
|
||||||
{
|
{
|
||||||
if (CORBA::is_nil(theStudy) || CORBA::is_nil(theObject))
|
if (CORBA::is_nil(theStudy) || CORBA::is_nil(theObject))
|
||||||
return false;
|
return false;
|
||||||
@ -581,18 +582,19 @@ CORBA::Boolean GEOM_Gen_i::RestoreSubShapesO (SALOMEDS::Study_ptr theStudy,
|
|||||||
if (CORBA::is_nil(aSO))
|
if (CORBA::is_nil(aSO))
|
||||||
return false;
|
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.
|
// purpose : Publish sub-shapes, standing for arguments and sub-shapes of arguments.
|
||||||
// To be used from GUI and from geompy.addToStudy
|
// To be used from GUI and from geompy.addToStudy
|
||||||
//============================================================================
|
//============================================================================
|
||||||
CORBA::Boolean GEOM_Gen_i::RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy,
|
CORBA::Boolean GEOM_Gen_i::RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy,
|
||||||
SALOMEDS::SObject_ptr theSObject,
|
SALOMEDS::SObject_ptr theSObject,
|
||||||
const GEOM::ListOfGO& theArgs,
|
const GEOM::ListOfGO& theArgs,
|
||||||
CORBA::Boolean isTrsf)
|
GEOM::find_shape_method theFindMethod,
|
||||||
|
CORBA::Boolean theInheritFirstArg)
|
||||||
{
|
{
|
||||||
if (CORBA::is_nil(theStudy) || CORBA::is_nil(theSObject))
|
if (CORBA::is_nil(theStudy) || CORBA::is_nil(theSObject))
|
||||||
return false;
|
return false;
|
||||||
@ -609,7 +611,7 @@ CORBA::Boolean GEOM_Gen_i::RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy,
|
|||||||
if (CORBA::is_nil(anO))
|
if (CORBA::is_nil(anO))
|
||||||
return false;
|
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
|
// purpose : Private method. Works only if both theObject and theSObject
|
||||||
// are defined, and does not check, if they correspond to each other.
|
// are defined, and does not check, if they correspond to each other.
|
||||||
//============================================================================
|
//============================================================================
|
||||||
CORBA::Boolean GEOM_Gen_i::RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
|
CORBA::Boolean GEOM_Gen_i::RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
|
||||||
GEOM::GEOM_Object_ptr theObject,
|
GEOM::GEOM_Object_ptr theObject,
|
||||||
SALOMEDS::SObject_ptr theSObject,
|
SALOMEDS::SObject_ptr theSObject,
|
||||||
const GEOM::ListOfGO& theArgs,
|
const GEOM::ListOfGO& theArgs,
|
||||||
CORBA::Boolean isTrsf)
|
GEOM::find_shape_method theFindMethod,
|
||||||
|
CORBA::Boolean theInheritFirstArg)
|
||||||
{
|
{
|
||||||
if (CORBA::is_nil(theStudy) || CORBA::is_nil(theObject) || CORBA::is_nil(theSObject))
|
if (CORBA::is_nil(theStudy) || CORBA::is_nil(theObject) || CORBA::is_nil(theSObject))
|
||||||
return false;
|
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
|
// Arguments to be published
|
||||||
GEOM::ListOfGO_var aList;
|
GEOM::ListOfGO_var aList;
|
||||||
|
|
||||||
@ -655,8 +653,8 @@ CORBA::Boolean GEOM_Gen_i::RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
|
|||||||
if (aLength < 1)
|
if (aLength < 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (isTrsf) {
|
if (theInheritFirstArg || (nbArgsActual == 1)) {
|
||||||
// In case of transformation we do not publish argument's reflection,
|
// Do not publish argument's reflection,
|
||||||
// but only reconstruct its published sub-shapes
|
// but only reconstruct its published sub-shapes
|
||||||
|
|
||||||
GEOM::GEOM_Object_var anArgO = aList[0];
|
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());
|
SALOMEDS::SObject_var anArgSO = theStudy->FindObjectIOR(anIOR.in());
|
||||||
|
|
||||||
GEOM::ListOfGO_var aParts =
|
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
|
// set the color of the transformed shape to the color of initial shape
|
||||||
theObject->SetColor(aList[0]->GetColor());
|
theObject->SetColor(aList[0]->GetColor());
|
||||||
|
|
||||||
return (aParts->length() > 0);
|
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_IShapesOperations_var aShapesOp = GetIShapesOperations(theStudy->StudyId());
|
||||||
|
GEOM::GEOM_IGroupOperations_var aGroupOp = GetIGroupOperations(theStudy->StudyId());
|
||||||
|
|
||||||
// Reconstruct arguments and tree of sub-shapes of the arguments
|
// Reconstruct arguments and tree of sub-shapes of the arguments
|
||||||
CORBA::String_var anIOR;
|
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
|
// 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)) {
|
if (!CORBA::is_nil(aSubO)) {
|
||||||
// Publish the sub-shape
|
// Publish the sub-shape
|
||||||
TCollection_AsciiString aSubName ("from_");
|
TCollection_AsciiString aSubName ("from_");
|
||||||
@ -715,7 +751,11 @@ CORBA::Boolean GEOM_Gen_i::RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
|
|||||||
|
|
||||||
if (!CORBA::is_nil(anArgSO)) {
|
if (!CORBA::is_nil(anArgSO)) {
|
||||||
// Restore published sub-shapes of the argument
|
// 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
|
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
|
// Restore published sub-shapes of the argument
|
||||||
GEOM::ListOfGO_var aParts =
|
GEOM::ListOfGO_var aParts =
|
||||||
RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, theObject, isTrsf);
|
RestoreSubShapesOneLevel(theStudy, anArgSO, aSubSO, theObject, theFindMethod);
|
||||||
|
|
||||||
if (aParts->length() > 0) {
|
if (aParts->length() > 0) {
|
||||||
// try to build an argument from a set of its sub-shapes,
|
// 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
|
// function : RestoreSubShapesOneLevel
|
||||||
// purpose : Private method
|
// purpose : Private method
|
||||||
//============================================================================
|
//============================================================================
|
||||||
GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr theStudy,
|
GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr theStudy,
|
||||||
SALOMEDS::SObject_ptr theOldSO,
|
SALOMEDS::SObject_ptr theOldSO,
|
||||||
SALOMEDS::SObject_ptr theNewSO,
|
SALOMEDS::SObject_ptr theNewSO,
|
||||||
GEOM::GEOM_Object_ptr theNewO,
|
GEOM::GEOM_Object_ptr theNewO,
|
||||||
CORBA::Boolean isTrsf)
|
GEOM::find_shape_method theFindMethod)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
GEOM::ListOfGO_var aParts = new GEOM::ListOfGO;
|
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();
|
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_IShapesOperations_var aShapesOp = GetIShapesOperations(theStudy->StudyId());
|
||||||
GEOM::GEOM_IGroupOperations_var aGroupOp = GetIGroupOperations(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)) {
|
if (!CORBA::is_nil(anOldSubO)) {
|
||||||
// Find a sub-shape of theNewO in place of anOldSubO
|
// Find a sub-shape of theNewO in place of anOldSubO
|
||||||
GEOM::GEOM_Object_var aNewSubO;
|
GEOM::GEOM_Object_var aNewSubO;
|
||||||
if (isTrsf) {
|
switch (theFindMethod) {
|
||||||
// transformation, cannot use GetInPlace, operate with indices
|
case GEOM::FSM_GetInPlace:
|
||||||
GEOM::ListOfLong_var anIDs = anOldSubO->GetSubShapeIndices();
|
{
|
||||||
if (anIDs->length() > 1) {
|
// Use GetInPlace
|
||||||
// group
|
aNewSubO = aShapesOp->GetInPlace(theNewO, anOldSubO);
|
||||||
aNewSubO = aGroupOp->CreateGroup(theNewO, aGroupOp->GetType(anOldSubO));
|
|
||||||
if (!CORBA::is_nil(aNewSubO))
|
|
||||||
aGroupOp->UnionIDs(aNewSubO, anIDs);
|
|
||||||
}
|
}
|
||||||
else {
|
break;
|
||||||
// single sub-shape
|
case GEOM::FSM_Transformed:
|
||||||
aNewSubO = aShapesOp->GetSubShape(theNewO, anIDs[0]);
|
{
|
||||||
|
// 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]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
else {
|
case GEOM::FSM_GetSame:
|
||||||
// not a transformation, so use GetInPlace
|
{
|
||||||
aNewSubO = aShapesOp->GetInPlace(theNewO, anOldSubO);
|
// 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)) {
|
if (!CORBA::is_nil(aNewSubO)) {
|
||||||
@ -833,14 +900,18 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr theS
|
|||||||
aNewSubO->SetColor(anOldSubO->GetColor());
|
aNewSubO->SetColor(anOldSubO->GetColor());
|
||||||
|
|
||||||
// Restore published sub-shapes of the argument
|
// 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
|
else { // GetInPlace failed, try to build from published parts
|
||||||
SALOMEDS::SObject_var aNewSubSO = aStudyBuilder->NewObject(theNewSO);
|
SALOMEDS::SObject_var aNewSubSO = aStudyBuilder->NewObject(theNewSO);
|
||||||
|
|
||||||
// Restore published sub-shapes of the argument
|
// Restore published sub-shapes of the argument
|
||||||
GEOM::ListOfGO_var aParts =
|
GEOM::ListOfGO_var aParts =
|
||||||
RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, theNewO, isTrsf);
|
RestoreSubShapesOneLevel(theStudy, anOldSubSO, aNewSubSO, theNewO, theFindMethod);
|
||||||
|
|
||||||
if (aParts->length() > 0) {
|
if (aParts->length() > 0) {
|
||||||
// try to build an object from a set of its sub-shapes,
|
// try to build an object from a set of its sub-shapes,
|
||||||
|
@ -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.
|
/*! \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)
|
* To be used from python scripts out of geompy.addToStudy (non-default usage)
|
||||||
*/
|
*/
|
||||||
CORBA::Boolean RestoreSubShapesO (SALOMEDS::Study_ptr theStudy,
|
CORBA::Boolean RestoreSubShapesO (SALOMEDS::Study_ptr theStudy,
|
||||||
GEOM::GEOM_Object_ptr theObject,
|
GEOM::GEOM_Object_ptr theObject,
|
||||||
const GEOM::ListOfGO& theArgs,
|
const GEOM::ListOfGO& theArgs,
|
||||||
CORBA::Boolean isTrsf);
|
GEOM::find_shape_method theFindMethod,
|
||||||
|
CORBA::Boolean theInheritFirstArg);
|
||||||
|
|
||||||
/*! \brief Publish sub-shapes, standing for arguments and sub-shapes of arguments.
|
/*! \brief Publish sub-shapes, standing for arguments and sub-shapes of arguments.
|
||||||
* To be used from GUI and from geompy.addToStudy
|
* To be used from GUI and from geompy.addToStudy
|
||||||
*/
|
*/
|
||||||
CORBA::Boolean RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy,
|
CORBA::Boolean RestoreSubShapesSO (SALOMEDS::Study_ptr theStudy,
|
||||||
SALOMEDS::SObject_ptr theSObject,
|
SALOMEDS::SObject_ptr theSObject,
|
||||||
const GEOM::ListOfGO& theArgs,
|
const GEOM::ListOfGO& theArgs,
|
||||||
CORBA::Boolean isTrsf);
|
GEOM::find_shape_method theFindMethod,
|
||||||
|
CORBA::Boolean theInheritFirstArg);
|
||||||
|
|
||||||
//-----------------------------------------------------------------------//
|
//-----------------------------------------------------------------------//
|
||||||
// Transaction methods //
|
// 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);
|
virtual GEOM::GEOM_Object_ptr GetObject(CORBA::Long theStudyID, const char* theEntry);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GEOM::ListOfGO* RestoreSubShapesOneLevel (SALOMEDS::Study_ptr theStudy,
|
GEOM::ListOfGO* RestoreSubShapesOneLevel (SALOMEDS::Study_ptr theStudy,
|
||||||
SALOMEDS::SObject_ptr theOldSO,
|
SALOMEDS::SObject_ptr theOldSO,
|
||||||
SALOMEDS::SObject_ptr theNewSO,
|
SALOMEDS::SObject_ptr theNewSO,
|
||||||
GEOM::GEOM_Object_ptr theNewO,
|
GEOM::GEOM_Object_ptr theNewO,
|
||||||
CORBA::Boolean isTrsf);
|
GEOM::find_shape_method theFindMethod);
|
||||||
|
|
||||||
CORBA::Boolean RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
|
CORBA::Boolean RestoreSubShapes (SALOMEDS::Study_ptr theStudy,
|
||||||
GEOM::GEOM_Object_ptr theObject,
|
GEOM::GEOM_Object_ptr theObject,
|
||||||
SALOMEDS::SObject_ptr theSObject,
|
SALOMEDS::SObject_ptr theSObject,
|
||||||
const GEOM::ListOfGO& theArgs,
|
const GEOM::ListOfGO& theArgs,
|
||||||
CORBA::Boolean isTrsf);
|
GEOM::find_shape_method theFindMethod,
|
||||||
|
CORBA::Boolean theInheritFirstArg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -131,16 +131,18 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
|||||||
# \param doRestoreSubShapes if True, finds and publishes also
|
# \param doRestoreSubShapes if True, finds and publishes also
|
||||||
# sub-shapes of \a aShape, corresponding to its arguments
|
# sub-shapes of \a aShape, corresponding to its arguments
|
||||||
# and published sub-shapes of 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
|
# \return study entry of the published shape in form of string
|
||||||
#
|
#
|
||||||
# Example: see GEOM_TestAll.py
|
# Example: see GEOM_TestAll.py
|
||||||
def addToStudy(self, aShape, aName,
|
def addToStudy(self, aShape, aName, doRestoreSubShapes=False,
|
||||||
doRestoreSubShapes=False, theArgs=[], isTrsf=False):
|
theArgs=[], theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
|
||||||
try:
|
try:
|
||||||
aSObject = self.AddInStudy(self.myStudy, aShape, aName, None)
|
aSObject = self.AddInStudy(self.myStudy, aShape, aName, None)
|
||||||
if doRestoreSubShapes:
|
if doRestoreSubShapes:
|
||||||
self.RestoreSubShapesSO(self.myStudy, aSObject, theArgs, isTrsf)
|
self.RestoreSubShapesSO(self.myStudy, aSObject, theArgs,
|
||||||
|
theFindMethod, theInheritFirstArg)
|
||||||
except:
|
except:
|
||||||
print "addToStudy() failed"
|
print "addToStudy() failed"
|
||||||
return ""
|
return ""
|
||||||
@ -164,15 +166,24 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
|||||||
# \param theObject published GEOM object, arguments of which 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.
|
# \param theArgs list of GEOM_Object, operation arguments to be published.
|
||||||
# If this list is empty, all operation arguments will 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
|
# \param theFindMethod method to search subshapes, corresponding to arguments and
|
||||||
# transformation they cannot be found by GetInPlace.
|
# their subshapes. Value from enumeration GEOM::find_shape_method.
|
||||||
# The argument itself is not published in this case,
|
# \param theInheritFirstArg set properties of the first argument for \a theObject.
|
||||||
# because the whole shape corresponds to the argument.
|
# 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.
|
# \return True in case of success, False otherwise.
|
||||||
#
|
#
|
||||||
# Example: see GEOM_TestAll.py
|
# Example: see GEOM_TestAll.py
|
||||||
def RestoreSubShapes (self, theObject, theArgs=[], isTrsf=False):
|
def RestoreSubShapes (self, theObject, theArgs=[],
|
||||||
return self.RestoreSubShapesO(self.myStudy, theObject, theArgs, isTrsf)
|
theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
|
||||||
|
return self.RestoreSubShapesO(self.myStudy, theObject, theArgs,
|
||||||
|
theFindMethod, theInheritFirstArg)
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Basic primitives
|
# Basic primitives
|
||||||
|
@ -399,7 +399,9 @@ void OperationGUI_PartitionDlg::restoreSubShapes (SALOMEDS::Study_ptr theStudy
|
|||||||
{
|
{
|
||||||
if (CheckBoxRestoreSS->isChecked()) {
|
if (CheckBoxRestoreSS->isChecked()) {
|
||||||
// empty list of arguments means that all arguments should be restored
|
// 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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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,
|
// 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
|
||||||
@ -17,7 +17,7 @@
|
|||||||
// License along with this library; if not, write to the Free Software
|
// License along with this library; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// 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->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
|
||||||
GroupPoints->PushButton1->setPixmap(image1);
|
GroupPoints->PushButton1->setPixmap(image1);
|
||||||
GroupPoints->LineEdit1->setReadOnly( true );
|
GroupPoints->LineEdit1->setReadOnly( true );
|
||||||
|
|
||||||
int aWidth = GroupPoints->TextLabel1->sizeHint().width() +
|
int aWidth = GroupPoints->TextLabel1->sizeHint().width() +
|
||||||
GroupPoints->PushButton1->sizeHint().width() +
|
GroupPoints->PushButton1->sizeHint().width() +
|
||||||
GroupPoints->getGroupBoxLayout()->spacing();
|
GroupPoints->getGroupBoxLayout()->spacing();
|
||||||
|
|
||||||
Layout1->addWidget(GroupPoints, 2, 0);
|
Layout1->addWidget(GroupPoints, 2, 0);
|
||||||
|
|
||||||
QHBox* aHBox = new QHBox( GroupPoints->GroupBox1 );
|
QHBox* aHBox = new QHBox( GroupPoints->GroupBox1 );
|
||||||
aHBox->setSpacing( 5 );
|
aHBox->setSpacing( 5 );
|
||||||
|
|
||||||
(new QLabel( tr( "GEOM_TOLERANCE" ), aHBox ))->setFixedWidth( aWidth );
|
(new QLabel( tr( "GEOM_TOLERANCE" ), aHBox ))->setFixedWidth( aWidth );
|
||||||
myTolEdt = new QtxDblSpinBox( 0, 100, 1e-7, aHBox );
|
myTolEdt = new QtxDblSpinBox( 0, 100, 1e-7, aHBox );
|
||||||
myTolEdt->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
|
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");
|
setHelpFileName("glue_faces_operation_page.html");
|
||||||
|
|
||||||
// Disable second way of gluing if OCC viewer is not active one
|
// 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())
|
!= OCCViewer_Viewer::Type())
|
||||||
RadioButton2->setEnabled(false);
|
RadioButton2->setEnabled(false);
|
||||||
|
|
||||||
@ -160,6 +160,8 @@ void RepairGUI_GlueDlg::Init()
|
|||||||
//myGeomGUI->SetState( 0 );
|
//myGeomGUI->SetState( 0 );
|
||||||
//globalSelection( GEOM_COMPOUND );
|
//globalSelection( GEOM_COMPOUND );
|
||||||
|
|
||||||
|
GroupBoxPublish->show();
|
||||||
|
|
||||||
/* signals and slots connections */
|
/* signals and slots connections */
|
||||||
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||||
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
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( myTolEdt2, SIGNAL( valueChanged( double ) ), this, SLOT( onTolerChanged( double ) ) );
|
||||||
connect( mySubShapesChk, SIGNAL( stateChanged( int ) ), this, SLOT( onSubShapesChk() ) );
|
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()) );
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) );
|
||||||
|
|
||||||
connect(myDetectBtn, SIGNAL(clicked()), this, SLOT(onDetect()));
|
connect(myDetectBtn, SIGNAL(clicked()), this, SLOT(onDetect()));
|
||||||
@ -181,7 +183,7 @@ void RepairGUI_GlueDlg::Init()
|
|||||||
initName( tr( "GLUE_NEW_OBJ_NAME" ) );
|
initName( tr( "GLUE_NEW_OBJ_NAME" ) );
|
||||||
|
|
||||||
ConstructorsClicked(0);
|
ConstructorsClicked(0);
|
||||||
|
|
||||||
activateSelection();
|
activateSelection();
|
||||||
updateButtonState();
|
updateButtonState();
|
||||||
}
|
}
|
||||||
@ -195,9 +197,9 @@ void RepairGUI_GlueDlg::ConstructorsClicked( int constructorId )
|
|||||||
{
|
{
|
||||||
if ( myCurrConstrId == constructorId )
|
if ( myCurrConstrId == constructorId )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 0, this, 0);
|
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||||
|
|
||||||
switch ( constructorId )
|
switch ( constructorId )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@ -207,13 +209,13 @@ void RepairGUI_GlueDlg::ConstructorsClicked( int constructorId )
|
|||||||
GroupPoints->show();
|
GroupPoints->show();
|
||||||
GroupPoints->LineEdit1->setText( "" );
|
GroupPoints->LineEdit1->setText( "" );
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
|
|
||||||
if ( myCurrConstrId >= 0 ) // i.e. it is not initialisation
|
if ( myCurrConstrId >= 0 ) // i.e. it is not initialisation
|
||||||
{
|
{
|
||||||
// copy tolerance from previous tolerance field
|
// copy tolerance from previous tolerance field
|
||||||
myTolEdt->setValue( myTolEdt2->value() );
|
myTolEdt->setValue( myTolEdt2->value() );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
@ -223,7 +225,7 @@ void RepairGUI_GlueDlg::ConstructorsClicked( int constructorId )
|
|||||||
GroupPoints2->show();
|
GroupPoints2->show();
|
||||||
GroupPoints->LineEdit1->setText("");
|
GroupPoints->LineEdit1->setText("");
|
||||||
myEditCurrentArgument = GroupPoints2->LineEdit1;
|
myEditCurrentArgument = GroupPoints2->LineEdit1;
|
||||||
|
|
||||||
if ( myCurrConstrId >= 0 ) // i.e. it is not initialisation
|
if ( myCurrConstrId >= 0 ) // i.e. it is not initialisation
|
||||||
{
|
{
|
||||||
// copy tolerance from previous tolerance field
|
// copy tolerance from previous tolerance field
|
||||||
@ -231,23 +233,23 @@ void RepairGUI_GlueDlg::ConstructorsClicked( int constructorId )
|
|||||||
mySubShapesChk->setChecked( false );
|
mySubShapesChk->setChecked( false );
|
||||||
clearTemporary();
|
clearTemporary();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
myCurrConstrId = constructorId;
|
myCurrConstrId = constructorId;
|
||||||
|
|
||||||
myEditCurrentArgument->setFocus();
|
myEditCurrentArgument->setFocus();
|
||||||
|
|
||||||
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
connect(myGeomGUI->getApp()->selectionMgr(),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
QSize aSize = minimumSizeHint();
|
QSize aSize = minimumSizeHint();
|
||||||
resize( width(), aSize.height() );
|
resize( width(), aSize.height() );
|
||||||
|
|
||||||
displayPreview();
|
displayPreview();
|
||||||
updateButtonState();
|
updateButtonState();
|
||||||
activateSelection();
|
activateSelection();
|
||||||
@ -298,7 +300,7 @@ void RepairGUI_GlueDlg::SelectionIntoArgument()
|
|||||||
updateButtonState();
|
updateButtonState();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
erasePreview();
|
erasePreview();
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
myObject = GEOM::GEOM_Object::_nil();
|
myObject = GEOM::GEOM_Object::_nil();
|
||||||
@ -352,7 +354,7 @@ void RepairGUI_GlueDlg::LineEditReturnPressed()
|
|||||||
void RepairGUI_GlueDlg::ActivateThisDialog()
|
void RepairGUI_GlueDlg::ActivateThisDialog()
|
||||||
{
|
{
|
||||||
GEOMBase_Skeleton::ActivateThisDialog();
|
GEOMBase_Skeleton::ActivateThisDialog();
|
||||||
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
connect(myGeomGUI->getApp()->selectionMgr(),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
//GroupPoints->LineEdit1->setText("");
|
//GroupPoints->LineEdit1->setText("");
|
||||||
@ -375,17 +377,6 @@ void RepairGUI_GlueDlg::enterEvent(QEvent* e)
|
|||||||
ActivateThisDialog();
|
ActivateThisDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : closeEvent()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void RepairGUI_GlueDlg::closeEvent(QCloseEvent* e)
|
|
||||||
{
|
|
||||||
//myGeomGUI->SetState( -1 );
|
|
||||||
GEOMBase_Skeleton::closeEvent( e );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : createOperation
|
// function : createOperation
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -441,14 +432,14 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects )
|
|||||||
|
|
||||||
// Get names of selected objects
|
// Get names of selected objects
|
||||||
SALOME_ListIteratorOfListIO it ( selectedIO() );
|
SALOME_ListIteratorOfListIO it ( selectedIO() );
|
||||||
for (; it.More(); it.Next())
|
for (; it.More(); it.Next())
|
||||||
selected.insert( it.Value()->getName(), 0 );
|
selected.insert( it.Value()->getName(), 0 );
|
||||||
|
|
||||||
// Iterate through result and select objects with names from selection
|
// Iterate through result and select objects with names from selection
|
||||||
// ObjectList toRemoveFromEnggine;
|
// ObjectList toRemoveFromEnggine;
|
||||||
ObjectList toGlue;
|
ObjectList toGlue;
|
||||||
ObjectList::iterator anIter;
|
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) ) )
|
if ( selected.contains( myGeomGUI->getApp()->orb()->object_to_string(*anIter) ) )
|
||||||
toGlue.push_back(*anIter);
|
toGlue.push_back(*anIter);
|
||||||
@ -480,10 +471,27 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects )
|
|||||||
return aResult;
|
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
|
// Function : clearShapeBufferLocal
|
||||||
// Purpose :
|
// Purpose :
|
||||||
//================================================================
|
//================================================================
|
||||||
void RepairGUI_GlueDlg::clearShapeBufferLocal( GEOM::GEOM_Object_ptr theObj )
|
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") ) {
|
if ( anIt->Value()->FindAttribute(anAttr, "AttributeIOR") ) {
|
||||||
_PTR(AttributeIOR) anIOR ( anAttr );
|
_PTR(AttributeIOR) anIOR ( anAttr );
|
||||||
TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() );
|
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
|
// Function : onAccept
|
||||||
// Purpose : This method should be called from dialog's slots onOk() and onApply()
|
// 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.
|
// performs a proper operation and manages transactions, etc.
|
||||||
//================================================================
|
//================================================================
|
||||||
bool RepairGUI_GlueDlg::onAcceptLocal()
|
bool RepairGUI_GlueDlg::onAcceptLocal()
|
||||||
@ -527,16 +535,16 @@ bool RepairGUI_GlueDlg::onAcceptLocal()
|
|||||||
_PTR(Study) aStudy = getStudy()->studyDS();
|
_PTR(Study) aStudy = getStudy()->studyDS();
|
||||||
|
|
||||||
bool aLocked = aStudy->GetProperties()->IsLocked();
|
bool aLocked = aStudy->GetProperties()->IsLocked();
|
||||||
if ( aLocked )
|
if ( aLocked )
|
||||||
{
|
{
|
||||||
MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked");
|
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") );
|
QObject::tr("WRN_WARNING"), QObject::tr("WRN_STUDY_LOCKED"), QObject::tr("BUT_OK") );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString msg;
|
QString msg;
|
||||||
if ( !isValid( msg ) )
|
if ( !isValid( msg ) )
|
||||||
{
|
{
|
||||||
showError( msg );
|
showError( msg );
|
||||||
return false;
|
return false;
|
||||||
@ -544,65 +552,64 @@ bool RepairGUI_GlueDlg::onAcceptLocal()
|
|||||||
|
|
||||||
erasePreview( false );
|
erasePreview( false );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ( openCommand() )
|
if ( openCommand() )
|
||||||
{
|
{
|
||||||
SUIT_OverrideCursor wc;
|
SUIT_OverrideCursor wc;
|
||||||
|
|
||||||
SUIT_Session::session()->activeApplication()->putInfo( "" );
|
myGeomGUI->getApp()->putInfo( "" );
|
||||||
ObjectList objects;
|
ObjectList objects;
|
||||||
|
|
||||||
if ( !execute( objects ) )
|
if ( !execute( objects ) )
|
||||||
{
|
{
|
||||||
wc.suspend();
|
wc.suspend();
|
||||||
abortCommand();
|
abortCommand();
|
||||||
showError();
|
showError();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const int nbObjs = objects.size();
|
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 )
|
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()
|
// PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName()
|
||||||
if ( aName.isEmpty() )
|
if (aName.isEmpty())
|
||||||
aName = GEOMBase::GetDefaultName( getPrefix( *it ) );
|
aName = GEOMBase::GetDefaultName( getPrefix( *it ) );
|
||||||
}
|
}
|
||||||
addInStudy( *it, aName.latin1() );
|
addInStudy( *it, aName.latin1() );
|
||||||
withChildren = false;
|
|
||||||
display( *it, false );
|
display( *it, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( nbObjs )
|
if ( nbObjs )
|
||||||
{
|
{
|
||||||
commitCommand();
|
commitCommand();
|
||||||
updateObjBrowser();
|
updateObjBrowser();
|
||||||
SUIT_Session::session()->activeApplication()->putInfo( QObject::tr("GEOM_PRP_DONE") );
|
myGeomGUI->getApp()->putInfo( QObject::tr("GEOM_PRP_DONE") );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
abortCommand();
|
abortCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
// JFA 28.12.2004 BEGIN // To enable warnings
|
// JFA 28.12.2004 BEGIN // To enable warnings
|
||||||
if ( !getOperation()->_is_nil() )
|
if ( !getOperation()->_is_nil() )
|
||||||
{
|
{
|
||||||
if ( !getOperation()->IsDone() )
|
if ( !getOperation()->IsDone() )
|
||||||
{
|
{
|
||||||
wc.suspend();
|
wc.suspend();
|
||||||
QString msgw = QObject::tr( getOperation()->GetErrorCode() );
|
QString msgw = QObject::tr( getOperation()->GetErrorCode() );
|
||||||
SUIT_MessageBox::warn1((QWidget*)(SUIT_Session::session()->activeApplication()->desktop()),
|
SUIT_MessageBox::warn1((QWidget*)(myGeomGUI->getApp()->desktop()),
|
||||||
QObject::tr( "WRN_WARNING" ),
|
QObject::tr( "WRN_WARNING" ),
|
||||||
msgw,
|
msgw,
|
||||||
QObject::tr( "BUT_OK" ));
|
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 );
|
SalomeApp_Tools::QtCatchCorbaException( e );
|
||||||
abortCommand();
|
abortCommand();
|
||||||
@ -643,10 +650,10 @@ void RepairGUI_GlueDlg::onDetect()
|
|||||||
|
|
||||||
GEOM::ListOfGO_var aList = GEOM::GEOM_IShapesOperations::_narrow
|
GEOM::ListOfGO_var aList = GEOM::GEOM_IShapesOperations::_narrow
|
||||||
( getOperation() )->GetGlueFaces( myObject, myTolEdt2->value() );
|
( 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]));
|
myTmpObjs.push_back(GEOM::GEOM_Object::_duplicate(aList[i]));
|
||||||
|
|
||||||
if ( myTmpObjs.size() > 0 )
|
if ( myTmpObjs.size() > 0 )
|
||||||
{
|
{
|
||||||
msg = tr( "FACES_FOR_GLUING_ARE_DETECTED" ).arg( myTmpObjs.size() );
|
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" );
|
msg = tr( "THERE_ARE_NO_FACES_FOR_GLUING" );
|
||||||
}
|
}
|
||||||
|
|
||||||
connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ;
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) );
|
||||||
SUIT_MessageBox::info1( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, "Close" );
|
SUIT_MessageBox::info1( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, "Close" );
|
||||||
updateButtonState();
|
updateButtonState();
|
||||||
activateSelection();
|
activateSelection();
|
||||||
@ -671,40 +678,40 @@ void RepairGUI_GlueDlg::onDetect()
|
|||||||
void RepairGUI_GlueDlg::activateSelection()
|
void RepairGUI_GlueDlg::activateSelection()
|
||||||
{
|
{
|
||||||
erasePreview(false);
|
erasePreview(false);
|
||||||
|
|
||||||
int anId = getConstructorId();
|
int anId = getConstructorId();
|
||||||
if ( anId == 0 ) // Case of whole gluing
|
if ( anId == 0 ) // Case of whole gluing
|
||||||
{
|
{
|
||||||
disconnect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
disconnect( myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ;
|
this, SLOT(SelectionIntoArgument()) );
|
||||||
|
|
||||||
globalSelection( GEOM_ALLSHAPES );
|
globalSelection( GEOM_ALLSHAPES );
|
||||||
if (myObject->_is_nil())
|
if (myObject->_is_nil())
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
|
|
||||||
connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ;
|
this, SLOT(SelectionIntoArgument()) );
|
||||||
}
|
}
|
||||||
else // Second case of gluing
|
else // Second case of gluing
|
||||||
{
|
{
|
||||||
if ( !mySubShapesChk->isChecked() )
|
if ( !mySubShapesChk->isChecked() )
|
||||||
globalSelection( GEOM_ALLSHAPES );
|
globalSelection( GEOM_ALLSHAPES );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
displayPreview( true, false, false, 2/*line width*/, 1/*display mode*/, Quantity_NOC_RED );
|
displayPreview( true, false, false, 2/*line width*/, 1/*display mode*/, Quantity_NOC_RED );
|
||||||
disconnect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
disconnect(myGeomGUI->getApp()->selectionMgr(),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ;
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) );
|
||||||
globalSelection( GEOM_PREVIEW );
|
globalSelection( GEOM_PREVIEW );
|
||||||
connect( ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) ) ;
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateViewer();
|
updateViewer();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : updateButtonState
|
// function : updateButtonState
|
||||||
// purpose : Update button state
|
// purpose : Update button state
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void RepairGUI_GlueDlg::updateButtonState()
|
void RepairGUI_GlueDlg::updateButtonState()
|
||||||
{
|
{
|
||||||
@ -776,42 +783,3 @@ void RepairGUI_GlueDlg::ClickOnCancel()
|
|||||||
clearTemporary();
|
clearTemporary();
|
||||||
GEOMBase_Skeleton::ClickOnCancel();
|
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 "";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
// License along with this library; if not, write to the Free Software
|
// License along with this library; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// 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 GEOM::GEOM_IOperations_ptr createOperation();
|
||||||
virtual bool isValid( QString& );
|
virtual bool isValid( QString& );
|
||||||
virtual bool execute( ObjectList& objects );
|
virtual bool execute( ObjectList& objects );
|
||||||
|
virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Init();
|
void Init();
|
||||||
void enterEvent(QEvent* e);
|
void enterEvent(QEvent* e);
|
||||||
void closeEvent(QCloseEvent* e);
|
|
||||||
void initSelection();
|
void initSelection();
|
||||||
|
|
||||||
void clearTemporary();
|
void clearTemporary();
|
||||||
|
@ -1,21 +1,30 @@
|
|||||||
//
|
// GEOM RepairGUI : GUI for Geometry component
|
||||||
// This library is distributed in the hope that it will be useful,
|
//
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||||
// Lesser General Public License for more details.
|
//
|
||||||
//
|
// This library is free software; you can redistribute it and/or
|
||||||
// You should have received a copy of the GNU Lesser General Public
|
// modify it under the terms of the GNU Lesser General Public
|
||||||
// License along with this library; if not, write to the Free Software
|
// License as published by the Free Software Foundation; either
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// version 2.1 of the License.
|
||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// 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
|
// File : RepairGUI_RemoveExtraEdgesDlg.cxx
|
||||||
// Author : Michael Zorin
|
// Author : Michael Zorin
|
||||||
// Module : GEOM
|
// Module : GEOM
|
||||||
// $Header:
|
// $Header$
|
||||||
|
|
||||||
#include "RepairGUI_RemoveExtraEdgesDlg.h"
|
#include "RepairGUI_RemoveExtraEdgesDlg.h"
|
||||||
|
|
||||||
@ -28,8 +37,7 @@
|
|||||||
#include <TColStd_MapOfInteger.hxx>
|
#include <TColStd_MapOfInteger.hxx>
|
||||||
|
|
||||||
#include <qlabel.h>
|
#include <qlabel.h>
|
||||||
|
#include <qcheckbox.h>
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : RepairGUI_RemoveExtraEdgesDlg()
|
// class : RepairGUI_RemoveExtraEdgesDlg()
|
||||||
@ -43,9 +51,10 @@ RepairGUI_RemoveExtraEdgesDlg::RepairGUI_RemoveExtraEdgesDlg(GeometryGUI* theGeo
|
|||||||
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
|
:GEOMBase_Skeleton(theGeometryGUI, parent, name, modal, WStyle_Customize |
|
||||||
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
|
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
|
||||||
{
|
{
|
||||||
QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_REMOVE_EXTRA_EDGES")));
|
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
|
||||||
QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
|
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"));
|
setCaption(tr("GEOM_REMOVE_EXTRA_EDGES_TITLE"));
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
@ -62,7 +71,7 @@ RepairGUI_RemoveExtraEdgesDlg::RepairGUI_RemoveExtraEdgesDlg(GeometryGUI* theGeo
|
|||||||
|
|
||||||
Layout1->addWidget(GroupPoints, 2, 0);
|
Layout1->addWidget(GroupPoints, 2, 0);
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
setHelpFileName("remove_extra_edges_operation_page.html");
|
setHelpFileName("remove_extra_edges_operation_page.html");
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
@ -86,11 +95,13 @@ void RepairGUI_RemoveExtraEdgesDlg::Init()
|
|||||||
{
|
{
|
||||||
/* init variables */
|
/* init variables */
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
|
|
||||||
myOkObject = false;
|
myOkObject = false;
|
||||||
|
|
||||||
activateSelection();
|
activateSelection();
|
||||||
|
|
||||||
|
GroupBoxPublish->show();
|
||||||
|
|
||||||
/* signals and slots connections */
|
/* signals and slots connections */
|
||||||
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||||
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
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->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||||
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||||
|
|
||||||
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
initName( tr( "REMOVE_EXTRA_EDGES_NEW_OBJ_NAME" ) );
|
initName( tr( "REMOVE_EXTRA_EDGES_NEW_OBJ_NAME" ) );
|
||||||
}
|
}
|
||||||
@ -128,7 +139,7 @@ bool RepairGUI_RemoveExtraEdgesDlg::ClickOnApply()
|
|||||||
|
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
myObject = GEOM::GEOM_Object::_nil();
|
myObject = GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
activateSelection();
|
activateSelection();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -144,7 +155,7 @@ void RepairGUI_RemoveExtraEdgesDlg::SelectionIntoArgument()
|
|||||||
{
|
{
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
QString aName;
|
QString aName;
|
||||||
|
|
||||||
if(myEditCurrentArgument == GroupPoints->LineEdit1) {
|
if(myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||||
if (IObjectCount() != 1) {
|
if (IObjectCount() != 1) {
|
||||||
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||||
@ -152,7 +163,7 @@ void RepairGUI_RemoveExtraEdgesDlg::SelectionIntoArgument()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// nbSel == 1
|
// nbSel == 1
|
||||||
Standard_Boolean testResult = Standard_False;
|
Standard_Boolean testResult = Standard_False;
|
||||||
GEOM::GEOM_Object_ptr aSelectedObject =
|
GEOM::GEOM_Object_ptr aSelectedObject =
|
||||||
@ -160,7 +171,7 @@ void RepairGUI_RemoveExtraEdgesDlg::SelectionIntoArgument()
|
|||||||
|
|
||||||
if (!testResult)
|
if (!testResult)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||||
myObject = aSelectedObject;
|
myObject = aSelectedObject;
|
||||||
myOkObject = true;
|
myOkObject = true;
|
||||||
@ -205,8 +216,8 @@ void RepairGUI_RemoveExtraEdgesDlg::LineEditReturnPressed()
|
|||||||
void RepairGUI_RemoveExtraEdgesDlg::ActivateThisDialog()
|
void RepairGUI_RemoveExtraEdgesDlg::ActivateThisDialog()
|
||||||
{
|
{
|
||||||
GEOMBase_Skeleton::ActivateThisDialog();
|
GEOMBase_Skeleton::ActivateThisDialog();
|
||||||
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
activateSelection();
|
activateSelection();
|
||||||
}
|
}
|
||||||
@ -269,11 +280,26 @@ bool RepairGUI_RemoveExtraEdgesDlg::isValid( QString& msg )
|
|||||||
bool RepairGUI_RemoveExtraEdgesDlg::execute( ObjectList& objects )
|
bool RepairGUI_RemoveExtraEdgesDlg::execute( ObjectList& objects )
|
||||||
{
|
{
|
||||||
GEOM::GEOM_Object_var anObj;
|
GEOM::GEOM_Object_var anObj;
|
||||||
|
|
||||||
anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())->RemoveExtraEdges(myObject);
|
anObj = GEOM::GEOM_IBlocksOperations::_narrow(getOperation())->RemoveExtraEdges(myObject);
|
||||||
|
|
||||||
if ( !anObj->_is_nil() )
|
if ( !anObj->_is_nil() )
|
||||||
objects.push_back( anObj._retn() );
|
objects.push_back( anObj._retn() );
|
||||||
|
|
||||||
return true;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
// License along with this library; if not, write to the Free Software
|
// License along with this library; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// 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 GEOM::GEOM_IOperations_ptr createOperation();
|
||||||
virtual bool isValid( QString& );
|
virtual bool isValid( QString& );
|
||||||
virtual bool execute( ObjectList& objects );
|
virtual bool execute( ObjectList& objects );
|
||||||
|
virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
|
||||||
|
|
||||||
private :
|
private :
|
||||||
void Init();
|
void Init();
|
||||||
|
@ -482,7 +482,9 @@ void TransformationGUI_MirrorDlg::restoreSubShapes (SALOMEDS::Study_ptr theStu
|
|||||||
{
|
{
|
||||||
if (CheckBoxRestoreSS->isChecked()) {
|
if (CheckBoxRestoreSS->isChecked()) {
|
||||||
// empty list of arguments means that all arguments should be restored
|
// 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +324,9 @@ void TransformationGUI_OffsetDlg::restoreSubShapes (SALOMEDS::Study_ptr theStu
|
|||||||
{
|
{
|
||||||
if (CheckBoxRestoreSS->isChecked()) {
|
if (CheckBoxRestoreSS->isChecked()) {
|
||||||
// empty list of arguments means that all arguments should be restored
|
// 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,7 +424,9 @@ void TransformationGUI_PositionDlg::restoreSubShapes (SALOMEDS::Study_ptr theS
|
|||||||
{
|
{
|
||||||
if (CheckBoxRestoreSS->isChecked()) {
|
if (CheckBoxRestoreSS->isChecked()) {
|
||||||
// empty list of arguments means that all arguments should be restored
|
// 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,7 +513,9 @@ void TransformationGUI_RotationDlg::restoreSubShapes (SALOMEDS::Study_ptr theS
|
|||||||
{
|
{
|
||||||
if (CheckBoxRestoreSS->isChecked()) {
|
if (CheckBoxRestoreSS->isChecked()) {
|
||||||
// empty list of arguments means that all arguments should be restored
|
// 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,7 +381,9 @@ void TransformationGUI_ScaleDlg::restoreSubShapes (SALOMEDS::Study_ptr theStud
|
|||||||
{
|
{
|
||||||
if (CheckBoxRestoreSS->isChecked()) {
|
if (CheckBoxRestoreSS->isChecked()) {
|
||||||
// empty list of arguments means that all arguments should be restored
|
// 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -590,7 +590,9 @@ void TransformationGUI_TranslationDlg::restoreSubShapes (SALOMEDS::Study_ptr t
|
|||||||
{
|
{
|
||||||
if (CheckBoxRestoreSS->isChecked()) {
|
if (CheckBoxRestoreSS->isChecked()) {
|
||||||
// empty list of arguments means that all arguments should be restored
|
// 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user