Beispiel #1
0
        public bool ScanData(Point startPoint, ulong _layerMask, LinkedList <MbeObj> objList)
        {
            Point   ptLT = new Point(startPoint.X - 1, startPoint.Y + 1);
            Point   ptRB = new Point(startPoint.X + 1, startPoint.Y - 1);
            MbeRect rc   = new MbeRect(ptLT, ptRB);

            MbeObj startObj = null;

            ulong layerMask = _layerMask & ((ulong)MbeLayer.LayerValue.PTH |
                                            (ulong)MbeLayer.LayerValue.CMP |
                                            (ulong)MbeLayer.LayerValue.L2 |
                                            (ulong)MbeLayer.LayerValue.L3 |
                                            (ulong)MbeLayer.LayerValue.SOL);



            foreach (MbeObj obj in objList)
            {
                if (obj.DeleteCount >= 0)
                {
                    continue;
                }
                startObj = obj.ConChkSeed(rc, layerMask);
                if (startObj != null)
                {
                    break;
                }
            }
            if (startObj == null)
            {
                return(false);
            }

            return(ScanData(startObj, objList));
        }
Beispiel #2
0
        /// <summary>
        /// workListからひとつのネット情報をobjListNetに取り出す
        /// </summary>
        /// <param name="objListNet"></param>
        /// <param name="pinOnly">ネット出力リストにピン情報だけを返すときtrue</param>
        /// <returns>ひとつもノードが見つからなかった場合はfalseを返す</returns>
        public bool GetNet(LinkedList <MbeObj> objListNet, bool pinOnly)
        {
            //ひとつのネットの起点になるピンを選び出す
            objListNet.Clear();
            MbeObj obj = null;

            foreach (MbeObj _obj in workList)
            {
                //すでにConnectionCheckActiveフラグがあるものは、ネットとして抽出済み
                if (_obj.ConnectionCheckActive)
                {
                    continue;
                }

                if (_obj.Id() == MbeObjID.MbePTH ||
                    _obj.Id() == MbeObjID.MbePinSMD)
                {
                    //if (_obj.TempPropString.Length > 0) {
                    obj = _obj;
                    break;
                    //}
                }
            }
            if (obj == null)
            {
                return(false);
            }

            conChk.Clear();

            //objを起点にして、接続されているものの ConnectionCheckActive 属性を有効にする。
            conChk.ScanData(obj, workList);

            //ConnectionCheckActive 属性が有効で、_obj.DeleteCount が-2でないものが出力リストに未登録。
            foreach (MbeObj _obj in workList)
            {
                if (_obj.ConnectionCheckActive && _obj.DeleteCount != -2)
                {
                    _obj.DeleteCount = -2;
                    if (pinOnly)
                    {
                        if (_obj.Id() == MbeObjID.MbePTH ||
                            _obj.Id() == MbeObjID.MbePinSMD)
                        {
                            if (_obj.TempPropString.Length > 0)
                            {
                                objListNet.AddLast(_obj);
                            }
                        }
                    }
                    else
                    {
                        objListNet.AddLast(_obj);
                    }
                }
            }
            return(true);
        }
