Mantis issue 0021191: GlueEdges and GlueFaces problem with tolerance 1. A fix by PKV.

This commit is contained in:
jfa 2012-03-16 13:23:39 +00:00
parent 426cef8148
commit f91bad6fb6
7 changed files with 575 additions and 280 deletions

View File

@ -18,12 +18,10 @@
// 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 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: GEOMAlgo_GlueDetector.cxx // File: GEOMAlgo_GlueDetector.cxx
// Created:
// Author: Peter KURNEV // Author: Peter KURNEV
// <pkv@irinox>
//
#include <GEOMAlgo_GlueDetector.hxx> #include <GEOMAlgo_GlueDetector.hxx>
#include <Bnd_Box.hxx> #include <Bnd_Box.hxx>
@ -61,6 +59,21 @@
#include <GEOMAlgo_PassKeyShape.hxx> #include <GEOMAlgo_PassKeyShape.hxx>
#include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx> #include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
#include <GEOMAlgo_Tools.hxx> #include <GEOMAlgo_Tools.hxx>
//
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_MapOfShape.hxx>
//modified by NIZNHY-PKV Tue Mar 13 10:25:47 2012f
static
Standard_Integer CheckAncesstors
(const TopoDS_Shape& aVSD,
const TopTools_MapOfShape& aMVSD,
const TopTools_IndexedDataMapOfShapeListOfShape& aMVE,
const TopTools_IndexedDataMapOfShapeListOfShape& aMEV,
TopTools_IndexedDataMapOfShapeListOfShape& aMEVZ);
//modified by NIZNHY-PKV Tue Mar 13 10:25:50 2012t
//======================================================================= //=======================================================================
//function : //function :
@ -77,6 +90,17 @@ GEOMAlgo_GlueDetector::GEOMAlgo_GlueDetector()
//======================================================================= //=======================================================================
GEOMAlgo_GlueDetector::~GEOMAlgo_GlueDetector() GEOMAlgo_GlueDetector::~GEOMAlgo_GlueDetector()
{} {}
//modified by NIZNHY-PKV Tue Mar 13 12:26:50 2012f
//=======================================================================
//function : StickedShapes
//purpose :
//=======================================================================
const TopTools_IndexedDataMapOfShapeListOfShape&
GEOMAlgo_GlueDetector::StickedShapes()
{
return myStickedShapes;
}
//modified by NIZNHY-PKV Tue Mar 13 12:26:54 2012t
//======================================================================= //=======================================================================
//function : Perform //function : Perform
//purpose : //purpose :
@ -85,6 +109,7 @@ void GEOMAlgo_GlueDetector::Perform()
{ {
myErrorStatus=0; myErrorStatus=0;
myWarningStatus=0; myWarningStatus=0;
myStickedShapes.Clear();
// //
CheckData(); CheckData();
if (myErrorStatus) { if (myErrorStatus) {
@ -99,6 +124,13 @@ void GEOMAlgo_GlueDetector::Perform()
return; return;
} }
// //
//modified by NIZNHY-PKV Wed Mar 14 08:00:09 2012f
CheckDetected();
if (myErrorStatus) {
return;
}
//modified by NIZNHY-PKV Wed Mar 14 08:00:12 2012t
//
DetectEdges(); DetectEdges();
if (myErrorStatus) { if (myErrorStatus) {
return; return;
@ -127,7 +159,6 @@ void GEOMAlgo_GlueDetector::DetectVertices()
TopTools_DataMapOfShapeListOfShape aMVV; TopTools_DataMapOfShapeListOfShape aMVV;
GEOMAlgo_IndexedDataMapOfIntegerShape aMIS; GEOMAlgo_IndexedDataMapOfIntegerShape aMIS;
NMTDS_IndexedDataMapOfShapeBndSphere aMSB; NMTDS_IndexedDataMapOfShapeBndSphere aMSB;
//
NMTDS_BndSphereTreeSelector aSelector; NMTDS_BndSphereTreeSelector aSelector;
NMTDS_BndSphereTree aBBTree; NMTDS_BndSphereTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, NMTDS_BndSphere> aTreeFiller(aBBTree); NCollection_UBTreeFiller <Standard_Integer, NMTDS_BndSphere> aTreeFiller(aBBTree);
@ -356,6 +387,7 @@ void GEOMAlgo_GlueDetector::DetectShapes(const TopAbs_ShapeEnum aType)
} }
// //
myImages.Bind(aS1, aLSDF); myImages.Bind(aS1, aLSDF);
//
// origins // origins
aItLS.Initialize(aLSDF); aItLS.Initialize(aLSDF);
for (; aItLS.More(); aItLS.Next()) { for (; aItLS.More(); aItLS.Next()) {
@ -428,3 +460,152 @@ void GEOMAlgo_GlueDetector::EdgePassKey(const TopoDS_Edge& aE,
// //
aPK.SetShapes(aLV); aPK.SetShapes(aLV);
} }
//modified by NIZNHY-PKV Tue Mar 13 09:54:18 2012f
//=======================================================================
//function : CheckDetected
//purpose :
//=======================================================================
void GEOMAlgo_GlueDetector::CheckDetected()
{
TopoDS_Iterator aItA;
TopExp_Explorer aExp;
TopTools_ListOfShape aLV;
TopTools_MapOfShape aMFence;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
TopTools_IndexedDataMapOfShapeListOfShape aMVE, aMEV;
//
// 1. aMVE, aMEV
TopExp::MapShapesAndAncestors(myArgument, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
//
aExp.Init(myArgument, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aE=aExp.Current();
//
aLV.Clear();
aMFence.Clear();
aItA.Initialize(aE);
for (; aItA.More(); aItA.Next()) {
const TopoDS_Shape& aV=aItA.Value();
if (aMFence.Add(aV)) {
aLV.Append(aV);
}
}
//
aMEV.Add(aE, aLV);
}
// 2. Checking
aItIm.Initialize(myImages);
for (; aItIm.More(); aItIm.Next()) {
//const TopoDS_Shape& aV=aItIm.Key();
const TopTools_ListOfShape& aLVSD=aItIm.Value();
CheckDetected(aLVSD, aMVE, aMEV);
}
}
//=======================================================================
//function : CheckDetected
//purpose :
//=======================================================================
void GEOMAlgo_GlueDetector::CheckDetected
(const TopTools_ListOfShape& aLVSD,
const TopTools_IndexedDataMapOfShapeListOfShape& aMVE,
const TopTools_IndexedDataMapOfShapeListOfShape& aMEV)
{
Standard_Integer i, aNbVSD, aNbA, iRet;
TopAbs_ShapeEnum aTypeS, aTypeA[2];
TopExp_Explorer aExp, aExpA;
TopTools_MapOfShape aMFence, aMVSD;
TopTools_ListOfShape aLV;
TopTools_ListIteratorOfListOfShape aItLS;
//
myErrorStatus=0;
//
aNbVSD=aLVSD.Extent();
if (aNbVSD < 2) {
return ;
}
//
aItLS.Initialize(aLVSD);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aVSD=aItLS.Value();
aMVSD.Add(aVSD);
}
//
aItLS.Initialize(aLVSD);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aVSD=aItLS.Value();
//
iRet=CheckAncesstors(aVSD, aMVSD, aMVE, aMEV, myStickedShapes);
if (iRet) {
// Sticked shapes detected
myWarningStatus=2;
}
}
}
//=======================================================================
//function : CheckAncesstors
//purpose :
//=======================================================================
Standard_Integer CheckAncesstors
(const TopoDS_Shape& aVSD,
const TopTools_MapOfShape& aMVSD,
const TopTools_IndexedDataMapOfShapeListOfShape& aMVE,
const TopTools_IndexedDataMapOfShapeListOfShape& aMEV,
TopTools_IndexedDataMapOfShapeListOfShape& aMEVZ)
{
Standard_Address pLE, pLV, pLVZ;
Standard_Integer iRet, aNbVX;
TopTools_ListIteratorOfListOfShape aItLE, aItLV;
TopTools_MapOfShape aMFence;
TopTools_ListOfShape aLVX;
//
iRet=0;
//
pLE=aMVE.FindFromKey1(aVSD);
if (!pLE) {
return iRet;
}
//
const TopTools_ListOfShape& aLE=*((TopTools_ListOfShape*)pLE);
aItLE.Initialize(aLE);
for (; aItLE.More(); aItLE.Next()) {
const TopoDS_Shape& aE=aItLE.Value();
//
pLV=aMEV.FindFromKey1(aE);
if (!pLV) {
continue; // it should be not so
}
//
aLVX.Clear();
const TopTools_ListOfShape& aLV=*((TopTools_ListOfShape*)pLV);
aItLV.Initialize(aLV);
for (; aItLV.More(); aItLV.Next()) {
const TopoDS_Shape& aV=aItLV.Value();
if (!aV.IsSame(aVSD)) {
if (aMVSD.Contains(aV)) {
if (aMFence.Add(aV)) {
aLVX.Append(aV);
}
}
}
}
//
aNbVX=aLVX.Extent();
if (!aNbVX) {
continue;
}
//
iRet=1;
//
pLVZ=aMEVZ.FindFromKey1(aE);
if (!pLVZ) {
aMEVZ.Add(aE, aLVX);
}
else {
TopTools_ListOfShape& aLVZ=*((TopTools_ListOfShape*)pLVZ);
aLVZ.Append(aLVX);
}
}
//
return iRet;
}
//modified by NIZNHY-PKV Tue Mar 13 09:54:59 2012t

View File

@ -18,50 +18,82 @@
// 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 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: GEOMAlgo_GlueDetector.hxx // File: GEOMAlgo_GlueDetector.hxx
// Created:
// Author: Peter KURNEV // Author: Peter KURNEV
// <pkv@irinox>
//
#ifndef _GEOMAlgo_GlueDetector_HeaderFile #ifndef _GEOMAlgo_GlueDetector_HeaderFile
#define _GEOMAlgo_GlueDetector_HeaderFile #define _GEOMAlgo_GlueDetector_HeaderFile
#include <Standard.hxx> #include <Standard.hxx>
#include <Standard_Macro.hxx> #include <Standard_Macro.hxx>
#include <GEOMAlgo_GluerAlgo.hxx>
#include <TopAbs_ShapeEnum.hxx> #include <TopAbs_ShapeEnum.hxx>
#include <GEOMAlgo_PassKeyShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <GEOMAlgo_GluerAlgo.hxx>
#include <GEOMAlgo_Algo.hxx> #include <GEOMAlgo_Algo.hxx>
#include <GEOMAlgo_PassKeyShape.hxx>
//======================================================================= //=======================================================================
//function : GEOMAlgo_GlueDetector //function : GEOMAlgo_GlueDetector
//purpose : //purpose :
//======================================================================= //=======================================================================
class GEOMAlgo_GlueDetector : public GEOMAlgo_GluerAlgo, class GEOMAlgo_GlueDetector : public GEOMAlgo_GluerAlgo,
public GEOMAlgo_Algo { public GEOMAlgo_Algo
{
public: public:
Standard_EXPORT GEOMAlgo_GlueDetector(); Standard_EXPORT
GEOMAlgo_GlueDetector();
Standard_EXPORT virtual ~GEOMAlgo_GlueDetector(); Standard_EXPORT virtual
~GEOMAlgo_GlueDetector();
Standard_EXPORT virtual
void Perform() ;
//modified by NIZNHY-PKV Tue Mar 13 12:23:20 2012f
Standard_EXPORT
const TopTools_IndexedDataMapOfShapeListOfShape& StickedShapes();
//modified by NIZNHY-PKV Tue Mar 13 12:23:26 2012t
//------------------------------------------------
protected:
Standard_EXPORT
void DetectVertices() ;
Standard_EXPORT
void DetectEdges() ;
Standard_EXPORT
void DetectFaces() ;
Standard_EXPORT
void DetectShapes(const TopAbs_ShapeEnum aType) ;
Standard_EXPORT
void EdgePassKey(const TopoDS_Edge& aE,
GEOMAlgo_PassKeyShape& aPK) ;
Standard_EXPORT
void FacePassKey(const TopoDS_Face& aF,
GEOMAlgo_PassKeyShape& aPK) ;
//modified by NIZNHY-PKV Tue Mar 13 09:53:03 2012f
Standard_EXPORT
void CheckDetected();
//
Standard_EXPORT
void CheckDetected
(const TopTools_ListOfShape& aLVSD,
const TopTools_IndexedDataMapOfShapeListOfShape& aMVE,
const TopTools_IndexedDataMapOfShapeListOfShape& aMEV);
Standard_EXPORT virtual void Perform() ;
protected: protected:
Standard_EXPORT void DetectVertices() ; TopTools_IndexedDataMapOfShapeListOfShape myStickedShapes;
//modified by NIZNHY-PKV Tue Mar 13 09:53:08 2012t
Standard_EXPORT void DetectEdges() ;
Standard_EXPORT void DetectFaces() ;
Standard_EXPORT void DetectShapes(const TopAbs_ShapeEnum aType) ;
Standard_EXPORT void EdgePassKey(const TopoDS_Edge& aE,
GEOMAlgo_PassKeyShape& aPK) ;
Standard_EXPORT void FacePassKey(const TopoDS_Face& aF,
GEOMAlgo_PassKeyShape& aPK) ;
private:
}; };
#endif #endif

View File

@ -18,7 +18,7 @@
// 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 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: GEOMAlgo_Gluer2.cxx // File: GEOMAlgo_Gluer2.cxx
// Author: Peter KURNEV // Author: Peter KURNEV
@ -81,7 +81,21 @@ void GEOMAlgo_Gluer2::Clear()
myImagesToWork.Clear(); myImagesToWork.Clear();
myOriginsToWork.Clear(); myOriginsToWork.Clear();
myKeepNonSolids=Standard_False; myKeepNonSolids=Standard_False;
//modified by NIZNHY-PKV Tue Mar 13 13:38:28 2012f
myDetector.Clear();
//modified by NIZNHY-PKV Tue Mar 13 13:38:30 2012t
} }
//modified by NIZNHY-PKV Tue Mar 13 12:26:50 2012f
//=======================================================================
//function : StickedShapes
//purpose :
//=======================================================================
const TopTools_IndexedDataMapOfShapeListOfShape&
GEOMAlgo_Gluer2::StickedShapes()
{
return myDetector.StickedShapes();
}
//modified by NIZNHY-PKV Tue Mar 13 12:26:54 2012t
//======================================================================= //=======================================================================
//function : SetShapesToGlue //function : SetShapesToGlue
//purpose : //purpose :
@ -151,7 +165,8 @@ void GEOMAlgo_Gluer2::Perform()
if (myErrorStatus) { if (myErrorStatus) {
return; return;
} }
if (myWarningStatus==1) {// no shapes to glue if (myWarningStatus==1) {
// no shapes to glue
myShape=myArgument; myShape=myArgument;
return; return;
} }
@ -426,9 +441,7 @@ void GEOMAlgo_Gluer2::FillContainers(const TopAbs_ShapeEnum aType)
} }
// //
GEOMAlgo_Tools3D::MakeContainer(aType, aWnew); GEOMAlgo_Tools3D::MakeContainer(aType, aWnew);
//modified by NIZNHY-PKV Tue May 10 13:46:30 2011f
aWnew.Orientation(aW.Orientation()); aWnew.Orientation(aW.Orientation());
//modified by NIZNHY-PKV Tue May 10 13:46:32 2011t
// //
aItS.Initialize(aW); aItS.Initialize(aW);
for (; aItS.More(); aItS.Next()) { for (; aItS.More(); aItS.Next()) {
@ -448,10 +461,6 @@ void GEOMAlgo_Gluer2::FillContainers(const TopAbs_ShapeEnum aType)
} }
} }
// //
//modified by NIZNHY-PKV Tue May 10 13:46:19 2011f
//aWnew.Orientation(aW.Orientation());
//modified by NIZNHY-PKV Tue May 10 13:46:22 2011t
//
//myImages / myOrigins //myImages / myOrigins
TopTools_ListOfShape aLSD; TopTools_ListOfShape aLSD;
// //
@ -632,3 +641,9 @@ void GEOMAlgo_Gluer2::BuildResult()
// //
// WarningStatus // WarningStatus
// 1 - no shapes to glue // 1 - no shapes to glue
// 2 - sticked shapes are detected.
// The value of myTolerance is so large that
// subshapes of a shape becomes intefere
// (e.g. vertices of an edge).
// In the case
// the result is can not be obtained

