コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
        } //checkAddShape

        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);
                        }
                    }
                }
            }
        } //CheckAddDbCable