#include "HYDRO_trace.hxx"
HYDROData_SequenceOfObjects::HYDROData_SequenceOfObjects()
- : NCollection_Sequence<Handle_HYDROData_Entity>()
+ : NCollection_Sequence<Handle(HYDROData_Entity)>()
{
}
HYDROData_SequenceOfObjects::HYDROData_SequenceOfObjects( const HYDROData_SequenceOfObjects& theSequence )
- : NCollection_Sequence<Handle_HYDROData_Entity>( theSequence )
+ : NCollection_Sequence<Handle(HYDROData_Entity)>( theSequence )
{
}
-HYDROData_SequenceOfObjects::HYDROData_SequenceOfObjects( const NCollection_Sequence<Handle_HYDROData_Entity>& theSequence )
- : NCollection_Sequence<Handle_HYDROData_Entity>( theSequence )
+HYDROData_SequenceOfObjects::HYDROData_SequenceOfObjects( const NCollection_Sequence<Handle(HYDROData_Entity)>& theSequence )
+ : NCollection_Sequence<Handle(HYDROData_Entity)>( theSequence )
{
}
-IMPLEMENT_STANDARD_HANDLE(HYDROData_Entity,MMgt_TShared)
IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Entity,MMgt_TShared)
// is equal function for unique object mapping
-bool IsEqual(const Handle_HYDROData_Entity& theObj1, const Handle_HYDROData_Entity& theObj2)
+bool IsEqual(const Handle(HYDROData_Entity)& theObj1, const Handle(HYDROData_Entity)& theObj2)
{
if ( !theObj1.IsNull() && !theObj2.IsNull() )
return theObj1->Label() == theObj2->Label();
return HYDROData_SequenceOfObjects();
}
-Standard_Boolean HYDROData_Entity::GetZLevel( Standard_Integer& theLevel ) const
+bool HYDROData_Entity::GetZLevel( Standard_Integer& theLevel ) const
{
theLevel = -1;
if ( aLabel.FindAttribute( TDataStd_Integer::GetID(), anIntVal ) )
{
theLevel = anIntVal->Get();
- return Standard_True;
+ return true;
}
}
- return Standard_False;
+ return false;
}
void HYDROData_Entity::SetZLevel( const Standard_Integer& theLevel )
void HYDROData_Entity::SetLabel( const TDF_Label& theLabel )
{
- myLab = theLabel;
+ myLab = theLabel;
}
void HYDROData_Entity::SaveByteArray( const int theTag,
return aRefs.IsNull() ? 0 : aRefs->Extent();
}
-bool HYDROData_Entity::HasReference( const Handle_HYDROData_Entity& theObj,
+bool HYDROData_Entity::HasReference( const Handle(HYDROData_Entity)& theObj,
const int theTag ) const
{
if ( theObj.IsNull() )
return false;
}
-void HYDROData_Entity::AddReferenceObject( const Handle_HYDROData_Entity& theObj,
+void HYDROData_Entity::AddReferenceObject( const Handle(HYDROData_Entity)& theObj,
const int theTag )
{
if ( theObj.IsNull() )
aRefs->Append( theObj->Label() );
}
-void HYDROData_Entity::SetReferenceObject( const Handle_HYDROData_Entity& theObj,
+void HYDROData_Entity::SetReferenceObject( const Handle(HYDROData_Entity)& theObj,
const int theTag,
const int theIndex )
{
}
}
-void HYDROData_Entity::InsertReferenceObject( const Handle_HYDROData_Entity& theObj,
+void HYDROData_Entity::InsertReferenceObject( const Handle(HYDROData_Entity)& theObj,
const int theTag,
const int theBeforeIndex )
{
Handle(HYDROData_Entity) HYDROData_Entity::GetReferenceObject( const int theTag,
const int theIndex ) const
{
+ //DEBTRACE("GetReferenceObject " << theTag << " " << theIndex);
Handle(HYDROData_Entity) aRes;
Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, false );
Handle(TDataStd_ReferenceList) HYDROData_Entity::getReferenceList( const int theTag,
const bool theIsCreate ) const
{
+ //DEBTRACE("getReferenceList " << theTag << " " << theIsCreate);
TDF_Label aLabel = theTag == 0 ? myLab : myLab.FindChild( theTag );
Handle(TDataStd_ReferenceList) aRefs;
if ( !aLabel.FindAttribute( TDataStd_ReferenceList::GetID(), aRefs ) && theIsCreate )
aRefs = TDataStd_ReferenceList::Set( aLabel );
-
return aRefs;
}
QString HYDROData_Entity::getPyTypeID() const
{
- DEBTRACE("HYDROData_Entity::getPyTypeID " << GetKind());
+ //DEBTRACE("HYDROData_Entity::getPyTypeID " << GetKind());
switch( GetKind() )
{
case KIND_IMAGE: return "KIND_IMAGE";
return anAttr->Get();
}
+
+void HYDROData_Entity::SetInteger( int theTag, int theValue )
+{
+ Handle(TDataStd_Integer) anAttr;
+ TDF_Label aLabel = myLab.FindChild( theTag );
+ if( !aLabel.FindAttribute( TDataStd_Integer::GetID(), anAttr ) )
+ aLabel.AddAttribute( anAttr = new TDataStd_Integer() );
+ anAttr->Set( theValue );
+}
+
+int HYDROData_Entity::GetInteger( int theTag, int theDefValue ) const
+{
+ Handle(TDataStd_Integer) anAttr;
+ TDF_Label aLabel = myLab.FindChild( theTag );
+ if( !aLabel.FindAttribute( TDataStd_Integer::GetID(), anAttr ) )
+ return 0;
+
+ return anAttr->Get();
+}
+
+bool HYDROData_Entity::CompareLabels(const Handle(HYDROData_Entity)& theOtherObj)
+{
+ if ( !theOtherObj.IsNull() )
+ return this->Label() == theOtherObj->Label();
+ return false;
+}
+