Salome HOME
PAL7508: Development of GetInPlace() functionality
authorjfa <jfa@opencascade.com>
Thu, 27 Jan 2005 15:22:36 +0000 (15:22 +0000)
committerjfa <jfa@opencascade.com>
Thu, 27 Jan 2005 15:22:36 +0000 (15:22 +0000)
18 files changed:
src/GEOM/GEOM_Function.cxx
src/GEOM/GEOM_Function.hxx
src/GEOMAlgo/GEOMAlgo_Gluer.cdl
src/GEOMAlgo/GEOMAlgo_Gluer.cxx
src/GEOMAlgo/GEOMAlgo_Gluer.hxx
src/GEOMAlgo/GEOMAlgo_Gluer.jxx
src/GEOMImpl/GEOMImpl_GlueDriver.cxx
src/GEOMImpl/GEOMImpl_IHealingOperations.cxx
src/GEOMImpl/GEOMImpl_IShapesOperations.cxx
src/GEOMImpl/GEOMImpl_ITranslate.hxx
src/GEOMImpl/GEOMImpl_PartitionDriver.cxx
src/GEOM_SWIG/GEOM_TestOthers.py
src/GEOM_SWIG/geompy.py
src/NMTAlgo/NMTAlgo_Builder.cxx
src/NMTAlgo/NMTAlgo_Splitter.cdl
src/NMTAlgo/NMTAlgo_Splitter.cxx
src/NMTAlgo/NMTAlgo_Splitter.hxx
src/NMTAlgo/NMTAlgo_Splitter_2.cxx

index e11f8cf7b0c84965aad888bfda7cbe2fb15fbccf..4112c03ad2c0cb3f8b6216132a91e648fe7c2d8a 100644 (file)
@@ -7,6 +7,7 @@ using namespace std;
 #include "utilities.h"
 
 #include <TDF.hxx>
+#include <TDF_Tool.hxx>
 #include <TDF_Data.hxx>
 #include <TDF_ChildIterator.hxx>
 #include <TDF_Reference.hxx>
@@ -25,6 +26,8 @@ using namespace std;
 #include <TNaming_NamedShape.hxx>
 #include <TNaming_Builder.hxx>
 
+#include <TColStd_ListOfInteger.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
 #include <TColStd_HArray1OfReal.hxx>
 #include <TColStd_HArray1OfInteger.hxx>
 #include <TColStd_HSequenceOfTransient.hxx>
@@ -36,6 +39,8 @@ using namespace std;
 #define ARGUMENT_LABEL 1
 #define RESULT_LABEL 2
 #define DESCRIPTION_LABEL 3
+#define HISTORY_LABEL 4
+
 #define ARGUMENTS _label.FindChild((ARGUMENT_LABEL))
 #define ARGUMENT(thePosition) _label.FindChild((ARGUMENT_LABEL)).FindChild((thePosition))
 #define SUB_ARGUMENT(thePos1, thePos2) _label.FindChild((ARGUMENT_LABEL)).FindChild((thePos1)).FindChild((thePos2))
@@ -542,38 +547,38 @@ Handle(TColStd_HSequenceOfTransient) GEOM_Function::GetReferenceList(int thePosi
  *  SetShape
  */
 //=============================================================================
-void GEOM_Function::SetShape(int thePosition, const TopoDS_Shape& theShape)
-{
-  _isDone = false;
-  if(thePosition <= 0 || theShape.IsNull()) return;
-
-  TDF_Label anArgLabel = ARGUMENT(thePosition);
-  TNaming_Builder aBuilder(anArgLabel);
-  aBuilder.Generated(theShape);
-
-  _isDone = true;
-  return;
-}
-
+//void GEOM_Function::SetShape(int thePosition, const TopoDS_Shape& theShape)
+//{
+//  _isDone = false;
+//  if(thePosition <= 0 || theShape.IsNull()) return;
+//
+//  TDF_Label anArgLabel = ARGUMENT(thePosition);
+//  TNaming_Builder aBuilder(anArgLabel);
+//  aBuilder.Generated(theShape);
+//
+//  _isDone = true;
+//  return;
+//}
+//
 //=============================================================================
 /*!
  *  GetShape
  */
 //=============================================================================
-TopoDS_Shape GEOM_Function::GetShape(int thePosition)
-{
-  _isDone = false;
-  TopoDS_Shape aShape;
-  if(thePosition <= 0) return aShape;
-
-  TDF_Label anArgLabel = ARGUMENT(thePosition);
-  Handle(TNaming_NamedShape) aNS;
-  if(!anArgLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) return aShape;
-
-  aShape = aNS->Get();
-  _isDone = true;
-  return aShape;
-}
+//TopoDS_Shape GEOM_Function::GetShape(int thePosition)
+//{
+//  _isDone = false;
+//  TopoDS_Shape aShape;
+//  if(thePosition <= 0) return aShape;
+//
+//  TDF_Label anArgLabel = ARGUMENT(thePosition);
+//  Handle(TNaming_NamedShape) aNS;
+//  if(!anArgLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) return aShape;
+//
+//  aShape = aNS->Get();
+//  _isDone = true;
+//  return aShape;
+//}
 
 
 //=============================================================================
@@ -589,6 +594,49 @@ void GEOM_Function::GetDependency(TDF_LabelSequence& theSeq)
   }
 }
 
+//=============================================================================
+/*!
+ *  GetHistoryEntry
+ */
+//=============================================================================
+TDF_Label GEOM_Function::GetHistoryEntry (const Standard_Boolean create)
+{
+  return _label.FindChild(HISTORY_LABEL, create);
+}
+
+//=============================================================================
+/*!
+ *  GetArgumentHistoryEntry
+ */
+//=============================================================================
+TDF_Label GEOM_Function::GetArgumentHistoryEntry (const TDF_Label&       theArgumentRefEntry,
+                                                  const Standard_Boolean create)
+{
+  TColStd_ListOfInteger anArgumentRefTags;
+  TDF_Tool::TagList(theArgumentRefEntry, anArgumentRefTags);
+  Standard_Integer anArgumentRefLabelPos = anArgumentRefTags.Extent();
+
+  TDF_Label aHistoryLabel = GetHistoryEntry(create);
+  if (aHistoryLabel.IsNull())
+    return aHistoryLabel;
+  Standard_Integer aHistoryLabelPos = aHistoryLabel.Depth() + 1;
+
+  Standard_Integer itag;
+  TDF_Label aHistoryCurLabel = aHistoryLabel;
+  TColStd_ListIteratorOfListOfInteger aListIter (anArgumentRefTags);
+  for (itag = 1; itag <= aHistoryLabelPos; itag++) {
+    aListIter.Next();
+  }
+  for (; itag <= anArgumentRefLabelPos; itag++) {
+    aHistoryCurLabel = aHistoryCurLabel.FindChild(aListIter.Value(), create);
+    if (aHistoryCurLabel.IsNull())
+      return aHistoryCurLabel;
+    aListIter.Next();
+  }
+
+  return aHistoryCurLabel;
+}
+
 //=======================================================================
 //function :  GEOM_Function_Type_
 //purpose  :
index be5c192f14ec82d61df23e3061830675cc0e7f17..92879bf0c20ecdd70f42c3b653e5b91f4c32862f 100644 (file)
@@ -222,16 +222,24 @@ public:
   Handle(TColStd_HSequenceOfTransient) GetReferenceList (int thePosition); 
 
   //Sets a TopoDS_Shape argument at position thePosition
-  void SetShape(int thePosition, const TopoDS_Shape& theShape);
+  //void SetShape(int thePosition, const TopoDS_Shape& theShape);
     
   //Returns a TopoDS_Shape argument at position thePosition
