mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-03-26 09:07:55 +05:00
PAL11298: Problem with GetInPlace() solved.
This commit is contained in:
parent
b177250180
commit
e4f62a39e8
@ -1375,6 +1375,25 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetShapesOnSphe
|
|||||||
* GetInPlace
|
* GetInPlace
|
||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
static void SimplifyWhat (TopoDS_Shape& theWhat,
|
||||||
|
TopTools_IndexedMapOfShape& theArgumentIndices,
|
||||||
|
TColStd_ListOfInteger& theSimpleSubWhat)
|
||||||
|
{
|
||||||
|
TopTools_MapOfShape mapShape;
|
||||||
|
TopoDS_Iterator It (theWhat, Standard_True, Standard_True);
|
||||||
|
for (; It.More(); It.Next()) {
|
||||||
|
if (mapShape.Add(It.Value())) {
|
||||||
|
TopoDS_Shape curSh = It.Value();
|
||||||
|
if (curSh.ShapeType() == TopAbs_COMPOUND ||
|
||||||
|
curSh.ShapeType() == TopAbs_COMPSOLID) {
|
||||||
|
SimplifyWhat(curSh, theArgumentIndices, theSimpleSubWhat);
|
||||||
|
} else {
|
||||||
|
theSimpleSubWhat.Append(theArgumentIndices.FindIndex(curSh));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace
|
Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace
|
||||||
(Handle(GEOM_Object) theShapeWhere,
|
(Handle(GEOM_Object) theShapeWhere,
|
||||||
Handle(GEOM_Object) theShapeWhat)
|
Handle(GEOM_Object) theShapeWhat)
|
||||||
@ -1443,21 +1462,56 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace
|
|||||||
|
|
||||||
TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(aWhatIndex, Standard_False);
|
TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(aWhatIndex, Standard_False);
|
||||||
if (aWhatHistoryLabel.IsNull()) {
|
if (aWhatHistoryLabel.IsNull()) {
|
||||||
// Removed entity
|
// Check, if the sought shape is Compound or Compsolid.
|
||||||
SetErrorCode(OK);
|
// In that case we will try to find history for its sub-shapes
|
||||||
return NULL;
|
if (aWhat.ShapeType() == TopAbs_COMPOUND ||
|
||||||
}
|
aWhat.ShapeType() == TopAbs_COMPSOLID) {
|
||||||
|
TColStd_ListOfInteger aSimpleSubWhat, aModifiedList;
|
||||||
|
SimplifyWhat(aWhat, anArgumentIndices, aSimpleSubWhat);
|
||||||
|
TColStd_ListIteratorOfListOfInteger anIterSub (aSimpleSubWhat);
|
||||||
|
for (; anIterSub.More(); anIterSub.Next()) {
|
||||||
|
Standard_Integer aSubWhatIndex = anIterSub.Value();
|
||||||
|
TDF_Label aSubWhatHistoryLabel =
|
||||||
|
anArgumentHistoryLabel.FindChild(aSubWhatIndex, Standard_False);
|
||||||
|
if (!aSubWhatHistoryLabel.IsNull()) {
|
||||||
|
Handle(TDataStd_IntegerArray) anIntegerArray;
|
||||||
|
if (aSubWhatHistoryLabel.FindAttribute(TDataStd_IntegerArray::GetID(), anIntegerArray)) {
|
||||||
|
for (Standard_Integer isub = 1; isub <= anIntegerArray->Length(); isub++) {
|
||||||
|
aModifiedList.Append(anIntegerArray->Value(isub));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (aModifiedList.Extent() > 0) {
|
||||||
|
Handle(TColStd_HArray1OfInteger) aModifiedArraySub =
|
||||||
|
new TColStd_HArray1OfInteger (1, aModifiedList.Extent());
|
||||||
|
TColStd_ListIteratorOfListOfInteger anIterModif (aModifiedList);
|
||||||
|
for (Standard_Integer imod = 1; anIterModif.More(); anIterModif.Next(), imod++) {
|
||||||
|
aModifiedArraySub->SetValue(imod, anIterModif.Value());
|
||||||
|
}
|
||||||
|
aModifiedArray = aModifiedArraySub;
|
||||||
|
} else {
|
||||||
|
// Removed entity
|
||||||
|
SetErrorCode(OK);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Removed entity
|
||||||
|
SetErrorCode(OK);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Handle(TDataStd_IntegerArray) anIntegerArray;
|
||||||
|
if (!aWhatHistoryLabel.FindAttribute(TDataStd_IntegerArray::GetID(), anIntegerArray)) {
|
||||||
|
SetErrorCode("Error: Empty modifications history for the sought shape.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
Handle(TDataStd_IntegerArray) anIntegerArray;
|
aModifiedArray = anIntegerArray->Array();
|
||||||
if (!aWhatHistoryLabel.FindAttribute(TDataStd_IntegerArray::GetID(), anIntegerArray)) {
|
if (aModifiedArray->Length() == 0) {
|
||||||
SetErrorCode("Error: Empty modifications history for the sought shape.");
|
SetErrorCode("Error: Empty modifications history for the sought shape.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
aModifiedArray = anIntegerArray->Array();
|
|
||||||
if (aModifiedArray->Length() == 0) {
|
|
||||||
SetErrorCode("Error: Empty modifications history for the sought shape.");
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user