]> SALOME platform Git repositories - modules/hydro.git/blob - src/HYDROData/HYDROData_IPolyline.cxx
Salome HOME
The data model has been rolled back to previous version.
[modules/hydro.git] / src / HYDROData / HYDROData_IPolyline.cxx
1
2 #include "HYDROData_IPolyline.h"
3
4 #include <gp_XY.hxx>
5
6 #include <TDataStd_RealList.hxx>
7
8 IMPLEMENT_STANDARD_HANDLE(HYDROData_IPolyline, HYDROData_Entity)
9 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_IPolyline, HYDROData_Entity)
10
11 HYDROData_IPolyline::HYDROData_IPolyline()
12 : HYDROData_Entity()
13 {
14 }
15
16 HYDROData_IPolyline::~HYDROData_IPolyline()
17 {
18 }
19
20 int HYDROData_IPolyline::NbPoints( const int theSectionIndex ) const
21 {
22   return GetPoints( theSectionIndex ).Length();
23 }
24
25 void HYDROData_IPolyline::getPointsLists( const int                  theSectionIndex,
26                                           Handle(TDataStd_RealList)& theListX,
27                                           Handle(TDataStd_RealList)& theListY,
28                                           const bool                 theIsCreate ) const
29 {
30   theListX.Nullify();
31   theListY.Nullify();
32
33   TDF_Label aLabel = myLab.FindChild( DataTag_Points, theIsCreate );
34   if ( aLabel.IsNull() )
35     return;
36
37   TDF_Label aSectLabel = aLabel.FindChild( theSectionIndex, theIsCreate );
38   if ( aSectLabel.IsNull() )
39     return;
40
41   TDF_Label aLabelX = aSectLabel.FindChild( 0, theIsCreate );
42   if ( !aLabelX.IsNull() )
43   {
44     if ( !aLabelX.FindAttribute( TDataStd_RealList::GetID(), theListX ) && theIsCreate )
45       theListX = TDataStd_RealList::Set( aLabelX );
46   }
47
48   TDF_Label aLabelY = aSectLabel.FindChild( 1, theIsCreate );
49   if ( !aLabelY.IsNull() )
50   {
51     if ( !aLabelY.FindAttribute( TDataStd_RealList::GetID(), theListY ) && theIsCreate )
52       theListY = TDataStd_RealList::Set( aLabelY );
53   }
54 }
55
56 void HYDROData_IPolyline::removePointsLists( const int theSectionIndex ) const
57 {
58   TDF_Label aLabel = myLab.FindChild( DataTag_Points, false );
59   if ( aLabel.IsNull() )
60     return;
61
62   TDF_Label aSectLabel = aLabel.FindChild( theSectionIndex, false );
63   if ( !aSectLabel.IsNull() )
64     aSectLabel.ForgetAllAttributes();
65 }