public override void Draw(CustomGraphics g) { base.Draw(g); int w = (int)g.GetTextSize("+").Width; g.DrawLeftText("+", mPlusPoint.X - w / 2, mPlusPoint.Y); }
public override void Draw(CustomGraphics g) { var rt = getRailText(); double w = rt == null ? (BODY_LEN * 0.5) : g.GetTextSize(rt).Width / 2; if (w > mLen * .8) { w = mLen * .8; } if (waveform == WAVEFORM.SQUARE && (mFlags & FLAG_CLOCK) != 0 || waveform == WAVEFORM.DC) { setLead1(1 - (w - 5) / mLen); } else { setLead1(1 - w / mLen); } setBbox(mPoint1, mPoint2, BODY_LEN); drawLead(mPoint1, mLead1); drawRail(g); drawPosts(); mCurCount = updateDotCount(-mCurrent, mCurCount); if (CirSim.Sim.DragElm != this) { drawDots(mPoint1, mLead1, mCurCount); } }
public override void Draw(CustomGraphics g) { drawLead(mPoint1, mPoint2); doDots(); setBbox(mPoint1, mPoint2, 3); drawPosts(); }
public override void Draw(CustomGraphics g) { drawLead(mPoint1, mLead1); g.LineColor = NeedsHighlight ? CustomGraphics.SelectColor : CustomGraphics.WhiteColor; var str = Text; var lineOver = false; if (str.StartsWith("/")) { lineOver = true; str = str.Substring(1); } drawCenteredText(str, P2, true); if (lineOver) { int asc = (int)CustomGraphics.FontText.Size; if (lineOver) { int ya = P2.Y - asc; int sw = (int)g.GetTextSize(str).Width; g.DrawLine(P2.X - sw / 2, ya, P2.X + sw / 2, ya); } } mCurCount = updateDotCount(mCurrent, mCurCount); drawDots(mPoint1, mLead1, mCurCount); interpPoint(ref mPos, 1 + 11.0 / mLen); setBbox(mPoint1, mPos, CircleSize); drawPosts(); }
void drawRail(CustomGraphics g) { if (waveform == WAVEFORM.SQUARE && (mFlags & FLAG_CLOCK) != 0) { drawCenteredText("CLK", P2, true); } else if (waveform == WAVEFORM.DC) { var color = NeedsHighlight ? CustomGraphics.SelectColor : CustomGraphics.WhiteColor; double v = getVoltage(); string s; if (Math.Abs(v) < 1) { s = v.ToString("0.000") + " V"; } else { s = Utils.UnitText(v, "V"); } if (getVoltage() > 0) { s = "+" + s; } drawCenteredText(s, P2, true); } else { drawWaveform(g, mPoint2); } }
public override void Draw(CustomGraphics g) { g.LineColor = NeedsHighlight ? CustomGraphics.SelectColor : CustomGraphics.GrayColor; g.DrawPolygon(mRectPoints); /* draw stubs */ for (int i = 0; i != 4; i++) { var a = posts[i]; var b = mStubs[i]; drawLead(a, b); mCurCounts[i] = updateDotCount(-GetCurrentIntoNode(i), mCurCounts[i]); drawDots(a, b, mCurCounts[i]); } mDiode.Draw(g); mTransistor.Draw(g); drawPosts(); /* draw little arrows */ var c = NeedsHighlight ? CustomGraphics.SelectColor : CustomGraphics.GrayColor; g.FillPolygon(c, mArrow1); g.FillPolygon(c, mArrow2); g.LineColor = c; int sx = mStubs[0].X + 2; int sy = (mStubs[0].Y + mStubs[1].Y) / 2; for (int i = 0; i != 2; i++) { int y = sy + i * 10 - 5; g.DrawLine(sx + 10, y, sx + 15, y); } }
public override void Draw(CustomGraphics g) { var color = NeedsHighlight ? CustomGraphics.SelectColor : CustomGraphics.WhiteColor; setScopeRect(); elmScope.Draw(g); setBbox(mPoint1, mPoint2, 0); drawPosts(); }
public override void Draw(CustomGraphics g) { drawPosts(); draw2Leads(); g.LineColor = NeedsHighlight ? CustomGraphics.SelectColor : CustomGraphics.GrayColor; g.DrawPolygon(gatePoly); g.DrawPolygon(symbolPoly); mCurCount = updateDotCount(mCurrent, mCurCount); drawDots(mLead2, mPoint2, mCurCount); }
public override void Draw(CustomGraphics g) { setBbox(P1, P2); draw2Leads(); if (waveform == WAVEFORM.DC) { int hs = 12; setBbox(mPoint1, mPoint2, hs); interpLeadAB(ref mPs1, ref mPs2, 0, hs * 0.5); drawLead(mPs1, mPs2); interpLeadAB(ref mPs1, ref mPs2, 1, hs); drawLead(mPs1, mPs2); string s = Utils.UnitText(mMaxVoltage, "V"); g.DrawRightText(s, mTextPos.X, mTextPos.Y); } else { setBbox(mPoint1, mPoint2, BODY_LEN); interpLead(ref mPs1, 0.5); drawWaveform(g, mPs1); string inds; if (0 < mBias || (0 == mBias && WAVEFORM.PULSE == waveform)) { inds = "+"; } else { inds = "*"; } drawCenteredLText(inds, mTextPos, true); } updateDotCount(); if (CirSim.Sim.DragElm != this) { if (waveform == WAVEFORM.DC) { drawDots(mPoint1, mPoint2, mCurCount); } else { drawDots(mPoint1, mLead1, mCurCount); drawDots(mPoint2, mLead2, -mCurCount); } } drawPosts(); }
public override void Draw(CustomGraphics g) { double v1 = Volts[0]; double v2 = Volts[1]; int hs = 8; setBbox(mPoint1, mPoint2, hs); draw2Leads(); drawCoil(mLead1, mLead2, v1, v2); drawValue(Inductance); drawName(); doDots(); drawPosts(); }