mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0027772: Foundation Classes - define Standard_Boolean using C++ type "bool" instead of "unsigned int"
Code has been updated to remove no-op casts and implicit casts to Standard_Boolean. Places of inproper use of Standard_Boolean instead of Standard_Integer have been corrected: - Bnd_Box, Bnd_Box2d Bit flags are now defined as private enum - HLRAlgo_BiPoint, HLRAlgo_EdgesBlock, HLRBRep_EdgeData, HLRBRep_FaceData Bit flags are now defined as enum - HLRAlgo_EdgeStatus, HLRBRep_BiPnt2D, HLRBRep_BiPoint Bit flags are now defined as bool fields - HLRAlgo_PolyData Bit flags are now defined as Standard_Integer - OSD_DirectoryIterator, OSD_FileIterator Boolean flag is now defined as Standard_Boolean - ShapeAnalysis_Surface::SurfaceNewton() now returns Standard_Integer (values 0, 1 or 3) - ChFi2d_FilletAlgo now uses TColStd_SequenceOfBoolean instead of TColStd_SequenceOfInteger for storing boolean flags Method IFSelect_Dispatch::PacketsCount() has been dropped from interface. ShapeFix_Solid::Status() has been fixed to decode requested status instead of returning integer value. TopOpeBRepBuild_Builder1 now defines map storing Standard_Boolean values instead of Standard_Integer. Persistence for Standard_Boolean type has been corrected to keep backward compatibility: - BinMDataStd, BinTools, FSD_BinaryFile Broken Draw Harness commands vdisplaymode and verasemode have been removed. BRepMesh_FastDiscretFace::initDataStructure() - workaround old gcc limitations BRepMesh_IncrementalMesh::clear() - avoid ambiguity
This commit is contained in:
@@ -405,7 +405,7 @@ static Standard_Integer ApplyContext (ShapeFix_WireSegment &wire,
|
||||
//purpose : auxilary
|
||||
//=======================================================================
|
||||
// check points coincidence
|
||||
static inline Standard_Integer IsCoincided (const gp_Pnt2d &p1, const gp_Pnt2d &p2,
|
||||
static inline Standard_Boolean IsCoincided (const gp_Pnt2d &p1, const gp_Pnt2d &p2,
|
||||
const Standard_Real UResolution,
|
||||
const Standard_Real VResolution,
|
||||
const Standard_Real tol)
|
||||
@@ -731,7 +731,7 @@ static void DistributeSplitPoints (const Handle(ShapeExtend_WireData) &sbwd,
|
||||
|
||||
for ( i=1; i <= indexes.Length() && indexes(i) < index; i++ );
|
||||
for ( Standard_Integer shift = 1; i <= indexes.Length() && indexes(i) == index; i++ ) {
|
||||
while ( shift < nsplit && isreversed != (Standard_Boolean) ( values(i) > params(shift) ) ) shift++;
|
||||
while ( shift < nsplit && isreversed != (values(i) > params(shift)) ) shift++;
|
||||
indexes.SetValue ( i, index + shift - 1 );
|
||||
}
|
||||
for ( ; i <= indexes.Length(); i++ )
|
||||
@@ -1116,7 +1116,7 @@ ShapeFix_WireSegment ShapeFix_ComposeShell::SplitWire (ShapeFix_WireSegment &wir
|
||||
B.SameRange(newEdge, Standard_False);
|
||||
//pdn take into account 0 codes (if ext)
|
||||
if(code == 0 && wire.Orientation()==TopAbs_EXTERNAL){
|
||||
code = ( ( isCutByU == (Standard_Boolean)( j == 1 ) ) ? 1 : 2 );
|
||||
code = ( ( isCutByU == (j == 1) ) ? 1 : 2 );
|
||||
}
|
||||
|
||||
result.AddEdge ( 0, newEdge, iumin, iumax, ivmin, ivmax );
|
||||
@@ -1159,7 +1159,7 @@ ShapeFix_WireSegment ShapeFix_ComposeShell::SplitWire (ShapeFix_WireSegment &wir
|
||||
result.AddEdge ( 0, edge, iumin, iumax, ivmin, ivmax );
|
||||
if(code == 0 && wire.Orientation()==TopAbs_EXTERNAL){
|
||||
//pdn defining code for intersection of two isos
|
||||
code = ( ( isCutByU == (Standard_Boolean)( Abs(firstPar-currPar) < Abs(lastPar-currPar) ) ) ? 2 : 1 );
|
||||
code = ( ( isCutByU == ( Abs(firstPar-currPar) < Abs(lastPar-currPar) ) ) ? 2 : 1 );
|
||||
}
|
||||
DefinePatch ( result, code, isCutByU, cutIndex );
|
||||
}
|
||||
@@ -1366,7 +1366,7 @@ Standard_Boolean ShapeFix_ComposeShell::SplitByLine (ShapeFix_WireSegment &wire,
|
||||
// Sort by parameter on edge
|
||||
for ( i = IntEdgePar.Length(); i > start; i-- )
|
||||
for ( Standard_Integer j = start; j < i; j++ ) {
|
||||
if ( isreversed == (Standard_Boolean) ( IntEdgePar(j+1) < IntEdgePar(j) ) ) continue;
|
||||
if ( isreversed == ( IntEdgePar(j+1) < IntEdgePar(j) ) ) continue;
|
||||
IntLinePar.Exchange ( j, j+1 );
|
||||
IntEdgePar.Exchange ( j, j+1 );
|
||||
}
|
||||
@@ -2056,7 +2056,7 @@ void ShapeFix_ComposeShell::CollectWires (ShapeFix_SequenceOfWireSegment &wires,
|
||||
}
|
||||
|
||||
// check whether current segment is on the same patch with previous
|
||||
Standard_Integer sp = IsSamePatch ( seg, myGrid->NbUPatches(), myGrid->NbVPatches(),
|
||||
Standard_Boolean sp = IsSamePatch ( seg, myGrid->NbUPatches(), myGrid->NbVPatches(),
|
||||
iumin, iumax, ivmin, ivmax );
|
||||
|
||||
// not same patch has lowest priority
|
||||
@@ -2077,14 +2077,14 @@ void ShapeFix_ComposeShell::CollectWires (ShapeFix_SequenceOfWireSegment &wires,
|
||||
if ( ! endV.IsSame ( j ? seg.LastVertex() : seg.FirstVertex() ) ) continue;
|
||||
|
||||
// check for misorientation only if nothing better is found
|
||||
Standard_Integer misor = ( anOr == ( j ? TopAbs_REVERSED : TopAbs_FORWARD ) );
|
||||
Standard_Boolean misor = ( anOr == ( j ? TopAbs_REVERSED : TopAbs_FORWARD ) );
|
||||
// if ( misor ) continue; // temporarily, to be improved
|
||||
|
||||
// returning back by the same edge is lowest priority
|
||||
if ( lastEdge.IsSame ( wire->Edge ( j ? wire->NbEdges() : 1 ) ) ) {
|
||||
if ( ! index && ! canBeClosed ) { // || ( sp && ! samepatch ) ) {
|
||||
index = i;
|
||||
reverse = j;
|
||||
reverse = j != 0;
|
||||
connected = Standard_True;
|
||||
misoriented = misor;
|
||||
samepatch = sp;
|
||||
@@ -2141,7 +2141,7 @@ void ShapeFix_ComposeShell::CollectWires (ShapeFix_SequenceOfWireSegment &wires,
|
||||
continue;
|
||||
|
||||
index = i;
|
||||
reverse = j;
|
||||
reverse = j != 0;
|
||||
angle = ang;
|
||||
mindist = dist;
|
||||
connected = conn;
|
||||
@@ -2262,7 +2262,7 @@ void ShapeFix_ComposeShell::CollectWires (ShapeFix_SequenceOfWireSegment &wires,
|
||||
for ( Standard_Integer k=1; k <= sbwd->NbEdges(); k++ ) {
|
||||
if ( !V.IsSame ( sae.FirstVertex ( sbwd->Edge(k) ) ) ) continue; //pdn I suppose that short segment should be inserted into the SAME vertex.
|
||||
|
||||
Standard_Integer sp = IsSamePatch ( wires(j), myGrid->NbUPatches(), myGrid->NbVPatches(),
|
||||
Standard_Boolean sp = IsSamePatch ( wires(j), myGrid->NbUPatches(), myGrid->NbVPatches(),
|
||||
iumin, iumax, ivmin, ivmax );
|
||||
if ( samepatch && !sp) continue;
|
||||
gp_Pnt2d pp;
|
||||
@@ -2510,7 +2510,7 @@ void ShapeFix_ComposeShell::MakeFacesOnPatch (TopTools_SequenceOfShape &faces,
|
||||
else
|
||||
continue;
|
||||
TopAbs_State state = clas.Perform (unp,Standard_False);
|
||||
if ( (Standard_Boolean) ( state == TopAbs_OUT ) == reverse ) {
|
||||
if ((state == TopAbs_OUT) == reverse) {
|
||||
holes.Append ( loops(j) );
|
||||
loops.Remove ( j-- );
|
||||
}
|
||||
|
@@ -1095,7 +1095,7 @@ Standard_Boolean ShapeFix_Face::FixOrientation(TopTools_DataMapOfShapeListOfShap
|
||||
TopoDS_Face af = TopoDS::Face ( dummy );
|
||||
af.Orientation ( TopAbs_FORWARD );
|
||||
B.Add (af,ws.Value(1));
|
||||
if ((myFixAddNaturalBoundMode != Standard_True || //: abv 29.08.01: Spatial_firex_lofting.sat
|
||||
if ((myFixAddNaturalBoundMode != 1 ||
|
||||
!IsSurfaceUVPeriodic (mySurf->Surface()) ) &&
|
||||
!ShapeAnalysis::IsOuterBound (af) )
|
||||
{
|
||||
|
@@ -144,7 +144,7 @@ Standard_Boolean ShapeFix_Shape::Perform(const Handle(Message_ProgressIndicator)
|
||||
case TopAbs_COMPOUND:
|
||||
case TopAbs_COMPSOLID: {
|
||||
TopoDS_Shape shape = myShape;
|
||||
Standard_Boolean savFixSameParameterMode = myFixSameParameterMode;
|
||||
Standard_Integer savFixSameParameterMode = myFixSameParameterMode;
|
||||
myFixSameParameterMode = Standard_False;
|
||||
myFixVertexTolMode = Standard_False;
|
||||
Standard_Integer aShapesNb = 0;
|
||||
@@ -195,7 +195,7 @@ Standard_Boolean ShapeFix_Shape::Perform(const Handle(Message_ProgressIndicator)
|
||||
case TopAbs_FACE: {
|
||||
if ( ! NeedFix ( myFixFaceMode ) ) break;
|
||||
Handle(ShapeFix_Face) sff = FixFaceTool();
|
||||
Standard_Integer savTopoMode = sff->FixWireTool()->ModifyTopologyMode();
|
||||
Standard_Boolean savTopoMode = sff->FixWireTool()->ModifyTopologyMode();
|
||||
sff->FixWireTool()->ModifyTopologyMode() = Standard_True;
|
||||
sff->Init(TopoDS::Face(S));
|
||||
sff->SetContext(Context());
|
||||
@@ -210,8 +210,8 @@ Standard_Boolean ShapeFix_Shape::Perform(const Handle(Message_ProgressIndicator)
|
||||
case TopAbs_WIRE: {
|
||||
if ( ! NeedFix ( myFixWireMode ) ) break;
|
||||
Handle(ShapeFix_Wire) sfw = FixWireTool();
|
||||
Standard_Integer savTopoMode = sfw->ModifyTopologyMode();
|
||||
Standard_Integer savClosedMode = sfw->ClosedWireMode();
|
||||
Standard_Boolean savTopoMode = sfw->ModifyTopologyMode();
|
||||
Standard_Boolean savClosedMode = sfw->ClosedWireMode();
|
||||
sfw->ModifyTopologyMode() = Standard_True;
|
||||
if ( ! S.Closed() )
|
||||
sfw->ClosedWireMode() = Standard_False;
|
||||
|
@@ -181,7 +181,7 @@ static Standard_Boolean GetFreeEdges(const TopoDS_Shape& aShape,TopTools_MapOfSh
|
||||
else MapEdges.Remove(edge);
|
||||
}
|
||||
}
|
||||
return (MapEdges.Extent());
|
||||
return !MapEdges.IsEmpty();
|
||||
}
|
||||
//=======================================================================
|
||||
// function : GetShells
|
||||
@@ -576,9 +576,7 @@ static void GlueClosedCandidate(TopTools_SequenceOfShape& OpenShells,
|
||||
|
||||
//Filling map MapOtherShells which contains candidate to creation of closed shell
|
||||
// with aShell.
|
||||
|
||||
TopTools_DataMapOfShapeInteger MapOtherShells;
|
||||
|
||||
NCollection_DataMap<TopoDS_Shape, Standard_Boolean, TopTools_ShapeMapHasher> MapOtherShells;
|
||||
for(Standard_Integer j = i+1 ; j <= OpenShells.Length();j++ ) {
|
||||
Standard_Boolean isAddShell = Standard_True;
|
||||
Standard_Boolean isReversed = Standard_False;
|
||||
@@ -603,17 +601,19 @@ static void GlueClosedCandidate(TopTools_SequenceOfShape& OpenShells,
|
||||
if(!isAddShell) continue;
|
||||
MapOtherShells.Bind(OpenShells.Value(j),isReversed);
|
||||
}
|
||||
if(!MapOtherShells.Extent()) continue;
|
||||
if(MapOtherShells.IsEmpty()) continue;
|
||||
|
||||
|
||||
if(MapOtherShells.Extent() >1) {
|
||||
|
||||
if (!MapOtherShells.IsEmpty())
|
||||
{
|
||||
// Case of compsolid when more than two shells have the same free boundary.
|
||||
TopTools_SequenceOfShape aSeqCandidate;
|
||||
aSeqCandidate.Append(OpenShells.Value(i));
|
||||
|
||||
for(TopTools_DataMapIteratorOfDataMapOfShapeInteger aIt(MapOtherShells); aIt.More(); aIt.Next())
|
||||
aSeqCandidate.Append(aIt.Key());
|
||||
for (NCollection_DataMap<TopoDS_Shape, Standard_Boolean, TopTools_ShapeMapHasher>::Iterator aIt(MapOtherShells); aIt.More(); aIt.Next())
|
||||
{
|
||||
aSeqCandidate.Append(aIt.Key());
|
||||
}
|
||||
|
||||
//Creation all possibly shells from choosen candidate.And
|
||||
// addition of them to temporary sequence.
|
||||
@@ -627,9 +627,9 @@ static void GlueClosedCandidate(TopTools_SequenceOfShape& OpenShells,
|
||||
aB.MakeShell(aNewSh);
|
||||
for(TopoDS_Iterator aIt1(aSeqCandidate.Value(k),Standard_False); aIt1.More(); aIt1.Next())
|
||||
aB.Add(aNewSh,aIt1.Value());
|
||||
Standard_Integer isRev = MapOtherShells.Find(aSeqCandidate.Value(l));
|
||||
Standard_Boolean isRev = MapOtherShells.Find(aSeqCandidate.Value(l));
|
||||
if(k !=1) {
|
||||
isRev = ((isRev == MapOtherShells.Find(aSeqCandidate.Value(k))) ? 1 : 0);
|
||||
isRev = (isRev == MapOtherShells.Find(aSeqCandidate.Value(k)));
|
||||
}
|
||||
for(TopExp_Explorer aExp(aSeqCandidate.Value(l),TopAbs_FACE); aExp.More(); aExp.Next()) {
|
||||
TopoDS_Shape aFace = (isRev ? aExp.Current().Reversed(): aExp.Current());
|
||||
@@ -656,9 +656,8 @@ static void GlueClosedCandidate(TopTools_SequenceOfShape& OpenShells,
|
||||
TopoDS_Shape addShell;
|
||||
Standard_Boolean isReversed = Standard_False;
|
||||
for(Standard_Integer j1 = i+1 ; j1 <= OpenShells.Length();j1++ ) {
|
||||
if(!MapOtherShells.IsBound(OpenShells.Value(j1))) continue;
|
||||
if(!MapOtherShells.Find (OpenShells.Value(j1), isReversed)) continue;
|
||||
addShell = OpenShells.Value(j1);
|
||||
isReversed = MapOtherShells.Find(addShell);
|
||||
OpenShells.Remove(j1);
|
||||
break;
|
||||
}
|
||||
|
@@ -587,9 +587,9 @@ TopoDS_Solid ShapeFix_Solid::SolidFromShell (const TopoDS_Shell& shell)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ShapeFix_Solid::Status(const ShapeExtend_Status /*status*/) const
|
||||
Standard_Boolean ShapeFix_Solid::Status (const ShapeExtend_Status theStatus) const
|
||||
{
|
||||
return myStatus;
|
||||
return ShapeExtend::DecodeStatus (myStatus, theStatus);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -343,7 +343,7 @@ Standard_Boolean ShapeFix_Wire::Perform()
|
||||
if ( !Context().IsNull() )
|
||||
myFixEdge->SetContext( Context() );
|
||||
|
||||
Standard_Integer Fixed = Standard_False;
|
||||
Standard_Boolean Fixed = Standard_False;
|
||||
|
||||
// FixReorder is first, because as a rule wire is required to be ordered
|
||||
// We shall analyze the order of edges in the wire and set appropriate
|
||||
|
Reference in New Issue
Block a user