2 #include "HYDROData_Zone.h"
4 #include "HYDROData_Bathymetry.h"
5 #include "HYDROData_Document.h"
6 #include "HYDROData_Polyline.h"
7 #include "HYDROData_Iterator.h"
9 #include <TDataStd_IntegerArray.hxx>
12 #include <QStringList>
14 #define PYTHON_POLYLINE_ID "KIND_ZONE"
16 IMPLEMENT_STANDARD_HANDLE(HYDROData_Zone, HYDROData_Object)
17 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Zone, HYDROData_Object)
19 HYDROData_Zone::HYDROData_Zone()
23 HYDROData_Zone::~HYDROData_Zone()
27 QStringList HYDROData_Zone::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
31 Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( this );
32 if ( aDocument.IsNull() )
38 void HYDROData_Zone::SetColor( const QColor& theColor )
40 Handle(TDataStd_IntegerArray) aColorArray;
41 if ( !myLab.FindChild( DataTag_Color ).FindAttribute( TDataStd_IntegerArray::GetID(), aColorArray ) )
42 aColorArray = TDataStd_IntegerArray::Set( myLab.FindChild( DataTag_Color ), 1, 4 );
44 aColorArray->SetValue( 1, theColor.red() );
45 aColorArray->SetValue( 2, theColor.green() );
46 aColorArray->SetValue( 3, theColor.blue() );
47 aColorArray->SetValue( 4, theColor.alpha() );
50 QColor HYDROData_Zone::GetColor() const
52 QColor aResColor( Qt::green );
54 Handle(TDataStd_IntegerArray) aColorArray;
55 if ( myLab.FindChild( DataTag_Color ).FindAttribute( TDataStd_IntegerArray::GetID(), aColorArray ) )
57 aResColor.setRed( aColorArray->Value( 1 ) );
58 aResColor.setGreen( aColorArray->Value( 2 ) );
59 aResColor.setBlue( aColorArray->Value( 3 ) );
60 aResColor.setAlpha( aColorArray->Value( 4 ) );
66 void HYDROData_Zone::SetPolyline( const Handle(HYDROData_Polyline)& thePolyline )
68 SetReferenceObject( thePolyline, DataTag_Polyline );
71 Handle(HYDROData_Polyline) HYDROData_Zone::GetPolyline() const
73 return Handle(HYDROData_Polyline)::DownCast(
74 GetReferenceObject( DataTag_Polyline ) );
77 void HYDROData_Zone::RemovePolyline()
79 ClearReferenceObjects( DataTag_Polyline );
82 int HYDROData_Zone::NbBathymetries() const
84 return NbReferenceObjects( DataTag_Bathymetry );
87 void HYDROData_Zone::AddBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry )
89 AddReferenceObject( theBathymetry, DataTag_Bathymetry );
92 void HYDROData_Zone::SetBathymetry( const int theIndex,
93 const Handle(HYDROData_Bathymetry)& theBathymetry )
95 SetReferenceObject( theBathymetry, DataTag_Bathymetry, theIndex );
98 Handle(HYDROData_Bathymetry) HYDROData_Zone::GetBathymetry( const int theIndex ) const
100 return Handle(HYDROData_Bathymetry)::DownCast(
101 GetReferenceObject( DataTag_Bathymetry, theIndex ) );
104 HYDROData_SequenceOfObjects HYDROData_Zone::GetBathymetries() const
106 return GetReferenceObjects( DataTag_Bathymetry );
109 void HYDROData_Zone::RemoveBathymetries()
111 ClearReferenceObjects( DataTag_Bathymetry );
114 QPainterPath HYDROData_Zone::GetPainterPath() const
118 Handle(HYDROData_Polyline) aPolyline = GetPolyline();
119 if ( !aPolyline.IsNull() )
121 aPath = aPolyline->painterPath();