1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-09 18:50:54 +03:00

0028776: Extend the field BOPAlgo_Builder::myOrigins so that the shape could have multiple origins

Change the type of the field BOPAlgo_Builder::myOrigins so that the new shape could have multiple origins in case of overlapping.
This commit is contained in:
emv 2017-05-03 15:42:53 +03:00 committed by bugmaster
parent c8425f03ff
commit b18a83d4a7
9 changed files with 100 additions and 30 deletions

View File

@ -1240,7 +1240,8 @@ The following Grid management methods within class V3d_Viewer do not implicitly
* Types GeomPlate_Array1OfHCurveOnSurface and GeomPlate_HArray1OfHCurveOnSurface have been replaced with GeomPlate_Array1OfHCurve and GeomPlate_HArray1OfHCurve correspondingly (accept base class Adaptor3d_HCurve instead of Adaptor3d_HCurveOnSurface). * Types GeomPlate_Array1OfHCurveOnSurface and GeomPlate_HArray1OfHCurveOnSurface have been replaced with GeomPlate_Array1OfHCurve and GeomPlate_HArray1OfHCurve correspondingly (accept base class Adaptor3d_HCurve instead of Adaptor3d_HCurveOnSurface).
* Enumeration *Image_PixMap::ImgFormat*, previously declared as nested enumeration within class *Image_PixMap*, has been moved to global namespace as *Image_Format* following OCCT coding rules. * Enumeration *Image_PixMap::ImgFormat*, previously declared as nested enumeration within class *Image_PixMap*, has been moved to global namespace as *Image_Format* following OCCT coding rules.
The enumeration values have suffix Image_Format_ and preserve previous name scheme for easy renaming of old values - e.g. Image_PixMap::ImgGray become Image_Format_Gray. The enumeration values have suffix Image_Format_ and preserve previous name scheme for easy renaming of old values - e.g. Image_PixMap::ImgGray become Image_Format_Gray.
Old definitions are preserved as depreacated aliases to the new ones. Old definitions are preserved as depreacated aliases to the new ones;
* The method BOPAlgo_Builder::Origins() returns BOPCol_DataMapOfShapeListOfShape instead of BOPCol_DataMapOfShapeShape.
@subsection upgrade_720_BOP_DataStructure BOP - Pairs of interfering indices @subsection upgrade_720_BOP_DataStructure BOP - Pairs of interfering indices

View File

@ -148,7 +148,7 @@ const BOPCol_DataMapOfShapeListOfShape& BOPAlgo_Builder::Images()const
//function : Origins //function : Origins
//purpose : //purpose :
//======================================================================= //=======================================================================
const BOPCol_DataMapOfShapeShape& BOPAlgo_Builder::Origins()const const BOPCol_DataMapOfShapeListOfShape& BOPAlgo_Builder::Origins()const
{ {
return myOrigins; return myOrigins;
} }

View File

@ -86,7 +86,7 @@ Standard_EXPORT virtual ~BOPAlgo_Builder();
Standard_EXPORT Standard_Boolean IsInterferred (const TopoDS_Shape& theS) const; Standard_EXPORT Standard_Boolean IsInterferred (const TopoDS_Shape& theS) const;
//! Returns myOrigins. //! Returns myOrigins.
Standard_EXPORT const BOPCol_DataMapOfShapeShape& Origins() const; Standard_EXPORT const BOPCol_DataMapOfShapeListOfShape& Origins() const;
//! Returns myShapesSD. //! Returns myShapesSD.
Standard_EXPORT const BOPCol_DataMapOfShapeShape& ShapesSD() const; Standard_EXPORT const BOPCol_DataMapOfShapeShape& ShapesSD() const;
@ -171,7 +171,7 @@ protected:
BOPCol_DataMapOfShapeListOfShape myImages; BOPCol_DataMapOfShapeListOfShape myImages;
BOPCol_DataMapOfShapeShape myShapesSD; BOPCol_DataMapOfShapeShape myShapesSD;
BOPCol_DataMapOfShapeListOfShape mySplits; BOPCol_DataMapOfShapeListOfShape mySplits;
BOPCol_DataMapOfShapeShape myOrigins; BOPCol_DataMapOfShapeListOfShape myOrigins;
Standard_Boolean myNonDestructive; Standard_Boolean myNonDestructive;
BOPAlgo_GlueEnum myGlue; BOPAlgo_GlueEnum myGlue;

