/// <summary> /// ポリゴンのための輪郭データを生成する。 /// </summary> /// <param name="outlineList"></param> /// <param name="param"></param> /// <remarks>ここで生成する輪郭データは内側に重なっていても良いものとする</remarks> public override void GenerateOutlineData(LinkedList <MbeGapChkObjLine> outlineList, GenOutlineParam param) { //if (param.layer != Layer) return; int distance; Point ptCenter = GetPos(0); Point[] pt; int pointCount; int x = ptCenter.X; int y = ptCenter.Y; if (shape == PadShape.Rect) { distance = param.traceWidth / 2 + param.gap; pt = new Point[4]; pointCount = 4; int xoffset = Width / 2 + distance; int yoffset = Height / 2 + distance; pt[0] = new Point(x - xoffset, y + yoffset); pt[1] = new Point(x + xoffset, y + yoffset); pt[2] = new Point(x + xoffset, y - yoffset); pt[3] = new Point(x - xoffset, y - yoffset); } else { int lineW; int lineL; Point pt0; Point pt1; if (Width < Height) { lineW = Width; lineL = Height - lineW; pt0 = new Point(x, y - lineL / 2); pt1 = new Point(x, y + lineL / 2); } else { lineW = Height; lineL = Width - lineW; pt0 = new Point(x - lineL / 2, y); pt1 = new Point(x + lineL / 2, y); } distance = (lineW + param.traceWidth) / 2 + param.gap * 11 / 10; int left = param.rc.L - distance; int top = param.rc.T + distance; int right = param.rc.R + distance; int bottom = param.rc.B - distance; MbeRect rcArea = new MbeRect(new Point(left, top), new Point(right, bottom)); if (Util.LineIsOutsideLTRB(pt0, pt1, rcArea)) { return; } bool dummyParam; Util.LineOutlineData(pt0, pt1, distance, out pt, out dummyParam); pointCount = 8; } for (int j = 0; j < pointCount; j++) { int j2 = j + 1; if (j2 == pointCount) { j2 = 0; } if (!Util.LineIsOutsideLTRB(pt[j], pt[j2], param.rc)) { MbeGapChkObjLine objLine = new MbeGapChkObjLine(); objLine.SetLineValue(pt[j], pt[j2], param.traceWidth); outlineList.AddLast(objLine); } } }
/// <summary> /// ポリゴンのための輪郭データを生成する。 /// </summary> /// <param name="outlineList"></param> /// <param name="param"></param> /// <remarks>ここで生成する輪郭データは内側に重なっていても良いものとする</remarks> public override void GenerateOutlineData(LinkedList <MbeGapChkObjLine> outlineList, GenOutlineParam param) { if (param.layer != Layer) { return; } base.GenerateOutlineData(outlineList, param); }
/// <summary> /// ポリゴンのための輪郭データを生成する。 /// </summary> /// <param name="outlineList"></param> /// <param name="param"></param> /// <remarks>ここで生成する輪郭データは内側に重なっていても良いものとする</remarks> public virtual void GenerateOutlineData(LinkedList <MbeGapChkObjLine> outlineList, GenOutlineParam param) { }
/// <summary> /// ポリゴンのための輪郭データを生成する。 /// </summary> /// <param name="outlineList"></param> /// <param name="param"></param> /// <remarks>ここで生成する輪郭データは内側に重なっていても良いものとする</remarks> public override void GenerateOutlineData(LinkedList <MbeGapChkObjLine> outlineList, GenOutlineParam param) { if (!doneFillFlag) { return; } //if (fillLineList.Count == 0) return; if (param.layer != Layer) { return; } if (posCount <= 3) { return; } int distance; if (restrictMask) { distance = (RESTRICT_TRACE_WIDTH + param.traceWidth) / 2 + RESTRICT_GAP * 11 / 10; //distance = (traceWidth + param.traceWidth) / 2 + param.gap * 11 / 10; } else { distance = (traceWidth + param.traceWidth) / 2 + param.gap * 11 / 10; } int left = param.rc.L - distance; int top = param.rc.T + distance; int right = param.rc.R + distance; int bottom = param.rc.B - distance; MbeRect rcArea = new MbeRect(new Point(left, top), new Point(right, bottom)); Point[] ptOutline; for (int i = 1; i < PosCount; i++) { int i2 = i + 1; if (i2 == PosCount) { i2 = 1; } Point p0 = GetPos(i); Point p1 = GetPos(i2); if (Util.LineIsOutsideLTRB(p0, p1, rcArea)) { continue; } bool dummyParam; Util.LineOutlineData(p0, p1, distance, out ptOutline, out dummyParam); for (int j = 0; j < 8; j++) { int j2 = j + 1; if (j2 == 8) { j2 = 0; } if (!Util.LineIsOutsideLTRB(ptOutline[j], ptOutline[j2], param.rc)) { MbeGapChkObjLine objLine = new MbeGapChkObjLine(); objLine.SetLineValue(ptOutline[j], ptOutline[j2], param.traceWidth); outlineList.AddLast(objLine); } } } }
/// <summary> /// ポリゴンのための輪郭データを生成する。 /// </summary> /// <param name="outlineList"></param> /// <param name="param"></param> /// <remarks>ここで生成する輪郭データは内側に重なっていても良いものとする</remarks> public override void GenerateOutlineData(LinkedList <MbeGapChkObjLine> outlineList, GenOutlineParam param) { //if (param.layer != Layer) return; int distance; Point ptCenter = GetPos(0); Point[] pt; int pointCount; int x = ptCenter.X; int y = ptCenter.Y; if (param.layer == MbeLayer.LayerValue.L2 || param.layer == MbeLayer.LayerValue.L3) { //内層のときは非接続時はドリル径+0.4mm。(ただし、表層padサイズを超えない)接続時はpadSizeのWidthかHeightの小さい方 int landDia; if (((ulong)param.layer & innerLayerConnectionInfo) == 0) { landDia = dia + 4000; if (landDia > InnerLandDia) { landDia = InnerLandDia; } } else { landDia = InnerLandDia; } Point pt0 = new Point(x, y); distance = (landDia + param.traceWidth) / 2 + param.gap * 11 / 10; int left = param.rc.L - distance; int top = param.rc.T + distance; int right = param.rc.R + distance; int bottom = param.rc.B - distance; MbeRect rcArea = new MbeRect(new Point(left, top), new Point(right, bottom)); if (Util.LineIsOutsideLTRB(pt0, pt0, rcArea)) { return; } bool dummyParam; Util.LineOutlineData(pt0, pt0, distance, out pt, out dummyParam); pointCount = 8; } else if (shape == PadShape.Rect) { distance = param.traceWidth / 2 + param.gap; pt = new Point[4]; pointCount = 4; int xoffset = Width / 2 + distance; int yoffset = Height / 2 + distance; pt[0] = new Point(x - xoffset, y + yoffset); pt[1] = new Point(x + xoffset, y + yoffset); pt[2] = new Point(x + xoffset, y - yoffset); pt[3] = new Point(x - xoffset, y - yoffset); } else { int lineW; int lineL; Point pt0; Point pt1; if (Width < Height) { lineW = Width; lineL = Height - lineW; pt0 = new Point(x, y - lineL / 2); pt1 = new Point(x, y + lineL / 2); } else { lineW = Height; lineL = Width - lineW; pt0 = new Point(x - lineL / 2, y); pt1 = new Point(x + lineL / 2, y); } distance = (lineW + param.traceWidth) / 2 + param.gap * 11 / 10; int left = param.rc.L - distance; int top = param.rc.T + distance; int right = param.rc.R + distance; int bottom = param.rc.B - distance; MbeRect rcArea = new MbeRect(new Point(left, top), new Point(right, bottom)); if (Util.LineIsOutsideLTRB(pt0, pt1, rcArea)) { return; } bool dummyParam; Util.LineOutlineData(pt0, pt1, distance, out pt, out dummyParam); pointCount = 8; } for (int j = 0; j < pointCount; j++) { int j2 = j + 1; if (j2 == pointCount) { j2 = 0; } if (!Util.LineIsOutsideLTRB(pt[j], pt[j2], param.rc)) { MbeGapChkObjLine objLine = new MbeGapChkObjLine(); objLine.SetLineValue(pt[j], pt[j2], param.traceWidth); outlineList.AddLast(objLine); } } }
/// <summary> /// ポリゴンのための輪郭データを生成する。 /// </summary> /// <param name="outlineList"></param> /// <param name="param"></param> /// <remarks>ここで生成する輪郭データは内側に重なっていても良いものとする /// 文字列をマジメに一画ごとに処理すると、線分の量が半端でなく大きくなる /// とりあえずは全体を矩形で囲む輪郭を生成する。 /// </remarks> public override void GenerateOutlineData(LinkedList <MbeGapChkObjLine> outlineList, GenOutlineParam param) { if (layer != param.layer) { return; } MbeRect rc = OccupationRect(); //LinkedList<CamOutBaseData> camdataLList = new LinkedList<CamOutBaseData>(); //bool reverse; //switch (layer) { // case MbeLayer.LayerValue.PLS: // case MbeLayer.LayerValue.STS: // case MbeLayer.LayerValue.SOL: // reverse = true; // break; // default: // reverse = false; // break; //} //MbeView.boardFont.GenerateCamDataString(camdataLList, 0, 0, reverse, signame, TextHeight, LineWidth); //int l = System.Int32.MaxValue; //int t = System.Int32.MinValue; //int r = System.Int32.MinValue; //int b = System.Int32.MaxValue; //Point ptz = new Point(0, 0); //Point ptOrigin = GetPos(0); //foreach (CamOutBaseData camd in camdataLList) { // if (dir != 0) { // camd.RotateStep90(dir, ptz); // } // camd.Move(ptOrigin); // if (camd.ctype == CamOutBaseData.CamType.VECTOR) { // if (l > camd.pt0.X) l = camd.pt0.X; // if (l > camd.pt1.X) l = camd.pt1.X; // if (r < camd.pt0.X) r = camd.pt0.X; // if (r < camd.pt1.X) r = camd.pt1.X; // if (b > camd.pt0.Y) b = camd.pt0.Y; // if (b > camd.pt1.Y) b = camd.pt1.Y; // if (t < camd.pt0.Y) t = camd.pt0.Y; // if (t < camd.pt1.Y) t = camd.pt1.Y; // } //} int distance = param.traceWidth / 2 + param.gap; int l = rc.L - distance; int t = rc.T + distance; int r = rc.R + distance; int b = rc.B - distance; Point[] pt = new Point[4]; pt[0] = new Point(l, t); pt[1] = new Point(r, t); pt[2] = new Point(r, b); pt[3] = new Point(l, b); for (int j = 0; j < 4; j++) { int j2 = j + 1; if (j2 == 4) { j2 = 0; } if (!Util.LineIsOutsideLTRB(pt[j], pt[j2], param.rc)) { MbeGapChkObjLine objLine = new MbeGapChkObjLine(); objLine.SetLineValue(pt[j], pt[j2], param.traceWidth); outlineList.AddLast(objLine); } } }
/// <summary> /// ポリゴンのための輪郭データを生成する。 /// </summary> /// <param name="outlineList"></param> /// <param name="param"></param> /// <remarks>ここで生成する輪郭データは内側に重なっていても良いものとする</remarks> public override void GenerateOutlineData(LinkedList <MbeGapChkObjLine> outlineList, GenOutlineParam param) { if (param.layer != Layer) { return; } int distance = (LineWidth + param.traceWidth) / 2 + param.gap; distance = distance * 11 / 10; int insideRadius = radius - distance; int outsideRadius = (radius + distance) * 1005 / 1000; distance = outsideRadius - radius; int left = param.rc.L - distance; int top = param.rc.T + distance; int right = param.rc.R + distance; int bottom = param.rc.B - distance; Point[] pt; MbeRect rcArea = new MbeRect(new Point(left, top), new Point(right, bottom)); //-------------------------------------------- int _endAngle; if (LimitStartEnd()) { _endAngle = startAngle + 3600; } else { _endAngle = endAngle; if (_endAngle == startAngle) { _endAngle = startAngle + 3600; } else if (_endAngle < startAngle) { _endAngle += 3600; } } if ((startAngle % 3600) != (_endAngle % 3600)) { for (int i = 1; i <= 2; i++) { if (!Util.PointIsOutsideLTRB(GetPos(i), rcArea)) { Util.PointOutlineData(GetPos(i), distance, out pt); for (int j = 0; j < 8; j++) { int j2 = j + 1; if (j2 == 8) { j2 = 0; } if (!Util.LineIsOutsideLTRB(pt[j], pt[j2], param.rc)) { MbeGapChkObjLine objLine = new MbeGapChkObjLine(); objLine.SetLineValue(pt[j], pt[j2], param.traceWidth); outlineList.AddLast(objLine); } } } } } //-------------------------------------------- //int _endAngle; //if (LimitStartEnd()) { // _endAngle = startAngle + 3600; //} else { // _endAngle = endAngle; // if (_endAngle == startAngle) _endAngle = startAngle + 3600; // else if (_endAngle < startAngle) _endAngle += 3600; //} int angle = startAngle; bool endFlag = false; int x; int y; double angleRad; angleRad = (double)angle / 1800.0 * Math.PI; x = (int)Math.Round(outsideRadius * Math.Cos(angleRad)) + posArray[0].X; y = (int)Math.Round(outsideRadius * Math.Sin(angleRad)) + posArray[0].Y; Point pt0 = new Point(x, y); Point pt1; while (!endFlag) { angle += 3600 / OUTLINE_DIVISION; if (angle >= _endAngle) { endFlag = true; angle = _endAngle; } angleRad = (double)angle / 1800.0 * Math.PI; x = (int)Math.Round(outsideRadius * Math.Cos(angleRad)) + posArray[0].X; y = (int)Math.Round(outsideRadius * Math.Sin(angleRad)) + posArray[0].Y; pt1 = new Point(x, y); if (!pt0.Equals(pt1)) //ゼロ長データは削除 { if (!Util.LineIsOutsideLTRB(pt0, pt1, param.rc)) { MbeGapChkObjLine objLine = new MbeGapChkObjLine(); objLine.SetLineValue(pt0, pt1, param.traceWidth); outlineList.AddLast(objLine); } pt0 = pt1; } } //-------------------------------------------- if (insideRadius > 10) { int division = (insideRadius > 10000 ? OUTLINE_DIVISION : 8); angle = startAngle; endFlag = false; angleRad = (double)angle / 1800.0 * Math.PI; x = (int)Math.Round(insideRadius * Math.Cos(angleRad)) + posArray[0].X; y = (int)Math.Round(insideRadius * Math.Sin(angleRad)) + posArray[0].Y; pt0 = new Point(x, y); while (!endFlag) { angle += 3600 / division; if (angle >= _endAngle) { endFlag = true; angle = _endAngle; } angleRad = (double)angle / 1800.0 * Math.PI; x = (int)Math.Round(insideRadius * Math.Cos(angleRad)) + posArray[0].X; y = (int)Math.Round(insideRadius * Math.Sin(angleRad)) + posArray[0].Y; pt1 = new Point(x, y); if (!pt0.Equals(pt1)) //ゼロ長データは削除 { if (!Util.LineIsOutsideLTRB(pt0, pt1, param.rc)) { MbeGapChkObjLine objLine = new MbeGapChkObjLine(); objLine.SetLineValue(pt0, pt1, param.traceWidth); outlineList.AddLast(objLine); } pt0 = pt1; } } } }
/// <summary> /// ポリゴンのための輪郭データを生成する。 /// </summary> /// <param name="outlineList"></param> /// <param name="param"></param> /// <remarks>ここで生成する輪郭データは内側に重なっていても良いものとする</remarks> public override void GenerateOutlineData(LinkedList <MbeGapChkObjLine> outlineList, GenOutlineParam param) { //if (param.layer != Layer) return; int distance; Point pt0 = GetPos(0); Point[] pt; distance = (Diameter + param.traceWidth) / 2 + param.gap * 11 / 10;; int left = param.rc.L - distance; int top = param.rc.T + distance; int right = param.rc.R + distance; int bottom = param.rc.B - distance; MbeRect rcArea = new MbeRect(new Point(left, top), new Point(right, bottom)); if (Util.PointIsOutsideLTRB(pt0, rcArea)) { return; } Util.PointOutlineData(pt0, distance, out pt); for (int j = 0; j < 8; j++) { int j2 = j + 1; if (j2 == 8) { j2 = 0; } if (!Util.LineIsOutsideLTRB(pt[j], pt[j2], param.rc)) { MbeGapChkObjLine objLine = new MbeGapChkObjLine(); objLine.SetLineValue(pt[j], pt[j2], param.traceWidth); outlineList.AddLast(objLine); } } }
/// <summary> /// ポリゴンのための輪郭データを生成する。 /// </summary> /// <param name="outlineList"></param> /// <param name="param"></param> /// <remarks> /// ここで生成する輪郭データは内側に重なっていても良いものとする /// 2009/01/01 ラインアウトラインの端点キャップ省略を止める。常に端点キャップ生成 /// </remarks> public override void GenerateOutlineData(LinkedList <MbeGapChkObjLine> outlineList, GenOutlineParam param) { if (param.layer != Layer) { return; } Point ptVia; bool bendMode = getPointVia(out ptVia); Point[] pt = new Point[3]; int lines; if (bendMode) { pt[0] = GetPos(0); pt[1] = ptVia; pt[2] = GetPos(1); lines = 2; } else { pt[0] = GetPos(0); pt[1] = GetPos(1); lines = 1; } int distance = (LineWidth + param.traceWidth) / 2 + param.gap * 11 / 10; int left = param.rc.L - distance; int top = param.rc.T + distance; int right = param.rc.R + distance; int bottom = param.rc.B - distance; MbeRect rcArea = new MbeRect(new Point(left, top), new Point(right, bottom)); Point[] ptOutline; for (int i = 0; i < lines; i++) { if (Util.LineIsOutsideLTRB(pt[i], pt[i + 1], rcArea)) { continue; } bool revBeginEnd; Util.LineOutlineData(pt[i], pt[i + 1], distance, out ptOutline, out revBeginEnd); bool p0Nocap = false; bool p1Nocap = false; if (bendMode) { if (i == 0) { if (revBeginEnd) { p1Nocap = (param.option & GenOutlineParam.P0_NO_LINECAP) != 0; } else { p0Nocap = (param.option & GenOutlineParam.P0_NO_LINECAP) != 0; } } else if (i == 1) { if (revBeginEnd) { p0Nocap = (param.option & GenOutlineParam.P1_NO_LINECAP) != 0; } else { p1Nocap = (param.option & GenOutlineParam.P1_NO_LINECAP) != 0; } } } else { if (revBeginEnd) { p1Nocap = (param.option & GenOutlineParam.P0_NO_LINECAP) != 0; p0Nocap = (param.option & GenOutlineParam.P1_NO_LINECAP) != 0; } else { p0Nocap = (param.option & GenOutlineParam.P0_NO_LINECAP) != 0; p1Nocap = (param.option & GenOutlineParam.P1_NO_LINECAP) != 0; } } for (int j = 0; j < 8; j++) { int j2 = j + 1; if (j2 == 8) { j2 = 0; } //不要なときはラインキャップを生成しない //if (bendMode) { // if (p0Nocap && i == 0) { // if (j >= 5 && j <= 7) continue; // } // if (p1Nocap && i == 1) { // if (j >= 1 && j <= 3) continue; // } //} else { if (p0Nocap) { //System.Diagnostics.Debug.WriteLine("Skip begin cap"); if (j >= 5 && j <= 7) { continue; } } if (p1Nocap) { //System.Diagnostics.Debug.WriteLine("Skip end cap"); if (j >= 1 && j <= 3) { continue; } } //} if (!Util.LineIsOutsideLTRB(ptOutline[j], ptOutline[j2], param.rc)) { MbeGapChkObjLine objLine = new MbeGapChkObjLine(); objLine.SetLineValue(ptOutline[j], ptOutline[j2], param.traceWidth); outlineList.AddLast(objLine); } } } }