2 #include "HYDROData_Domain.h"
4 #include "HYDROData_Bathymetry.h"
5 #include "HYDROData_Document.h"
6 #include "HYDROData_Iterator.h"
8 #include <TDataStd_IntegerArray.hxx>
11 #include <QStringList>
13 IMPLEMENT_STANDARD_HANDLE(HYDROData_Domain, HYDROData_Object)
14 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Domain, HYDROData_Object)
16 HYDROData_Domain::HYDROData_Domain()
20 HYDROData_Domain::~HYDROData_Domain()
24 QStringList HYDROData_Domain::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
28 Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( this );
29 if ( aDocument.IsNull() )
32 QString aDocName = aDocument->GetDocPyName();
33 QString aZoneName = GetName();
35 aResList << QString( "%1 = %2.CreateObject( %3 );" )
36 .arg( aZoneName ).arg( aDocName ).arg( getPythonKindId() );
37 aResList << QString( "%1.SetName( \"%2\" );" )
38 .arg( aZoneName ).arg( aZoneName );
39 aResList << QString( "" );
41 QColor aFillingColor = GetFillingColor();
42 aResList << QString( "filling_color = QColor( %1, %2, %3, %4 );" )
43 .arg( aFillingColor.red() ).arg( aFillingColor.green() )
44 .arg( aFillingColor.blue() ).arg( aFillingColor.alpha() );
45 aResList << QString( "%1.SetFillingColor( filling_color );" ).arg( aZoneName );
46 aResList << QString( "" );
48 QColor aBorderColor = GetBorderColor();
49 aResList << QString( "border_color = QColor( %1, %2, %3, %4 );" )
50 .arg( aBorderColor.red() ).arg( aBorderColor.green() )
51 .arg( aBorderColor.blue() ).arg( aBorderColor.alpha() );
52 aResList << QString( "%1.SetBorderColor( border_color );" ).arg( aZoneName );
53 aResList << QString( "" );
55 HYDROData_SequenceOfObjects aZoneBaths = GetBathymetries();
56 HYDROData_SequenceOfObjects::Iterator aBathsIter( aZoneBaths );
57 for ( ; aBathsIter.More(); aBathsIter.Next() )
59 Handle(HYDROData_Bathymetry) aRefBath =
60 Handle(HYDROData_Bathymetry)::DownCast( aBathsIter.Value() );
61 if ( !aRefBath.IsNull() )
62 setPythonReferenceObject( theTreatedObjects, aResList, aRefBath, "AddBathymetry" );
68 QColor HYDROData_Domain::DefaultFillingColor()
70 return QColor( Qt::green );
73 void HYDROData_Domain::SetFillingColor( const QColor& theColor )
75 return SetColor( theColor, DataTag_FillingColor );
78 QColor HYDROData_Domain::GetFillingColor() const
80 return GetColor( DefaultFillingColor(), DataTag_FillingColor );
83 QColor HYDROData_Domain::DefaultBorderColor()
85 return QColor( Qt::transparent );
88 void HYDROData_Domain::SetBorderColor( const QColor& theColor )
90 return SetColor( theColor, DataTag_BorderColor );
93 QColor HYDROData_Domain::GetBorderColor() const
95 return GetColor( DefaultBorderColor(), DataTag_BorderColor );
98 int HYDROData_Domain::NbBathymetries() const
100 return NbReferenceObjects( DataTag_Bathymetry );
103 void HYDROData_Domain::AddBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry )
105 AddReferenceObject( theBathymetry, DataTag_Bathymetry );
108 void HYDROData_Domain::SetBathymetry( const int theIndex,
109 const Handle(HYDROData_Bathymetry)& theBathymetry )
111 SetReferenceObject( theBathymetry, DataTag_Bathymetry, theIndex );
114 Handle(HYDROData_Bathymetry) HYDROData_Domain::GetBathymetry( const int theIndex ) const
116 return Handle(HYDROData_Bathymetry)::DownCast(
117 GetReferenceObject( DataTag_Bathymetry, theIndex ) );
120 HYDROData_SequenceOfObjects HYDROData_Domain::GetBathymetries() const
122 return GetReferenceObjects( DataTag_Bathymetry );
125 void HYDROData_Domain::RemoveBathymetries()
127 ClearReferenceObjects( DataTag_Bathymetry );