View File

@ -38,7 +38,7 @@
//function : FillImagesVertices //function : FillImagesVertices
//purpose : //purpose :
//======================================================================= //=======================================================================
void BOPAlgo_Builder::FillImagesVertices() void BOPAlgo_Builder::FillImagesVertices()
{ {
myErrorStatus=0; myErrorStatus=0;
// //
@ -59,6 +59,12 @@
myImages.Bind(aV, aLVSD); myImages.Bind(aV, aLVSD);
// //
myShapesSD.Bind(aV, aVSD); myShapesSD.Bind(aV, aVSD);
//
BOPCol_ListOfShape* pLOr = myOrigins.ChangeSeek(aVSD);
if (!pLOr) {
pLOr = myOrigins.Bound(aVSD, BOPCol_ListOfShape());
}
pLOr->Append(aV);
} }
} }
//======================================================================= //=======================================================================
@ -97,7 +103,12 @@
Standard_Integer nSpR = aPBR->Edge(); Standard_Integer nSpR = aPBR->Edge();
const TopoDS_Shape& aSpR = myDS->Shape(nSpR); const TopoDS_Shape& aSpR = myDS->Shape(nSpR);
pLS->Append(aSpR); pLS->Append(aSpR);
myOrigins.Bind(aSpR, aE); //
BOPCol_ListOfShape* pLOr = myOrigins.ChangeSeek(aSpR);
if (!pLOr) {
pLOr = myOrigins.Bound(aSpR, BOPCol_ListOfShape());
}
pLOr->Append(aE);
// //
if (myDS->IsCommonBlockOnEdge(aPB)) { if (myDS->IsCommonBlockOnEdge(aPB)) {
Standard_Integer nSp = aPB->Edge(); Standard_Integer nSp = aPB->Edge();

View File

@ -707,7 +707,12 @@ void BOPAlgo_Builder::FillImagesFaces1()
aItLS.Initialize(aLFIm); aItLS.Initialize(aLFIm);
for (; aItLS.More(); aItLS.Next()) { for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Face& aFSp=(*(TopoDS_Face*)(&aItLS.Value())); const TopoDS_Face& aFSp=(*(TopoDS_Face*)(&aItLS.Value()));
myOrigins.Bind(aFSp, aF); //
BOPCol_ListOfShape* pLOr = myOrigins.ChangeSeek(aFSp);
if (!pLOr) {
pLOr = myOrigins.Bound(aFSp, BOPCol_ListOfShape());
}
pLOr->Append(aF);
} }
// //
// 3. // 3.

View File

@ -894,10 +894,7 @@ void BOPAlgo_Builder::BuildSplitSolids
const BOPCol_ListOfShape& aLSR=aBS.Areas(); const BOPCol_ListOfShape& aLSR=aBS.Areas();
// //
if (!myImages.IsBound(aS)) { if (!myImages.IsBound(aS)) {
BOPCol_ListOfShape aLSx; BOPCol_ListOfShape* pLSx = myImages.Bound(aS, BOPCol_ListOfShape());
//
myImages.Bind(aS, aLSx);
BOPCol_ListOfShape& aLSIm=myImages.ChangeFind(aS);
// //
aIt.Initialize(aLSR); aIt.Initialize(aLSR);
for (; aIt.More(); aIt.Next()) { for (; aIt.More(); aIt.Next()) {
@ -910,7 +907,13 @@ void BOPAlgo_Builder::BuildSplitSolids
// //
const BOPTools_Set& aSTx=aMST.Added(aST); const BOPTools_Set& aSTx=aMST.Added(aST);
const TopoDS_Shape& aSx=aSTx.Shape(); const TopoDS_Shape& aSx=aSTx.Shape();
aLSIm.Append(aSx); pLSx->Append(aSx);
//
BOPCol_ListOfShape* pLOr = myOrigins.ChangeSeek(aSx);
if (!pLOr) {
pLOr = myOrigins.Bound(aSx, BOPCol_ListOfShape());
}
pLOr->Append(aS);
// //
if (bFlagSD) { if (bFlagSD) {
myShapesSD.Bind(aSR, aSx); myShapesSD.Bind(aSR, aSx);
@ -1105,8 +1108,8 @@ void BOPAlgo_Builder::FillInternalShapes()
continue; continue;
} }
// //
if(aMSOr.Contains(aSd)) { if (aMSOr.Contains(aSd)) {
// // make new solid
TopoDS_Solid aSdx; TopoDS_Solid aSdx;
// //
aBB.MakeSolid(aSdx); aBB.MakeSolid(aSdx);
@ -1118,15 +1121,12 @@ void BOPAlgo_Builder::FillInternalShapes()
// //
aBB.Add(aSdx, aSI); aBB.Add(aSdx, aSI);
// //
if (myImages.IsBound(aSdx)) { // no need to check for images of aSd as aMSOr contains only original solids
BOPCol_ListOfShape& aLS=myImages.ChangeFind(aSdx); BOPCol_ListOfShape* pLS = myImages.Bound(aSd, BOPCol_ListOfShape());
aLS.Append(aSdx); pLS->Append(aSdx);
} //
else { BOPCol_ListOfShape* pLOr = myOrigins.Bound(aSdx, BOPCol_ListOfShape());
BOPCol_ListOfShape aLS; pLOr->Append(aSd);
aLS.Append(aSdx);
myImages.Bind(aSd, aLS);
}
// //
aMSOr.Remove(aSd); aMSOr.Remove(aSd);
aSd=aSdx; aSd=aSdx;

View File

@ -1200,20 +1200,34 @@ Standard_Integer boporigin(Draw_Interpretor& di,
return 0; return 0;
} }
// //
char buf[32];
//
BOPAlgo_Builder& aBuilder = BOPTest_Objects::Builder(); BOPAlgo_Builder& aBuilder = BOPTest_Objects::Builder();
const BOPCol_DataMapOfShapeShape& aDMI = aBuilder.Origins(); const BOPCol_DataMapOfShapeListOfShape& aDMI = aBuilder.Origins();
if (!aDMI.IsBound(aS)) { if (!aDMI.IsBound(aS)) {
di << " no origins found\n"; di << " no origins found\n";
return 0; return 0;
} }
// //
const TopoDS_Shape& aSx = aDMI.Find(aS); char buf[32];
//
sprintf(buf, "%s_or", a[1]); sprintf(buf, "%s_or", a[1]);
DBRep::Set(buf, aSx);
// //
const BOPCol_ListOfShape& aLSx = aDMI.Find(aS);
if (aLSx.Extent() == 1) {
DBRep::Set(buf, aLSx.First());
di << "1 origin found\n" << buf << "\n";
return 0;
}
//
TopoDS_Compound aCOr;
BRep_Builder().MakeCompound(aCOr);
//
BOPCol_ListIteratorOfListOfShape aItLSx(aLSx);
for (; aItLSx.More(); aItLSx.Next()) {
BRep_Builder().Add(aCOr, aItLSx.Value());
}
//
DBRep::Set(buf, aCOr);
//
di << aLSx.Extent() << " origins found\n";
di << buf << "\n"; di << buf << "\n";
// //
return 0; return 0;

View File

@ -491,7 +491,12 @@
aSx=aSTx.Shape(); aSx=aSTx.Shape();
aSx.Orientation(anOriF); aSx.Orientation(anOriF);
aLFIm.Append(aSx); aLFIm.Append(aSx);
myOrigins.Bind(aSx, aF); //
BOPCol_ListOfShape* pLOr = myOrigins.ChangeSeek(aSx);
if (!pLOr) {
pLOr = myOrigins.Bound(aSx, BOPCol_ListOfShape());
}
pLOr->Append(aF);
// //
if (bFlagSD) { if (bFlagSD) {
myShapesSD.Bind(aFR, aSx); myShapesSD.Bind(aFR, aSx);

View File

@ -0,0 +1,34 @@
puts "========"
puts "OCC28776"
puts "========"
puts ""
####################################################################
# Extend the field BOPAlgo_Builder::myOrigins so that the shape could have multiple origins
####################################################################
box b1 10 10 10
box b2 10 10 10
box b3 10 10 10
bclearobjects
bcleartools
baddobjects b1 b2 b3
bfillds
bbuild r
explode r v
boporigin r_1
checknbshapes r_1_or -vertex 3
explode r e
boporigin r_1
checknbshapes r_1_or -edge 3
explode r f
boporigin r_1
checknbshapes r_1_or -face 3
explode r so
boporigin r_1
checknbshapes r_1_or -solid 3