Standard_Integer aLen = theSubShapes->Length();
if (aLen < 1) {
- SetErrorCode("The list is empty");
+ //SetErrorCode("The list is empty");
+ SetErrorCode(OK);
return;
}
if (aSeq.IsNull()) return;
Standard_Integer aLength = aSeq->Length();
- if (aLength == 1 && aSeq->Value(1) == -1) // empty group
- return;
+ // VSR 28/04/2011 commented to allow operation even for empty group
+ // if (aLength == 1 && aSeq->Value(1) == -1) // empty group
+ // return;
TColStd_MapOfInteger mapIDsCurrent;
Standard_Integer j = 1;
// 1. If aShape_i is sub-shape of aMainShape - remove it
if (mapIndices.Contains(aShape_i)) {
rem_id = mapIndices.FindIndex(aShape_i);
- if (mapIDsCurrent.Contains(rem_id)) {
+ if (rem_id > 0 && mapIDsCurrent.Contains(rem_id)) {
mapIDsToRemove.Add(rem_id);
}
}
TopoDS_Shape aSubShape_i = mapIndices_i.FindKey(ii);
if (mapIndices.Contains(aSubShape_i)) {
rem_id = mapIndices.FindIndex(aSubShape_i);
- if (mapIDsCurrent.Contains(rem_id)) {
+ if (rem_id > 0 && mapIDsCurrent.Contains(rem_id)) {
mapIDsToRemove.Add(rem_id);
}
}
TopoDS_Shape aSubShape_i = aSubShapes_i.Current();
if (mapIndices.Contains(aSubShape_i)) {
rem_id = mapIndices.FindIndex(aSubShape_i);
- if (mapIDsCurrent.Contains(rem_id)) {
+ if (rem_id > 0 && mapIDsCurrent.Contains(rem_id)) {
mapIDsToRemove.Add(rem_id);
}
}
Standard_Integer aLen = theSubShapes->Length();
if (aLen < 1) {
- SetErrorCode("The list is empty");
+ //SetErrorCode("The list is empty");
+ SetErrorCode(OK);
return;
}
Standard_Integer aLen = theSubShapes->Length();
if (aLen < 1) {
- SetErrorCode("The list is empty");
+ //SetErrorCode("The list is empty");
+ SetErrorCode(OK);
return;
}
if (aSeq.IsNull()) return;
Standard_Integer aLength = aSeq->Length();
- if (aLength == 1 && aSeq->Value(1) == -1) // empty group
- return;
+ // VSR 28/04/2011 commented to allow operation even for empty group
+ // if (aLength == 1 && aSeq->Value(1) == -1) // empty group
+ // return;
TColStd_MapOfInteger mapIDsCurrent;
Standard_Integer j = 1;
Standard_Integer i, rem_id;
for (i = 1; i <= aLen; i++) {
rem_id = theSubShapes->Value(i);
- if (mapIDsCurrent.Contains(rem_id)) {
+ if (rem_id > 0 && mapIDsCurrent.Contains(rem_id)) {
mapIDsToRemove.Add(rem_id);
}
}
if (mapIDsToRemove.Extent() > 0) {
Standard_Integer k = 1, aRemLength = mapIDsToRemove.Extent();
- Handle(TColStd_HArray1OfInteger) aNewSeq = new TColStd_HArray1OfInteger(1, aLength - aRemLength);
-
- for (j = 1; j <= aLength; j++) {
- if (!mapIDsToRemove.Contains(aSeq->Value(j))) {
- aNewSeq->SetValue(k, aSeq->Value(j));
- k++;
+ Handle(TColStd_HArray1OfInteger) aNewSeq;
+ if ( aLength - aRemLength > 0 ) {
+ aNewSeq = new TColStd_HArray1OfInteger(1, aLength - aRemLength);
+ for (j = 1; j <= aLength; j++) {
+ if (!mapIDsToRemove.Contains(aSeq->Value(j))) {
+ aNewSeq->SetValue(k, aSeq->Value(j));
+ k++;
+ }
}
}
+ else {
+ aNewSeq = new TColStd_HArray1OfInteger(1,1);
+ aNewSeq->SetValue(1, -1);
+ }
aSSI.SetIndices(aNewSeq);