コード例 #1
0
        public bool FullFill(MbeObjPolygon polygon, LinkedList <MbeGapChkObj> objList)
        {
            int posCouont = polygon.PosCount;

            layer      = polygon.Layer;
            traceWidth = polygon.TraceWidth;
            patternGap = polygon.PatternGap;
            thermalGap = polygon.ThermalGap;


            orgFrameLineList.Clear();
            frameLineList.Clear();
            fillLineList.Clear();
            outlineList.Clear();

            if (!SetFrame(polygon))
            {
                return(false);
            }
            PlaceFillLines();

            foreach (MbeGapChkObjLine obj in frameLineList)
            {
                objList.AddLast(obj);
            }
            foreach (MbeGapChkObjLine obj in fillLineList)
            {
                objList.AddLast(obj);
            }
            return(true);
        }
コード例 #2
0
ファイル: MbeObj.cs プロジェクト: ShuDiamonds/PIC-project
        /// <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);
        }
コード例 #3
0
 /// <summary>
 /// コピーコンストラクタ
 /// </summary>
 /// <param name="mbeObjPolygon"></param>
 public MbeObjPolygon(MbeObjPolygon mbeObjPolygon)
     : base(mbeObjPolygon)
 {
     traceWidth      = mbeObjPolygon.traceWidth;
     patternGap      = mbeObjPolygon.patternGap;
     thermalGap      = mbeObjPolygon.thermalGap;
     fillingPriority = mbeObjPolygon.fillingPriority;
     removeFloating  = mbeObjPolygon.removeFloating;
     restrictMask    = mbeObjPolygon.restrictMask;
     fillLineList    = new LinkedList <MbeGapChkObjLine>();
     foreach (MbeGapChkObjLine obj in mbeObjPolygon.fillLineList)
     {
         fillLineList.AddLast(obj);
     }
 }
コード例 #4
0
        /// <summary>
        /// 多角形の枠線の生成
        /// </summary>
        /// <param name="polygon"></param>
        /// <returns></returns>
        protected bool SetFrame(MbeObjPolygon polygon)
        {
            if (!polygon.IsValid())
            {
                return(false);
            }

            //frameLineList.Clear();

            int posCouont = polygon.PosCount;

            //layer = polygon.Layer;
            //traceWidth = polygon.TraceWidth;

            ptConnect = polygon.GetPos(0);
            for (int i = 1; i < posCouont; i++)
            {
                int index2 = i + 1;
                if (index2 >= posCouont)
                {
                    index2 = 1;
                }
                Point pt0 = polygon.GetPos(i);
                Point pt1 = polygon.GetPos(index2);
                if (i == 1)
                {
                    rcArea = new MbeRect(pt0, pt1);
                }
                else if (index2 > 1)
                {
                    rcArea.Or(pt1);
                }
                MbeGapChkObjLine objLine;
                objLine        = new MbeGapChkObjLine();
                objLine.status = LINE_STATUS_FRAME;
                objLine.layer  = layer;
                objLine.SetLineValue(pt0, pt1, traceWidth);
                orgFrameLineList.AddLast(objLine);
                objLine        = new MbeGapChkObjLine();
                objLine.status = LINE_STATUS_FRAME;
                objLine.layer  = layer;
                objLine.SetLineValue(pt0, pt1, traceWidth);
                frameLineList.AddLast(objLine);
            }
            return(true);
        }
コード例 #5
0
        /// <summary>
        /// ポリゴンのプロパティ編集ダイアログの起動
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        private bool EditPropertyPolygon(MbeObjPolygon obj)
        {
            SetPolygonForm dlg = new SetPolygonForm();

            dlg.PatternGap     = obj.PatternGap;
            dlg.TraceWidth     = obj.TraceWidth;
            dlg.Priority       = obj.FillingPriority;
            dlg.RemoveFloating = (obj.RemoveFloating ? CheckState.Checked : CheckState.Unchecked);
            dlg.RestrictMask   = (obj.RestrictMask ? CheckState.Checked : CheckState.Unchecked);
            DialogResult retv = dlg.ShowDialog();

            if (retv == DialogResult.OK)
            {
                obj.PatternGap      = dlg.PatternGap;
                obj.TraceWidth      = dlg.TraceWidth;
                obj.FillingPriority = dlg.Priority;
                obj.RemoveFloating  = (dlg.RemoveFloating == CheckState.Checked);
                obj.RestrictMask    = (dlg.RestrictMask == CheckState.Checked);
                return(true);
            }
            return(false);
        }
