-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// 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
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <Selector_FilterByNeighbors.h>
const int theLevel, TopTools_MapOfShape& theResult)
{
TopAbs_ShapeEnum aConnectorType = TopAbs_VERTEX; // type of the connector sub-shapes
- if (theValue.ShapeType() == TopAbs_FACE)
+ TopAbs_ShapeEnum aValueType = theValue.ShapeType();
+ if (aValueType == TopAbs_FACE)
aConnectorType = TopAbs_EDGE;
+ else if (aValueType == TopAbs_COMPOUND) { // for geometrical naming: compound of faces
+ TopExp_Explorer anExp(theValue, TopAbs_FACE);
+ if (anExp.More()) {
+ aConnectorType = TopAbs_EDGE;
+ aValueType = TopAbs_FACE;
+ } else {
+ aValueType = TopAbs_EDGE;
+ }
+ }
TopTools_MapOfShape aNBConnectors; // connector shapes that already belong to neighbors
- for(TopExp_Explorer aValExp(theValue, aConnectorType); aValExp.More(); aValExp.Next()) {
+ for(TopExp_Explorer aValExp(theValue, aConnectorType); aValExp.More(); aValExp.Next())
aNBConnectors.Add(aValExp.Current());
- }
TopTools_MapOfShape alreadyProcessed;
- alreadyProcessed.Add(theValue);
+ if (aValueType == theValue.ShapeType())
+ alreadyProcessed.Add(theValue);
+ else
+ for(TopExp_Explorer aValExp(theValue, aValueType); aValExp.More(); aValExp.Next())
+ alreadyProcessed.Add(aValExp.Current());
for(int aLevel = 1; aLevel <= theLevel; aLevel++) {
TopoDS_ListOfShape aGoodCandidates;
- TopExp_Explorer aCandidate(theContext, theValue.ShapeType());
+ TopExp_Explorer aCandidate(theContext, aValueType);
for(; aCandidate.More(); aCandidate.Next()) {
if (alreadyProcessed.Contains(aCandidate.Current()))
continue;
if (aNBIter->second == aMinLevel) {
TopTools_MapOfShape aThisNBs;
findNeighbors(theContext, aNBIter->first, aMinLevel, aThisNBs);
- // aMatches must contain common part of all NBs lists
- for(TopTools_MapOfShape::Iterator aThisNB(aThisNBs); aThisNB.More(); aThisNB.Next()) {
- if (aFirst) {
+ if (aFirst) { // aMatches must contain common part of all NBs lists
+ for(TopTools_MapOfShape::Iterator aThisNB(aThisNBs); aThisNB.More(); aThisNB.Next()) {
aMatches.Append(aThisNB.Value());
- } else {
- // remove all in aMatches which are not in this NBs
- for(TopoDS_ListOfShape::Iterator aMatch(aMatches); aMatch.More(); ) {
- if (aThisNBs.Contains(aMatch.Value())) {
- aMatch.Next();
- } else {
- aMatches.Remove(aMatch);
- }
+ }
+ } else { // remove all in aMatches which are not in this NBs
+ for(TopoDS_ListOfShape::Iterator aMatch(aMatches); aMatch.More(); ) {
+ if (aThisNBs.Contains(aMatch.Value())) {
+ aMatch.Next();
+ } else {
+ aMatches.Remove(aMatch);
}
}
}
} else
return TopoDS_Shape();
}
+ break; // no more NBs with higher levels
}
if (!aLevelNBs.IsEmpty()) {
TopTools_MapOfShape aNBsOfCandidate;