View File

@ -18,26 +18,28 @@
// 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 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: GEOMAlgo_Gluer2.hxx // File: GEOMAlgo_Gluer2.hxx
// Created:
// Author: Peter KURNEV // Author: Peter KURNEV
// <pkv@irinox>
#ifndef _GEOMAlgo_Gluer2_HeaderFile #ifndef _GEOMAlgo_Gluer2_HeaderFile
#define _GEOMAlgo_Gluer2_HeaderFile #define _GEOMAlgo_Gluer2_HeaderFile
#include <Standard.hxx> #include <Standard.hxx>
#include <Standard_Macro.hxx> #include <Standard_Macro.hxx>
#include <Standard_Boolean.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx> #include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx> #include <TopTools_DataMapOfShapeShape.hxx>
#include <Standard_Boolean.hxx>
#include <GEOMAlgo_GluerAlgo.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <NMTTools_CoupleOfShape.hxx> #include <NMTTools_CoupleOfShape.hxx>
#include <NMTTools_ListOfCoupleOfShape.hxx> #include <NMTTools_ListOfCoupleOfShape.hxx>
#include <GEOMAlgo_GluerAlgo.hxx>
#include <GEOMAlgo_BuilderShape.hxx> #include <GEOMAlgo_BuilderShape.hxx>
#include <GEOMAlgo_GlueDetector.hxx>
//======================================================================= //=======================================================================
//class : GEOMAlgo_Gluer2 //class : GEOMAlgo_Gluer2
@ -47,88 +49,127 @@ class GEOMAlgo_Gluer2 : public GEOMAlgo_GluerAlgo,
public GEOMAlgo_BuilderShape { public GEOMAlgo_BuilderShape {
public: public:
Standard_EXPORT GEOMAlgo_Gluer2(); Standard_EXPORT
GEOMAlgo_Gluer2();
Standard_EXPORT virtual ~GEOMAlgo_Gluer2(); Standard_EXPORT
virtual ~GEOMAlgo_Gluer2();
Standard_EXPORT void SetShapesToGlue(const TopTools_DataMapOfShapeListOfShape& aM) ; Standard_EXPORT
void SetShapesToGlue(const TopTools_DataMapOfShapeListOfShape& aM) ;
Standard_EXPORT const TopTools_DataMapOfShapeListOfShape& ShapesToGlue() const; Standard_EXPORT
const TopTools_DataMapOfShapeListOfShape& ShapesToGlue() const;
Standard_EXPORT void SetKeepNonSolids(const Standard_Boolean theFlag) ; Standard_EXPORT
void SetKeepNonSolids(const Standard_Boolean theFlag) ;
Standard_EXPORT Standard_Boolean KeepNonSolids() const; Standard_EXPORT
Standard_Boolean KeepNonSolids() const;
Standard_EXPORT virtual void Clear() ; Standard_EXPORT virtual void Clear() ;
Standard_EXPORT virtual void Perform() ; Standard_EXPORT
virtual void Perform() ;
Standard_EXPORT virtual void CheckData() ; Standard_EXPORT
virtual void CheckData() ;
Standard_EXPORT void Detect() ; Standard_EXPORT
void Detect() ;
Standard_EXPORT const TopTools_DataMapOfShapeListOfShape& ShapesDetected() const; Standard_EXPORT
const TopTools_DataMapOfShapeListOfShape& ShapesDetected() const;
Standard_EXPORT const TopTools_DataMapOfShapeListOfShape& ImagesToWork() const; Standard_EXPORT
const TopTools_DataMapOfShapeListOfShape& ImagesToWork() const;
Standard_EXPORT virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS) ; Standard_EXPORT
virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS) ;
Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS) ; Standard_EXPORT
virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS) ;
Standard_EXPORT virtual Standard_Boolean IsDeleted(const TopoDS_Shape& theS) ; Standard_EXPORT
virtual Standard_Boolean IsDeleted(const TopoDS_Shape& theS) ;
Standard_EXPORT static void MakeVertex(const TopTools_ListOfShape& theLV, Standard_EXPORT
static void MakeVertex(const TopTools_ListOfShape& theLV,
TopoDS_Vertex& theV) ; TopoDS_Vertex& theV) ;
Standard_EXPORT static void MapBRepShapes(const TopoDS_Shape& theS, Standard_EXPORT
static void MapBRepShapes(const TopoDS_Shape& theS,
TopTools_MapOfShape& theM) ; TopTools_MapOfShape& theM) ;
Standard_EXPORT static void MapShapes(const TopoDS_Shape& theS, Standard_EXPORT
static void MapShapes(const TopoDS_Shape& theS,
TopTools_MapOfShape& theM) ; TopTools_MapOfShape& theM) ;
//modified by NIZNHY-PKV Tue Mar 13 12:23:20 2012f
Standard_EXPORT
const TopTools_IndexedDataMapOfShapeListOfShape& StickedShapes();
//modified by NIZNHY-PKV Tue Mar 13 12:23:26 2012t
//------------------------------------------------
protected: protected:
Standard_EXPORT
void PerformShapesToWork() ;
Standard_EXPORT void PerformShapesToWork() ; Standard_EXPORT
void FillVertices() ;
Standard_EXPORT void FillVertices() ; Standard_EXPORT
void FillEdges() ;
Standard_EXPORT void FillEdges() ; Standard_EXPORT
void FillWires() ;
Standard_EXPORT void FillWires() ; Standard_EXPORT
void FillFaces() ;
Standard_EXPORT void FillFaces() ; Standard_EXPORT
void FillShells() ;
Standard_EXPORT void FillShells() ; Standard_EXPORT
void FillSolids() ;
Standard_EXPORT void FillSolids() ; Standard_EXPORT
void FillCompSolids() ;
Standard_EXPORT void FillCompSolids() ; Standard_EXPORT
void FillCompounds() ;
Standard_EXPORT void FillCompounds() ; Standard_EXPORT
void BuildResult() ;
Standard_EXPORT void BuildResult() ; Standard_EXPORT
void FillBRepShapes(const TopAbs_ShapeEnum theType) ;
Standard_EXPORT void FillBRepShapes(const TopAbs_ShapeEnum theType) ; Standard_EXPORT
void FillContainers(const TopAbs_ShapeEnum theType) ;
Standard_EXPORT void FillContainers(const TopAbs_ShapeEnum theType) ; Standard_EXPORT
void FillCompound(const TopoDS_Shape& theC) ;
Standard_EXPORT void FillCompound(const TopoDS_Shape& theC) ; Standard_EXPORT
virtual void PrepareHistory() ;
Standard_EXPORT virtual void PrepareHistory() ; Standard_EXPORT
Standard_Boolean HasImage(const TopoDS_Shape& theC) ;
Standard_EXPORT Standard_Boolean HasImage(const TopoDS_Shape& theC) ; Standard_EXPORT
void MakeBRepShapes(const TopoDS_Shape& theS,
Standard_EXPORT void MakeBRepShapes(const TopoDS_Shape& theS,
TopoDS_Shape& theSnew) ; TopoDS_Shape& theSnew) ;
Standard_EXPORT void MakeEdge(const TopoDS_Edge& theE, Standard_EXPORT
void MakeEdge(const TopoDS_Edge& theE,
TopoDS_Edge& theEnew) ; TopoDS_Edge& theEnew) ;
Standard_EXPORT void MakeFace(const TopoDS_Face& theF, Standard_EXPORT
void MakeFace(const TopoDS_Face& theF,
TopoDS_Face& theFnew) ; TopoDS_Face& theFnew) ;
Standard_EXPORT void TreatPair(const NMTTools_CoupleOfShape& theCS, Standard_EXPORT
void TreatPair(const NMTTools_CoupleOfShape& theCS,
NMTTools_ListOfCoupleOfShape& theLCS) ; NMTTools_ListOfCoupleOfShape& theLCS) ;
protected: protected:
@ -138,7 +179,9 @@ protected:
TopTools_DataMapOfShapeListOfShape myImagesToWork; TopTools_DataMapOfShapeListOfShape myImagesToWork;
TopTools_DataMapOfShapeShape myOriginsToWork; TopTools_DataMapOfShapeShape myOriginsToWork;
Standard_Boolean myKeepNonSolids; Standard_Boolean myKeepNonSolids;
//modified by NIZNHY-PKV Tue Mar 13 13:30:40 2012f
GEOMAlgo_GlueDetector myDetector;
//modified by NIZNHY-PKV Tue Mar 13 13:30:43 2012t
private: private:
}; };
#endif #endif