-  TopoDS_Shape GetShape(int thePosition);  
+  //TopoDS_Shape GetShape(int thePosition);  
   
   //Returns true if the last method succided 
   bool IsDone() { return _isDone; }
 
   //Returns a sequence of the external dependencies of this function
- void GetDependency(TDF_LabelSequence& theSeq);
+  void GetDependency(TDF_LabelSequence& theSeq);
+
+  //Returns top label of this function's history tree
+  TDF_Label GetHistoryEntry (const Standard_Boolean create = Standard_True);
+
+  //Returns history label, corresponding to the label,
+  //on which a reference on argument is stored
+  TDF_Label GetArgumentHistoryEntry (const TDF_Label&       theArgumentRefEntry,
+                                     const Standard_Boolean create = Standard_True);
 
 private:
 
index a28e365efb8ab2e40169c5f984a4fec57b6faeab..a8c778b6ebf11cf04c2e6f2e6314e151616d20ce 100755 (executable)
@@ -41,6 +41,22 @@ is
     AloneShapes(me) 
         returns Integer from Standard;     
 
+    --modified by NIZNHY-PKV Fri Jan 21 14:16:58 2005f-
+    Modified(me:out;  
+           S : Shape from TopoDS) 
+       returns ListOfShape from TopTools;
+    ---C++: return const & 
+   
+    Generated(me:out;  
+           S : Shape from TopoDS) 
+       returns ListOfShape from TopTools;
+    ---C++: return const & 
+
+    IsDeleted (me:out;  
+           S : Shape from TopoDS)
+       returns Boolean from Standard; 
+    --modified by NIZNHY-PKV Fri Jan 21 14:17:04 2005t  
+
     CheckData(me:out) 
        is redefined protected; 
         
@@ -97,6 +113,11 @@ is
            aFR : Face from TopoDS;  
            aF  : Face from TopoDS) 
        returns Boolean from Standard        
+       is protected;  
+     
+    HasNewSubShape(me; 
+           aS  : Shape from TopoDS) 
+       returns Boolean from Standard        
        is protected; 
 -- 
     Images(me) 
@@ -113,5 +134,8 @@ fields
     myImages      : DataMapOfShapeListOfShape from TopTools is protected;   
     myOrigins     : DataMapOfShapeShape from TopTools is protected; 
     myNbAlone     : Integer from Standard is protected;      
-    
+----    
+    myGenerated   : ListOfShape from TopTools is protected;
+----    
+
 end Gluer;
index bd497c1f3b9a61731968d89cc3d916aae4998777..b63e99eea9c94b7e75bbfb7c9d8a5408ea914834 100755 (executable)
@@ -32,6 +32,7 @@
 #include <TopoDS_Wire.hxx>
 #include <TopoDS_Shell.hxx>
 #include <TopoDS_Solid.hxx>
+#include <TopoDS_Iterator.hxx>
 
 #include <TopTools_IndexedMapOfShape.hxx>
 #include <TopTools_ListOfShape.hxx>
 #include <GEOMAlgo_IndexedDataMapOfPassKeyListOfShape.hxx>
 #include <GEOMAlgo_PassKey.hxx>
 #include <GEOMAlgo_Tools.hxx>
+//
+
+static 
+  void GetSubShapes(const TopoDS_Shape& aS,
+                   TopTools_IndexedMapOfShape& aMSS);
 
 //=======================================================================
 //function : GEOMAlgo_Gluer
@@ -318,7 +324,7 @@ void GEOMAlgo_Gluer::MakeSolids()
   //
   aNbS=aMS.Extent();
   if (aNbS) {
-    Standard_Real aTol=1.e-7;
+    //Standard_Real aTol=1.e-7;
     BOP_CorrectTolerances::CorrectCurveOnSurface(myResult);
   }
 }
@@ -394,6 +400,7 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType)
 {
   myErrorStatus=0;
   //
+  Standard_Boolean bHasNewSubShape;
   Standard_Integer i, aNbF, aNbSDF, iErr;
   TopoDS_Shape aNewShape;
   TopTools_IndexedMapOfShape aMF;
@@ -442,6 +449,7 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType)
   }
   //
   // Images/Origins
+  //
   aNbF=aMPKLF.Extent();
   for (i=1; i<=aNbF; ++i) {
     const TopTools_ListOfShape& aLSDF=aMPKLF(i);
@@ -451,19 +459,36 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType)
     }
     //
     const TopoDS_Shape& aS1=aLSDF.First();
