Salome HOME
fa2c0e16171b80e5c43c83c9cd4c0164c5e629ec
[modules/hydro.git] / src / HYDROData / HYDROData_Zone.cxx
1
2 #include "HYDROData_Zone.h"
3
4 #include "HYDROData_Bathymetry.h"
5 #include "HYDROData_Document.h"
6 #include "HYDROData_Polyline.h"
7 #include "HYDROData_Iterator.h"
8
9 #include <TDataStd_IntegerArray.hxx>
10
11 #include <QColor>
12 #include <QStringList>
13
14 #define PYTHON_POLYLINE_ID "KIND_ZONE"
15
16 IMPLEMENT_STANDARD_HANDLE(HYDROData_Zone, HYDROData_Object)
17 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Zone, HYDROData_Object)
18
19 HYDROData_Zone::HYDROData_Zone()
20 {
21 }
22
23 HYDROData_Zone::~HYDROData_Zone()
24 {
25 }
26
27 QStringList HYDROData_Zone::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
28 {
29   QStringList aResList;
30
31   Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( this );
32   if ( aDocument.IsNull() )
33     return aResList;
34
35   return aResList;
36 }
37
38 QColor HYDROData_Zone::DefaultFillingColor()
39 {
40   return QColor( Qt::green );
41 }
42
43 void HYDROData_Zone::SetFillingColor( const QColor& theColor )
44 {
45   return SetColor( theColor, DataTag_FillingColor );
46 }
47
48 QColor HYDROData_Zone::GetFillingColor() const
49 {
50   return GetColor( DefaultFillingColor(), DataTag_FillingColor );
51 }
52
53 QColor HYDROData_Zone::DefaultBorderColor()
54 {
55   return QColor( Qt::transparent );
56 }
57
58 void HYDROData_Zone::SetBorderColor( const QColor& theColor )
59 {
60   return SetColor( theColor, DataTag_BorderColor );
61 }
62
63 QColor HYDROData_Zone::GetBorderColor() const
64 {
65   return GetColor( DefaultBorderColor(), DataTag_BorderColor );
66 }
67
68 void HYDROData_Zone::SetPolyline( const Handle(HYDROData_Polyline)& thePolyline )
69 {
70   SetReferenceObject( thePolyline, DataTag_Polyline );
71 }
72
73 Handle(HYDROData_Polyline) HYDROData_Zone::GetPolyline() const
74 {
75   return Handle(HYDROData_Polyline)::DownCast( 
76            GetReferenceObject( DataTag_Polyline ) );
77 }
78
79 void HYDROData_Zone::RemovePolyline()
80 {
81   ClearReferenceObjects( DataTag_Polyline );
82 }
83
84 int HYDROData_Zone::NbBathymetries() const
85 {
86   return NbReferenceObjects( DataTag_Bathymetry );
87 }
88
89 void HYDROData_Zone::AddBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry )
90 {
91   AddReferenceObject( theBathymetry, DataTag_Bathymetry );
92 }
93
94 void HYDROData_Zone::SetBathymetry( const int                           theIndex,
95                                     const Handle(HYDROData_Bathymetry)& theBathymetry )
96 {
97   SetReferenceObject( theBathymetry, DataTag_Bathymetry, theIndex );
98 }
99
100 Handle(HYDROData_Bathymetry) HYDROData_Zone::GetBathymetry( const int theIndex ) const
101 {
102   return Handle(HYDROData_Bathymetry)::DownCast( 
103            GetReferenceObject( DataTag_Bathymetry, theIndex ) );
104 }
105
106 HYDROData_SequenceOfObjects HYDROData_Zone::GetBathymetries() const
107 {
108   return GetReferenceObjects( DataTag_Bathymetry );
109 }
110
111 void HYDROData_Zone::RemoveBathymetries()
112 {
113   ClearReferenceObjects( DataTag_Bathymetry );
114 }
115
116 QPainterPath HYDROData_Zone::GetPainterPath() const
117 {
118   QPainterPath aPath;
119
120   Handle(HYDROData_Polyline) aPolyline = GetPolyline();
121   if ( !aPolyline.IsNull() )
122   {
123     aPath = aPolyline->painterPath();
124   }
125
126   return aPath;
127 }
128