]> OCCT Git - occt.git/commitdiff
Revert "0026314: Method SetShape working not correctly."
authorabv <abv@opencascade.com>
Tue, 16 Feb 2016 11:53:16 +0000 (14:53 +0300)
committerbugmaster <bugmaster@opencascade.com>
Wed, 17 Feb 2016 09:33:27 +0000 (12:33 +0300)
This reverts commit e2df45413ea1d506d911c6f29dacf42c80ca8a35.

src/XCAFDoc/XCAFDoc_ShapeTool.cxx
src/XCAFDoc/XCAFDoc_ShapeTool.hxx
src/XDEDRAW/XDEDRAW_Shapes.cxx
tests/bugs/xde/bug22962
tests/bugs/xde/bug25441 [deleted file]
tests/bugs/xde/bug26314 [deleted file]

index 7949f6580cead67d59c2acd8bd1ed7d7ae86c705..75f010b75d5ab5dc4ff8895030885bddfb5355ea 100644 (file)
@@ -402,32 +402,26 @@ TDF_Label XCAFDoc_ShapeTool::NewShape() const
 //=======================================================================
 
 void XCAFDoc_ShapeTool::SetShape (const TDF_Label& L, const TopoDS_Shape& S)
-{ 
-  if(IsReference(L) || !IsTopLevel(L) || /*IsAssembly(L) ||*/ !S.Location().IsIdentity())
-    return;
-
-  TDF_LabelSequence aSubShapes;
-  GetSubShapes(L, aSubShapes);
-
+{
   TNaming_Builder tnBuild(L);
   tnBuild.Generated(S);
   Handle(XCAFDoc_ShapeMapTool) A = XCAFDoc_ShapeMapTool::Set(L);
+//  if ( ! L.FindAttribute(XCAFDoc_ShapeMapTool::GetID(), A) ) {
+//    A = XCAFDoc_ShapeMapTool::Set(L);
+//    L.AddAttribute(A);
+//  }
   A->SetShape(S);
 
-  for(Standard_Integer i = 1; i<=aSubShapes.Length(); i++)
-  {
-    TDF_Label aSubLabel = aSubShapes(i);
-    if (!IsSubShape(L, GetShape(aSubLabel)))
-    {
-      aSubLabel.ForgetAllAttributes();
-    }
-  }
-
   if(!myShapeLabels.IsBound(S)) {
     myShapeLabels.Bind(S,L);
   }
-
-  UpdateAssociatedAssembly(L);
+  
+  //:abv 31.10.01: update assemblies that refer a shape
+  TDF_LabelSequence Labels;
+  if ( GetUsers ( L, Labels, Standard_True ) ) {
+    for ( Standard_Integer i=Labels.Length(); i >=1; i-- ) 
+      UpdateAssembly ( Labels(i) );
+  }
 }
 
 //=======================================================================
@@ -998,26 +992,6 @@ void XCAFDoc_ShapeTool::RemoveComponent (const TDF_Label& comp) const
   }
 }
 
-//=======================================================================
-//function : UpdateAssociatedAssembly
-//purpose  : 
-//=======================================================================
-
-void XCAFDoc_ShapeTool::UpdateAssociatedAssembly (const TDF_Label& L) const
-{
-  TDF_LabelSequence Labels;
-  if ( GetUsers ( L, Labels ) ) {
-    for ( Standard_Integer i=Labels.Length(); i >=1; i-- ) 
-    {
-      TDF_Label anAssemblyLabel = Labels(i).Father();
-      if(!anAssemblyLabel.IsNull())
-      {
-        UpdateAssembly(anAssemblyLabel);
-      }
-    }
-  }
-}
-
 //=======================================================================
 //function : UpdateAssembly
 //purpose  : 
@@ -1027,38 +1001,19 @@ void XCAFDoc_ShapeTool::UpdateAssembly (const TDF_Label& L) const
 {
   if ( ! IsAssembly(L) ) return;
 
+  TopoDS_Compound newassembly;
   BRep_Builder b;
-  TopoDS_Shape aShape = GetShape(L);
-  Standard_Boolean isFree = aShape.Free();
-  if (!isFree)
-    aShape.Free(Standard_True);
-
-  TopTools_SequenceOfShape aSubShapeSeq;
-  TopoDS_Iterator Iterator(aShape);
-  for (; Iterator.More(); Iterator.Next())
-    aSubShapeSeq.Append(Iterator.Value());
-
-  for (Standard_Integer i = 1; i <= aSubShapeSeq.Length(); i++) 
-    b.Remove(aShape, aSubShapeSeq.Value(i));
+  b.MakeCompound(newassembly);
 
   TDF_ChildIterator chldLabIt(L);
   for (; chldLabIt.More(); chldLabIt.Next() ) {
     TDF_Label subLabel = chldLabIt.Value();
     if ( IsComponent ( subLabel ) ) {
-      b.Add(aShape, GetShape(subLabel));
+      b.Add(newassembly, GetShape(subLabel));
     }
   }
-
-  if (!isFree)
-    aShape.Free(Standard_False);
-
   TNaming_Builder tnBuild(L);
-  tnBuild.Generated(aShape);
-
-  Handle(XCAFDoc_ShapeMapTool) A = XCAFDoc_ShapeMapTool::Set(L);
-  A->SetShape(aShape);
-
-  UpdateAssociatedAssembly(L);
+  tnBuild.Generated(newassembly);
 }
 
 //=======================================================================