-    if (aType==TopAbs_FACE) {
-      TopoDS_Face aNewFace;
-      //
-      const TopoDS_Face& aF1=TopoDS::Face(aS1);
-      MakeFace(aF1, aNewFace);
-      aNewShape=aNewFace;
+    //
+    //modified by NIZNHY-PKV Fri Jan 21 15:34:00 2005 f
+    //
+    bHasNewSubShape=Standard_True;
+    // prevent creation of a new shape if there are not
+    // new subshapes of aSS among the originals
+    if (aNbSDF==1) {
+      bHasNewSubShape=HasNewSubShape(aS1);
+      if (!bHasNewSubShape) {
+       aNewShape=aS1;
+       aNewShape.Orientation(TopAbs_FORWARD);
+      }
     }
-    else if (aType==TopAbs_EDGE) {
-      TopoDS_Edge aNewEdge;
-      //
-      const TopoDS_Edge& aE1=TopoDS::Edge(aS1);
-      MakeEdge(aE1, aNewEdge);
-      aNewShape=aNewEdge;
+    //modified by NIZNHY-PKV Fri Jan 21 15:34:05 2005 t
+    //
+    if (bHasNewSubShape) {//modified by NIZNHY-PKV Fri Jan 21 15:34:10 2005ft 
+      if (aType==TopAbs_FACE) {
+       TopoDS_Face aNewFace;
+       //
+       const TopoDS_Face& aF1=TopoDS::Face(aS1);
+       MakeFace(aF1, aNewFace);
+       aNewShape=aNewFace;
+      }
+      else if (aType==TopAbs_EDGE) {
+       TopoDS_Edge aNewEdge;
+       //
+       const TopoDS_Edge& aE1=TopoDS::Edge(aS1);
+       MakeEdge(aE1, aNewEdge);
+       aNewShape=aNewEdge;
+      }
     }
     //
     myImages.Bind(aNewShape, aLSDF);
@@ -676,7 +701,6 @@ void GEOMAlgo_Gluer::MakeVertex(const TopTools_ListOfShape& aLV,
 void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE, 
                              TopoDS_Edge& aNewEdge)
 {
-  //modified by NIZNHY-PKV Thu Dec 30 11:15:23 2004 f
   myErrorStatus=0;
   //
   Standard_Boolean bIsDE;
@@ -723,7 +747,6 @@ void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE,
   else {
     BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge); 
   }
-  //modified by NIZNHY-PKV Thu Dec 30 11:15:28 2004 t
 }
 //
 //=======================================================================
@@ -766,7 +789,7 @@ void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF,
       aER=TopoDS::Edge(myOrigins.Find(aE));
       //
       aER.Orientation(TopAbs_FORWARD);
-      if (!BRep_Tool::Degenerated(aER)) {//modified by NIZNHY-PKV Thu Dec 30 11:31:37 2004 ft
+      if (!BRep_Tool::Degenerated(aER)) {
        // build p-curve
        if (bIsUPeriodic) {
          GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax);
@@ -808,11 +831,11 @@ Standard_Boolean GEOMAlgo_Gluer::IsToReverse(const TopoDS_Face& aFR,
   aExp.Init(aF, TopAbs_EDGE);
   for (; aExp.More(); aExp.Next()) {
     const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current());
-    //modified by NIZNHY-PKV Thu Dec 30 11:38:05 2004 f
+    //
     if (BRep_Tool::Degenerated(aE)) {
       continue;
     }
-    //modified by NIZNHY-PKV Thu Dec 30 11:38:08 2004 t
+    //
     const TopoDS_Edge& aER=TopoDS::Edge(myOrigins.Find(aE));
     //
     aC3D=BRep_Tool::Curve(aE, aT1, aT2);
@@ -836,7 +859,111 @@ Standard_Boolean GEOMAlgo_Gluer::IsToReverse(const TopoDS_Face& aFR,
   return bRet;
 }
 //
-
+//modified by NIZNHY-PKV Fri Jan 21 10:55:42 2005 f
+//=======================================================================
+//function : HasNewSubShape
+//purpose  : 
+//=======================================================================
+Standard_Boolean GEOMAlgo_Gluer::HasNewSubShape(const TopoDS_Shape& aS)const
+{
+  Standard_Boolean bRet;
+  Standard_Integer i, aNbSS;
+  TopTools_IndexedMapOfShape aMSS;
+  //
+  GetSubShapes(aS, aMSS);
+  //
+  bRet=Standard_False;
+  aNbSS=aMSS.Extent();
+  for (i=1; i<=aNbSS; ++i) {
+    const TopoDS_Shape& aSS=aMSS(i);
+    if (aSS.ShapeType()==TopAbs_WIRE) {
+      continue;
+    }
+    //
+    bRet=!myOrigins.IsBound(aSS);
+    if (bRet) {
+      return bRet;
+    }
+    //
+    const TopoDS_Shape& aSSIm=myOrigins.Find(aSS);
+    bRet=!aSSIm.IsSame(aSS);
+    if (bRet) {
+      return bRet;
+    }
+  }
+  return bRet;
+}
+//=======================================================================
+//function : GetSubShapes
+//purpose  : 
+//=======================================================================
+void GetSubShapes(const TopoDS_Shape& aS,
+                 TopTools_IndexedMapOfShape& aMSS)
+{
+  Standard_Integer aR;
+  TopAbs_ShapeEnum aType;
+  TopoDS_Iterator aIt;
+  //
+  aType=aS.ShapeType();
+  aR=(Standard_Integer)aType+1;
+  if (aR>TopAbs_VERTEX) {
+    return;
+  }
+  //
+  aIt.Initialize(aS);
+  for (; aIt.More(); aIt.Next()) {
+    const TopoDS_Shape& aSS=aIt.Value();
+    aMSS.Add(aSS);
+    GetSubShapes(aSS, aMSS);
+  }
+}
+//=======================================================================
+//function : Modified
+//purpose  : 
+//=======================================================================
+const TopTools_ListOfShape& GEOMAlgo_Gluer::Modified (const TopoDS_Shape& aS) 
+{
+  TopAbs_ShapeEnum aType;
+  //
+  myGenerated.Clear();
+  //
+  aType=aS.ShapeType();
+  if (aType==TopAbs_FACE || 
+      aType==TopAbs_EDGE || 
+      aType==TopAbs_VERTEX) {
+    if(myOrigins.IsBound(aS)) {
+      const TopoDS_Shape& aSnew=myOrigins.Find(aS);
+      if (!aSnew.IsSame(aS)) {
+       myGenerated.Append(aSnew);
+      }
+    }
+  }
+  //
+  return myGenerated;
+}
+//=======================================================================
+//function : Generated
+//purpose  : 
+//=======================================================================
+const TopTools_ListOfShape& GEOMAlgo_Gluer::Generated(const TopoDS_Shape& )
+{
+  myGenerated.Clear();
+  return myGenerated;
+}
+//=======================================================================
+//function : IsDeleted
+//purpose  : 
+//=======================================================================
+Standard_Boolean GEOMAlgo_Gluer::IsDeleted (const TopoDS_Shape& aS)
+{
+  Standard_Boolean bRet=Standard_False;
+  //
+  const TopTools_ListOfShape& aL=Modified(aS);
+  bRet=!aL.IsEmpty();
+  //
+  return bRet;
+}
+//modified by NIZNHY-PKV Fri Jan 21 10:59:21 2005 t
 //
 // ErrorStatus
 //
@@ -854,37 +981,3 @@ Standard_Boolean GEOMAlgo_Gluer::IsToReverse(const TopoDS_Face& aFR,
 //
 // 1   - some shapes can not be glued by faces
 //
-/*
-//=======================================================================
-//function : BuildResult
-//purpose  : 
-//=======================================================================
-void GEOMAlgo_Gluer::BuildResult()
-{
-  Standard_Boolean bAdded;
-  TopoDS_Compound aCmp;
-  BRep_Builder aBB;
-  TopAbs_ShapeEnum aType;
-  TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
-  //
-  aBB.MakeCompound(aCmp);
-  //
-  bAdded=Standard_False;
-  aItIm.Initialize(myImages);
-  for (; aItIm.More(); aItIm.Next()) {
-    const TopoDS_Shape& aIm=aItIm.Key();
-    aType=aIm.ShapeType();
-    if(aType==TopAbs_SOLID) {
-      bAdded=Standard_True;
-      aBB.Add(aCmp, aIm);
-    }
-  }
-  myResult=aCmp;
-  //
-  if (bAdded) {
-    Standard_Real aTol=1.e-7;
-    BOP_CorrectTolerances::CorrectCurveOnSurface(myResult);
-    //BRepLib::SameParameter(myResult, aTol, bAdded);
-  }
-}
-*/
index af5faefa17fb25e7cfd0a673b1178f02980ea0aa..994b717fa4db6f0d85cf06ec9499f9d5e4a139a5 100644 (file)
 #ifndef _Standard_Integer_HeaderFile
 #include <Standard_Integer.hxx>
 #endif
+#ifndef _TopTools_ListOfShape_HeaderFile
+#include <TopTools_ListOfShape.hxx>
+#endif
 #ifndef _GEOMAlgo_ShapeAlgo_HeaderFile
 #include <GEOMAlgo_ShapeAlgo.hxx>
 #endif
 #ifndef _TopAbs_ShapeEnum_HeaderFile
 #include <TopAbs_ShapeEnum.hxx>
 #endif
+class TopTools_ListOfShape;
+class TopoDS_Shape;
 class TopoDS_Edge;
 class GEOMAlgo_PassKey;
 class TopoDS_Face;
-class TopTools_ListOfShape;
 class TopoDS_Vertex;
 class TopTools_DataMapOfShapeListOfShape;
 class TopTools_DataMapOfShapeShape;
@@ -83,6 +87,9 @@ Standard_EXPORT   void SetCheckGeometry(const Standard_Boolean aFlag) ;
 Standard_EXPORT   Standard_Boolean CheckGeometry() const;
 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;
 
@@ -109,6 +116,7 @@ Standard_EXPORT   void MakeVertex(const TopTools_ListOfShape& aLV,TopoDS_Vertex&
 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
@@ -118,6 +126,7 @@ Standard_Real myTol;
 TopTools_DataMapOfShapeListOfShape myImages;
 TopTools_DataMapOfShapeShape myOrigins;
 Standard_Integer myNbAlone;
+TopTools_ListOfShape myGenerated;
 
 
 private: 
index f56c73fa85d4b9fb1110349bbf1dede74f6b9860..a80b13204d1d45de08ce4f0b911fc0a0921755ae 100644 (file)
@@ -1,3 +1,9 @@
+#ifndef _TopTools_ListOfShape_HeaderFile
+#include <TopTools_ListOfShape.hxx>
+#endif
+#ifndef _TopoDS_Shape_HeaderFile
+#include <TopoDS_Shape.hxx>
+#endif
 #ifndef _TopoDS_Edge_HeaderFile
 #include <TopoDS_Edge.hxx>
 #endif
@@ -7,9 +13,6 @@
 #ifndef _TopoDS_Face_HeaderFile
 #include <TopoDS_Face.hxx>
 #endif
-#ifndef _TopTools_ListOfShape_HeaderFile
-#include <TopTools_ListOfShape.hxx>
-#endif
 #ifndef _TopoDS_Vertex_HeaderFile
 #include <TopoDS_Vertex.hxx>
 #endif
index 8eb0ffb4ffa4a1def4b61d7c36c6411372f6cdb7..f2af73996ccbd8eb19b67bb5c35da707f1d56058 100644 (file)
@@ -4,13 +4,21 @@ using namespace std;
 #include "GEOMImpl_IGlue.hxx"
 #include "GEOMImpl_Types.hxx"
 
+#include "GEOM_Object.hxx"
 #include "GEOM_Function.hxx"
 
 #include "GEOMAlgo_Gluer.hxx"
 
 #include "utilities.h"
 
+#include <TDataStd_IntegerArray.hxx>
+
+#include <TopExp.hxx>
 #include <TopoDS_Shape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+
 #include <Standard_NullObject.hxx>
 #include <Standard_Failure.hxx>
 
@@ -97,6 +105,51 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& the
 
   aRes = aGluer.Result();
 
+  // 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 = aGluer.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;
 }
 
index 144455fce75de8e082ba01a2b310e22cf608d33b..774ef28e29bdcf43734ed50f9e21d5040d281936 100644 (file)
@@ -197,6 +197,8 @@ bool GEOMImpl_IHealingOperations::GetOperatorParameters( const string theOperati
     aMsg += TCollection_AsciiString( nbParamValueErrors );
     MESSAGE(aMsg.ToCString());
   }
+
+  return true;
 }
 
 //=============================================================================
index 6db0d877682c98834e49c54f6896bec4c76e6d35..071b5c3df268681ba5e26ec94a52aa948be6913d 100644 (file)
@@ -27,6 +27,7 @@ using namespace std;
 #include <TFunction_Driver.hxx>
 #include <TFunction_Logbook.hxx>
 #include <TDataStd_Integer.hxx>
+#include <TDataStd_IntegerArray.hxx>
 #include <TDF_Tool.hxx>
 
 #include <BRepExtrema_ExtCF.hxx>
@@ -64,6 +65,8 @@ using namespace std;
 #include <gp_Lin.hxx>
 #include <TColStd_Array1OfReal.hxx>
 #include <TColStd_HArray1OfInteger.hxx>
+#include <TColStd_ListOfInteger.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
 
 //#include <OSD_Timer.hxx>
 
@@ -1383,46 +1386,112 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace
   if (aWhere.IsNull() || aWhat.IsNull()) return NULL;
 
   //Fill array of indices
-  TopTools_IndexedMapOfShape anIndices;
-  TopExp::MapShapes(aWhere, anIndices);
-
-//  Handle(TColStd_HArray1OfInteger) anArray =
-//    new TColStd_HArray1OfInteger (1, listSS.Extent());
-//  TopTools_ListIteratorOfListOfShape itSub (listSS);
-//  for (int index = 1; itSub.More(); itSub.Next(), ++index) {
-//    int id = anIndices.FindIndex(itSub.Value());
-//    anArray->SetValue(index, id);
-//  }
-//  
-//  //Add a new group object
-//  Handle(GEOM_Object) aGroup = GetEngine()->AddSubShape(theShape, anArray);
-//
-//  //Set a GROUP type
-//  aGroup->SetType(GEOM_GROUP);
-//
-//  //Set a sub shape type
-//  TDF_Label aFreeLabel = aGroup->GetFreeLabel();
-//  TDataStd_Integer::Set(aFreeLabel, (Standard_Integer)theShapeType);
-// 
-//  //Make a Python command
-//  TCollection_AsciiString anEntry, aDescr;
-//  TDF_Tool::Entry(aGroup->GetEntry(), anEntry);
-//  aDescr += anEntry;
-//  aDescr += " = IShapesOperations.GetInPlace(";
-//  TDF_Tool::Entry(theShapeWhere->GetEntry(), anEntry);
-//  aDescr += anEntry + ",";
-//  TDF_Tool::Entry(theShapeWhat->GetEntry(), anEntry);
-//  aDescr += anEntry + ")";
-//
-//  Handle(GEOM_Function) aFunction = aGroup->GetFunction(1);
-//  aFunction->SetDescription(aDescr);
-
-//  SetErrorCode(OK);
-//  return aGroup;
-  SetErrorCode("Not yet implemented");
-  return NULL;
-}
+  Handle(TColStd_HArray1OfInteger) aModifiedArray;
+
+  Handle(GEOM_Function) aWhereFunction = theShapeWhere->GetLastFunction();
+
+  TopTools_IndexedMapOfShape aWhereIndices;
+  TopExp::MapShapes(aWhere, aWhereIndices);
+
+  if (aWhereIndices.Contains(aWhat)) {
+
+    // entity was not changed by the operation
+    Standard_Integer aWhatIndex = aWhereIndices.FindIndex(aWhat);
+    aModifiedArray = new TColStd_HArray1OfInteger(1,1);
+    aModifiedArray->SetValue(1, aWhatIndex);
+
+  } else {
+
+    TDF_Label aHistoryLabel = aWhereFunction->GetHistoryEntry(Standard_False);
+    if (aHistoryLabel.IsNull()) {
+      SetErrorCode("History for an operation, produced the shape, does not exist.");
+      return NULL;
+    }
+
+    // search in history for all argument shapes
+    Standard_Boolean isFound = Standard_False;
+
+    TDF_LabelSequence aLabelSeq;
+    aWhereFunction->GetDependency(aLabelSeq);
+    Standard_Integer nbArg = aLabelSeq.Length();
+
+    for (Standard_Integer iarg = 1; iarg <= nbArg && !isFound; 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);
+
+      if (anArgumentIndices.Contains(aWhat)) {
+        isFound = Standard_True;
+        Standard_Integer aWhatIndex = anArgumentIndices.FindIndex(aWhat);
+
+        // Find corresponding label in history
+        TDF_Label anArgumentHistoryLabel =
+          aWhereFunction->GetArgumentHistoryEntry(anArgumentRefLabel, Standard_False);
+        if (anArgumentHistoryLabel.IsNull()) {
+          SetErrorCode("History for this entity does not exist.");
+          return NULL;
+        }
+
+        TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(aWhatIndex, Standard_False);
+        if (aWhatHistoryLabel.IsNull()) {
+          SetErrorCode("History for this entity does not exist.");
+          return NULL;
+        }
+
+        Handle(TDataStd_IntegerArray) anIntegerArray;
+        if (!aWhatHistoryLabel.FindAttribute(TDataStd_IntegerArray::GetID(), anIntegerArray)) {
+          SetErrorCode("Empty history. Possibly, this entity is absent in result.");
+          return NULL;
+        }
 
+        aModifiedArray = anIntegerArray->Array();
+        if (aModifiedArray->Length() == 0) {
+          SetErrorCode("This entity is absent in result.");
+          return NULL;
+        }
+      }
+    }
+
+    if (!isFound) {
+      SetErrorCode("Not found in arguments.");
+      return NULL;
+    }
+  }
+
+  //Add a new object
+  Handle(GEOM_Object) aResult = GetEngine()->AddSubShape(theShapeWhere, aModifiedArray);
+
+  if (aModifiedArray->Length() > 1) {
+    //Set a GROUP type
+    aResult->SetType(GEOM_GROUP);
+
+    //Set a sub shape type
+    TDF_Label aFreeLabel = aResult->GetFreeLabel();
+    TopAbs_ShapeEnum aShapeType = aWhat.ShapeType();
+    TDataStd_Integer::Set(aFreeLabel, (Standard_Integer)aShapeType);
+  }
+
+  //Make a Python command
+  TCollection_AsciiString anEntry, aDescr;
+  TDF_Tool::Entry(aResult->GetEntry(), anEntry);
+  aDescr += anEntry;
+  aDescr += " = IShapesOperations.GetInPlace(";
+  TDF_Tool::Entry(theShapeWhere->GetEntry(), anEntry);
+  aDescr += anEntry + ",";
+  TDF_Tool::Entry(theShapeWhat->GetEntry(), anEntry);
+  aDescr += anEntry + ")";
+
+  Handle(GEOM_Function) aFunction = aResult->GetFunction(1);
+  aFunction->SetDescription(aDescr);
+
+  SetErrorCode(OK);
+  return aResult;
+}
 
 //=======================================================================
 //function : SortShapes
index 886f7744ff242e848d23ad836726cc71ae743890..83566e04da89a3a0d7b520774560050744360f5a 100755 (executable)
@@ -6,14 +6,12 @@
 #define TRANSLATE_ARG_POINT1   1  
 #define TRANSLATE_ARG_POINT2   2
 #define TRANSLATE_ARG_VECTOR   3
-#define TRANSLATE_ARG_REF      4
-#define TRANSLATE_ARG_SHAPE    5
 #define TRANSLATE_ARG_ORIGINAL 6
-#define TRANSLATE_ARG_STEP1      7
-#define TRANSLATE_ARG_NBITER1   8
-#define TRANSLATE_ARG_STEP2      9
-#define TRANSLATE_ARG_NBITER2   10
-#define TRANSLATE_ARG_VECTOR2 11
+#define TRANSLATE_ARG_STEP1    7
+#define TRANSLATE_ARG_NBITER1  8
+#define TRANSLATE_ARG_STEP2    9
+#define TRANSLATE_ARG_NBITER2  10
+#define TRANSLATE_ARG_VECTOR2  11
 #define TRANSLATE_ARG_DX  12
 #define TRANSLATE_ARG_DY  13  
 #define TRANSLATE_ARG_DZ  14  
@@ -36,10 +34,6 @@ class GEOMImpl_ITranslate
   
   Handle(GEOM_Function) GetVector() { return _func->GetReference(TRANSLATE_ARG_VECTOR); } 
   
-  void SetShape(const TopoDS_Shape& theShape) { _func->SetShape(TRANSLATE_ARG_SHAPE, theShape); }
-  
-  TopoDS_Shape GetShape() { return _func->GetShape(TRANSLATE_ARG_SHAPE); }
-
   void SetOriginal(Handle(GEOM_Function) theOriginal) { _func->SetReference(TRANSLATE_ARG_ORIGINAL, theOriginal); }
 
   Handle(GEOM_Function) GetOriginal() { return _func->GetReference(TRANSLATE_ARG_ORIGINAL); }
index 5f284c4884d19b086be14cb5e9ed796de5c51f62..61f3fde20e629c0a510cb0565c9e9d5ee947d79f 100644 (file)
@@ -3,11 +3,17 @@ using namespace std;
 #include "GEOMImpl_PartitionDriver.hxx"
 #include "GEOMImpl_IPartition.hxx"
 #include "GEOMImpl_Types.hxx"
+
+#include "GEOM_Object.hxx"
 #include "GEOM_Function.hxx"
 
 #include <NMTAlgo_Splitter1.hxx>
+
+#include <TDataStd_IntegerArray.hxx>
+
 #include <BRep_Tool.hxx>
 #include <BRepAlgo.hxx>
+
 #include <TopoDS.hxx>
 #include <TopoDS_Shape.hxx>
 #include <TopoDS_Vertex.hxx>
@@ -15,7 +21,10 @@ using namespace std;
 #include <TopAbs.hxx>
 #include <TopExp.hxx>
 #include <TopTools_MapOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
 
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+#include <TColStd_ListOfInteger.hxx>
 #include <Standard_NullObject.hxx>
 #include <Precision.hxx>
 #include <gp_Pnt.hxx>
@@ -52,6 +61,7 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
   Standard_Integer aType = aFunction->GetType();
 
   TopoDS_Shape aShape;
+  NMTAlgo_Splitter1 PS;
 
   if (aType == PARTITION_PARTITION) {
     Handle(TColStd_HSequenceOfTransient) aShapes  = aCI.GetShapes();
@@ -65,7 +75,6 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
     nbshapes += aShapes->Length() + aTools->Length();
     nbshapes += aKeepIns->Length() + aRemIns->Length();
 
-    NMTAlgo_Splitter1 PS;
     TopTools_MapOfShape ShapesMap(nbshapes), ToolsMap(nbshapes);
 
     // add object shapes that are in ListShapes;
@@ -135,11 +144,6 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
       PS.RemoveShapesInside(aShape_i);
     }
 
-    aShape = PS.Shape();
-
-    if (!BRepAlgo::IsValid(aShape)) {
-      Standard_ConstructionError::Raise("Partition aborted : non valid shape result");
-    }
   } else if (aType == PARTITION_HALF) {
     Handle(GEOM_Function) aRefShape = aCI.GetShape();
     Handle(GEOM_Function) aRefPlane = aCI.GetPlane();
@@ -150,8 +154,6 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
       Standard_NullObject::Raise("In Half Partition a shape or a plane is null");
     }
 
