Salome HOME
The data model has been rolled back to previous version.
[modules/hydro.git] / src / HYDROData / HYDROData_Object.cxx
1
2 #include "HYDROData_Object.h"
3
4 #include "HYDROData_Bathymetry.h"
5
6 #include <TNaming_Builder.hxx>
7 #include <TNaming_NamedShape.hxx>
8
9 #include <TopoDS_Shape.hxx>
10
11 #include <QColor>
12
13 IMPLEMENT_STANDARD_HANDLE(HYDROData_Object,HYDROData_Entity)
14 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Object,HYDROData_Entity)
15
16 HYDROData_Object::HYDROData_Object()
17 : HYDROData_Entity()
18 {
19 }
20
21 HYDROData_Object::~HYDROData_Object()
22 {
23 }
24
25 void HYDROData_Object::SetTopShape( const TopoDS_Shape& theShape )
26 {
27   TNaming_Builder aBuilder( myLab.FindChild( DataTag_TopShape ) );
28   aBuilder.Generated( theShape );
29 }
30
31 void HYDROData_Object::SetShape3D( const TopoDS_Shape& theShape )
32 {
33   TNaming_Builder aBuilder( myLab.FindChild( DataTag_Shape3D ) );
34   aBuilder.Generated( theShape );
35 }
36
37 void HYDROData_Object::SetBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry )
38 {
39   SetReferenceObject( theBathymetry, DataTag_Bathymetry );
40 }
41
42 Handle(HYDROData_Bathymetry) HYDROData_Object::GetBathymetry() const
43 {
44   return Handle(HYDROData_Bathymetry)::DownCast( 
45            GetReferenceObject( DataTag_Bathymetry ) );
46 }
47
48 void HYDROData_Object::RemoveBathymetry()
49 {
50   ClearReferenceObjects( DataTag_Bathymetry );
51 }
52
53 TopoDS_Shape HYDROData_Object::getTopShape() const
54 {
55   Handle(TNaming_NamedShape) aNamedShape;
56   if( myLab.FindChild( DataTag_TopShape ).FindAttribute( TNaming_NamedShape::GetID(), aNamedShape ) )
57     return aNamedShape->Get();
58   return TopoDS_Shape();
59 }
60
61 TopoDS_Shape HYDROData_Object::getShape3D() const
62 {
63   Handle(TNaming_NamedShape) aNamedShape;
64   if( myLab.FindChild( DataTag_Shape3D ).FindAttribute( TNaming_NamedShape::GetID(), aNamedShape ) )
65     return aNamedShape->Get();
66   return TopoDS_Shape();
67 }
68
69 void HYDROData_Object::SetFillingColor( const QColor& theColor )
70 {
71   return SetColor( theColor, DataTag_FillingColor );
72 }
73
74 QColor HYDROData_Object::GetFillingColor() const
75 {
76   return GetColor( DefaultFillingColor(), DataTag_FillingColor );
77 }
78
79 void HYDROData_Object::SetBorderColor( const QColor& theColor )
80 {
81   return SetColor( theColor, DataTag_BorderColor );
82 }
83
84 QColor HYDROData_Object::GetBorderColor() const
85 {
86   return GetColor( DefaultBorderColor(), DataTag_BorderColor );
87 }
88
89 QColor HYDROData_Object::DefaultFillingColor()
90 {
91   return QColor( Qt::yellow );
92 }
93
94 QColor HYDROData_Object::DefaultBorderColor()
95 {
96   return QColor( Qt::transparent );
97 }