Example #1
0
        public void TestOne()
        {
            for (int i = 0; i < 10000000; i++)
            {
                var value = new LineSt
                {
                    //Text = "This is a new line in the struct.",
                    //FormattedText = "This is a new line in the struct.",
                    number  = 1,
                    reverse = false
                };

                //value.FormattedText = $"{value.number}: {value.Text}";
                LineStruct.Add(value);
            }
        }
Example #2
0
        //THE ACTUAL SHAPE RENDERING IS HERE

        public void render(Shape.Line line, int thickness = 1, Brush color = null)
        {
            Pen pcolor;

            if (color == null)
            {
                pcolor = new Pen(Brushes.Black, thickness);
            }
            else
            {
                pcolor = new Pen(color, thickness);
            }
            LineStruct ls = new LineStruct(line, pcolor);

            renderlist.Add(ls);
            renderct++;
        }
Example #3
0
    void OnGUI()
    {
        //Creating struct "Line1"
        LineStruct Line1 = new LineStruct();
        Line1.vecA = new Vector2(10, 10);
        Line1.vecB = new Vector2(60, 10);
        Line1.color = Color.blue;
        Line1.thickness = 3;

        if (GuiActive) {
            GuiHelper.DrawLine(Line1.vecA, Line1.vecB, Line1.color, Line1.thickness);
        }

        if (EscMenu.EscMenuActive) {
            EscMenu.Draw();
        }

        if (OptionsMenu.OptionsMenuActive) {
            OptionsMenu.Draw();
        }
    }
Example #4
0
 public void SetLine(LineStruct inLine, string inName, int priority, int ndNumber, bool makeFixed)
 {
     int layer = inLine.type;
     NodePoint ndPoint = new NodePoint(inName, priority, ndNumber);
     if (inLine.Height > 0)
     {
         for (int y = inLine.Bottom; y <= inLine.Top; y++)
         {
             bool isSrs = layoutMap[inLine.X][y][layer].isSource;
             layoutMap[inLine.X][y][layer] = new NodePoint(ndPoint);
             layoutMap[inLine.X][y][layer].isSource = isSrs;
             layoutMap[inLine.X][y][layer].number = -1;//change!
             layoutMap[inLine.X][y][layer].isFixed = makeFixed;
         }
     }
     if (inLine.Width > 0)
     {
         for (int x = inLine.Left; x <= inLine.Right; x++)
         {
             bool isSrs = layoutMap[x][inLine.Y][layer].isSource;
             layoutMap[x][inLine.Y][layer] = new NodePoint(ndPoint);
             layoutMap[x][inLine.Y][layer].isSource = isSrs;
             layoutMap[x][inLine.Y][layer].number = -1;
             layoutMap[x][inLine.Y][layer].isFixed = makeFixed;
         }
     }
 }
Example #5
0
 private string GetLineW(LineStruct inLine)
 {
     if ( (inLine.Length() <= 1)  || (inLine.type == Material.na_) || (inLine.type == Material.pa_) )
     {
         return "-2.00";
     }
     return "1.00";
 }
Example #6
0
 private double CorrectTop(LineStruct inLine)
 {
     if ( (inLine.type == Layers.siliconTrace) && (inLine.Width == 0) )
     {
         if ( (inLine.Top == (Params.lineN - 1)) || (inLine.Top == (Params.lineP - 1)) )
             return (-0.1);
     }
     return 0.0;
 }
Example #7
0
 private double CorrectBottom(LineStruct inLine)
 {
     if ( (inLine.type == Layers.siliconTrace) && (inLine.Width == 0) )
     {
         if ( (inLine.Bottom == (Params.lineN + 1)) || (inLine.Bottom == (Params.lineP + 1)) )
             return 0.1;
     }
     return 0.0;
 }