Beispiel #3
0
        /// <summary>
        /// ReadCE3のストリームから、startWordで始まるMbeObjを読み取る
        /// </summary>
        /// <param name="readMb3"></param>
        /// <param name="startWord"></param>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static ReadCE3.RdStatus ReadMbeObj(ReadCE3 readMb3, string startWord, out MbeObj obj)
        {
            ReadCE3.RdStatus result = ReadCE3.RdStatus.NoError;
            obj = null;
            if (startWord == "+MBE_HOLE")
            {
                obj = new MbeObjHole();
            }
            else if (startWord == "+MBE_PTH")
            {
                obj = new MbeObjPTH();
            }
            else if (startWord == "+MBE_PINSMD")
            {
                obj = new MbeObjPinSMD(true);
            }
            else if (startWord == "+MBE_FLASHMARK")
            {
                obj = new MbeObjPinSMD(false);
            }
            else if (startWord == "+MBE_LINE")
            {
                obj = new MbeObjLine();
            }
            else if (startWord == "+MBE_POLYGON")
            {
                obj = new MbeObjPolygon();
            }
            else if (startWord == "+MBE_TEXT")
            {
                obj = new MbeObjText();
            }
            else if (startWord == "+MBE_ARC")
            {
                obj = new MbeObjArc();
            }
            else if (startWord == "+MBE_COMPONENT")
            {
                obj = new MbeObjComponent();
            }
            else
            {
                string strSkipTo = "-" + startWord.Substring(1);
                readMb3.SkipTo(strSkipTo);
            }

            if (obj != null)
            {
                result = obj.RdMb3(readMb3);
                if (result != ReadCE3.RdStatus.NoError)
                {
                    obj = null;
                }
            }
            return(result);
        }
        ///// <summary>
        ///// 分割。線分系オブジェクトで意味を持つ。
        ///// </summary>
        ///// <param name="lineIndex">分割可能な線のインデックス。単純ラインなら無視。</param>
        ///// <param name="ptDivAt"></param>
        ///// <returns></returns>
        //public override bool DivideAtCenter(int lineIndex, out MbeObj newObj)
        //{
        //    newObj = null;
        //    if (lineIndex >= posCount) return false;
        //    int index2 = lineIndex + 1;
        //    if (index2 >= posCount) index2 = 1;

        //    Point pt0 = this.GetPos(lineIndex);
        //    Point pt1 = this.GetPos(index2);
        //    Point ptDivAt = new Point((pt0.X + pt1.X) / 2, (pt0.Y + pt1.Y) / 2);

        //    return AddPointAt(ptDivAt, lineIndex);
        //}

        /// <summary>
        /// 指定点で分割。線分系オブジェクトで意味を持つ。
        /// </summary>
        /// <param name="lineIndex">分割可能な線のインデックス。単純ラインなら無視。</param>
        /// <param name="ptDivAt"></param>
        /// <returns></returns>
        public override bool DivideAtPoint(int lineIndex, Point pt, out MbeObj newObj)
        {
            newObj = null;
            //if (lineIndex >= posCount) return false;
            //int index2 = lineIndex + 1;
            //if (index2 >= posCount) index2 = 1;

            //Point pt0 = this.GetPos(lineIndex);
            //Point pt1 = this.GetPos(index2);
            //Point ptDivAt = new Point((pt0.X + pt1.X) / 2, (pt0.Y + pt1.Y) / 2);

            return(AddPointAt(pt, lineIndex));
        }
Beispiel #5
0
        public bool ScanData(MbeObj startObj, LinkedList <MbeObj> objList)
        {
            startObj.SetConnectCheck();
            AddObjPoint(startObj);

            LinkedListNode <MbeConChkElm> node = chkPointList.First;

            while (node != null)
            {
                scanObj(node.Value, objList);
                node = node.Next;
            }
            return(true);
        }
Beispiel #6
0
        ///// <summary>
        ///// 分割。線分系オブジェクトで意味を持つ。
        ///// </summary>
        ///// <param name="lineIndex">分割可能な線のインデックス。単純ラインなら無視。</param>
        ///// <param name="ptDivAt"></param>
        ///// <returns></returns>
        //public override bool DivideAtCenter(int lineIndex, out MbeObj newObj)
        //{
        //    Point pt0 = this.GetPos(0);
        //    Point pt1 = this.GetPos(1);
        //    Point ptDivAt = new Point((pt0.X + pt1.X) / 2, (pt0.Y + pt1.Y) / 2);
        //    newObj = Duplicate();
        //    SetPos(ptDivAt, 1);
        //    newObj.SetPos(ptDivAt, 0);
        //    return true;
        //}

        /// <summary>
        /// 指定点で分割。線分系オブジェクトで意味を持つ。
        /// </summary>
        /// <param name="lineIndex">分割可能な線のインデックス。単純ラインなら無視。</param>
        /// <param name="ptDivAt"></param>
        /// <returns></returns>
        public override bool DivideAtPoint(int lineIndex, Point pt, out MbeObj newObj)
        {
            newObj = Duplicate();
            if (lineIndex == 0)
            {
                SetPos(pt, 1);
                newObj.SetPos(pt, 0);
            }
            else
            {
                SetPos(pt, 0);
                newObj.SetPos(pt, 1);
            }

            return(true);
        }