-    NMTAlgo_Splitter1 PS;
-
     // add object shapes that are in ListShapes;
     PS.AddShape(aShapeArg);
 
@@ -162,19 +164,61 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
     PS.SetRemoveWebs(Standard_False);
     PS.Build(aShapeArg.ShapeType());
 
-    aShape = PS.Shape();
-
-    if (!BRepAlgo::IsValid(aShape)) {
-      Standard_ConstructionError::Raise("Partition aborted : non valid shape result");
-    }
-  }
-  else {
+  } else {
   }
 
+  aShape = PS.Shape();
   if (aShape.IsNull()) return 0;
 
+  if (!BRepAlgo::IsValid(aShape)) {
+    Standard_ConstructionError::Raise("Partition aborted : non valid shape result");
+  }
+
   aFunction->SetValue(aShape);
 
+  // Fill history to be used by GetInPlace functionality
+  TopTools_IndexedMapOfShape aResIndices;
+  TopExp::MapShapes(aShape, aResIndices);
+
+  // 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 = PS.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);
+        }
+      }
+    }
+  }
+
   log.SetTouched(Label());
 
   return 1;
index 220b37e2431116dfe008da8318a26d1319242351..55429a96be2962a0dd2d53692c7a6ba58dac7406 100644 (file)
@@ -353,3 +353,23 @@ def TestOtherOperations (geompy, math):
     geompy.addToStudy(vertex_i, "Vertex on Sphere (center = (0, 0, 0), r = 100)")
 
   # GetInPlace(theShapeWhere, theShapeWhat)
