From: skl Date: Wed, 11 Apr 2007 11:19:19 +0000 (+0000) Subject: Implementation of gluing faces by given list (for PAL13191). X-Git-Tag: V3_2_6pre4~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b78e38e83e4ff98450d750651474d8b3f806aaa4;p=modules%2Fgeom.git Implementation of gluing faces by given list (for PAL13191). --- diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 6eba34398..05c9fe46f 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -989,6 +989,25 @@ module GEOM */ GEOM_Object MakeGlueFaces (in GEOM_Object theShape, in double theTolerance); + /*! + * Find coincident faces in theShape for possible gluing. + * \param theShape Initial shape. + * \param theTolerance Maximum distance between faces, which can be considered as coincident. + * \return ListOfGO + */ + ListOfGO GetGlueFaces (in GEOM_Object theShape, in double theTolerance); + + /*! + * Replace coincident faces in theShape by one face + * in compliance with given list of faces + * \param theShape Initial shape. + * \param theTolerance Maximum distance between faces, which can be considered as coincident. + * \param theFaces List of faces for gluing. + * \return New GEOM_Object, containing a copy of theShape without some faces. + */ + GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape, in double theTolerance, + in ListOfGO theFaces); + /*! * Explode a shape on subshapes of a given type. * \param theShape Shape to be exploded. diff --git a/idl/GEOM_Superv.idl b/idl/GEOM_Superv.idl index 074ff9e5a..92e6fc36d 100644 --- a/idl/GEOM_Superv.idl +++ b/idl/GEOM_Superv.idl @@ -312,7 +312,12 @@ module GEOM GEOM_Object MakeSolidShells (in GEOM_List theShells) ; GEOM_Object MakeCompound (in GEOM_List theShapes) ; GEOM_Object MakeGlueFaces (in GEOM_Object theShape, - in double theTolerance) ; + in double theTolerance); + GEOM_List GetGlueFaces (in GEOM_Object theShape, + in double theTolerance); + GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape, + in double theTolerance, + in ListOfGO theFaces); GEOM_List MakeExplode (in GEOM_Object theShape, in long theShapeType, in boolean isSorted) ; diff --git a/src/GEOMAlgo/GEOMAlgo.cdl b/src/GEOMAlgo/GEOMAlgo.cdl index b1e7aaa2f..1e1e88f79 100755 --- a/src/GEOMAlgo/GEOMAlgo.cdl +++ b/src/GEOMAlgo/GEOMAlgo.cdl @@ -127,6 +127,7 @@ is -- -- gluer class Gluer; + class Gluer1; class GlueAnalyser; class CoupleOfShapes; class PassKey; @@ -146,7 +147,16 @@ is -- class FinderShapeOn1; class StateCollector; - + -- adds + deferred class HAlgo; + deferred class Clsf; + class ClsfSurf; + class ClsfBox; + --modified by NIZNHY-PKV Mon Jan 29 10:27:44 2007f + class ClsfSolid; + --modified by NIZNHY-PKV Mon Jan 29 10:27:46 2007t + class FinderShapeOn2; + class PassKeyShapeMapHasher; -- -- Builder/Splitter deferred class BuilderShape; @@ -224,4 +234,26 @@ is instantiates IndexedDataMap from TCollection (Shape from TopoDS, ShapeInfo from GEOMAlgo, ShapeMapHasher from TopTools); + + class DataMapOfPassKeyShapeShape + instantiates DataMap from TCollection (PassKeyShape from GEOMAlgo, + Shape from TopoDS, + PassKeyShapeMapHasher from GEOMAlgo); + + class DataMapOfShapeShapeSet instantiates + DataMap from TCollection(Shape from TopoDS, + ShapeSet from GEOMAlgo, + ShapeMapHasher from TopTools); + + class DataMapOfShapeReal instantiates + DataMap from TCollection(Shape from TopoDS, + Real from Standard, + ShapeMapHasher from TopTools); + + + class DataMapOfRealListOfShape instantiates + DataMap from TCollection(Real from Standard, + ListOfShape from TopTools, + MapRealHasher from TColStd); + end GEOMAlgo; diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSolid.cdl b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.cdl new file mode 100755 index 000000000..ed6093c58 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.cdl @@ -0,0 +1,59 @@ +-- 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. +-- +-- 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_ClsfSolid.cdl +-- Created: Mon Jan 29 10:28:07 2007 +-- Author: Peter KURNEV +-- + + +class ClsfSolid from GEOMAlgo + inherits Clsf from GEOMAlgo + + ---Purpose: + +uses + Shape from TopoDS + +--raises + +is + Create + returns mutable ClsfSolid from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ClsfSolid();" + + SetShape(me:mutable; + aS:Shape from TopoDS); + + Shape(me) + returns Shape from TopoDS; + ---C++: return const & + + Perform(me:mutable) + is redefined; + + CheckData(me:mutable) + is redefined; + + +fields + myShape: Shape from TopoDS is protected; + myPClsf: Address from Standard is protected; + +end ClsfSolid; diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSolid.cxx b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.cxx new file mode 100755 index 000000000..0e779c996 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.cxx @@ -0,0 +1,139 @@ +// 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. +// +// 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_ClsfSolid.cxx +// Created: Mon Jan 29 10:35:46 2007 +// Author: Peter KURNEV +// + + +#include + +#include +#include +#include +#include +#include + +//======================================================================= +//function : +//purpose : +//======================================================================= + GEOMAlgo_ClsfSolid::GEOMAlgo_ClsfSolid() +: + GEOMAlgo_Clsf() +{ + myPClsf=NULL; +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= + GEOMAlgo_ClsfSolid::~GEOMAlgo_ClsfSolid() +{ + if (myPClsf) { + BRepClass3d_SolidClassifier* pSC; + // + pSC=(BRepClass3d_SolidClassifier*)myPClsf; + delete pSC; + } +} +//======================================================================= +//function : SetShape +//purpose : +//======================================================================= + void GEOMAlgo_ClsfSolid::SetShape(const TopoDS_Shape& aS) +{ + myShape=aS; +} +//======================================================================= +//function : Shape +//purpose : +//======================================================================= + const TopoDS_Shape& GEOMAlgo_ClsfSolid::Shape()const +{ + return myShape; +} +//======================================================================= +//function : CheckData +//purpose : +//======================================================================= + void GEOMAlgo_ClsfSolid::CheckData() +{ + myErrorStatus=0; + // + BRepClass3d_SolidClassifier* pSC; + TopAbs_ShapeEnum aType; + BRep_Builder aBB; + TopoDS_Solid aS; + // + if (myShape.IsNull()) { + myErrorStatus=10; // mySolid=NULL + return; + } + // + aType=myShape.ShapeType(); + if (!(aType==TopAbs_SOLID || aType==TopAbs_SHELL)) { + myErrorStatus=12; + return; + } + // + //=== + if (aType==TopAbs_SOLID) { + aS=TopoDS::Solid(myShape); + } + else { + aBB.MakeSolid(aS); + aBB.Add(aS, myShape); + } + // + if (myPClsf) { + pSC=(BRepClass3d_SolidClassifier*)myPClsf; + delete pSC; + } + // + pSC=new BRepClass3d_SolidClassifier(aS); + myPClsf=pSC; +} +//======================================================================= +//function : Perform +//purpose : +//======================================================================= + void GEOMAlgo_ClsfSolid::Perform() +{ + myErrorStatus=0; + // + if (!myPClsf) { + myErrorStatus=11; + return; + } + // + BRepClass3d_SolidClassifier* pSC; + // + pSC=(BRepClass3d_SolidClassifier*)myPClsf; + pSC->Perform(myPnt, myTolerance); + myState=pSC->State(); +} +// +// myErrorStatus : +// +// 10 - mySolid=NULL +// 11 - myPClsf=NULL +// 12 - unallowed type of myShape + diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSolid.hxx b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.hxx new file mode 100644 index 000000000..8feb5337e --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.hxx @@ -0,0 +1,106 @@ +// 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. +// +// 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_ClsfSolid_HeaderFile +#define _GEOMAlgo_ClsfSolid_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_GEOMAlgo_ClsfSolid_HeaderFile +#include +#endif + +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _Standard_Address_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_Clsf_HeaderFile +#include +#endif +class TopoDS_Shape; + + + +class GEOMAlgo_ClsfSolid : public GEOMAlgo_Clsf { + +public: + // Methods PUBLIC + // + + +Standard_EXPORT GEOMAlgo_ClsfSolid(); +Standard_EXPORT virtual ~GEOMAlgo_ClsfSolid(); + + +Standard_EXPORT void SetShape(const TopoDS_Shape& aS) ; + + +Standard_EXPORT const TopoDS_Shape& Shape() const; + + +Standard_EXPORT virtual void Perform() ; + + +Standard_EXPORT virtual void CheckData() ; +//Standard_EXPORT ~GEOMAlgo_ClsfSolid(); + + + + + // Type management + // + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // +TopoDS_Shape myShape; +Standard_Address myPClsf; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSolid.ixx b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.ixx new file mode 100644 index 000000000..c3a9f9b2d --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.ixx @@ -0,0 +1,74 @@ +// 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. +// +// 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 + +#include + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +//GEOMAlgo_ClsfSolid::~GEOMAlgo_ClsfSolid() {} + + + +Standard_EXPORT Handle_Standard_Type& GEOMAlgo_ClsfSolid_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(GEOMAlgo_Clsf); + static Handle_Standard_Type aType2 = STANDARD_TYPE(GEOMAlgo_HAlgo); + static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_ClsfSolid", + sizeof(GEOMAlgo_ClsfSolid), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(GEOMAlgo_ClsfSolid) Handle(GEOMAlgo_ClsfSolid)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMAlgo_ClsfSolid) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_ClsfSolid))) { + _anOtherObject = Handle(GEOMAlgo_ClsfSolid)((Handle(GEOMAlgo_ClsfSolid)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& GEOMAlgo_ClsfSolid::DynamicType() const +{ + return STANDARD_TYPE(GEOMAlgo_ClsfSolid) ; +} +//Standard_Boolean GEOMAlgo_ClsfSolid::IsKind(const Handle(Standard_Type)& AType) const +//{ +// return (STANDARD_TYPE(GEOMAlgo_ClsfSolid) == AType || GEOMAlgo_Clsf::IsKind(AType)); +//} +//Handle_GEOMAlgo_ClsfSolid::~Handle_GEOMAlgo_ClsfSolid() {} + diff --git a/src/GEOMAlgo/GEOMAlgo_ClsfSolid.jxx b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.jxx new file mode 100644 index 000000000..3d84d0210 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_ClsfSolid.jxx @@ -0,0 +1,25 @@ +// 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. +// +// 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 _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_ClsfSolid_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape.hxx new file mode 100644 index 000000000..8c046bf60 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape.hxx @@ -0,0 +1,113 @@ +// 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. +// +// 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_DataMapIteratorOfDataMapOfPassKeyShapeShape_HeaderFile +#define _GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_HeaderFile + +#ifndef _TCollection_BasicMapIterator_HeaderFile +#include +#endif +#ifndef _Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile +#include +#endif +class Standard_NoSuchObject; +class GEOMAlgo_PassKeyShape; +class TopoDS_Shape; +class GEOMAlgo_PassKeyShapeMapHasher; +class GEOMAlgo_DataMapOfPassKeyShapeShape; +class GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape : public TCollection_BasicMapIterator { + +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_DataMapIteratorOfDataMapOfPassKeyShapeShape(); + + +Standard_EXPORT GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape(const GEOMAlgo_DataMapOfPassKeyShapeShape& aMap); + + +Standard_EXPORT void Initialize(const GEOMAlgo_DataMapOfPassKeyShapeShape& aMap) ; + + +Standard_EXPORT const GEOMAlgo_PassKeyShape& Key() const; + + +Standard_EXPORT const TopoDS_Shape& Value() const; + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_0.cxx b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_0.cxx new file mode 100644 index 000000000..36e1955f0 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_0.cxx @@ -0,0 +1,57 @@ +// 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. +// +// 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 + +#include + +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_PassKeyShape_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_PassKeyShapeMapHasher_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_DataMapOfPassKeyShapeShape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile +#include +#endif + + +#define TheKey GEOMAlgo_PassKeyShape +#define TheKey_hxx +#define TheItem TopoDS_Shape +#define TheItem_hxx +#define Hasher GEOMAlgo_PassKeyShapeMapHasher +#define Hasher_hxx +#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_Type_() +#define TCollection_DataMap GEOMAlgo_DataMapOfPassKeyShapeShape +#define TCollection_DataMap_hxx +#include + diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx new file mode 100644 index 000000000..856164622 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx @@ -0,0 +1,132 @@ +// 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. +// +// 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_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile +#define _GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile +#include +#endif + +#ifndef _GEOMAlgo_PassKeyShape_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _TCollection_MapNode_HeaderFile +#include +#endif +#ifndef _TCollection_MapNodePtr_HeaderFile +#include +#endif +class GEOMAlgo_PassKeyShape; +class TopoDS_Shape; +class GEOMAlgo_PassKeyShapeMapHasher; +class GEOMAlgo_DataMapOfPassKeyShapeShape; +class GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape; + + + +class GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape : public TCollection_MapNode { + +public: + // Methods PUBLIC + // + +GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape(const GEOMAlgo_PassKeyShape& K,const TopoDS_Shape& I,const TCollection_MapNodePtr& n); + + GEOMAlgo_PassKeyShape& Key() const; + + TopoDS_Shape& Value() const; +//Standard_EXPORT ~GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape(); + + + + + // Type management + // + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + //Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // +GEOMAlgo_PassKeyShape myKey; +TopoDS_Shape myValue; + + +}; + +#define TheKey GEOMAlgo_PassKeyShape +#define TheKey_hxx +#define TheItem TopoDS_Shape +#define TheItem_hxx +#define Hasher GEOMAlgo_PassKeyShapeMapHasher +#define Hasher_hxx +#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_Type_() +#define TCollection_DataMap GEOMAlgo_DataMapOfPassKeyShapeShape +#define TCollection_DataMap_hxx + +#include + +#undef TheKey +#undef TheKey_hxx +#undef TheItem +#undef TheItem_hxx +#undef Hasher +#undef Hasher_hxx +#undef TCollection_DataMapNode +#undef TCollection_DataMapNode_hxx +#undef TCollection_DataMapIterator +#undef TCollection_DataMapIterator_hxx +#undef Handle_TCollection_DataMapNode +#undef TCollection_DataMapNode_Type_ +#undef TCollection_DataMap +#undef TCollection_DataMap_hxx + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_0.cxx b/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_0.cxx new file mode 100644 index 000000000..424e74701 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_0.cxx @@ -0,0 +1,103 @@ +// 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. +// +// 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 + +#include + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +#ifndef _GEOMAlgo_PassKeyShape_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_PassKeyShapeMapHasher_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_DataMapOfPassKeyShapeShape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_HeaderFile +#include +#endif +//GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape::~GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape() {} + + + +Standard_EXPORT Handle_Standard_Type& GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape", + sizeof(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape) Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape))) { + _anOtherObject = Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)((Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape::DynamicType() const +{ + return STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape) ; +} +//Standard_Boolean GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape::IsKind(const Handle(Standard_Type)& AType) const +//{ +// return (STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape) == AType || TCollection_MapNode::IsKind(AType)); +//} +//Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape::~Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape() {} +#define TheKey GEOMAlgo_PassKeyShape +#define TheKey_hxx +#define TheItem TopoDS_Shape +#define TheItem_hxx +#define Hasher GEOMAlgo_PassKeyShapeMapHasher +#define Hasher_hxx +#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_Type_() +#define TCollection_DataMap GEOMAlgo_DataMapOfPassKeyShapeShape +#define TCollection_DataMap_hxx +#include + diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyShapeShape.hxx b/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyShapeShape.hxx new file mode 100644 index 000000000..4e209557f --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyShapeShape.hxx @@ -0,0 +1,155 @@ +// 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. +// +// 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_DataMapOfPassKeyShapeShape_HeaderFile +#define _GEOMAlgo_DataMapOfPassKeyShapeShape_HeaderFile + +#ifndef _TCollection_BasicMap_HeaderFile +#include +#endif +#ifndef _Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile +#include +#endif +#ifndef _Standard_Integer_HeaderFile +#include +#endif +#ifndef _Standard_Boolean_HeaderFile +#include +#endif +class Standard_DomainError; +class Standard_NoSuchObject; +class GEOMAlgo_PassKeyShape; +class TopoDS_Shape; +class GEOMAlgo_PassKeyShapeMapHasher; +class GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape; +class GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class GEOMAlgo_DataMapOfPassKeyShapeShape : public TCollection_BasicMap { + +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_DataMapOfPassKeyShapeShape(const Standard_Integer NbBuckets = 1); + + +Standard_EXPORT GEOMAlgo_DataMapOfPassKeyShapeShape& Assign(const GEOMAlgo_DataMapOfPassKeyShapeShape& Other) ; + GEOMAlgo_DataMapOfPassKeyShapeShape& operator =(const GEOMAlgo_DataMapOfPassKeyShapeShape& Other) +{ + return Assign(Other); +} + + + +Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ; + + +Standard_EXPORT void Clear() ; +~GEOMAlgo_DataMapOfPassKeyShapeShape() +{ + Clear(); +} + + + +Standard_EXPORT Standard_Boolean Bind(const GEOMAlgo_PassKeyShape& K,const TopoDS_Shape& I) ; + + +Standard_EXPORT Standard_Boolean IsBound(const GEOMAlgo_PassKeyShape& K) const; + + +Standard_EXPORT Standard_Boolean UnBind(const GEOMAlgo_PassKeyShape& K) ; + + +Standard_EXPORT const TopoDS_Shape& Find(const GEOMAlgo_PassKeyShape& K) const; + const TopoDS_Shape& operator()(const GEOMAlgo_PassKeyShape& K) const +{ + return Find(K); +} + + + +Standard_EXPORT TopoDS_Shape& ChangeFind(const GEOMAlgo_PassKeyShape& K) ; + TopoDS_Shape& operator()(const GEOMAlgo_PassKeyShape& K) +{ + return ChangeFind(K); +} + + + + + + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + +Standard_EXPORT GEOMAlgo_DataMapOfPassKeyShapeShape(const GEOMAlgo_DataMapOfPassKeyShapeShape& Other); + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyShapeShape_0.cxx b/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyShapeShape_0.cxx new file mode 100644 index 000000000..777551745 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_DataMapOfPassKeyShapeShape_0.cxx @@ -0,0 +1,60 @@ +// 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. +// +// 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 + +#include + +#ifndef _Standard_DomainError_HeaderFile +#include +#endif +#ifndef _Standard_NoSuchObject_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_PassKeyShape_HeaderFile +#include +#endif +#ifndef _TopoDS_Shape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_PassKeyShapeMapHasher_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_HeaderFile +#include +#endif + + +#define TheKey GEOMAlgo_PassKeyShape +#define TheKey_hxx +#define TheItem TopoDS_Shape +#define TheItem_hxx +#define Hasher GEOMAlgo_PassKeyShapeMapHasher +#define Hasher_hxx +#define TCollection_DataMapNode GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapNode_hxx +#define TCollection_DataMapIterator GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapIterator_hxx +#define Handle_TCollection_DataMapNode Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape +#define TCollection_DataMapNode_Type_() GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_Type_() +#define TCollection_DataMap GEOMAlgo_DataMapOfPassKeyShapeShape +#define TCollection_DataMap_hxx +#include + diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer1.cdl b/src/GEOMAlgo/GEOMAlgo_Gluer1.cdl new file mode 100755 index 000000000..d226781a7 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Gluer1.cdl @@ -0,0 +1,71 @@ +-- 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. +-- +-- 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_Gluer1.cdl +-- Created: Wed Jan 24 11:37:31 2007 +-- Author: Peter KURNEV +-- + + +class Gluer1 from GEOMAlgo + inherits Gluer from GEOMAlgo + + ---Purpose: + +uses + ListOfCoupleOfShapes from GEOMAlgo, + DataMapOfPassKeyShapeShape from GEOMAlgo + +--raises + +is + Create + returns Gluer1 from GEOMAlgo; + ---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_Gluer1();" + + SetFacesToUnglue(me:out; + aLCS:ListOfCoupleOfShapes from GEOMAlgo); + + FacesToUnglue(me) + returns ListOfCoupleOfShapes from GEOMAlgo; + ---C++: return const& + + GluedFaces(me) + returns ListOfCoupleOfShapes from GEOMAlgo; + ---C++: return const& + + RejectedFaces(me) + returns ListOfCoupleOfShapes from GEOMAlgo; + ---C++: return const& + + Perform(me:out) + is redefined; + + UnglueFaces(me:out); + + FillGluedFaces(me:out) + is protected; + +fields + myGluedFaces :ListOfCoupleOfShapes from GEOMAlgo is protected; + myFacesToUnglue :ListOfCoupleOfShapes from GEOMAlgo is protected; + myRejectedFaces :ListOfCoupleOfShapes from GEOMAlgo is protected; + myMapGN :DataMapOfPassKeyShapeShape from GEOMAlgo is protected; + +end Gluer1; diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer1.cxx b/src/GEOMAlgo/GEOMAlgo_Gluer1.cxx new file mode 100755 index 000000000..d1636fea5 --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Gluer1.cxx @@ -0,0 +1,542 @@ +// 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. +// +// 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_Gluer1.cxx +// Created: Wed Jan 24 11:52:27 2007 +// Author: Peter KURNEV +// + + +#include + +#include + +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +//======================================================================= +//class : GEOMAlgo_CoupleOfInteger +//purpose : +//======================================================================= +class GEOMAlgo_CoupleOfInteger { + // + public: + // + GEOMAlgo_CoupleOfInteger() { + myInt1=0; + myInt2=0; + } + // + ~GEOMAlgo_CoupleOfInteger() { + } + // + void SetValues(const Standard_Integer aI1, + const Standard_Integer aI2) { + myInt1=aI1; + myInt2=aI2; + } + // + void SetValue1(const Standard_Integer aI1) { + myInt1=aI1; + } + // + void SetValue2(const Standard_Integer aI1) { + myInt1=aI1; + } + // + void Values(Standard_Integer& aI1, + Standard_Integer& aI2) const { + aI1=myInt1; + aI2=myInt2; + } + // + Standard_Integer Value1()const { + return myInt1; + } + // + Standard_Integer Value2()const { + return myInt2; + } + // + protected: + Standard_Integer myInt1; + Standard_Integer myInt2; +}; +// +//======================================================================= +// +static + void SortShell(const Standard_Integer , + GEOMAlgo_CoupleOfInteger* ); +static + void RefineSolid(const TopoDS_Shape& , + const TopTools_DataMapOfShapeShape& , + TopTools_DataMapOfShapeShape& ); +static + void MakeFaceToReplace(const TopoDS_Face& , + TopoDS_Face& ); +// +//======================================================================= +//function : GEOMAlgo_Gluer1 +//purpose : +//======================================================================= + GEOMAlgo_Gluer1::GEOMAlgo_Gluer1() +: + GEOMAlgo_Gluer() +{ +} +//======================================================================= +//function : +//purpose : +//======================================================================= + GEOMAlgo_Gluer1::~GEOMAlgo_Gluer1() +{ +} +//======================================================================= +//function : SetFacesToUnglue +//purpose : +//======================================================================= + void GEOMAlgo_Gluer1::SetFacesToUnglue(const GEOMAlgo_ListOfCoupleOfShapes& aLCS) +{ + myFacesToUnglue=aLCS; +} +//======================================================================= +//function : FacesToUnglue +//purpose : +//======================================================================= + const GEOMAlgo_ListOfCoupleOfShapes& GEOMAlgo_Gluer1::FacesToUnglue()const +{ + return myFacesToUnglue; +} +//======================================================================= +//function : GluedFaces +//purpose : +//======================================================================= + const GEOMAlgo_ListOfCoupleOfShapes& GEOMAlgo_Gluer1::GluedFaces()const +{ + return myGluedFaces; +} +//======================================================================= +//function : RejectedFaces +//purpose : +//======================================================================= + const GEOMAlgo_ListOfCoupleOfShapes& GEOMAlgo_Gluer1::RejectedFaces()const +{ + return myRejectedFaces; +} +//======================================================================= +//function : Perform +//purpose : +//======================================================================= + void GEOMAlgo_Gluer1::Perform() +{ + // 1. + GEOMAlgo_Gluer::Perform(); + if (myErrorStatus) { + return; + } + // + FillGluedFaces(); + if (myErrorStatus) { + return; + } +} +//======================================================================= +//function : FillGluedFaces +//purpose : +//======================================================================= + void GEOMAlgo_Gluer1::FillGluedFaces() +{ + myErrorStatus=0; + // + Standard_Integer aNbIm, aNbS, i; + TopAbs_ShapeEnum aType; + TopTools_ListIteratorOfListOfShape aItLS; + TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm; + GEOMAlgo_CoupleOfShapes aCS; + GEOMAlgo_PassKeyShape aPKS; + // + myMapGN.Clear(); + myGluedFaces.Clear(); + // + aNbIm=myImages.Extent(); + aItIm.Initialize(myImages); + for (; aItIm.More(); aItIm.Next()) { + const TopoDS_Shape& aSnew=aItIm.Key(); + aType=aSnew.ShapeType(); + if (aType!=TopAbs_FACE) { + continue; + } + // + const TopTools_ListOfShape& aLS=aItIm.Value(); + aNbS=aLS.Extent(); + if (aNbS!=2) { + continue; + } + // + TopoDS_Shape aSold[2]; + aItLS.Initialize(aLS); + for (i=0; aItLS.More(); aItLS.Next(), ++i) { + const TopoDS_Shape& aSi=aItLS.Value(); + aSold[i]=aItLS.Value(); + } + // + aCS.SetShapes(aSold[0], aSold[1]); + myGluedFaces.Append(aCS); + // + aPKS.Clear(); + aPKS.SetShapes(aSold[0], aSold[1]); + myMapGN.Bind(aPKS, aSnew); + } +} +//======================================================================= +//function : UnglueFaces +//purpose : +//======================================================================= + void GEOMAlgo_Gluer1::UnglueFaces() +{ + if (myErrorStatus) { + return; + } + // + Standard_Boolean bFound; + Standard_Integer i, aNbUN, aNbS, aNbF, iX; + TopTools_IndexedDataMapOfShapeListOfShape aMFSR, aMFS, aMSF; + TopTools_ListIteratorOfListOfShape aItLS, aItLS1; + GEOMAlgo_PassKeyShape aPKS; + GEOMAlgo_ListIteratorOfListOfCoupleOfShapes aItCS; + GEOMAlgo_DataMapOfPassKeyShapeShape aMapUN; + GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape aItUN; + GEOMAlgo_CoupleOfInteger *pIx; + // + if (myResult.IsNull()) { + myErrorStatus=200; // no result + return; + } + myWarningStatus=0; + myRejectedFaces.Clear(); + // + // 0. Fill map [Face]/Solid for myResult: aMFSR + TopExp::MapShapesAndAncestors(myResult, TopAbs_FACE, TopAbs_SOLID, aMFSR); + // + // 1. Fill Faces to process: aMapUN : [Fold1, Fold2] / Fnew + aNbUN=myFacesToUnglue.Extent(); + if (!aNbUN) { + // all faces that can be unglued will be unglued + aMapUN=myMapGN; + myFacesToUnglue=myGluedFaces; + } + else { + aItCS.Initialize(myFacesToUnglue); + for (; aItCS.More(); aItCS.Next()) { + const GEOMAlgo_CoupleOfShapes& aCS=aItCS.Value(); + const TopoDS_Shape& aS1=aCS.Shape1(); + const TopoDS_Shape& aS2=aCS.Shape2(); + aPKS.Clear(); + aPKS.SetShapes(aS1, aS2); + if (!myMapGN.IsBound(aPKS)) { + //some faces, wanted to unglue, are not glued at all; + myWarningStatus=2; + myRejectedFaces.Append(aCS); + continue; + } + // + const TopoDS_Shape& aFN=myMapGN.Find(aPKS); + aMapUN.Bind(aPKS, aFN); + } + } + // + // 2 Fill map FN/Solids for myResult: aMFS + aNbUN=aMapUN.Extent(); + aItUN.Initialize(aMapUN); + for (; aItUN.More(); aItUN.Next()) { + const TopoDS_Shape& aFN=aItUN.Value(); + if (!aMFSR.Contains(aFN)) { + myWarningStatus=3; // how can it be + continue; + } + // + const TopTools_ListOfShape& aLS=aMFSR.FindFromKey(aFN); + aNbS=aLS.Extent(); + if (aNbS!=2) { + // wrong result: More than 2 solids shared one face + myWarningStatus=4; + continue; + } + aMFS.Add(aFN, aLS); + } + // + // 3 Fill map Solids/FN for myResult: aMSF + aNbUN=aMFS.Extent(); + for (i=1; i<=aNbUN; ++i) { + const TopoDS_Shape& aFN=aMFS.FindKey(i); + const TopTools_ListOfShape& aLS=aMFS(i); + aItLS.Initialize(aLS); + for (; aItLS.More(); aItLS.Next()) { + const TopoDS_Shape& aS=aItLS.Value(); + if (aMSF.Contains(aS)) { + TopTools_ListOfShape& aLF=aMSF.ChangeFromKey(aS); + aLF.Append(aFN); + } + else { + TopTools_ListOfShape aLF; + aLF.Append(aFN); + aMSF.Add(aS, aLF); + } + } + } + // + // 4 Sort indices of aMSF + aNbS=aMSF.Extent(); + if (aNbS<2) { + // wrong number of solids that have shared face + myWarningStatus=5; + } + // + pIx=new GEOMAlgo_CoupleOfInteger[aNbS]; + // + for (i=1; i<=aNbS; ++i) { + const TopTools_ListOfShape& aLF=aMSF(i); + aNbF=aLF.Extent(); + pIx[i-1].SetValues(aNbF, i); + } + SortShell(aNbS, pIx); + // + // 5 Refine solids + // + TopTools_DataMapOfShapeShape aMFNFN2, aMFNFD; + TopTools_DataMapIteratorOfDataMapOfShapeShape aItMSS; + TopTools_MapOfShape aMFNP; + TopTools_IndexedMapOfShape aMFD; + // + for (iX=aNbS-1; iX>=0; --iX) { + i=pIx[iX].Value2(); + // solid from myResult aSN + const TopoDS_Shape& aSN=aMSF.FindKey(i); + // + // candidates to be faces to replace for aSN + const TopTools_ListOfShape& aLFN=aMSF(i); + aNbF=aLFN.Extent(); + // + // original solid for aSN -> aSD + const TopTools_ListOfShape& aLSD=myImages.Find(aSN); + const TopoDS_Shape& aSD=aLSD.First(); + // + // faces of original solid -> aMFD + aMFD.Clear(); + TopExp::MapShapes(aSD, TopAbs_FACE, aMFD); + // + // faces to replace for aSN [FN]/FD -> aMFNFD + aMFNFD.Clear(); + aItLS.Initialize(aLFN); + for (; aItLS.More(); aItLS.Next()) { + const TopoDS_Shape& aFN=aItLS.Value(); + if (!aMFNP.Add(aFN)) { + continue; + } + // + // original face from original solid -> FD + TopoDS_Shape aFD; + // + bFound=Standard_False; + const TopTools_ListOfShape& aLFD=myImages.Find(aFN); + aItLS1.Initialize(aLFD); + for (; aItLS1.More(); aItLS1.Next()) { + const TopoDS_Shape& aFDx=aItLS1.Value(); + if (aMFD.Contains(aFDx)) { + aFD=aFDx; + bFound=Standard_True; + break; + } + } + //if (!bFound) {...} + aMFNFD.Bind(aFN, aFD); + } // for (; aItLS.More(); aItLS.Next()) { + // + aNbF=aMFNFD.Extent(); + if (!aNbF) { + // nothing to do here + continue; + } + // update solid SN (and its shells) + RefineSolid(aSN, aMFNFD, aMFNFN2); + // + // update myOrigins / myImages + aItMSS.Initialize(aMFNFD); + for (; aItMSS.More(); aItMSS.Next()) { + const TopoDS_Shape& aFN=aItMSS.Key(); // face removed from aSN + const TopoDS_Shape& aFD=aItMSS.Value(); // old face from aSD + const TopoDS_Shape& aFN2=aMFNFN2.Find(aFN);// face added to aSN + // + // myOrigins + myOrigins.ChangeFind(aFD)=aFN2; + // + // myImages + TopTools_ListOfShape aLFDx; + // + TopTools_ListOfShape& aLFD=myImages.ChangeFind(aFN); + aItLS.Initialize(aLFD); + for (; aItLS.More(); aItLS.Next()) { + const TopoDS_Shape& aFDx=aItLS.Value(); + if (!aFDx.IsSame(aFD)) { + aLFDx.Append(aFDx); + } + } + aLFD=aLFDx; + // + aLFDx.Clear(); + aLFDx.Append(aFD); + myImages.Bind(aFN2, aLFDx); + } // for (; aItMSS.More(); aItMSS.Next()) { + } // for (iX=aNbS-1; iX>=0; --iX) { + // + delete [] pIx; +} +//======================================================================= +// function: RefineSolid +// purpose : replace faces (aMFN) of solid aSd by new ones +//======================================================================= +void RefineSolid(const TopoDS_Shape& aSd, + const TopTools_DataMapOfShapeShape& aMFNFD, + TopTools_DataMapOfShapeShape& aMFNFN2) +{ + TopoDS_Shape *pSh; + TopoDS_Face aF2; + TopoDS_Iterator aItSd, aItSh; + BRep_Builder aBB; + TopTools_ListOfShape aLF; + TopTools_ListIteratorOfListOfShape aItLF; + // + aItSd.Initialize(aSd); + for (; aItSd.More(); aItSd.Next()) { + const TopoDS_Shape& aSh=aItSd.Value(); + pSh=(TopoDS_Shape *)&aSh; + pSh->Free(Standard_True); + aLF.Clear(); + aItSh.Initialize(*pSh); + for (; aItSh.More(); aItSh.Next()) { + const TopoDS_Shape& aF=aItSh.Value(); + if (aMFNFD.IsBound(aF)) { + aLF.Append(aF); + } + } + // + aItLF.Initialize(aLF); + for (; aItLF.More(); aItLF.Next()) { + const TopoDS_Face& aF=TopoDS::Face(aItLF.Value()); + // + MakeFaceToReplace(aF, aF2); + // + aMFNFN2.Bind(aF, aF2); + aBB.Remove(*pSh, aF); + aBB.Add(*pSh, aF2); + } + pSh->Free(Standard_False); + } +} +//======================================================================= +//function : MakeFaceToReplace +//purpose : +//======================================================================= +void MakeFaceToReplace(const TopoDS_Face& aF, + TopoDS_Face& aFR) +{ + Standard_Real aTol; + Handle(Geom_Surface) aS; + TopLoc_Location aLoc; + TopoDS_Face aFFWD, aFnew; + TopoDS_Iterator aItF; + BRep_Builder aBB; + // + aFFWD=aF; + aFFWD.Orientation(TopAbs_FORWARD); + aS=BRep_Tool::Surface(aFFWD, aLoc); + aTol=BRep_Tool::Tolerance(aFFWD); + // + aBB.MakeFace (aFnew, aS, aLoc, aTol); + aItF.Initialize(aFFWD); + for (; aItF.More(); aItF.Next()) { + const TopoDS_Shape& aW=aItF.Value(); + aBB.Add(aFnew, aW); + } + aFnew.Orientation(aF.Orientation()); + aFR=aFnew; +} +//======================================================================= +// function: SortShell +// purpose : +//======================================================================= +void SortShell(const Standard_Integer n, + GEOMAlgo_CoupleOfInteger* a) +{ + Standard_Integer nd, i, j, l, d=1; + GEOMAlgo_CoupleOfInteger x; + // + while(d<=n) { + d*=2; + } + // + while (d) { + d=(d-1)/2; + // + nd=n-d; + for (i=0; i -1) { + goto m30; + } + }//if (a[l] < a[j]){ + }//for (i=0; i +#endif +#ifndef _GEOMAlgo_DataMapOfPassKeyShapeShape_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_Gluer_HeaderFile +#include +#endif +class GEOMAlgo_ListOfCoupleOfShapes; + + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + + +class GEOMAlgo_Gluer1 : public GEOMAlgo_Gluer { + +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_Gluer1(); +Standard_EXPORT virtual ~GEOMAlgo_Gluer1(); + + +Standard_EXPORT void SetFacesToUnglue(const GEOMAlgo_ListOfCoupleOfShapes& aLCS) ; + + +Standard_EXPORT const GEOMAlgo_ListOfCoupleOfShapes& FacesToUnglue() const; + + +Standard_EXPORT const GEOMAlgo_ListOfCoupleOfShapes& GluedFaces() const; + + +Standard_EXPORT const GEOMAlgo_ListOfCoupleOfShapes& RejectedFaces() const; + + +Standard_EXPORT virtual void Perform() ; + + +Standard_EXPORT void UnglueFaces() ; + + + + + +protected: + + // Methods PROTECTED + // + + +Standard_EXPORT void FillGluedFaces() ; + + + // Fields PROTECTED + // +GEOMAlgo_ListOfCoupleOfShapes myGluedFaces; +GEOMAlgo_ListOfCoupleOfShapes myFacesToUnglue; +GEOMAlgo_ListOfCoupleOfShapes myRejectedFaces; +GEOMAlgo_DataMapOfPassKeyShapeShape myMapGN; + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer1.ixx b/src/GEOMAlgo/GEOMAlgo_Gluer1.ixx new file mode 100644 index 000000000..9198a8dbb --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Gluer1.ixx @@ -0,0 +1,24 @@ +// 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. +// +// 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 + +#include + + + + diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer1.jxx b/src/GEOMAlgo/GEOMAlgo_Gluer1.jxx new file mode 100644 index 000000000..bb63320eb --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_Gluer1.jxx @@ -0,0 +1,25 @@ +// 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. +// +// 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_ListOfCoupleOfShapes_HeaderFile +#include +#endif +#ifndef _GEOMAlgo_Gluer1_HeaderFile +#include +#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_ClsfSolid.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_ClsfSolid.hxx new file mode 100644 index 000000000..8098ce527 --- /dev/null +++ b/src/GEOMAlgo/Handle_GEOMAlgo_ClsfSolid.hxx @@ -0,0 +1,72 @@ +// 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. +// +// 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 _Handle_GEOMAlgo_ClsfSolid_HeaderFile +#define _Handle_GEOMAlgo_ClsfSolid_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_GEOMAlgo_Clsf_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(GEOMAlgo_Clsf); +class GEOMAlgo_ClsfSolid; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_ClsfSolid); + +class Handle(GEOMAlgo_ClsfSolid) : public Handle(GEOMAlgo_Clsf) { + public: + Handle(GEOMAlgo_ClsfSolid)():Handle(GEOMAlgo_Clsf)() {} + Handle(GEOMAlgo_ClsfSolid)(const Handle(GEOMAlgo_ClsfSolid)& aHandle) : Handle(GEOMAlgo_Clsf)(aHandle) + { + } + + Handle(GEOMAlgo_ClsfSolid)(const GEOMAlgo_ClsfSolid* anItem) : Handle(GEOMAlgo_Clsf)((GEOMAlgo_Clsf *)anItem) + { + } + + Handle(GEOMAlgo_ClsfSolid)& operator=(const Handle(GEOMAlgo_ClsfSolid)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMAlgo_ClsfSolid)& operator=(const GEOMAlgo_ClsfSolid* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMAlgo_ClsfSolid* operator->() const + { + return (GEOMAlgo_ClsfSolid *)ControlAccess(); + } + +// Standard_EXPORT ~Handle(GEOMAlgo_ClsfSolid)(); + + Standard_EXPORT static const Handle(GEOMAlgo_ClsfSolid) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/GEOMAlgo/Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx b/src/GEOMAlgo/Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx new file mode 100644 index 000000000..8360ec290 --- /dev/null +++ b/src/GEOMAlgo/Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx @@ -0,0 +1,72 @@ +// 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. +// +// 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 _Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile +#define _Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TCollection_MapNode_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TCollection_MapNode); +class GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape); + +class Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape) : public Handle(TCollection_MapNode) { + public: + Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)():Handle(TCollection_MapNode)() {} + Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)(const Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)& aHandle) : Handle(TCollection_MapNode)(aHandle) + { + } + + Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)(const GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem) + { + } + + Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)& operator=(const Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)& operator=(const GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape* operator->() const + { + return (GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape *)ControlAccess(); + } + +// Standard_EXPORT ~Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape)(); + + Standard_EXPORT static const Handle(GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/GEOMAlgo/Makefile.in b/src/GEOMAlgo/Makefile.in index 4c46e9ed9..447899ee3 100644 --- a/src/GEOMAlgo/Makefile.in +++ b/src/GEOMAlgo/Makefile.in @@ -58,16 +58,20 @@ LIB_SRC = \ GEOMAlgo_ClsfBox.cxx \ GEOMAlgo_Clsf.cxx \ GEOMAlgo_ClsfSurf.cxx \ + GEOMAlgo_ClsfSolid.cxx \ GEOMAlgo_CoupleOfShapes.cxx \ GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger_0.cxx \ + GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape_0.cxx \ GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape_0.cxx \ GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal_0.cxx \ GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet_0.cxx \ GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger_0.cxx \ + GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape_0.cxx \ GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape_0.cxx \ GEOMAlgo_DataMapNodeOfDataMapOfShapeReal_0.cxx \ GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet_0.cxx \ GEOMAlgo_DataMapOfPassKeyInteger_0.cxx \ + GEOMAlgo_DataMapOfPassKeyShapeShape_0.cxx \ GEOMAlgo_DataMapOfRealListOfShape_0.cxx \ GEOMAlgo_DataMapOfShapeReal_0.cxx \ GEOMAlgo_DataMapOfShapeShapeSet_0.cxx \ @@ -77,6 +81,7 @@ LIB_SRC = \ GEOMAlgo_FinderShapeOnQuad.cxx \ GEOMAlgo_GlueAnalyser.cxx \ GEOMAlgo_Gluer.cxx \ + GEOMAlgo_Gluer1.cxx \ GEOMAlgo_HAlgo.cxx \ GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_0.cxx \ GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_0.cxx \ @@ -138,16 +143,20 @@ EXPORT_HEADERS = \ GEOMAlgo_ClsfBox.hxx \ GEOMAlgo_Clsf.hxx \ GEOMAlgo_ClsfSurf.hxx \ + GEOMAlgo_ClsfSolid.hxx \ GEOMAlgo_CoupleOfShapes.hxx \ GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger.hxx \ + GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyShapeShape.hxx \ GEOMAlgo_DataMapIteratorOfDataMapOfRealListOfShape.hxx \ GEOMAlgo_DataMapIteratorOfDataMapOfShapeReal.hxx \ GEOMAlgo_DataMapIteratorOfDataMapOfShapeShapeSet.hxx \ GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger.hxx \ + GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx \ GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape.hxx \ GEOMAlgo_DataMapNodeOfDataMapOfShapeReal.hxx \ GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet.hxx \ GEOMAlgo_DataMapOfPassKeyInteger.hxx \ + GEOMAlgo_DataMapOfPassKeyShapeShape.hxx \ GEOMAlgo_DataMapOfRealListOfShape.hxx \ GEOMAlgo_DataMapOfShapeReal.hxx \ GEOMAlgo_DataMapOfShapeShapeSet.hxx \ @@ -157,6 +166,7 @@ EXPORT_HEADERS = \ GEOMAlgo_FinderShapeOnQuad.hxx \ GEOMAlgo_GlueAnalyser.hxx \ GEOMAlgo_Gluer.hxx \ + GEOMAlgo_Gluer1.hxx \ GEOMAlgo_HAlgo.hxx \ GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape.hxx \ GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape.hxx \ @@ -206,7 +216,9 @@ EXPORT_HEADERS = \ Handle_GEOMAlgo_ClsfBox.hxx \ Handle_GEOMAlgo_Clsf.hxx \ Handle_GEOMAlgo_ClsfSurf.hxx \ + Handle_GEOMAlgo_ClsfSolid.hxx \ Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyInteger.hxx \ + Handle_GEOMAlgo_DataMapNodeOfDataMapOfPassKeyShapeShape.hxx \ Handle_GEOMAlgo_DataMapNodeOfDataMapOfRealListOfShape.hxx \ Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeReal.hxx \ Handle_GEOMAlgo_DataMapNodeOfDataMapOfShapeShapeSet.hxx \ diff --git a/src/GEOMImpl/GEOMImpl_GlueDriver.cxx b/src/GEOMImpl/GEOMImpl_GlueDriver.cxx index fd41180a9..e056bf7d8 100644 --- a/src/GEOMImpl/GEOMImpl_GlueDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_GlueDriver.cxx @@ -28,6 +28,10 @@ #include #include +#include "GEOMAlgo_Gluer1.hxx" +#include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx" +#include "GEOMAlgo_CoupleOfShapes.hxx" +#include "GEOMAlgo_ListOfCoupleOfShapes.hxx" #include "utilities.h" @@ -187,6 +191,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& the return aRes; } + //======================================================================= //function : GlueFaces //purpose : @@ -249,6 +254,56 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape, return aRes; } + +//======================================================================= +//function : GlueFacesByList +//purpose : +//======================================================================= +TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesByList (const TopoDS_Shape& theShape, + const Standard_Real theTolerance, + const TopTools_MapOfShape& aFaces) +{ + TopoDS_Shape aRes; + + GEOMAlgo_Gluer1 aGluer; + GEOMAlgo_ListIteratorOfListOfCoupleOfShapes aItCS; + GEOMAlgo_CoupleOfShapes aCS; + GEOMAlgo_ListOfCoupleOfShapes aLCS; + + aGluer.SetShape(theShape); + aGluer.SetTolerance(theTolerance); + aGluer.Perform(); + Standard_Integer iErr = aGluer.ErrorStatus(); + if (iErr) return aRes; + + TopTools_ListOfShape listShape; + const GEOMAlgo_ListOfCoupleOfShapes& aLCSG = aGluer.GluedFaces(); + // Access to faces + aItCS.Initialize(aLCSG); + for (; aItCS.More(); aItCS.Next()) { + 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) ) + continue; + aCS.SetShapes(aF1,aF2); + aLCS.Append(aCS); + } + + //cout<<"aLCS.Extent() = "<0) { + aGluer.SetFacesToUnglue(aLCS); + aGluer.UnglueFaces(); + iErr = aGluer.ErrorStatus(); + if (iErr) return aRes; + } + + aRes = aGluer.Result(); + + return aRes; +} + + //======================================================================= //function : Execute //purpose : @@ -264,16 +319,35 @@ Standard_Integer GEOMImpl_GlueDriver::Execute(TFunction_Logbook& log) const TopoDS_Shape aShape; TCollection_AsciiString aWrn; - if (aType == GLUE_FACES) { - Handle(GEOM_Function) aRefBase = aCI.GetBase(); - TopoDS_Shape aShapeBase = aRefBase->GetValue(); - if (aShapeBase.IsNull()) { - Standard_NullObject::Raise("Shape for gluing is null"); - } + Handle(GEOM_Function) aRefBase = aCI.GetBase(); + TopoDS_Shape aShapeBase = aRefBase->GetValue(); + if (aShapeBase.IsNull()) { + Standard_NullObject::Raise("Shape for gluing is null"); + } + + Standard_Real tol3d = aCI.GetTolerance(); - Standard_Real tol3d = aCI.GetTolerance(); + if (aType == GLUE_FACES) { aShape = GlueFacesWithWarnings(aShapeBase, tol3d, aWrn); - } else { + } + else { // aType == GLUE_FACES_BY_LIST + Handle(TColStd_HSequenceOfTransient) SF = aCI.GetFaces(); + TopTools_MapOfShape aFaces; + int i=1; + for( ; i <= SF->Length(); i++) { + Handle(Standard_Transient) anItem = SF->Value(i); + if(anItem.IsNull()) + continue; + Handle(GEOM_Function) aRefSh = Handle(GEOM_Function)::DownCast(anItem); + if(aRefSh.IsNull()) + continue; + TopoDS_Shape aFace = aRefSh->GetValue(); + if(aFace.IsNull()) + continue; + if(!aFaces.Contains(aFace)) + aFaces.Add(aFace); + } + aShape = GlueFacesByList(aShapeBase, tol3d, aFaces); } if (aShape.IsNull()) return 0; diff --git a/src/GEOMImpl/GEOMImpl_GlueDriver.hxx b/src/GEOMImpl/GEOMImpl_GlueDriver.hxx index 3c78c7bc8..eee00b868 100644 --- a/src/GEOMImpl/GEOMImpl_GlueDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_GlueDriver.hxx @@ -53,6 +53,8 @@ class Handle_Standard_Type; class Handle(TFunction_Driver); class GEOMImpl_GlueDriver; +#include + Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_GlueDriver); class Handle(GEOMImpl_GlueDriver) : public Handle(TFunction_Driver) { @@ -154,6 +156,11 @@ Standard_EXPORT TopoDS_Shape GlueFacesWithWarnings (const TopoDS_Shape& theShape const Standard_Real theTolerance, TCollection_AsciiString& theWarning) const; +Standard_EXPORT static TopoDS_Shape GlueFacesByList (const TopoDS_Shape& theShape, + const Standard_Real theTolerance, + const TopTools_MapOfShape& aFaces); + + // Type management // Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_GlueDriver_Type_(); diff --git a/src/GEOMImpl/GEOMImpl_IGlue.hxx b/src/GEOMImpl/GEOMImpl_IGlue.hxx index 31d0cd2d4..7670ed70a 100644 --- a/src/GEOMImpl/GEOMImpl_IGlue.hxx +++ b/src/GEOMImpl/GEOMImpl_IGlue.hxx @@ -22,8 +22,11 @@ #include "GEOM_Function.hxx" +#include + #define GLUE_ARG_BASE 1 #define GLUE_ARG_TOLER 2 +#define GLUE_ARG_FACES 3 class GEOMImpl_IGlue { @@ -41,6 +44,12 @@ class GEOMImpl_IGlue Standard_Real GetTolerance() { return _func->GetReal(GLUE_ARG_TOLER); } + void SetFaces(const Handle(TColStd_HSequenceOfTransient)& theShapes) + { _func->SetReferenceList(GLUE_ARG_FACES, theShapes); } + + Handle(TColStd_HSequenceOfTransient) GetFaces() + { return _func->GetReferenceList(GLUE_ARG_FACES); } + private: Handle(GEOM_Function) _func; diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx index 54d7d9aef..28cae6290 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx @@ -43,6 +43,10 @@ #include "GEOMAlgo_FinderShapeOn2.hxx" #include "GEOMAlgo_ClsfBox.hxx" //#include "GEOMAlgo_ClsfSurf.hxx" +#include "GEOMAlgo_Gluer1.hxx" +#include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx" +#include "GEOMAlgo_CoupleOfShapes.hxx" +#include "GEOMAlgo_ListOfCoupleOfShapes.hxx" #include "utilities.h" #include "OpUtil.hxx" @@ -548,6 +552,170 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFaces return aGlued; } +//============================================================================= +/*! + * GetGlueFaces + */ +//============================================================================= +Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueFaces + (Handle(GEOM_Object) theShape, + const Standard_Real theTolerance) +{ + SetErrorCode(KO); + + if (theShape.IsNull()) return NULL; + TopoDS_Shape aShape = theShape->GetValue(); + if (aShape.IsNull()) return NULL; + + Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; + + Standard_Integer iErr; + TopoDS_Shape aS; + GEOMAlgo_Gluer1 aGluer; + GEOMAlgo_ListIteratorOfListOfCoupleOfShapes aItCS; + GEOMAlgo_CoupleOfShapes aCS; + GEOMAlgo_ListOfCoupleOfShapes aLCS; + + //aGluer = new GEOMAlgo_Gluer1; + aGluer.SetShape(aShape); + aGluer.SetTolerance(theTolerance); + aGluer.Perform(); + iErr = aGluer.ErrorStatus(); + if (iErr) return NULL; + + TopTools_ListOfShape listShape; + const GEOMAlgo_ListOfCoupleOfShapes& aLCSG = aGluer.GluedFaces(); + // Access to faces + aItCS.Initialize(aLCSG); + for (; aItCS.More(); aItCS.Next()) { + const GEOMAlgo_CoupleOfShapes& aCSG = aItCS.Value(); + listShape.Append(aCSG.Shape1()); + } + + TopTools_ListIteratorOfListOfShape itSub (listShape); + TCollection_AsciiString anAsciiList, anEntry; + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aShape, anIndices); + Handle(TColStd_HArray1OfInteger) anArray; + Handle(GEOM_Object) anObj; + for (int index = 1; itSub.More(); itSub.Next(), ++index) { + TopoDS_Shape aValue = itSub.Value(); + 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(); + pd << "] = geompy.GetGlueFaces" << theShape << ", " << theTolerance << ")"; + + SetErrorCode(OK); + + return aSeq; +} + + +//============================================================================= +/*! + * MakeGlueFacesByList + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList + (Handle(GEOM_Object) theShape, + const Standard_Real theTolerance, + list theFaces) +{ + 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_FACES_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); + Handle(TColStd_HSequenceOfTransient) aFaces = new TColStd_HSequenceOfTransient; + list::iterator it = theFaces.begin(); + for (; it != theFaces.end(); it++) { + Handle(GEOM_Function) aRefSh = (*it)->GetLastFunction(); + if (aRefSh.IsNull()) { + SetErrorCode("NULL argument shape for the shape construction"); + return NULL; + } + aFaces->Append(aRefSh); + } + aCI.SetFaces(aFaces); + + //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 faces"); + 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.MakeGlueFacesByList(" + << theShape << ", " << theTolerance << ", ["; + // Faces + it = theFaces.begin(); + if (it != theFaces.end()) { + pd << (*it++); + while (it != theFaces.end()) { + pd << ", " << (*it++); + } + } + pd << "])"; + + + // to provide warning + if (!isWarning) SetErrorCode(OK); + return aGlued; +} + + + //============================================================================= /*! * MakeExplode diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx index 909b4438a..42d2ed991 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.hxx @@ -60,7 +60,14 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) MakeCompound (list theShapes); Standard_EXPORT Handle(GEOM_Object) MakeGlueFaces (Handle(GEOM_Object) theShape, - const Standard_Real theTolerance); + 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, + list theFaces); Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakeExplode (Handle(GEOM_Object) theShape, const Standard_Integer theShapeType, diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx index 2e0170267..adf629917 100755 --- a/src/GEOMImpl/GEOMImpl_Types.hxx +++ b/src/GEOMImpl/GEOMImpl_Types.hxx @@ -223,6 +223,7 @@ #define BASIC_FILLING 1 #define GLUE_FACES 1 +#define GLUE_FACES_BY_LIST 2 #define SKETCHER_NINE_DOUBLS 1 #define SKETCHER_PLANE 2 diff --git a/src/GEOM_I/GEOM_IShapesOperations_i.cc b/src/GEOM_I/GEOM_IShapesOperations_i.cc index b9893fd9c..b3edf98db 100644 --- a/src/GEOM_I/GEOM_IShapesOperations_i.cc +++ b/src/GEOM_I/GEOM_IShapesOperations_i.cc @@ -354,6 +354,92 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces return GetObject(anObject); } + +//============================================================================= +/*! + * GetGlueFaces + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueFaces + (GEOM::GEOM_Object_ptr theShape, + const CORBA::Double theTolerance) +{ + GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL) return aSeq._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + if (aShape.IsNull()) return aSeq._retn(); + + Handle(TColStd_HSequenceOfTransient) aHSeq = + GetOperations()->GetGlueFaces(aShape, theTolerance); + + //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(); +} + + +//============================================================================= +/*! + * MakeGlueFacesByList + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList + (GEOM::GEOM_Object_ptr theShape, + const CORBA::Double theTolerance, + const GEOM::ListOfGO& theFaces) +{ + GEOM::GEOM_Object_var aGEOMObject; + + //Set a not done flag + GetOperations()->SetNotDone(); + + if (theShape == NULL) return aGEOMObject._retn(); + + //Get the reference objects + Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject + (theShape->GetStudyID(), theShape->GetEntry()); + + if (aShape.IsNull()) return aGEOMObject._retn(); + + int ind, aLen; + list aFaces; + //Get the shapes + aLen = theFaces.length(); + for (ind = 0; ind < aLen; ind++) { + if (theFaces[ind] == NULL) return aGEOMObject._retn(); + Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject + (theFaces[ind]->GetStudyID(), theFaces[ind]->GetEntry()); + if (aSh.IsNull()) return aGEOMObject._retn(); + aFaces.push_back(aSh); + } + + //Perform the gluing + Handle(GEOM_Object) anObject = + GetOperations()->MakeGlueFacesByList(aShape, theTolerance, aFaces); + //if (!GetOperations()->IsDone() || anObject.IsNull()) + // to allow warning + if (anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); +} + + //============================================================================= /*! * MakeExplode diff --git a/src/GEOM_I/GEOM_IShapesOperations_i.hh b/src/GEOM_I/GEOM_IShapesOperations_i.hh index 2b70daead..98e4e4e3e 100644 --- a/src/GEOM_I/GEOM_IShapesOperations_i.hh +++ b/src/GEOM_I/GEOM_IShapesOperations_i.hh @@ -62,6 +62,13 @@ class GEOM_IShapesOperations_i : GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape, CORBA::Double theTolerance); + GEOM::ListOfGO* GetGlueFaces (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theTolerance); + + GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theTolerance, + const GEOM::ListOfGO& theFaces); + GEOM::ListOfGO* MakeExplode (GEOM::GEOM_Object_ptr theShape, CORBA::Long theShapeType, CORBA::Boolean isSorted); diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index 24b2f0f11..299d9f550 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -1678,7 +1678,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCompound (GEOM::GEOM_List_ptr theShapes // MakeGlueFaces: //============================================================================= GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFaces (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theTolerance) + CORBA::Double theTolerance) { beginService( " GEOM_Superv_i::MakeGlueFaces" ); MESSAGE("GEOM_Superv_i::MakeGlueFaces"); @@ -1688,6 +1688,37 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFaces (GEOM::GEOM_Object_ptr theSha return anObj; } +//============================================================================= +// GetGlueFaces: +//============================================================================= +GEOM::GEOM_List_ptr GEOM_Superv_i::GetGlueFaces (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theTolerance) +{ + beginService( " GEOM_Superv_i::GetGlueFaces" ); + MESSAGE("GEOM_Superv_i::GetGlueFaces"); + getShapesOp(); + GEOM::ListOfGO* aList = myShapesOp->GetGlueFaces(theShape, theTolerance); + GEOM_List_i* aListPtr = new GEOM_List_i(*(aList)); + MESSAGE(" List of "<GetList().length()<<" element(s)"); + endService( " GEOM_Superv_i::GetGlueFaces" ); + return aListPtr->_this(); +} + +//============================================================================= +// MakeGlueFacesByList: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theTolerance, + const GEOM::ListOfGO& theFaces) +{ + beginService( " GEOM_Superv_i::MakeGlueFacesByList" ); + MESSAGE("GEOM_Superv_i::MakeGlueFacesByList"); + getShapesOp(); + GEOM::GEOM_Object_ptr anObj = myShapesOp->MakeGlueFacesByList(theShape, theTolerance, theFaces); + endService( " GEOM_Superv_i::MakeGlueFacesByList" ); + return anObj; +} + //============================================================================= // MakeExplode: //============================================================================= diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh index 3ec66530b..298a01ede 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.hh +++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh @@ -378,7 +378,12 @@ public: GEOM::GEOM_Object_ptr MakeSolidShells (GEOM::GEOM_List_ptr theShells); GEOM::GEOM_Object_ptr MakeCompound (GEOM::GEOM_List_ptr theShapes); GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape, - CORBA::Double theTolerance); + CORBA::Double theTolerance); + GEOM::GEOM_List_ptr GetGlueFaces (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theTolerance); + GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape, + CORBA::Double theTolerance, + const GEOM::ListOfGO& theFaces); GEOM::GEOM_List_ptr MakeExplode (GEOM::GEOM_Object_ptr theShape, CORBA::Long theShapeType, CORBA::Boolean isSorted); diff --git a/src/GEOM_SWIG/geompy.py b/src/GEOM_SWIG/geompy.py index ce42e671b..089a39c6b 100644 --- a/src/GEOM_SWIG/geompy.py +++ b/src/GEOM_SWIG/geompy.py @@ -1387,6 +1387,38 @@ def MakeGlueFaces(theShape, theTolerance): print "MakeGlueFaces : ", ShapesOp.GetErrorCode() return anObj + +## Find coincident faces in theShape for possible gluing. +# @param theShape Initial shape. +# @param theTolerance Maximum distance between faces, +# which can be considered as coincident. +# @return ListOfGO. +# +# Example: see GEOM_Spanner.py +def GetGlueFaces(theShape, theTolerance): + anObj = ShapesOp.GetGlueFaces(theShape, theTolerance) + if ShapesOp.IsDone() == 0: + print "GetGlueFaces : ", ShapesOp.GetErrorCode() + return anObj + + +## Replace coincident faces in theShape by one face +# in compliance with given list of faces +# @param theShape Initial shape. +# @param theTolerance Maximum distance between faces, +# which can be considered as coincident. +# @param theFaces List of faces for gluing. +# @return New GEOM_Object, containing a copy of theShape +# without some faces. +# +# Example: see GEOM_Spanner.py +def MakeGlueFacesByList(theShape, theTolerance, theFaces): + anObj = ShapesOp.MakeGlueFacesByList(theShape, theTolerance, theFaces) + if ShapesOp.IsDone() == 0: + print "MakeGlueFacesByList : ", ShapesOp.GetErrorCode() + return anObj + + # ----------------------------------------------------------------------------- # Boolean (Common, Cut, Fuse, Section) # -----------------------------------------------------------------------------