Example #8
0
        public NodeTraces RecoveryFixedPath(ContactSimple startPoint, string curName)
        {
            NodeTraces trace = new NodeTraces();

            //List<ContactSimple> endPts = GetSourceContacts(endPoint, curName);
            ContactSimple sPoint = new ContactSimple(startPoint);
            /*foreach (ContactSimple cnt in GetSourceContacts(startPoint, curName))
                if (GetPoint(cnt).isFixed)
                    sPoint = cnt;*/
            List<ContactSimple> passedPts = new List<ContactSimple>();

            if (!startPoint.isInOut())
            {
                sPoint = startPoint.GetInDiffusionEdge();//.GetHigherPoint(0);
                //if (startPoint.y > Params.lineMiddle)
                  //  sPoint = startPoint.GetLowerPoint(0);
            }

            NodePoint ndPoint = GetPoint(sPoint);
            passedPts.Add(sPoint);
            LineStruct ln = new LineStruct(startPoint, startPoint);
            do
            {
                foreach (int  lay in Params.allLayersRange[sPoint.layer])//pin-pong + wrong layer!!!!!!
                {
                    ln = GetFixedLine(passedPts, lay, curName);
                    if (ln.Length() > 0)// && (passedPts.FindIndex(el => el == ln.OpositePoint(sPoint)) < 0))
                    {
                        trace.lines.Add(ln);
                        break;
                    }
                }
                sPoint = ln.OpositePoint(sPoint);
                passedPts.Add(sPoint);
                ndPoint = GetPoint(sPoint);
            } while(!ndPoint.isSource && ndPoint.number > 0);//GetPoint(sPoint).isSource

            return trace;
        }
Example #9
0
        private LineStruct GetLineVertical(PairInt curPoint, int layer, string curName)
        {
            int x = curPoint.x;
            int y = curPoint.y;

            //bool upUsed = false, downUsed = false;
            int iUp, iDown;
            int d = layoutMap[x][y][layer].number;
            for (iUp = y + 1; iUp < Params.topEdge; iUp++)
            {
                if ( (layoutMap[x][iUp][layer].number == (d - 1)) &&
                    (layoutMap[x][iUp][layer].name == curName) )
                    d--;
                else
                {
                    break;
                }
            }
            for (iDown = y - 1; iDown >= 0; iDown--)
            {
                if ( (layoutMap[x][iDown][layer].number == (d - 1)) &&
                    (layoutMap[x][iDown][layer].name == curName) )
                    d--;
                else
                    break;
            }

            int heightSeg = iDown - y + 1;
            int startY = y;
            if ( ((y - iDown) < (iUp - y)) )//|| ((y - iDown) < 0) )
                heightSeg = iUp - y - 1;
                //startY = iDown + 1;
            //else

            /*string typeLine = Params.silType;
            if (layer == Layers.metal1Trace)
                typeLine = Params.met1Type;
            else if (layer == Layers.metal2Trace)
                typeLine = Params.met2Type;*/

            LineStruct retLineStr = new LineStruct(new PairInt(x, startY),
                                                   new PairInt(x, startY + heightSeg), layer);

            //if (retLineStr.Y < 0)
            //	return retLineStr;
            return retLineStr;
        }
Example #10
0
        private LineStruct GetLineHorizont_bad(PairInt curPoint, int layer, string curName)
        {
            int x = curPoint.x;
            int y = curPoint.y;

            bool rightUsed = false, leftUsed = false;
            int iRight, iLeft;

            int d = layoutMap[x][y][layer].number;
            for (iRight = x + 1; iRight < wide; iRight++)
            {
                if (layoutMap[iRight][y][layer].isUsed)
                {
                    rightUsed = true;
                    break;
                }
                if ( (layoutMap[iRight][y][layer].number == (d - 1)) &&
                    (layoutMap[iRight][y][layer].name == curName) )
                    d--;
                else
                    break;
            }
            for (iLeft = x - 1; iLeft >= 0; iLeft--)
            {
                if (layoutMap[iLeft][y][layer].isUsed)
                {
                    leftUsed = true;
                    break;
                }
                if ( (layoutMap[iLeft][y][layer].number == (d - 1)) &&
                    (layoutMap[iLeft][y][layer].name == curName) )
                    d--;
                else
                    break;
            }

            int wideSeg = x - iLeft + 1;
            int startX = x;
            if ( ((x - iLeft) > (iRight - x)) || (leftUsed && !rightUsed) )
                startX = iLeft + 1;
            else
                wideSeg = iRight - x - 1;

            /*string typeLine = Params.silType;
            if (layer == Layers.metal1Trace)
                typeLine = Params.met1Type;
            else if (layer == Layers.metal2Trace)
                typeLine = Params.met2Type;*/

            LineStruct retLineStr = new LineStruct(new PairInt(startX, y),
                                                   new PairInt(startX + wideSeg, y), layer);

            return retLineStr;
        }