Beispiel #7
0
 /// <summary>
 /// コピーコンストラクタ
 /// </summary>
 /// <param name="mbeObj"></param>
 protected MbeObj(MbeObj mbeObj)
 {
     posCount   = mbeObj.posCount;
     posArray   = new Point[posCount];
     selectFlag = new bool[posCount];
     for (int i = 0; i < posCount; i++)
     {
         posArray[i]   = mbeObj.posArray[i];
         selectFlag[i] = mbeObj.selectFlag[i];
     }
     layer                 = MbeLayer.LayerValue.NUL;
     Layer                 = mbeObj.layer;
     signame               = mbeObj.signame;
     addCount              = mbeObj.addCount;
     deleteCount           = mbeObj.deleteCount;
     connectionCheckActive = mbeObj.connectionCheckActive;
     strTempProp           = mbeObj.strTempProp;
 }
Beispiel #8
0
 /// <summary>
 /// 同じ場所に同じオブジェクトが重なるのを防ぐ
 /// </summary>
 /// <param name="obj"></param>
 /// <returns>比較対象と重ならないときにtrue</returns>
 public virtual bool CheckRejectOverlay(MbeObj obj)
 {
     if (Id() != obj.Id())
     {
         return(false);
     }
     for (int i = 0; i < posCount; i++)
     {
         if (posArray[i] != obj.posArray[i])
         {
             return(false);
         }
     }
     if (Layer != obj.layer)
     {
         return(false);
     }
     return(true);
 }
 /// <summary>
 /// コピーコンストラクタ
 /// </summary>
 /// <param name="mbeObjPin"></param>
 public MbeObjComponent(MbeObjComponent mbeObjComponent)
     : base(mbeObjComponent)
 {
     //layer = mbeObjComponent.layer;
     refNum      = (MbeObjText)mbeObjComponent.refNum.Duplicate();
     packageName = mbeObjComponent.packageName;
     remarksText = mbeObjComponent.remarksText;
     angleX10    = mbeObjComponent.angleX10;
     //pinCount = mbeObjComponent.pinCount;
     if (mbeObjComponent.contentsObj != null)
     {
         int n = mbeObjComponent.contentsObj.Count;
         contentsObj = new List <MbeObj>(n);
         for (int i = 0; i < n; i++)
         {
             MbeObj obj = mbeObjComponent.contentsObj[i];
             if (obj != null)
             {
                 contentsObj.Add(obj.Duplicate());
             }
         }
     }
 }
Beispiel #10
0
        /// <summary>
        /// オブジェクトの点を追加する
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        protected bool AddObjPoint(MbeObj obj)
        {
            if (obj.DeleteCount >= 0)
            {
                return(false);
            }
            if (((ulong)obj.Layer & ((ulong)MbeLayer.LayerValue.CMP |
                                     (ulong)MbeLayer.LayerValue.L2 |
                                     (ulong)MbeLayer.LayerValue.L3 |
                                     (ulong)MbeLayer.LayerValue.SOL |
                                     (ulong)MbeLayer.LayerValue.PTH)) == 0)
            {
                return(false);
            }

            if (obj.Id() == MbeObjID.MbePTH ||
                obj.Id() == MbeObjID.MbePinSMD ||
                obj.Id() == MbeObjID.MbePolygon)
            {
                return(AddPoint(obj.GetPos(0), (ulong)obj.Layer));
            }
            if (obj.Id() == MbeObjID.MbeLine)
            {
                bool result = AddPoint(obj.GetPos(0), (ulong)obj.Layer);
                result |= AddPoint(obj.GetPos(1), (ulong)obj.Layer);
                return(result);
            }
            if (obj.Id() == MbeObjID.MbeArc)
            {
                bool result = AddPoint(obj.GetPos(1), (ulong)obj.Layer);
                result |= AddPoint(obj.GetPos(2), (ulong)obj.Layer);
                return(result);
            }

            return(false);
        }
