TDataStd_Name::Set(myLab, TCollection_ExtendedString(theName.toLatin1().constData()));
}
-bool HYDROData_Object::IsVisible( const int theViewId ) const
-{
- ViewId2VisualStateMap aMap;
- GetViewId2VisualStateMap( aMap );
- if( aMap.find( theViewId ) != aMap.end() )
- {
- const VisualState& aVisualState = aMap[ theViewId ];
- return aVisualState.Visibility;
- }
- return false;
-}
-
-void HYDROData_Object::SetVisible( const int theViewId,
- const bool theVal )
-{
- if( theViewId == 0 )
- return;
-
- ViewId2VisualStateMap aMap;
- GetViewId2VisualStateMap( aMap );
-
- VisualState& aVisualState = aMap[ theViewId ];
- aVisualState.Visibility = theVal;
-
- SetViewId2VisualStateMap( aMap );
-}
-
bool HYDROData_Object::IsRemoved() const
{
return !myLab.HasAttribute();
return (const char*)(&(aData->InternalArray()->ChangeArray1().ChangeValue(1)));
return NULL;
}
-
-void HYDROData_Object::GetViewId2VisualStateMap( ViewId2VisualStateMap& theMap ) const
-{
- theMap.clear();
-
- TDF_Label aViewIdLab = myLab.FindChild( DataTag_ViewId );
- TDF_Label aVisibilityLab = myLab.FindChild( DataTag_Visibility );
- TDF_Label aTransparencyLab = myLab.FindChild( DataTag_Transparency );
- TDF_Label aZValueLab = myLab.FindChild( DataTag_ZValue );
-
- Handle(TDataStd_IntegerArray) aViewIdArray;
- Handle(TDataStd_BooleanArray) aVisibilityArray;
- Handle(TDataStd_RealArray) aTransparencyArray;
- Handle(TDataStd_RealArray) aZValueArray;
-
- if( !aViewIdLab.FindAttribute( TDataStd_IntegerArray::GetID(), aViewIdArray ) ||
- !aVisibilityLab.FindAttribute( TDataStd_BooleanArray::GetID(), aVisibilityArray ) ||
- !aTransparencyLab.FindAttribute( TDataStd_RealArray::GetID(), aTransparencyArray ) ||
- !aZValueLab.FindAttribute( TDataStd_RealArray::GetID(), aZValueArray ) )
- return;
-
- int aSize = qMin( qMin( aViewIdArray->Length(), aVisibilityArray->Length() ),
- qMin( aTransparencyArray->Length(), aZValueArray->Length() ) );
- for( int anIndex = 0; anIndex < aSize; anIndex++ )
- {
- int aViewId = aViewIdArray->Value( anIndex );
- VisualState aVisualState;
- aVisualState.Visibility = aVisibilityArray->Value( anIndex );
- aVisualState.Transparency = aTransparencyArray->Value( anIndex );
- aVisualState.ZValue = aZValueArray->Value( anIndex );
- theMap[ aViewId ] = aVisualState;
- }
-}
-
-void HYDROData_Object::SetViewId2VisualStateMap( const ViewId2VisualStateMap& theMap )
-{
- TDF_Label aViewIdLab = myLab.FindChild( DataTag_ViewId );
- TDF_Label aVisibilityLab = myLab.FindChild( DataTag_Visibility );
- TDF_Label aTransparencyLab = myLab.FindChild( DataTag_Transparency );
- TDF_Label aZValueLab = myLab.FindChild( DataTag_ZValue );
-
- aViewIdLab.ForgetAllAttributes();
- aVisibilityLab.ForgetAllAttributes();
- aTransparencyLab.ForgetAllAttributes();
- aZValueLab.ForgetAllAttributes();
-
- int aSize = theMap.size();
-
- Handle(TDataStd_IntegerArray) aViewIdArray =
- TDataStd_IntegerArray::Set( aViewIdLab, 0, aSize-1 );
- Handle(TDataStd_BooleanArray) aVisibilityArray =
- TDataStd_BooleanArray::Set( aVisibilityLab, 0, aSize-1 );
- Handle(TDataStd_RealArray) aTransparencyArray =
- TDataStd_RealArray::Set( aTransparencyLab, 0, aSize-1 );
- Handle(TDataStd_RealArray) aZValueArray =
- TDataStd_RealArray::Set( aZValueLab, 0, aSize-1 );
-
- int anIndex = 0;
- ViewId2VisualStateMapIterator anIter( theMap );
- while( anIter.hasNext() )
- {
- int aViewId = anIter.next().key();
- const VisualState& aVisualState = anIter.value();
- aViewIdArray->SetValue( anIndex, aViewId );
- aVisibilityArray->SetValue( anIndex, aVisualState.Visibility );
- aTransparencyArray->SetValue( anIndex, aVisualState.Transparency );
- aZValueArray->SetValue( anIndex, aVisualState.ZValue );
- anIndex++;
- }
-}