GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape, in double theTolerance,
in ListOfGO theFaces, in boolean doKeepNonSolids);
+ /*!
+ * Replace coincident edges in theShape by one edge.
+ * \param theShape Initial shape.
+ * \param theTolerance Maximum distance between edges, which can be considered as coincident.
+ * \return New GEOM_Object, containing a copy of theShape without coincident edges.
+ */
+ GEOM_Object MakeGlueEdges (in GEOM_Object theShape, in double theTolerance);
+
+ /*!
+ * Find coincident edges in theShape for possible gluing.
+ * \param theShape Initial shape.
+ * \param theTolerance Maximum distance between edges, which can be considered as coincident.
+ * \return ListOfGO
+ */
+ ListOfGO GetGlueEdges (in GEOM_Object theShape, in double theTolerance);
+
+ /*!
+ * Replace coincident edges in theShape by one edge
+ * in compliance with given list of edges
+ * \param theShape Initial shape.
+ * \param theTolerance Maximum distance between edges, which can be considered as coincident.
+ * \param theFaces List of edges for gluing.
+ * \return New GEOM_Object, containing a copy of theShape without some edges.
+ */
+ GEOM_Object MakeGlueEdgesByList (in GEOM_Object theShape,
+ in double theTolerance,
+ in ListOfGO theEdges);
+
/*!
* Get all sub-shapes and groups of \a theShape,
* that were created already by any other methods.
--- Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+-- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+-- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+--
+-- This library is free software; you can redistribute it and/or
+-- modify it under the terms of the GNU Lesser General Public
+-- License as published by the Free Software Foundation; either
+-- version 2.1 of the License.
+--
+-- This library is distributed in the hope that it will be useful
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+-- Lesser General Public License for more details.
--
--- Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
--- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+-- You should have received a copy of the GNU Lesser General Public
+-- License along with this library; if not, write to the Free Software
+-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--
--- This library is free software; you can redistribute it and/or
--- modify it under the terms of the GNU Lesser General Public
--- License as published by the Free Software Foundation; either
--- version 2.1 of the License.
---
--- This library is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
--- Lesser General Public License for more details.
---
--- You should have received a copy of the GNU Lesser General Public
--- License along with this library; if not, write to the Free Software
--- 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.cdl
-- Created: Sat Dec 04 12:36:22 2004
-- gluer
class Gluer;
class Gluer1;
+
+--modified by NIZNHY-PKV Mon Feb 21 10:07:22 2011f
+ imported Gluer2 from GEOMAlgo;
+ imported GlueDetector from GEOMAlgo;
+ imported GluerAlgo from GEOMAlgo;
+--modified by NIZNHY-PKV Mon Feb 21 10:07:27 2011t
+
class GlueAnalyser;
class CoupleOfShapes;
class StateCollector;
class ClsfSolid;
--- class FinderShapeOn2;
--- class PassKeyShapeMapHasher;
+ -- class FinderShapeOn2;
+ -- class PassKeyShapeMapHasher;
--
-- Builder/Splitter
deferred class BuilderShape;
--- /dev/null
+// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// 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 <NCollection_UBTreeFiller.hxx>
+
+#include <TColStd_ListOfInteger.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+#include <TColStd_MapIteratorOfMapOfInteger.hxx>
+
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Compound.hxx>
+
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopTools_MapIteratorOfMapOfShape.hxx>
+
+#include <TopExp.hxx>
+#include <BRep_Tool.hxx>
+#include <BRep_Builder.hxx>
+#include <BRepBndLib.hxx>
+
+#include <NMTDS_BndSphereTree.hxx>
+#include <NMTDS_BndSphere.hxx>
+#include <NMTDS_IndexedDataMapOfShapeBndSphere.hxx>
+
+#include <GEOMAlgo_IndexedDataMapOfIntegerShape.hxx>
+#include <GEOMAlgo_Gluer.hxx>
+#include <GEOMAlgo_PassKeyShape.hxx>
+#include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
+#include <GEOMAlgo_Tools.hxx>
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+GEOMAlgo_GlueDetector::GEOMAlgo_GlueDetector()
+:
+ GEOMAlgo_GluerAlgo(),
+ GEOMAlgo_Algo()
+{}
+//=======================================================================
+//function : ~
+//purpose :
+//=======================================================================
+GEOMAlgo_GlueDetector::~GEOMAlgo_GlueDetector()
+{}
+//=======================================================================
+//function : Perform
+//purpose :
+//=======================================================================
+void GEOMAlgo_GlueDetector::Perform()
+{
+ myErrorStatus=0;
+ myWarningStatus=0;
+ //
+ CheckData();
+ if (myErrorStatus) {
+ return;
+ }
+ //
+ DetectVertices();
+ if (myErrorStatus) {
+ return;
+ }
+ //
+ DetectEdges();
+ if (myErrorStatus) {
+ return;
+ }
+ //
+ DetectFaces();
+ if (myErrorStatus) {
+ return;
+ }
+}
+//=======================================================================
+//function : DetectVertices
+//purpose :
+//=======================================================================
+void GEOMAlgo_GlueDetector::DetectVertices()
+{
+ Standard_Integer j, i, aNbV, aNbVSD;
+ Standard_Real aTolV;
+ gp_Pnt aPV;
+ TColStd_ListIteratorOfListOfInteger aIt;
+ TopoDS_Shape aVF;
+ TopTools_IndexedMapOfShape aMV;
+ TopTools_MapOfShape aMVProcessed;
+ TopTools_ListIteratorOfListOfShape aItS;
+ TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
+ TopTools_DataMapOfShapeListOfShape aMVV;
+ GEOMAlgo_IndexedDataMapOfIntegerShape aMIS;
+ NMTDS_IndexedDataMapOfShapeBndSphere aMSB;
+ //
+ NMTDS_BndSphereTreeSelector aSelector;
+ NMTDS_BndSphereTree aBBTree;
+ NCollection_UBTreeFiller <Standard_Integer, NMTDS_BndSphere> aTreeFiller(aBBTree);
+ //
+ myErrorStatus=0;
+ //
+ TopExp::MapShapes(myArgument, TopAbs_VERTEX, aMV);
+ aNbV=aMV.Extent();
+ if (!aNbV) {
+ myErrorStatus=2; // no vertices in source shape
+ return;
+ }
+ //
+ for (i=1; i<=aNbV; ++i) {
+ NMTDS_BndSphere aBox;
+ //
+ const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aMV(i));
+ aPV=BRep_Tool::Pnt(aV);
+ aTolV=BRep_Tool::Tolerance(aV);
+ //
+ aBox.SetGap(myTolerance);
+ aBox.SetCenter(aPV);
+ aBox.SetRadius(aTolV);
+ //
+ aTreeFiller.Add(i, aBox);
+ //
+ aMIS.Add(i, aV);
+ aMSB.Add(aV, aBox);
+ }
+ //
+ aTreeFiller.Fill();
+ //
+ //---------------------------------------------------
+ // Chains
+ for (i=1; i<=aNbV; ++i) {
+ const TopoDS_Shape& aV=aMV(i);
+ //
+ if (aMVProcessed.Contains(aV)) {
+ continue;
+ }
+ //
+ Standard_Integer aNbIP, aIP, aNbIP1, aIP1;
+ TopTools_ListOfShape aLVSD;
+ TColStd_MapOfInteger aMIP, aMIP1, aMIPC;
+ TColStd_MapIteratorOfMapOfInteger aIt1;
+ //
+ aMIP.Add(i);
+ while(1) {
+ 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()) {
+ }//for(; aIt1.More(); aIt1.Next()) {
+ //
+ aNbIP1=aMIP1.Extent();
+ if (!aNbIP1) {
+ break;
+ }
+ //
+ aIt1.Initialize(aMIP);
+ for(; aIt1.More(); aIt1.Next()) {
+ aIP=aIt1.Key();
+ aMIPC.Add(aIP);
+ }
+ //
+ aMIP.Clear();
+ aIt1.Initialize(aMIP1);
+ for(; aIt1.More(); aIt1.Next()) {
+ aIP=aIt1.Key();
+ aMIP.Add(aIP);
+ }
+ aMIP1.Clear();
+ }// while(1)
+ //
+ // Fill myImages
+ aNbIP=aMIPC.Extent();
+ //
+ if (!aNbIP) {// no SD vertices is found
+ aMVProcessed.Add(aV);
+ continue;
+ }
+ //else { // SD vertices founded [ aMIPC ]
+ aIt1.Initialize(aMIPC);
+ for(j=0; aIt1.More(); aIt1.Next(), ++j) {
+ aIP=aIt1.Key();
+ const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
+ if (!j) {
+ aVF=aVP;
+ }
+ aLVSD.Append(aVP);
+ aMVProcessed.Add(aVP);
+ }
+ //}
+ myImages.Bind(aVF, aLVSD);
+ }// for (i=1; i<=aNbV; ++i) {
+ //------------------------------
+ // Origins
+ aItIm.Initialize(myImages);
+ for (; aItIm.More(); aItIm.Next()) {
+ const TopoDS_Shape& aV=aItIm.Key();
+ const TopTools_ListOfShape& aLVSD=aItIm.Value();
+ aItS.Initialize(aLVSD);
+ for (; aItS.More(); aItS.Next()) {
+ const TopoDS_Shape& aVSD=aItS.Value();
+ if (!myOrigins.IsBound(aVSD)) {
+ myOrigins.Bind(aVSD, aV);
+ }
+ }
+ }
+}
+//=======================================================================
+//function : DetectFaces
+//purpose :
+//=======================================================================
+void GEOMAlgo_GlueDetector::DetectFaces()
+{
+ DetectShapes(TopAbs_FACE);
+}
+//=======================================================================
+//function : DetectEdges
+//purpose :
+//=======================================================================
+void GEOMAlgo_GlueDetector::DetectEdges()
+{
+ DetectShapes(TopAbs_EDGE);
+}
+//=======================================================================
+//function : DetectShapes
+//purpose :
+//=======================================================================
+void GEOMAlgo_GlueDetector::DetectShapes(const TopAbs_ShapeEnum aType)
+{
+ Standard_Boolean bDegenerated;
+ Standard_Integer i, aNbF, aNbSDF, iErr;
+ TopTools_IndexedMapOfShape aMF;
+ TopTools_ListIteratorOfListOfShape aItLS;
+ GEOMAlgo_PassKeyShape aPKF;
+ GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape aMPKLF;
+ //
+ myErrorStatus=0;
+ //
+ TopExp::MapShapes(myArgument, aType, aMF);
+ //
+ 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);
+ }
+ else if (aType==TopAbs_EDGE) {
+ const TopoDS_Edge& aE=*((TopoDS_Edge*)&aS);
+ EdgePassKey(aE, aPKF);
+ }
+ //
+ if (myErrorStatus) {
+ return;
+ }
+ //
+ if (aMPKLF.Contains(aPKF)) {
+ TopTools_ListOfShape& aLSDF=aMPKLF.ChangeFromKey(aPKF);
+ aLSDF.Append(aS);
+ }
+ else {
+ TopTools_ListOfShape aLSDF;
+ //
+ aLSDF.Append(aS);
+ aMPKLF.Add(aPKF, aLSDF);
+ }
+ }
+ // check geometric coincidence
+ if (myCheckGeometry) {
+ iErr=GEOMAlgo_Tools::RefineSDShapes(aMPKLF, myTolerance, myContext);
+ if (iErr) {
+ myErrorStatus=200;
+ return;
+ }
+ }
+ //
+ // Images/Origins
+ aNbF=aMPKLF.Extent();
+ for (i=1; i<=aNbF; ++i) {
+ const TopTools_ListOfShape& aLSDF=aMPKLF(i);
+ aNbSDF=aLSDF.Extent();
+ if (!aNbSDF) {
+ myErrorStatus=4; // it must not be
+ }
+ //
+ if (aNbSDF==1) {
+ continue;
+ }
+ //
+ 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;
+ }
+ }
+ //
+ myImages.Bind(aS1, aLSDF);
+ // origins
+ aItLS.Initialize(aLSDF);
+ for (; aItLS.More(); aItLS.Next()) {
+ const TopoDS_Shape& aFSD=aItLS.Value();
+ if (!myOrigins.IsBound(aFSD)) {
+ myOrigins.Bind(aFSD, aS1);
+ }
+ }
+ }// for (i=1; i<=aNbF; ++i)
+}
+//=======================================================================
+//function : FacePassKey
+//purpose :
+//=======================================================================
+void GEOMAlgo_GlueDetector::FacePassKey(const TopoDS_Face& aF,
+ GEOMAlgo_PassKeyShape& aPK)
+{
+ Standard_Integer i, aNbE;
+ TopoDS_Shape aER;
+ TopTools_ListOfShape aLE;
+ TopTools_IndexedMapOfShape aME;
+ //
+ TopExp::MapShapes(aF, TopAbs_EDGE, aME);
+ //
+ aNbE=aME.Extent();
+ for (i=1; i<=aNbE; ++i) {
+ const TopoDS_Shape& aE=aME(i);
+ //
+ const TopoDS_Edge& aEE=*((TopoDS_Edge*)&aE);
+ if (BRep_Tool::Degenerated(aEE)) {
+ continue;
+ }
+ //
+ if (myOrigins.IsBound(aE)) {
+ aER=myOrigins.Find(aE);
+ }
+ else {
+ aER=aE;
+ }
+ aLE.Append(aER);
+ }
+ aPK.SetShapes(aLE);
+}
+//=======================================================================
+//function : EdgePassKey
+//purpose :
+//=======================================================================
+void GEOMAlgo_GlueDetector::EdgePassKey(const TopoDS_Edge& aE,
+ GEOMAlgo_PassKeyShape& aPK)
+{
+ TopAbs_Orientation aOr;
+ TopoDS_Shape aVR;
+ TopoDS_Iterator aIt;
+ TopTools_ListOfShape aLV;
+ //
+ aIt.Initialize(aE);
+ for (; aIt.More(); aIt.Next()) {
+ const TopoDS_Shape& aV=aIt.Value();
+ aOr=aV.Orientation();
+ if (aOr==TopAbs_FORWARD || aOr==TopAbs_REVERSED) {
+ if (myOrigins.IsBound(aV)) {
+ aVR=myOrigins.Find(aV);
+ }
+ else {
+ aVR=aV;
+ }
+ aLV.Append(aVR);
+ }
+ }
+ //
+ aPK.SetShapes(aLV);
+}
--- /dev/null
+// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// 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 <GEOMAlgo_Algo.hxx>
+
+//=======================================================================
+//function : GEOMAlgo_GlueDetector
+//purpose :
+//=======================================================================
+class GEOMAlgo_GlueDetector : public GEOMAlgo_GluerAlgo,
+ public GEOMAlgo_Algo {
+public:
+ Standard_EXPORT GEOMAlgo_GlueDetector();
+
+ Standard_EXPORT virtual ~GEOMAlgo_GlueDetector();
+
+ Standard_EXPORT virtual void Perform() ;
+
+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:
+};
+#endif
-// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#ifndef _GEOMAlgo_Gluer_HeaderFile
-#define _GEOMAlgo_Gluer_HeaderFile
-
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-#ifndef _Standard_Real_HeaderFile
-#include <Standard_Real.hxx>
-#endif
-#ifndef _TopTools_DataMapOfShapeListOfShape_HeaderFile
-#include <TopTools_DataMapOfShapeListOfShape.hxx>
-#endif
-#ifndef _TopTools_DataMapOfShapeShape_HeaderFile
-#include <TopTools_DataMapOfShapeShape.hxx>
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _TopTools_ListOfShape_HeaderFile
-#include <TopTools_ListOfShape.hxx>
-#endif
-#ifndef _TopTools_MapOfShape_HeaderFile
-#include <TopTools_MapOfShape.hxx>
-#endif
-#ifndef _GEOMAlgo_ShapeAlgo_HeaderFile
-#include <GEOMAlgo_ShapeAlgo.hxx>
-#endif
-#ifndef _TopAbs_ShapeEnum_HeaderFile
-#include <TopAbs_ShapeEnum.hxx>
-#endif
-#ifndef _TopoDS_Compound_HeaderFile
-#include <TopoDS_Compound.hxx>
-#endif
-class TopTools_ListOfShape;
-class TopoDS_Shape;
-class TopoDS_Edge;
-class GEOMAlgo_PassKeyShape;
-class TopoDS_Face;
-class TopoDS_Vertex;
-class TopTools_DataMapOfShapeListOfShape;
-class TopTools_DataMapOfShapeShape;
-
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
-
-class GEOMAlgo_Gluer : public GEOMAlgo_ShapeAlgo {
-
-public:
-
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- // Methods PUBLIC
- //
-
-
-Standard_EXPORT GEOMAlgo_Gluer();
-Standard_EXPORT virtual ~GEOMAlgo_Gluer();
-
-
-Standard_EXPORT void SetCheckGeometry(const Standard_Boolean aFlag) ;
-
-
-Standard_EXPORT Standard_Boolean CheckGeometry() const;
-
-
-Standard_EXPORT void SetKeepNonSolids(const Standard_Boolean aFlag) ;
-
-
-Standard_EXPORT virtual void Perform() ;
-
-
-Standard_EXPORT Standard_Integer AloneShapes() const;
-
-
-Standard_EXPORT const TopTools_ListOfShape& Modified(const TopoDS_Shape& S) ;
-
-
-Standard_EXPORT const TopTools_ListOfShape& Generated(const TopoDS_Shape& S) ;
-
-
-Standard_EXPORT Standard_Boolean IsDeleted(const TopoDS_Shape& S) ;
-
-
-Standard_EXPORT const TopTools_DataMapOfShapeListOfShape& Images() const;
-
-
-Standard_EXPORT const TopTools_DataMapOfShapeShape& Origins() const;
-
-
-
-
-
-protected:
-
- // Methods PROTECTED
- //
-
-
-Standard_EXPORT virtual void CheckData() ;
-
-
-Standard_EXPORT virtual void CheckResult() ;
-
-
-Standard_EXPORT void MakeVertices() ;
-
-
-Standard_EXPORT void MakeEdges() ;
-
-
-Standard_EXPORT void MakeFaces() ;
-
-
-Standard_EXPORT void MakeShapes(const TopAbs_ShapeEnum aType) ;
-
-
-Standard_EXPORT void MakeShells() ;
-
-
-Standard_EXPORT void MakeSubShapes(const TopoDS_Shape& theShape,
- TopTools_MapOfShape& theMS,
- TopoDS_Compound& theResult);
-
-
-Standard_EXPORT void MakeSolids() ;
-
-
-Standard_EXPORT void InnerTolerance() ;
-
-
-Standard_EXPORT void EdgePassKey(const TopoDS_Edge& aE,GEOMAlgo_PassKeyShape& aPK) ;
-
-
-Standard_EXPORT void FacePassKey(const TopoDS_Face& aF,GEOMAlgo_PassKeyShape& aPK) ;
-
-
-Standard_EXPORT void MakeVertex(const TopTools_ListOfShape& aLV,TopoDS_Vertex& aNewV) ;
-
-
-Standard_EXPORT void MakeEdge(const TopoDS_Edge& aEdge,TopoDS_Edge& aNewEdge) ;
-
-
-Standard_EXPORT void MakeFace(const TopoDS_Face& aFace,TopoDS_Face& aNewEdge) ;
-
-
-Standard_EXPORT Standard_Boolean IsToReverse(const TopoDS_Face& aFR,const TopoDS_Face& aF) ;
-
-
-Standard_EXPORT Standard_Boolean HasNewSubShape(const TopoDS_Shape& aS) const;
-
-
- // Fields PROTECTED
- //
-Standard_Boolean myCheckGeometry;
-Standard_Boolean myKeepNonSolids;
-Standard_Real myTol;
-TopTools_DataMapOfShapeListOfShape myImages;
-TopTools_DataMapOfShapeShape myOrigins;
-Standard_Integer myNbAlone;
-TopTools_ListOfShape myGenerated;
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other Inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+// File generated by CPPExt (Value)\r
+//\r
+// Copyright (C) 1991 - 2000 by \r
+// Matra Datavision SA. All rights reserved.\r
+// \r
+// Copyright (C) 2001 - 2004 by\r
+// Open CASCADE SA. All rights reserved.\r
+// \r
+// This file is part of the Open CASCADE Technology software.\r
+//\r
+// This software may be distributed and/or modified under the terms and\r
+// conditions of the Open CASCADE Public License as defined by Open CASCADE SA\r
+// and appearing in the file LICENSE included in the packaging of this file.\r
+// \r
+// This software is distributed on an "AS IS" basis, without warranty of any\r
+// kind, and Open CASCADE SA hereby disclaims all such warranties,\r
+// including without limitation, any warranties of merchantability, fitness\r
+// for a particular purpose or non-infringement. Please see the License for\r
+// the specific terms and conditions governing rights and limitations under the\r
+// License.\r
+\r
+#ifndef _GEOMAlgo_Gluer_HeaderFile\r
+#define _GEOMAlgo_Gluer_HeaderFile\r
+\r
+#ifndef _Standard_HeaderFile\r
+#include <Standard.hxx>\r
+#endif\r
+#ifndef _Standard_Macro_HeaderFile\r
+#include <Standard_Macro.hxx>\r
+#endif\r
+\r
+#ifndef _Standard_Boolean_HeaderFile\r
+#include <Standard_Boolean.hxx>\r
+#endif\r
+#ifndef _Standard_Real_HeaderFile\r
+#include <Standard_Real.hxx>\r
+#endif\r
+#ifndef _TopTools_DataMapOfShapeListOfShape_HeaderFile\r
+#include <TopTools_DataMapOfShapeListOfShape.hxx>\r
+#endif\r
+#ifndef _TopTools_DataMapOfShapeShape_HeaderFile\r
+#include <TopTools_DataMapOfShapeShape.hxx>\r
+#endif\r
+#ifndef _Standard_Integer_HeaderFile\r
+#include <Standard_Integer.hxx>\r
+#endif\r
+#ifndef _TopTools_ListOfShape_HeaderFile\r
+#include <TopTools_ListOfShape.hxx>\r
+#endif\r
+#ifndef _GEOMAlgo_ShapeAlgo_HeaderFile\r
+#include <GEOMAlgo_ShapeAlgo.hxx>\r
+#endif\r
+#ifndef _TopAbs_ShapeEnum_HeaderFile\r
+#include <TopAbs_ShapeEnum.hxx>\r
+#endif\r
+class TopTools_ListOfShape;\r
+class TopoDS_Shape;\r
+class TopoDS_Edge;\r
+class GEOMAlgo_PassKeyShape;\r
+class TopoDS_Face;\r
+class TopoDS_Vertex;\r
+class TopTools_DataMapOfShapeListOfShape;\r
+class TopTools_DataMapOfShapeShape;\r
+class TopTools_MapOfShape;\r
+class TopoDS_Compound;\r
+\r
+\r
+\r
+class GEOMAlgo_Gluer : public GEOMAlgo_ShapeAlgo {\r
+public:\r
+\r
+ void* operator new(size_t,void* anAddress) \r
+ {\r
+ return anAddress;\r
+ }\r
+ void* operator new(size_t size) \r
+ {\r
+ return Standard::Allocate(size); \r
+ }\r
+ void operator delete(void *anAddress) \r
+ {\r
+ if (anAddress) Standard::Free((Standard_Address&)anAddress); \r
+ }\r
+\r
+ \r
+ Standard_EXPORT GEOMAlgo_Gluer();\r
+Standard_EXPORT virtual ~GEOMAlgo_Gluer();\r
+ \r
+ Standard_EXPORT void SetCheckGeometry(const Standard_Boolean aFlag) ;\r
+ \r
+ Standard_EXPORT Standard_Boolean CheckGeometry() const;\r
+ \r
+ Standard_EXPORT virtual void Perform() ;\r
+ \r
+ Standard_EXPORT Standard_Integer AloneShapes() const;\r
+ \r
+ Standard_EXPORT const TopTools_ListOfShape& Modified(const TopoDS_Shape& S) ;\r
+ \r
+ Standard_EXPORT const TopTools_ListOfShape& Generated(const TopoDS_Shape& S) ;\r
+ \r
+ Standard_EXPORT Standard_Boolean IsDeleted(const TopoDS_Shape& S) ;\r
+ \r
+ Standard_EXPORT const TopTools_DataMapOfShapeListOfShape& Images() const;\r
+ \r
+ Standard_EXPORT const TopTools_DataMapOfShapeShape& Origins() const;\r
+ \r
+ Standard_EXPORT void MakeSubShapes(const TopoDS_Shape& aS,TopTools_MapOfShape& aM,TopoDS_Compound& aC) ;\r
+ \r
+ Standard_EXPORT void SetKeepNonSolids(const Standard_Boolean bFlag) ;\r
+ \r
+ Standard_EXPORT Standard_Boolean KeepNonSolids() const;\r
+\r
+\r
+\r
+\r
+\r
+protected:\r
+\r
+ \r
+ Standard_EXPORT virtual void CheckData() ;\r
+ \r
+ Standard_EXPORT virtual void CheckResult() ;\r
+ \r
+ Standard_EXPORT void MakeVertices() ;\r
+ \r
+ Standard_EXPORT void MakeEdges() ;\r
+ \r
+ Standard_EXPORT void MakeFaces() ;\r
+ \r
+ Standard_EXPORT void MakeShapes(const TopAbs_ShapeEnum aType) ;\r
+ \r
+ Standard_EXPORT void MakeShells() ;\r
+ \r
+ Standard_EXPORT void MakeSolids() ;\r
+ \r
+ Standard_EXPORT void InnerTolerance() ;\r
+ \r
+ Standard_EXPORT void EdgePassKey(const TopoDS_Edge& aE,GEOMAlgo_PassKeyShape& aPK) ;\r
+ \r
+ Standard_EXPORT void FacePassKey(const TopoDS_Face& aF,GEOMAlgo_PassKeyShape& aPK) ;\r
+ \r
+ Standard_EXPORT void MakeVertex(const TopTools_ListOfShape& aLV,TopoDS_Vertex& aNewV) ;\r
+ \r
+ Standard_EXPORT void MakeEdge(const TopoDS_Edge& aEdge,TopoDS_Edge& aNewEdge) ;\r
+ \r
+ Standard_EXPORT void MakeFace(const TopoDS_Face& aFace,TopoDS_Face& aNewEdge) ;\r
+ \r
+ Standard_EXPORT Standard_Boolean IsToReverse(const TopoDS_Face& aFR,const TopoDS_Face& aF) ;\r
+ \r
+ Standard_EXPORT Standard_Boolean HasNewSubShape(const TopoDS_Shape& aS) const;\r
+\r
+\r
+Standard_Boolean myCheckGeometry;\r
+Standard_Real myTol;\r
+TopTools_DataMapOfShapeListOfShape myImages;\r
+TopTools_DataMapOfShapeShape myOrigins;\r
+Standard_Integer myNbAlone;\r
+TopTools_ListOfShape myGenerated;\r
+Standard_Boolean myKeepNonSolids;\r
+\r
+\r
+private:\r
+\r
+\r
+\r
+\r
+\r
+};\r
+\r
+\r
+\r
+\r
+\r
+// other Inline functions and methods (like "C++: function call" methods)\r
+\r
+\r
+#endif\r
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// 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
+
+#include <GEOMAlgo_Gluer2.hxx>
+
+#include <TopAbs_ShapeEnum.hxx>
+
+#include <TopoDS_Compound.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Vertex.hxx>
+
+#include <BRep_Builder.hxx>
+#include <TopExp.hxx>
+#include <BRepLib.hxx>
+
+#include <TopTools_MapOfShape.hxx>
+#include <TopTools_MapIteratorOfMapOfShape.hxx>
+#include <TopTools_DataMapOfShapeShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
+#include <GEOMAlgo_GlueDetector.hxx>
+#include <GEOMAlgo_Tools3D.hxx>
+
+//=======================================================================
+//function : GEOMAlgo_Gluer2
+//purpose :
+//=======================================================================
+GEOMAlgo_Gluer2::GEOMAlgo_Gluer2()
+:
+ GEOMAlgo_GluerAlgo(),
+ GEOMAlgo_BuilderShape()
+{
+ myTolerance=0.0001;
+}
+//=======================================================================
+//function : ~GEOMAlgo_Gluer2
+//purpose :
+//=======================================================================
+GEOMAlgo_Gluer2::~GEOMAlgo_Gluer2()
+{
+}
+//=======================================================================
+//function : Clear
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::Clear()
+{
+ myErrorStatus=0;
+ myWarningStatus=0;
+ //
+ GEOMAlgo_GluerAlgo::Clear();
+ //
+ myImagesDetected.Clear();
+ myOriginsDetected.Clear();
+ myShapesToGlue.Clear();
+ myImagesToWork.Clear();
+ myOriginsToWork.Clear();
+ myKeepNonSolids=Standard_False;
+}
+//=======================================================================
+//function : SetShapesToGlue
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::SetShapesToGlue(const TopTools_DataMapOfShapeListOfShape& aM)
+{
+ myShapesToGlue=aM;
+}
+//=======================================================================
+//function : ShapesToGlue
+//purpose :
+//=======================================================================
+const TopTools_DataMapOfShapeListOfShape& GEOMAlgo_Gluer2::ShapesToGlue()const
+{
+ return myShapesToGlue;
+}
+//=======================================================================
+//function : SetKeepNonSolids
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::SetKeepNonSolids(const Standard_Boolean aFlag)
+{
+ myKeepNonSolids=aFlag;
+}
+//=======================================================================
+//function : KeepNonSolids
+//purpose :
+//=======================================================================
+Standard_Boolean GEOMAlgo_Gluer2::KeepNonSolids()const
+{
+ return myKeepNonSolids;
+}
+//=======================================================================
+//function : ShapesDetected
+//purpose :
+//=======================================================================
+const TopTools_DataMapOfShapeListOfShape& GEOMAlgo_Gluer2::ShapesDetected()const
+{
+ return myImagesDetected;
+}
+//=======================================================================
+//function : ImagesToWork
+//purpose :
+//=======================================================================
+const TopTools_DataMapOfShapeListOfShape& GEOMAlgo_Gluer2::ImagesToWork()const
+{
+ return myImagesToWork;
+}
+//=======================================================================
+//function : Perform
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::Perform()
+{
+ myErrorStatus=0;
+ myWarningStatus=0;
+ //
+ CheckData();
+ if (myErrorStatus) {
+ return;
+ }
+ //
+ PerformShapesToWork();
+ if (myErrorStatus) {
+ return;
+ }
+ if (myWarningStatus==1) {// no shapes to glue
+ myShape=myArgument;
+ return;
+ }
+ //
+ FillVertices();
+ if (myErrorStatus) {
+ return;
+ }
+ //
+ FillEdges();
+ if (myErrorStatus) {
+ return;
+ }
+ //
+ FillWires();
+ if (myErrorStatus) {
+ return;
+ }
+ //
+ FillFaces();
+ if (myErrorStatus) {
+ return;
+ }
+ //
+ FillShells();
+ if (myErrorStatus) {
+ return;
+ }
+ //
+ FillSolids();
+ if (myErrorStatus) {
+ return;
+ }
+ //
+ FillCompSolids();
+ if (myErrorStatus) {
+ return;
+ }
+ //
+ FillCompounds();
+ if (myErrorStatus) {
+ return;
+ }
+ //
+ BuildResult();
+ if (myErrorStatus) {
+ return;
+ }
+ //
+ PrepareHistory();
+ if (myErrorStatus) {
+ return;
+ }
+ //
+ BRepLib::SameParameter(myShape, myTolerance, Standard_True);
+}
+//=======================================================================
+//function : CheckData
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::CheckData()
+{
+ Standard_Integer aNbSG, i;
+ TopAbs_ShapeEnum aType, aTypeX;
+ TopTools_ListIteratorOfListOfShape aItLS;
+ TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS;
+ //
+ myErrorStatus=0;
+ myWarningStatus=0;
+ //
+ aNbSG=myShapesToGlue.Extent();
+ if (aNbSG) {
+ // Check myShapesToGlue
+ aItDMSLS.Initialize(myShapesToGlue);
+ for (; aItDMSLS.More(); aItDMSLS.Next()) {
+ //const TopoDS_Shape& aSkey=aItDMSLS.Key();
+ const TopTools_ListOfShape& aLSG=aItDMSLS.Value();
+ aItLS.Initialize(aLSG);
+ for (i=0; aItLS.More(); aItLS.Next(), ++i) {
+ const TopoDS_Shape& aSG=aItLS.Value();
+ aTypeX=aSG.ShapeType();
+ if (!i) {
+ aType=aTypeX;
+ if (!(aType==TopAbs_VERTEX ||
+ aType==TopAbs_EDGE ||
+ aType==TopAbs_FACE)) {
+ myErrorStatus=21;// non-brep shapes
+ return;
+ }
+ continue;
+ }
+ if (aTypeX!=aType) {
+ myErrorStatus=20;// non-homogeneous shapes
+ return;
+ }
+ }
+ }
+ }// if (aNbSG) {
+}
+//=======================================================================
+//function : FillEdges
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::FillEdges()
+{
+ FillBRepShapes(TopAbs_EDGE);
+}
+//=======================================================================
+//function : FillFaces
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::FillFaces()
+{
+ FillBRepShapes(TopAbs_FACE);
+}
+//=======================================================================
+//function : FillWires
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::FillWires()
+{
+ FillContainers(TopAbs_WIRE);
+}
+//=======================================================================
+//function : FillShells
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::FillShells()
+{
+ FillContainers(TopAbs_SHELL);
+}
+//=======================================================================
+//function : FillSolids
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::FillSolids()
+{
+ FillContainers(TopAbs_SOLID);
+}
+//=======================================================================
+//function : FillCompSolids
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::FillCompSolids()
+{
+ FillContainers(TopAbs_COMPSOLID);
+}
+//=======================================================================
+//function : FillVertices
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::FillVertices()
+{
+ TopAbs_ShapeEnum aType;
+ TopoDS_Vertex aVnew;
+ TopTools_ListIteratorOfListOfShape aItLS;
+ TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS;
+ //
+ myErrorStatus=0;
+ myWarningStatus=0;
+ //
+ aItDMSLS.Initialize(myImagesToWork);
+ for (; aItDMSLS.More(); aItDMSLS.Next()) {
+ const TopoDS_Shape& aSkey=aItDMSLS.Key();
+ aType=aSkey.ShapeType();
+ if (aType!=TopAbs_VERTEX) {
+ continue;
+ }
+ //
+ const TopTools_ListOfShape& aLSD=aItDMSLS.Value();
+ //
+ GEOMAlgo_Gluer2::MakeVertex(aLSD, aVnew);
+ //
+ myImages.Bind(aVnew, aLSD);
+ //
+ aItLS.Initialize(aLSD);
+ for (; aItLS.More(); aItLS.Next()) {
+ const TopoDS_Shape& aV=aItLS.Value();
+ myOrigins.Bind(aV, aVnew);
+ }
+ }
+}
+//=======================================================================
+//function : FillBRepShapes
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::FillBRepShapes(const TopAbs_ShapeEnum theType)
+{
+ Standard_Boolean bHasImage, bIsToWork;
+ Standard_Integer i, aNbE;
+ TopoDS_Iterator aItS;
+ TopoDS_Shape aEnew;
+ TopTools_IndexedMapOfShape aME;
+ TopTools_MapOfShape aMFence;
+ TopTools_ListIteratorOfListOfShape aItLS;
+ //
+ myErrorStatus=0;
+ myWarningStatus=0;
+ //
+ TopExp::MapShapes(myArgument, theType, aME);
+ //
+ aNbE=aME.Extent();
+ for (i=1; i<=aNbE; ++i) {
+ const TopoDS_Shape& aE=aME(i);
+ //
+ if (!aMFence.Add(aE)) {
+ continue;
+ }
+ //
+ bIsToWork=myOriginsToWork.IsBound(aE);
+ bHasImage=HasImage(aE);
+ if (!bHasImage && !bIsToWork) {
+ continue;
+ }
+ //
+ MakeBRepShapes(aE, aEnew);
+ //
+ //myImages / myOrigins
+ if (bIsToWork) {
+ const TopoDS_Shape& aSkey=myOriginsToWork.Find(aE);
+ const TopTools_ListOfShape& aLSD=myImagesToWork.Find(aSkey);
+ //
+ myImages.Bind(aEnew, aLSD);
+ //
+ aItLS.Initialize(aLSD);
+ for (; aItLS.More(); aItLS.Next()) {
+ const TopoDS_Shape& aEx=aItLS.Value();
+ myOrigins.Bind(aEx, aEnew);
+ //
+ aMFence.Add(aEx);
+ }
+ }
+ else {
+ TopTools_ListOfShape aLSD;
+ //
+ aLSD.Append(aE);
+ myImages.Bind(aEnew, aLSD);
+ myOrigins.Bind(aE, aEnew);
+ }
+ }//for (i=1; i<=aNbF; ++i) {
+}
+//=======================================================================
+//function : FillContainers
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::FillContainers(const TopAbs_ShapeEnum aType)
+{
+ Standard_Boolean bHasImage, bToReverse;
+ Standard_Integer i, aNbW;
+ TopoDS_Shape aWnew, aEnew;
+ TopoDS_Iterator aItS;
+ BRep_Builder aBB;
+ TopTools_IndexedMapOfShape aMW;
+ TopTools_MapOfShape aMFence;
+ //
+ myErrorStatus=0;
+ myWarningStatus=0;
+ //
+ TopExp::MapShapes(myArgument, aType, aMW);
+ //
+ aNbW=aMW.Extent();
+ for (i=1; i<=aNbW; ++i) {
+ const TopoDS_Shape& aW=aMW(i);
+ //
+ if (!aMFence.Add(aW)) {
+ continue;
+ }
+ //
+ bHasImage=HasImage(aW);
+ if (!bHasImage) {
+ continue;
+ }
+ //
+ GEOMAlgo_Tools3D::MakeContainer(aType, aWnew);
+ //
+ aItS.Initialize(aW);
+ for (; aItS.More(); aItS.Next()) {
+ const TopoDS_Shape& aE=aItS.Value();
+ if (myOrigins.IsBound(aE)) {
+ aEnew=myOrigins.Find(aE);
+ //
+ bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aEnew, aE, myContext);
+ if (bToReverse) {
+ aEnew.Reverse();
+ }
+ //
+ aBB.Add(aWnew, aEnew);
+ }
+ else {
+ aBB.Add(aWnew, aE);
+ }
+ }
+ //
+ aWnew.Orientation(aW.Orientation());
+ //
+ //myImages / myOrigins
+ TopTools_ListOfShape aLSD;
+ //
+ aLSD.Append(aW);
+ myImages.Bind(aWnew, aLSD);
+ myOrigins.Bind(aW, aWnew);
+ //
+ }//for (i=1; i<=aNbE; ++i) {
+}
+//=======================================================================
+//function : FillCompounds
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::FillCompounds()
+{
+ TopAbs_ShapeEnum aType;
+ TopoDS_Iterator aItC;
+ //
+ myErrorStatus=0;
+ myWarningStatus=0;
+ //
+ aItC.Initialize(myArgument);
+ for (; aItC.More(); aItC.Next()) {
+ const TopoDS_Shape& aCx=aItC.Value();
+ aType=aCx.ShapeType();
+ if (aType==TopAbs_COMPOUND) {
+ FillCompound(aCx);
+ }
+ }
+}
+//=======================================================================
+//function : FillCompound
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::FillCompound(const TopoDS_Shape& aC)
+{
+ Standard_Boolean bHasImage;
+ TopAbs_ShapeEnum aType;
+ TopoDS_Shape aCnew, aCXnew;
+ TopoDS_Iterator aItC;
+ BRep_Builder aBB;
+ //
+ bHasImage=HasImage(aC);
+ if (!bHasImage) {
+ return;
+ }
+ //
+ GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, aCnew);
+ //
+ aItC.Initialize(aC);
+ for (; aItC.More(); aItC.Next()) {
+ const TopoDS_Shape& aCX=aItC.Value();
+ aType=aCX.ShapeType();
+ //
+ if (aType==TopAbs_COMPOUND) {
+ FillCompound(aCX);
+ }
+ //
+ if (myOrigins.IsBound(aCX)) {
+ aCXnew=myOrigins.Find(aCX);
+ aCXnew.Orientation(aCX.Orientation());
+ aBB.Add(aCnew, aCXnew);
+ }
+ else {
+ aBB.Add(aCnew, aCX);
+ }
+ }
+ //
+ //myImages / myOrigins
+ TopTools_ListOfShape aLSD;
+ //
+ aLSD.Append(aC);
+ myImages.Bind(aCnew, aLSD);
+ myOrigins.Bind(aC, aCnew);
+}
+//=======================================================================
+//function : HasImage
+//purpose :
+//=======================================================================
+Standard_Boolean GEOMAlgo_Gluer2::HasImage(const TopoDS_Shape& aC)
+{
+ Standard_Boolean bRet;
+ TopAbs_ShapeEnum aType;
+ TopoDS_Iterator aItC;
+ //
+ bRet=Standard_False;
+ aItC.Initialize(aC);
+ for (; aItC.More(); aItC.Next()) {
+ const TopoDS_Shape& aCx=aItC.Value();
+ aType=aCx.ShapeType();
+ //
+ if (aType==TopAbs_COMPOUND) {
+ bRet=HasImage(aCx);
+ if (bRet) {
+ return bRet;
+ }
+ }
+ else {
+ bRet=myOrigins.IsBound(aCx);
+ if (bRet) {
+ return bRet;
+ }
+ }
+ }
+ //
+ bRet=myOrigins.IsBound(aC);
+ //
+ return bRet;
+}
+//=======================================================================
+//function : BuildResult
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::BuildResult()
+{
+ Standard_Boolean bHasImage;
+ TopoDS_Shape aCnew, aCXnew;
+ TopoDS_Iterator aItC;
+ BRep_Builder aBB;
+ //
+ myErrorStatus=0;
+ myWarningStatus=0;
+ //
+ aItC.Initialize(myArgument);
+ for (; aItC.More(); aItC.Next()) {
+ const TopoDS_Shape& aCx=aItC.Value();
+ bHasImage=HasImage(aCx);
+ if (bHasImage) {
+ break;
+ }
+ }
+ //
+ if (!bHasImage) {
+ myShape=myArgument;
+ return;
+ }
+ //
+ GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, aCnew);
+ //
+ aItC.Initialize(myArgument);
+ for (; aItC.More(); aItC.Next()) {
+ const TopoDS_Shape& aCX=aItC.Value();
+ if (myOrigins.IsBound(aCX)) {
+ aCXnew=myOrigins.Find(aCX);
+ aCXnew.Orientation(aCX.Orientation());
+ aBB.Add(aCnew, aCXnew);
+ }
+ else {
+ aBB.Add(aCnew, aCX);
+ }
+ }
+ //
+ if (!myKeepNonSolids) {
+ Standard_Integer i, aNb;
+ TopoDS_Shape aCnew1;
+ TopTools_IndexedMapOfShape aM;
+ //
+ 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);
+ aBB.Add(aCnew1, aS);
+ }
+ aCnew=aCnew1;
+ }
+ //
+ myShape=aCnew;
+}
+//--------------------------------------------------------
+//
+// ErrorStatus
+// 11 - GEOMAlgo_GlueDetector failed
+// 13 - PerformImagesToWork failed
+// 14 - PerformImagesToWork failed
+//
+// WarningStatus
+// 1 - no shapes to glue
--- /dev/null
+// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// 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 <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_BuilderShape.hxx>
+
+//=======================================================================
+//class : GEOMAlgo_Gluer2
+//purpose :
+//=======================================================================
+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 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) ;
+
+
+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) ;
+
+protected:
+ TopTools_DataMapOfShapeListOfShape myShapesToGlue;
+ TopTools_DataMapOfShapeListOfShape myImagesDetected;
+ TopTools_DataMapOfShapeShape myOriginsDetected;
+ TopTools_DataMapOfShapeListOfShape myImagesToWork;
+ TopTools_DataMapOfShapeShape myOriginsToWork;
+ Standard_Boolean myKeepNonSolids;
+
+private:
+};
+#endif
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// 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_1.cxx
+// Created:
+// Author: Peter KURNEV
+// <peter@PREFEX>
+//
+#include <GEOMAlgo_Gluer2.hxx>
+
+#include <gp_XYZ.hxx>
+#include <gp_Pnt.hxx>
+
+#include <TopLoc_Location.hxx>
+
+#include <Geom_Surface.hxx>
+
+#include <TopAbs_ShapeEnum.hxx>
+
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Wire.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Iterator.hxx>
+
+#include <BRep_Tool.hxx>
+#include <BRep_Builder.hxx>
+
+#include <BRepTools.hxx>
+#include <TopExp.hxx>
+
+#include <TopTools_MapOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+
+#include <BOPTools_Tools.hxx>
+#include <BOPTools_Tools2D.hxx>
+#include <BOPTools_Tools3D.hxx>
+
+#include <GEOMAlgo_Tools.hxx>
+
+
+//=======================================================================
+//function : MakeBRepShapes
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::MakeBRepShapes(const TopoDS_Shape& theS,
+ TopoDS_Shape& theSnew)
+{
+ TopAbs_ShapeEnum aType;
+ //
+ aType=theS.ShapeType();
+ if (aType==TopAbs_EDGE) {
+ TopoDS_Edge aEE, aEEnew;
+ //
+ aEE=*((TopoDS_Edge*)&theS);
+ MakeEdge(aEE, aEEnew);
+ if (myErrorStatus) {
+ return;
+ }
+ //
+ theSnew=aEEnew;
+ }
+ else if (aType==TopAbs_FACE) {
+ TopoDS_Face aFF, aFFnew;
+ //
+ aFF=*((TopoDS_Face*)&theS);
+ MakeFace(aFF, aFFnew);
+ if (myErrorStatus) {
+ return;
+ }
+ //
+ theSnew=aFFnew;
+ }
+}
+//=======================================================================
+//function : MakeFace
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::MakeFace(const TopoDS_Face& theF,
+ TopoDS_Face& theFnew)
+{
+ Standard_Boolean bIsToReverse, bIsUPeriodic;
+ Standard_Real aTol, aUMin, aUMax, aVMin, aVMax;
+ TopAbs_Orientation aOrE;
+ Handle(Geom_Surface) aS;
+ TopLoc_Location aLoc;
+ TopoDS_Shape aW, aWr;
+ TopoDS_Edge aEx;
+ TopoDS_Face aFF, aFnew;
+ TopoDS_Iterator aItW, aItE;
+ BRep_Builder aBB;
+ TopTools_ListOfShape aLEr;
+ TopTools_ListIteratorOfListOfShape aItLE;
+ //
+ myErrorStatus=0;
+ //
+ aFF=theF;
+ aFF.Orientation(TopAbs_FORWARD);
+ //
+ aTol=BRep_Tool::Tolerance(aFF);
+ aS=BRep_Tool::Surface(aFF, aLoc);
+ bIsUPeriodic=GEOMAlgo_Tools::IsUPeriodic(aS);
+ BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax);
+ //
+ aBB.MakeFace (aFnew, aS, aLoc, aTol);
+ //
+ aItW.Initialize(aFF);
+ for (; aItW.More(); aItW.Next()) {
+ const TopoDS_Shape& aW=aItW.Value();
+ //
+ if (!myOrigins.IsBound(aW)) {
+ aBB.Add(aFnew, aW);
+ continue;
+ }
+ //
+ aWr=myOrigins.Find(aW);
+ //
+ // clear contents of Wr
+ aLEr.Clear();
+ aItE.Initialize(aWr);
+ for (; aItE.More(); aItE.Next()) {
+ const TopoDS_Shape& aEr=aItE.Value();
+ aLEr.Append(aEr);
+ }
+ //
+ aItLE.Initialize(aLEr);
+ for (; aItLE.More(); aItLE.Next()) {
+ const TopoDS_Shape& aEr=aItLE.Value();
+ aBB.Remove(aWr, aEr);
+ }
+ //
+ // refill contents of Wr
+ aItE.Initialize(aW);
+ for (; aItE.More(); aItE.Next()) {
+ const TopoDS_Edge& aE=*((TopoDS_Edge*)(&aItE.Value()));
+ //
+ aEx=aE;
+ if (myOrigins.IsBound(aE)) {
+ aEx=*((TopoDS_Edge*)(&myOrigins.Find(aE)));
+ }
+ //
+ if (!BRep_Tool::Degenerated(aEx)) {
+ aEx.Orientation(TopAbs_FORWARD);
+ if (bIsUPeriodic) {
+ GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(aEx, aFF, aUMin, aUMax);
+ }
+ BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aEx, aFF);
+ //
+ bIsToReverse=BOPTools_Tools3D::IsSplitToReverse1(aEx, aE, myContext);
+ if (bIsToReverse) {
+ aEx.Reverse();
+ }
+ }
+ else {
+ aEx.Orientation(aE.Orientation());
+ }
+ aBB.Add(aWr, aEx);
+ }// for (; aItE.More(); aItE.Next()) {
+ //
+ aBB.Add(aFnew, aWr);
+ }// for (; aItW.More(); aItW.Next()) {
+ theFnew=aFnew;
+}
+//=======================================================================
+//function : MakeEdge
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::MakeEdge(const TopoDS_Edge& aE,
+ TopoDS_Edge& aNewEdge)
+{
+ myErrorStatus=0;
+ //
+ Standard_Boolean bIsDE;
+ Standard_Real aT1, aT2;
+ TopoDS_Vertex aV1, aV2, aVR1, aVR2;
+ TopoDS_Edge aEx;
+ //
+ bIsDE=BRep_Tool::Degenerated(aE);
+ //
+ aEx=aE;
+ aEx.Orientation(TopAbs_FORWARD);
+ //
+ TopExp::Vertices(aEx, aV1, aV2);
+ //
+ aT1=BRep_Tool::Parameter(aV1, aEx);
+ aT2=BRep_Tool::Parameter(aV2, aEx);
+ //
+ aVR1=aV1;
+ if (myOrigins.IsBound(aV1)) {
+ aVR1=*((TopoDS_Vertex*)&myOrigins.Find(aV1));
+ }
+ aVR1.Orientation(TopAbs_FORWARD);
+ //
+ aVR2=aV2;
+ if (myOrigins.IsBound(aV2)) {
+ aVR2=*((TopoDS_Vertex*)&myOrigins.Find(aV2));
+ }
+ aVR2.Orientation(TopAbs_REVERSED);
+ //
+ if (!bIsDE) {
+ BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge);
+ }
+ else {
+ Standard_Real aTol;
+ BRep_Builder aBB;
+ TopoDS_Edge E;
+ TopAbs_Orientation anOrE;
+ //
+ anOrE=aE.Orientation();
+ aTol=BRep_Tool::Tolerance(aE);
+ //
+ E=aEx;
+ E.EmptyCopy();
+ //
+ aBB.Add (E, aVR1);
+ aBB.Add (E, aVR2);
+ aBB.Range(E, aT1, aT2);
+ aBB.Degenerated(E, Standard_True);
+ aBB.UpdateEdge(E, aTol);
+ //
+ aNewEdge=E;
+ }
+}
+//=======================================================================
+//function : MakeVertex
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::MakeVertex(const TopTools_ListOfShape& aLV,
+ TopoDS_Vertex& aNewVertex)
+{
+ Standard_Integer aNbV;
+ Standard_Real aTolV, aD, aDmax;
+ gp_XYZ aGC;
+ gp_Pnt aP3D, aPGC;
+ TopoDS_Vertex aVx;
+ BRep_Builder aBB;
+ TopTools_ListIteratorOfListOfShape aIt;
+ //
+ aNbV=aLV.Extent();
+ if (!aNbV) {
+ return;
+ }
+ //
+ // center of gravity
+ aGC.SetCoord(0.,0.,0.);
+ aIt.Initialize(aLV);
+ for (; aIt.More(); aIt.Next()) {
+ aVx=*((TopoDS_Vertex*)(&aIt.Value()));
+ aP3D=BRep_Tool::Pnt(aVx);
+ aGC+=aP3D.XYZ();
+ }
+ aGC/=(Standard_Real)aNbV;
+ aPGC.SetXYZ(aGC);
+ //
+ // tolerance value
+ aDmax=-1.;
+ aIt.Initialize(aLV);
+ for (; aIt.More(); aIt.Next()) {
+ aVx=*((TopoDS_Vertex*)(&aIt.Value()));
+ aP3D=BRep_Tool::Pnt(aVx);
+ aTolV=BRep_Tool::Tolerance(aVx);
+ aD=aPGC.Distance(aP3D)+aTolV;
+ if (aD>aDmax) {
+ aDmax=aD;
+ }
+ }
+ //
+ aBB.MakeVertex (aNewVertex, aPGC, aDmax);
+}
+//=======================================================================
+//function : MapBRepShapes
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::MapBRepShapes(const TopoDS_Shape& aS,
+ TopTools_MapOfShape& aM)
+{
+ Standard_Boolean bHasBRep;
+ TopAbs_ShapeEnum aType;
+ TopoDS_Iterator aIt;
+ //
+ aType=aS.ShapeType();
+ if (aType==TopAbs_VERTEX ||
+ aType==TopAbs_EDGE ||
+ aType==TopAbs_FACE) {
+ aM.Add(aS);
+ }
+ //
+ aIt.Initialize(aS);
+ for(; aIt.More(); aIt.Next()) {
+ const TopoDS_Shape& aSx=aIt.Value();
+ aType=aSx.ShapeType();
+ GEOMAlgo_Gluer2::MapBRepShapes(aSx, aM);
+ }
+}
+
+//
+// ErrorStatus
+//
+// 40 - GEOMAlgo_GlueDetector is failed
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// 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_2.cxx
+// Created:
+// Author: Peter KURNEV
+// <peter@PREFEX>
+//
+#include <GEOMAlgo_Gluer2.hxx>
+
+#include <TopAbs_ShapeEnum.hxx>
+
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <GEOMAlgo_BuilderShape.hxx>
+#include <GEOMAlgo_Tools3D.hxx>
+
+//=======================================================================
+//function : PrepareHistory
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::PrepareHistory()
+{
+ Standard_Boolean bHasImage, bContainsSD;
+ //
+ // 1. Clearing
+ GEOMAlgo_BuilderShape::PrepareHistory();
+ //
+ if(myShape.IsNull()) {
+ return;
+ }
+ //
+ GEOMAlgo_Gluer2::MapShapes(myShape, myMapShape);
+ //
+}
+//=======================================================================
+//function : Generated
+//purpose :
+//=======================================================================
+const TopTools_ListOfShape& GEOMAlgo_Gluer2::Generated(const TopoDS_Shape& )
+{
+ myHistShapes.Clear();
+ return myHistShapes;
+}
+//=======================================================================
+//function : Modified
+//purpose :
+//=======================================================================
+const TopTools_ListOfShape& GEOMAlgo_Gluer2::Modified(const TopoDS_Shape& theS)
+{
+ Standard_Boolean bIsDeleted, bHasImage, bToReverse;
+ TopAbs_ShapeEnum aType;
+ TopoDS_Shape aSim;
+ //
+ myHistShapes.Clear();
+ //
+ aType=theS.ShapeType();
+ if (!(aType==TopAbs_VERTEX || aType==TopAbs_EDGE ||
+ aType==TopAbs_FACE || aType==TopAbs_SOLID)) {
+ return myHistShapes;
+ }
+ //
+ bIsDeleted=IsDeleted(theS);
+ if (bIsDeleted) {
+ return myHistShapes;
+ }
+ //
+ bHasImage=myOrigins.IsBound(theS);
+ if (!bHasImage) {
+ return myHistShapes;
+ }
+ //
+ aSim=myOrigins.Find(theS);
+ if (aSim.IsSame(theS)){
+ return myHistShapes;
+ }
+ //
+ if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
+ aSim.Orientation(theS.Orientation());
+ }
+ else {
+ bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aSim, theS, myContext);
+ if (bToReverse) {
+ aSim.Reverse();
+ }
+ }
+ //
+ myHistShapes.Append(aSim);
+ //
+ return myHistShapes;
+}
+//=======================================================================
+//function : IsDeleted
+//purpose :
+//=======================================================================
+Standard_Boolean GEOMAlgo_Gluer2::IsDeleted(const TopoDS_Shape& theS)
+{
+ Standard_Boolean bRet, bContains, bHasImage;
+ //
+ bRet=Standard_False;
+ //
+ if (theS.IsNull()) {
+ return !bRet; //true
+ }
+ //
+ bContains=myMapShape.Contains(theS);
+ if (bContains) {
+ return bRet; //false
+ }
+ //
+ bHasImage=myOrigins.IsBound(theS);
+ if (bHasImage) {
+ const TopoDS_Shape& aSim=myOrigins.Find(theS);
+ bContains=myMapShape.Contains(aSim);
+ if (bContains) {
+ return bRet; //false
+ }
+ }
+ //
+ return !bRet; //true
+}
+//=======================================================================
+//function : MapShapes
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::MapShapes(const TopoDS_Shape& theS,
+ TopTools_MapOfShape& theM)
+{
+ TopoDS_Iterator aIt;
+ //
+ theM.Add(theS);
+ aIt.Initialize(theS);
+ for (; aIt.More(); aIt.Next()) {
+ const TopoDS_Shape& aSx=aIt.Value();
+ GEOMAlgo_Gluer2::MapShapes(aSx, theM);
+ }
+}
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// 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
+// <peter@PREFEX>
+//
+#include <GEOMAlgo_Gluer2.hxx>
+
+#include <TopAbs_ShapeEnum.hxx>
+
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+
+#include <BRep_Tool.hxx>
+
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+
+#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
+#include <TopTools_DataMapOfShapeListOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopTools_MapIteratorOfMapOfShape.hxx>
+#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
+#include <NMTTools_CoupleOfShape.hxx>
+#include <NMTTools_ListOfCoupleOfShape.hxx>
+#include <NMTTools_ListIteratorOfListOfCoupleOfShape.hxx>
+#include <NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx>
+#include <NMTTools_Tools.hxx>
+
+#include <GEOMAlgo_GlueDetector.hxx>
+
+
+static
+ void MapShapes1(const TopoDS_Shape& aS,
+ const TopAbs_ShapeEnum aType,
+ TopTools_IndexedMapOfShape& aM);
+
+//=======================================================================
+//function : Detect
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::Detect()
+{
+ Standard_Boolean bCheckGeometry;
+ Standard_Integer iErr, aNbSD;
+ TopTools_ListIteratorOfListOfShape aItLS;
+ TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS;
+ GEOMAlgo_GlueDetector aDetector;
+ //
+ myErrorStatus=0;
+ myWarningStatus=0;
+ //
+ myImagesDetected.Clear();
+ myOriginsDetected.Clear();
+ //
+ bCheckGeometry=Standard_True;
+ aDetector.SetArgument(myArgument);
+ aDetector.SetTolerance(myTolerance);
+ aDetector.SetCheckGeometry(bCheckGeometry);
+ //
+ aDetector.Perform();
+ iErr=aDetector.ErrorStatus();
+ if (iErr) {
+ myErrorStatus=11;// Detector failed
+ return;
+ }
+ //
+ const TopTools_DataMapOfShapeListOfShape& aImages=aDetector.Images();
+ aItDMSLS.Initialize(aImages);
+ for (; aItDMSLS.More(); aItDMSLS.Next()) {
+ const TopoDS_Shape& aSkey=aItDMSLS.Key();
+ const TopTools_ListOfShape& aLSD=aItDMSLS.Value();
+ aNbSD=aLSD.Extent();
+ myImagesDetected.Bind(aSkey, aLSD);
+ }
+ //
+ aItDMSLS.Initialize(myImagesDetected);
+ for (; aItDMSLS.More(); aItDMSLS.Next()) {
+ const TopoDS_Shape& aSkey=aItDMSLS.Key();
+ const TopTools_ListOfShape& aLSD=aItDMSLS.Value();
+ aItLS.Initialize(aLSD);
+ for (; aItLS.More(); aItLS.Next()) {
+ const TopoDS_Shape& aSx=aItLS.Value();
+ myOriginsDetected.Bind(aSx, aSkey);
+ }
+ }
+}
+//=======================================================================
+//function : PerformShapesToWork
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::PerformShapesToWork()
+{
+ Standard_Integer aNbSG, i, j, aNbC, aNb, aNbSD;
+ TopTools_ListIteratorOfListOfShape aItLS1, aItLS2;
+ TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS;
+ NMTTools_CoupleOfShape aCS;
+ NMTTools_ListOfCoupleOfShape aLCS;
+ NMTTools_ListIteratorOfListOfCoupleOfShape aItCS;
+ //
+ myErrorStatus=0;
+ myWarningStatus=0;
+ //
+ myImagesToWork.Clear();
+ myOriginsToWork.Clear();
+ //
+ aNbSD=myImagesDetected.Extent();
+ if (!aNbSD) {// no shapes to glue detected
+ myWarningStatus=1;
+ return;
+ }
+ //
+ aNbSG=myShapesToGlue.Extent();
+ if (!aNbSG) {
+ // glue all possible
+ myImagesToWork=myImagesDetected;
+ //
+ aItDMSLS.Initialize(myImagesToWork);
+ for (; aItDMSLS.More(); aItDMSLS.Next()) {
+ const TopoDS_Shape& aSkey=aItDMSLS.Key();
+ const TopTools_ListOfShape& aLSD=aItDMSLS.Value();
+ aItLS1.Initialize(aLSD);
+ for (; aItLS1.More(); aItLS1.Next()) {
+ const TopoDS_Shape& aSx=aItLS1.Value();
+ myOriginsToWork.Bind(aSx, aSkey);
+ }
+ }
+ return;
+ }// if (!aNbSG) {
+ //
+ // 1. Make pairs
+ aItDMSLS.Initialize(myShapesToGlue);
+ for (; aItDMSLS.More(); aItDMSLS.Next()) {
+ 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);
+ }
+ }
+ }
+ }
+ //
+ // 2. Find Chains
+ TopTools_ListOfShape aLSX;
+ NMTTools_IndexedDataMapOfShapeIndexedMapOfShape aMC;
+ //
+ NMTTools_Tools::FindChains(aLCS, aMC);
+ //
+ // 3. myImagesToWork, myOriginsToWork
+ aNbC=aMC.Extent();
+ for (i=1; i<=aNbC; ++i) {
+ const TopoDS_Shape& aSkey=aMC.FindKey(i);
+ const TopTools_IndexedMapOfShape& aM=aMC(i);
+ aLSX.Clear();
+ aNb=aM.Extent();
+ for (j=1; j<=aNb; ++j) {
+ const TopoDS_Shape& aS=aM(j);
+ aLSX.Append(aS);
+ myOriginsToWork.Bind(aS, aSkey);
+ }
+ myImagesToWork.Bind(aSkey, aLSX);
+ }
+}
+//=======================================================================
+//function : TreatPair
+//purpose :
+//=======================================================================
+void GEOMAlgo_Gluer2::TreatPair(const NMTTools_CoupleOfShape& aCS,
+ NMTTools_ListOfCoupleOfShape& aLCS)
+{
+ if (myErrorStatus) {
+ return;
+ }
+ //
+ Standard_Integer i, aNbS1, aNbS2, aNbS;
+ TopAbs_ShapeEnum aType, aTypeS;
+ TopTools_ListIteratorOfListOfShape aItLS;
+ TopTools_IndexedMapOfShape aMS1, aMS2;
+ TopTools_DataMapOfShapeListOfShape aDMSLS;
+ TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS;
+ NMTTools_CoupleOfShape aCSS;
+ //
+ // 1. Checking the pair on whether it can be glued at all
+ // 1.1
+ const TopoDS_Shape& aS1=aCS.Shape1();
+ if (!myOriginsDetected.IsBound(aS1)) {
+ myErrorStatus=30;
+ return;
+ }
+ const TopoDS_Shape& aSkey1=myOriginsDetected.Find(aS1);
+ // 1.2
+ const TopoDS_Shape& aS2=aCS.Shape2();
+ if (!myOriginsDetected.IsBound(aS2)) {
+ myErrorStatus=30;
+ return;
+ }
+ const TopoDS_Shape& aSkey2=myOriginsDetected.Find(aS2);
+ // 1.3
+ if (!aSkey1.IsSame(aSkey2)) {
+ myErrorStatus=33;
+ return;
+ }
+ //
+ // 2. Append the pair to the aLCS
+ aLCS.Append(aCS);
+ //
+ // 3. Treatment the subshapes of the pair
+ aType=aS1.ShapeType();
+ if (aType==TopAbs_VERTEX) {
+ return;
+ }
+ aTypeS=TopAbs_EDGE;
+ if (aType==aTypeS) {
+ aTypeS=TopAbs_VERTEX;
+ }
+ //
+ MapShapes1(aS1, aTypeS, aMS1);
+ MapShapes1(aS2, aTypeS, aMS2);
+ //
+ aNbS1=aMS1.Extent();
+ aNbS2=aMS2.Extent();
+ if (aNbS1!=aNbS2) {
+ myErrorStatus=31;
+ return;
+ }
+ //
+ // 1.
+ for (i=1; i<=aNbS1; ++i) {
+ const TopoDS_Shape& aSS1=aMS1(i);
+ if (aMS2.Contains(aSS1)) {
+ continue;
+ }
+ //
+ if (!myOriginsDetected.IsBound(aSS1)) {
+ myErrorStatus=30;
+ return;
+ }
+ //
+ const TopoDS_Shape& aSkey=myOriginsDetected.Find(aSS1);
+ if (aDMSLS.IsBound(aSkey)) {
+ TopTools_ListOfShape& aLS=aDMSLS.ChangeFind(aSkey);
+ aLS.Append(aSS1);
+ }
+ else {
+ TopTools_ListOfShape aLS;
+ //
+ aLS.Append(aSS1);
+ aDMSLS.Bind(aSkey, aLS);
+ }
+ }
+ //
+ // 2.
+ for (i=1; i<=aNbS2; ++i) {
+ const TopoDS_Shape& aSS2=aMS2(i);
+ if (aMS1.Contains(aSS2)) {
+ continue;
+ }
+ //
+ if (!myOriginsDetected.IsBound(aSS2)) {
+ myErrorStatus=30;
+ return;
+ }
+ //
+ const TopoDS_Shape& aSkey=myOriginsDetected.Find(aSS2);
+ if (aDMSLS.IsBound(aSkey)) {
+ TopTools_ListOfShape& aLS=aDMSLS.ChangeFind(aSkey);
+ aLS.Append(aSS2);
+ }
+ else {
+ TopTools_ListOfShape aLS;
+ //
+ aLS.Append(aSS2);
+ aDMSLS.Bind(aSkey, aLS);
+ }
+ }
+ //
+ // 3.
+ aItDMSLS.Initialize(aDMSLS);
+ for (; aItDMSLS.More(); aItDMSLS.Next()) {
+ const TopoDS_Shape& aSkey=aItDMSLS.Key();
+ const TopTools_ListOfShape& aLS=aItDMSLS.Value();
+ aNbS=aLS.Extent();
+ if (aNbS!=2) {
+ myErrorStatus=32;
+ return;
+ }
+ //
+ const TopoDS_Shape& aSS1=aLS.First();
+ const TopoDS_Shape& aSS2=aLS.Last();
+ aCSS.SetShape1(aSS1);
+ aCSS.SetShape2(aSS2);
+ TreatPair(aCSS, aLCS);
+ }
+}
+//=======================================================================
+//function : MapShapes1
+//purpose :
+//=======================================================================
+void MapShapes1(const TopoDS_Shape& aS,
+ const TopAbs_ShapeEnum aType,
+ TopTools_IndexedMapOfShape& aM)
+{
+ TopExp_Explorer aEx (aS, aType);
+ while (aEx.More()) {
+ const TopoDS_Shape aSx=aEx.Current();
+ if (aType==TopAbs_EDGE) {
+ const TopoDS_Edge& aEx=*((TopoDS_Edge*)&aSx);
+ if (BRep_Tool::Degenerated(aEx)) {
+ continue;
+ }
+ }
+ aM.Add(aSx);
+ aEx.Next();
+ }
+}
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// 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_GluerAlgo.cxx
+// Created:
+// Author: Peter KURNEV
+// <peter@PREFEX>
+//
+#include <GEOMAlgo_GluerAlgo.hxx>
+
+
+//=======================================================================
+//function : GEOMAlgo_GluerAlgo
+//purpose :
+//=======================================================================
+GEOMAlgo_GluerAlgo::GEOMAlgo_GluerAlgo()
+{
+ myTolerance=0.0001;
+ myCheckGeometry=Standard_True;
+}
+//=======================================================================
+//function : ~GEOMAlgo_GluerAlgo
+//purpose :
+//=======================================================================
+GEOMAlgo_GluerAlgo::~GEOMAlgo_GluerAlgo()
+{
+}
+//=======================================================================
+//function : SetArgument
+//purpose :
+//=======================================================================
+void GEOMAlgo_GluerAlgo::SetArgument(const TopoDS_Shape& theShape)
+{
+ myArgument=theShape;
+}
+//=======================================================================
+//function : Argument
+//purpose :
+//=======================================================================
+const TopoDS_Shape& GEOMAlgo_GluerAlgo::Argument()const
+{
+ return myArgument;
+}
+//=======================================================================
+//function : SetTolerance
+//purpose :
+//=======================================================================
+void GEOMAlgo_GluerAlgo::SetTolerance(const Standard_Real aT)
+{
+ myTolerance=aT;
+}
+//=======================================================================
+//function : Tolerance
+//purpose :
+//=======================================================================
+Standard_Real GEOMAlgo_GluerAlgo::Tolerance()const
+{
+ return myTolerance;
+}
+
+//=======================================================================
+//function : SetCheckGeometry
+//purpose :
+//=======================================================================
+void GEOMAlgo_GluerAlgo::SetCheckGeometry(const Standard_Boolean aFlag)
+{
+ myCheckGeometry=aFlag;
+}
+//=======================================================================
+//function : CheckGeometry
+//purpose :
+//=======================================================================
+Standard_Boolean GEOMAlgo_GluerAlgo::CheckGeometry() const
+{
+ return myCheckGeometry;
+}
+//=======================================================================
+//function : Context
+//purpose :
+//=======================================================================
+IntTools_Context& GEOMAlgo_GluerAlgo::Context()
+{
+ return myContext;
+}
+//=======================================================================
+//function : Images
+//purpose :
+//=======================================================================
+const TopTools_DataMapOfShapeListOfShape& GEOMAlgo_GluerAlgo::Images()const
+{
+ return myImages;
+}
+//=======================================================================
+//function : Origins
+//purpose :
+//=======================================================================
+const TopTools_DataMapOfShapeShape& GEOMAlgo_GluerAlgo::Origins()const
+{
+ return myOrigins;
+}
+//=======================================================================
+//function : Clear
+//purpose :
+//=======================================================================
+void GEOMAlgo_GluerAlgo::Clear()
+{
+ myImages.Clear();
+ myOrigins.Clear();
+}
+//=======================================================================
+//function : Perform
+//purpose :
+//=======================================================================
+void GEOMAlgo_GluerAlgo::Perform()
+{
+}
--- /dev/null
+// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// 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_GluerAlgo.hxx
+// Created:
+// Author: Peter KURNEV
+// <pkv@irinox>
+//
+#ifndef _GEOMAlgo_GluerAlgo_HeaderFile
+#define _GEOMAlgo_GluerAlgo_HeaderFile
+
+#include <Standard_Macro.hxx>
+#include <TopoDS_Shape.hxx>
+#include <Standard_Real.hxx>
+#include <Standard_Boolean.hxx>
+#include <IntTools_Context.hxx>
+#include <TopTools_DataMapOfShapeListOfShape.hxx>
+#include <TopTools_DataMapOfShapeShape.hxx>
+#include <GEOMAlgo_BuilderShape.hxx>
+
+//=======================================================================
+//class : GEOMAlgo_GluerAlgo
+//purpose :
+//=======================================================================
+class GEOMAlgo_GluerAlgo {
+public:
+
+ Standard_EXPORT
+ GEOMAlgo_GluerAlgo();
+
+ Standard_EXPORT
+ virtual ~GEOMAlgo_GluerAlgo();
+
+ Standard_EXPORT
+ virtual void SetArgument(const TopoDS_Shape& theShape) ;
+
+ Standard_EXPORT
+ const TopoDS_Shape& Argument() const;
+
+ Standard_EXPORT
+ void SetTolerance(const Standard_Real aT) ;
+
+ Standard_EXPORT
+ Standard_Real Tolerance() const;
+
+ Standard_EXPORT
+ void SetCheckGeometry(const Standard_Boolean aFlag) ;
+
+ Standard_EXPORT
+ Standard_Boolean CheckGeometry() const;
+
+ Standard_EXPORT
+ virtual void Perform() ;
+
+ Standard_EXPORT
+ virtual void Clear() ;
+
+ Standard_EXPORT
+ IntTools_Context& Context() ;
+
+ Standard_EXPORT
+ const TopTools_DataMapOfShapeListOfShape& Images() const;
+
+ Standard_EXPORT
+ const TopTools_DataMapOfShapeShape& Origins() const;
+
+protected:
+ TopoDS_Shape myArgument;
+ Standard_Real myTolerance;
+ Standard_Boolean myCheckGeometry;
+ IntTools_Context myContext;
+ TopTools_DataMapOfShapeListOfShape myImages;
+ TopTools_DataMapOfShapeShape myOrigins;
+
+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
-#
-#
+
# GEOM GEOMAlgo : tools for Glue Faces algorithm
# File : Makefile.in
# Author : Julia DOROVSKIKH
-# Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : GEOM
-# $Header$
include $(top_srcdir)/adm_local/unix/make_common_starter.am
GEOMAlgo_FinderShapeOnQuad.cxx \
GEOMAlgo_GlueAnalyser.cxx \
GEOMAlgo_Gluer.cxx \
+ GEOMAlgo_GlueDetector.cxx \
+ GEOMAlgo_Gluer2.cxx \
+ GEOMAlgo_Gluer2_1.cxx \
+ GEOMAlgo_Gluer2_2.cxx \
+ GEOMAlgo_Gluer2_3.cxx \
+ GEOMAlgo_GluerAlgo.cxx \
GEOMAlgo_Gluer1.cxx \
GEOMAlgo_HAlgo.cxx \
GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_0.cxx \
GEOMAlgo_Gluer1.hxx \
GEOMAlgo_Gluer1.ixx \
GEOMAlgo_Gluer1.jxx \
+ GEOMAlgo_GlueDetector.hxx \
+ GEOMAlgo_Gluer2.hxx \
+ GEOMAlgo_GluerAlgo.hxx \
GEOMAlgo_HAlgo.hxx \
GEOMAlgo_HAlgo.ixx \
GEOMAlgo_HAlgo.jxx \
<source>ICON_DLG_GLUE_FACES2</source>
<translation>glue2.png</translation>
</message>
+ <message>
+ <source>ICON_DLG_GLUE_EDGES</source>
+ <translation>glue.png</translation>
+ </message>
+ <message>
+ <source>ICON_DLG_GLUE_EDGES2</source>
+ <translation>glue2.png</translation>
+ </message>
<message>
<source>ICON_DLG_LIMIT_TOLERANCE</source>
<translation>limit_tolerance.png</translation>
<source>ICO_GLUE_FACES</source>
<translation>glue.png</translation>
</message>
+ <message>
+ <source>ICO_GLUE_EDGES</source>
+ <translation>glue.png</translation>
+ </message>
<message>
<source>ICO_LIMIT_TOLERANCE</source>
<translation>limit_tolerance.png</translation>
<translation>Glue</translation>
</message>
<message>
- <source>GEOM_GLUE_TITLE</source>
+ <source>GEOM_GLUE_FACES_TITLE</source>
<translation>Glue faces</translation>
</message>
+ <message>
+ <source>GEOM_GLUE_EDGES_TITLE</source>
+ <translation>Glue edges</translation>
+ </message>
<message>
<source>GEOM_LIMIT_TOLERANCE_TITLE</source>
<translation>Limit tolerance</translation>
<source>MEN_GLUE_FACES</source>
<translation>Glue Faces</translation>
</message>
+ <message>
+ <source>MEN_GLUE_EDGES</source>
+ <translation>Glue Edges</translation>
+ </message>
<message>
<source>MEN_GROUP</source>
<translation>Group</translation>
<message>
<source>MEN_POP_PUBLISH_OBJ</source>
<translation>Publish...</translation>
- </message>
+ </message>
<message>
<source>MEN_POP_ISOS</source>
<translation>Isos</translation>
<source>STB_GLUE_FACES</source>
<translation>Perform glue faces</translation>
</message>
+ <message>
+ <source>STB_GLUE_EDGES</source>
+ <translation>Perform glue edges</translation>
+ </message>
<message>
<source>STB_GROUP_CREATE</source>
<translation>Create a group</translation>
</message>
<message>
<source>STB_POP_UNPUBLISH_OBJ</source>
- <translation>Unpublish object</translation>
+ <translation>Unpublish object</translation>
</message>
<message>
<source>STB_POP_PUBLISH_OBJ</source>
<translation>Publish object</translation>
- </message>
+ </message>
<message>
<source>STB_POP_HIDE_CHILDREN</source>
<translation>Hide child objects</translation>
<source>TOP_GLUE_FACES</source>
<translation>Perform glue faces</translation>
</message>
+ <message>
+ <source>TOP_GLUE_EDGES</source>
+ <translation>Perform glue edges</translation>
+ </message>
<message>
<source>TOP_GROUP_CREATE</source>
<translation>Create a group</translation>
<message>
<source>TOP_POP_UNPUBLISH_OBJ</source>
<translation>Unpublish object</translation>
- </message>
+ </message>
<message>
<source>TOP_POP_PUBLISH_OBJ</source>
- <translation>Publish object</translation>
- </message>
+ <translation>Publish object</translation>
+ </message>
<message>
<source>TOP_POP_HIDE_CHILDREN</source>
<translation>Hide Children</translation>
<message>
<source>FACES_FOR_GLUING_ARE_DETECTED</source>
<translation>There are %1 face(s) that can be glued. They are coloured on the screen with red colour.
-Please close this message box and select faces for glueing</translation>
+Please close this message box and select faces for gluing</translation>
+ </message>
+ <message>
+ <source>EDGES_FOR_GLUING_ARE_DETECTED</source>
+ <translation>There are %1 edge(s) that can be glued. They are coloured on the screen with red colour.
+Please close this message box and select edges for gluing</translation>
</message>
<message>
<source>GLUE_FACES</source>
<translation>Glue faces</translation>
</message>
+ <message>
+ <source>GLUE_EDGES</source>
+ <translation>Glue edges</translation>
+ </message>
<message>
<source>SELECT_FACES</source>
<translation>Select Faces</translation>
</message>
+ <message>
+ <source>SELECT_EDGES</source>
+ <translation>Select Edges</translation>
+ </message>
<message>
<source>THERE_ARE_NO_FACES_FOR_GLUING</source>
<translation>There are no faces for gluing</translation>
</message>
+ <message>
+ <source>THERE_ARE_NO_EDGES_FOR_GLUING</source>
+ <translation>There are no edges for gluing</translation>
+ </message>
</context>
<context>
<name>RepairGUI_ShapeProcessDlg</name>
<name>GEOMToolsGUI_PublishDlg</name>
<message>
<source>GEOM_PUBLISH_OBJECTS_TLT</source>
- <translation>Publish Objects</translation>
- </message>
+ <translation>Publish Objects</translation>
+ </message>
<message>
- <source>OBJECT_NAME</source>
- <translation>Name</translation>
+ <source>OBJECT_NAME</source>
+ <translation>Name</translation>
</message>
<message>
- <source>OBJECT_ENTRY</source>
- <translation>Entry</translation>
- </message>
+ <source>OBJECT_ENTRY</source>
+ <translation>Entry</translation>
+ </message>
<message>
<source>UNSELECT_ALL</source>
<translation>U&nselect All</translation>
</message>
- <message>
+ <message>
<source>SELECT_ALL</source>
- <translation>Select &All</translation>
+ <translation>Select &All</translation>
</message>
<message>
<source>GEOM_PUBLISH_BTN</source>
- <translation>&Publish</translation>
+ <translation>&Publish</translation>
</message>
<message>
<source>GEOM_PUBLISH_CLOSE_BTN</source>
- <translation>P&ublish And Close</translation>
- </message>
+ <translation>P&ublish And Close</translation>
+ </message>
</context>
</TS>
case GEOMOp::OpFreeFaces: // MENU MEASURE - FREE FACES
case GEOMOp::OpOrientation: // MENU REPAIR - CHANGE ORIENTATION
case GEOMOp::OpGlueFaces: // MENU REPAIR - GLUE FACES
+ case GEOMOp::OpGlueEdges: // MENU REPAIR - GLUE EDGES
case GEOMOp::OpLimitTolerance: // MENU REPAIR - LIMIT TOLERANCE
case GEOMOp::OpRemoveExtraEdges: // MENU REPAIR - REMOVE EXTRA EDGES
libName = "RepairGUI";
createGeomAction( GEOMOp::OpSewing, "SEWING" );
createGeomAction( GEOMOp::OpGlueFaces, "GLUE_FACES" );
+ createGeomAction( GEOMOp::OpGlueEdges, "GLUE_EDGES" );
createGeomAction( GEOMOp::OpLimitTolerance, "LIMIT_TOLERANCE" );
createGeomAction( GEOMOp::OpSuppressFaces, "SUPPRESS_FACES" );
createGeomAction( GEOMOp::OpSuppressHoles, "SUPPERSS_HOLES" );
createMenu( GEOMOp::OpSuppressHoles, repairId, -1 );
createMenu( GEOMOp::OpSewing, repairId, -1 );
createMenu( GEOMOp::OpGlueFaces, repairId, -1 );
+ createMenu( GEOMOp::OpGlueEdges, repairId, -1 );
createMenu( GEOMOp::OpLimitTolerance, repairId, -1 );
createMenu( GEOMOp::OpAddPointOnEdge, repairId, -1 );
//createMenu( GEOMOp::OpFreeBoundaries, repairId, -1 );
OpGlueFaces = 4010, // MENU REPAIR - GLUE FACES
OpRemoveExtraEdges = 4011, // MENU REPAIR - REMOVE EXTRA EDGES
OpLimitTolerance = 4012, // MENU REPAIR - LIMIT TOLERANCE
+ OpGlueEdges = 4013, // MENU REPAIR - GLUE EDGES
// MeasureGUI ----------------//--------------------------------
OpProperties = 5000, // MENU MEASURES - PROPERTIES
OpCenterMass = 5001, // MENU MEASURES - CENTRE OF MASS
// 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 <GEOMAlgo_Gluer.hxx>
#include "GEOMAlgo_Gluer1.hxx"
+#include "GEOMAlgo_Gluer2.hxx"
#include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx"
#include "GEOMAlgo_CoupleOfShapes.hxx"
#include "GEOMAlgo_ListOfCoupleOfShapes.hxx"
#include <TopExp.hxx>
#include <TopoDS_Shape.hxx>
-#include <TopTools_ListOfShape.hxx>
+#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <ShapeFix_Shape.hxx>
//function : GlueFacesWithWarnings
//purpose :
//=======================================================================
+/*
TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& theShape,
const Standard_Real theTolerance,
const Standard_Boolean doKeepNonSolids,
aSfs->Perform();
aRes = aSfs->Shape();
-
// Fill history to be used by GetInPlace functionality
TopTools_IndexedMapOfShape aResIndices;
TopExp::MapShapes(aRes, aResIndices);
return aRes;
}
-
//=======================================================================
//function : GlueFaces
//purpose :
const Standard_Real theTolerance,
const Standard_Boolean doKeepNonSolids)
{
- Standard_Integer iErr, iWrn;
TopoDS_Shape aRes;
GEOMAlgo_Gluer aGluer;
aGluer.Perform();
- iErr = aGluer.ErrorStatus();
+ Standard_Integer iErr = aGluer.ErrorStatus();
if (iErr) {
switch (iErr) {
case 2:
return aRes;
}
- iWrn = aGluer.WarningStatus();
+ Standard_Integer iWrn = aGluer.WarningStatus();
if (iWrn) {
switch (iWrn) {
case 1:
return aRes;
}
-
//=======================================================================
//function : GlueFacesByList
//purpose :
const GEOMAlgo_CoupleOfShapes& aCSG = aItCS.Value();
const TopoDS_Shape& aF1 = aCSG.Shape1();
const TopoDS_Shape& aF2 = aCSG.Shape2();
- if( aFaces.Contains(aF1) || aFaces.Contains(aF2) )
+ if (aFaces.Contains(aF1) || aFaces.Contains(aF2))
continue;
aCS.SetShapes(aF1,aF2);
aLCS.Append(aCS);
}
//cout<<"aLCS.Extent() = "<<aLCS.Extent()<<endl;
- if(aLCS.Extent()>0) {
+ if (aLCS.Extent()>0) {
aGluer.SetFacesToUnglue(aLCS);
aGluer.UnglueFaces();
iErr = aGluer.ErrorStatus();
return aRes;
}
+*/
+
+//=======================================================================
+//function : GlueFaces
+//purpose :
+//=======================================================================
+TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape,
+ const Standard_Real theTolerance,
+ const Standard_Boolean doKeepNonSolids)
+{
+ TopoDS_Shape aRes;
+
+ GEOMAlgo_Gluer2 aGA;
+
+ // 1. Initialization
+ aGA.SetArgument(theShape);
+ aGA.SetTolerance(theTolerance);
+ aGA.SetKeepNonSolids(doKeepNonSolids);
+
+ // 2. Detect interferred shapes
+ aGA.Detect();
+ Standard_Integer iErr = aGA.ErrorStatus();
+ if (iErr) {
+ switch (iErr) {
+ case 11:
+ Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
+ break;
+ case 13:
+ case 14:
+ Standard_Failure::Raise("PerformImagesToWork failed");
+ break;
+ default:
+ {
+ // description of all errors see in GEOMAlgo_Gluer2.cxx
+ TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
+ aMsg += TCollection_AsciiString(iErr);
+ Standard_Failure::Raise(aMsg.ToCString());
+ break;
+ }
+ }
+ return aRes;
+ }
+
+ // 3. Set shapes to glue. If the operator is absent, the whole gluing will be done
+ //aGA.SetShapesToGlue(aMSG);
+
+ // 4. Gluing
+ aGA.Perform();
+ iErr = aGA.ErrorStatus();
+ if (iErr) {
+ switch (iErr) {
+ case 11:
+ Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
+ break;
+ case 13:
+ case 14:
+ Standard_Failure::Raise("PerformImagesToWork failed");
+ break;
+ default:
+ {
+ // description of all errors see in GEOMAlgo_Gluer2.cxx
+ TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
+ aMsg += TCollection_AsciiString(iErr);
+ Standard_Failure::Raise(aMsg.ToCString());
+ break;
+ }
+ }
+ return aRes;
+ }
+
+ Standard_Integer iWrn = aGA.WarningStatus();
+ if (iWrn) {
+ switch (iWrn) {
+ case 1:
+ MESSAGE("No shapes to glue");
+ break;
+ default:
+ // description of all warnings see in GEOMAlgo_Gluer2.cxx
+ MESSAGE("Warning in GEOMAlgo_Gluer2 with code " << iWrn);
+ break;
+ }
+ }
+
+ // 5. Result
+ aRes = aGA.Shape();
+ return aRes;
+}
+
+//=======================================================================
+//function : GlueWithWarnings
+//purpose :
+//=======================================================================
+TopoDS_Shape GEOMImpl_GlueDriver::GlueWithWarnings (const TopoDS_Shape& theShape,
+ const Standard_Real theTolerance,
+ const TopAbs_ShapeEnum theShapeType,
+ const Standard_Boolean doKeepNonSolids,
+ TCollection_AsciiString& theWarning) const
+{
+ TopoDS_Shape aRes;
+
+ GEOMAlgo_Gluer2 aGA;
+
+ // 1. Initialization
+ aGA.SetArgument(theShape);
+ aGA.SetTolerance(theTolerance);
+ aGA.SetKeepNonSolids(doKeepNonSolids);
+
+ // 2. Detect interferred shapes
+ aGA.Detect();
+ Standard_Integer iErr = aGA.ErrorStatus();
+ if (iErr) {
+ switch (iErr) {
+ case 11:
+ Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
+ break;
+ case 13:
+ case 14:
+ Standard_Failure::Raise("PerformImagesToWork failed");
+ break;
+ default:
+ {
+ // description of all errors see in GEOMAlgo_Gluer2.cxx
+ TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
+ aMsg += TCollection_AsciiString(iErr);
+ Standard_Failure::Raise(aMsg.ToCString());
+ break;
+ }
+ }
+ return aRes;
+ }
+
+ // 3. Fill shapes to glue aMSG
+ TopTools_DataMapOfShapeListOfShape aMSG;
+ const TopTools_DataMapOfShapeListOfShape& aMSD = aGA.ShapesDetected();
+ TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItMSD;
+ aItMSD.Initialize(aMSD);
+ for (; aItMSD.More(); aItMSD.Next()) {
+ const TopoDS_Shape& aSx = aItMSD.Key();
+ const TopTools_ListOfShape& aLSD = aItMSD.Value();
+ if (aSx.ShapeType() == theShapeType) {
+ aMSG.Bind(aSx, aLSD);
+ }
+ }
+
+ // 4. Set shapes to glue. If the operator is absent, the whole gluing will be done
+ aGA.SetShapesToGlue(aMSG);
+
+ // 5. Gluing
+ aGA.Perform();
+ iErr = aGA.ErrorStatus();
+ if (iErr) {
+ switch (iErr) {
+ case 11:
+ Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
+ break;
+ case 13:
+ case 14:
+ Standard_Failure::Raise("PerformImagesToWork failed");
+ break;
+ default:
+ {
+ // description of all errors see in GEOMAlgo_Gluer2.cxx
+ TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
+ aMsg += TCollection_AsciiString(iErr);
+ Standard_Failure::Raise(aMsg.ToCString());
+ break;
+ }
+ }
+ return aRes;
+ }
+
+ Standard_Integer iWrn = aGA.WarningStatus();
+ if (iWrn) {
+ switch (iWrn) {
+ case 1:
+ theWarning = "No shapes to glue";
+ break;
+ default:
+ // description of all warnings see in GEOMAlgo_Gluer2.cxx
+ theWarning = "Warning in GEOMAlgo_Gluer2 with code ";
+ theWarning += TCollection_AsciiString(iWrn);
+ break;
+ }
+ }
+
+ // 6. Result
+ aRes = aGA.Shape();
+
+ // 7. Fill history to be used by GetInPlace functionality
+ TopTools_IndexedMapOfShape aResIndices;
+ TopExp::MapShapes(aRes, aResIndices);
+
+ Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
+
+ // history for all argument shapes
+ TDF_LabelSequence aLabelSeq;
+ aFunction->GetDependency(aLabelSeq);
+ Standard_Integer nbArg = aLabelSeq.Length();
+
+ for (Standard_Integer iarg = 1; iarg <= nbArg; iarg++) {
+
+ TDF_Label anArgumentRefLabel = aLabelSeq.Value(iarg);
+
+ Handle(GEOM_Object) anArgumentObject = GEOM_Object::GetReferencedObject(anArgumentRefLabel);
+ TopoDS_Shape anArgumentShape = anArgumentObject->GetValue();
+
+ TopTools_IndexedMapOfShape anArgumentIndices;
+ TopExp::MapShapes(anArgumentShape, anArgumentIndices);
+ Standard_Integer nbArgumentEntities = anArgumentIndices.Extent();
+
+ // Find corresponding label in history
+ TDF_Label anArgumentHistoryLabel =
+ aFunction->GetArgumentHistoryEntry(anArgumentRefLabel, Standard_True);
+
+ for (Standard_Integer ie = 1; ie <= nbArgumentEntities; ie++) {
+ TopoDS_Shape anEntity = anArgumentIndices.FindKey(ie);
+ const TopTools_ListOfShape& aModified = aGA.Modified(anEntity);
+ Standard_Integer nbModified = aModified.Extent();
+
+ if (nbModified > 0) {
+ TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(ie, Standard_True);
+ Handle(TDataStd_IntegerArray) anAttr =
+ TDataStd_IntegerArray::Set(aWhatHistoryLabel, 1, nbModified);
+
+ TopTools_ListIteratorOfListOfShape itM (aModified);
+ for (int im = 1; itM.More(); itM.Next(), ++im) {
+ int id = aResIndices.FindIndex(itM.Value());
+ anAttr->SetValue(im, id);
+ }
+ }
+ }
+ }
+
+ return aRes;
+}
+
+//=======================================================================
+//function : GlueByList
+//purpose :
+//=======================================================================
+TopoDS_Shape GEOMImpl_GlueDriver::GlueByList (const TopoDS_Shape& theShape,
+ const Standard_Real theTolerance,
+ const Standard_Boolean doKeepNonSolids,
+ const TopTools_MapOfShape& theShapesList)
+{
+ TopoDS_Shape aRes;
+
+ GEOMAlgo_Gluer2 aGA;
+
+ // 1. Initialization
+ aGA.SetArgument(theShape);
+ aGA.SetTolerance(theTolerance);
+ aGA.SetKeepNonSolids(doKeepNonSolids);
+
+ // 2. Detect interferred shapes
+ aGA.Detect();
+ Standard_Integer iErr = aGA.ErrorStatus();
+ if (iErr) {
+ switch (iErr) {
+ case 11:
+ Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
+ break;
+ case 13:
+ case 14:
+ Standard_Failure::Raise("PerformImagesToWork failed");
+ break;
+ default:
+ {
+ // description of all errors see in GEOMAlgo_Gluer2.cxx
+ TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
+ aMsg += TCollection_AsciiString(iErr);
+ Standard_Failure::Raise(aMsg.ToCString());
+ break;
+ }
+ }
+ return aRes;
+ }
+
+ // 3. Fill shapes to glue aMSG
+ TopTools_DataMapOfShapeListOfShape aMSG;
+ const TopTools_DataMapOfShapeListOfShape& aMSD = aGA.ShapesDetected();
+ TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItMSD;
+ aItMSD.Initialize(aMSD);
+ for (; aItMSD.More(); aItMSD.Next()) {
+ const TopoDS_Shape& aSx = aItMSD.Key();
+ const TopTools_ListOfShape& aLSD = aItMSD.Value();
+ TopTools_ListIteratorOfListOfShape anItLSD (aLSD);
+ bool isToGlue = false;
+ for (; anItLSD.More() && !isToGlue; anItLSD.Next()) {
+ if (theShapesList.Contains(anItLSD.Value())) {
+ isToGlue = true;
+ aMSG.Bind(aSx, aLSD);
+ }
+ }
+ }
+
+ // 4. Set shapes to glue. If the operator is absent, the whole gluing will be done
+ aGA.SetShapesToGlue(aMSG);
+
+ // 5. Gluing
+ aGA.Perform();
+ iErr = aGA.ErrorStatus();
+ if (iErr) {
+ switch (iErr) {
+ case 11:
+ Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
+ break;
+ case 13:
+ case 14:
+ Standard_Failure::Raise("PerformImagesToWork failed");
+ break;
+ default:
+ {
+ // description of all errors see in GEOMAlgo_Gluer2.cxx
+ TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
+ aMsg += TCollection_AsciiString(iErr);
+ Standard_Failure::Raise(aMsg.ToCString());
+ break;
+ }
+ }
+ return aRes;
+ }
+
+ Standard_Integer iWrn = aGA.WarningStatus();
+ if (iWrn) {
+ switch (iWrn) {
+ case 1:
+ MESSAGE("No shapes to glue");
+ break;
+ default:
+ // description of all warnings see in GEOMAlgo_Gluer2.cxx
+ MESSAGE("Warning in GEOMAlgo_Gluer2 with code " << iWrn);
+ break;
+ }
+ }
+
+ // 6. Result
+ aRes = aGA.Shape();
+
+ return aRes;
+}
//=======================================================================
//function : Execute
Standard_Boolean aKeepNonSolids = aCI.GetKeepNonSolids();
if (aType == GLUE_FACES) {
- aShape = GlueFacesWithWarnings(aShapeBase, tol3d, aKeepNonSolids, aWrn);
+ //aShape = GlueFacesWithWarnings(aShapeBase, tol3d, aKeepNonSolids, aWrn);
+ aShape = GlueWithWarnings(aShapeBase, tol3d, TopAbs_FACE, aKeepNonSolids, aWrn);
+ }
+ else if (aType == GLUE_EDGES) {
+ aShape = GlueWithWarnings(aShapeBase, tol3d, TopAbs_EDGE, aKeepNonSolids, aWrn);
}
- else { // aType == GLUE_FACES_BY_LIST
+ else if (aType == GLUE_FACES_BY_LIST || aType == GLUE_EDGES_BY_LIST) {
Handle(TColStd_HSequenceOfTransient) SF = aCI.GetFaces();
TopTools_MapOfShape aFaces;
- int i=1;
- for( ; i <= SF->Length(); i++) {
+ int i = 1;
+ for (; i <= SF->Length(); i++) {
Handle(Standard_Transient) anItem = SF->Value(i);
- if(anItem.IsNull())
+ if (anItem.IsNull())
continue;
Handle(GEOM_Function) aRefSh = Handle(GEOM_Function)::DownCast(anItem);
- if(aRefSh.IsNull())
+ if (aRefSh.IsNull())
continue;
TopoDS_Shape aFace = aRefSh->GetValue();
- if(aFace.IsNull())
+ if (aFace.IsNull())
continue;
- if(!aFaces.Contains(aFace))
+ if (!aFaces.Contains(aFace))
aFaces.Add(aFace);
}
- aShape = GlueFacesByList(aShapeBase, tol3d, aKeepNonSolids, aFaces);
+ //aShape = GlueFacesByList(aShapeBase, tol3d, aKeepNonSolids, aFaces);
+ aShape = GlueByList(aShapeBase, tol3d, aKeepNonSolids, aFaces);
}
if (aShape.IsNull()) return 0;
{
static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver);
+ if (aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver);
static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
+ if (aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
+ if (aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
}
}
- return _anOtherObject ;
+ return _anOtherObject;
}
// 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 : GEOMImpl_GlueDriver.ixx
// Module : GEOMImpl
-//
+
#ifndef _GEOMImpl_GlueDriver_HeaderFile
#define _GEOMImpl_GlueDriver_HeaderFile
Standard_EXPORT static TopoDS_Shape GlueFaces (const TopoDS_Shape& theShape,
const Standard_Real theTolerance,
const Standard_Boolean doKeepNonSolids = Standard_True);
-
+ /*
Standard_EXPORT TopoDS_Shape GlueFacesWithWarnings (const TopoDS_Shape& theShape,
const Standard_Real theTolerance,
const Standard_Boolean doKeepNonSolids,
const Standard_Real theTolerance,
const Standard_Boolean doKeepNonSolids,
const TopTools_MapOfShape& aFaces);
+ */
+Standard_EXPORT TopoDS_Shape GlueWithWarnings (const TopoDS_Shape& theShape,
+ const Standard_Real theTolerance,
+ const TopAbs_ShapeEnum theShapeType,
+ const Standard_Boolean doKeepNonSolids,
+ TCollection_AsciiString& theWarning) const;
+
+Standard_EXPORT static TopoDS_Shape GlueByList (const TopoDS_Shape& theShape,
+ const Standard_Real theTolerance,
+ const Standard_Boolean doKeepNonSolids,
+ const TopTools_MapOfShape& theShapesList);
// Type management
#include "GEOMAlgo_ClsfBox.hxx"
#include "GEOMAlgo_ClsfSolid.hxx"
#include "GEOMAlgo_Gluer1.hxx"
+#include "GEOMAlgo_GlueDetector.hxx"
#include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx"
#include "GEOMAlgo_CoupleOfShapes.hxx"
#include "GEOMAlgo_ListOfCoupleOfShapes.hxx"
#include <TopAbs.hxx>
#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopLoc_Location.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Iterator.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopLoc_Location.hxx>
-#include <TopTools_MapOfShape.hxx>
-#include <TopTools_MapOfOrientedShape.hxx>
#include <TopTools_Array1OfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopTools_MapOfOrientedShape.hxx>
#include <Geom_Surface.hxx>
#include <Geom_Plane.hxx>
* GetGlueFaces
*/
//=============================================================================
+/*
Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueFaces
(Handle(GEOM_Object) theShape,
const Standard_Real theTolerance)
if( anAsciiList.Length() > 0 ) {
anAsciiList.Trunc(anAsciiList.Length() - 1);
Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
- GEOM::TPythonDump pd (aFunction, /*append=*/true);
+ GEOM::TPythonDump pd (aFunction, true);
pd << "[" << anAsciiList.ToCString();
pd << "] = geompy.GetGlueFaces(" << theShape << ", " << theTolerance << ")";
}
return aSeq;
}
+*/
//=============================================================================
/*!
return aGlued;
}
+//=============================================================================
+/*!
+ * MakeGlueEdges
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueEdges
+ (Handle(GEOM_Object) theShape,
+ const Standard_Real theTolerance)
+{
+ SetErrorCode(KO);
+
+ if (theShape.IsNull()) return NULL;
+
+ //Add a new Glued object
+ Handle(GEOM_Object) aGlued = GetEngine()->AddObject(GetDocID(), GEOM_GLUED);
+
+ //Add a new Glue function
+ Handle(GEOM_Function) aFunction;
+ aFunction = aGlued->AddFunction(GEOMImpl_GlueDriver::GetID(), GLUE_EDGES);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_GlueDriver::GetID()) return NULL;
+
+ GEOMImpl_IGlue aCI (aFunction);
+
+ Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
+ if (aRefShape.IsNull()) return NULL;
+
+ aCI.SetBase(aRefShape);
+ aCI.SetTolerance(theTolerance);
+ aCI.SetKeepNonSolids(true);
+
+ //Compute the sub-shape value
+ Standard_Boolean isWarning = Standard_False;
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Shape driver failed to glue edges");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ // to provide warning
+ if (!aFunction->GetValue().IsNull()) {
+ isWarning = Standard_True;
+ } else {
+ return NULL;
+ }
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction) << aGlued << " = geompy.MakeGlueEdges("
+ << theShape << ", " << theTolerance << ")";
+
+ // to provide warning
+ if (!isWarning) SetErrorCode(OK);
+ return aGlued;
+}
+
+//=============================================================================
+/*!
+ * GetGlueShapes
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueShapes
+ (Handle(GEOM_Object) theShape,
+ const Standard_Real theTolerance,
+ const TopAbs_ShapeEnum theType)
+{
+ SetErrorCode(KO);
+
+ if (theShape.IsNull()) return NULL;
+ TopoDS_Shape aShape = theShape->GetValue();
+ if (aShape.IsNull()) return NULL;
+
+ Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+
+ GEOMAlgo_GlueDetector aGluer;
+ aGluer.SetArgument(aShape);
+ aGluer.SetTolerance(theTolerance);
+ aGluer.Perform();
+ Standard_Integer iErr = aGluer.ErrorStatus();
+ if (iErr) return NULL;
+
+ TCollection_AsciiString anAsciiList, anEntry;
+ TopTools_IndexedMapOfShape anIndices;
+ TopExp::MapShapes(aShape, anIndices);
+ Handle(TColStd_HArray1OfInteger) anArray;
+ Handle(GEOM_Object) anObj;
+
+ const TopTools_DataMapOfShapeListOfShape& aImages = aGluer.Images();
+ TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS (aImages);
+ for (int index = 1; aItDMSLS.More(); aItDMSLS.Next(), ++index) {
+ // some key shape
+ //const TopoDS_Shape& aSkey = aItDMSLS.Key();
+
+ // list of shapes of the argument that can be glued
+ const TopTools_ListOfShape& aLSD = aItDMSLS.Value();
+
+ //listShape.Append(aLSD.First());
+ TopoDS_Shape aValue = aLSD.First();
+
+ if (aValue.ShapeType() == theType) {
+ anArray = new TColStd_HArray1OfInteger(1,1);
+ anArray->SetValue(1, anIndices.FindIndex(aValue));
+ anObj = GetEngine()->AddSubShape(theShape, anArray);
+ if (!anObj.IsNull()) {
+ aSeq->Append(anObj);
+
+ // for python command
+ TDF_Tool::Entry(anObj->GetEntry(), anEntry);
+ anAsciiList += anEntry;
+ anAsciiList += ",";
+ }
+ }
+ }
+
+ // Make a Python command
+ if (anAsciiList.Length() > 0) {
+ anAsciiList.Trunc(anAsciiList.Length() - 1);
+ Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+ GEOM::TPythonDump pd (aFunction, /*append=*/true);
+ pd << "[" << anAsciiList.ToCString();
+ if (theType == TopAbs_FACE)
+ pd << "] = geompy.GetGlueFaces(" << theShape << ", " << theTolerance << ")";
+ else if (theType == TopAbs_EDGE)
+ pd << "] = geompy.GetGlueEdges(" << theShape << ", " << theTolerance << ")";
+ }
+
+ SetErrorCode(OK);
+
+ return aSeq;
+}
+
+//=============================================================================
+/*!
+ * MakeGlueEdgesByList
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueEdgesByList
+ (Handle(GEOM_Object) theShape,
+ const Standard_Real theTolerance,
+ std::list<Handle(GEOM_Object)> theEdges)
+{
+ SetErrorCode(KO);
+
+ if (theShape.IsNull()) return NULL;
+
+ //Add a new Glued object
+ Handle(GEOM_Object) aGlued = GetEngine()->AddObject(GetDocID(), GEOM_GLUED);
+
+ //Add a new Glue function
+ Handle(GEOM_Function) aFunction;
+ aFunction = aGlued->AddFunction(GEOMImpl_GlueDriver::GetID(), GLUE_EDGES_BY_LIST);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_GlueDriver::GetID()) return NULL;
+
+ GEOMImpl_IGlue aCI (aFunction);
+
+ Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
+ if (aRefShape.IsNull()) return NULL;
+
+ aCI.SetBase(aRefShape);
+ aCI.SetTolerance(theTolerance);
+ aCI.SetKeepNonSolids(true);
+
+ Handle(TColStd_HSequenceOfTransient) anEdges = new TColStd_HSequenceOfTransient;
+ std::list<Handle(GEOM_Object)>::iterator it = theEdges.begin();
+ for (; it != theEdges.end(); it++) {
+ Handle(GEOM_Function) aRefSh = (*it)->GetLastFunction();
+ if (aRefSh.IsNull()) {
+ SetErrorCode("NULL argument shape for the shape construction");
+ return NULL;
+ }
+ anEdges->Append(aRefSh);
+ }
+ aCI.SetFaces(anEdges);
+
+ //Compute the sub-shape value
+ Standard_Boolean isWarning = Standard_False;
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Shape driver failed to glue edges");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ // to provide warning
+ if (!aFunction->GetValue().IsNull()) {
+ isWarning = Standard_True;
+ } else {
+ return NULL;
+ }
+ }
+
+ //Make a Python command
+
+ GEOM::TPythonDump pd (aFunction);
+ pd << aGlued << " = geompy.MakeGlueEdgesByList("
+ << theShape << ", " << theTolerance << ", [";
+ // Edges
+ it = theEdges.begin();
+ if (it != theEdges.end()) {
+ pd << (*it++);
+ while (it != theEdges.end()) {
+ pd << ", " << (*it++);
+ }
+ }
+ pd << "])";
+
+ // to provide warning
+ if (!isWarning) SetErrorCode(OK);
+ return aGlued;
+}
+
//=============================================================================
/*!
* GetExistingSubObjects
const Standard_Real theTolerance,
const Standard_Boolean doKeepNonSolids);
- Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetGlueFaces (Handle(GEOM_Object) theShape,
- const Standard_Real theTolerance);
+ //Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetGlueFaces (Handle(GEOM_Object) theShape,
+ // const Standard_Real theTolerance);
Standard_EXPORT Handle(GEOM_Object) MakeGlueFacesByList (Handle(GEOM_Object) theShape,
const Standard_Real theTolerance,
std::list<Handle(GEOM_Object)> theFaces,
const Standard_Boolean doKeepNonSolids);
+ Standard_EXPORT Handle(GEOM_Object) MakeGlueEdges (Handle(GEOM_Object) theShape,
+ const Standard_Real theTolerance);
+
+ Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetGlueShapes (Handle(GEOM_Object) theShape,
+ const Standard_Real theTolerance,
+ const TopAbs_ShapeEnum theType);
+
+ Standard_EXPORT Handle(GEOM_Object) MakeGlueEdgesByList (Handle(GEOM_Object) theShape,
+ const Standard_Real theTolerance,
+ std::list<Handle(GEOM_Object)> theEdges);
+
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetExistingSubObjects
(Handle(GEOM_Object) theShape,
const Standard_Boolean theGroupsOnly);
#define BASIC_FILLING 1
-#define GLUE_FACES 1
+#define GLUE_FACES 1
#define GLUE_FACES_BY_LIST 2
+#define GLUE_EDGES 3
+#define GLUE_EDGES_BY_LIST 4
#define SKETCHER_NINE_DOUBLS 1
#define SKETCHER_PLANE 2
return GetObject(anObject);
}
-
//=============================================================================
/*!
* GetGlueFaces
if (aShape.IsNull()) return aSeq._retn();
Handle(TColStd_HSequenceOfTransient) aHSeq =
- GetOperations()->GetGlueFaces(aShape, theTolerance);
+ //GetOperations()->GetGlueFaces(aShape, theTolerance);
+ GetOperations()->GetGlueShapes(aShape, theTolerance, TopAbs_FACE);
//if (!GetOperations()->IsDone() || aHSeq.IsNull())
// to allow warning
return aSeq._retn();
}
-
//=============================================================================
/*!
* MakeGlueFacesByList
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * MakeGlueEdges
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueEdges
+ (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theTolerance)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference objects
+ Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
+ if (aShape.IsNull()) return aGEOMObject._retn();
+
+ //Perform the gluing
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakeGlueEdges(aShape, theTolerance);
+ //if (!GetOperations()->IsDone() || anObject.IsNull())
+ // to allow warning
+ if (anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ * GetGlueEdges
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueEdges
+ (GEOM::GEOM_Object_ptr theShape,
+ const CORBA::Double theTolerance)
+{
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference objects
+ Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
+ if (aShape.IsNull()) return aSeq._retn();
+
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->GetGlueShapes(aShape, theTolerance, TopAbs_EDGE);
+
+ //if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ // to allow warning
+ if (aHSeq.IsNull())
+ return aSeq._retn();
+
+ Standard_Integer aLength = aHSeq->Length();
+ aSeq->length(aLength);
+ for (Standard_Integer i = 1; i <= aLength; i++)
+ aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+ return aSeq._retn();
+}
+
+//=============================================================================
+/*!
+ * MakeGlueEdgesByList
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueEdgesByList
+ (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theTolerance,
+ const GEOM::ListOfGO& theEdges)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference objects
+ Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
+ if (aShape.IsNull()) return aGEOMObject._retn();
+
+ int ind, aLen;
+ std::list<Handle(GEOM_Object)> anEdges;
+ //Get the shapes
+ aLen = theEdges.length();
+ for (ind = 0; ind < aLen; ind++) {
+ Handle(GEOM_Object) aSh = GetObjectImpl(theEdges[ind]);
+ if (aSh.IsNull()) return aGEOMObject._retn();
+ anEdges.push_back(aSh);
+ }
+
+ //Perform the gluing
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakeGlueEdgesByList(aShape, theTolerance, anEdges);
+ //if (!GetOperations()->IsDone() || anObject.IsNull())
+ // to allow warning
+ if (anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
//=============================================================================
/*!
* GetExistingSubObjects
const GEOM::ListOfGO& theFaces,
CORBA::Boolean doKeepNonSolids);
+ GEOM::GEOM_Object_ptr MakeGlueEdges (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theTolerance);
+
+ GEOM::ListOfGO* GetGlueEdges (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theTolerance);
+
+ GEOM::GEOM_Object_ptr MakeGlueEdgesByList (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Double theTolerance,
+ const GEOM::ListOfGO& theEdges);
+
GEOM::ListOfGO* GetExistingSubObjects (GEOM::GEOM_Object_ptr theShape,
CORBA::Boolean theGroupsOnly);
raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode()
return anObj
+ ## Replace coincident edges in theShape by one edge.
+ # @param theShape Initial shape.
+ # @param theTolerance Maximum distance between edges, which can be considered as coincident.
+ # @return New GEOM_Object, containing a copy of theShape without coincident edges.
+ #
+ # @ref tui_glue_faces "Example"
+ def MakeGlueEdges(self, theShape, theTolerance):
+ # Example: see GEOM_Spanner.py
+ theTolerance,Parameters = ParseParameters(theTolerance)
+ anObj = self.ShapesOp.MakeGlueEdges(theShape, theTolerance)
+ if anObj is None:
+ raise RuntimeError, "MakeGlueEdges : " + self.ShapesOp.GetErrorCode()
+ anObj.SetParameters(Parameters)
+ return anObj
+
+ ## Find coincident edges in theShape for possible gluing.
+ # @param theShape Initial shape.
+ # @param theTolerance Maximum distance between edges,
+ # which can be considered as coincident.
+ # @return ListOfGO.
+ #
+ # @ref tui_glue_faces "Example"
+ def GetGlueEdges(self, theShape, theTolerance):
+ # Example: see GEOM_Spanner.py
+ anObj = self.ShapesOp.GetGlueEdges(theShape, theTolerance)
+ RaiseIfFailed("GetGlueEdges", self.ShapesOp)
+ return anObj
+
+ ## Replace coincident edges in theShape by one edge
+ # in compliance with given list of edges
+ # @param theShape Initial shape.
+ # @param theTolerance Maximum distance between edges,
+ # which can be considered as coincident.
+ # @param theFaces List of edges for gluing.
+ # @return New GEOM_Object, containing a copy of theShape
+ # without some edges.
+ #
+ # @ref tui_glue_faces "Example"
+ def MakeGlueEdgesByList(self, theShape, theTolerance, theEdges):
+ # Example: see GEOM_Spanner.py
+ anObj = self.ShapesOp.MakeGlueEdgesByList(theShape, theTolerance, theEdges)
+ if anObj is None:
+ raise RuntimeError, "MakeGlueEdgesByList : " + self.ShapesOp.GetErrorCode()
+ return anObj
+
# end of l3_healing
## @}
getGeometryGUI()->EmitSignalDeactivateDialog();
QDialog* aDlg = NULL;
- switch ( theCommandID ) {
+ switch (theCommandID) {
case GEOMOp::OpSewing: aDlg = new RepairGUI_SewingDlg (getGeometryGUI(), parent); break;
- case GEOMOp::OpGlueFaces: aDlg = new RepairGUI_GlueDlg (getGeometryGUI(), parent); break;
+ case GEOMOp::OpGlueFaces: aDlg = new RepairGUI_GlueDlg (getGeometryGUI(), parent, false, TopAbs_FACE); break;
+ case GEOMOp::OpGlueEdges: aDlg = new RepairGUI_GlueDlg (getGeometryGUI(), parent, false, TopAbs_EDGE); break;
case GEOMOp::OpLimitTolerance: aDlg = new RepairGUI_LimitToleranceDlg (getGeometryGUI(), parent); break;
case GEOMOp::OpSuppressFaces: aDlg = new RepairGUI_SuppressFacesDlg (getGeometryGUI(), parent); break;
case GEOMOp::OpSuppressHoles: aDlg = new RepairGUI_RemoveHolesDlg (getGeometryGUI(), parent); break;
case GEOMOp::OpOrientation: aDlg = new RepairGUI_ChangeOrientationDlg (getGeometryGUI(), parent); break;
case GEOMOp::OpRemoveExtraEdges: aDlg = new RepairGUI_RemoveExtraEdgesDlg (getGeometryGUI(), parent); break;
default:
- app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
+ app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
break;
}
- if ( aDlg )
+ if (aDlg)
aDlg->show();
return true;
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
// GEOM RepairGUI : GUI for Geometry component
// File : RepairGUI_GlueDlg.cxx
-// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
-//
+// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
+
#include "RepairGUI_GlueDlg.h"
#include <DlgRef.h>
#include <SalomeApp_DoubleSpinBox.h>
#include <SalomeApp_Application.h>
-#include <LightApp_SelectionMgr.h>
#include <SalomeApp_Study.h>
#include <SalomeApp_Tools.h>
+#include <LightApp_SelectionMgr.h>
#include <SUIT_Session.h>
#include <SUIT_Desktop.h>
#include <SUIT_MessageBox.h>
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
-RepairGUI_GlueDlg::RepairGUI_GlueDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
- bool modal )
- : GEOMBase_Skeleton( theGeometryGUI, parent, modal ),
- myCurrConstrId( -1 )
+RepairGUI_GlueDlg::RepairGUI_GlueDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
+ bool modal, TopAbs_ShapeEnum theGlueMode)
+ : GEOMBase_Skeleton(theGeometryGUI, parent, modal),
+ myCurrConstrId(-1), myGlueMode(theGlueMode)
{
- QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_GLUE_FACES" ) ) );
- QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_GLUE_FACES2" ) ));
- QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
-
- setWindowTitle( tr( "GEOM_GLUE_TITLE" ) );
+ QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
+ QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_GLUE_FACES")));
+ QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_GLUE_FACES2")));
+ QPixmap image3 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_GLUE_EDGES")));
+ QPixmap image4 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_GLUE_EDGES2")));
+
+ QString aTitle;
+ if (theGlueMode == TopAbs_FACE)
+ aTitle = tr("GEOM_GLUE_FACES_TITLE");
+ else if (theGlueMode == TopAbs_EDGE)
+ aTitle = tr("GEOM_GLUE_EDGES_TITLE");
+ setWindowTitle(aTitle);
/***************************************************************/
- mainFrame()->GroupConstructors->setTitle( tr( "GEOM_GLUE_TITLE" ) );
- mainFrame()->RadioButton1->setIcon( image0 );
- mainFrame()->RadioButton2->setIcon( image2 );
- mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
+ mainFrame()->GroupConstructors->setTitle(aTitle);
+ if (theGlueMode == TopAbs_FACE) {
+ mainFrame()->RadioButton1->setIcon(image1);
+ mainFrame()->RadioButton2->setIcon(image2);
+ }
+ else if (theGlueMode == TopAbs_EDGE) {
+ mainFrame()->RadioButton1->setIcon(image3);
+ mainFrame()->RadioButton2->setIcon(image4);
+ }
+ mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton3->close();
- GroupPoints = new DlgRef_1SelExt( centralWidget() );
- GroupPoints->GroupBox1->setTitle( tr( "GEOM_GLUE" ) );
- GroupPoints->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
- GroupPoints->PushButton1->setIcon( image1 );
- GroupPoints->LineEdit1->setReadOnly( true );
-
- QLabel* aTolLab = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->Box );
- myTolEdt = new SalomeApp_DoubleSpinBox( GroupPoints->Box );
- initSpinBox( myTolEdt, 0., 100., DEFAULT_TOLERANCE_VALUE, "len_tol_precision" );
- myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE );
-
- QGridLayout* boxLayout = new QGridLayout( GroupPoints->Box );
- boxLayout->setMargin( 0 ); boxLayout->setSpacing( 6 );
- boxLayout->addWidget( aTolLab, 0, 0 );
- boxLayout->addWidget( myTolEdt, 0, 2 );
+ GroupPoints = new DlgRef_1SelExt(centralWidget());
+ GroupPoints->GroupBox1->setTitle(tr("GEOM_GLUE"));
+ GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
+ GroupPoints->PushButton1->setIcon(image0);
+ GroupPoints->LineEdit1->setReadOnly(true);
+
+ QLabel* aTolLab = new QLabel(tr("GEOM_TOLERANCE"), GroupPoints->Box);
+ myTolEdt = new SalomeApp_DoubleSpinBox(GroupPoints->Box);
+ initSpinBox(myTolEdt, 0., 100., DEFAULT_TOLERANCE_VALUE, "len_tol_precision");
+ myTolEdt->setValue(DEFAULT_TOLERANCE_VALUE);
+
+ QGridLayout* boxLayout = new QGridLayout(GroupPoints->Box);
+ boxLayout->setMargin(0); boxLayout->setSpacing(6);
+ boxLayout->addWidget(aTolLab, 0, 0);
+ boxLayout->addWidget(myTolEdt, 0, 2);
/***************************************************************/
- GroupPoints2 = new DlgRef_1SelExt( centralWidget() );
- GroupPoints2->GroupBox1->setTitle( tr( "GEOM_GLUE" ) );
- GroupPoints2->TextLabel1->setText( tr( "GEOM_SELECTED_SHAPE" ) );
- GroupPoints2->PushButton1->setIcon( image1 );
- GroupPoints2->LineEdit1->setReadOnly( true );
-
- QLabel* aTolLab2 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints2->Box );
- myTolEdt2 = new SalomeApp_DoubleSpinBox( GroupPoints2->Box );
- initSpinBox( myTolEdt2, 0., 100., DEFAULT_TOLERANCE_VALUE, "len_tol_precision" );
- myTolEdt2->setValue( DEFAULT_TOLERANCE_VALUE );
-
- myDetectBtn = new QPushButton( tr( "GEOM_DETECT" ) + QString( " [%1]" ).arg( tr( "GLUE_FACES" ) ),
- GroupPoints2->Box );
- mySubShapesChk = new QCheckBox( tr( "SELECT_FACES" ), GroupPoints2->Box );
-
- boxLayout = new QGridLayout( GroupPoints2->Box );
- boxLayout->setMargin( 0 ); boxLayout->setSpacing( 6 );
- boxLayout->addWidget( aTolLab2, 0, 0 );
- boxLayout->addWidget( myTolEdt2, 0, 2 );
- boxLayout->addWidget( myDetectBtn, 1, 0, 1, 3 );
- boxLayout->addWidget( mySubShapesChk, 2, 0, 1, 3 );
-
- QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
- layout->setMargin( 0 ); layout->setSpacing( 6 );
- layout->addWidget( GroupPoints );
- layout->addWidget( GroupPoints2 );
+ GroupPoints2 = new DlgRef_1SelExt(centralWidget());
+ GroupPoints2->GroupBox1->setTitle(tr("GEOM_GLUE"));
+ GroupPoints2->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
+ GroupPoints2->PushButton1->setIcon(image0);
+ GroupPoints2->LineEdit1->setReadOnly(true);
+
+ QLabel* aTolLab2 = new QLabel(tr("GEOM_TOLERANCE"), GroupPoints2->Box);
+ myTolEdt2 = new SalomeApp_DoubleSpinBox(GroupPoints2->Box);
+ initSpinBox(myTolEdt2, 0., 100., DEFAULT_TOLERANCE_VALUE, "len_tol_precision");
+ myTolEdt2->setValue(DEFAULT_TOLERANCE_VALUE);
+
+ QString aGlueString (" [%1]");
+ QString aSelString;
+ if (theGlueMode == TopAbs_FACE) {
+ aGlueString = aGlueString.arg(tr("GLUE_FACES"));
+ aSelString = tr("SELECT_FACES");
+ }
+ else if (theGlueMode == TopAbs_EDGE) {
+ aGlueString = aGlueString.arg(tr("GLUE_EDGES"));
+ aSelString = tr("SELECT_EDGES");
+ }
+ myDetectBtn = new QPushButton (tr("GEOM_DETECT") + aGlueString, GroupPoints2->Box);
+ mySubShapesChk = new QCheckBox (aSelString, GroupPoints2->Box);
+
+ boxLayout = new QGridLayout(GroupPoints2->Box);
+ boxLayout->setMargin(0); boxLayout->setSpacing(6);
+ boxLayout->addWidget(aTolLab2, 0, 0);
+ boxLayout->addWidget(myTolEdt2, 0, 2);
+ boxLayout->addWidget(myDetectBtn, 1, 0, 1, 3);
+ boxLayout->addWidget(mySubShapesChk, 2, 0, 1, 3);
+
+ QVBoxLayout* layout = new QVBoxLayout(centralWidget());
+ layout->setMargin(0); layout->setSpacing(6);
+ layout->addWidget(GroupPoints);
+ layout->addWidget(GroupPoints2);
/***************************************************************/
- setHelpFileName( "glue_faces_operation_page.html" );
-
+ setHelpFileName("glue_faces_operation_page.html");
+
// Disable second way of gluing if OCC viewer is not active one
- if ( myGeomGUI->getApp()->desktop()->activeWindow()->getViewManager()->getType()
- != OCCViewer_Viewer::Type() )
- mainFrame()->RadioButton2->setEnabled( false );
+ if (myGeomGUI->getApp()->desktop()->activeWindow()->getViewManager()->getType()
+ != OCCViewer_Viewer::Type())
+ mainFrame()->RadioButton2->setEnabled(false);
Init();
}
-
//=================================================================================
// function : ~RepairGUI_GlueDlg()
// purpose : Destroys the object and frees any allocated resources
{
}
-
//=================================================================================
// function : Init()
// purpose :
myObject = GEOM::GEOM_Object::_nil();
- //myGeomGUI->SetState( 0 );
- //globalSelection( GEOM_COMPOUND );
+ //myGeomGUI->SetState(0);
+ //globalSelection(GEOM_COMPOUND);
mainFrame()->GroupBoxPublish->show();
//Hide preview checkbox
mainFrame()->CheckBoxPreview->hide();
/* signals and slots connections */
- connect( buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
- connect( buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
- connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
+ connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
- connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
- connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
+ connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
- connect( GroupPoints2->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
- connect( GroupPoints2->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
- connect( myTolEdt2, SIGNAL( valueChanged( double ) ), this, SLOT( onTolerChanged( double ) ) );
- connect( mySubShapesChk, SIGNAL( stateChanged( int ) ), this, SLOT( onSubShapesChk() ) );
+ connect(GroupPoints2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupPoints2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(myTolEdt2, SIGNAL(valueChanged(double)), this, SLOT(onTolerChanged(double)));
+ connect(mySubShapesChk, SIGNAL(stateChanged(int)), this, SLOT(onSubShapesChk()));
- connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
- this, SLOT( SelectionIntoArgument() ) );
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
- connect( myDetectBtn, SIGNAL( clicked() ), this, SLOT( onDetect() ) );
+ connect(myDetectBtn, SIGNAL(clicked()), this, SLOT(onDetect()));
- initName( tr( "GLUE_NEW_OBJ_NAME" ) );
+ initName(tr("GLUE_NEW_OBJ_NAME"));
+
+ ConstructorsClicked(0);
- ConstructorsClicked( 0 );
-
activateSelection();
updateButtonState();
}
-
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
-void RepairGUI_GlueDlg::ConstructorsClicked( int constructorId )
+void RepairGUI_GlueDlg::ConstructorsClicked(int constructorId)
{
- if ( myCurrConstrId == constructorId )
+ if (myCurrConstrId == constructorId)
return;
-
- disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
-
- switch ( constructorId ) {
+
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+
+ switch (constructorId) {
case 0:
GroupPoints2->hide();
GroupPoints->show();
- GroupPoints->LineEdit1->setText( "" );
+ GroupPoints->LineEdit1->setText("");
myEditCurrentArgument = GroupPoints->LineEdit1;
-
- if ( myCurrConstrId >= 0 ) {
+
+ if (myCurrConstrId >= 0) {
// i.e. it is not initialisation
// copy tolerance from previous tolerance field
- myTolEdt->setValue( myTolEdt2->value() );
+ myTolEdt->setValue(myTolEdt2->value());
}
break;
case 1:
GroupPoints->hide();
GroupPoints2->show();
- GroupPoints->LineEdit1->setText( "" );
+ GroupPoints->LineEdit1->setText("");
myEditCurrentArgument = GroupPoints2->LineEdit1;
-
- if ( myCurrConstrId >= 0 ) {
+
+ if (myCurrConstrId >= 0) {
// i.e. it is not initialisation
// copy tolerance from previous tolerance field
- myTolEdt2->setValue( myTolEdt->value() );
- mySubShapesChk->setChecked( false );
+ myTolEdt2->setValue(myTolEdt->value());
+ mySubShapesChk->setChecked(false);
clearTemporary();
}
break;
}
-
+
myCurrConstrId = constructorId;
myEditCurrentArgument->setFocus();
- connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
- this, SLOT( SelectionIntoArgument() ) );
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
qApp->processEvents();
updateGeometry();
- resize( minimumSizeHint() );
+ resize(minimumSizeHint());
processPreview();
updateButtonState();
SelectionIntoArgument();
}
-
//=================================================================================
// function : ClickOnOk()
// purpose : Same than click on apply but close this dialog.
//=================================================================================
void RepairGUI_GlueDlg::ClickOnOk()
{
- setIsApplyAndClose( true );
- if ( ClickOnApply() )
+ setIsApplyAndClose(true);
+ if (ClickOnApply())
ClickOnCancel();
}
-
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
bool RepairGUI_GlueDlg::ClickOnApply()
{
- if ( !onAcceptLocal() )
+ if (!onAcceptLocal())
return false;
initName();
//GroupPoints->LineEdit1->setText("");
//myObject = GEOM::GEOM_Object::_nil();
- //globalSelection( GEOM_COMPOUND );
+ //globalSelection(GEOM_COMPOUND);
- ConstructorsClicked( getConstructorId() );
+ ConstructorsClicked(getConstructorId());
return true;
}
//=================================================================================
void RepairGUI_GlueDlg::SelectionIntoArgument()
{
- if ( mySubShapesChk->isChecked() && getConstructorId() == 1 ) {
+ if (mySubShapesChk->isChecked() && getConstructorId() == 1) {
updateButtonState();
return;
}
-
+
erasePreview();
- myEditCurrentArgument->setText( "" );
+ myEditCurrentArgument->setText("");
myObject = GEOM::GEOM_Object::_nil();
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList);
- if ( aSelList.Extent() == 1 ) {
+ if (aSelList.Extent() == 1) {
Handle(SALOME_InteractiveObject) anIO = aSelList.First();
- myObject = GEOMBase::ConvertIOinGEOMObject( anIO );
- if ( !CORBA::is_nil( myObject ) )
- myEditCurrentArgument->setText( GEOMBase::GetName( myObject ) );
+ myObject = GEOMBase::ConvertIOinGEOMObject(anIO);
+ if (!CORBA::is_nil(myObject))
+ myEditCurrentArgument->setText(GEOMBase::GetName(myObject));
}
updateButtonState();
}
void RepairGUI_GlueDlg::SetEditCurrentArgument()
{
const QObject* send = sender();
- if ( send == GroupPoints->PushButton1 || send == GroupPoints2->PushButton1 ) {
+ if (send == GroupPoints->PushButton1 || send == GroupPoints2->PushButton1) {
myEditCurrentArgument->setFocus();
SelectionIntoArgument();
}
}
-
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
void RepairGUI_GlueDlg::LineEditReturnPressed()
{
const QObject* send = sender();
- if ( send == GroupPoints->LineEdit1 ) {
+ if (send == GroupPoints->LineEdit1) {
myEditCurrentArgument = GroupPoints->LineEdit1;
GEOMBase_Skeleton::LineEditReturnPressed();
}
- else if ( send == GroupPoints2->LineEdit1 ) {
+ else if (send == GroupPoints2->LineEdit1) {
myEditCurrentArgument = GroupPoints2->LineEdit1;
GEOMBase_Skeleton::LineEditReturnPressed();
}
}
-
//=================================================================================
// function : ActivateThisDialog()
// purpose :
void RepairGUI_GlueDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
- this, SLOT( SelectionIntoArgument() ) );
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
//GroupPoints->LineEdit1->setText("");
//GroupPoints2->LineEdit1->setText("");
//myObject = GEOM::GEOM_Object::_nil();
- //myGeomGUI->SetState( 0 );
- //globalSelection( GEOM_COMPOUND );
+ //myGeomGUI->SetState(0);
+ //globalSelection(GEOM_COMPOUND);
activateSelection();
}
-
//=================================================================================
// function : enterEvent()
// purpose : Mouse enter onto the dialog to activate it
//=================================================================================
-void RepairGUI_GlueDlg::enterEvent( QEvent* )
+void RepairGUI_GlueDlg::enterEvent(QEvent*)
{
- if ( !mainFrame()->GroupConstructors->isEnabled() )
+ if (!mainFrame()->GroupConstructors->isEnabled())
ActivateThisDialog();
}
-
//=================================================================================
// function : createOperation
// purpose :
//=================================================================================
GEOM::GEOM_IOperations_ptr RepairGUI_GlueDlg::createOperation()
{
- return getGeomEngine()->GetIShapesOperations( getStudyId() );
+ return getGeomEngine()->GetIShapesOperations(getStudyId());
}
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
-bool RepairGUI_GlueDlg::isValid( QString& msg )
+bool RepairGUI_GlueDlg::isValid(QString& msg)
{
bool ok = true;
double v = 0;
- switch ( getConstructorId() )
+ switch (getConstructorId())
{
case 0:
v = myTolEdt->value();
- ok = myTolEdt->isValid( msg, !IsPreview() );
+ ok = myTolEdt->isValid(msg, !IsPreview());
break;
case 1:
- v = myTolEdt2->value();
- ok = myTolEdt2->isValid( msg, !IsPreview() );
+ v = myTolEdt2->value();
+ ok = myTolEdt2->isValid(msg, !IsPreview());
break;
}
- return !myObject->_is_nil() && ( IsPreview() || v > 0. ) && ok;
+ return !myObject->_is_nil() && (IsPreview() || v > 0.) && ok;
}
//=================================================================================
// function : execute
// purpose :
//=================================================================================
-bool RepairGUI_GlueDlg::execute( ObjectList& objects )
+bool RepairGUI_GlueDlg::execute(ObjectList& objects)
{
bool aResult = false;
objects.clear();
- GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
- switch ( getConstructorId() ) {
+ GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());
+ switch (getConstructorId()) {
case 0:
{
- GEOM::GEOM_Object_var anObj = anOper->MakeGlueFaces( myObject, myTolEdt->value(), true );
+ GEOM::GEOM_Object_var anObj;
+ if (myGlueMode == TopAbs_FACE)
+ anObj = anOper->MakeGlueFaces(myObject, myTolEdt->value(), true);
+ else if (myGlueMode == TopAbs_EDGE)
+ anObj = anOper->MakeGlueEdges(myObject, myTolEdt->value());
+
aResult = !anObj->_is_nil();
- if ( aResult && !IsPreview() )
+ if (aResult && !IsPreview())
{
QStringList aParameters;
aParameters << myTolEdt->text();
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
- objects.push_back( anObj._retn() );
+ objects.push_back(anObj._retn());
}
break;
}
case 1:
{
- if ( IsPreview() ) {
- // if this method is used for displaying preview then we must detect glue faces only
- ObjectList::iterator anIter;
- for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter )
- objects.push_back( GEOM::GEOM_Object::_duplicate( *anIter ) );
- return myTmpObjs.size() ? true : false;
+ if (IsPreview()) {
+ // if this method is used for displaying preview then we must detect glue faces/edges only
+ for (int i = 0; i < myTmpObjs.count(); i++) {
+ myTmpObjs[i].get()->Register(); // increment counter, since calling function will call UnRegister()
+ objects.push_back(myTmpObjs[i].copy());
+ }
+ return !myTmpObjs.isEmpty();
} // IsPreview
- // Make glue face by list.
+ // Make glue faces/edges by list.
// Iterate through myTmpObjs and verifies where each object is currently selected or not.
- QMap<QString, char> selected;
+ QSet<QString> selected;
// Get names of selected objects
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
aSelMgr->selectedObjects(aSelList);
SALOME_ListIteratorOfListIO it (aSelList);
- for (; it.More(); it.Next())
- selected.insert(it.Value()->getName(), 0);
+ for (; it.More(); it.Next())
+ selected.insert(it.Value()->getName());
// Iterate through result and select objects with names from selection
// ObjectList toRemoveFromEnggine;
- ObjectList toGlue;
- ObjectList::iterator anIter;
- for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter ) {
- if ( selected.contains( myGeomGUI->getApp()->orb()->object_to_string(*anIter) ) )
- toGlue.push_back( *anIter );
- }
-
- // make glue faces
+
+ // make glue faces/edges
GEOM::ListOfGO_var aListForGlue = new GEOM::ListOfGO();
- aListForGlue->length( toGlue.size() );
- ObjectList::iterator anIter3 = toGlue.begin();
- for ( int i = 0; anIter3 != toGlue.end(); ++anIter3, ++i )
- aListForGlue[ i ] = *anIter3;
- GEOM::GEOM_Object_var anObj = anOper->MakeGlueFacesByList( myObject, myTolEdt2->value(), aListForGlue, true );
+ aListForGlue->length(myTmpObjs.count());
+ int added = 0;
+ for (int i = 0; i < myTmpObjs.count(); i++) {
+ CORBA::String_var tmpior = myGeomGUI->getApp()->orb()->object_to_string(myTmpObjs[i].get());
+ if (selected.contains(tmpior.in()))
+ aListForGlue[ added++ ] = myTmpObjs[i].copy();
+ }
+ aListForGlue->length(added);
+
+ GEOM::GEOM_Object_var anObj;
+ if (myGlueMode == TopAbs_FACE)
+ anObj = anOper->MakeGlueFacesByList(myObject, myTolEdt2->value(), aListForGlue.in(), true);
+ else if (myGlueMode == TopAbs_EDGE)
+ anObj = anOper->MakeGlueEdgesByList(myObject, myTolEdt2->value(), aListForGlue.in());
aResult = !anObj->_is_nil();
- if ( aResult )
+ if (aResult)
{
- if ( !IsPreview() )
+ if (!IsPreview())
{
QStringList aParameters;
aParameters << myTolEdt2->text();
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
}
- objects.push_back( anObj._retn() );
+ objects.push_back(anObj._retn());
}
// Remove from engine useless objects
// function : restoreSubShapes
// purpose :
//=================================================================================
-void RepairGUI_GlueDlg::restoreSubShapes( SALOMEDS::Study_ptr theStudy,
- SALOMEDS::SObject_ptr theSObject )
+void RepairGUI_GlueDlg::restoreSubShapes(SALOMEDS::Study_ptr theStudy,
+ SALOMEDS::SObject_ptr theSObject)
{
- if ( mainFrame()->CheckBoxRestoreSS->isChecked() ) {
+ if (mainFrame()->CheckBoxRestoreSS->isChecked()) {
GEOM::find_shape_method aFindMethod = GEOM::FSM_GetInPlace;
- if ( getConstructorId() == 0 ) // MakeGlueFaces
+ if (getConstructorId() == 0) // MakeGlueFaces or MakeGlueEdges
aFindMethod = GEOM::FSM_GetInPlaceByHistory;
// empty list of arguments means that all arguments should be restored
- getGeomEngine()->RestoreSubShapesSO( theStudy, theSObject, GEOM::ListOfGO(),
+ getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(),
aFindMethod, /*theInheritFirstArg=*/true,
- mainFrame()->CheckBoxAddPrefix->isChecked() );
+ mainFrame()->CheckBoxAddPrefix->isChecked());
}
}
//================================================================
// Function : clearShapeBufferLocal
-// Purpose :
+// Purpose :
//================================================================
-void RepairGUI_GlueDlg::clearShapeBufferLocal( GEOM::GEOM_Object_ptr theObj )
+void RepairGUI_GlueDlg::clearShapeBufferLocal(GEOM::GEOM_Object_ptr theObj)
{
- if ( CORBA::is_nil( theObj ) )
+ if (CORBA::is_nil(theObj))
return;
- CORBA::String_var IOR = myGeomGUI->getApp()->orb()->object_to_string( theObj );
- TCollection_AsciiString asciiIOR( (char *)( IOR.in() ) );
- myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( asciiIOR );
+ CORBA::String_var IOR = myGeomGUI->getApp()->orb()->object_to_string(theObj);
+ TCollection_AsciiString asciiIOR((char *)(IOR.in()));
+ myGeomGUI->GetShapeReader().RemoveShapeFromBuffer(asciiIOR);
- if ( !getStudy() || !( getStudy()->studyDS() ) )
+ if (!getStudy() || !(getStudy()->studyDS()))
return;
_PTR(Study) aStudy = getStudy()->studyDS();
- _PTR(SObject) aSObj ( aStudy->FindObjectIOR( std::string( IOR.in() ) ) );
- if ( !aSObj )
+ _PTR(SObject) aSObj (aStudy->FindObjectIOR(std::string(IOR.in())));
+ if (!aSObj)
return;
- _PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) );
- for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) {
+ _PTR(ChildIterator) anIt (aStudy->NewChildIterator(aSObj));
+ for (anIt->InitEx(true); anIt->More(); anIt->Next()) {
_PTR(GenericAttribute) anAttr;
- if ( anIt->Value()->FindAttribute(anAttr, "AttributeIOR") ) {
- _PTR(AttributeIOR) anIOR ( anAttr );
- TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() );
- myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( asciiIOR );
+ if (anIt->Value()->FindAttribute(anAttr, "AttributeIOR")) {
+ _PTR(AttributeIOR) anIOR (anAttr);
+ TCollection_AsciiString asciiIOR((char*)anIOR->Value().c_str());
+ myGeomGUI->GetShapeReader().RemoveShapeFromBuffer(asciiIOR);
}
}
}
//================================================================
// Function : onAccept
// Purpose : This method should be called from dialog's slots onOk() and onApply()
-// It perfroms user input validation, then it
+// It perfroms user input validation, then it
// performs a proper operation and manages transactions, etc.
//================================================================
bool RepairGUI_GlueDlg::onAcceptLocal()
{
- if ( !getStudy() || !( getStudy()->studyDS() ) )
+ if (!getStudy() || !(getStudy()->studyDS()))
return false;
_PTR(Study) aStudy = getStudy()->studyDS();
bool aLocked = aStudy->GetProperties()->IsLocked();
- if ( aLocked ) {
+ if (aLocked) {
MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked");
- SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), tr( "WRN_STUDY_LOCKED" ), tr( "BUT_OK" ) );
+ SUIT_MessageBox::warning(this, tr("WRN_WARNING"), tr("WRN_STUDY_LOCKED"), tr("BUT_OK"));
return false;
}
QString msg;
- if ( !isValid( msg ) ) {
- showError( msg );
+ if (!isValid(msg)) {
+ showError(msg);
return false;
}
- erasePreview( false );
+ erasePreview(false);
try {
- if ( openCommand() ) {
+ if (openCommand()) {
SUIT_OverrideCursor wc;
-
- myGeomGUI->getApp()->putInfo( "" );
+
+ myGeomGUI->getApp()->putInfo("");
ObjectList objects;
-
- if ( !execute( objects ) ) {
+
+ if (!execute(objects)) {
wc.suspend();
abortCommand();
showError();
}
else {
const int nbObjs = objects.size();
- for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) {
+ for (ObjectList::iterator it = objects.begin(); it != objects.end(); ++it) {
QString aName = getNewObjectName();
- if ( nbObjs > 1 ) {
- if ( aName.isEmpty() )
- aName = getPrefix( *it );
- aName = GEOMBase::GetDefaultName( aName );
+ if (nbObjs > 1) {
+ if (aName.isEmpty())
+ aName = getPrefix(*it);
+ aName = GEOMBase::GetDefaultName(aName);
}
else {
// PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName()
- if ( aName.isEmpty() )
- aName = GEOMBase::GetDefaultName( getPrefix( *it ) );
+ if (aName.isEmpty())
+ aName = GEOMBase::GetDefaultName(getPrefix(*it));
}
- addInStudy( *it, aName.toLatin1().data() );
- display( *it, false );
+ addInStudy(*it, aName.toLatin1().data());
+ display(*it, false);
}
-
- if ( nbObjs ) {
+
+ if (nbObjs) {
commitCommand();
updateObjBrowser();
- myGeomGUI->getApp()->putInfo( QObject::tr("GEOM_PRP_DONE") );
+ myGeomGUI->getApp()->putInfo(QObject::tr("GEOM_PRP_DONE"));
}
else {
abortCommand();
}
// JFA 28.12.2004 BEGIN // To enable warnings
- GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
- if ( !CORBA::is_nil(anOper) && !anOper->IsDone() ) {
+ GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());
+ if (!CORBA::is_nil(anOper) && !anOper->IsDone()) {
wc.suspend();
- QString msgw = QObject::tr( anOper->GetErrorCode() );
- SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), msgw, tr( "BUT_OK" ) );
+ QString msgw = QObject::tr(anOper->GetErrorCode());
+ SUIT_MessageBox::warning(this, tr("WRN_WARNING"), msgw, tr("BUT_OK"));
}
// JFA 28.12.2004 END
}
}
}
- catch( const SALOME::SALOME_Exception& e ) {
- SalomeApp_Tools::QtCatchCorbaException( e );
+ catch(const SALOME::SALOME_Exception& e) {
+ SalomeApp_Tools::QtCatchCorbaException(e);
abortCommand();
}
return true;
}
-
//=================================================================================
// function : onDetect
// purpose :
{
clearTemporary();
QString msg;
- if ( !isValid( msg ) ) {
- showError( msg );
+ if (!isValid(msg)) {
+ showError(msg);
return;
}
- buttonOk()->setEnabled( false );
- buttonApply()->setEnabled( false );
- globalSelection( GEOM_ALLSHAPES );
-
- GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
- GEOM::ListOfGO_var aList = anOper->GetGlueFaces( myObject, myTolEdt2->value() );
-
- for ( int i = 0, n = aList->length(); i < n; i++ )
- myTmpObjs.push_back(GEOM::GEOM_Object::_duplicate(aList[i]));
-
- if ( myTmpObjs.size() > 0 ) {
- msg = tr( "FACES_FOR_GLUING_ARE_DETECTED" ).arg( myTmpObjs.size() );
- mySubShapesChk->setChecked( true );
+ buttonOk()->setEnabled(false);
+ buttonApply()->setEnabled(false);
+ globalSelection(GEOM_ALLSHAPES);
+
+ GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());
+ GEOM::ListOfGO_var aList;
+ if (myGlueMode == TopAbs_FACE)
+ aList = anOper->GetGlueFaces(myObject.in(), myTolEdt2->value());
+ else if (myGlueMode == TopAbs_EDGE)
+ aList = anOper->GetGlueEdges(myObject.in(), myTolEdt2->value());
+
+ for (int i = 0, n = aList->length(); i < n; i++)
+ myTmpObjs << GEOM::GeomObjPtr(aList[i].in());
+
+ if (!myTmpObjs.isEmpty()) {
+ if (myGlueMode == TopAbs_FACE)
+ msg = tr("FACES_FOR_GLUING_ARE_DETECTED").arg(myTmpObjs.count());
+ else if (myGlueMode == TopAbs_EDGE)
+ msg = tr("EDGES_FOR_GLUING_ARE_DETECTED").arg(myTmpObjs.count());
+ mySubShapesChk->setChecked(true);
}
else {
- msg = tr( "THERE_ARE_NO_FACES_FOR_GLUING" );
+ if (myGlueMode == TopAbs_FACE)
+ msg = tr("THERE_ARE_NO_FACES_FOR_GLUING");
+ else if (myGlueMode == TopAbs_EDGE)
+ msg = tr("THERE_ARE_NO_EDGES_FOR_GLUING");
}
-
- connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
- this, SLOT( SelectionIntoArgument() ) ) ;
- SUIT_MessageBox::information( this, tr( "GEOM_FREE_BOUNDS_TLT" ), msg, tr( "Close" ) );
+
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument())) ;
+ SUIT_MessageBox::information(this, tr("GEOM_FREE_BOUNDS_TLT"), msg, tr("Close"));
updateButtonState();
activateSelection();
}
//=================================================================================
void RepairGUI_GlueDlg::activateSelection()
{
- erasePreview( false );
-
+ erasePreview(false);
+
int anId = getConstructorId();
- if ( anId == 0 ) {
+ if (anId == 0) {
// Case of whole gluing
- disconnect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
- this, SLOT( SelectionIntoArgument() ) );
-
- globalSelection( GEOM_ALLSHAPES );
- if ( myObject->_is_nil())
+ disconnect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ globalSelection(GEOM_ALLSHAPES);
+ if (myObject->_is_nil())
SelectionIntoArgument();
- connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
- this, SLOT( SelectionIntoArgument() ) );
- }
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+ }
else {
// Second case of gluing
- if ( !mySubShapesChk->isChecked() )
- globalSelection( GEOM_ALLSHAPES );
+ if (!mySubShapesChk->isChecked())
+ globalSelection(GEOM_ALLSHAPES);
else {
- displayPreview( true, false, false, 2/*line width*/, 1/*display mode*/, Quantity_NOC_RED );
- disconnect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
- this, SLOT( SelectionIntoArgument() ) ) ;
- globalSelection( GEOM_PREVIEW );
- connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
- this, SLOT( SelectionIntoArgument() ) ) ;
- }
+ displayPreview(true, true, false, false, 2/*line width*/, 1/*display mode*/, Quantity_NOC_RED);
+ disconnect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument())) ;
+ globalSelection(GEOM_PREVIEW);
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument())) ;
+ }
}
updateViewer();
}
//=================================================================================
// function : updateButtonState
-// purpose : Update button state
+// purpose : Update button state
//=================================================================================
void RepairGUI_GlueDlg::updateButtonState()
{
int anId = getConstructorId();
bool hasMainObj = !myObject->_is_nil();
- if ( anId == 0 ) {
- buttonOk()->setEnabled( hasMainObj );
- buttonApply()->setEnabled( hasMainObj );
+ if (anId == 0) {
+ buttonOk()->setEnabled(hasMainObj);
+ buttonApply()->setEnabled(hasMainObj);
}
else
{
SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList);
- bool wasSelected = false;
SALOME_ListIteratorOfListIO it (aSelList);
- if (it.More() > 0)
- wasSelected = true;
- bool wasDetected = myTmpObjs.size() ? true : false;
- buttonOk()->setEnabled( hasMainObj && wasDetected && wasSelected );
- buttonApply()->setEnabled( hasMainObj && wasDetected && wasSelected );
- mySubShapesChk->setEnabled( hasMainObj && wasDetected );
- myDetectBtn->setEnabled( hasMainObj );
- if ( !hasMainObj || !wasDetected )
- mySubShapesChk->setChecked( false );
+ bool wasSelected = it.More() > 0;
+ bool wasDetected = !myTmpObjs.isEmpty();
+ buttonOk()->setEnabled(hasMainObj && wasDetected && wasSelected);
+ buttonApply()->setEnabled(hasMainObj && wasDetected && wasSelected);
+ mySubShapesChk->setEnabled(hasMainObj && wasDetected);
+ myDetectBtn->setEnabled(hasMainObj);
+ if (!hasMainObj || !wasDetected)
+ mySubShapesChk->setChecked(false);
}
}
//=================================================================================
void RepairGUI_GlueDlg::clearTemporary()
{
- ObjectList::iterator anIter;
- for ( anIter = myTmpObjs.begin(); anIter != myTmpObjs.end(); ++anIter )
- getGeomEngine()->RemoveObject(*anIter);
-
myTmpObjs.clear();
}
// function : onTolerChanged
// purpose : Remove temporary objects from engine
//=================================================================================
-void RepairGUI_GlueDlg::onTolerChanged( double /*theVal*/ )
+void RepairGUI_GlueDlg::onTolerChanged(double /*theVal*/)
{
clearTemporary();
activateSelection();
//=================================================================================
void RepairGUI_GlueDlg::onSubShapesChk()
{
- if ( !mySubShapesChk->isChecked() )
+ if (!mySubShapesChk->isChecked())
clearTemporary();
activateSelection();
updateButtonState();
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// GEOM GEOMGUI : GUI for Geometry component
-// File : RepairGUI_GlueDlg.h
-// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
-//
+// GEOM GEOMGUI : GUI for Geometry component
+// File : RepairGUI_GlueDlg.h
+// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
+
#ifndef REPAIRGUI_GLUEDLG_H
#define REPAIRGUI_GLUEDLG_H
#include <GEOMBase_Skeleton.h>
+#include <TopAbs.hxx>
+
+#include <QList>
+
class DlgRef_1SelExt;
class SalomeApp_DoubleSpinBox;
class QPushButton;
Q_OBJECT
public:
- RepairGUI_GlueDlg( GeometryGUI*, QWidget* = 0, bool = false );
+ RepairGUI_GlueDlg (GeometryGUI*, QWidget* = 0, bool = false, TopAbs_ShapeEnum theGlueMode = TopAbs_FACE);
~RepairGUI_GlueDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
- virtual bool isValid( QString& );
- virtual bool execute( ObjectList& );
- virtual void restoreSubShapes( SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr );
+ virtual bool isValid (QString&);
+ virtual bool execute (ObjectList&);
+ virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
private:
void Init();
- void enterEvent( QEvent* );
+ void enterEvent (QEvent*);
void initSelection();
-
+
void clearTemporary();
-
- bool onAcceptLocal();
- void clearShapeBufferLocal( GEOM::GEOM_Object_ptr );
+
// Reimplementation of onAccept for local case of this class.
-
+ bool onAcceptLocal();
+ void clearShapeBufferLocal (GEOM::GEOM_Object_ptr);
+
void activateSelection();
void updateButtonState();
void selectTmpInViewer();
-
-private:
+
+private:
GEOM::GEOM_Object_var myObject;
- ObjectList myTmpObjs;
-
+ QList<GEOM::GeomObjPtr> myTmpObjs;
+
DlgRef_1SelExt* GroupPoints;
DlgRef_1SelExt* GroupPoints2;
SalomeApp_DoubleSpinBox* myTolEdt;
SalomeApp_DoubleSpinBox* myTolEdt2;
QPushButton* myDetectBtn;
QCheckBox* mySubShapesChk;
-
+
int myCurrConstrId;
-
+
+ TopAbs_ShapeEnum myGlueMode;
+
protected slots:
virtual void ClickOnCancel();
-
+
private slots:
void ClickOnOk();
bool ClickOnApply();
void SelectionIntoArgument();
void SetEditCurrentArgument();
- void ConstructorsClicked( int );
- //void ValueChangedInSpinBox();
-
+ void ConstructorsClicked (int);
+
void onDetect();
- void onTolerChanged( double );
+ void onTolerChanged (double);
void onSubShapesChk();
};