2 #include "HYDROData_ShapesGroup.h"
4 #include <TDF_ChildIDIterator.hxx>
7 #include <TopoDS_Edge.hxx>
9 #include <TNaming_Builder.hxx>
10 #include <TNaming_NamedShape.hxx>
12 IMPLEMENT_STANDARD_HANDLE(HYDROData_ShapesGroup,HYDROData_Entity)
13 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_ShapesGroup,HYDROData_Entity)
15 HYDROData_ShapesGroup::HYDROData_ShapesGroup()
20 HYDROData_ShapesGroup::~HYDROData_ShapesGroup()
24 bool HYDROData_ShapesGroup::CanBeUpdated() const
29 bool HYDROData_ShapesGroup::CanRemove()
34 void HYDROData_ShapesGroup::AddShape( const TopoDS_Shape& theShape )
36 if ( theShape.IsNull() )
39 TDF_Label aNewLab = myLab.FindChild( DataTag_Shape ).NewChild();
41 TNaming_Builder aBuilder( aNewLab );
42 aBuilder.Generated( theShape );
45 void HYDROData_ShapesGroup::SetShapes( const TopTools_SequenceOfShape& theShapes )
49 for ( int i = 1, n = theShapes.Length(); i <= n; ++i )
51 const TopoDS_Shape& aShape = theShapes.Value( i );
56 void HYDROData_ShapesGroup::GetShapes( TopTools_SequenceOfShape& theShapes ) const
60 TDF_Label aLabel = myLab.FindChild( DataTag_Shape, false );
61 if ( aLabel.IsNull() )
64 TDF_ChildIDIterator aChildIt( aLabel, TNaming_NamedShape::GetID() );
65 for ( ; aChildIt.More(); aChildIt.Next() )
67 Handle(TNaming_NamedShape) aNamedShape =
68 Handle(TNaming_NamedShape)::DownCast( aChildIt.Value() );
69 if ( aNamedShape.IsNull() )
72 TopoDS_Shape aStoredShape = aNamedShape->Get();
73 if ( aStoredShape.IsNull() )
76 theShapes.Append( aStoredShape );
80 void HYDROData_ShapesGroup::RemoveShapes()
82 TDF_Label aLabel = myLab.FindChild( DataTag_Shape, false );
83 if ( !aLabel.IsNull() )
84 aLabel.ForgetAllAttributes();