public static CadRuler Create(CadFigure fig, int idx0, int idx1) { CadRuler ret = default(CadRuler); ret.Fig = fig; ret.Idx0 = idx0; ret.Idx1 = idx1; return(ret); }
public void Set(MarkPoint mkp) { CadFigure fig = mkp.Figure; int pointIndex = mkp.PointIndex; int cnt = fig.PointList.Count; if (cnt < 2) { return; } if (!fig.IsLoop) { if (pointIndex == cnt - 1) { Ruler[RCount] = CadRuler.Create(fig, pointIndex - 1, pointIndex); RCount++; return; } else if (pointIndex == 0) { Ruler[RCount] = CadRuler.Create(fig, 1, 0); RCount++; return; } } int idx0; int idx1; idx0 = (pointIndex + cnt - 1) % cnt; idx1 = pointIndex; Debug.Assert(idx0 >= 0 && idx0 < cnt); Ruler[RCount] = CadRuler.Create(fig, idx0, idx1); RCount++; idx0 = (pointIndex + 1) % cnt; idx1 = pointIndex; Debug.Assert(idx0 >= 0 && idx0 < cnt); Ruler[RCount] = CadRuler.Create(fig, idx0, idx1); RCount++; }
public void Set(MarkSegment mks, DrawContext dc) { Ruler[RCount] = CadRuler.Create(mks.Figure, mks.PtIndexA, mks.PtIndexB); RCount++; }