Example #11
0
        private LineStruct GetLineHorizont(PairInt curPoint, int layer, string curName)
        {
            int x = curPoint.x;
            int y = curPoint.y;
            //string curName = layoutMap[x][y][layer].name;

            int iRight, iLeft;

            int d = layoutMap[x][y][layer].number;
            for (iRight = x + 1; iRight < wide; iRight++)
            {
                if ( (layoutMap[iRight][y][layer].number == (d - 1)) &&
                    (layoutMap[iRight][y][layer].name == curName) )
                    d--;
                else
                    break;
            }
            for (iLeft = x - 1; iLeft >= 0; iLeft--)
            {
                if ( (layoutMap[iLeft][y][layer].number == (d - 1)) &&
                    (layoutMap[iLeft][y][layer].name == curName) )
                    d--;
                else
                    break;
            }

            int wideSeg = iLeft - x + 1;
            int startX = x;
            if ((x - iLeft) < (iRight - x))
                wideSeg = iRight - x - 1;

            LineStruct retLineStr = new LineStruct(new PairInt(startX, y),
                                                   new PairInt(startX + wideSeg, y), layer);

            return retLineStr;
        }
Example #12
0
        private LineStruct GetLineHorizont(List<LineStruct> curLines, PairInt curPoint, int layer, string curName)
        {
            int x = curPoint.x;
            int y = curPoint.y;
            //string curName = layoutMap[x][y][layer].name;

            bool nextCheck = true;
            int iRight, iLeft;

            int d = layoutMap[x][y][layer].number;
            for (iRight = x + 1; (iRight < wide) && nextCheck; iRight++)
            {
                if ( (layoutMap[iRight][y][layer].number == (d - 1)) &&
                    (layoutMap[iRight][y][layer].name == curName) )
                    d--;
                else
                    break;

                foreach (LineStruct ln in curLines)
                    if (ln.OverlapWithPoint(iRight, y, layer))
                        nextCheck = false;
            }
            nextCheck = true;
            for (iLeft = x - 1; (iLeft >= 0) && nextCheck; iLeft--)
            {
                if ( (layoutMap[iLeft][y][layer].number == (d - 1)) &&
                    (layoutMap[iLeft][y][layer].name == curName) )
                    d--;
                else
                    break;

                foreach (LineStruct ln in curLines)
                    if (ln.OverlapWithPoint(iLeft, y, layer))
                        nextCheck = false;
            }

            int wideSeg = iLeft - x + 1;
            int startX = x;
            if ((x - iLeft) < (iRight - x))
                wideSeg = iRight - x - 1;

            LineStruct retLineStr = new LineStruct(new PairInt(startX, y),
                                                   new PairInt(startX + wideSeg, y), layer);

            return retLineStr;
        }