Beispiel #11
0
        ///// <summary>
        ///// 中央で分割。線分系オブジェクトで意味を持つ。
        ///// </summary>
        ///// <param name="lineIndex">分割可能な線のインデックス。単純ラインなら無視。</param>
        ///// <param name="ptDivAt"></param>
        ///// <returns></returns>
        //public virtual bool DivideAtCenter(int lineIndex, out MbeObj newObj)
        //{
        //    newObj = null;
        //    return false;
        //}

        /// <summary>
        /// 指定点で分割。線分系オブジェクトで意味を持つ。
        /// </summary>
        /// <param name="lineIndex">分割可能な線のインデックス。単純ラインなら無視。</param>
        /// <param name="ptDivAt"></param>
        /// <returns></returns>
        public virtual bool DivideAtPoint(int lineIndex, Point pt, out MbeObj newObj)
        {
            newObj = null;
            return(false);
        }
Beispiel #12
0
        /// <summary>
        /// objがchkPointと接続されているかの判定を行う
        /// </summary>
        /// <param name="chkPoint"></param>
        /// <param name="obj"></param>
        /// <returns></returns>
        protected bool testObj(MbeConChkElm chkPoint, MbeObj obj)
        {
            if (obj.DeleteCount >= 0)
            {
                return(false);
            }
            if (obj.ConnectionCheckActive)
            {
                return(false);
            }

            if (obj.Id() == MbeObjID.MbePTH)
            {
                if (obj.GetPos(0).Equals(chkPoint.pt))
                {
                    obj.SetConnectCheck();
                    AddObjPoint(obj);                           //反対面にchkPointの追加
                    return(true);
                }
            }
            else if (obj.Id() == MbeObjID.MbePinSMD)
            {
                if ((chkPoint.layer == (ulong)obj.Layer) && obj.GetPos(0).Equals(chkPoint.pt))
                {
                    obj.SetConnectCheck();
                    return(true);
                }
            }
            else if (obj.Id() == MbeObjID.MbePolygon)
            {
                if ((chkPoint.layer == (ulong)obj.Layer) && obj.GetPos(0).Equals(chkPoint.pt))
                {
                    obj.SetConnectCheck();
                    return(true);
                }
            }
            else if (obj.Id() == MbeObjID.MbeArc)
            {
                if (chkPoint.layer != (ulong)obj.Layer)
                {
                    return(false);
                }
                if (obj.GetPos(1).Equals(chkPoint.pt))
                {
                    obj.SetConnectCheck();
                    AddPoint(obj.GetPos(2), (ulong)obj.Layer);
                }
                if (obj.GetPos(2).Equals(chkPoint.pt))
                {
                    obj.SetConnectCheck();
                    AddPoint(obj.GetPos(1), (ulong)obj.Layer);
                }
                return(obj.ConnectionCheckActive);
            }
            else if (obj.Id() == MbeObjID.MbeLine)
            {
                if (chkPoint.layer != (ulong)obj.Layer)
                {
                    return(false);
                }
                if (obj.GetPos(0).Equals(chkPoint.pt))
                {
                    obj.SetConnectCheck();
                    AddPoint(obj.GetPos(1), (ulong)obj.Layer);
                }
                if (obj.GetPos(1).Equals(chkPoint.pt))
                {
                    obj.SetConnectCheck();
                    AddPoint(obj.GetPos(0), (ulong)obj.Layer);
                }
                return(obj.ConnectionCheckActive);
            }
            else if (obj.Id() == MbeObjID.MbeComponent)
            {
                bool result = false;
                foreach (MbeObj objContent in ((MbeObjComponent)obj).ContentsObj)
                {
                    result |= testObj(chkPoint, objContent);                            //再帰呼び出し
                }
                return(result);
            }
            return(false);
        }
Beispiel #13
0
 protected MbeGapChkObj()
 {
     netNum = -1;
     mbeObj = null;
     status = 0;
 }