mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-13 02:00:35 +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);
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
@ -621,16 +623,12 @@ 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,
|
||||||
@ -764,7 +804,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr theS
|
|||||||
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,7 +840,15 @@ 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) {
|
||||||
|
case GEOM::FSM_GetInPlace:
|
||||||
|
{
|
||||||
|
// Use GetInPlace
|
||||||
|
aNewSubO = aShapesOp->GetInPlace(theNewO, anOldSubO);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GEOM::FSM_Transformed:
|
||||||
|
{
|
||||||
// transformation, cannot use GetInPlace, operate with indices
|
// transformation, cannot use GetInPlace, operate with indices
|
||||||
GEOM::ListOfLong_var anIDs = anOldSubO->GetSubShapeIndices();
|
GEOM::ListOfLong_var anIDs = anOldSubO->GetSubShapeIndices();
|
||||||
if (anIDs->length() > 1) {
|
if (anIDs->length() > 1) {
|
||||||
@ -814,9 +862,28 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::Study_ptr theS
|
|||||||
aNewSubO = aShapesOp->GetSubShape(theNewO, anIDs[0]);
|
aNewSubO = aShapesOp->GetSubShape(theNewO, anIDs[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
break;
|
||||||
// not a transformation, so use GetInPlace
|
case GEOM::FSM_GetSame:
|
||||||
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,
|
||||||
|
@ -139,7 +139,8 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
|
|||||||
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
|
||||||
@ -147,7 +148,8 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
|
|||||||
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 //
|
||||||
@ -240,13 +242,14 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
|
|||||||
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
|
||||||
@ -129,7 +129,7 @@ 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()));
|
||||||
@ -196,7 +198,7 @@ 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 )
|
||||||
{
|
{
|
||||||
@ -240,7 +242,7 @@ void RepairGUI_GlueDlg::ConstructorsClicked( int 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();
|
||||||
@ -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 :
|
||||||
@ -480,6 +471,23 @@ 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
|
||||||
@ -530,7 +538,7 @@ bool RepairGUI_GlueDlg::onAcceptLocal()
|
|||||||
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;
|
||||||
}
|
}
|
||||||
@ -550,7 +558,7 @@ bool RepairGUI_GlueDlg::onAcceptLocal()
|
|||||||
{
|
{
|
||||||
SUIT_OverrideCursor wc;
|
SUIT_OverrideCursor wc;
|
||||||
|
|
||||||
SUIT_Session::session()->activeApplication()->putInfo( "" );
|
myGeomGUI->getApp()->putInfo( "" );
|
||||||
ObjectList objects;
|
ObjectList objects;
|
||||||
|
|
||||||
if ( !execute( objects ) )
|
if ( !execute( objects ) )
|
||||||
@ -562,23 +570,22 @@ bool RepairGUI_GlueDlg::onAcceptLocal()
|
|||||||
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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -586,7 +593,7 @@ bool RepairGUI_GlueDlg::onAcceptLocal()
|
|||||||
{
|
{
|
||||||
commitCommand();
|
commitCommand();
|
||||||
updateObjBrowser();
|
updateObjBrowser();
|
||||||
SUIT_Session::session()->activeApplication()->putInfo( QObject::tr("GEOM_PRP_DONE") );
|
myGeomGUI->getApp()->putInfo( QObject::tr("GEOM_PRP_DONE") );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -600,7 +607,7 @@ bool RepairGUI_GlueDlg::onAcceptLocal()
|
|||||||
{
|
{
|
||||||
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" ));
|
||||||
@ -657,8 +664,8 @@ 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();
|
||||||
@ -675,15 +682,15 @@ void RepairGUI_GlueDlg::activateSelection()
|
|||||||
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
|
||||||
{
|
{
|
||||||
@ -692,11 +699,11 @@ void RepairGUI_GlueDlg::activateSelection()
|
|||||||
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();
|
||||||
@ -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 "";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -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,3 +1,12 @@
|
|||||||
|
// 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,
|
// This library is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
@ -15,7 +24,7 @@
|
|||||||
// 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,8 +51,9 @@ 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"));
|
||||||
|
|
||||||
@ -91,6 +100,8 @@ void RepairGUI_RemoveExtraEdgesDlg::Init()
|
|||||||
|
|
||||||
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" ) );
|
||||||
}
|
}
|
||||||
@ -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();
|
||||||
}
|
}
|
||||||
@ -277,3 +288,18 @@ bool RepairGUI_RemoveExtraEdgesDlg::execute( ObjectList& objects )
|
|||||||
|
|
||||||
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -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