improved lead drawing

This commit is contained in:
bancika
2011-01-20 23:34:33 +00:00
parent be7e9a1d53
commit 9ae74ac0a1
6 changed files with 15 additions and 9 deletions
@@ -66,8 +66,14 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
Shape shape = getBodyShape(); Shape shape = getBodyShape();
if (shape == null) { if (shape == null) {
g2d.setStroke(new BasicStroke(getLeadThickness().convertToPixels())); g2d.setStroke(new BasicStroke(getLeadThickness().convertToPixels()));
g2d.setColor(getLeadColor(componentState)); g2d.setColor(shouldShadeLeads() ? getLeadColor(componentState).darker()
: getLeadColor(componentState));
g2d.drawLine(points[0].x, points[0].y, points[1].x, points[1].y); g2d.drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
if (shouldShadeLeads()) {
g2d.setStroke(new BasicStroke(getLeadThickness().convertToPixels() - 2));
g2d.setColor(getLeadColor(componentState));
g2d.drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
}
return; return;
} }
Rectangle shapeRect = shape.getBounds(); Rectangle shapeRect = shape.getBounds();
@@ -72,7 +72,7 @@ public class AxialFilmCapacitor extends AbstractLeadedComponent<Capacitance> {
@Override @Override
protected Shape getBodyShape() { protected Shape getBodyShape() {
return new Rectangle2D.Double(0f, 0f, getWidth().convertToPixels(), getHeight() return new Rectangle2D.Double(0f, 0f, getWidth().convertToPixels(),
.convertToPixels()); getClosestOdd(getHeight().convertToPixels()));
} }
} }
@@ -72,7 +72,7 @@ public class RadialCeramicDiskCapacitor extends AbstractLeadedComponent<Capacita
@Override @Override
protected Shape getBodyShape() { protected Shape getBodyShape() {
return new Ellipse2D.Double(0f, 0f, getWidth().convertToPixels(), getHeight() return new Ellipse2D.Double(0f, 0f, getWidth().convertToPixels(), getClosestOdd(getHeight()
.convertToPixels()); .convertToPixels()));
} }
} }
@@ -73,7 +73,7 @@ public class RadialFilmCapacitor extends AbstractLeadedComponent<Capacitance> {
@Override @Override
protected Shape getBodyShape() { protected Shape getBodyShape() {
double radius = getHeight().convertToPixels() * 0.7; double radius = getHeight().convertToPixels() * 0.7;
return new RoundRectangle2D.Double(0f, 0f, getWidth().convertToPixels(), getHeight() return new RoundRectangle2D.Double(0f, 0f, getWidth().convertToPixels(),
.convertToPixels(), radius, radius); getClosestOdd(getHeight().convertToPixels()), radius, radius);
} }
} }
@@ -72,7 +72,7 @@ public class Resistor extends AbstractLeadedComponent<Resistance> {
@Override @Override
protected Shape getBodyShape() { protected Shape getBodyShape() {
return new Rectangle2D.Double(0f, 0f, getWidth().convertToPixels(), getHeight() return new Rectangle2D.Double(0f, 0f, getWidth().convertToPixels(),
.convertToPixels()); getClosestOdd(getHeight().convertToPixels()));
} }
} }