return TopAbs_SHAPE;
}
-const TopoDS_Shape getShapeFromCompound(
- const std::string& theSubShapeName, const TopoDS_Shape& theCompound)
+const TopoDS_Shape getShapeFromNS(
+ const std::string& theSubShapeName, Handle(TNaming_NamedShape) theNS)
{
TopoDS_Shape aSelection;
std::string::size_type n = theSubShapeName.rfind('/');
if (n == std::string::npos) return aSelection;
aSubString = aSubString.substr(n+1);
int indx = atoi(aSubString.c_str());
- TopoDS_Iterator it(theCompound);
- for (int i = 1;it.More();it.Next(), i++) {
- if(i == indx) {
- aSelection = it.Value();
- break;
+
+ TNaming_Iterator anItL(theNS);
+ for(int i = 1; anItL.More(); anItL.Next(), i++) {
+ if (i == indx) {
+ return anItL.NewShape();
}
- else continue;
}
return aSelection;
}
if(aLabel.IsNull()) return aFace;
Handle(TNaming_NamedShape) aNS;
if(aLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
- const TopoDS_Shape& aShape = aNS->Get();
- if(!aShape.IsNull()) {
- if(aShape.ShapeType() == TopAbs_COMPOUND)
- aFace = getShapeFromCompound(theSubShapeName, aShape);
- else
- aFace = aShape;
- }
+ aFace = getShapeFromNS(theSubShapeName, aNS);
}
return aFace;
}
if(!aLabel.IsNull()) {
Handle(TNaming_NamedShape) aNS;
if(aLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
- const TopoDS_Shape& aShape = aNS->Get();
- if(!aShape.IsNull()) {
- if(aShape.ShapeType() == TopAbs_COMPOUND)
- aSelection = getShapeFromCompound(theSubShapeName, aShape);
- else
- aSelection = aShape;
- }
+ aSelection = getShapeFromNS(theSubShapeName, aNS);
}
}
if(aSelection.IsNull()) {
if(!aLabel.IsNull()) {
Handle(TNaming_NamedShape) aNS;
if(aLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
- const TopoDS_Shape& aShape = aNS->Get();
- if(!aShape.IsNull()) {
- if(aShape.ShapeType() == TopAbs_COMPOUND)
- aSelection = getShapeFromCompound(theSubShapeName, aShape);
- else
- aSelection = aShape;
- }
+ aSelection = getShapeFromNS(theSubShapeName, aNS);
}
}
if(aSelection.IsNull()) {