@@ -1951,4 +1906,4 @@ void XCAFDoc_ShapeTool::makeSubShape (const TDF_Label& Part, const TopoDS_Shape&
     }
     makeSubShape(Part, aChildShape);
   }
-}
\ No newline at end of file
+}
index c1f7c9dc6b9f8d91d6716c2a84094451bed728d5..bc7ddd8c1eee86548d77a1734571810ab820d6be 100644 (file)
@@ -203,11 +203,6 @@ public:
   Standard_EXPORT TDF_Label NewShape() const;
   
   //! Sets representation (TopoDS_Shape) for top-level shape.
-  //! If S has location(location.IsIdentity() is false),
-  //! command will be skipped. Sub-shapes of S which is
-  //! subshape of old shape, will be stored ( all atributes will be stored).
-  //! If a sub-label of L is not a sub-shape of the new shape,
-  //! it will be removed.
   Standard_EXPORT void SetShape (const TDF_Label& L, const TopoDS_Shape& S);
   
   //! Adds a new top-level (creates and returns a new label)
@@ -291,9 +286,6 @@ public:
   //! Removes a component from its assembly
   Standard_EXPORT void RemoveComponent (const TDF_Label& comp) const;
   
-  //! Update labels associated with Label <L>
-  Standard_EXPORT void UpdateAssociatedAssembly (const TDF_Label& L) const;
-  
   //! Update an assembly at label <L>
   Standard_EXPORT void UpdateAssembly (const TDF_Label& L) const;
   
index 954be5fccce4796f927ddf0c33b2e2b8c813f1b3..20bfb0ca9e623f9e4b14b10f08e0ddda1e4dd3b9 100644 (file)
@@ -102,8 +102,7 @@ static Standard_Integer setShape (Draw_Interpretor& di, Standard_Integer argc, c
 //  XCAFDoc_ShapeTool myAssembly;
 //  myAssembly.Init(Doc);
   Handle(XCAFDoc_ShapeTool) myAssembly = XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
-  if( !myAssembly->IsAssembly(aLabel))
-    myAssembly->SetShape(aLabel, aShape);
+  myAssembly->SetShape(aLabel, aShape);
   return 0;
 }
 
index 53b527dc9eaee270cb58858b77fe2ea3e0424499..4155ca96b183dbf9234d83133f07dbe1e0e581b6 100755 (executable)
@@ -7,7 +7,7 @@ puts ""
 #######################################################################
 
 set BugNumber OCC22962
-set check_value 96
+set check_value 94
 pload DCAF
 
 ReadStep D1 [locate_data_file OCC22962-dm1-oc-214.stp]
diff --git a/tests/bugs/xde/bug25441 b/tests/bugs/xde/bug25441
deleted file mode 100644 (file)
index 60aad3f..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-puts "========"
-puts "OCC25441"
-puts "========"
-puts ""
-###########################################################################
-# XCAFDoc_ShapeTool::UpdateAssembly() does not update the back-references
-###########################################################################
-
-pload OCAFKERNEL
-
-box b 0 0 0 1 1 1
-psphere b1 10
-NewDocument d
-compound b c
-compound c c1
-XAddShape d c1 1
-XShow d
-XSetShape d 0:1:1:3 b1
-XShow d
-vfit
-
-checkview -screenshot -3d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/xde/bug26314 b/tests/bugs/xde/bug26314
deleted file mode 100644 (file)
index 23d9bd4..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-puts "========"
-puts "OCC26314"
-puts "========"
-puts ""
-############################################################
-# Method XCAFDoc_ShapeTool::SetShape() works not correctly
-############################################################
-
-pload OCAFKERNEL
-
-box b 0 0 0 1 1 1
-box b1 -10 -10 -10 10 10 10
-box b2 1 1 1 10 10 10
-NewDocument d
-compound b1 c1
-XAddShape d b 1
-XAddShape d c1 1
-XShow d
-XSetShape d 0:1:1:3 b2
-XShow d
-vfit
-
-checkview -screenshot -3d -path ${imagedir}/${test_image}.png