mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
change layer to double
added solder pad
This commit is contained in:
+2
-2
@@ -3,10 +3,10 @@ package org.diylc.components.boards;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
|
||||
import org.diylc.core.ComponentLayer;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
|
||||
@ComponentDescriptor(name = "Blank Board", category = "Boards", author = "Branislav Stojkovic", componentLayer = ComponentLayer.BOARD, instanceNamePrefix = "B", desciption = "Blank circuit board")
|
||||
@ComponentDescriptor(name = "Blank Board", category = "Boards", author = "Branislav Stojkovic", zOrder = IDIYComponent.BOARD, instanceNamePrefix = "B", description = "Blank circuit board")
|
||||
public class BlankBoard extends AbstractBoard {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
+2
-2
@@ -7,15 +7,15 @@ import java.awt.Composite;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
|
||||
import org.diylc.core.ComponentLayer;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.Project;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "Perf Board w/ Pads", category = "Boards", author = "Branislav Stojkovic", componentLayer = ComponentLayer.BOARD, instanceNamePrefix = "B", desciption = "Perforated FR4 board with solder pads spaced 0.1 inch apart")
|
||||
@ComponentDescriptor(name = "Perf Board w/ Pads", category = "Boards", author = "Branislav Stojkovic", zOrder = IDIYComponent.BOARD, instanceNamePrefix = "B", description = "Perforated FR4 board with solder pads spaced 0.1 inch apart")
|
||||
public class PerfBoard extends AbstractBoard {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
+2
-2
@@ -6,15 +6,15 @@ import java.awt.Composite;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
|
||||
import org.diylc.core.ComponentLayer;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.Project;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
@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")
|
||||
@ComponentDescriptor(name = "Vero Board", category = "Boards", author = "Branislav Stojkovic", zOrder = IDIYComponent.BOARD, instanceNamePrefix = "B", description = "Perforated FR4 board with copper strips connecting all holes in a row")
|
||||
public class VeroBoard extends AbstractBoard {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package org.diylc.components.interconnects;
|
||||
package org.diylc.components.connectivity;
|
||||
|
||||
public enum AWG {
|
||||
|
||||
+9
-5
@@ -1,17 +1,19 @@
|
||||
package org.diylc.components.interconnects;
|
||||
package org.diylc.components.connectivity;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Shape;
|
||||
|
||||
import org.diylc.components.AbstractLeadedDIYComponent;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Trace", author = "Branislav Stojkovic", category = "Interconnects", instanceNamePrefix = "J", desciption = "Jumper wire")
|
||||
public class Trace extends AbstractLeadedDIYComponent<Void> {
|
||||
@ComponentDescriptor(name = "Copper Trace", author = "Branislav Stojkovic", category = "Connectivity", instanceNamePrefix = "J", description = "Jumper wire", zOrder = IDIYComponent.ABOVE_BOARD)
|
||||
public class CopperTrace extends AbstractLeadedDIYComponent<Void> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -23,7 +25,9 @@ public class Trace extends AbstractLeadedDIYComponent<Void> {
|
||||
|
||||
@Override
|
||||
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||
|
||||
g2d.setStroke(new BasicStroke(3));
|
||||
g2d.setColor(COLOR);
|
||||
g2d.drawLine(1, height - 2, width - 2, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,7 +53,7 @@ public class Trace extends AbstractLeadedDIYComponent<Void> {
|
||||
@Deprecated
|
||||
public Color getBodyColor() {
|
||||
return super.getBodyColor();
|
||||
};
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
+15
-4
@@ -1,4 +1,4 @@
|
||||
package org.diylc.components.interconnects;
|
||||
package org.diylc.components.connectivity;
|
||||
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.BasicStroke;
|
||||
@@ -6,22 +6,25 @@ import java.awt.Color;
|
||||
import java.awt.Composite;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.geom.CubicCurve2D;
|
||||
import java.awt.geom.Path2D;
|
||||
|
||||
import org.diylc.components.AbstractTransparentComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.Project;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "Hookup wire", author = "Branislav Stojkovic", category = "Interconnects", instanceNamePrefix = "W", desciption = "Jumper wire")
|
||||
@ComponentDescriptor(name = "Hookup wire", author = "Branislav Stojkovic", category = "Connectivity", instanceNamePrefix = "W", description = "Jumper wire", zOrder = IDIYComponent.ABOVE_COMPONENT)
|
||||
public class HookupWire extends AbstractTransparentComponent<AWG> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static Color GUIDELINE_COLOR = Color.blue;
|
||||
public static Color COLOR = Color.green;
|
||||
public static double INSULATION_THICKNESS_PCT = 0.3;
|
||||
|
||||
private Point[] controlPoints = new Point[] {
|
||||
new Point(-5 * Constants.GRID, -5 * Constants.GRID), new Point(0, -3 * Constants.GRID),
|
||||
@@ -32,7 +35,14 @@ public class HookupWire extends AbstractTransparentComponent<AWG> {
|
||||
|
||||
@Override
|
||||
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||
|
||||
g2d.setColor(COLOR.darker());
|
||||
g2d.setStroke(new BasicStroke(3));
|
||||
CubicCurve2D curve = new CubicCurve2D.Double(1, height - 1, width / 4, height / 3,
|
||||
3 * width / 4, 2 * height / 3, width - 1, 1);
|
||||
g2d.draw(curve);
|
||||
g2d.setColor(COLOR);
|
||||
g2d.setStroke(new BasicStroke(1));
|
||||
g2d.draw(curve);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,7 +58,8 @@ public class HookupWire extends AbstractTransparentComponent<AWG> {
|
||||
g2d.drawLine(controlPoints[2].x, controlPoints[2].y, controlPoints[3].x,
|
||||
controlPoints[3].y);
|
||||
}
|
||||
int thickness = (int) (Math.pow(Math.E, -1.12436 - 0.11594 * value.getValue()) * Constants.PIXELS_PER_INCH);
|
||||
int thickness = (int) (Math.pow(Math.E, -1.12436 - 0.11594 * value.getValue())
|
||||
* Constants.PIXELS_PER_INCH * (1 + 2 * INSULATION_THICKNESS_PCT));
|
||||
Path2D path = new Path2D.Double();
|
||||
path.moveTo(controlPoints[0].x, controlPoints[0].y);
|
||||
path.curveTo(controlPoints[1].x, controlPoints[1].y, controlPoints[2].x,
|
||||
+9
-6
@@ -1,32 +1,35 @@
|
||||
package org.diylc.components.interconnects;
|
||||
package org.diylc.components.connectivity;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Shape;
|
||||
|
||||
import org.diylc.components.AbstractLeadedDIYComponent;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.measures.Size;
|
||||
|
||||
@ComponentDescriptor(name = "Jumper", author = "Branislav Stojkovic", category = "Interconnects", instanceNamePrefix = "J", desciption = "Jumper wire")
|
||||
@ComponentDescriptor(name = "Jumper", author = "Branislav Stojkovic", category = "Connectivity", instanceNamePrefix = "J", description = "Jumper wire", zOrder = IDIYComponent.ABOVE_BOARD)
|
||||
public class Jumper extends AbstractLeadedDIYComponent<Void> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||
|
||||
g2d.setStroke(new BasicStroke(1));
|
||||
g2d.setColor(LEAD_COLOR);
|
||||
g2d.drawLine(1, height - 2, width - 2, 1);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Color getBodyColor() {
|
||||
return super.getBodyColor();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Color getBorderColor() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getBorderColor();
|
||||
}
|
||||
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
package org.diylc.components.connectivity;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
|
||||
import org.diylc.components.AbstractSinglePointComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.Project;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "Solder Pad", category = "Connectivity", author = "Branislav Stojkovic", description = "test", instanceNamePrefix = "", stretchable = false, zOrder = IDIYComponent.ABOVE_BOARD + 0.1)
|
||||
public class SolderPad extends AbstractSinglePointComponent {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static Size SIZE = new Size(0.09d, SizeUnit.in);
|
||||
public static Size HOLE_SIZE = new Size(0.8d, SizeUnit.mm);
|
||||
public static Color COLOR = Color.black;
|
||||
|
||||
private Size size = SIZE;
|
||||
private Color color = COLOR;
|
||||
|
||||
@Override
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, Project project) {
|
||||
int diameter = size.convertToPixels();
|
||||
int holeDiameter = HOLE_SIZE.convertToPixels();
|
||||
g2d.setColor(color);
|
||||
g2d.fillOval(point.x - diameter / 2, point.y - diameter / 2, diameter, diameter);
|
||||
g2d.setColor(Constants.CANVAS_COLOR);
|
||||
g2d.fillOval(point.x - holeDiameter / 2, point.y - holeDiameter / 2, holeDiameter,
|
||||
holeDiameter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||
int diameter = width / 2;
|
||||
int holeDiameter = 4;
|
||||
g2d.setColor(COLOR);
|
||||
g2d.fillOval((width - diameter) / 2, (height - diameter) / 2, diameter, diameter);
|
||||
g2d.setColor(Constants.CANVAS_COLOR);
|
||||
g2d.fillOval((width - holeDiameter) / 2, (height - holeDiameter) / 2, holeDiameter,
|
||||
holeDiameter);
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
public Size getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(Size size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(Color color) {
|
||||
this.color = color;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -9,15 +9,15 @@ import java.awt.Point;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
|
||||
import org.diylc.components.AbstractTransparentComponent;
|
||||
import org.diylc.core.ComponentLayer;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.Project;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Mini Toggle Switch", category = "Electromechanical", author = "Branislav Stojkovic", desciption = "", stretchable = false, componentLayer = ComponentLayer.COMPONENT, instanceNamePrefix = "SW")
|
||||
@ComponentDescriptor(name = "Mini Toggle Switch", category = "Electromechanical", author = "Branislav Stojkovic", description = "", stretchable = false, zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "SW")
|
||||
public class MiniToggleSwitch extends AbstractTransparentComponent<ToggleSwitchType> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@ import java.awt.Shape;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
||||
import org.diylc.components.AbstractLeadedDIYComponent;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.measures.Capacitance;
|
||||
@@ -13,7 +14,7 @@ import org.diylc.core.measures.CapacitanceUnit;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Axial Film Capacitor", author = "Branislav Stojkovic", category = "Passive", instanceNamePrefix = "C", desciption = "test")
|
||||
@ComponentDescriptor(name = "Axial Film Capacitor", author = "Branislav Stojkovic", category = "Passive", instanceNamePrefix = "C", description = "test", zOrder = IDIYComponent.COMPONENT)
|
||||
public class AxialFilmCapacitor extends AbstractLeadedDIYComponent<Capacitance> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@ import java.awt.Shape;
|
||||
import java.awt.geom.Ellipse2D;
|
||||
|
||||
import org.diylc.components.AbstractLeadedDIYComponent;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.measures.Capacitance;
|
||||
@@ -13,7 +14,7 @@ import org.diylc.core.measures.CapacitanceUnit;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Ceramic Capacitor", author = "Branislav Stojkovic", category = "Passive", instanceNamePrefix = "C", desciption = "test")
|
||||
@ComponentDescriptor(name = "Ceramic Capacitor", author = "Branislav Stojkovic", category = "Passive", instanceNamePrefix = "C", description = "test", zOrder = IDIYComponent.COMPONENT)
|
||||
public class RadialCeramicDiskCapacitor extends AbstractLeadedDIYComponent<Capacitance> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@ import java.awt.Shape;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
|
||||
import org.diylc.components.AbstractLeadedDIYComponent;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.measures.Capacitance;
|
||||
@@ -13,7 +14,7 @@ import org.diylc.core.measures.CapacitanceUnit;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Radial Film Capacitor", author = "Branislav Stojkovic", category = "Passive", instanceNamePrefix = "C", desciption = "test")
|
||||
@ComponentDescriptor(name = "Radial Film Capacitor", author = "Branislav Stojkovic", category = "Passive", instanceNamePrefix = "C", description = "test", zOrder = IDIYComponent.COMPONENT)
|
||||
public class RadialFilmCapacitor extends AbstractLeadedDIYComponent<Capacitance> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
+2
-1
@@ -6,6 +6,7 @@ import java.awt.Shape;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
||||
import org.diylc.components.AbstractLeadedDIYComponent;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.measures.Resistance;
|
||||
@@ -13,7 +14,7 @@ import org.diylc.core.measures.ResistanceUnit;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Resistor", author = "Branislav Stojkovic", category = "Passive", instanceNamePrefix = "R", desciption = "test")
|
||||
@ComponentDescriptor(name = "Resistor", author = "Branislav Stojkovic", category = "Passive", instanceNamePrefix = "R", description = "test", zOrder = IDIYComponent.COMPONENT)
|
||||
public class Resistor extends AbstractLeadedDIYComponent<Resistance> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
+2
-1
@@ -15,6 +15,7 @@ import java.awt.geom.RoundRectangle2D;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.components.AbstractTransparentComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.Project;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
@@ -22,7 +23,7 @@ import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "DIL IC", author = "Branislav Stojkovic", category = "Semiconductors", instanceNamePrefix = "IC", desciption = "test", stretchable = false)
|
||||
@ComponentDescriptor(name = "DIL IC", author = "Branislav Stojkovic", category = "Semiconductors", instanceNamePrefix = "IC", description = "test", stretchable = false, zOrder = IDIYComponent.COMPONENT)
|
||||
public class DIL_IC extends AbstractTransparentComponent<String> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
Reference in New Issue
Block a user