added some icons

This commit is contained in:
bancika
2011-01-09 12:44:07 +00:00
parent 32efad1490
commit 41bcfec45e
11 changed files with 61 additions and 19 deletions
@@ -6,7 +6,7 @@ import java.awt.Graphics2D;
import org.diylc.core.ComponentLayer; import org.diylc.core.ComponentLayer;
import org.diylc.core.annotations.ComponentDescriptor; import org.diylc.core.annotations.ComponentDescriptor;
@ComponentDescriptor(name = "Blank Board", category = "Boards", author = "Branislav Stojkovic", componentLayer = ComponentLayer.BOARD, instanceNamePrefix = "B", desciption = "Blank FR4 board") @ComponentDescriptor(name = "Blank Board", category = "Boards", author = "Branislav Stojkovic", componentLayer = ComponentLayer.BOARD, instanceNamePrefix = "B", desciption = "Blank circuit board")
public class BlankBoard extends AbstractBoard { public class BlankBoard extends AbstractBoard {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -26,6 +26,9 @@ public class BlankBoard extends AbstractBoard {
@Override @Override
public void drawIcon(Graphics2D g2d, int width, int height) { public void drawIcon(Graphics2D g2d, int width, int height) {
g2d.setColor(BOARD_COLOR);
g2d.fillRect(2, 2, width - 4, height - 4);
g2d.setColor(BORDER_COLOR);
g2d.drawRect(2, 2, width - 4, height - 4);
} }
} }
@@ -136,6 +136,13 @@ public class PerfBoard extends AbstractBoard {
@Override @Override
public void drawIcon(Graphics2D g2d, int width, int height) { public void drawIcon(Graphics2D g2d, int width, int height) {
g2d.setColor(BOARD_COLOR);
g2d.fillRect(2, 2, width - 4, height - 4);
g2d.setColor(BORDER_COLOR);
g2d.drawRect(2, 2, width - 4, height - 4);
g2d.setColor(COPPER_COLOR);
g2d.fillOval(width / 4, width / 4, width / 2, width / 2);
g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(width / 2 - 1, width / 2 - 1, 2, 2);
} }
} }
@@ -14,7 +14,7 @@ import org.diylc.core.measures.Size;
import org.diylc.core.measures.SizeUnit; import org.diylc.core.measures.SizeUnit;
import org.diylc.utils.Constants; import org.diylc.utils.Constants;
@ComponentDescriptor(name = "Vero Board", category = "Boards", author = "Branislav Stojkovic", componentLayer = ComponentLayer.BOARD, instanceNamePrefix = "B", desciption = "Perforated FR4 board with solder pads spaced 0.1 inch apart") @ComponentDescriptor(name = "Vero Board", category = "Boards", author = "Branislav Stojkovic", componentLayer = ComponentLayer.BOARD, instanceNamePrefix = "B", desciption = "Perforated FR4 board with copper strips connecting all holes in a row")
public class VeroBoard extends AbstractBoard { public class VeroBoard extends AbstractBoard {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -135,6 +135,14 @@ public class VeroBoard extends AbstractBoard {
@Override @Override
public void drawIcon(Graphics2D g2d, int width, int height) { public void drawIcon(Graphics2D g2d, int width, int height) {
g2d.setColor(BOARD_COLOR);
g2d.fillRect(2, 2, width - 4, height - 4);
g2d.setColor(BORDER_COLOR);
g2d.drawRect(2, 2, width - 4, height - 4);
g2d.setColor(COPPER_COLOR);
g2d.fillRect(4, width / 4, width - 8, width / 2);
g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(width / 3 - 1, width / 2 - 1, 2, 2);
g2d.fillOval(2 * width / 3 - 1, width / 2 - 1, 2, 2);
} }
} }
@@ -56,8 +56,8 @@ public class HookupWire extends AbstractTransparentComponent<AWG> {
Composite oldComposite = g2d.getComposite(); Composite oldComposite = g2d.getComposite();
if (alpha < MAX_ALPHA) { if (alpha < MAX_ALPHA) {
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha
1f * alpha / MAX_ALPHA)); / MAX_ALPHA));
} }
g2d.setColor(color.darker()); g2d.setColor(color.darker());
g2d.setStroke(new BasicStroke(thickness)); g2d.setStroke(new BasicStroke(thickness));
@@ -83,7 +83,7 @@ public class HookupWire extends AbstractTransparentComponent<AWG> {
controlPoints[index].setLocation(point); controlPoints[index].setLocation(point);
} }
@EditableProperty @EditableProperty(name = "AWG")
@Override @Override
public AWG getValue() { public AWG getValue() {
return value; return value;
@@ -58,7 +58,7 @@ public class Jumper extends AbstractLeadedDIYComponent<Void> {
} }
@Override @Override
protected Shape getComponentShape() { protected Shape getBodyShape() {
return null; return null;
} }
@@ -86,7 +86,7 @@ public class Trace extends AbstractLeadedDIYComponent<Void> {
} }
@Override @Override
protected Shape getComponentShape() { protected Shape getBodyShape() {
return null; return null;
} }
@@ -39,7 +39,13 @@ public class AxialFilmCapacitor extends AbstractLeadedDIYComponent<Capacitance>
} }
public void drawIcon(Graphics2D g2d, int width, int height) { public void drawIcon(Graphics2D g2d, int width, int height) {
g2d.drawString("C", 10, 10); g2d.rotate(-Math.PI / 4, width / 2, height / 2);
g2d.setColor(LEAD_COLOR);
g2d.drawLine(0, height / 2, width, height / 2);
g2d.setColor(BODY_COLOR);
g2d.fillRect(4, height / 2 - 3, width - 8, 6);
g2d.setColor(BORDER_COLOR);
g2d.drawRect(4, height / 2 - 3, width - 8, 6);
} }
@Override @Override
@@ -63,7 +69,7 @@ public class AxialFilmCapacitor extends AbstractLeadedDIYComponent<Capacitance>
} }
@Override @Override
protected Shape getComponentShape() { protected Shape getBodyShape() {
return new Rectangle2D.Double(0f, 0f, getWidth().convertToPixels(), getHeight() return new Rectangle2D.Double(0f, 0f, getWidth().convertToPixels(), getHeight()
.convertToPixels()); .convertToPixels());
} }
@@ -39,7 +39,13 @@ public class RadialCeramicDiskCapacitor extends AbstractLeadedDIYComponent<Capac
} }
public void drawIcon(Graphics2D g2d, int width, int height) { public void drawIcon(Graphics2D g2d, int width, int height) {
g2d.drawString("C", 10, 10); g2d.rotate(-Math.PI / 4, width / 2, height / 2);
g2d.setColor(LEAD_COLOR);
g2d.drawLine(0, height / 2, width, height / 2);
g2d.setColor(BODY_COLOR);
g2d.fillOval(4, height / 2 - 3, width - 8, 6);
g2d.setColor(BORDER_COLOR);
g2d.drawOval(4, height / 2 - 3, width - 8, 6);
} }
@Override @Override
@@ -63,7 +69,7 @@ public class RadialCeramicDiskCapacitor extends AbstractLeadedDIYComponent<Capac
} }
@Override @Override
protected Shape getComponentShape() { protected Shape getBodyShape() {
return new Ellipse2D.Double(0f, 0f, getWidth().convertToPixels(), getHeight() return new Ellipse2D.Double(0f, 0f, getWidth().convertToPixels(), getHeight()
.convertToPixels()); .convertToPixels());
} }
@@ -39,7 +39,13 @@ public class RadialFilmCapacitor extends AbstractLeadedDIYComponent<Capacitance>
} }
public void drawIcon(Graphics2D g2d, int width, int height) { public void drawIcon(Graphics2D g2d, int width, int height) {
g2d.drawString("C", 10, 10); g2d.rotate(-Math.PI / 4, width / 2, height / 2);
g2d.setColor(LEAD_COLOR);
g2d.drawLine(0, height / 2, width, height / 2);
g2d.setColor(BODY_COLOR);
g2d.fillRoundRect(4, height / 2 - 3, width - 8, 6, 2, 2);
g2d.setColor(BORDER_COLOR);
g2d.drawRoundRect(4, height / 2 - 3, width - 8, 6, 2, 2);
} }
@Override @Override
@@ -63,7 +69,7 @@ public class RadialFilmCapacitor extends AbstractLeadedDIYComponent<Capacitance>
} }
@Override @Override
protected Shape getComponentShape() { 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(), getHeight()
.convertToPixels(), radius, radius); .convertToPixels(), radius, radius);
@@ -39,7 +39,13 @@ public class Resistor extends AbstractLeadedDIYComponent<Resistance> {
} }
public void drawIcon(Graphics2D g2d, int width, int height) { public void drawIcon(Graphics2D g2d, int width, int height) {
g2d.drawString("R", 10, 10); g2d.rotate(-Math.PI / 4, width / 2, height / 2);
g2d.setColor(LEAD_COLOR);
g2d.drawLine(0, height / 2, width, height / 2);
g2d.setColor(BODY_COLOR);
g2d.fillRect(4, height / 2 - 3, width - 8, 6);
g2d.setColor(BORDER_COLOR);
g2d.drawRect(4, height / 2 - 3, width - 8, 6);
} }
@Override @Override
@@ -63,7 +69,7 @@ public class Resistor extends AbstractLeadedDIYComponent<Resistance> {
} }
@Override @Override
protected Shape getComponentShape() { protected Shape getBodyShape() {
return new Rectangle2D.Double(0f, 0f, getWidth().convertToPixels(), getHeight() return new Rectangle2D.Double(0f, 0f, getWidth().convertToPixels(), getHeight()
.convertToPixels()); .convertToPixels());
} }