コード例 #6
0
        /// <summary>
        /// 複製を行う
        /// </summary>
        /// <returns></returns>
        public override MbeObj Duplicate()
        {
            MbeObj newObj = new MbeObjPolygon(this);

            return(newObj);
        }
コード例 #7
0
        /// <summary>
        /// 塗りつぶしのアップデートを行う
        /// </summary>
        /// <param name="polygon"></param>
        /// <param name="objList"></param>
        /// <returns></returns>
        public bool UpdateFill(MbeObjPolygon polygon, LinkedList <MbeObj> mainList)
        {
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            long time_ms;

            int posCouont = polygon.PosCount;

            layer          = polygon.Layer;
            traceWidth     = polygon.TraceWidth;
            patternGap     = polygon.PatternGap;
            thermalGap     = polygon.ThermalGap;
            removeFloating = polygon.RemoveFloating;


            orgFrameLineList.Clear();
            frameLineList.Clear();
            fillLineList.Clear();
            outlineList.Clear();

            //-----------------------------------------
            sw.Start();
            if (!SetFrame(polygon))
            {
                return(false);
            }
            //PlaceFillLines();

            SetupWorkList(mainList);
            SetupNetInfo(polygon.GetPos(0), polygon.Layer);
            sw.Stop();
            time_ms = sw.ElapsedMilliseconds;
            System.Diagnostics.Debug.WriteLine("Fill polygon Step1: " + time_ms);
            sw.Reset();
            //-----------------------------------------
            sw.Start();
            PlaceOutlines();
            PlaceFillLines();
            sw.Stop();
            time_ms = sw.ElapsedMilliseconds;
            System.Diagnostics.Debug.WriteLine("Fill polygon Step2: " + time_ms);
            sw.Reset();
            //-----------------------------------------
            sw.Start();
            TrimFillLines();
            sw.Stop();
            time_ms = sw.ElapsedMilliseconds;
            System.Diagnostics.Debug.WriteLine("Fill polygon Step3: " + time_ms);
            sw.Reset();
            //-----------------------------------------
            sw.Start();

            foreach (MbeGapChkObjLine obj in outlineList)
            {
                fillLineList.AddLast(obj);
            }
            outlineList.Clear();
            if (removeFloating)
            {
                RemoveIsland();
            }
            sw.Stop();
            time_ms = sw.ElapsedMilliseconds;
            System.Diagnostics.Debug.WriteLine("Fill polygon Step4: " + time_ms);
            sw.Reset();

            ClearConnectCheck();            //これを忘れると接続ネットの描画がハイライトになる。

            ClearWorkFlag();

            polygon.fillLineList.Clear();
            //foreach (MbeGapChkObjLine obj in frameLineList) {
            //    polygon.fillLineList.AddLast(obj);
            //}
            foreach (MbeGapChkObjLine obj in fillLineList)
            {
                if (obj.netNum != -1 || !removeFloating)
                {
                    polygon.fillLineList.AddLast(obj);
                }
            }
            //foreach (MbeGapChkObjLine obj in outlineList) {
            //    polygon.fillLineList.AddLast(obj);
            //}

            //foreach (MbeGapChkObjLine obj in polygon.fillLineList) {
            //    Point pt0 = obj.p0;
            //    Point pt1 = obj.p1;
            //    System.Diagnostics.Debug.WriteLine("Fill  " + pt0.X + "," + pt0.Y + "," + pt1.X + "," + pt1.Y);
            //}


            return(true);
        }