+  box5 = geompy.MakeBoxDXDYDZ(100, 100, 100)
+  box6 = geompy.MakeTranslation(box5, 50, 50, 0)
+
+  part = geompy.MakePartition([box5], [box6])
+  geompy.addToStudy(part, "Partitioned")
+
+  ibb = 5
+  box_list = [box5, box6]
+  for abox in box_list:
+    geompy.addToStudy(abox, "Box " + `ibb`)
+    box_faces = geompy.SubShapeAll(abox, geompy.ShapeType["FACE"])
+    ifa = 1
+    for aface in box_faces:
+      geompy.addToStudyInFather(abox, aface, "Face" + `ifa`)
+      refl_box_face = geompy.GetInPlace(part, aface)
+      if refl_box_face is not None:
+        geompy.addToStudyInFather(part, refl_box_face,
+                                  "Reflection of Face " + `ifa` + " of box " + `ibb`)
+      ifa = ifa + 1
+    ibb = ibb + 1
index a4a9db5a3e8ee8e255fb5336b5fc5ac849104747..656c22bae6f23deaefec4febb5957b8e171bd8ea 100644 (file)
@@ -2009,7 +2009,7 @@ def MakeHexa2Faces(F1, F2):
       print "MakeHexa2Faces : ", BlocksOp.GetErrorCode()
     return anObj
 