View File

@ -18,9 +18,8 @@
// 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 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File: GEOMAlgo_Gluer2_3.cxx // File: GEOMAlgo_Gluer2_3.cxx
// Created:
// Author: Peter KURNEV // Author: Peter KURNEV
#include <GEOMAlgo_Gluer2.hxx> #include <GEOMAlgo_Gluer2.hxx>
@ -68,7 +67,7 @@ void GEOMAlgo_Gluer2::Detect()
Standard_Integer iErr, aNbSD; Standard_Integer iErr, aNbSD;
TopTools_ListIteratorOfListOfShape aItLS; TopTools_ListIteratorOfListOfShape aItLS;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS; TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS;
GEOMAlgo_GlueDetector aDetector; //GEOMAlgo_GlueDetector aDetector;
// //
myErrorStatus=0; myErrorStatus=0;
myWarningStatus=0; myWarningStatus=0;
@ -77,18 +76,31 @@ void GEOMAlgo_Gluer2::Detect()
myOriginsDetected.Clear(); myOriginsDetected.Clear();
// //
bCheckGeometry=Standard_True; bCheckGeometry=Standard_True;
aDetector.SetArgument(myArgument);
aDetector.SetTolerance(myTolerance);
aDetector.SetCheckGeometry(bCheckGeometry);
// //
aDetector.Perform(); //modified by NIZNHY-PKV Tue Mar 13 13:33:35 2012f
iErr=aDetector.ErrorStatus(); myDetector.Clear();
myDetector.SetContext(myContext);
//modified by NIZNHY-PKV Tue Mar 13 13:33:38 2012t
myDetector.SetArgument(myArgument);
myDetector.SetTolerance(myTolerance);
myDetector.SetCheckGeometry(bCheckGeometry);
//
myDetector.Perform();
iErr=myDetector.ErrorStatus();
if (iErr) { if (iErr) {
myErrorStatus=11;// Detector failed // Detector is failed
myErrorStatus=11;
return; return;
} }
//modified by NIZNHY-PKV Tue Mar 13 13:40:36 2012f
iErr=myDetector.WarningStatus();
if (iErr) {
// Sticked shapes are detected
myWarningStatus=2;
}
//modified by NIZNHY-PKV Tue Mar 13 13:40:39 2012t
// //
const TopTools_DataMapOfShapeListOfShape& aImages=aDetector.Images(); const TopTools_DataMapOfShapeListOfShape& aImages=myDetector.Images();
aItDMSLS.Initialize(aImages); aItDMSLS.Initialize(aImages);
for (; aItDMSLS.More(); aItDMSLS.Next()) { for (; aItDMSLS.More(); aItDMSLS.Next()) {
const TopoDS_Shape& aSkey=aItDMSLS.Key(); const TopoDS_Shape& aSkey=aItDMSLS.Key();
@ -114,7 +126,7 @@ void GEOMAlgo_Gluer2::Detect()
//======================================================================= //=======================================================================
void GEOMAlgo_Gluer2::PerformShapesToWork() void GEOMAlgo_Gluer2::PerformShapesToWork()
{ {
Standard_Integer aNbSG, i, j, aNbC, aNb, aNbSD; Standard_Integer aNbSG, i, j, k, aNbC, aNb, aNbSD;
TopTools_ListIteratorOfListOfShape aItLS1, aItLS2; TopTools_ListIteratorOfListOfShape aItLS1, aItLS2;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS; TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS;
NMTTools_CoupleOfShape aCS; NMTTools_CoupleOfShape aCS;
@ -153,7 +165,7 @@ void GEOMAlgo_Gluer2::PerformShapesToWork()
// //
// 1. Make pairs // 1. Make pairs
aItDMSLS.Initialize(myShapesToGlue); aItDMSLS.Initialize(myShapesToGlue);
for (; aItDMSLS.More(); aItDMSLS.Next()) { for (k=0; aItDMSLS.More(); aItDMSLS.Next(), ++k) {
//const TopoDS_Shape& aSkey=aItDMSLS.Key(); //const TopoDS_Shape& aSkey=aItDMSLS.Key();
const TopTools_ListOfShape& aLSG=aItDMSLS.Value(); const TopTools_ListOfShape& aLSG=aItDMSLS.Value();
aItLS1.Initialize(aLSG); aItLS1.Initialize(aLSG);
@ -345,27 +357,3 @@ void MapShapes1(const TopoDS_Shape& aS,
aM.Add(aSx); aM.Add(aSx);
} }
} }
/*
//=======================================================================
//function : MapShapes1
//purpose :
//=======================================================================
void MapShapes1(const TopoDS_Shape& aS,
const TopAbs_ShapeEnum aType,
TopTools_IndexedMapOfShape& aM)
{
TopExp_Explorer aExp (aS, aType);
while (aExp.More()) {
const TopoDS_Shape aSx=aExp.Current();
if (aType==TopAbs_EDGE) {
const TopoDS_Edge& aEx=*((TopoDS_Edge*)&aSx);
if (BRep_Tool::Degenerated(aEx)) {
aExp.Next();
continue;
}
}
aM.Add(aSx);
aExp.Next();
}
}
*/

View File

@ -818,6 +818,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_GLUE_EDGES_TITLE</source> <source>GEOM_GLUE_EDGES_TITLE</source>
<translation>Glue edges</translation> <translation>Glue edges</translation>
</message> </message>
<message>
<source>GLUE_ERROR_STICKED_SHAPES</source>
<translation>The tolerance value is too big. Sticked shapes are detected.</translation>
</message>
<message> <message>
<source>GEOM_LIMIT_TOLERANCE_TITLE</source> <source>GEOM_LIMIT_TOLERANCE_TITLE</source>
<translation>Limit tolerance</translation> <translation>Limit tolerance</translation>

View File

@ -18,7 +18,6 @@
// 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 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <Standard_Stream.hxx> #include <Standard_Stream.hxx>
@ -29,13 +28,13 @@
#include <GEOM_Object.hxx> #include <GEOM_Object.hxx>
#include <GEOM_Function.hxx> #include <GEOM_Function.hxx>
//#include <GEOMAlgo_Gluer.hxx>
//#include "GEOMAlgo_Gluer1.hxx"
#include "GEOMAlgo_Gluer2.hxx" #include "GEOMAlgo_Gluer2.hxx"
#include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx" #include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx"
#include "GEOMAlgo_CoupleOfShapes.hxx" #include "GEOMAlgo_CoupleOfShapes.hxx"
#include "GEOMAlgo_ListOfCoupleOfShapes.hxx" #include "GEOMAlgo_ListOfCoupleOfShapes.hxx"
#include <Basics_OCCTVersion.hxx>
#include "utilities.h" #include "utilities.h"
#include <TDataStd_IntegerArray.hxx> #include <TDataStd_IntegerArray.hxx>
@ -428,6 +427,39 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueWithWarnings (const TopoDS_Shape& theShape
// 2. Detect interferred shapes // 2. Detect interferred shapes
aGA.Detect(); aGA.Detect();
//modified by NIZNHY-PKV Tue Mar 13 14:07:12 2012f
#if OCC_VERSION_LARGE > 0x06050200
Standard_Integer iWrnDetect = aGA.WarningStatus();
if (iWrnDetect == 2) {
/*
TopTools_ListIteratorOfListOfShape aItLS;
// Sticked shapes are detected
const TopTools_IndexedDataMapOfShapeListOfShape& aIDMSS = pGluer2->StickedShapes();
Standard_Integer i, aNb = aIDMSS.Extent();
for (i = 1; i <= aNb; ++i) {
// ancestor aSa (edge, wire face,..)
const TopoDS_Shape& aSa = aIDMSS.FindKey(i);
// successors aSs (vertex, edge, ...)
// of the ancestor that are sticked
// for given value of the tolerance
const TopTools_ListOfShape& aLSS = aIDMSS.FindFromIndex(i);
aItLS.Initialize(aLSS);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aSs = aItLS.Value();
}
}
*/
Standard_Failure::Raise("GLUE_ERROR_STICKED_SHAPES");
//Standard_Failure::Raise("Sticked shapes are detected. The tolerance value is too big.");
//theWarning = "Sticked shapes are detected. The tolerance value is too big.";
}
#endif
//modified by NIZNHY-PKV Tue Mar 13 14:07:14 2012t
Standard_Integer iErr = aGA.ErrorStatus(); Standard_Integer iErr = aGA.ErrorStatus();
if (iErr) { if (iErr) {
switch (iErr) { switch (iErr) {