2 #include "HYDROData_ShapesGroup.h"
4 #include <TDF_ChildIDIterator.hxx>
7 #include <TopoDS_Edge.hxx>
9 #include <TopTools_ListOfShape.hxx>
10 #include <TopTools_ListIteratorOfListOfShape.hxx>
12 #include <TNaming_Builder.hxx>
13 #include <TNaming_NamedShape.hxx>
15 IMPLEMENT_STANDARD_HANDLE(HYDROData_ShapesGroup,HYDROData_Entity)
16 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_ShapesGroup,HYDROData_Entity)
18 HYDROData_ShapesGroup::HYDROData_ShapesGroup()
23 HYDROData_ShapesGroup::~HYDROData_ShapesGroup()
27 bool HYDROData_ShapesGroup::CanBeUpdated() const
32 bool HYDROData_ShapesGroup::CanRemove()
37 void HYDROData_ShapesGroup::AddShape( const TopoDS_Shape& theShape )
39 if ( theShape.IsNull() )
42 TDF_Label aNewLab = myLab.FindChild( DataTag_Shape ).NewChild();
44 TNaming_Builder aBuilder( aNewLab );
45 aBuilder.Generated( theShape );
48 void HYDROData_ShapesGroup::SetShapes( const TopTools_SequenceOfShape& theShapes )
52 for ( int i = 1, n = theShapes.Length(); i <= n; ++i )
54 const TopoDS_Shape& aShape = theShapes.Value( i );
59 void HYDROData_ShapesGroup::SetShapes( const TopTools_ListOfShape& theShapes )
63 TopTools_ListIteratorOfListOfShape anIter( theShapes );
64 for ( ; anIter.More(); anIter.Next() )
66 const TopoDS_Shape& aShape = anIter.Value();
71 void HYDROData_ShapesGroup::GetShapes( TopTools_SequenceOfShape& theShapes ) const
75 TDF_Label aLabel = myLab.FindChild( DataTag_Shape, false );
76 if ( aLabel.IsNull() )
79 TDF_ChildIDIterator aChildIt( aLabel, TNaming_NamedShape::GetID() );
80 for ( ; aChildIt.More(); aChildIt.Next() )
82 Handle(TNaming_NamedShape) aNamedShape =
83 Handle(TNaming_NamedShape)::DownCast( aChildIt.Value() );
84 if ( aNamedShape.IsNull() )
87 TopoDS_Shape aStoredShape = aNamedShape->Get();
88 if ( aStoredShape.IsNull() )
91 theShapes.Append( aStoredShape );
95 void HYDROData_ShapesGroup::RemoveShapes()
97 TDF_Label aLabel = myLab.FindChild( DataTag_Shape, false );
98 if ( !aLabel.IsNull() )
99 aLabel.ForgetAllAttributes();