Example #13
0
        private LineStruct GetFixedLine(List<ContactSimple> passedPoints, int layer, string curName)
        {
            ContactSimple curPoint = passedPoints.Last();
            int x = curPoint.x;
            int y = curPoint.y;
            int iUp, iDown, iRight, iLeft;
            int d = 0;//layoutMap[x][y][layer].number;
            for (iUp = y + 1; iUp < Params.topEdge; iUp++)
            {
                if ((layoutMap[x][iUp][layer].isFixed) &&
                    (layoutMap[x][iUp][layer].name == curName))
                    d--;
                else
                {
                    break;
                }
            }
            for (iDown = y - 1; iDown >= 0; iDown--)
            {
                if ((layoutMap[x][iDown][layer].isFixed) &&
                    (layoutMap[x][iDown][layer].name == curName))
                    d--;
                else
                    break;
            }
            for (iRight = x + 1; iRight < wide; iRight++)
            {
                if ((layoutMap[iRight][y][layer].isFixed) &&
                    (layoutMap[iRight][y][layer].name == curName))
                    d--;
                else
                    break;
            }
            for (iLeft = x - 1; iLeft >= 0; iLeft--)
            {
                if ((layoutMap[iLeft][y][layer].isFixed) &&
                    (layoutMap[iLeft][y][layer].name == curName))
                    d--;
                else
                    break;
            }

            /*string typeLine = Params.silType;
            if (layer == Layers.metal1Trace)
                typeLine = Params.met1Type;
            else if (layer == Layers.metal2Trace)
                typeLine = Params.met2Type;*/

            List<LineStruct> lines = new List<LineStruct>();
            lines.Add(new LineStruct(new PairInt(x, y), new PairInt(x, iDown + 1), layer));
            lines.Add(new LineStruct(new PairInt(x, y), new PairInt(x, iUp - 1), layer));
            lines.Add(new LineStruct(new PairInt(x, y), new PairInt(iRight - 1, y), layer));
            lines.Add(new LineStruct(new PairInt(x, y), new PairInt(iLeft + 1, y), layer));
            LineStruct longest = new LineStruct(new PairInt(x, y), new PairInt(x, y), layer);//lines[0];
            foreach (LineStruct ln in lines)
                if ((ln.Length() > longest.Length()) &&
                    (passedPoints.FindIndex(el => (PairInt)el == (PairInt)ln.OpositePoint(curPoint)) < 0))
                    longest = ln;
            return longest;
        }
Example #14
0
        /*private void SpreadUsedNode(Node nd)
        {

            List<int> currentConnection = new List<int>();
            for (int i = 0; i < nd.arcCollection.Count; i++)
            {
                if (currentConnection.FindIndex(el => el == i) < 0)
                {
                    NodeTraces curTrace = new NodeTraces();

                    List<int> curList = nodeDistanceDict[nd.name].GetConnectedPoints(i);
                    int curStart = curList.Min();
                    currentConnection.Add(curStart);

                    List<ContactSimple> startPoints = FindStartPoint(nd.arcCollection[curStart], nd.name);
                    SetContactNumber(startPoints, 0);
                    NodePointProcess proc = new NodePointProcess(GetPoint(startPoints[0]), false);
                    SpreadWaveProcess(startPoints, proc);

                    foreach (int curEnd in curList)
                    {
                        if (currentConnection.FindIndex(el => el == curEnd) < 0)//(curStart != curEnd)
                        {
                            int numbFixedWith = nodeDistanceDict[nd.name].GetFixedPointTo(curEnd);
                            if ((numbFixedWith >= 0)) //&& (currentConnection.FindIndex(el => el == numbFixedWith) >= 0))
                                curTrace.AddTrace(RecoveryFixedPath(nd.arcCollection[curEnd], nd.name));

                            if (numbFixedWith != curStart)
                            {
                                curTrace.AddTrace(RecoveryUnicPath(curTrace.lines, nd.arcCollection[curEnd],
                                                           nd.arcCollection[curStart], nd.name));
                                if (numbFixedWith >= 0)
                                    currentConnection.Add(numbFixedWith);
                            }
                            currentConnection.Add(curEnd);
                        }
                    }

                    SetUsed(curTrace);

                    SetContactNumber(startPoints, 0);
                    ReplaceUnused procRemove = new ReplaceUnused(GetPoint(startPoints[0]), false);
                    int count = SpreadWaveProcess(startPoints, procRemove);
                    nodeDistanceDict[nd.name].SetCountForNumber(i, count);
                }
            }
        }*/
        private bool SetUsedInLine(LineStruct inLine)
        {
            bool firstPass = false;
            foreach (ContactSimple cnt in inLine.GetPointArray())
            {
                //if (firstPass && GetPoint(cnt).isUsed)
                //	return false;
                if (cnt.layer == Layers.metal1Trace || cnt.layer == Layers.metal2Trace || cnt.layer == Layers.siliconTrace)
                {
                    GetPoint(cnt).isUsed = true;
                    GetPoint(cnt).isReplace = false;
                }
                //firstPass = true;
            }
            return true;
        }
