private void btnInsert_Click(object sender, EventArgs e) { if (this.listBoxPoints.SelectedIndex < 0) { return; } PointTrace pointTrace = pointsCache[this.listBoxPoints.SelectedIndex]; if (pointTrace.PointType != TracePointType.End) { return; } int index = this.listBoxPoints.SelectedIndex; PointTrace pointPrev = pointsCache[this.listBoxPoints.SelectedIndex - 1]; PointD newPoint = (Machine.Instance.Robot.PosXY - origin).ToPoint(); TraceBase trace = this.tracesCache[pointTrace.TraceIndex]; TraceBase tracePrev; if (pointTrace.TraceIndex == 0) { tracePrev = null; } else { tracePrev = this.tracesCache[pointTrace.TraceIndex - 1]; } if (this.rbLine.Checked) { trace.Start = newPoint.Clone() as PointD; TraceLine line; if (tracePrev == null) { line = new TraceLine(pointPrev.Point.Clone() as PointD, newPoint.Clone() as PointD); line.LineStyle = trace.LineStyle; } else { line = new TraceLine(tracePrev.End.Clone() as PointD, newPoint.Clone() as PointD); line.LineStyle = trace.LineStyle; } this.tracesCache.Insert(pointTrace.TraceIndex, line); } else { TraceArc arc = new TraceArc(trace.Start, newPoint, trace.End); arc.LineStyle = trace.LineStyle; this.tracesCache[pointTrace.TraceIndex] = arc; } this.updatePointsCache(); this.LoadLines2ListBox(); this.LoadPoints2ListBox(); this.listBoxPoints.SelectedIndex = index + 1; }
public override object Clone() { MoveAbsXyCmdLine moveAbsXyCmdLine = MemberwiseClone() as MoveAbsXyCmdLine; moveAbsXyCmdLine.position = position.Clone() as PointD; return(moveAbsXyCmdLine); }
public override object Clone() { MeasureHeightCmdLine measureHeightCmdLine = MemberwiseClone() as MeasureHeightCmdLine; measureHeightCmdLine.position = position.Clone() as PointD; return(measureHeightCmdLine); }
public override object Clone() { DoMultiPassCmdLine doMultiPassCmdLine = MemberwiseClone() as DoMultiPassCmdLine; doMultiPassCmdLine.Origin = Origin.Clone() as PointD; return(doMultiPassCmdLine); }
public override object Clone() { MoveXyCmdLine moveXyCmdLine = MemberwiseClone() as MoveXyCmdLine; //moveXyCmdLine.offset = offset.Clone() as PointD; moveXyCmdLine.position = position.Clone() as PointD; return(moveXyCmdLine); }
public Line(PointD tstartpnt, PointD tendpnt, Color tcolor, float twidth) { this.Color = tcolor; this.LineWidth = twidth; this.p1 = tstartpnt.Clone() as PointD; this.p2 = tendpnt.Clone() as PointD; }
public override object Clone() { DotCmdLine dotCmdLine = MemberwiseClone() as DotCmdLine; dotCmdLine.position = position.Clone() as PointD; dotCmdLine.IdCode = dotCmdLine.GetHashCode(); return(dotCmdLine); }
public virtual object Clone() { LineCoordinate lineCoordinate = MemberwiseClone() as LineCoordinate; lineCoordinate.Start = Start.Clone() as PointD; lineCoordinate.End = End.Clone() as PointD; lineCoordinate.LineStyle = LineStyle; return(lineCoordinate); }
private static void DrawGridLines(PointD startPoint, PointD endPoint) { var currentPoint = startPoint.Clone(); double GRID_DETAIL = Const.GRID_INTERVAL / 8; double GRID_MAWARI = Const.GRID_INTERVAL * 2; //縦の線を引く while (currentPoint.X <= endPoint.X) { var s = new PointD(currentPoint.X, startPoint.Y - GRID_MAWARI); var e = new PointD(currentPoint.X, endPoint.Y + GRID_MAWARI); var id = AutoCad.Db.Line.Make(s, e); var amari = (currentPoint.X - startPoint.X) % Const.GRID_INTERVAL; if (amari == GRID_DETAIL * 0) { AutoCad.Db.Line.SetColor(id, CadColor.Magenta); } else if (amari == GRID_DETAIL * 4) { AutoCad.Db.Line.SetColor(id, CadColor.Green); } else { AutoCad.Db.Line.SetColor(id, CadColor.Gray); } currentPoint.X += GRID_DETAIL; } //横の線を引く while (currentPoint.Y <= endPoint.Y) { var s = new PointD(startPoint.X - GRID_MAWARI, currentPoint.Y); var e = new PointD(endPoint.X + GRID_MAWARI, currentPoint.Y); var id = AutoCad.Db.Line.Make(s, e); var amari = (currentPoint.Y - startPoint.Y) % Const.GRID_INTERVAL; if (amari == GRID_DETAIL * 0) { AutoCad.Db.Line.SetColor(id, CadColor.Magenta); } else if (amari == GRID_DETAIL * 4) { AutoCad.Db.Line.SetColor(id, CadColor.Green); } else { AutoCad.Db.Line.SetColor(id, CadColor.Gray); } currentPoint.Y += GRID_DETAIL; } }
internal PointD ToLngLat(PointD prjPoint) { if (_ProjectedSystem == ProjectedSystem.WebMercator) { return(WebMercator2lonLat(prjPoint)); } else { return(prjPoint.Clone()); } }
internal PointD ToProjCo(PointD geoPoint) { if (_ProjectedSystem == ProjectedSystem.WebMercator) { return(lonLat2WebMercator(geoPoint)); } else { return(geoPoint.Clone()); } }
public override object Clone() { ArcCmdLine arcCmdLine = MemberwiseClone() as ArcCmdLine; arcCmdLine.start = start.Clone() as PointD; arcCmdLine.middle = middle.Clone() as PointD; arcCmdLine.end = end.Clone() as PointD; arcCmdLine.center = center.Clone() as PointD; arcCmdLine.IdCode = arcCmdLine.GetHashCode(); return(arcCmdLine); }
public override object Clone() { StepAndRepeatCmdLine stepAndRepeatCmdLine = MemberwiseClone() as StepAndRepeatCmdLine; stepAndRepeatCmdLine.Origin = Origin.Clone() as PointD; stepAndRepeatCmdLine.HorizontalEnd = HorizontalEnd.Clone() as PointD; stepAndRepeatCmdLine.VerticalEnd = VerticalEnd.Clone() as PointD; stepAndRepeatCmdLine.DoCmdLineList = new List <DoCmdLine>(); foreach (DoCmdLine doCmdLine in DoCmdLineList) { stepAndRepeatCmdLine.DoCmdLineList.Add(doCmdLine.Clone() as DoCmdLine); } return(stepAndRepeatCmdLine); }
public override object Clone() { SnakeLineCmdLine snakeLineCmdLine = MemberwiseClone() as SnakeLineCmdLine; snakeLineCmdLine.point1 = point1.Clone() as PointD; snakeLineCmdLine.point2 = point2.Clone() as PointD; snakeLineCmdLine.point3 = point3.Clone() as PointD; snakeLineCmdLine.lineCoordinateList = new List <LineCoordinate>(); foreach (LineCoordinate c in lineCoordinateList) { snakeLineCmdLine.lineCoordinateList.Add(c.Clone() as LineCoordinate); } snakeLineCmdLine.IdCode = snakeLineCmdLine.GetHashCode(); return(snakeLineCmdLine); }
/// <summary>グリッドの一番右上の交点の座標を返す</summary> private static PointD GetGridEndPoint(PointD gridBasePoint, List <PointD> gridArea) { var areaEndPoint = gridBasePoint.Clone(); while (areaEndPoint.X + Const.GRID_INTERVAL <= gridArea[1].X) { areaEndPoint.X += Const.GRID_INTERVAL; } while (areaEndPoint.Y + Const.GRID_INTERVAL <= gridArea[1].Y) { areaEndPoint.Y += Const.GRID_INTERVAL; } return(areaEndPoint); }
/// <summary>グリッドの一番左下の交点の座標を返す</summary> private static PointD GetGridStartPoint(PointD gridBasePoint, List <PointD> gridArea) { var areaStartPoint = gridBasePoint.Clone(); while (gridArea[0].X <= areaStartPoint.X - Const.GRID_INTERVAL) { areaStartPoint.X -= Const.GRID_INTERVAL; } while (gridArea[0].Y <= areaStartPoint.Y - Const.GRID_INTERVAL) { areaStartPoint.Y -= Const.GRID_INTERVAL; } return(areaStartPoint); }
private static void DrawCircleNumber(PointD startPoint, PointD endPoint) { var currentPoint = startPoint.Clone(); double CIRCLE_RADIUS = (Const.GRID_INTERVAL - 150) / 2; double GRID_MAWARI = Const.GRID_INTERVAL * 2; while (currentPoint.X <= endPoint.X) { var number = (currentPoint.X - startPoint.X) / Const.GRID_INTERVAL + 1; var s = new PointD(currentPoint.X, startPoint.Y - (GRID_MAWARI + CIRCLE_RADIUS)); var startCircleId = AutoCad.Db.Circle.Make(s, CIRCLE_RADIUS); AutoCad.Db.Circle.SetColor(startCircleId, CadColor.Cyan); var startTextId = AutoCad.Db.Text.Make(number.ToString(), CIRCLE_RADIUS, s, Align.中央); AutoCad.Db.Text.SetColor(startTextId, CadColor.Cyan); var e = new PointD(currentPoint.X, endPoint.Y + (GRID_MAWARI + CIRCLE_RADIUS)); var endCircleId = AutoCad.Db.Circle.Make(e, CIRCLE_RADIUS); AutoCad.Db.Circle.SetColor(endCircleId, CadColor.Cyan); var endTextId = AutoCad.Db.Text.Make(number.ToString(), CIRCLE_RADIUS, e, Align.中央); AutoCad.Db.Text.SetColor(endTextId, CadColor.Cyan); currentPoint.X += Const.GRID_INTERVAL; } while (currentPoint.Y <= endPoint.Y) { var number = (currentPoint.Y - startPoint.Y) / Const.GRID_INTERVAL + 1; var s = new PointD(startPoint.X - (GRID_MAWARI + CIRCLE_RADIUS), currentPoint.Y); var startCircleId = AutoCad.Db.Circle.Make(s, CIRCLE_RADIUS); AutoCad.Db.Circle.SetColor(startCircleId, CadColor.Cyan); var startTextId = AutoCad.Db.Text.Make(number.ToString(), CIRCLE_RADIUS, s, Align.中央); AutoCad.Db.Text.SetColor(startTextId, CadColor.Cyan); var e = new PointD(endPoint.X + (GRID_MAWARI + CIRCLE_RADIUS), currentPoint.Y); var endCircleId = AutoCad.Db.Circle.Make(e, CIRCLE_RADIUS); AutoCad.Db.Circle.SetColor(endCircleId, CadColor.Cyan); var endTextId = AutoCad.Db.Text.Make(number.ToString(), CIRCLE_RADIUS, e, Align.中央); AutoCad.Db.Text.SetColor(endTextId, CadColor.Cyan); currentPoint.Y += Const.GRID_INTERVAL; } }
/// <summary>グリッドを描く範囲の左下と右上の座標を取得する</summary> private static List <PointD> GetGridArea(List <int> lineIds) { var layerName = AutoCad.Db.Line.GetLayerName(lineIds[0]); var objectIds = Filters.GetAll(layerName); PointD leftDown = AutoCad.Db.Line.GetStartPoint(lineIds[0]); PointD rightUp = leftDown.Clone(); foreach (var objectId in objectIds) { var bound = AutoCad.Db.Line.GetEntityBound(objectId); if (bound[0].X < leftDown.X) { leftDown.X = bound[0].X; } if (bound[0].Y < leftDown.Y) { leftDown.Y = bound[0].Y; } if (rightUp.X < bound[1].X) { rightUp.X = bound[1].X; } if (rightUp.Y < bound[1].Y) { rightUp.Y = bound[1].Y; } } return(new List <PointD> { leftDown, rightUp }); }
public Circle(PointD tcenter, double tradius, Color tcolor, LineType ttype, float twidth) { this.Color = tcolor; this.LineType = ttype; this.LineWidth = twidth; this.Center = tcenter.Clone() as PointD; this.Radius = tradius; }
public Text(string value, PointD point) { Value = value; RefPoint = point.Clone() as PointD; }
public Text(string value, PointD point, Color color) { this.Value = value; this.RefPoint = point.Clone() as PointD; this.Color = color; }
public Text(string value, PointD point, Color color, String style, double textHieght) { this.Value = value; this.RefPoint = point.Clone() as PointD; this.Color = color; this.FontStyle = style; this.TextHieght = textHieght; }
public double Orietation = 0; //Text rotation #region Constructor and Destructor public Text(string value, PointD point, Color color, string justtype, string style, int rotateang, uint fontWeight) { Value = value; RefPoint = point.Clone() as PointD; Color = color; JustType = justtype; FontStyle = style; Orietation = rotateang; FontWeight = fontWeight; }
public Arc(PointD tcenter, double tradius, double tStartAng, double tEndAng, Color tcolor, LineType ttype, float twidth) { this.Color = tcolor; this.LineType = ttype; this.LineWidth = twidth; Center = tcenter.Clone() as PointD; Radius = tradius; StartAng = tStartAng; EndAng = tEndAng; }
public AlignedDimension(PointD tStartpn, PointD tEndpn, PointD tTextReferpn, double tArrowSize) { Startpn = tStartpn.Clone() as PointD; Endpn = tEndpn.Clone() as PointD; TextReferP = tTextReferpn.Clone() as PointD; PointD v1 = Normalize(Cross(new PointD(0, 0, 1), Endpn - Startpn)); double refheight = Abs(Dot(v1, tTextReferpn - Endpn)); HieghtReferP = Endpn + v1 * refheight; ArrowSize = tArrowSize; }
public AlignedDimension(PointD tStartpn, PointD tEndpn, double refheight, double tArrowSize) { Startpn = tStartpn.Clone() as PointD; Endpn = tEndpn.Clone() as PointD; ArrowSize = tArrowSize; PointD v1 = Normalize(Cross(new PointD(0, 0, 1), Endpn - Startpn)); TextReferP = (Startpn + Endpn) / 2 + v1 * refheight; HieghtReferP = Endpn + v1 * refheight; }
public void AddPoint(PointD tpoint) { Points.Add(tpoint.Clone() as PointD); }
public Line(PointD tstartpnt, PointD tendpnt) { this.p1 = tstartpnt.Clone() as PointD; this.p2 = tendpnt.Clone() as PointD; }
public DiametricDimension(Circle aCircle, double refDirection, PointD tTextReferpn, string tText, double tArrowSize) { double angle = DegToRad(refDirection); PointD V1 = (new PointD(Cos(angle), Sin(angle), 0)) * aCircle.Radius; Startpn = aCircle.Center - V1; Endpn = aCircle.Center + V1; TextReferP = tTextReferpn.Clone() as PointD; LeaderLength = Norm((this.TextReferP - (this.Startpn + this.Endpn) / 2.0)) - Value / 2.0; if (LeaderLength < 0) LeaderLength = 0; ArrowSize = tArrowSize; this.Text = tText; }
public AlignedDimension(PointD tStartpn, PointD tEndpn) { Startpn = tStartpn.Clone() as PointD; Endpn = tEndpn.Clone() as PointD; PointD v1 = Normalize(Cross(new PointD(0, 0, 1), Endpn - Startpn)); TextReferP = (Startpn + Endpn) / 2 + v1 * ArrowSize * 0.5; HieghtReferP = Endpn + v1 * ArrowSize * 0.5; }
public RadialDimension(Circle aCircle, double refDirection, PointD tTextReferpn, double tArrowSize) { double angle = DegToRad(refDirection); PointD V1 = (new PointD(Cos(angle), Sin(angle), 0)) * aCircle.Radius; Startpn = aCircle.Center.Clone() as PointD; Endpn = aCircle.Center + V1; TextReferP = tTextReferpn.Clone() as PointD; LeaderLength = Norm((this.Startpn - this.TextReferP)) - Value; if (LeaderLength < 0) LeaderLength = 0; ArrowSize = tArrowSize; }
public Arc(PointD tcenter, double tradius) { Center = tcenter.Clone() as PointD; Radius = tradius; }