private void CheckAddDbCable( Database.DbElement aDbCable, ArrayList aList ) { if( aDbCable.GetElementType() == Database.DbElementTypeInstance.SCCABLE ) { if( aDbCable.IsValid && aList.IndexOf( aDbCable ) == -1 ) aList.Add( aDbCable ); } else if( aDbCable.GetElementType() == Database.DbElementTypeInstance.SCMCABLE ) { Database.DbElement[] _cables = aDbCable.Members( Database.DbElementTypeInstance.SCCABLE ); if( _cables != null ) { foreach( Database.DbElement _cable in _cables ) { if( _cable.IsValid && aList.IndexOf( _cable ) == -1 ) aList.Add( _cable ); } } } }
public CableInfo( Database.DbElement aCable ) { //if given cable is valid in db: if( aCable.IsValid ) { //get name of given cable mCableName = aCable.GetAsString( Database.DbAttributeInstance.NAMN ); //get cable component name if( aCable.IsAttributeValid( Database.DbAttributeInstance.SPRE ) ) { Database.DbElement _spref = aCable.GetElement( Database.DbAttributeInstance.SPRE ); if( _spref.IsValid ) mComponentName = _spref.GetAsString( Database.DbAttributeInstance.NAMN ); } Database.DbElement _staref = aCable.GetElement( Database.DbAttributeInstance.STAREF ); if( _staref.IsValid ) { if( _staref.GetElementType() == Database.DbElementTypeInstance.SCELCONNECTION ) { mStartElconn = MiscUtilities.GetElemPresName( _staref ); mStartEqui = MiscUtilities.GetElemPresName( _staref.Owner ); } else mStartEqui = MiscUtilities.GetElemPresName( _staref ); } Database.DbElement _endref = aCable.GetElement( Database.DbAttributeInstance.ENDREF ); if( _endref.IsValid ) { if( _endref.GetElementType() == Database.DbElementTypeInstance.SCELCONNECTION ) { mEndElconn = MiscUtilities.GetElemPresName( _endref ); mEndEqui = MiscUtilities.GetElemPresName( _endref.Owner ); } else mEndEqui = MiscUtilities.GetElemPresName( _endref ); } Database.DbElement [] _cores = aCable.Members( Database.DbElementTypeInstance.SCCORE ); //get informaton about cores foreach( Database.DbElement _core in _cores ) { CoreInfo _coreInf = new CoreInfo( _core, this ); mCores.Add( _coreInf ); } } }
/// <summary> /// public constructor /// </summary> /// <param name="aCore">database core element to get information from</param> public CoreInfo( Database.DbElement aCore, CableInfo aCableInfo ) { mStartElconn = aCableInfo.StartElconn; mStartEqui = aCableInfo.StartEqui; mEndElconn = aCableInfo.EndElconn; mEndEqui = aCableInfo.EndEqui; if( aCore.IsValid ) { // get core name mCoreName = aCore.GetAsString( Database.DbAttributeInstance.NAMN ); // get information about elements connected to core head Database.DbElement _elconn = aCore.GetElement( Database.DbAttributeInstance.STAREF ); if( _elconn.IsValid ) { mStartElconn = MiscUtilities.GetElemPresName( _elconn ); mStartEqui = MiscUtilities.GetElemPresName( _elconn.Owner ); } int _point = aCore.GetInteger( Database.DbAttributeInstance.STAPOI ); if( _point == 0 ) mStartPin = UNSET_TEXT; else mStartPin = string.Format( PIN_TEMPLATE, _point.ToString() ); // get information about elements connected to core tail _elconn = aCore.GetElement( Database.DbAttributeInstance.ENDREF ); if( _elconn.IsValid ) { mEndElconn = MiscUtilities.GetElemPresName( _elconn ); mEndEqui = MiscUtilities.GetElemPresName( _elconn.Owner ); } _point = aCore.GetInteger( Database.DbAttributeInstance.ENDPOI ); if( _point == 0 ) mEndPin = UNSET_TEXT; else mEndPin = string.Format( PIN_TEMPLATE, _point.ToString() ); } }