Example #15
0
 public void Setup()
 {
     LineStruct.Clear();
     LineClass.Clear();
 }
Example #16
0
        private LineStruct GetLineVertical(List<LineStruct> curLines, PairInt curPoint, int layer, string curName)
        {
            int x = curPoint.x;
            int y = curPoint.y;

            bool nextCheck = true;// downUsed = false;
            int iUp, iDown;
            int d = layoutMap[x][y][layer].number;
            for (iUp = y + 1; (iUp < Params.topEdge) && nextCheck; iUp++)
            {
                if ( (layoutMap[x][iUp][layer].number == (d - 1)) &&
                    (layoutMap[x][iUp][layer].name == curName) )
                    d--;
                else
                {
                    break;
                }

                foreach (LineStruct ln in curLines)
                    if (ln.OverlapWithPoint(x, iUp, layer))
                        nextCheck = false;
            }
            nextCheck = true;
            for (iDown = y - 1; (iDown >= 0) && nextCheck; iDown--)
            {
                if ( (layoutMap[x][iDown][layer].number == (d - 1)) &&
                    (layoutMap[x][iDown][layer].name == curName) )
                    d--;
                else
                    break;

                foreach (LineStruct ln in curLines)
                    if (ln.OverlapWithPoint(x, iDown, layer))
                        nextCheck = false;
            }

            int heightSeg = iDown - y + 1;
            int startY = y;
            if ( ((y - iDown) < (iUp - y)) )//|| ((y - iDown) < 0) )
                heightSeg = iUp - y - 1;

            LineStruct retLineStr = new LineStruct(new PairInt(x, startY),
                                                   new PairInt(x, startY + heightSeg), layer);

            return retLineStr;
        }
Example #17
0
        private LineStruct GetLineVertical_old(PairInt curPoint, int layer, string curName)
        {
            int x = curPoint.x;
            int y = curPoint.y;
            //string curName = layoutMap[x][y][layer].name;
            //NodePoint np = layoutMap[x][y][layer];

            int iUp, iDown;
            int d = layoutMap[x][y][layer].number;
            for (iUp = y + 1; iUp < Params.topEdge; iUp++)
            {
                if ( (layoutMap[x][iUp][layer].number == (d - 1)) &&
                    (layoutMap[x][iUp][layer].name == curName) )
                    d--;
                else
                {
                    //np = layoutMap[x][iUp][layer];
                    break;
                }
            }
            for (iDown = y - 1; iDown >= 0; iDown--)
            {
                if ( (layoutMap[x][iDown][layer].number == (d - 1)) &&
                    (layoutMap[x][iDown][layer].name == curName) )
                    d--;
                else
                    break;
            }

            int heightSeg = y - iDown - 1;
            int startY = y;
            if ((y - iDown) > (iUp - y))
                startY = iDown + 1;
            else
                heightSeg = iUp - y - 1;
            //LineStruct retLine = new LineStruct(x,
            //Segment retSegment = new Segment(x, startY, 0, heightSeg);

            /*string typeLine = Params.silType;
            if (layer == Layers.metal1Trace)
                typeLine = Params.met1Type;
            else if (layer == Layers.metal2Trace)
                typeLine = Params.met2Type;*/

            LineStruct retLineStr = new LineStruct(new PairInt(x, startY),
                                                   new PairInt(x, startY + heightSeg), layer);
            //retLineStr.line = retSegment;
            return retLineStr;
        }