#include <TopTools_MapOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
+IMPLEMENT_STANDARD_RTTIEXT(BRepBuilderAPI_Sewing,MMgt_TShared)
+
//#include <LocalAnalysis_SurfaceContinuity.hxx>
//=======================================================================
//function : SameRange
TopoDS_Edge BRepBuilderAPI_Sewing::SameParameterEdge(const TopoDS_Shape& edge,
const TopTools_SequenceOfShape& seqEdges,
- const TColStd_SequenceOfInteger& seqForward,
+ const TColStd_SequenceOfBoolean& seqForward,
TopTools_MapOfShape& mapMerged,
const Handle(BRepTools_ReShape)& locReShape)
{
if (locReShape != myReShape) Edge2 = TopoDS::Edge(aTmpShape);
// Calculate relative orientation
- Standard_Integer Orientation = seqForward(i);
- if (!isForward) Orientation = (Orientation? 0 : 1);
+ Standard_Boolean Orientation = seqForward(i);
+ if (!isForward) Orientation = !Orientation;
// Retrieve faces information for the second edge
TopoDS_Shape bnd2 = oedge2;
void BRepBuilderAPI_Sewing::AnalysisNearestEdges(const TopTools_SequenceOfShape& sequenceSec,
TColStd_SequenceOfInteger& seqIndCandidate,
- TColStd_SequenceOfInteger& seqOrientations,
+ TColStd_SequenceOfBoolean& seqOrientations,
const Standard_Boolean evalDist)
{
Standard_Boolean BRepBuilderAPI_Sewing::FindCandidates(TopTools_SequenceOfShape& seqSections,
TColStd_IndexedMapOfInteger& mapReference,
TColStd_SequenceOfInteger& seqCandidates,
- TColStd_SequenceOfInteger& seqOrientations)
+ TColStd_SequenceOfBoolean& seqOrientations)
{
Standard_Integer i, nbSections = seqSections.Length();
if(nbSections <= 1)
// Reference section is connected to section #i
Standard_Boolean isInserted = Standard_False;
- Standard_Integer j, ori = (arrForward(i)? 1 : 0);
- for (j = 1; (j <= seqCandidates.Length()) && !isInserted; j++) {
+ Standard_Boolean ori = arrForward(i);
+ for (Standard_Integer j = 1; (j <= seqCandidates.Length()) && !isInserted; j++) {
Standard_Real aDelta = arrDistance(i) - arrDistance(seqCandidates.Value(j));
if( aDelta < Precision::Confusion()) {
if (myNonmanifold && nbCandidates >1) {
TColStd_SequenceOfInteger seqNewCandidates;
- TColStd_SequenceOfInteger seqOrientationsNew;
+ TColStd_SequenceOfBoolean seqOrientationsNew;
seqCandidates.Prepend(1);
- seqOrientations.Prepend(1);
+ seqOrientations.Prepend(Standard_True);
for(Standard_Integer k = 1; k <= seqSections.Length() && seqCandidates.Length() > 1 ; k++) {
AnalysisNearestEdges(seqSections,seqCandidates,seqOrientations,(k==1));
if(k == 1 && !seqCandidates.Length()) return Standard_False;
if (mapReference.Contains(indCandidate)) break;
// Find candidates for candidate #indCandidate
mapReference.Add(indCandidate); // Push candidate in the map
- TColStd_SequenceOfInteger seqCandidates1, seqOrientations1;
+ TColStd_SequenceOfInteger seqCandidates1;
+ TColStd_SequenceOfBoolean seqOrientations1;
Standard_Boolean isFound =
FindCandidates(seqSections,mapReference,seqCandidates1,seqOrientations1);
mapReference.RemoveLast(); // Pop candidate from the map
if (!isPrevSplit) {
// Obtain sequence of edges merged with bound
TopTools_SequenceOfShape seqMergedWithBound;
- TColStd_SequenceOfInteger seqMergedWithBoundOri;
+ TColStd_SequenceOfBoolean seqMergedWithBoundOri;
if (MergedNearestEdges(bound,seqMergedWithBound,seqMergedWithBoundOri)) {
// Store bound in the map
MergedWithBound.Bind(bound,bound);
if (!nbMerged) MergedWithBound.UnBind(bound);
}
}
- Standard_Boolean isMerged = MergedWithBound.Extent();
+ const Standard_Boolean isMerged = !MergedWithBound.IsEmpty();
// Merge with cutting sections
Handle(BRepTools_ReShape) SectionsReShape = new BRepTools_ReShape;
if (myMergedEdges.Contains(section)) continue;
// Merge cutting section
TopTools_SequenceOfShape seqMergedWithSection;
- TColStd_SequenceOfInteger seqMergedWithSectionOri;
+ TColStd_SequenceOfBoolean seqMergedWithSectionOri;
if (MergedNearestEdges(section,seqMergedWithSection,seqMergedWithSectionOri)) {
// Store section in the map
MergedWithSections.Bind(section,section);
}
}
}
- Standard_Boolean isMergedSplit = MergedWithSections.Extent();
+ const Standard_Boolean isMergedSplit = !MergedWithSections.IsEmpty();
if (!isMerged && !isMergedSplit) {
// Nothing was merged in this iteration
Standard_Boolean BRepBuilderAPI_Sewing::MergedNearestEdges(const TopoDS_Shape& edge,
TopTools_SequenceOfShape& SeqMergedEdge,
- TColStd_SequenceOfInteger& SeqMergedOri)
+ TColStd_SequenceOfBoolean& SeqMergedOri)
{
// Retrieve edge nodes
TopoDS_Vertex no1, no2;
}
// Find merging candidates
- TColStd_SequenceOfInteger seqForward;
+ TColStd_SequenceOfBoolean seqForward;
TColStd_SequenceOfInteger seqCandidates;
TColStd_IndexedMapOfInteger mapReference;
mapReference.Add(indRef); // Add index of reference section
for (i = 1; i <= nbCandidates; i++) {
// Retrieve merged edge
TopoDS_Shape iedge = seqEdges(seqCandidates(i));
- Standard_Integer ori = (seqForward(i))? 1 : 0;
+ Standard_Boolean ori = seqForward(i) != 0;
SeqMergedEdge.Append(iedge);
SeqMergedOri.Append(ori);
if (!myNonmanifold) break;
}
- success = nbCandidates;
+ success = (nbCandidates != 0);
}
}