// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
+
// File: GEOMAlgo_GlueDetector.cxx
-// Created:
// Author: Peter KURNEV
-// <pkv@irinox>
-//
+
#include <GEOMAlgo_GlueDetector.hxx>
#include <Bnd_Box.hxx>
#include <GEOMAlgo_PassKeyShape.hxx>
#include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.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 :
-//purpose :
+//function :
+//purpose :
//=======================================================================
GEOMAlgo_GlueDetector::GEOMAlgo_GlueDetector()
:
{}
//=======================================================================
//function : ~
-//purpose :
+//purpose :
//=======================================================================
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
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_GlueDetector::Perform()
{
myErrorStatus=0;
myWarningStatus=0;
+ myStickedShapes.Clear();
//
CheckData();
if (myErrorStatus) {
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();
if (myErrorStatus) {
return;
}
//=======================================================================
//function : DetectVertices
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_GlueDetector::DetectVertices()
{
TopTools_DataMapOfShapeListOfShape aMVV;
GEOMAlgo_IndexedDataMapOfIntegerShape aMIS;
NMTDS_IndexedDataMapOfShapeBndSphere aMSB;
- //
NMTDS_BndSphereTreeSelector aSelector;
NMTDS_BndSphereTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, NMTDS_BndSphere> aTreeFiller(aBBTree);
aTreeFiller.Add(i, aBox);
//
aMIS.Add(i, aV);
- aMSB.Add(aV, aBox);
+ aMSB.Add(aV, aBox);
}
//
aTreeFiller.Fill();
aNbIP=aMIP.Extent();
aIt1.Initialize(aMIP);
for(; aIt1.More(); aIt1.Next()) {
- aIP=aIt1.Key();
- if (aMIPC.Contains(aIP)) {
- continue;
- }
- //
- const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
- const NMTDS_BndSphere& aBoxVP=aMSB.FindFromKey(aVP);
- //
- aSelector.Clear();
- aSelector.SetBox(aBoxVP);
- //
- aNbVSD=aBBTree.Select(aSelector);
- if (!aNbVSD) {
- continue; // it shoild not be so [at least IP itself]
- }
- //
- const TColStd_ListOfInteger& aLI=aSelector.Indices();
- aIt.Initialize(aLI);
- for (; aIt.More(); aIt.Next()) {
- aIP1=aIt.Value();
- if (aMIP.Contains(aIP1)) {
- continue;
- }
- aMIP1.Add(aIP1);
- } //for (; aIt.More(); aIt.Next()) {
+ aIP=aIt1.Key();
+ if (aMIPC.Contains(aIP)) {
+ continue;
+ }
+ //
+ const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
+ const NMTDS_BndSphere& aBoxVP=aMSB.FindFromKey(aVP);
+ //
+ aSelector.Clear();
+ aSelector.SetBox(aBoxVP);
+ //
+ aNbVSD=aBBTree.Select(aSelector);
+ if (!aNbVSD) {
+ continue; // it shoild not be so [at least IP itself]
+ }
+ //
+ const TColStd_ListOfInteger& aLI=aSelector.Indices();
+ aIt.Initialize(aLI);
+ for (; aIt.More(); aIt.Next()) {
+ aIP1=aIt.Value();
+ if (aMIP.Contains(aIP1)) {
+ continue;
+ }
+ aMIP1.Add(aIP1);
+ } //for (; aIt.More(); aIt.Next()) {
}//for(; aIt1.More(); aIt1.Next()) {
//
aNbIP1=aMIP1.Extent();
if (!aNbIP1) {
- break;
+ break;
}
//
aIt1.Initialize(aMIP);
for(; aIt1.More(); aIt1.Next()) {
- aIP=aIt1.Key();
- aMIPC.Add(aIP);
+ aIP=aIt1.Key();
+ aMIPC.Add(aIP);
}
//
aMIP.Clear();
aIt1.Initialize(aMIP1);
for(; aIt1.More(); aIt1.Next()) {
- aIP=aIt1.Key();
- aMIP.Add(aIP);
+ aIP=aIt1.Key();
+ aMIP.Add(aIP);
}
aMIP1.Clear();
}// while(1)
aIP=aIt1.Key();
const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
if (!j) {
- aVF=aVP;
+ aVF=aVP;
}
aLVSD.Append(aVP);
aMVProcessed.Add(aVP);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aVSD=aItS.Value();
if (!myOrigins.IsBound(aVSD)) {
- myOrigins.Bind(aVSD, aV);
+ myOrigins.Bind(aVSD, aV);
}
}
}
}
//=======================================================================
//function : DetectFaces
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_GlueDetector::DetectFaces()
{
}
//=======================================================================
//function : DetectEdges
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_GlueDetector::DetectEdges()
{
}
//=======================================================================
//function : DetectShapes
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_GlueDetector::DetectShapes(const TopAbs_ShapeEnum aType)
{
aNbF=aMF.Extent();
for (i=1; i<=aNbF; ++i) {
const TopoDS_Shape& aS=aMF(i);
- //
+ //
if (aType==TopAbs_FACE) {
const TopoDS_Face& aF=*((TopoDS_Face*)&aS);
FacePassKey(aF, aPKF);
continue;
}
//
- const TopoDS_Shape& aS1=aLSDF.First();
+ const TopoDS_Shape& aS1=aLSDF.First();
//
if (aType==TopAbs_EDGE) {
const TopoDS_Edge& aE1=*((TopoDS_Edge*)&aS1);
bDegenerated=BRep_Tool::Degenerated(aE1);
if (bDegenerated) {
- continue;
+ continue;
}
}
//
myImages.Bind(aS1, aLSDF);
+ //
// origins
aItLS.Initialize(aLSDF);
for (; aItLS.More(); aItLS.Next()) {
}
//=======================================================================
//function : FacePassKey
-//purpose :
+//purpose :
//=======================================================================
-void GEOMAlgo_GlueDetector::FacePassKey(const TopoDS_Face& aF,
- GEOMAlgo_PassKeyShape& aPK)
+void GEOMAlgo_GlueDetector::FacePassKey(const TopoDS_Face& aF,
+ GEOMAlgo_PassKeyShape& aPK)
{
Standard_Integer i, aNbE;
TopoDS_Shape aER;
if (BRep_Tool::Degenerated(aEE)) {
continue;
}
- //
+ //
if (myOrigins.IsBound(aE)) {
aER=myOrigins.Find(aE);
}
}
//=======================================================================
//function : EdgePassKey
-//purpose :
+//purpose :
//=======================================================================
-void GEOMAlgo_GlueDetector::EdgePassKey(const TopoDS_Edge& aE,
- GEOMAlgo_PassKeyShape& aPK)
+void GEOMAlgo_GlueDetector::EdgePassKey(const TopoDS_Edge& aE,
+ GEOMAlgo_PassKeyShape& aPK)
{
TopAbs_Orientation aOr;
TopoDS_Shape aVR;
aOr=aV.Orientation();
if (aOr==TopAbs_FORWARD || aOr==TopAbs_REVERSED) {
if (myOrigins.IsBound(aV)) {
- aVR=myOrigins.Find(aV);
+ aVR=myOrigins.Find(aV);
}
else {
- aVR=aV;
+ aVR=aV;
}
aLV.Append(aVR);
}
//
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
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
+
// File: GEOMAlgo_GlueDetector.hxx
-// Created:
// Author: Peter KURNEV
-// <pkv@irinox>
-//
+
#ifndef _GEOMAlgo_GlueDetector_HeaderFile
#define _GEOMAlgo_GlueDetector_HeaderFile
#include <Standard.hxx>
#include <Standard_Macro.hxx>
-#include <GEOMAlgo_GluerAlgo.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_PassKeyShape.hxx>
//=======================================================================
//function : GEOMAlgo_GlueDetector
-//purpose :
+//purpose :
//=======================================================================
-class GEOMAlgo_GlueDetector : public GEOMAlgo_GluerAlgo,
- public GEOMAlgo_Algo {
+class GEOMAlgo_GlueDetector : public GEOMAlgo_GluerAlgo,
+ public GEOMAlgo_Algo
+{
public:
- Standard_EXPORT GEOMAlgo_GlueDetector();
-
- Standard_EXPORT virtual ~GEOMAlgo_GlueDetector();
-
- Standard_EXPORT virtual void Perform() ;
+ Standard_EXPORT
+ 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) ;
-
-private:
+ 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);
+
+
+ protected:
+ TopTools_IndexedDataMapOfShapeListOfShape myStickedShapes;
+ //modified by NIZNHY-PKV Tue Mar 13 09:53:08 2012t
+
};
#endif
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
+
// File: GEOMAlgo_Gluer2.cxx
// Author: Peter KURNEV
//=======================================================================
//function : GEOMAlgo_Gluer2
-//purpose :
+//purpose :
//=======================================================================
GEOMAlgo_Gluer2::GEOMAlgo_Gluer2()
:
}
//=======================================================================
//function : ~GEOMAlgo_Gluer2
-//purpose :
+//purpose :
//=======================================================================
GEOMAlgo_Gluer2::~GEOMAlgo_Gluer2()
{
}
//=======================================================================
//function : Clear
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_Gluer2::Clear()
{
myImagesToWork.Clear();
myOriginsToWork.Clear();
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
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_Gluer2::SetShapesToGlue(const TopTools_DataMapOfShapeListOfShape& aM)
{
}
//=======================================================================
//function : ShapesToGlue
-//purpose :
+//purpose :
//=======================================================================
const TopTools_DataMapOfShapeListOfShape& GEOMAlgo_Gluer2::ShapesToGlue()const
{
}
//=======================================================================
//function : SetKeepNonSolids
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_Gluer2::SetKeepNonSolids(const Standard_Boolean aFlag)
{
}
//=======================================================================
//function : KeepNonSolids
-//purpose :
+//purpose :
//=======================================================================
-Standard_Boolean GEOMAlgo_Gluer2::KeepNonSolids()const
+Standard_Boolean GEOMAlgo_Gluer2::KeepNonSolids()const
{
return myKeepNonSolids;
}
//=======================================================================
//function : ShapesDetected
-//purpose :
+//purpose :
//=======================================================================
const TopTools_DataMapOfShapeListOfShape& GEOMAlgo_Gluer2::ShapesDetected()const
{
}
//=======================================================================
//function : ImagesToWork
-//purpose :
+//purpose :
//=======================================================================
const TopTools_DataMapOfShapeListOfShape& GEOMAlgo_Gluer2::ImagesToWork()const
{
}
//=======================================================================
//function : Perform
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_Gluer2::Perform()
{
myErrorStatus=0;
myWarningStatus=0;
- //
+ //
CheckData();
if (myErrorStatus) {
return;
if (myErrorStatus) {
return;
}
- if (myWarningStatus==1) {// no shapes to glue
+ if (myWarningStatus==1) {
+ // no shapes to glue
myShape=myArgument;
return;
}
}
//=======================================================================
//function : CheckData
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_Gluer2::CheckData()
{
aTypeX=aSG.ShapeType();
if (!i) {
aType=aTypeX;
- if (!(aType==TopAbs_VERTEX ||
- aType==TopAbs_EDGE ||
+ if (!(aType==TopAbs_VERTEX ||
+ aType==TopAbs_EDGE ||
aType==TopAbs_FACE)) {
myErrorStatus=21;// non-brep shapes
return;
}
//=======================================================================
//function : FillEdges
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_Gluer2::FillEdges()
{
FillBRepShapes(TopAbs_EDGE);
-}
+}
//=======================================================================
//function : FillFaces
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_Gluer2::FillFaces()
{
}
//=======================================================================
//function : FillWires
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_Gluer2::FillWires()
{
}
//=======================================================================
//function : FillShells
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_Gluer2::FillShells()
{
}
//=======================================================================
//function : FillSolids
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_Gluer2::FillSolids()
{
FillContainers(TopAbs_SOLID);
-}
+}
//=======================================================================
//function : FillCompSolids
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_Gluer2::FillCompSolids()
{
FillContainers(TopAbs_COMPSOLID);
-}
+}
//=======================================================================
//function : FillVertices
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_Gluer2::FillVertices()
{
}
//=======================================================================
//function : FillBRepShapes
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_Gluer2::FillBRepShapes(const TopAbs_ShapeEnum theType)
-{
+{
Standard_Boolean bHasImage, bIsToWork;
Standard_Integer i, aNbE;
TopoDS_Iterator aItS;
}
//=======================================================================
//function : FillContainers
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_Gluer2::FillContainers(const TopAbs_ShapeEnum aType)
{
}
//
GEOMAlgo_Tools3D::MakeContainer(aType, aWnew);
- //modified by NIZNHY-PKV Tue May 10 13:46:30 2011f
aWnew.Orientation(aW.Orientation());
- //modified by NIZNHY-PKV Tue May 10 13:46:32 2011t
//
aItS.Initialize(aW);
for (; aItS.More(); aItS.Next()) {
}
}
//
- //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
TopTools_ListOfShape aLSD;
//
}
//=======================================================================
//function : FillCompounds
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_Gluer2::FillCompounds()
{
}
//=======================================================================
//function : FillCompound
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_Gluer2::FillCompound(const TopoDS_Shape& aC)
{
}
//=======================================================================
//function : HasImage
-//purpose :
+//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_Gluer2::HasImage(const TopoDS_Shape& aC)
{
}
//=======================================================================
//function : BuildResult
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_Gluer2::BuildResult()
{
GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, aCnew1);
//
TopExp::MapShapes(aCnew, TopAbs_SOLID, aM);
-
+
aNb=aM.Extent();
for (i=1; i<=aNb; ++i) {
const TopoDS_Shape& aS=aM(i);
// 14 - PerformImagesToWork failed
//
// 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
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
+
// File: GEOMAlgo_Gluer2.hxx
-// Created:
// Author: Peter KURNEV
-// <pkv@irinox>
#ifndef _GEOMAlgo_Gluer2_HeaderFile
#define _GEOMAlgo_Gluer2_HeaderFile
#include <Standard.hxx>
#include <Standard_Macro.hxx>
+#include <Standard_Boolean.hxx>
+
+#include <TopAbs_ShapeEnum.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
-#include <Standard_Boolean.hxx>
-#include <GEOMAlgo_GluerAlgo.hxx>
-#include <TopAbs_ShapeEnum.hxx>
+
#include <NMTTools_CoupleOfShape.hxx>
#include <NMTTools_ListOfCoupleOfShape.hxx>
+
+#include <GEOMAlgo_GluerAlgo.hxx>
#include <GEOMAlgo_BuilderShape.hxx>
+#include <GEOMAlgo_GlueDetector.hxx>
//=======================================================================
//class : GEOMAlgo_Gluer2
-//purpose :
+//purpose :
//=======================================================================
-class GEOMAlgo_Gluer2 : public GEOMAlgo_GluerAlgo,
+class GEOMAlgo_Gluer2 : public GEOMAlgo_GluerAlgo,
public GEOMAlgo_BuilderShape {
public:
-
- Standard_EXPORT GEOMAlgo_Gluer2();
-
- Standard_EXPORT virtual ~GEOMAlgo_Gluer2();
-
- Standard_EXPORT void SetShapesToGlue(const TopTools_DataMapOfShapeListOfShape& aM) ;
-
- Standard_EXPORT const TopTools_DataMapOfShapeListOfShape& ShapesToGlue() const;
-
- Standard_EXPORT void SetKeepNonSolids(const Standard_Boolean theFlag) ;
-
- Standard_EXPORT Standard_Boolean KeepNonSolids() const;
-
+
+ Standard_EXPORT
+ GEOMAlgo_Gluer2();
+
+ Standard_EXPORT
+ virtual ~GEOMAlgo_Gluer2();
+
+ Standard_EXPORT
+ void SetShapesToGlue(const TopTools_DataMapOfShapeListOfShape& aM) ;
+
+ Standard_EXPORT
+ const TopTools_DataMapOfShapeListOfShape& ShapesToGlue() const;
+
+ Standard_EXPORT
+ void SetKeepNonSolids(const Standard_Boolean theFlag) ;
+
+ Standard_EXPORT
+ Standard_Boolean KeepNonSolids() const;
+
Standard_EXPORT virtual void Clear() ;
-
- Standard_EXPORT virtual void Perform() ;
-
- Standard_EXPORT virtual void CheckData() ;
-
- Standard_EXPORT void Detect() ;
-
- Standard_EXPORT const TopTools_DataMapOfShapeListOfShape& ShapesDetected() 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& Modified(const TopoDS_Shape& theS) ;
-
- Standard_EXPORT virtual Standard_Boolean IsDeleted(const TopoDS_Shape& theS) ;
-
- Standard_EXPORT static void MakeVertex(const TopTools_ListOfShape& theLV,
- TopoDS_Vertex& theV) ;
-
- Standard_EXPORT static void MapBRepShapes(const TopoDS_Shape& theS,
- TopTools_MapOfShape& theM) ;
-
- Standard_EXPORT static void MapShapes(const TopoDS_Shape& theS,
- TopTools_MapOfShape& theM) ;
+ Standard_EXPORT
+ virtual void Perform() ;
+
+ Standard_EXPORT
+ virtual void CheckData() ;
+
+ Standard_EXPORT
+ void Detect() ;
+
+ Standard_EXPORT
+ const TopTools_DataMapOfShapeListOfShape& ShapesDetected() 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& Modified(const TopoDS_Shape& theS) ;
+ Standard_EXPORT
+ virtual Standard_Boolean IsDeleted(const TopoDS_Shape& theS) ;
+
+ Standard_EXPORT
+ static void MakeVertex(const TopTools_ListOfShape& theLV,
+ TopoDS_Vertex& theV) ;
+
+ Standard_EXPORT
+ static void MapBRepShapes(const TopoDS_Shape& theS,
+ TopTools_MapOfShape& theM) ;
+
+ Standard_EXPORT
+ static void MapShapes(const TopoDS_Shape& theS,
+ 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:
-
- Standard_EXPORT void PerformShapesToWork() ;
-
- Standard_EXPORT void FillVertices() ;
-
- Standard_EXPORT void FillEdges() ;
-
- Standard_EXPORT void FillWires() ;
-
- Standard_EXPORT void FillFaces() ;
-
- Standard_EXPORT void FillShells() ;
-
- Standard_EXPORT void FillSolids() ;
-
- Standard_EXPORT void FillCompSolids() ;
-
- Standard_EXPORT void FillCompounds() ;
-
- Standard_EXPORT void BuildResult() ;
-
- Standard_EXPORT void FillBRepShapes(const TopAbs_ShapeEnum theType) ;
-
- Standard_EXPORT void FillContainers(const TopAbs_ShapeEnum theType) ;
-
- Standard_EXPORT void FillCompound(const TopoDS_Shape& theC) ;
-
- Standard_EXPORT virtual void PrepareHistory() ;
-
- Standard_EXPORT Standard_Boolean HasImage(const TopoDS_Shape& theC) ;
-
- Standard_EXPORT void MakeBRepShapes(const TopoDS_Shape& theS,
- TopoDS_Shape& theSnew) ;
-
- Standard_EXPORT void MakeEdge(const TopoDS_Edge& theE,
- TopoDS_Edge& theEnew) ;
-
- Standard_EXPORT void MakeFace(const TopoDS_Face& theF,
- TopoDS_Face& theFnew) ;
-
- Standard_EXPORT void TreatPair(const NMTTools_CoupleOfShape& theCS,
- NMTTools_ListOfCoupleOfShape& theLCS) ;
+ Standard_EXPORT
+ void PerformShapesToWork() ;
+
+ Standard_EXPORT
+ void FillVertices() ;
+
+ Standard_EXPORT
+ void FillEdges() ;
+
+ Standard_EXPORT
+ void FillWires() ;
+
+ Standard_EXPORT
+ void FillFaces() ;
+
+ Standard_EXPORT
+ void FillShells() ;
+
+ Standard_EXPORT
+ void FillSolids() ;
+
+ Standard_EXPORT
+ void FillCompSolids() ;
+
+ Standard_EXPORT
+ void FillCompounds() ;
+
+ Standard_EXPORT
+ void BuildResult() ;
+
+ Standard_EXPORT
+ void FillBRepShapes(const TopAbs_ShapeEnum theType) ;
+
+ Standard_EXPORT
+ void FillContainers(const TopAbs_ShapeEnum theType) ;
+
+ Standard_EXPORT
+ void FillCompound(const TopoDS_Shape& theC) ;
+
+ Standard_EXPORT
+ virtual void PrepareHistory() ;
+
+ Standard_EXPORT
+ Standard_Boolean HasImage(const TopoDS_Shape& theC) ;
+
+ Standard_EXPORT
+ void MakeBRepShapes(const TopoDS_Shape& theS,
+ TopoDS_Shape& theSnew) ;
+
+ Standard_EXPORT
+ void MakeEdge(const TopoDS_Edge& theE,
+ TopoDS_Edge& theEnew) ;
+
+ Standard_EXPORT
+ void MakeFace(const TopoDS_Face& theF,
+ TopoDS_Face& theFnew) ;
+
+ Standard_EXPORT
+ void TreatPair(const NMTTools_CoupleOfShape& theCS,
+ NMTTools_ListOfCoupleOfShape& theLCS) ;
protected:
TopTools_DataMapOfShapeListOfShape myShapesToGlue;
TopTools_DataMapOfShapeListOfShape myImagesToWork;
TopTools_DataMapOfShapeShape myOriginsToWork;
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:
};
#endif
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File: GEOMAlgo_Gluer2_3.cxx
-// Created:
-// Author: Peter KURNEV
+
+// File: GEOMAlgo_Gluer2_3.cxx
+// Author: Peter KURNEV
#include <GEOMAlgo_Gluer2.hxx>
static
void MapShapes1(const TopoDS_Shape& aS,
- const TopAbs_ShapeEnum aType,
- TopTools_IndexedMapOfShape& aM);
+ const TopAbs_ShapeEnum aType,
+ TopTools_IndexedMapOfShape& aM);
//=======================================================================
//function : Detect
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_Gluer2::Detect()
{
Standard_Integer iErr, aNbSD;
TopTools_ListIteratorOfListOfShape aItLS;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS;
- GEOMAlgo_GlueDetector aDetector;
+ //GEOMAlgo_GlueDetector aDetector;
//
myErrorStatus=0;
myWarningStatus=0;
myOriginsDetected.Clear();
//
bCheckGeometry=Standard_True;
- aDetector.SetArgument(myArgument);
- aDetector.SetTolerance(myTolerance);
- aDetector.SetCheckGeometry(bCheckGeometry);
//
- aDetector.Perform();
- iErr=aDetector.ErrorStatus();
+ //modified by NIZNHY-PKV Tue Mar 13 13:33:35 2012f
+ 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) {
- myErrorStatus=11;// Detector failed
+ // Detector is failed
+ myErrorStatus=11;
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);
for (; aItDMSLS.More(); aItDMSLS.Next()) {
const TopoDS_Shape& aSkey=aItDMSLS.Key();
}
//=======================================================================
//function : PerformShapesToWork
-//purpose :
+//purpose :
//=======================================================================
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_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS;
NMTTools_CoupleOfShape aCS;
NMTTools_ListOfCoupleOfShape aLCS;
- NMTTools_ListIteratorOfListOfCoupleOfShape aItCS;
+ NMTTools_ListIteratorOfListOfCoupleOfShape aItCS;
//
myErrorStatus=0;
myWarningStatus=0;
const TopTools_ListOfShape& aLSD=aItDMSLS.Value();
aItLS1.Initialize(aLSD);
for (; aItLS1.More(); aItLS1.Next()) {
- const TopoDS_Shape& aSx=aItLS1.Value();
- myOriginsToWork.Bind(aSx, aSkey);
+ const TopoDS_Shape& aSx=aItLS1.Value();
+ myOriginsToWork.Bind(aSx, aSkey);
}
}
return;
//
// 1. Make pairs
aItDMSLS.Initialize(myShapesToGlue);
- for (; aItDMSLS.More(); aItDMSLS.Next()) {
+ for (k=0; aItDMSLS.More(); aItDMSLS.Next(), ++k) {
//const TopoDS_Shape& aSkey=aItDMSLS.Key();
const TopTools_ListOfShape& aLSG=aItDMSLS.Value();
aItLS1.Initialize(aLSG);
for (i=0; aItLS1.More(); aItLS1.Next(), ++i) {
aItLS2.Initialize(aLSG);
for (j=0; aItLS2.More(); aItLS2.Next(), ++j) {
- if (j>i) {
- const TopoDS_Shape& aSG1=aItLS1.Value();
- const TopoDS_Shape& aSG2=aItLS2.Value();
- aCS.SetShape1(aSG1);
- aCS.SetShape2(aSG2);
- TreatPair(aCS, aLCS);
- }
+ if (j>i) {
+ const TopoDS_Shape& aSG1=aItLS1.Value();
+ const TopoDS_Shape& aSG2=aItLS2.Value();
+ aCS.SetShape1(aSG1);
+ aCS.SetShape2(aSG2);
+ TreatPair(aCS, aLCS);
+ }
}
}
}
}
//=======================================================================
//function : TreatPair
-//purpose :
+//purpose :
//=======================================================================
void GEOMAlgo_Gluer2::TreatPair(const NMTTools_CoupleOfShape& aCS,
- NMTTools_ListOfCoupleOfShape& aLCS)
+ NMTTools_ListOfCoupleOfShape& aLCS)
{
if (myErrorStatus) {
return;
}
//=======================================================================
//function : MapShapes1
-//purpose :
+//purpose :
//=======================================================================
void MapShapes1(const TopoDS_Shape& aS,
- const TopAbs_ShapeEnum aType,
- TopTools_IndexedMapOfShape& aM)
+ const TopAbs_ShapeEnum aType,
+ TopTools_IndexedMapOfShape& aM)
{
TopExp_Explorer aExp;
-
+
aExp.Init (aS, aType);
for ( ;aExp.More(); aExp.Next()) {
const TopoDS_Shape aSx=aExp.Current();
if (aType==TopAbs_EDGE) {
const TopoDS_Edge& aEx=*((TopoDS_Edge*)&aSx);
if (BRep_Tool::Degenerated(aEx)) {
- continue;
- }
- }
- 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;
+ continue;
}
}
aM.Add(aSx);
- aExp.Next();
}
}
-*/
<source>GEOM_GLUE_EDGES_TITLE</source>
<translation>Glue edges</translation>
</message>
+ <message>
+ <source>GLUE_ERROR_STICKED_SHAPES</source>
+ <translation>The tolerance value is too big. Sticked shapes are detected.</translation>
+ </message>
<message>
<source>GEOM_LIMIT_TOLERANCE_TITLE</source>
<translation>Limit tolerance</translation>
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#include <Standard_Stream.hxx>
#include <GEOM_Object.hxx>
#include <GEOM_Function.hxx>
-//#include <GEOMAlgo_Gluer.hxx>
-//#include "GEOMAlgo_Gluer1.hxx"
#include "GEOMAlgo_Gluer2.hxx"
#include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx"
#include "GEOMAlgo_CoupleOfShapes.hxx"
#include "GEOMAlgo_ListOfCoupleOfShapes.hxx"
+#include <Basics_OCCTVersion.hxx>
+
#include "utilities.h"
#include <TDataStd_IntegerArray.hxx>
// 2. Detect interferred shapes
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();
if (iErr) {
switch (iErr) {