2 #include "HYDROData_Object.h"
4 #include "HYDROData_Bathymetry.h"
6 #include <TNaming_Builder.hxx>
7 #include <TNaming_NamedShape.hxx>
9 #include <TopoDS_Shape.hxx>
13 IMPLEMENT_STANDARD_HANDLE(HYDROData_Object,HYDROData_Entity)
14 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Object,HYDROData_Entity)
16 HYDROData_Object::HYDROData_Object()
21 HYDROData_Object::~HYDROData_Object()
25 void HYDROData_Object::SetTopShape( const TopoDS_Shape& theShape )
27 TNaming_Builder aBuilder( myLab.FindChild( DataTag_TopShape ) );
28 aBuilder.Generated( theShape );
31 void HYDROData_Object::SetShape3D( const TopoDS_Shape& theShape )
33 TNaming_Builder aBuilder( myLab.FindChild( DataTag_Shape3D ) );
34 aBuilder.Generated( theShape );
37 void HYDROData_Object::SetBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry )
39 SetReferenceObject( theBathymetry, DataTag_Bathymetry );
42 Handle(HYDROData_Bathymetry) HYDROData_Object::GetBathymetry() const
44 return Handle(HYDROData_Bathymetry)::DownCast(
45 GetReferenceObject( DataTag_Bathymetry ) );
48 void HYDROData_Object::RemoveBathymetry()
50 ClearReferenceObjects( DataTag_Bathymetry );
53 TopoDS_Shape HYDROData_Object::getTopShape() const
55 TDF_Label aLabel = myLab.FindChild( DataTag_TopShape, false );
56 if ( !aLabel.IsNull() )
58 Handle(TNaming_NamedShape) aNamedShape;
59 if( aLabel.FindAttribute( TNaming_NamedShape::GetID(), aNamedShape ) )
60 return aNamedShape->Get();
63 return TopoDS_Shape();
66 void HYDROData_Object::removeTopShape()
68 TDF_Label aLabel = myLab.FindChild( DataTag_TopShape, false );
69 if ( !aLabel.IsNull() )
70 aLabel.ForgetAllAttributes();
73 TopoDS_Shape HYDROData_Object::getShape3D() const
75 TDF_Label aLabel = myLab.FindChild( DataTag_Shape3D, false );
76 if ( !aLabel.IsNull() )
78 Handle(TNaming_NamedShape) aNamedShape;
79 if( aLabel.FindAttribute( TNaming_NamedShape::GetID(), aNamedShape ) )
80 return aNamedShape->Get();
83 return TopoDS_Shape();
86 void HYDROData_Object::removeShape3D()
88 TDF_Label aLabel = myLab.FindChild( DataTag_Shape3D, false );
89 if ( !aLabel.IsNull() )
90 aLabel.ForgetAllAttributes();
93 void HYDROData_Object::SetFillingColor( const QColor& theColor )
95 return SetColor( theColor, DataTag_FillingColor );
98 QColor HYDROData_Object::GetFillingColor() const
100 return GetColor( DefaultFillingColor(), DataTag_FillingColor );
103 void HYDROData_Object::SetBorderColor( const QColor& theColor )
105 return SetColor( theColor, DataTag_BorderColor );
108 QColor HYDROData_Object::GetBorderColor() const
110 return GetColor( DefaultBorderColor(), DataTag_BorderColor );
113 QColor HYDROData_Object::DefaultFillingColor()
115 return QColor( Qt::yellow );
118 QColor HYDROData_Object::DefaultBorderColor()
120 return QColor( Qt::transparent );