-def MakeHexa2Faces(F1, F2):
+def GetPoint(theShape, theX, theY, theZ, theEpsilon):
     """
      *  Get a vertex, found in the given shape by its coordinates.
      *  \param theShape Block or a compound of blocks.
index c7a902f0634be1c7e36f1fab7780d7fea680ac06..315b36b6818feb42ead8552188a455161e37d833 100644 (file)
       continue;
     }
     //
+    //modified by NIZNHY-PKV Fri Jan 21 17:01:10 2005 f
+    if (aNbSp==1) {
+      const BOPTools_PaveBlock& aPB1=aLPB.First();
+      const BOPTools_PaveBlock& aPBR1=pPF->RealPaveBlock(aPB1);
+      nSp=aPBR1.Edge();
+      const TopoDS_Shape& aSp1=aDS.Shape(nSp);
+      if (aSp1.IsSame(aE)) {
+       continue;
+      }
+    }
+    //modified by NIZNHY-PKV Fri Jan 21 17:01:14 2005 t
+    //
     aLSp.Clear();
     aIt.Initialize(aLPB);
     for (; aIt.More(); aIt.Next()) {
index 761c051f3769b732d613564f2796df0d23e1000f..c928426df642b1977be79b3a2e6fc4de84fbb296 100644 (file)
@@ -19,7 +19,8 @@ uses
     Shape               from TopoDS,
     MapOfOrientedShape  from TopTools,
     IndexedMapOfShape   from TopTools,
-    DataMapOfShapeShape from TopTools,
+    DataMapOfShapeShape from TopTools, 
+    DataMapOfShapeListOfShape from TopTools,
     ListOfShape         from TopTools,
     MapOfShape          from TopTools,
     AsDes               from BRepAlgo,
@@ -166,5 +167,8 @@ fields
     myMapSIFC      : DataMapOfShapeShape from TopTools is protected;  
 ----vv    
     myGenerated    : ListOfShape         from TopTools is protected;
+    --modified by NIZNHY-PKV Mon Jan 24 09:45:10 2005f 
+    myModifiedFaces: DataMapOfShapeListOfShape from TopTools is protected;     
+    --modified by NIZNHY-PKV Mon Jan 24 09:45:14 2005t 
 ----^^
 end Splitter;
index 83b82b84d54138d0ababbc374e6b8bb715130187..9b85beebc7185875de7afc54c8cf9e1cc6b7ab2d 100644 (file)
@@ -114,6 +114,9 @@ static
   myObjShapes.Clear();
   myToolShapes.Clear();
   myMapSIFC.Clear();
+  //modified by NIZNHY-PKV Mon Jan 24 09:47:37 2005f
+  myModifiedFaces.Clear();
+  //modified by NIZNHY-PKV Mon Jan 24 09:47:41 2005t
   myErrorStatus=0;
 }
 //=======================================================================
@@ -472,10 +475,13 @@ static
   TopTools_ListIteratorOfListOfShape aItS, aItFI;
   TopExp_Explorer aExp;
   TopAbs_Orientation aOriFS; 
-  TopoDS_Face aFIx;
+  TopoDS_Face aFIx, aFIy;
   BRep_Builder aBB;
   //
   myImageShape.Clear();
+  //modified by NIZNHY-PKV Mon Jan 24 09:48:15 2005f
+  myModifiedFaces.Clear();
+  //modified by NIZNHY-PKV Mon Jan 24 09:48:18 2005t
   //
   aItS.Initialize(myListShapes);
   for ( ;aItS.More(); aItS.Next()) {
@@ -490,6 +496,14 @@ static
       //
       if (!myImagesFaces.HasImage(aFS)) {
        myQueryShapes.Add(aFS);
+       //modified by NIZNHY-PKV Mon Jan 24 09:50:42 2005 f
+       if (!myModifiedFaces.IsBound(aFS)) {
+         TopTools_ListOfShape aLS;
+         //
+         aLS.Append(aFS);
+         myModifiedFaces.Bind(aFS, aLS);
+       }
+       //modified by NIZNHY-PKV Mon Jan 24 09:50:44 2005 t
        continue;
       }
       //
@@ -510,10 +524,28 @@ static
            aFSDIx.Reverse();
          }
          myQueryShapes.Add(aFSDIx);
+         //modified by NIZNHY-PKV Mon Jan 24 09:56:06 2005f
+         aFIy=aFSDIx;
+         //modified by NIZNHY-PKV Mon Jan 24 09:56:09 2005t
        }
        else {
          myQueryShapes.Add(aFIx);
+         //modified by NIZNHY-PKV Mon Jan 24 09:56:06 2005f
+         aFIy=aFIx;
+         //modified by NIZNHY-PKV Mon Jan 24 09:56:09 2005t
+       }
+       //modified by NIZNHY-PKV Mon Jan 24 09:53:38 2005f
+       if (!myModifiedFaces.IsBound(aFS)) {
+         TopTools_ListOfShape aLS;
+         //
+         aLS.Append(aFIy);
+         myModifiedFaces.Bind(aFS, aLS);
+       }
+       else {
+         TopTools_ListOfShape& aLS=myModifiedFaces.ChangeFind(aFS);
+         aLS.Append(aFIy);
        }
+       //modified by NIZNHY-PKV Mon Jan 24 09:53:43 2005t
       }
     }//for (; aExp.More(); aExp.Next()) {
     //
index 0609ad516baa6dc51811398c0bf16b2845cf110a..d22864b39223b7a103e4253f595283ad03586910 100644 (file)
@@ -1,16 +1,23 @@
 // File generated by CPPExt (Value)
-//                     Copyright (C) 1991,1995 by
-//  
-//                      MATRA DATAVISION, FRANCE
+//
+//                     Copyright (C) 1991 - 2000 by  
+//                      Matra Datavision SA.  All rights reserved.
 //  
-// This software is furnished in accordance with the terms and conditions
-// of the contract and with the inclusion of the above copyright notice.
-// This software or any other copy thereof may not be provided or otherwise
-// be made available to any other person. No title to an ownership of the
-// software is hereby transferred.
+//                     Copyright (C) 2001 - 2004 by
+//                     Open CASCADE SA.  All rights reserved.
+// 
+// This file is part of the Open CASCADE Technology software.
+//
+// This software may be distributed and/or modified under the terms and
+// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
+// and appearing in the file LICENSE included in the packaging of this file.
 //  
-// At the termination of the contract, the software and all copies of this
-// software must be deleted.
+// This software is distributed on an "AS IS" basis, without warranty of any
+// kind, and Open CASCADE SA hereby disclaims all such warranties,
+// including without limitation, any warranties of merchantability, fitness
+// for a particular purpose or non-infringement. Please see the License for
+// the specific terms and conditions governing rights and limitations under the
+// License.
 
 #ifndef _NMTAlgo_Splitter_HeaderFile
 #define _NMTAlgo_Splitter_HeaderFile
@@ -36,6 +43,9 @@
 #ifndef _TopTools_MapOfOrientedShape_HeaderFile
 #include <TopTools_MapOfOrientedShape.hxx>
 #endif
+#ifndef _TopTools_DataMapOfShapeListOfShape_HeaderFile
+#include <TopTools_DataMapOfShapeListOfShape.hxx>
+#endif
 #ifndef _NMTAlgo_Builder_HeaderFile
 #include <NMTAlgo_Builder.hxx>
 #endif
@@ -130,6 +140,7 @@ TopTools_MapOfShape myToolShapes;
 TopTools_MapOfShape myObjShapes;
 TopTools_DataMapOfShapeShape myMapSIFC;
 TopTools_ListOfShape myGenerated;
+TopTools_DataMapOfShapeListOfShape myModifiedFaces;
 
 
 private: 
index d50bc6d3d21ce26135f9dfa5d7cecb3099502877..337c9843545ebb09a328b5d80a7537af1533451e 100644 (file)
 //function : RemoveShapesInside
 //purpose  : remove shapes that are inside S from result
 //=======================================================================
-  void NMTAlgo_Splitter::RemoveShapesInside (const TopoDS_Shape& aS)
+  void NMTAlgo_Splitter::RemoveShapesInside (const TopoDS_Shape& S)
 {
   TopoDS_Iterator it;
-  TopAbs_ShapeEnum aTypeS;
-  //
-  aTypeS=aS.ShapeType();
-  if (aTypeS < TopAbs_SOLID) { // compound or compsolid
-    it.Initialize(aS);
+  if (S.ShapeType() < TopAbs_SOLID) { // compound or compsolid
+    it.Initialize( S );
     for (; it.More(); it.Next()) {
-      const TopoDS_Shape& aSx=it.Value();
-      RemoveShapesInside(aSx);
+      RemoveShapesInside( it.Value());
     }
     return;
   }
   //
-  Standard_Boolean bFromTool, bIsClosed;
-  Standard_Integer i, aNbE;
-  TopoDS_Shape aIntFacesComp;
-  TopoDS_Compound aC;
+  Standard_Boolean isTool;
+  TopoDS_Shape IntFacesComp;
+  TopoDS_Compound C;
   TopTools_IndexedMapOfShape MIF; // map of internal faces
   TopTools_MapOfShape RFM;
   TopTools_MapIteratorOfMapOfShape itF;
-  TopTools_IndexedDataMapOfShapeListOfShape aMEF;
   //
-  bFromTool=myToolShapes.Contains(aS);
+  //modified by NIZNHY-PKV Wed Dec 22 18:56:27 2004 f
+  isTool=myToolShapes.Contains(S);
+  //modified by NIZNHY-PKV Wed Dec 22 18:56:31 2004 t
   //
-  if (!myImageShape.HasImage(aS)) {
-    return; 
+  //isTool = Standard_False;
+  if (!myImageShape.HasImage( S )) {
+    return;
   }
   //
-  aIntFacesComp = FindFacesInside(aS, Standard_False, Standard_True);
+  IntFacesComp = FindFacesInside( S, Standard_False, Standard_True);
   //
-  TopExp::MapShapes(aIntFacesComp, TopAbs_FACE, MIF);
+  TopExp::MapShapes( IntFacesComp, TopAbs_FACE, MIF);
   if (MIF.IsEmpty()) {
     return;
   }
   // add to MIF split faces of S
-  const TopoDS_Shape& aSIm=myImageShape.Image(aS).First();
+  const TopoDS_Shape& aSIm=myImageShape.Image(S).First();
   TopExp::MapShapes(aSIm, TopAbs_FACE, MIF);
   //
   // leave in the result only those shapes not having all face in MIF
-  myBuilder.MakeCompound(aC);
+  myBuilder.MakeCompound(C);
   //
   // RFM : faces of removed shapes that encounter once
   it.Initialize(myShape);
     //
     if (expResF.More()) {
       // add shape to result
-      myBuilder.Add(aC, aSR);
+      myBuilder.Add(C, aSR);
     }
     else {
       // add faces of a removed shape to RFM
-      if (!bFromTool) { //modified by NIZNHY-PKV Thu Dec 23 09:55:39 2004 ft
-       for (expResF.ReInit(); expResF.More(); expResF.Next()) {
-         const TopoDS_Shape& aF = expResF.Current();
-         if (!RFM.Remove(aF)) {
-           RFM.Add(aF);
-         }
+      for (expResF.ReInit(); expResF.More(); expResF.Next()) {
+       const TopoDS_Shape& aF = expResF.Current();
+       if (!RFM.Remove(aF)) {
+         RFM.Add(aF);
        }
-      }//modified by NIZNHY-PKV Thu Dec 23 09:55:29 2004 ft
+      }
     }
   }// for (; it.More(); it.Next())
   //
-  if (bFromTool) {
-    myShape=aC;
-    return;
-  }
+  //modified by NIZNHY-PKV Wed Dec 22 18:59:46 2004 f
+  TopoDS_Compound aCx;
   //
-  // bIsClosed
-  bIsClosed = Standard_False; 
-  if (aTypeS==TopAbs_SOLID) {
-    bIsClosed = Standard_True; 
-  }
-  else if (aTypeS==TopAbs_SHELL) {
-    aMEF.Clear();
-    TopExp::MapShapesAndAncestors(aS, TopAbs_EDGE, TopAbs_FACE, aMEF);
-    aNbE=aMEF.Extent(); 
-    for (i=1; bIsClosed && i<=aNbE; ++i) {
-      bIsClosed=(aMEF(i).Extent()!=1);
-    }
+  myBuilder.MakeCompound(aCx);
+  itF.Initialize (RFM);
+  for (; itF.More(); itF.Next()) {
+    const TopoDS_Shape& aF=itF.Key();
+    myBuilder.Add(aCx, aF);
   }
+  //modified by NIZNHY-PKV Wed Dec 22 18:59:48 2004 t
   //
-  // rebuild S, it must remain in the result
-  if (bIsClosed) {
-    // add to a new shape external faces of removed shapes, ie those in RFM
-    TopoDS_Shell aShell;
-    //
-    myBuilder.MakeShell(aShell);
-    // exclude redundant internal face with edges encounterd only once
-    aMEF.Clear();
-    itF.Initialize (RFM);
-    for (; itF.More(); itF.Next()) {
-      const TopoDS_Shape& aF=itF.Key();
-      TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, aMEF);
-    }
-    // add only faces forming a closed shell
-    for (itF.Reset() ; itF.More(); itF.Next())  {
-      const TopoDS_Shape& aF=itF.Key();
-      TopExp_Explorer expE (aF, TopAbs_EDGE);
-      for (; expE.More(); expE.Next()) {
-       if (aMEF.FindFromKey(expE.Current()).Extent()==1) {
-         break;
-       }
-      }
-      if (!expE.More()) {
-       myBuilder.Add(aShell, aF);
+  if (!isTool) {
+    // rebuild S, it must remain in the result
+    Standard_Boolean isClosed = Standard_False;
+    switch (S.ShapeType()) {
+    case TopAbs_SOLID :
+      isClosed = Standard_True; break;
+    case TopAbs_SHELL: {
+      TopTools_IndexedDataMapOfShapeListOfShape MEF;
+      TopExp::MapShapesAndAncestors(S, TopAbs_EDGE, TopAbs_FACE, MEF);
+      Standard_Integer i;
+      for (i=1;  isClosed && i<=MEF.Extent();  ++i) {
+        isClosed = ( MEF(i).Extent() != 1 );
       }
+      break;
+    }
+    default:
+      isClosed = Standard_False;
     }
     //
-    if (aTypeS==TopAbs_SOLID) {
-      TopoDS_Solid aSolid;
+    if (isClosed) {
+      // add to a new shape external faces of removed shapes, ie those in RFM
+      TopoDS_Shell Shell;
+      myBuilder.MakeShell(Shell);
+      // exclude redundant internal face with edges encounterd only once
+      TopTools_IndexedDataMapOfShapeListOfShape MEF;
       //
-      myBuilder.MakeSolid(aSolid);
-      myBuilder.Add (aSolid, aShell);
-      myBuilder.Add (aC, aSolid);
-    }
+      itF.Initialize (RFM);
+      for ( ; itF.More(); itF.Next()) {
+       const TopoDS_Shape& aF=itF.Key();
+        TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, MEF);
+      }
+      // add only faces forming a closed shell
+      for (itF.Reset() ; itF.More(); itF.Next())  {
+       const TopoDS_Shape& aF=itF.Key();
+        TopExp_Explorer expE (aF, TopAbs_EDGE);
+        for (; expE.More(); expE.Next()) {
+          if (MEF.FindFromKey(expE.Current()).Extent() == 1) {
+            break;
+         }
+       }
+        if (!expE.More()) {
+          myBuilder.Add( Shell, aF);
+       }
+       else {
+         //int a=0;
+       }
+      }
+      
+      if (S.ShapeType() == TopAbs_SOLID) {
+        TopoDS_Solid Solid;
+        myBuilder.MakeSolid( Solid );
+        myBuilder.Add (Solid, Shell);
+        myBuilder.Add (C, Solid);
+      }
+      else {
+        myBuilder.Add (C, Shell);
+      }
+    } // if (isClosed) {
     else {
-      myBuilder.Add (aC, aShell);
-    }
-  } // if (bIsClosed) {
-  //
-  else {
-    it.Initialize(aSIm);
-    for (; it.More(); it.Next()) {
-      const TopoDS_Shape& aSx=it.Value();
-      myBuilder.Add (aC, aSx);
+      it.Initialize(aSIm);
+      for (; it.More(); it.Next()) {
+       myBuilder.Add (C, it.Value());
+      }
     }
   }
   //
-  myShape=aC;
+  myShape = C;
 }
-
+ //modified by NIZNHY-PKV Mon Jan 24 10:19:30 2005 f
 //=======================================================================
 //function : Modified
 //purpose  : 
   const TopTools_ListOfShape& NMTAlgo_Splitter::Modified (const TopoDS_Shape& S) 
 
 {
-  myGenerated.Clear();
+  TopAbs_ShapeEnum aType;
   TopTools_ListIteratorOfListOfShape it;
   TopTools_MapOfShape aMap;
   TopExp_Explorer anExp;
-
-  if(S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_EDGE) {
-
-    if(S.ShapeType() == TopAbs_FACE) { 
-      if (myImagesFaces.HasImage( S )) {
-       it.Initialize(myImagesFaces.Image(S));
-       anExp.Init(myShape, TopAbs_FACE);
+  //
+  myGenerated.Clear();
+  aType=S.ShapeType();
+  //
+  switch (aType) {
+    case TopAbs_FACE: {
+      if (myModifiedFaces.IsBound(S)) {
+       anExp.Init(myShape, aType);
+       for(; anExp.More(); anExp.Next()) {
+         aMap.Add(anExp.Current());
+       }
+       //
+       const TopTools_ListOfShape& aLS=myModifiedFaces.Find(S);
+       it.Initialize(aLS);
+       for (; it.More(); it.Next()) {
+         const TopoDS_Shape& aFx=it.Value();
+         if (!aFx.IsSame(S)) {
+           if (aMap.Contains(aFx)) {
+             myGenerated.Append(aFx);
+           }
+         }
+       }
       }
     }
-    else {
-      if (myImagesEdges.HasImage( S )) {
-       it.Initialize(myImagesEdges.Image(S));
-       anExp.Init(myShape, TopAbs_EDGE);
+      break;
+      //
+    case TopAbs_EDGE: {
+      if (myImagesEdges.HasImage(S)) {
+       anExp.Init(myShape, aType);
+       for(; anExp.More(); anExp.Next()) {
+         aMap.Add(anExp.Current());
+       }
+       //
+       const TopTools_ListOfShape& aLE=myImagesEdges.Image(S);
+       it.Initialize(aLE);
+       for (; it.More(); it.Next()) {
+         const TopoDS_Shape& aEx=it.Value();
+         if (!aEx.IsSame(S)) {
+           if(aMap.Contains(aEx)) {
+             myGenerated.Append(aEx);
+           }
+         }
+       }
       }
     }
-  
-    for(; anExp.More(); anExp.Next()) {
-      aMap.Add(anExp.Current());
-    }
-
-    for (; it.More(); it.Next()) {
-      if(aMap.Contains(it.Value())) {
-       myGenerated.Append(it.Value());
+      break;
+      //
+    case TopAbs_VERTEX: {
+      Standard_Integer aNbS, anIndex, i, aSDVInd;
+      //
+      const NMTTools_DSFiller& aDSF = Filler();
+      const NMTTools_PaveFiller& aPF = aDSF.PaveFiller();
+      const NMTDS_ShapesDataStructure& aDS = aDSF.DS();
+      //
+      aNbS = aDS.NumberOfSourceShapes();
+      anIndex = 0;
+      //
+      for(i=1; i<=aNbS; ++i) {
+       const TopoDS_Shape& aS = aDS.Shape(i);
+       if(S.IsSame(aS)) {
+         anIndex = i;
+         break;
+       }
       }
-    }
-
-    return myGenerated;
-
-  }
-
-  if(S.ShapeType() == TopAbs_VERTEX) {
-    
-    const NMTTools_DSFiller& aDSF = Filler();
-    const NMTTools_PaveFiller& aPF = aDSF.PaveFiller();
-    const NMTDS_ShapesDataStructure& aDS = aDSF.DS();
-
-    Standard_Integer aNbS = aDS.NumberOfSourceShapes();
-    Standard_Integer anIndex = 0, i;
-
-    for(i = 1; i <= aNbS; ++i) {
-
-      const TopoDS_Shape& aS = aDS.Shape(i);
-      if(S.IsSame(aS)) {
-       anIndex = i;
-       break;
+      //
+      if(!anIndex) {
+       break;//return myGenerated;
       }
-
-    }
-
-    if(anIndex == 0) return myGenerated;
-
-    Standard_Integer aSDVInd = aPF.FindSDVertex(anIndex);
-
-    if(aSDVInd == 0) return myGenerated;
-
-    const TopoDS_Shape aSDV = aDS.Shape(aSDVInd);
-
-    anExp.Init(myShape, TopAbs_VERTEX);
-    for(; anExp.More(); anExp.Next()) {
-
-      if(aSDV.IsSame(anExp.Current())) {
-       myGenerated.Append(aSDV);
-       break;
+      //
+      aSDVInd=aPF.FindSDVertex(anIndex);
+      if(!aSDVInd) {
+       break;//return myGenerated;
       }
-
-    }
-    
-  }
-
+      //
+      const TopoDS_Shape& aSDV=aDS.Shape(aSDVInd);
+      //
+      anExp.Init(myShape, aType);
+      for(; anExp.More(); anExp.Next()) {
+       const TopoDS_Shape& aVx=anExp.Current();
+       if(aSDV.IsSame(aVx)) {
+         myGenerated.Append(aSDV);
+         break;
+       }
+      }
+    } 
+      break;
+      //
+    default:
+      break;
+  } // switch (aType) {
+  //
   return myGenerated;
 }
+//modified by NIZNHY-PKV Mon Jan 24 10:28:40 2005 t
 //=======================================================================
 //function : Generated
 //purpose  :