Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }