mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-07 12:24:58 +10:00
Refactor abstract class
This commit is contained in:
@@ -28,7 +28,6 @@ import java.awt.Shape;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Area;
|
||||
import java.awt.geom.Ellipse2D;
|
||||
import java.awt.geom.Path2D;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
@@ -172,9 +171,6 @@ public abstract class AbstractMakerBoard extends AbstractTransparentComponent<Vo
|
||||
@Override
|
||||
public void setControlPoint(Point2D point, int index) {
|
||||
controlPoints[index].setLocation(point);
|
||||
// if (index == 0) {
|
||||
// updateControlPoints();
|
||||
// }
|
||||
invalidateCache();
|
||||
}
|
||||
|
||||
@@ -233,7 +229,8 @@ public abstract class AbstractMakerBoard extends AbstractTransparentComponent<Vo
|
||||
/**
|
||||
* Helper to draw standard pin header pins at given control point indices.
|
||||
*/
|
||||
protected void drawPinHeader(Graphics2D g2d, int startIndex, int count, boolean female, boolean outlineMode, IDrawingObserver drawingObserver) {
|
||||
protected void drawPinHeader(Graphics2D g2d, int startIndex, int count, boolean outlineMode,
|
||||
IDrawingObserver drawingObserver) {
|
||||
if (outlineMode) return;
|
||||
int pinPx = (int) Math.round(PIN_SIZE.convertToPixels());
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
@@ -254,13 +251,6 @@ public abstract class AbstractMakerBoard extends AbstractTransparentComponent<Vo
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for {@link #drawPinHeader(Graphics2D, int, int, boolean, boolean, IDrawingObserver)}.
|
||||
*/
|
||||
protected void drawPins(Graphics2D g2d, int startIndex, int count, boolean female, boolean outlineMode, IDrawingObserver drawingObserver) {
|
||||
drawPinHeader(g2d, startIndex, count, female, outlineMode, drawingObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to format a pin name for silkscreen display (e.g. "3V3_1" -> "3V3", "A0 (ADC0)" -> "A0").
|
||||
*
|
||||
@@ -384,341 +374,6 @@ public abstract class AbstractMakerBoard extends AbstractTransparentComponent<Vo
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw the official Arduino infinity logo (white infinity symbol with '-' and '+').
|
||||
* Default bounding box size is 95.56 x 45.33 px.
|
||||
*
|
||||
* @param g2d Graphics2D context
|
||||
* @param x Top-left X coordinate of the logo bounding box
|
||||
* @param y Top-left Y coordinate of the logo bounding box
|
||||
*/
|
||||
protected void drawArduinoLogo(Graphics2D g2d, double x, double y) {
|
||||
drawArduinoLogo(g2d, x, y, 1.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw the official Arduino infinity logo with custom scaling.
|
||||
*
|
||||
* @param g2d Graphics2D context
|
||||
* @param x Top-left X coordinate of the logo bounding box
|
||||
* @param y Top-left Y coordinate of the logo bounding box
|
||||
* @param scale Scale factor (1.0 = 95.56 x 45.33 px)
|
||||
*/
|
||||
protected void drawArduinoLogo(Graphics2D g2d, double x, double y, double scale) {
|
||||
AffineTransform oldTx = g2d.getTransform();
|
||||
g2d.translate(x, y);
|
||||
if (scale != 1.0) {
|
||||
g2d.scale(scale, scale);
|
||||
}
|
||||
|
||||
Path2D.Double infinityBody = new Path2D.Double(Path2D.WIND_EVEN_ODD);
|
||||
// Outer loop
|
||||
infinityBody.moveTo(47.56, 14.67);
|
||||
infinityBody.curveTo(50.00, 12.00, 51.78, 9.78, 54.00, 7.78);
|
||||
infinityBody.curveTo(62.22, 0.44, 71.56, -2.44, 82.22, 2.22);
|
||||
infinityBody.curveTo(92.22, 6.44, 97.78, 16.89, 95.56, 27.56);
|
||||
infinityBody.curveTo(93.56, 37.33, 84.00, 44.89, 73.78, 45.33);
|
||||
infinityBody.curveTo(64.22, 45.56, 56.89, 41.33, 50.89, 34.44);
|
||||
infinityBody.curveTo(50.00, 33.33, 49.11, 32.22, 48.00, 30.89);
|
||||
infinityBody.curveTo(47.11, 31.78, 46.44, 32.67, 46.00, 33.33);
|
||||
infinityBody.curveTo(39.56, 41.33, 31.56, 46.00, 20.89, 45.33);
|
||||
infinityBody.curveTo(10.44, 44.67, 0.67, 34.89, 0.00, 24.44);
|
||||
infinityBody.curveTo(-0.89, 11.11, 9.33, 0.22, 23.33, 0.00);
|
||||
infinityBody.curveTo(32.67, 0.00, 40.00, 4.67, 45.78, 12.00);
|
||||
infinityBody.curveTo(46.44, 12.89, 47.11, 13.56, 47.78, 14.67);
|
||||
infinityBody.closePath();
|
||||
|
||||
// Left hole cutout
|
||||
infinityBody.moveTo(24.44, 7.56);
|
||||
infinityBody.curveTo(14.67, 7.56, 7.56, 13.78, 6.89, 21.78);
|
||||
infinityBody.curveTo(6.22, 28.89, 11.78, 36.00, 19.56, 37.78);
|
||||
infinityBody.curveTo(27.33, 39.33, 33.33, 36.22, 38.00, 30.67);
|
||||
infinityBody.curveTo(45.11, 22.22, 44.89, 23.56, 38.00, 15.11);
|
||||
infinityBody.curveTo(34.22, 10.44, 29.11, 7.78, 24.22, 7.56);
|
||||
infinityBody.closePath();
|
||||
|
||||
// Right hole cutout
|
||||
infinityBody.moveTo(72.67, 7.33);
|
||||
infinityBody.curveTo(71.56, 7.33, 70.67, 7.33, 69.78, 7.33);
|
||||
infinityBody.curveTo(61.56, 8.89, 56.44, 14.44, 52.44, 21.56);
|
||||
infinityBody.curveTo(52.22, 22.00, 52.22, 23.11, 52.44, 23.56);
|
||||
infinityBody.curveTo(56.00, 29.56, 60.22, 34.89, 67.33, 37.11);
|
||||
infinityBody.curveTo(74.00, 39.33, 80.00, 37.56, 84.67, 32.22);
|
||||
infinityBody.curveTo(88.89, 27.56, 89.78, 22.00, 87.11, 16.44);
|
||||
infinityBody.curveTo(84.22, 10.44, 78.89, 7.78, 72.67, 7.33);
|
||||
infinityBody.lineTo(72.67, 7.33);
|
||||
infinityBody.closePath();
|
||||
|
||||
g2d.setColor(Color.WHITE);
|
||||
g2d.fill(infinityBody);
|
||||
|
||||
// Minus sign in left loop
|
||||
Path2D.Double minus = new Path2D.Double();
|
||||
minus.moveTo(31.33, 24.44);
|
||||
minus.curveTo(31.33, 24.44, 31.33, 24.89, 30.89, 24.89);
|
||||
minus.lineTo(16.44, 24.89);
|
||||
minus.curveTo(16.44, 24.89, 16.00, 24.89, 16.00, 24.44);
|
||||
minus.lineTo(16.00, 20.00);
|
||||
minus.curveTo(16.00, 20.00, 16.00, 19.56, 16.44, 19.56);
|
||||
minus.lineTo(30.89, 19.56);
|
||||
minus.curveTo(30.89, 19.56, 31.33, 19.56, 31.33, 20.00);
|
||||
minus.lineTo(31.33, 24.44);
|
||||
minus.closePath();
|
||||
g2d.fill(minus);
|
||||
|
||||
// Plus sign in right loop
|
||||
Path2D.Double plus = new Path2D.Double();
|
||||
plus.moveTo(78.89, 20.22);
|
||||
plus.curveTo(78.89, 20.22, 78.89, 19.78, 78.44, 19.78);
|
||||
plus.lineTo(74.22, 19.78);
|
||||
plus.curveTo(74.22, 19.78, 73.78, 19.78, 73.78, 19.33);
|
||||
plus.lineTo(73.78, 15.11);
|
||||
plus.curveTo(73.78, 15.11, 73.78, 14.67, 73.33, 14.67);
|
||||
plus.lineTo(68.89, 14.67);
|
||||
plus.curveTo(68.89, 14.67, 68.44, 14.67, 68.44, 15.11);
|
||||
plus.lineTo(68.44, 19.33);
|
||||
plus.curveTo(68.44, 19.33, 68.44, 19.78, 68.00, 19.78);
|
||||
plus.lineTo(63.78, 19.78);
|
||||
plus.curveTo(63.78, 19.78, 63.33, 19.78, 63.33, 20.22);
|
||||
plus.lineTo(63.33, 24.67);
|
||||
plus.curveTo(63.33, 24.67, 63.33, 25.11, 63.78, 25.11);
|
||||
plus.lineTo(68.00, 25.11);
|
||||
plus.curveTo(68.00, 25.11, 68.44, 25.11, 68.44, 25.56);
|
||||
plus.lineTo(68.44, 29.78);
|
||||
plus.curveTo(68.44, 29.78, 68.44, 30.22, 68.89, 30.22);
|
||||
plus.lineTo(73.33, 30.22);
|
||||
plus.curveTo(73.33, 30.22, 73.78, 30.22, 73.78, 29.78);
|
||||
plus.lineTo(73.78, 25.56);
|
||||
plus.curveTo(73.78, 25.56, 73.78, 25.11, 74.22, 25.11);
|
||||
plus.lineTo(78.44, 25.11);
|
||||
plus.curveTo(78.44, 25.11, 78.89, 25.11, 78.89, 24.67);
|
||||
plus.lineTo(78.89, 20.22);
|
||||
plus.closePath();
|
||||
g2d.fill(plus);
|
||||
|
||||
g2d.setTransform(oldTx);
|
||||
}
|
||||
|
||||
private static final Area RASPBERRY_PI_LOGO_AREA = createRaspberryPiLogoArea();
|
||||
|
||||
private static Area createRaspberryPiLogoArea() {
|
||||
Path2D.Double p0 = new Path2D.Double(Path2D.WIND_NON_ZERO);
|
||||
p0.moveTo(19.6295, 0.0014);
|
||||
p0.curveTo(19.1612, 0.0159, 18.6569, 0.1889, 18.0849, 0.6402);
|
||||
p0.curveTo(16.6837, 0.0999, 15.3251, -0.0878, 14.1102, 1.0122);
|
||||
p0.curveTo(12.2342, 0.7689, 11.6245, 1.2710, 11.1626, 1.8572);
|
||||
p0.curveTo(10.7507, 1.8487, 8.0807, 1.4339, 6.8564, 3.2603);
|
||||
p0.curveTo(3.7794, 2.8963, 2.8070, 5.0701, 3.9089, 7.0973);
|
||||
p0.curveTo(3.2805, 8.0702, 2.6293, 9.0313, 4.0989, 10.8859);
|
||||
p0.curveTo(3.5790, 11.9189, 3.9013, 13.0394, 5.1259, 14.3954);
|
||||
p0.curveTo(4.8027, 15.8475, 5.4379, 16.8720, 6.5775, 17.6704);
|
||||
p0.curveTo(6.3644, 19.6575, 8.3997, 20.8128, 9.0075, 21.2245);
|
||||
p0.curveTo(9.2408, 22.3823, 9.7272, 23.4749, 12.0520, 24.0790);
|
||||
p0.curveTo(12.4354, 25.8045, 13.8326, 26.1024, 15.1856, 26.4646);
|
||||
p0.curveTo(10.7138, 29.0639, 6.8789, 32.4840, 6.9049, 40.8755);
|
||||
p0.lineTo(6.2500, 42.0440);
|
||||
p0.curveTo(1.1224, 45.1622, -3.4908, 55.1843, 3.7230, 63.3304);
|
||||
p0.curveTo(4.1942, 65.8804, 4.9845, 67.7119, 5.6881, 69.7390);
|
||||
p0.curveTo(6.7405, 77.9072, 13.6088, 81.7320, 15.4203, 82.1843);
|
||||
p0.curveTo(18.0749, 84.2063, 20.9021, 86.1249, 24.7280, 87.4689);
|
||||
p0.curveTo(28.3346, 91.1885, 32.2420, 92.6062, 36.1706, 92.6039);
|
||||
p0.curveTo(36.2282, 92.6039, 36.2868, 92.6045, 36.3445, 92.6039);
|
||||
p0.curveTo(40.2731, 92.6063, 44.1803, 91.1887, 47.7870, 87.4689);
|
||||
p0.curveTo(51.6128, 86.1249, 54.4401, 84.2063, 57.0947, 82.1843);
|
||||
p0.curveTo(58.9062, 81.7319, 65.7745, 77.9072, 66.8269, 69.7390);
|
||||
p0.curveTo(67.5305, 67.7119, 68.3208, 65.8803, 68.7920, 63.3304);
|
||||
p0.curveTo(76.0057, 55.1837, 71.3926, 45.1609, 66.2650, 42.0427);
|
||||
p0.lineTo(65.6090, 40.8744);
|
||||
p0.curveTo(65.6350, 32.4834, 61.8002, 29.0634, 57.3284, 26.4634);
|
||||
p0.curveTo(58.6814, 26.1014, 60.0786, 25.8034, 60.4619, 24.0779);
|
||||
p0.curveTo(62.7867, 23.4737, 63.2732, 22.3811, 63.5065, 21.2234);
|
||||
p0.curveTo(64.1143, 20.8118, 66.1495, 19.6564, 65.9365, 17.6693);
|
||||
p0.curveTo(67.0759, 16.8708, 67.7113, 15.8463, 67.3880, 14.3943);
|
||||
p0.curveTo(68.6127, 13.0383, 68.9350, 11.9177, 68.4150, 10.8847);
|
||||
p0.curveTo(69.8849, 9.0309, 69.2328, 8.0698, 68.6052, 7.0970);
|
||||
p0.curveTo(69.7063, 5.0698, 68.7346, 2.8959, 65.6566, 3.2600);
|
||||
p0.curveTo(64.4326, 1.4335, 61.7634, 1.8484, 61.3506, 1.8569);
|
||||
p0.curveTo(60.8887, 1.2707, 60.2793, 0.7685, 58.4032, 1.0119);
|
||||
p0.curveTo(57.1883, -0.0882, 55.8298, 0.0995, 54.4285, 0.6399);
|
||||
p0.curveTo(52.7646, -0.6731, 51.6635, 0.3794, 50.4059, 0.7773);
|
||||
p0.curveTo(48.3914, 0.1191, 47.9309, 1.0207, 46.9410, 1.3879);
|
||||
p0.curveTo(44.7440, 0.9236, 44.0764, 1.9344, 43.0232, 3.0012);
|
||||
p0.lineTo(41.7982, 2.9769);
|
||||
p0.curveTo(38.4844, 4.9297, 36.8382, 8.9061, 36.2548, 10.9503);
|
||||
p0.curveTo(35.6710, 8.9057, 34.0286, 4.9293, 30.7155, 2.9769);
|
||||
p0.lineTo(29.4904, 3.0012);
|
||||
p0.curveTo(28.4359, 1.9344, 27.7683, 0.9236, 25.5714, 1.3879);
|
||||
p0.curveTo(24.5815, 1.0207, 24.1222, 0.1191, 22.1064, 0.7773);
|
||||
p0.curveTo(21.2810, 0.5162, 20.5218, -0.0267, 19.6279, 0.0010);
|
||||
p0.closePath();
|
||||
|
||||
Path2D.Double p1 = new Path2D.Double(Path2D.WIND_NON_ZERO);
|
||||
p1.moveTo(13.0322, 8.5925);
|
||||
p1.curveTo(21.8236, 13.1250, 26.9346, 16.7915, 29.7345, 19.9142);
|
||||
p1.curveTo(28.3006, 25.6612, 20.8204, 25.9235, 18.0852, 25.7623);
|
||||
p1.curveTo(18.6452, 25.5016, 19.1125, 25.1894, 19.2782, 24.7097);
|
||||
p1.curveTo(18.5919, 24.2219, 16.1583, 24.6583, 14.4594, 23.7037);
|
||||
p1.curveTo(15.1120, 23.5686, 15.4173, 23.4369, 15.7225, 22.9552);
|
||||
p1.curveTo(14.1174, 22.4433, 12.3885, 22.0022, 11.3715, 21.1541);
|
||||
p1.curveTo(11.9203, 21.1609, 12.4327, 21.2768, 13.1493, 20.7798);
|
||||
p1.curveTo(11.7116, 20.0050, 10.1775, 19.3910, 8.9856, 18.2068);
|
||||
p1.curveTo(9.7289, 18.1885, 10.5303, 18.1994, 10.7633, 17.9260);
|
||||
p1.curveTo(9.4475, 17.1108, 8.3373, 16.2042, 7.4183, 15.2126);
|
||||
p1.curveTo(8.4585, 15.3381, 8.8977, 15.2300, 9.1493, 15.0488);
|
||||
p1.curveTo(8.1546, 14.0300, 6.8956, 13.1698, 6.2954, 11.9143);
|
||||
p1.curveTo(7.0678, 12.1805, 7.7744, 12.2825, 8.2838, 11.8909);
|
||||
p1.curveTo(7.9458, 11.1284, 6.4976, 10.6787, 5.6638, 8.8967);
|
||||
p1.curveTo(6.4770, 8.9756, 7.3394, 9.0741, 7.5119, 8.8967);
|
||||
p1.curveTo(7.1345, 7.3591, 6.4869, 6.4947, 5.8518, 5.5991);
|
||||
p1.curveTo(7.5920, 5.5732, 10.2286, 5.6058, 10.1092, 5.4587);
|
||||
p1.lineTo(9.0332, 4.3593);
|
||||
p1.curveTo(10.7330, 3.9016, 12.4723, 4.4328, 13.7350, 4.8271);
|
||||
p1.curveTo(14.3020, 4.3797, 13.7250, 3.8141, 13.0332, 3.2365);
|
||||
p1.curveTo(14.4778, 3.4293, 15.7832, 3.7615, 16.9630, 4.2189);
|
||||
p1.curveTo(17.5935, 3.6497, 16.5537, 3.0805, 16.0507, 2.5113);
|
||||
p1.curveTo(18.2825, 2.9347, 19.2281, 3.5297, 20.1677, 4.1253);
|
||||
p1.curveTo(20.8496, 3.4719, 20.2068, 2.9165, 19.7467, 2.3476);
|
||||
p1.curveTo(21.4295, 2.9709, 22.2962, 3.7756, 23.2088, 4.5698);
|
||||
p1.curveTo(23.5182, 4.1523, 23.9948, 3.8463, 23.4193, 2.8388);
|
||||
p1.curveTo(24.6141, 3.5275, 25.5139, 4.3390, 26.1796, 5.2482);
|
||||
p1.curveTo(26.9189, 4.7775, 26.6200, 4.1338, 26.6241, 3.5406);
|
||||
p1.curveTo(27.8657, 4.5506, 28.6537, 5.6255, 29.6183, 6.6751);
|
||||
p1.curveTo(29.8126, 6.5336, 29.9827, 6.0538, 30.1329, 5.2949);
|
||||
p1.curveTo(33.0952, 8.1688, 37.2809, 15.4074, 31.2089, 18.2774);
|
||||
p1.curveTo(26.0413, 14.0154, 19.8697, 10.9176, 13.0304, 8.5937);
|
||||
p1.closePath();
|
||||
p1.moveTo(59.6793, 8.5925);
|
||||
p1.curveTo(50.8889, 13.1254, 45.7783, 16.7909, 42.9783, 19.9142);
|
||||
p1.curveTo(44.4122, 25.6612, 51.8924, 25.9235, 54.6276, 25.7623);
|
||||
p1.curveTo(54.0676, 25.5016, 53.6003, 25.1894, 53.4346, 24.7097);
|
||||
p1.curveTo(54.1210, 24.2219, 56.5545, 24.6583, 58.2535, 23.7037);
|
||||
p1.curveTo(57.6008, 23.5686, 57.2955, 23.4369, 56.9903, 22.9552);
|
||||
p1.curveTo(58.5954, 22.4433, 60.3244, 22.0022, 61.3413, 21.1541);
|
||||
p1.curveTo(60.7925, 21.1609, 60.2801, 21.2768, 59.5635, 20.7798);
|
||||
p1.curveTo(61.0012, 20.0050, 62.5353, 19.3910, 63.7272, 18.2068);
|
||||
p1.curveTo(62.9839, 18.1885, 62.1825, 18.1994, 61.9495, 17.9260);
|
||||
p1.curveTo(63.2653, 17.1108, 64.3755, 16.2042, 65.2946, 15.2126);
|
||||
p1.curveTo(64.2543, 15.3381, 63.8151, 15.2300, 63.5636, 15.0488);
|
||||
p1.curveTo(64.5582, 14.0300, 65.8172, 13.1698, 66.4174, 11.9143);
|
||||
p1.curveTo(65.6450, 12.1805, 64.9384, 12.2825, 64.4290, 11.8909);
|
||||
p1.curveTo(64.7670, 11.1284, 66.2152, 10.6787, 67.0490, 8.8967);
|
||||
p1.curveTo(66.2358, 8.9756, 65.3734, 9.0741, 65.2010, 8.8967);
|
||||
p1.curveTo(65.5790, 7.3585, 66.2266, 6.4940, 66.8617, 5.5984);
|
||||
p1.curveTo(65.1215, 5.5726, 62.4849, 5.6052, 62.6043, 5.4581);
|
||||
p1.lineTo(63.6803, 4.3587);
|
||||
p1.curveTo(61.9805, 3.9010, 60.2411, 4.4322, 58.9785, 4.8265);
|
||||
p1.curveTo(58.4115, 4.3791, 58.9885, 3.8135, 59.6802, 3.2358);
|
||||
p1.curveTo(58.2357, 3.4287, 56.9302, 3.7608, 55.7504, 4.2183);
|
||||
p1.curveTo(55.1200, 3.6491, 56.1598, 3.0799, 56.6627, 2.5107);
|
||||
p1.curveTo(54.4310, 2.9341, 53.4854, 3.5290, 52.5457, 4.1247);
|
||||
p1.curveTo(51.8639, 3.4713, 52.5067, 2.9159, 52.9667, 2.3470);
|
||||
p1.curveTo(51.2840, 2.9703, 50.4172, 3.7750, 49.5047, 4.5692);
|
||||
p1.curveTo(49.1953, 4.1517, 48.7187, 3.8456, 49.2941, 2.8382);
|
||||
p1.curveTo(48.0994, 3.5268, 47.1995, 4.3384, 46.5338, 5.2476);
|
||||
p1.curveTo(45.7946, 4.7769, 46.0934, 4.1332, 46.0894, 3.5399);
|
||||
p1.curveTo(44.8477, 4.5499, 44.0597, 5.6249, 43.0952, 6.6744);
|
||||
p1.curveTo(42.9009, 6.5330, 42.7307, 6.0532, 42.5805, 5.2943);
|
||||
p1.curveTo(39.6183, 8.1682, 35.4325, 15.4067, 41.5045, 18.2768);
|
||||
p1.curveTo(46.6695, 14.0139, 52.8407, 10.9163, 59.6805, 8.5924);
|
||||
p1.closePath();
|
||||
|
||||
Path2D.Double p2 = new Path2D.Double(Path2D.WIND_NON_ZERO);
|
||||
p2.moveTo(47.0024, 67.1140);
|
||||
p2.curveTo(47.0188, 70.5889, 45.0112, 73.8170, 41.7504, 75.5588);
|
||||
p2.curveTo(38.4896, 77.3006, 34.4542, 77.3006, 31.1934, 75.5588);
|
||||
p2.curveTo(27.9326, 73.8170, 25.9250, 70.5889, 25.9414, 67.1140);
|
||||
p2.curveTo(25.9250, 63.6391, 27.9326, 60.4110, 31.1934, 58.6692);
|
||||
p2.curveTo(34.4542, 56.9274, 38.4896, 56.9274, 41.7504, 58.6692);
|
||||
p2.curveTo(45.0112, 60.4110, 47.0188, 63.6391, 47.0024, 67.1140);
|
||||
p2.closePath();
|
||||
p2.moveTo(30.3786, 39.3746);
|
||||
p2.curveTo(33.2055, 41.2176, 34.6522, 44.7077, 34.1649, 48.5090);
|
||||
p2.curveTo(33.6776, 52.3102, 31.3275, 55.8665, 28.0144, 57.8164);
|
||||
p2.curveTo(24.7013, 59.7663, 20.9097, 59.8245, 18.0912, 57.9688);
|
||||
p2.curveTo(15.2643, 56.1258, 13.8176, 52.6357, 14.3049, 48.8344);
|
||||
p2.curveTo(14.7922, 45.0332, 17.1423, 41.4769, 20.4554, 39.5270);
|
||||
p2.curveTo(23.7685, 37.5771, 27.5601, 37.5189, 30.3786, 39.3746);
|
||||
p2.closePath();
|
||||
|
||||
Path2D.Double p3 = new Path2D.Double(Path2D.WIND_NON_ZERO);
|
||||
p3.moveTo(42.1557, 38.8570);
|
||||
p3.curveTo(37.8215, 41.6966, 37.0284, 48.2301, 40.3987, 53.3303);
|
||||
p3.curveTo(43.7691, 58.4306, 50.1089, 60.2909, 54.4431, 57.4513);
|
||||
p3.curveTo(58.7773, 54.6117, 59.5704, 48.0782, 56.2001, 42.9780);
|
||||
p3.curveTo(52.8297, 37.8777, 46.4899, 36.0174, 42.1557, 38.8570);
|
||||
p3.closePath();
|
||||
p3.moveTo(8.5710, 44.0484);
|
||||
p3.curveTo(13.2819, 42.7856, 10.1614, 63.5377, 6.3284, 61.8350);
|
||||
p3.curveTo(2.1120, 58.4438, 0.7540, 48.5122, 8.5710, 44.0484);
|
||||
p3.closePath();
|
||||
|
||||
Path2D.Double p4 = new Path2D.Double(Path2D.WIND_NON_ZERO);
|
||||
p4.moveTo(63.0123, 43.7896);
|
||||
p4.curveTo(58.3009, 42.5272, 61.4219, 63.2802, 65.2549, 61.5775);
|
||||
p4.curveTo(69.4712, 58.1859, 70.8292, 48.2535, 63.0123, 43.7896);
|
||||
p4.closePath();
|
||||
p4.moveTo(47.0060, 28.3359);
|
||||
p4.curveTo(55.1360, 26.9631, 61.9009, 31.7933, 61.6279, 40.6091);
|
||||
p4.curveTo(61.3605, 43.9888, 44.0109, 28.8391, 47.0061, 28.3359);
|
||||
p4.closePath();
|
||||
p4.moveTo(24.5436, 28.0771);
|
||||
p4.curveTo(16.4130, 26.7043, 9.6488, 31.5356, 9.9218, 40.3506);
|
||||
p4.curveTo(10.1892, 43.7301, 27.5388, 28.5804, 24.5436, 28.0771);
|
||||
p4.closePath();
|
||||
p4.moveTo(36.2218, 26.0212);
|
||||
p4.curveTo(31.3695, 25.8950, 26.7127, 29.6225, 26.7014, 31.7845);
|
||||
p4.curveTo(26.6879, 34.4115, 30.5378, 37.1013, 36.2548, 37.1695);
|
||||
p4.curveTo(42.0931, 37.2113, 45.8185, 35.0165, 45.8372, 32.3055);
|
||||
p4.curveTo(45.8585, 29.2338, 40.5274, 25.9737, 36.2217, 26.0211);
|
||||
p4.closePath();
|
||||
p4.moveTo(36.5181, 79.8920);
|
||||
p4.curveTo(40.7486, 79.7073, 46.4253, 81.2546, 46.4364, 83.3072);
|
||||
p4.curveTo(46.5066, 85.3003, 41.2882, 89.8037, 36.2375, 89.7166);
|
||||
p4.curveTo(31.0069, 89.9423, 25.8778, 85.4319, 25.9449, 83.8686);
|
||||
p4.curveTo(25.8666, 81.5764, 32.3140, 79.7867, 36.5181, 79.8919);
|
||||
p4.closePath();
|
||||
p4.moveTo(20.8923, 67.7271);
|
||||
p4.curveTo(23.9043, 71.3559, 25.2773, 77.7311, 22.7637, 79.6104);
|
||||
p4.curveTo(20.3857, 81.0450, 14.6109, 80.4542, 10.5063, 74.5576);
|
||||
p4.curveTo(7.7381, 69.6096, 8.0949, 64.5746, 10.0385, 63.0956);
|
||||
p4.curveTo(12.9450, 61.3250, 17.4358, 63.7165, 20.8925, 67.7271);
|
||||
p4.closePath();
|
||||
p4.moveTo(51.5410, 66.5770);
|
||||
p4.curveTo(48.2822, 70.3940, 46.4676, 77.3560, 48.8449, 79.5982);
|
||||
p4.curveTo(51.1179, 81.3402, 57.2199, 81.0967, 61.7272, 74.8425);
|
||||
p4.curveTo(65.0002, 70.6421, 63.9035, 63.6272, 62.0340, 61.7643);
|
||||
p4.curveTo(59.2569, 59.6163, 55.2701, 62.3653, 51.5410, 66.5759);
|
||||
p4.closePath();
|
||||
|
||||
Area area = new Area(p0);
|
||||
area.subtract(new Area(p1));
|
||||
area.subtract(new Area(p2));
|
||||
area.subtract(new Area(p3));
|
||||
area.subtract(new Area(p4));
|
||||
|
||||
return area;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw the Raspberry Pi logo in white using vector paths.
|
||||
* Native bounding box is 72.51 x 92.60 px.
|
||||
*
|
||||
* @param g2d Graphics2D context
|
||||
* @param x Top-left X coordinate
|
||||
* @param y Top-left Y coordinate
|
||||
* @param size Target height in pixels
|
||||
*/
|
||||
public static void drawRaspberryPiLogo(Graphics2D g2d, double x, double y, double size) {
|
||||
AffineTransform oldTx = g2d.getTransform();
|
||||
g2d.translate(x, y);
|
||||
double scale = size / 92.604;
|
||||
g2d.scale(scale, scale);
|
||||
|
||||
g2d.setColor(Color.WHITE);
|
||||
g2d.fill(RASPBERRY_PI_LOGO_AREA);
|
||||
g2d.setTransform(oldTx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw a complete PCB terminal block (green body + inner compartment lines + screw lugs)
|
||||
* that matches the visuals of the PCBTerminalBlock component.
|
||||
@@ -970,212 +625,6 @@ public abstract class AbstractMakerBoard extends AbstractTransparentComponent<Vo
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw a mounting hole.
|
||||
*/
|
||||
protected void drawMountingHole(Graphics2D g2d, double cx, double cy, double diameter) {
|
||||
g2d.setColor(Constants.CANVAS_COLOR);
|
||||
g2d.fill(new Ellipse2D.Double(cx - diameter / 2.0, cy - diameter / 2.0, diameter, diameter));
|
||||
g2d.setColor(Color.DARK_GRAY);
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
g2d.draw(new Ellipse2D.Double(cx - diameter / 2.0, cy - diameter / 2.0, diameter, diameter));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw an IC chip on the board.
|
||||
*/
|
||||
protected void drawChip(Graphics2D g2d, double x, double y, double w, double h, String label) {
|
||||
g2d.setColor(IC_BODY_COLOR);
|
||||
g2d.fill(new RoundRectangle2D.Double(x, y, w, h, 4, 4));
|
||||
g2d.setColor(IC_BORDER_COLOR);
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
g2d.draw(new RoundRectangle2D.Double(x, y, w, h, 4, 4));
|
||||
|
||||
// pin 1 dot
|
||||
g2d.setColor(PIN_MARKER_COLOR);
|
||||
g2d.fill(new Ellipse2D.Double(x + 3, y + 3, 3, 3));
|
||||
|
||||
if (label != null && !label.isEmpty() && w > 20 && h > 10) {
|
||||
g2d.setColor(IC_TEXT_COLOR);
|
||||
g2d.setFont(SILK_FONT_SMALL);
|
||||
StringUtils.drawCenteredText(g2d, label, x + w / 2.0, y + h / 2.0, HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw an FPC / ribbon cable connector (e.g. MIPI CSI/DSI, PCIe FPC).
|
||||
*/
|
||||
protected void drawFpcConnector(Graphics2D g2d, double x, double y, double w, double h, boolean vertical, String label) {
|
||||
g2d.setColor(IC_BODY_COLOR);
|
||||
g2d.fill(new RoundRectangle2D.Double(x, y, w, h, 2, 2));
|
||||
g2d.setColor(IC_BORDER_COLOR);
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
g2d.draw(new RoundRectangle2D.Double(x, y, w, h, 2, 2));
|
||||
|
||||
// Inner slot / latch bar
|
||||
g2d.setColor(HEADER_BODY_COLOR.darker());
|
||||
if (vertical) {
|
||||
double slotW = Math.max(1.5, w * 0.35);
|
||||
double slotH = Math.max(2.0, h - 4);
|
||||
g2d.fill(new Rectangle2D.Double(x + (w - slotW) / 2.0, y + 2, slotW, slotH));
|
||||
} else {
|
||||
double slotW = Math.max(2.0, w - 4);
|
||||
double slotH = Math.max(1.5, h * 0.35);
|
||||
g2d.fill(new Rectangle2D.Double(x + 2, y + (h - slotH) / 2.0, slotW, slotH));
|
||||
}
|
||||
|
||||
if (label != null && !label.isEmpty()) {
|
||||
g2d.setColor(Color.WHITE);
|
||||
g2d.setFont(SILK_FONT_SMALL);
|
||||
if (w >= 20 && h >= 10) {
|
||||
StringUtils.drawCenteredText(g2d, label, x + w / 2.0, y + h / 2.0, HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw a standard Micro-USB connector.
|
||||
*/
|
||||
protected void drawMicroUsb(Graphics2D g2d, double x, double y, double w, double h, String label) {
|
||||
drawMetalConnector(g2d, x, y, w, h, label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw a standard USB Type-C connector.
|
||||
*/
|
||||
protected void drawUsbC(Graphics2D g2d, double x, double y, double w, double h, String label) {
|
||||
drawMetalConnector(g2d, x, y, w, h, label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw a standard USB Type-A connector.
|
||||
*/
|
||||
protected void drawUsbA(Graphics2D g2d, double x, double y, double w, double h, String label) {
|
||||
drawMetalConnector(g2d, x, y, w, h, label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw a standard USB Type-B connector.
|
||||
*/
|
||||
protected void drawUsbB(Graphics2D g2d, double x, double y, double w, double h, String label) {
|
||||
drawMetalConnector(g2d, x, y, w, h, label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw a standard Mini-USB connector.
|
||||
*/
|
||||
protected void drawMiniUsb(Graphics2D g2d, double x, double y, double w, double h, String label) {
|
||||
drawMetalConnector(g2d, x, y, w, h, label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw any standardized USB port type.
|
||||
*/
|
||||
protected void drawUsbPort(Graphics2D g2d, double x, double y, double w, double h, UsbPortType type, String label) {
|
||||
drawMetalConnector(g2d, x, y, w, h, label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw a metal connector / shield (e.g. RF shield cans, SD card slots, HDMI).
|
||||
*/
|
||||
protected void drawMetalConnector(Graphics2D g2d, double x, double y, double w, double h, String label) {
|
||||
g2d.setColor(USB_METAL_COLOR);
|
||||
g2d.fill(new RoundRectangle2D.Double(x, y, w, h, 3, 3));
|
||||
g2d.setColor(METAL_SHIELD_BORDER);
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
g2d.draw(new RoundRectangle2D.Double(x, y, w, h, 3, 3));
|
||||
if (label != null && !label.isEmpty()) {
|
||||
g2d.setColor(METAL_LABEL_COLOR);
|
||||
g2d.setFont(SILK_FONT_SMALL);
|
||||
StringUtils.drawCenteredText(g2d, label, x + w / 2.0, y + h / 2.0, HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw a standard ESP-style PCB meander antenna with a dark (#1E1E1E) substrate rectangle underneath.
|
||||
*
|
||||
* @param g2d Graphics2D context
|
||||
* @param x top-left X coordinate of the antenna substrate rectangle
|
||||
* @param y top-left Y coordinate of the antenna substrate rectangle
|
||||
* @param width width of the antenna substrate rectangle (e.g. 15.0mm, matching main chip width)
|
||||
* @param height height of the antenna substrate rectangle (e.g. 7.0mm)
|
||||
*/
|
||||
protected void drawPcbAntenna(Graphics2D g2d, double x, double y, double width, double height) {
|
||||
// Dark rectangle underneath (#1E1E1E)
|
||||
g2d.setColor(ANTENNA_BG_COLOR);
|
||||
g2d.fill(new Rectangle2D.Double(x, y, width, height));
|
||||
|
||||
// Serpentine antenna trace (gold/copper)
|
||||
g2d.setColor(ANTENNA_COLOR);
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1.5f));
|
||||
Path2D.Double antPath = new Path2D.Double();
|
||||
|
||||
if (width >= height) {
|
||||
double antPadX = x + new Size(1.5d, SizeUnit.mm).convertToPixels();
|
||||
double antPadW = width - new Size(3.0d, SizeUnit.mm).convertToPixels();
|
||||
double traceH = new Size(4.1d, SizeUnit.mm).convertToPixels();
|
||||
double marginY = height > traceH ? (height - traceH) / 2.0 : height * 0.15;
|
||||
double antTopY = y + marginY;
|
||||
double antMidY = y + height - marginY;
|
||||
antPath.moveTo(antPadX, antMidY);
|
||||
antPath.lineTo(antPadX, antTopY);
|
||||
antPath.lineTo(antPadX + antPadW * 0.25, antTopY);
|
||||
antPath.lineTo(antPadX + antPadW * 0.25, antMidY);
|
||||
antPath.lineTo(antPadX + antPadW * 0.50, antMidY);
|
||||
antPath.lineTo(antPadX + antPadW * 0.50, antTopY);
|
||||
antPath.lineTo(antPadX + antPadW * 0.75, antTopY);
|
||||
antPath.lineTo(antPadX + antPadW * 0.75, antMidY);
|
||||
antPath.lineTo(antPadX + antPadW, antMidY);
|
||||
antPath.lineTo(antPadX + antPadW, antTopY);
|
||||
} else {
|
||||
double antPadY = y + new Size(1.5d, SizeUnit.mm).convertToPixels();
|
||||
double antPadH = height - new Size(3.0d, SizeUnit.mm).convertToPixels();
|
||||
double traceW = new Size(4.1d, SizeUnit.mm).convertToPixels();
|
||||
double marginX = width > traceW ? (width - traceW) / 2.0 : width * 0.15;
|
||||
double antLeftX = x + marginX;
|
||||
double antRightX = x + width - marginX;
|
||||
antPath.moveTo(antRightX, antPadY);
|
||||
antPath.lineTo(antLeftX, antPadY);
|
||||
antPath.lineTo(antLeftX, antPadY + antPadH * 0.25);
|
||||
antPath.lineTo(antRightX, antPadY + antPadH * 0.25);
|
||||
antPath.lineTo(antRightX, antPadY + antPadH * 0.50);
|
||||
antPath.lineTo(antLeftX, antPadY + antPadH * 0.50);
|
||||
antPath.lineTo(antLeftX, antPadY + antPadH * 0.75);
|
||||
antPath.lineTo(antRightX, antPadY + antPadH * 0.75);
|
||||
antPath.lineTo(antRightX, antPadY + antPadH);
|
||||
antPath.lineTo(antLeftX, antPadY + antPadH);
|
||||
}
|
||||
g2d.draw(antPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw a standard ESP-style PCB meander antenna using default 15.0mm x 7.0mm dimensions.
|
||||
*/
|
||||
protected void drawPcbAntenna(Graphics2D g2d, double x, double y) {
|
||||
drawPcbAntenna(g2d, x, y, ANTENNA_WIDTH.convertToPixels(), ANTENNA_LENGTH.convertToPixels());
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw a standard SMD tactile push button (housing + circular actuator).
|
||||
*
|
||||
* @param g2d Graphics2D context
|
||||
* @param x Top-left X coordinate of the button body
|
||||
* @param y Top-left Y coordinate of the button body
|
||||
* @param w Width of the button body
|
||||
* @param h Height of the button body
|
||||
*/
|
||||
protected void drawButton(Graphics2D g2d, double x, double y, double w, double h) {
|
||||
g2d.setColor(BUTTON_BODY_COLOR);
|
||||
g2d.fill(new RoundRectangle2D.Double(x, y, w, h, 2, 2));
|
||||
g2d.setColor(BUTTON_BORDER_COLOR);
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
g2d.draw(new RoundRectangle2D.Double(x, y, w, h, 2, 2));
|
||||
|
||||
double actuatorD = Math.min(w, h) * 0.55;
|
||||
g2d.setColor(BUTTON_ACTUATOR_COLOR);
|
||||
g2d.fill(new Ellipse2D.Double(x + (w - actuatorD) / 2.0, y + (h - actuatorD) / 2.0, actuatorD, actuatorD));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to get outline border color.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,374 @@
|
||||
/*
|
||||
*
|
||||
* DIY Layout Creator (DIYLC).
|
||||
* Copyright (c) 2009-2025 held jointly by the individual authors.
|
||||
*
|
||||
* This file is part of DIYLC.
|
||||
*
|
||||
* DIYLC is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DIYLC is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package org.diylc.components;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Area;
|
||||
import java.awt.geom.Path2D;
|
||||
|
||||
/**
|
||||
* Vector artwork for the manufacturer logos silkscreened onto maker boards. The paths are traced
|
||||
* from the official brand marks and are drawn in white, the way the boards themselves print them.
|
||||
*
|
||||
* @author Branislav Stojkovic
|
||||
*/
|
||||
public class MakerBoardLogos {
|
||||
|
||||
private static final Area RASPBERRY_PI_LOGO_AREA = createRaspberryPiLogoArea();
|
||||
|
||||
private MakerBoardLogos() {}
|
||||
|
||||
/**
|
||||
* Helper to draw the official Arduino infinity logo (white infinity symbol with '-' and '+').
|
||||
* Default bounding box size is 95.56 x 45.33 px.
|
||||
*
|
||||
* @param g2d Graphics2D context
|
||||
* @param x Top-left X coordinate of the logo bounding box
|
||||
* @param y Top-left Y coordinate of the logo bounding box
|
||||
*/
|
||||
public static void drawArduinoLogo(Graphics2D g2d, double x, double y) {
|
||||
drawArduinoLogo(g2d, x, y, 1.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw the official Arduino infinity logo with custom scaling.
|
||||
*
|
||||
* @param g2d Graphics2D context
|
||||
* @param x Top-left X coordinate of the logo bounding box
|
||||
* @param y Top-left Y coordinate of the logo bounding box
|
||||
* @param scale Scale factor (1.0 = 95.56 x 45.33 px)
|
||||
*/
|
||||
public static void drawArduinoLogo(Graphics2D g2d, double x, double y, double scale) {
|
||||
AffineTransform oldTx = g2d.getTransform();
|
||||
g2d.translate(x, y);
|
||||
if (scale != 1.0) {
|
||||
g2d.scale(scale, scale);
|
||||
}
|
||||
|
||||
Path2D.Double infinityBody = new Path2D.Double(Path2D.WIND_EVEN_ODD);
|
||||
// Outer loop
|
||||
infinityBody.moveTo(47.56, 14.67);
|
||||
infinityBody.curveTo(50.00, 12.00, 51.78, 9.78, 54.00, 7.78);
|
||||
infinityBody.curveTo(62.22, 0.44, 71.56, -2.44, 82.22, 2.22);
|
||||
infinityBody.curveTo(92.22, 6.44, 97.78, 16.89, 95.56, 27.56);
|
||||
infinityBody.curveTo(93.56, 37.33, 84.00, 44.89, 73.78, 45.33);
|
||||
infinityBody.curveTo(64.22, 45.56, 56.89, 41.33, 50.89, 34.44);
|
||||
infinityBody.curveTo(50.00, 33.33, 49.11, 32.22, 48.00, 30.89);
|
||||
infinityBody.curveTo(47.11, 31.78, 46.44, 32.67, 46.00, 33.33);
|
||||
infinityBody.curveTo(39.56, 41.33, 31.56, 46.00, 20.89, 45.33);
|
||||
infinityBody.curveTo(10.44, 44.67, 0.67, 34.89, 0.00, 24.44);
|
||||
infinityBody.curveTo(-0.89, 11.11, 9.33, 0.22, 23.33, 0.00);
|
||||
infinityBody.curveTo(32.67, 0.00, 40.00, 4.67, 45.78, 12.00);
|
||||
infinityBody.curveTo(46.44, 12.89, 47.11, 13.56, 47.78, 14.67);
|
||||
infinityBody.closePath();
|
||||
|
||||
// Left hole cutout
|
||||
infinityBody.moveTo(24.44, 7.56);
|
||||
infinityBody.curveTo(14.67, 7.56, 7.56, 13.78, 6.89, 21.78);
|
||||
infinityBody.curveTo(6.22, 28.89, 11.78, 36.00, 19.56, 37.78);
|
||||
infinityBody.curveTo(27.33, 39.33, 33.33, 36.22, 38.00, 30.67);
|
||||
infinityBody.curveTo(45.11, 22.22, 44.89, 23.56, 38.00, 15.11);
|
||||
infinityBody.curveTo(34.22, 10.44, 29.11, 7.78, 24.22, 7.56);
|
||||
infinityBody.closePath();
|
||||
|
||||
// Right hole cutout
|
||||
infinityBody.moveTo(72.67, 7.33);
|
||||
infinityBody.curveTo(71.56, 7.33, 70.67, 7.33, 69.78, 7.33);
|
||||
infinityBody.curveTo(61.56, 8.89, 56.44, 14.44, 52.44, 21.56);
|
||||
infinityBody.curveTo(52.22, 22.00, 52.22, 23.11, 52.44, 23.56);
|
||||
infinityBody.curveTo(56.00, 29.56, 60.22, 34.89, 67.33, 37.11);
|
||||
infinityBody.curveTo(74.00, 39.33, 80.00, 37.56, 84.67, 32.22);
|
||||
infinityBody.curveTo(88.89, 27.56, 89.78, 22.00, 87.11, 16.44);
|
||||
infinityBody.curveTo(84.22, 10.44, 78.89, 7.78, 72.67, 7.33);
|
||||
infinityBody.lineTo(72.67, 7.33);
|
||||
infinityBody.closePath();
|
||||
|
||||
g2d.setColor(Color.WHITE);
|
||||
g2d.fill(infinityBody);
|
||||
|
||||
// Minus sign in left loop
|
||||
Path2D.Double minus = new Path2D.Double();
|
||||
minus.moveTo(31.33, 24.44);
|
||||
minus.curveTo(31.33, 24.44, 31.33, 24.89, 30.89, 24.89);
|
||||
minus.lineTo(16.44, 24.89);
|
||||
minus.curveTo(16.44, 24.89, 16.00, 24.89, 16.00, 24.44);
|
||||
minus.lineTo(16.00, 20.00);
|
||||
minus.curveTo(16.00, 20.00, 16.00, 19.56, 16.44, 19.56);
|
||||
minus.lineTo(30.89, 19.56);
|
||||
minus.curveTo(30.89, 19.56, 31.33, 19.56, 31.33, 20.00);
|
||||
minus.lineTo(31.33, 24.44);
|
||||
minus.closePath();
|
||||
g2d.fill(minus);
|
||||
|
||||
// Plus sign in right loop
|
||||
Path2D.Double plus = new Path2D.Double();
|
||||
plus.moveTo(78.89, 20.22);
|
||||
plus.curveTo(78.89, 20.22, 78.89, 19.78, 78.44, 19.78);
|
||||
plus.lineTo(74.22, 19.78);
|
||||
plus.curveTo(74.22, 19.78, 73.78, 19.78, 73.78, 19.33);
|
||||
plus.lineTo(73.78, 15.11);
|
||||
plus.curveTo(73.78, 15.11, 73.78, 14.67, 73.33, 14.67);
|
||||
plus.lineTo(68.89, 14.67);
|
||||
plus.curveTo(68.89, 14.67, 68.44, 14.67, 68.44, 15.11);
|
||||
plus.lineTo(68.44, 19.33);
|
||||
plus.curveTo(68.44, 19.33, 68.44, 19.78, 68.00, 19.78);
|
||||
plus.lineTo(63.78, 19.78);
|
||||
plus.curveTo(63.78, 19.78, 63.33, 19.78, 63.33, 20.22);
|
||||
plus.lineTo(63.33, 24.67);
|
||||
plus.curveTo(63.33, 24.67, 63.33, 25.11, 63.78, 25.11);
|
||||
plus.lineTo(68.00, 25.11);
|
||||
plus.curveTo(68.00, 25.11, 68.44, 25.11, 68.44, 25.56);
|
||||
plus.lineTo(68.44, 29.78);
|
||||
plus.curveTo(68.44, 29.78, 68.44, 30.22, 68.89, 30.22);
|
||||
plus.lineTo(73.33, 30.22);
|
||||
plus.curveTo(73.33, 30.22, 73.78, 30.22, 73.78, 29.78);
|
||||
plus.lineTo(73.78, 25.56);
|
||||
plus.curveTo(73.78, 25.56, 73.78, 25.11, 74.22, 25.11);
|
||||
plus.lineTo(78.44, 25.11);
|
||||
plus.curveTo(78.44, 25.11, 78.89, 25.11, 78.89, 24.67);
|
||||
plus.lineTo(78.89, 20.22);
|
||||
plus.closePath();
|
||||
g2d.fill(plus);
|
||||
|
||||
g2d.setTransform(oldTx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw the Raspberry Pi logo in white using vector paths.
|
||||
* Native bounding box is 72.51 x 92.60 px.
|
||||
*
|
||||
* @param g2d Graphics2D context
|
||||
* @param x Top-left X coordinate
|
||||
* @param y Top-left Y coordinate
|
||||
* @param size Target height in pixels
|
||||
*/
|
||||
public static void drawRaspberryPiLogo(Graphics2D g2d, double x, double y, double size) {
|
||||
AffineTransform oldTx = g2d.getTransform();
|
||||
g2d.translate(x, y);
|
||||
double scale = size / 92.604;
|
||||
g2d.scale(scale, scale);
|
||||
|
||||
g2d.setColor(Color.WHITE);
|
||||
g2d.fill(RASPBERRY_PI_LOGO_AREA);
|
||||
g2d.setTransform(oldTx);
|
||||
}
|
||||
|
||||
private static Area createRaspberryPiLogoArea() {
|
||||
Path2D.Double p0 = new Path2D.Double(Path2D.WIND_NON_ZERO);
|
||||
p0.moveTo(19.6295, 0.0014);
|
||||
p0.curveTo(19.1612, 0.0159, 18.6569, 0.1889, 18.0849, 0.6402);
|
||||
p0.curveTo(16.6837, 0.0999, 15.3251, -0.0878, 14.1102, 1.0122);
|
||||
p0.curveTo(12.2342, 0.7689, 11.6245, 1.2710, 11.1626, 1.8572);
|
||||
p0.curveTo(10.7507, 1.8487, 8.0807, 1.4339, 6.8564, 3.2603);
|
||||
p0.curveTo(3.7794, 2.8963, 2.8070, 5.0701, 3.9089, 7.0973);
|
||||
p0.curveTo(3.2805, 8.0702, 2.6293, 9.0313, 4.0989, 10.8859);
|
||||
p0.curveTo(3.5790, 11.9189, 3.9013, 13.0394, 5.1259, 14.3954);
|
||||
p0.curveTo(4.8027, 15.8475, 5.4379, 16.8720, 6.5775, 17.6704);
|
||||
p0.curveTo(6.3644, 19.6575, 8.3997, 20.8128, 9.0075, 21.2245);
|
||||
p0.curveTo(9.2408, 22.3823, 9.7272, 23.4749, 12.0520, 24.0790);
|
||||
p0.curveTo(12.4354, 25.8045, 13.8326, 26.1024, 15.1856, 26.4646);
|
||||
p0.curveTo(10.7138, 29.0639, 6.8789, 32.4840, 6.9049, 40.8755);
|
||||
p0.lineTo(6.2500, 42.0440);
|
||||
p0.curveTo(1.1224, 45.1622, -3.4908, 55.1843, 3.7230, 63.3304);
|
||||
p0.curveTo(4.1942, 65.8804, 4.9845, 67.7119, 5.6881, 69.7390);
|
||||
p0.curveTo(6.7405, 77.9072, 13.6088, 81.7320, 15.4203, 82.1843);
|
||||
p0.curveTo(18.0749, 84.2063, 20.9021, 86.1249, 24.7280, 87.4689);
|
||||
p0.curveTo(28.3346, 91.1885, 32.2420, 92.6062, 36.1706, 92.6039);
|
||||
p0.curveTo(36.2282, 92.6039, 36.2868, 92.6045, 36.3445, 92.6039);
|
||||
p0.curveTo(40.2731, 92.6063, 44.1803, 91.1887, 47.7870, 87.4689);
|
||||
p0.curveTo(51.6128, 86.1249, 54.4401, 84.2063, 57.0947, 82.1843);
|
||||
p0.curveTo(58.9062, 81.7319, 65.7745, 77.9072, 66.8269, 69.7390);
|
||||
p0.curveTo(67.5305, 67.7119, 68.3208, 65.8803, 68.7920, 63.3304);
|
||||
p0.curveTo(76.0057, 55.1837, 71.3926, 45.1609, 66.2650, 42.0427);
|
||||
p0.lineTo(65.6090, 40.8744);
|
||||
p0.curveTo(65.6350, 32.4834, 61.8002, 29.0634, 57.3284, 26.4634);
|
||||
p0.curveTo(58.6814, 26.1014, 60.0786, 25.8034, 60.4619, 24.0779);
|
||||
p0.curveTo(62.7867, 23.4737, 63.2732, 22.3811, 63.5065, 21.2234);
|
||||
p0.curveTo(64.1143, 20.8118, 66.1495, 19.6564, 65.9365, 17.6693);
|
||||
p0.curveTo(67.0759, 16.8708, 67.7113, 15.8463, 67.3880, 14.3943);
|
||||
p0.curveTo(68.6127, 13.0383, 68.9350, 11.9177, 68.4150, 10.8847);
|
||||
p0.curveTo(69.8849, 9.0309, 69.2328, 8.0698, 68.6052, 7.0970);
|
||||
p0.curveTo(69.7063, 5.0698, 68.7346, 2.8959, 65.6566, 3.2600);
|
||||
p0.curveTo(64.4326, 1.4335, 61.7634, 1.8484, 61.3506, 1.8569);
|
||||
p0.curveTo(60.8887, 1.2707, 60.2793, 0.7685, 58.4032, 1.0119);
|
||||
p0.curveTo(57.1883, -0.0882, 55.8298, 0.0995, 54.4285, 0.6399);
|
||||
p0.curveTo(52.7646, -0.6731, 51.6635, 0.3794, 50.4059, 0.7773);
|
||||
p0.curveTo(48.3914, 0.1191, 47.9309, 1.0207, 46.9410, 1.3879);
|
||||
p0.curveTo(44.7440, 0.9236, 44.0764, 1.9344, 43.0232, 3.0012);
|
||||
p0.lineTo(41.7982, 2.9769);
|
||||
p0.curveTo(38.4844, 4.9297, 36.8382, 8.9061, 36.2548, 10.9503);
|
||||
p0.curveTo(35.6710, 8.9057, 34.0286, 4.9293, 30.7155, 2.9769);
|
||||
p0.lineTo(29.4904, 3.0012);
|
||||
p0.curveTo(28.4359, 1.9344, 27.7683, 0.9236, 25.5714, 1.3879);
|
||||
p0.curveTo(24.5815, 1.0207, 24.1222, 0.1191, 22.1064, 0.7773);
|
||||
p0.curveTo(21.2810, 0.5162, 20.5218, -0.0267, 19.6279, 0.0010);
|
||||
p0.closePath();
|
||||
|
||||
Path2D.Double p1 = new Path2D.Double(Path2D.WIND_NON_ZERO);
|
||||
p1.moveTo(13.0322, 8.5925);
|
||||
p1.curveTo(21.8236, 13.1250, 26.9346, 16.7915, 29.7345, 19.9142);
|
||||
p1.curveTo(28.3006, 25.6612, 20.8204, 25.9235, 18.0852, 25.7623);
|
||||
p1.curveTo(18.6452, 25.5016, 19.1125, 25.1894, 19.2782, 24.7097);
|
||||
p1.curveTo(18.5919, 24.2219, 16.1583, 24.6583, 14.4594, 23.7037);
|
||||
p1.curveTo(15.1120, 23.5686, 15.4173, 23.4369, 15.7225, 22.9552);
|
||||
p1.curveTo(14.1174, 22.4433, 12.3885, 22.0022, 11.3715, 21.1541);
|
||||
p1.curveTo(11.9203, 21.1609, 12.4327, 21.2768, 13.1493, 20.7798);
|
||||
p1.curveTo(11.7116, 20.0050, 10.1775, 19.3910, 8.9856, 18.2068);
|
||||
p1.curveTo(9.7289, 18.1885, 10.5303, 18.1994, 10.7633, 17.9260);
|
||||
p1.curveTo(9.4475, 17.1108, 8.3373, 16.2042, 7.4183, 15.2126);
|
||||
p1.curveTo(8.4585, 15.3381, 8.8977, 15.2300, 9.1493, 15.0488);
|
||||
p1.curveTo(8.1546, 14.0300, 6.8956, 13.1698, 6.2954, 11.9143);
|
||||
p1.curveTo(7.0678, 12.1805, 7.7744, 12.2825, 8.2838, 11.8909);
|
||||
p1.curveTo(7.9458, 11.1284, 6.4976, 10.6787, 5.6638, 8.8967);
|
||||
p1.curveTo(6.4770, 8.9756, 7.3394, 9.0741, 7.5119, 8.8967);
|
||||
p1.curveTo(7.1345, 7.3591, 6.4869, 6.4947, 5.8518, 5.5991);
|
||||
p1.curveTo(7.5920, 5.5732, 10.2286, 5.6058, 10.1092, 5.4587);
|
||||
p1.lineTo(9.0332, 4.3593);
|
||||
p1.curveTo(10.7330, 3.9016, 12.4723, 4.4328, 13.7350, 4.8271);
|
||||
p1.curveTo(14.3020, 4.3797, 13.7250, 3.8141, 13.0332, 3.2365);
|
||||
p1.curveTo(14.4778, 3.4293, 15.7832, 3.7615, 16.9630, 4.2189);
|
||||
p1.curveTo(17.5935, 3.6497, 16.5537, 3.0805, 16.0507, 2.5113);
|
||||
p1.curveTo(18.2825, 2.9347, 19.2281, 3.5297, 20.1677, 4.1253);
|
||||
p1.curveTo(20.8496, 3.4719, 20.2068, 2.9165, 19.7467, 2.3476);
|
||||
p1.curveTo(21.4295, 2.9709, 22.2962, 3.7756, 23.2088, 4.5698);
|
||||
p1.curveTo(23.5182, 4.1523, 23.9948, 3.8463, 23.4193, 2.8388);
|
||||
p1.curveTo(24.6141, 3.5275, 25.5139, 4.3390, 26.1796, 5.2482);
|
||||
p1.curveTo(26.9189, 4.7775, 26.6200, 4.1338, 26.6241, 3.5406);
|
||||
p1.curveTo(27.8657, 4.5506, 28.6537, 5.6255, 29.6183, 6.6751);
|
||||
p1.curveTo(29.8126, 6.5336, 29.9827, 6.0538, 30.1329, 5.2949);
|
||||
p1.curveTo(33.0952, 8.1688, 37.2809, 15.4074, 31.2089, 18.2774);
|
||||
p1.curveTo(26.0413, 14.0154, 19.8697, 10.9176, 13.0304, 8.5937);
|
||||
p1.closePath();
|
||||
p1.moveTo(59.6793, 8.5925);
|
||||
p1.curveTo(50.8889, 13.1254, 45.7783, 16.7909, 42.9783, 19.9142);
|
||||
p1.curveTo(44.4122, 25.6612, 51.8924, 25.9235, 54.6276, 25.7623);
|
||||
p1.curveTo(54.0676, 25.5016, 53.6003, 25.1894, 53.4346, 24.7097);
|
||||
p1.curveTo(54.1210, 24.2219, 56.5545, 24.6583, 58.2535, 23.7037);
|
||||
p1.curveTo(57.6008, 23.5686, 57.2955, 23.4369, 56.9903, 22.9552);
|
||||
p1.curveTo(58.5954, 22.4433, 60.3244, 22.0022, 61.3413, 21.1541);
|
||||
p1.curveTo(60.7925, 21.1609, 60.2801, 21.2768, 59.5635, 20.7798);
|
||||
p1.curveTo(61.0012, 20.0050, 62.5353, 19.3910, 63.7272, 18.2068);
|
||||
p1.curveTo(62.9839, 18.1885, 62.1825, 18.1994, 61.9495, 17.9260);
|
||||
p1.curveTo(63.2653, 17.1108, 64.3755, 16.2042, 65.2946, 15.2126);
|
||||
p1.curveTo(64.2543, 15.3381, 63.8151, 15.2300, 63.5636, 15.0488);
|
||||
p1.curveTo(64.5582, 14.0300, 65.8172, 13.1698, 66.4174, 11.9143);
|
||||
p1.curveTo(65.6450, 12.1805, 64.9384, 12.2825, 64.4290, 11.8909);
|
||||
p1.curveTo(64.7670, 11.1284, 66.2152, 10.6787, 67.0490, 8.8967);
|
||||
p1.curveTo(66.2358, 8.9756, 65.3734, 9.0741, 65.2010, 8.8967);
|
||||
p1.curveTo(65.5790, 7.3585, 66.2266, 6.4940, 66.8617, 5.5984);
|
||||
p1.curveTo(65.1215, 5.5726, 62.4849, 5.6052, 62.6043, 5.4581);
|
||||
p1.lineTo(63.6803, 4.3587);
|
||||
p1.curveTo(61.9805, 3.9010, 60.2411, 4.4322, 58.9785, 4.8265);
|
||||
p1.curveTo(58.4115, 4.3791, 58.9885, 3.8135, 59.6802, 3.2358);
|
||||
p1.curveTo(58.2357, 3.4287, 56.9302, 3.7608, 55.7504, 4.2183);
|
||||
p1.curveTo(55.1200, 3.6491, 56.1598, 3.0799, 56.6627, 2.5107);
|
||||
p1.curveTo(54.4310, 2.9341, 53.4854, 3.5290, 52.5457, 4.1247);
|
||||
p1.curveTo(51.8639, 3.4713, 52.5067, 2.9159, 52.9667, 2.3470);
|
||||
p1.curveTo(51.2840, 2.9703, 50.4172, 3.7750, 49.5047, 4.5692);
|
||||
p1.curveTo(49.1953, 4.1517, 48.7187, 3.8456, 49.2941, 2.8382);
|
||||
p1.curveTo(48.0994, 3.5268, 47.1995, 4.3384, 46.5338, 5.2476);
|
||||
p1.curveTo(45.7946, 4.7769, 46.0934, 4.1332, 46.0894, 3.5399);
|
||||
p1.curveTo(44.8477, 4.5499, 44.0597, 5.6249, 43.0952, 6.6744);
|
||||
p1.curveTo(42.9009, 6.5330, 42.7307, 6.0532, 42.5805, 5.2943);
|
||||
p1.curveTo(39.6183, 8.1682, 35.4325, 15.4067, 41.5045, 18.2768);
|
||||
p1.curveTo(46.6695, 14.0139, 52.8407, 10.9163, 59.6805, 8.5924);
|
||||
p1.closePath();
|
||||
|
||||
Path2D.Double p2 = new Path2D.Double(Path2D.WIND_NON_ZERO);
|
||||
p2.moveTo(47.0024, 67.1140);
|
||||
p2.curveTo(47.0188, 70.5889, 45.0112, 73.8170, 41.7504, 75.5588);
|
||||
p2.curveTo(38.4896, 77.3006, 34.4542, 77.3006, 31.1934, 75.5588);
|
||||
p2.curveTo(27.9326, 73.8170, 25.9250, 70.5889, 25.9414, 67.1140);
|
||||
p2.curveTo(25.9250, 63.6391, 27.9326, 60.4110, 31.1934, 58.6692);
|
||||
p2.curveTo(34.4542, 56.9274, 38.4896, 56.9274, 41.7504, 58.6692);
|
||||
p2.curveTo(45.0112, 60.4110, 47.0188, 63.6391, 47.0024, 67.1140);
|
||||
p2.closePath();
|
||||
p2.moveTo(30.3786, 39.3746);
|
||||
p2.curveTo(33.2055, 41.2176, 34.6522, 44.7077, 34.1649, 48.5090);
|
||||
p2.curveTo(33.6776, 52.3102, 31.3275, 55.8665, 28.0144, 57.8164);
|
||||
p2.curveTo(24.7013, 59.7663, 20.9097, 59.8245, 18.0912, 57.9688);
|
||||
p2.curveTo(15.2643, 56.1258, 13.8176, 52.6357, 14.3049, 48.8344);
|
||||
p2.curveTo(14.7922, 45.0332, 17.1423, 41.4769, 20.4554, 39.5270);
|
||||
p2.curveTo(23.7685, 37.5771, 27.5601, 37.5189, 30.3786, 39.3746);
|
||||
p2.closePath();
|
||||
|
||||
Path2D.Double p3 = new Path2D.Double(Path2D.WIND_NON_ZERO);
|
||||
p3.moveTo(42.1557, 38.8570);
|
||||
p3.curveTo(37.8215, 41.6966, 37.0284, 48.2301, 40.3987, 53.3303);
|
||||
p3.curveTo(43.7691, 58.4306, 50.1089, 60.2909, 54.4431, 57.4513);
|
||||
p3.curveTo(58.7773, 54.6117, 59.5704, 48.0782, 56.2001, 42.9780);
|
||||
p3.curveTo(52.8297, 37.8777, 46.4899, 36.0174, 42.1557, 38.8570);
|
||||
p3.closePath();
|
||||
p3.moveTo(8.5710, 44.0484);
|
||||
p3.curveTo(13.2819, 42.7856, 10.1614, 63.5377, 6.3284, 61.8350);
|
||||
p3.curveTo(2.1120, 58.4438, 0.7540, 48.5122, 8.5710, 44.0484);
|
||||
p3.closePath();
|
||||
|
||||
Path2D.Double p4 = new Path2D.Double(Path2D.WIND_NON_ZERO);
|
||||
p4.moveTo(63.0123, 43.7896);
|
||||
p4.curveTo(58.3009, 42.5272, 61.4219, 63.2802, 65.2549, 61.5775);
|
||||
p4.curveTo(69.4712, 58.1859, 70.8292, 48.2535, 63.0123, 43.7896);
|
||||
p4.closePath();
|
||||
p4.moveTo(47.0060, 28.3359);
|
||||
p4.curveTo(55.1360, 26.9631, 61.9009, 31.7933, 61.6279, 40.6091);
|
||||
p4.curveTo(61.3605, 43.9888, 44.0109, 28.8391, 47.0061, 28.3359);
|
||||
p4.closePath();
|
||||
p4.moveTo(24.5436, 28.0771);
|
||||
p4.curveTo(16.4130, 26.7043, 9.6488, 31.5356, 9.9218, 40.3506);
|
||||
p4.curveTo(10.1892, 43.7301, 27.5388, 28.5804, 24.5436, 28.0771);
|
||||
p4.closePath();
|
||||
p4.moveTo(36.2218, 26.0212);
|
||||
p4.curveTo(31.3695, 25.8950, 26.7127, 29.6225, 26.7014, 31.7845);
|
||||
p4.curveTo(26.6879, 34.4115, 30.5378, 37.1013, 36.2548, 37.1695);
|
||||
p4.curveTo(42.0931, 37.2113, 45.8185, 35.0165, 45.8372, 32.3055);
|
||||
p4.curveTo(45.8585, 29.2338, 40.5274, 25.9737, 36.2217, 26.0211);
|
||||
p4.closePath();
|
||||
p4.moveTo(36.5181, 79.8920);
|
||||
p4.curveTo(40.7486, 79.7073, 46.4253, 81.2546, 46.4364, 83.3072);
|
||||
p4.curveTo(46.5066, 85.3003, 41.2882, 89.8037, 36.2375, 89.7166);
|
||||
p4.curveTo(31.0069, 89.9423, 25.8778, 85.4319, 25.9449, 83.8686);
|
||||
p4.curveTo(25.8666, 81.5764, 32.3140, 79.7867, 36.5181, 79.8919);
|
||||
p4.closePath();
|
||||
p4.moveTo(20.8923, 67.7271);
|
||||
p4.curveTo(23.9043, 71.3559, 25.2773, 77.7311, 22.7637, 79.6104);
|
||||
p4.curveTo(20.3857, 81.0450, 14.6109, 80.4542, 10.5063, 74.5576);
|
||||
p4.curveTo(7.7381, 69.6096, 8.0949, 64.5746, 10.0385, 63.0956);
|
||||
p4.curveTo(12.9450, 61.3250, 17.4358, 63.7165, 20.8925, 67.7271);
|
||||
p4.closePath();
|
||||
p4.moveTo(51.5410, 66.5770);
|
||||
p4.curveTo(48.2822, 70.3940, 46.4676, 77.3560, 48.8449, 79.5982);
|
||||
p4.curveTo(51.1179, 81.3402, 57.2199, 81.0967, 61.7272, 74.8425);
|
||||
p4.curveTo(65.0002, 70.6421, 63.9035, 63.6272, 62.0340, 61.7643);
|
||||
p4.curveTo(59.2569, 59.6163, 55.2701, 62.3653, 51.5410, 66.5759);
|
||||
p4.closePath();
|
||||
|
||||
Area area = new Area(p0);
|
||||
area.subtract(new Area(p1));
|
||||
area.subtract(new Area(p2));
|
||||
area.subtract(new Area(p3));
|
||||
area.subtract(new Area(p4));
|
||||
|
||||
return area;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
/*
|
||||
*
|
||||
* DIY Layout Creator (DIYLC).
|
||||
* Copyright (c) 2009-2025 held jointly by the individual authors.
|
||||
*
|
||||
* This file is part of DIYLC.
|
||||
*
|
||||
* DIYLC is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* DIYLC is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package org.diylc.components;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.Ellipse2D;
|
||||
import java.awt.geom.Path2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
|
||||
import org.diylc.awt.StringUtils;
|
||||
import org.diylc.common.HorizontalAlignment;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
/**
|
||||
* Painters for the discrete parts populated onto a maker board -- chips, connectors, antennas,
|
||||
* buttons and mounting holes. They are pure functions of the geometry they are handed, drawn in
|
||||
* whatever coordinate space {@code g2d} is currently in, so a board calls them while its own
|
||||
* rotation is still applied.
|
||||
*
|
||||
* @author Branislav Stojkovic
|
||||
*/
|
||||
public class MakerBoardPainter {
|
||||
|
||||
private MakerBoardPainter() {}
|
||||
|
||||
/**
|
||||
* Helper to draw a mounting hole.
|
||||
*/
|
||||
public static void drawMountingHole(Graphics2D g2d, double cx, double cy, double diameter) {
|
||||
g2d.setColor(Constants.CANVAS_COLOR);
|
||||
g2d.fill(new Ellipse2D.Double(cx - diameter / 2.0, cy - diameter / 2.0, diameter, diameter));
|
||||
g2d.setColor(Color.DARK_GRAY);
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
g2d.draw(new Ellipse2D.Double(cx - diameter / 2.0, cy - diameter / 2.0, diameter, diameter));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw an IC chip on the board.
|
||||
*/
|
||||
public static void drawChip(Graphics2D g2d, double x, double y, double w, double h, String label) {
|
||||
g2d.setColor(AbstractMakerBoard.IC_BODY_COLOR);
|
||||
g2d.fill(new RoundRectangle2D.Double(x, y, w, h, 4, 4));
|
||||
g2d.setColor(AbstractMakerBoard.IC_BORDER_COLOR);
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
g2d.draw(new RoundRectangle2D.Double(x, y, w, h, 4, 4));
|
||||
|
||||
// pin 1 dot
|
||||
g2d.setColor(AbstractMakerBoard.PIN_MARKER_COLOR);
|
||||
g2d.fill(new Ellipse2D.Double(x + 3, y + 3, 3, 3));
|
||||
|
||||
if (label != null && !label.isEmpty() && w > 20 && h > 10) {
|
||||
g2d.setColor(AbstractMakerBoard.IC_TEXT_COLOR);
|
||||
g2d.setFont(AbstractMakerBoard.SILK_FONT_SMALL);
|
||||
StringUtils.drawCenteredText(g2d, label, x + w / 2.0, y + h / 2.0, HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw an FPC / ribbon cable connector (e.g. MIPI CSI/DSI, PCIe FPC).
|
||||
*/
|
||||
public static void drawFpcConnector(Graphics2D g2d, double x, double y, double w, double h, boolean vertical, String label) {
|
||||
g2d.setColor(AbstractMakerBoard.IC_BODY_COLOR);
|
||||
g2d.fill(new RoundRectangle2D.Double(x, y, w, h, 2, 2));
|
||||
g2d.setColor(AbstractMakerBoard.IC_BORDER_COLOR);
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
g2d.draw(new RoundRectangle2D.Double(x, y, w, h, 2, 2));
|
||||
|
||||
// Inner slot / latch bar
|
||||
g2d.setColor(AbstractMakerBoard.HEADER_BODY_COLOR.darker());
|
||||
if (vertical) {
|
||||
double slotW = Math.max(1.5, w * 0.35);
|
||||
double slotH = Math.max(2.0, h - 4);
|
||||
g2d.fill(new Rectangle2D.Double(x + (w - slotW) / 2.0, y + 2, slotW, slotH));
|
||||
} else {
|
||||
double slotW = Math.max(2.0, w - 4);
|
||||
double slotH = Math.max(1.5, h * 0.35);
|
||||
g2d.fill(new Rectangle2D.Double(x + 2, y + (h - slotH) / 2.0, slotW, slotH));
|
||||
}
|
||||
|
||||
if (label != null && !label.isEmpty()) {
|
||||
g2d.setColor(Color.WHITE);
|
||||
g2d.setFont(AbstractMakerBoard.SILK_FONT_SMALL);
|
||||
if (w >= 20 && h >= 10) {
|
||||
StringUtils.drawCenteredText(g2d, label, x + w / 2.0, y + h / 2.0, HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw a standard Micro-USB connector.
|
||||
*/
|
||||
public static void drawMicroUsb(Graphics2D g2d, double x, double y, double w, double h, String label) {
|
||||
drawMetalConnector(g2d, x, y, w, h, label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw a standard USB Type-C connector.
|
||||
*/
|
||||
public static void drawUsbC(Graphics2D g2d, double x, double y, double w, double h, String label) {
|
||||
drawMetalConnector(g2d, x, y, w, h, label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw a standard USB Type-A connector.
|
||||
*/
|
||||
public static void drawUsbA(Graphics2D g2d, double x, double y, double w, double h, String label) {
|
||||
drawMetalConnector(g2d, x, y, w, h, label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw a standard USB Type-B connector.
|
||||
*/
|
||||
public static void drawUsbB(Graphics2D g2d, double x, double y, double w, double h, String label) {
|
||||
drawMetalConnector(g2d, x, y, w, h, label);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw a metal connector / shield (e.g. RF shield cans, SD card slots, HDMI).
|
||||
*/
|
||||
public static void drawMetalConnector(Graphics2D g2d, double x, double y, double w, double h, String label) {
|
||||
g2d.setColor(AbstractMakerBoard.USB_METAL_COLOR);
|
||||
g2d.fill(new RoundRectangle2D.Double(x, y, w, h, 3, 3));
|
||||
g2d.setColor(AbstractMakerBoard.METAL_SHIELD_BORDER);
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
g2d.draw(new RoundRectangle2D.Double(x, y, w, h, 3, 3));
|
||||
if (label != null && !label.isEmpty()) {
|
||||
g2d.setColor(AbstractMakerBoard.METAL_LABEL_COLOR);
|
||||
g2d.setFont(AbstractMakerBoard.SILK_FONT_SMALL);
|
||||
StringUtils.drawCenteredText(g2d, label, x + w / 2.0, y + h / 2.0, HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw a standard ESP-style PCB meander antenna with a dark (#1E1E1E) substrate rectangle underneath.
|
||||
*
|
||||
* @param g2d Graphics2D context
|
||||
* @param x top-left X coordinate of the antenna substrate rectangle
|
||||
* @param y top-left Y coordinate of the antenna substrate rectangle
|
||||
* @param width width of the antenna substrate rectangle (e.g. 15.0mm, matching main chip width)
|
||||
* @param height height of the antenna substrate rectangle (e.g. 7.0mm)
|
||||
*/
|
||||
public static void drawPcbAntenna(Graphics2D g2d, double x, double y, double width, double height) {
|
||||
// Dark rectangle underneath (#1E1E1E)
|
||||
g2d.setColor(AbstractMakerBoard.ANTENNA_BG_COLOR);
|
||||
g2d.fill(new Rectangle2D.Double(x, y, width, height));
|
||||
|
||||
// Serpentine antenna trace (gold/copper)
|
||||
g2d.setColor(AbstractMakerBoard.ANTENNA_COLOR);
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1.5f));
|
||||
Path2D.Double antPath = new Path2D.Double();
|
||||
|
||||
if (width >= height) {
|
||||
double antPadX = x + new Size(1.5d, SizeUnit.mm).convertToPixels();
|
||||
double antPadW = width - new Size(3.0d, SizeUnit.mm).convertToPixels();
|
||||
double traceH = new Size(4.1d, SizeUnit.mm).convertToPixels();
|
||||
double marginY = height > traceH ? (height - traceH) / 2.0 : height * 0.15;
|
||||
double antTopY = y + marginY;
|
||||
double antMidY = y + height - marginY;
|
||||
antPath.moveTo(antPadX, antMidY);
|
||||
antPath.lineTo(antPadX, antTopY);
|
||||
antPath.lineTo(antPadX + antPadW * 0.25, antTopY);
|
||||
antPath.lineTo(antPadX + antPadW * 0.25, antMidY);
|
||||
antPath.lineTo(antPadX + antPadW * 0.50, antMidY);
|
||||
antPath.lineTo(antPadX + antPadW * 0.50, antTopY);
|
||||
antPath.lineTo(antPadX + antPadW * 0.75, antTopY);
|
||||
antPath.lineTo(antPadX + antPadW * 0.75, antMidY);
|
||||
antPath.lineTo(antPadX + antPadW, antMidY);
|
||||
antPath.lineTo(antPadX + antPadW, antTopY);
|
||||
} else {
|
||||
double antPadY = y + new Size(1.5d, SizeUnit.mm).convertToPixels();
|
||||
double antPadH = height - new Size(3.0d, SizeUnit.mm).convertToPixels();
|
||||
double traceW = new Size(4.1d, SizeUnit.mm).convertToPixels();
|
||||
double marginX = width > traceW ? (width - traceW) / 2.0 : width * 0.15;
|
||||
double antLeftX = x + marginX;
|
||||
double antRightX = x + width - marginX;
|
||||
antPath.moveTo(antRightX, antPadY);
|
||||
antPath.lineTo(antLeftX, antPadY);
|
||||
antPath.lineTo(antLeftX, antPadY + antPadH * 0.25);
|
||||
antPath.lineTo(antRightX, antPadY + antPadH * 0.25);
|
||||
antPath.lineTo(antRightX, antPadY + antPadH * 0.50);
|
||||
antPath.lineTo(antLeftX, antPadY + antPadH * 0.50);
|
||||
antPath.lineTo(antLeftX, antPadY + antPadH * 0.75);
|
||||
antPath.lineTo(antRightX, antPadY + antPadH * 0.75);
|
||||
antPath.lineTo(antRightX, antPadY + antPadH);
|
||||
antPath.lineTo(antLeftX, antPadY + antPadH);
|
||||
}
|
||||
g2d.draw(antPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw a standard ESP-style PCB meander antenna using default 15.0mm x 7.0mm dimensions.
|
||||
*/
|
||||
public static void drawPcbAntenna(Graphics2D g2d, double x, double y) {
|
||||
drawPcbAntenna(g2d, x, y, AbstractMakerBoard.ANTENNA_WIDTH.convertToPixels(), AbstractMakerBoard.ANTENNA_LENGTH.convertToPixels());
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to draw a standard SMD tactile push button (housing + circular actuator).
|
||||
*
|
||||
* @param g2d Graphics2D context
|
||||
* @param x Top-left X coordinate of the button body
|
||||
* @param y Top-left Y coordinate of the button body
|
||||
* @param w Width of the button body
|
||||
* @param h Height of the button body
|
||||
*/
|
||||
public static void drawButton(Graphics2D g2d, double x, double y, double w, double h) {
|
||||
g2d.setColor(AbstractMakerBoard.BUTTON_BODY_COLOR);
|
||||
g2d.fill(new RoundRectangle2D.Double(x, y, w, h, 2, 2));
|
||||
g2d.setColor(AbstractMakerBoard.BUTTON_BORDER_COLOR);
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
g2d.draw(new RoundRectangle2D.Double(x, y, w, h, 2, 2));
|
||||
|
||||
double actuatorD = Math.min(w, h) * 0.55;
|
||||
g2d.setColor(AbstractMakerBoard.BUTTON_ACTUATOR_COLOR);
|
||||
g2d.fill(new Ellipse2D.Double(x + (w - actuatorD) / 2.0, y + (h - actuatorD) / 2.0, actuatorD, actuatorD));
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -221,10 +222,10 @@ public class CharacterLCD extends AbstractMakerBoard {
|
||||
|
||||
if (!outlineMode) {
|
||||
// 4 Mounting holes in corners
|
||||
drawMountingHole(g2d, boardX + 20, boardY + 20, 20);
|
||||
drawMountingHole(g2d, boardX + 20, boardY + boardH - 20, 20);
|
||||
drawMountingHole(g2d, boardX + boardW - 20, boardY + 20, 20);
|
||||
drawMountingHole(g2d, boardX + boardW - 20, boardY + boardH - 20, 20);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 20, boardY + 20, 20);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 20, boardY + boardH - 20, 20);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 20, boardY + 20, 20);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 20, boardY + boardH - 20, 20);
|
||||
|
||||
// Metal Bezel around screen
|
||||
double bezelMarginX = (lcdSize == LCDSize._16x2) ? 45 : 40;
|
||||
@@ -257,7 +258,7 @@ public class CharacterLCD extends AbstractMakerBoard {
|
||||
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -196,7 +197,7 @@ public class LEDMatrix8x8 extends AbstractMakerBoard {
|
||||
}
|
||||
|
||||
// MAX7219 IC
|
||||
drawChip(g2d, boardX + 20, matrixY + matrixSize + 15, boardW - 40, 45, "MAX7219");
|
||||
MakerBoardPainter.drawChip(g2d, boardX + 20, matrixY + matrixSize + 15, boardW - 40, 45, "MAX7219");
|
||||
|
||||
// Silkscreen
|
||||
g2d.setColor(Color.WHITE);
|
||||
@@ -207,7 +208,7 @@ public class LEDMatrix8x8 extends AbstractMakerBoard {
|
||||
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -170,10 +171,10 @@ public class OLEDDisplay extends AbstractMakerBoard {
|
||||
|
||||
if (!outlineMode) {
|
||||
// 4 Corner mounting holes
|
||||
drawMountingHole(g2d, boardX + 16, boardY + 16, 16);
|
||||
drawMountingHole(g2d, boardX + 16, boardY + boardSizePx - 16, 16);
|
||||
drawMountingHole(g2d, boardX + boardSizePx - 16, boardY + 16, 16);
|
||||
drawMountingHole(g2d, boardX + boardSizePx - 16, boardY + boardSizePx - 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 16, boardY + 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 16, boardY + boardSizePx - 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardSizePx - 16, boardY + 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardSizePx - 16, boardY + boardSizePx - 16, 16);
|
||||
|
||||
// Glass OLED Panel
|
||||
double glassMarginX = 18;
|
||||
@@ -198,7 +199,7 @@ public class OLEDDisplay extends AbstractMakerBoard {
|
||||
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
+6
-5
@@ -38,6 +38,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -293,10 +294,10 @@ public class SevenSegmentDisplay extends AbstractMakerBoard {
|
||||
|
||||
} else {
|
||||
// TM1637 4-Digit Display Module
|
||||
drawMountingHole(g2d, boardX + 14, boardY + 14, 12);
|
||||
drawMountingHole(g2d, boardX + 14, boardY + boardH - 14, 12);
|
||||
drawMountingHole(g2d, boardX + boardW - 14, boardY + 14, 12);
|
||||
drawMountingHole(g2d, boardX + boardW - 14, boardY + boardH - 14, 12);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 14, boardY + 14, 12);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 14, boardY + boardH - 14, 12);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 14, boardY + 14, 12);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 14, boardY + boardH - 14, 12);
|
||||
|
||||
// Display Bezel (Center)
|
||||
double bezelW = new Size(30.0d, SizeUnit.mm).convertToPixels();
|
||||
@@ -335,7 +336,7 @@ public class SevenSegmentDisplay extends AbstractMakerBoard {
|
||||
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -144,10 +145,10 @@ public class TFTDisplay extends AbstractMakerBoard {
|
||||
|
||||
if (!outlineMode) {
|
||||
// 4 Mounting holes in corners
|
||||
drawMountingHole(g2d, boardX + 20, boardY + 20, 20);
|
||||
drawMountingHole(g2d, boardX + 20, boardY + boardH - 20, 20);
|
||||
drawMountingHole(g2d, boardX + boardW - 20, boardY + 20, 20);
|
||||
drawMountingHole(g2d, boardX + boardW - 20, boardY + boardH - 20, 20);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 20, boardY + 20, 20);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 20, boardY + boardH - 20, 20);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 20, boardY + 20, 20);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 20, boardY + boardH - 20, 20);
|
||||
|
||||
// Color Screen Area
|
||||
double screenMarginX = 35;
|
||||
@@ -169,12 +170,12 @@ public class TFTDisplay extends AbstractMakerBoard {
|
||||
StringUtils.drawCenteredText(g2d, "TFT 2.8\" 320x240 SPI", screenX + screenW / 2.0, screenY + 12, HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
|
||||
// SD Card holder on right edge
|
||||
drawMetalConnector(g2d, boardX + boardW - 28, boardY + 100, 36, 120, "SD");
|
||||
MakerBoardPainter.drawMetalConnector(g2d, boardX + boardW - 28, boardY + 100, 36, 120, "SD");
|
||||
}
|
||||
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ public class WS2812BStick extends AbstractMakerBoard {
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
// Draw input and output header pins
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,8 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardLogos;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -308,25 +310,25 @@ public class ArduinoMega extends AbstractMakerBoard {
|
||||
if (!outlineMode) {
|
||||
// Mounting holes (6 mounting holes from technical design)
|
||||
double holeDiameter = new Size(0.12d, SizeUnit.in).convertToPixels();
|
||||
drawMountingHole(g2d, boardX + new Size(0.55d, SizeUnit.in).convertToPixels(), boardY + new Size(2.0d, SizeUnit.in).convertToPixels(), holeDiameter); // (550, 100 mils)
|
||||
drawMountingHole(g2d, boardX + new Size(0.6d, SizeUnit.in).convertToPixels(), boardY + new Size(0.1d, SizeUnit.in).convertToPixels(), holeDiameter); // (600, 2000 mils)
|
||||
drawMountingHole(g2d, boardX + new Size(2.6d, SizeUnit.in).convertToPixels(), boardY + new Size(0.7d, SizeUnit.in).convertToPixels(), holeDiameter); // (2600, 1400 mils)
|
||||
drawMountingHole(g2d, boardX + new Size(2.6d, SizeUnit.in).convertToPixels(), boardY + new Size(1.8d, SizeUnit.in).convertToPixels(), holeDiameter); // (2600, 300 mils)
|
||||
drawMountingHole(g2d, boardX + new Size(3.55d, SizeUnit.in).convertToPixels(), boardY + new Size(0.1d, SizeUnit.in).convertToPixels(), holeDiameter); // (3550, 2000 mils)
|
||||
drawMountingHole(g2d, boardX + new Size(3.8d, SizeUnit.in).convertToPixels(), boardY + new Size(2.0d, SizeUnit.in).convertToPixels(), holeDiameter); // (3800, 100 mils)
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + new Size(0.55d, SizeUnit.in).convertToPixels(), boardY + new Size(2.0d, SizeUnit.in).convertToPixels(), holeDiameter); // (550, 100 mils)
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + new Size(0.6d, SizeUnit.in).convertToPixels(), boardY + new Size(0.1d, SizeUnit.in).convertToPixels(), holeDiameter); // (600, 2000 mils)
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + new Size(2.6d, SizeUnit.in).convertToPixels(), boardY + new Size(0.7d, SizeUnit.in).convertToPixels(), holeDiameter); // (2600, 1400 mils)
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + new Size(2.6d, SizeUnit.in).convertToPixels(), boardY + new Size(1.8d, SizeUnit.in).convertToPixels(), holeDiameter); // (2600, 300 mils)
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + new Size(3.55d, SizeUnit.in).convertToPixels(), boardY + new Size(0.1d, SizeUnit.in).convertToPixels(), holeDiameter); // (3550, 2000 mils)
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + new Size(3.8d, SizeUnit.in).convertToPixels(), boardY + new Size(2.0d, SizeUnit.in).convertToPixels(), holeDiameter); // (3800, 100 mils)
|
||||
|
||||
// USB Type-B Jack & DC Power Jack
|
||||
drawUsbB(g2d, boardX - USB_B_OVERHANG.convertToPixels(),
|
||||
MakerBoardPainter.drawUsbB(g2d, boardX - USB_B_OVERHANG.convertToPixels(),
|
||||
boardY + new Size(0.375d, SizeUnit.in).convertToPixels(),
|
||||
USB_B_LENGTH.convertToPixels(),
|
||||
USB_B_WIDTH.convertToPixels(), "USB");
|
||||
drawChip(g2d, boardX - new Size(0.07d, SizeUnit.in).convertToPixels(),
|
||||
MakerBoardPainter.drawChip(g2d, boardX - new Size(0.07d, SizeUnit.in).convertToPixels(),
|
||||
boardY + new Size(1.625d, SizeUnit.in).convertToPixels(),
|
||||
new Size(0.52d, SizeUnit.in).convertToPixels(),
|
||||
new Size(0.35d, SizeUnit.in).convertToPixels(), "DC IN");
|
||||
|
||||
// ATmega2560 square QFP chip
|
||||
drawChip(g2d, boardX + new Size(1.825d, SizeUnit.in).convertToPixels(),
|
||||
MakerBoardPainter.drawChip(g2d, boardX + new Size(1.825d, SizeUnit.in).convertToPixels(),
|
||||
boardY + new Size(0.825d, SizeUnit.in).convertToPixels(),
|
||||
new Size(0.4d, SizeUnit.in).convertToPixels(),
|
||||
new Size(0.4d, SizeUnit.in).convertToPixels(), "ATmega2560");
|
||||
@@ -337,7 +339,7 @@ public class ArduinoMega extends AbstractMakerBoard {
|
||||
double btnH = BUTTON_LENGTH.convertToPixels();
|
||||
double btnX = boardX + new Size(2.72d, SizeUnit.in).convertToPixels();
|
||||
double btnY = boardY + new Size(1.0d, SizeUnit.in).convertToPixels() - btnH / 2.0;
|
||||
drawButton(g2d, btnX, btnY, btnW, btnH);
|
||||
MakerBoardPainter.drawButton(g2d, btnX, btnY, btnW, btnH);
|
||||
|
||||
g2d.setColor(SILK_COLOR);
|
||||
g2d.setFont(SILK_FONT_SMALL);
|
||||
@@ -345,7 +347,7 @@ public class ArduinoMega extends AbstractMakerBoard {
|
||||
btnY + btnH + new Size(1.0d, SizeUnit.mm).convertToPixels(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
|
||||
// Arduino Infinity Logo
|
||||
drawArduinoLogo(g2d, boardX + new Size(1.2d, SizeUnit.in).convertToPixels(),
|
||||
MakerBoardLogos.drawArduinoLogo(g2d, boardX + new Size(1.2d, SizeUnit.in).convertToPixels(),
|
||||
boardY + new Size(0.4d, SizeUnit.in).convertToPixels());
|
||||
|
||||
// Silkscreen text & branding
|
||||
@@ -405,7 +407,7 @@ public class ArduinoMega extends AbstractMakerBoard {
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
// Draw header pins with continuity tracking
|
||||
drawPinHeader(g2d, 0, controlPoints.length, true, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
@@ -454,7 +456,7 @@ public class ArduinoMega extends AbstractMakerBoard {
|
||||
double logoH = 45.33 * scale;
|
||||
double logoX = boardX + (boardW - logoW) / 2.0 + 1.0;
|
||||
double logoY = boardY + 3.5;
|
||||
drawArduinoLogo(g2d, logoX, logoY, scale);
|
||||
MakerBoardLogos.drawArduinoLogo(g2d, logoX, logoY, scale);
|
||||
|
||||
// MEGA text below logo
|
||||
g2d.setColor(SILK_COLOR);
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -500,10 +501,10 @@ public class ArduinoNano extends AbstractMakerBoard {
|
||||
double leftHoleX = boardX + boardMarginX;
|
||||
double rightHoleX = boardX + boardW - boardMarginX;
|
||||
|
||||
drawMountingHole(g2d, leftHoleX, topHoleY, holeDiameter);
|
||||
drawMountingHole(g2d, rightHoleX, topHoleY, holeDiameter);
|
||||
drawMountingHole(g2d, leftHoleX, bottomHoleY, holeDiameter);
|
||||
drawMountingHole(g2d, rightHoleX, bottomHoleY, holeDiameter);
|
||||
MakerBoardPainter.drawMountingHole(g2d, leftHoleX, topHoleY, holeDiameter);
|
||||
MakerBoardPainter.drawMountingHole(g2d, rightHoleX, topHoleY, holeDiameter);
|
||||
MakerBoardPainter.drawMountingHole(g2d, leftHoleX, bottomHoleY, holeDiameter);
|
||||
MakerBoardPainter.drawMountingHole(g2d, rightHoleX, bottomHoleY, holeDiameter);
|
||||
|
||||
// USB jack at bottom (plain metal connector)
|
||||
UsbPortType usbType = getUsbPortType();
|
||||
@@ -511,8 +512,8 @@ public class ArduinoNano extends AbstractMakerBoard {
|
||||
double usbW = usbSizes[0].convertToPixels();
|
||||
double usbH = usbSizes[1].convertToPixels();
|
||||
double usbOverhang = usbSizes[2].convertToPixels();
|
||||
drawUsbPort(g2d, boardX + (boardW - usbW) / 2.0, boardY + boardH - usbH + usbOverhang, usbW, usbH,
|
||||
usbType, "USB");
|
||||
MakerBoardPainter.drawMetalConnector(g2d, boardX + (boardW - usbW) / 2.0,
|
||||
boardY + boardH - usbH + usbOverhang, usbW, usbH, "USB");
|
||||
|
||||
double chipSize = new Size(0.28d, SizeUnit.in).convertToPixels();
|
||||
double chipCenterX = boardX + boardW / 2.0;
|
||||
@@ -544,7 +545,7 @@ public class ArduinoNano extends AbstractMakerBoard {
|
||||
} else if (getVersion().getMcuLabel() != null) {
|
||||
// Later Nanos carry an axis-aligned QFN in the same spot, unless the MCU is a die inside
|
||||
// the module at the far end of the board
|
||||
drawChip(g2d, chipCenterX - chipSize / 2.0, chipCenterY - chipSize / 2.0, chipSize, chipSize,
|
||||
MakerBoardPainter.drawChip(g2d, chipCenterX - chipSize / 2.0, chipCenterY - chipSize / 2.0, chipSize, chipSize,
|
||||
getVersion().getMcuLabel());
|
||||
}
|
||||
|
||||
@@ -556,7 +557,7 @@ public class ArduinoNano extends AbstractMakerBoard {
|
||||
case EVERY: {
|
||||
// A bare QFN USB bridge rather than a shielded module
|
||||
double bridgeSize = new Size(5.0d, SizeUnit.mm).convertToPixels();
|
||||
drawChip(g2d, boardX + (boardW - bridgeSize) / 2.0, moduleY, bridgeSize, bridgeSize,
|
||||
MakerBoardPainter.drawChip(g2d, boardX + (boardW - bridgeSize) / 2.0, moduleY, bridgeSize, bridgeSize,
|
||||
getVersion().getModuleLabel());
|
||||
break;
|
||||
}
|
||||
@@ -579,7 +580,7 @@ public class ArduinoNano extends AbstractMakerBoard {
|
||||
default: {
|
||||
double moduleW = new Size(10.0d, SizeUnit.mm).convertToPixels();
|
||||
double moduleH = new Size(11.0d, SizeUnit.mm).convertToPixels();
|
||||
drawMetalConnector(g2d, boardX + (boardW - moduleW) / 2.0, moduleY, moduleW, moduleH,
|
||||
MakerBoardPainter.drawMetalConnector(g2d, boardX + (boardW - moduleW) / 2.0, moduleY, moduleW, moduleH,
|
||||
getVersion().getModuleLabel());
|
||||
}
|
||||
}
|
||||
@@ -590,7 +591,7 @@ public class ArduinoNano extends AbstractMakerBoard {
|
||||
double btnH = BUTTON_LENGTH.convertToPixels();
|
||||
double btnX = boardX + (boardW - btnW) / 2.0;
|
||||
double btnY = boardY + new Size(0.68d, SizeUnit.in).convertToPixels();
|
||||
drawButton(g2d, btnX, btnY, btnW, btnH);
|
||||
MakerBoardPainter.drawButton(g2d, btnX, btnY, btnW, btnH);
|
||||
|
||||
g2d.setColor(SILK_COLOR);
|
||||
g2d.setFont(SILK_FONT_SMALL);
|
||||
@@ -619,7 +620,7 @@ public class ArduinoNano extends AbstractMakerBoard {
|
||||
|
||||
// Draw pins or solder pads
|
||||
if (headers) {
|
||||
drawPinHeader(g2d, 0, getHeaderPinCount(), false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, getHeaderPinCount(), outlineMode, drawingObserver);
|
||||
} else if (getVersion() == NanoVersion.CLASSIC) {
|
||||
drawPcbSolderPads(g2d, 0, getHeaderPinCount(), true, outlineMode, drawingObserver);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,8 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardLogos;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -464,29 +466,29 @@ public class ArduinoUno extends AbstractMakerBoard {
|
||||
if (!outlineMode) {
|
||||
// Mounting holes
|
||||
double holeDiameter = new Size(0.12d, SizeUnit.in).convertToPixels();
|
||||
drawMountingHole(g2d, boardX + new Size(0.6d, SizeUnit.in).convertToPixels(), boardY + new Size(0.1d, SizeUnit.in).convertToPixels(), holeDiameter);
|
||||
drawMountingHole(g2d, boardX + new Size(0.55d, SizeUnit.in).convertToPixels(), boardY + new Size(2.0d, SizeUnit.in).convertToPixels(), holeDiameter);
|
||||
drawMountingHole(g2d, boardX + new Size(2.6d, SizeUnit.in).convertToPixels(), boardY + new Size(0.7d, SizeUnit.in).convertToPixels(), holeDiameter);
|
||||
drawMountingHole(g2d, boardX + new Size(2.6d, SizeUnit.in).convertToPixels(), boardY + new Size(1.8d, SizeUnit.in).convertToPixels(), holeDiameter);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + new Size(0.6d, SizeUnit.in).convertToPixels(), boardY + new Size(0.1d, SizeUnit.in).convertToPixels(), holeDiameter);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + new Size(0.55d, SizeUnit.in).convertToPixels(), boardY + new Size(2.0d, SizeUnit.in).convertToPixels(), holeDiameter);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + new Size(2.6d, SizeUnit.in).convertToPixels(), boardY + new Size(0.7d, SizeUnit.in).convertToPixels(), holeDiameter);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + new Size(2.6d, SizeUnit.in).convertToPixels(), boardY + new Size(1.8d, SizeUnit.in).convertToPixels(), holeDiameter);
|
||||
|
||||
if (isR4()) {
|
||||
double usbCW = USB_C_WIDTH.convertToPixels();
|
||||
double usbCL = USB_C_LENGTH.convertToPixels();
|
||||
double usbCY = boardY + new Size(15.5d, SizeUnit.mm).convertToPixels() - usbCW / 2.0;
|
||||
drawUsbC(g2d, boardX - USB_C_OVERHANG.convertToPixels(), usbCY, usbCL, usbCW, "USB-C");
|
||||
MakerBoardPainter.drawUsbC(g2d, boardX - USB_C_OVERHANG.convertToPixels(), usbCY, usbCL, usbCW, "USB-C");
|
||||
} else if (getVersion() == ArduinoUnoVersion.LEONARDO) {
|
||||
double microW = USB_MICRO_LENGTH.convertToPixels();
|
||||
double microH = USB_MICRO_WIDTH.convertToPixels();
|
||||
double microY = boardY + new Size(0.6d, SizeUnit.in).convertToPixels() - microH / 2.0;
|
||||
drawMicroUsb(g2d, boardX - USB_MICRO_OVERHANG.convertToPixels(), microY, microW, microH, "USB");
|
||||
MakerBoardPainter.drawMicroUsb(g2d, boardX - USB_MICRO_OVERHANG.convertToPixels(), microY, microW, microH, "USB");
|
||||
} else {
|
||||
drawUsbB(g2d, boardX - USB_B_OVERHANG.convertToPixels(),
|
||||
MakerBoardPainter.drawUsbB(g2d, boardX - USB_B_OVERHANG.convertToPixels(),
|
||||
boardY + new Size(0.375d, SizeUnit.in).convertToPixels(),
|
||||
USB_B_LENGTH.convertToPixels(),
|
||||
USB_B_WIDTH.convertToPixels(), "USB");
|
||||
}
|
||||
|
||||
drawChip(g2d, boardX - new Size(0.07d, SizeUnit.in).convertToPixels(),
|
||||
MakerBoardPainter.drawChip(g2d, boardX - new Size(0.07d, SizeUnit.in).convertToPixels(),
|
||||
boardY + new Size(1.615d, SizeUnit.in).convertToPixels(),
|
||||
new Size(0.52d, SizeUnit.in).convertToPixels(),
|
||||
new Size(0.355d, SizeUnit.in).convertToPixels(), "DC IN");
|
||||
@@ -501,13 +503,13 @@ public class ArduinoUno extends AbstractMakerBoard {
|
||||
double antH = new Size(15d, SizeUnit.mm).convertToPixels();
|
||||
double antX = boardX;
|
||||
double antY = boardY + boardH - new Size(13.5d, SizeUnit.mm).convertToPixels() - antH;
|
||||
drawPcbAntenna(g2d, antX, antY, antW, antH);
|
||||
MakerBoardPainter.drawPcbAntenna(g2d, antX, antY, antW, antH);
|
||||
|
||||
double s3W = new Size(14d, SizeUnit.mm).convertToPixels();
|
||||
double s3H = new Size(14d, SizeUnit.mm).convertToPixels();
|
||||
double s3X = boardX + new Size(5.5d, SizeUnit.mm).convertToPixels();
|
||||
double s3Y = boardY + boardH - new Size(14.0d, SizeUnit.mm).convertToPixels() - s3H;
|
||||
drawMetalConnector(g2d, s3X, s3Y, s3W, s3H, "ESP32-S3");
|
||||
MakerBoardPainter.drawMetalConnector(g2d, s3X, s3Y, s3W, s3H, "ESP32-S3");
|
||||
}
|
||||
|
||||
double raW = new Size(10d, SizeUnit.mm).convertToPixels();
|
||||
@@ -531,7 +533,7 @@ public class ArduinoUno extends AbstractMakerBoard {
|
||||
double swdH = SWD_HEIGHT.convertToPixels();
|
||||
double swdX = boardX + SWD_X.convertToPixels();
|
||||
double swdY = boardY + SWD_Y.convertToPixels();
|
||||
drawFpcConnector(g2d, swdX, swdY, swdW, swdH, true, "");
|
||||
MakerBoardPainter.drawFpcConnector(g2d, swdX, swdY, swdW, swdH, true, "");
|
||||
|
||||
g2d.setColor(SILK_COLOR);
|
||||
g2d.setFont(SILK_FONT_SMALL);
|
||||
@@ -542,10 +544,10 @@ public class ArduinoUno extends AbstractMakerBoard {
|
||||
} else if (getVersion() == ArduinoUnoVersion.LEONARDO) {
|
||||
// The 32U4 is a square TQFP-44 where the R3 carries its DIP-28
|
||||
double chipSize = new Size(0.4d, SizeUnit.in).convertToPixels();
|
||||
drawChip(g2d, boardX + new Size(1.62d, SizeUnit.in).convertToPixels(),
|
||||
MakerBoardPainter.drawChip(g2d, boardX + new Size(1.62d, SizeUnit.in).convertToPixels(),
|
||||
boardY + new Size(1.255d, SizeUnit.in).convertToPixels(), chipSize, chipSize, "32U4");
|
||||
} else {
|
||||
drawChip(g2d, boardX + new Size(1.095d, SizeUnit.in).convertToPixels(),
|
||||
MakerBoardPainter.drawChip(g2d, boardX + new Size(1.095d, SizeUnit.in).convertToPixels(),
|
||||
boardY + new Size(1.345d, SizeUnit.in).convertToPixels(),
|
||||
new Size(1.46d, SizeUnit.in).convertToPixels(),
|
||||
new Size(0.22d, SizeUnit.in).convertToPixels(), "ATmega328P");
|
||||
@@ -556,7 +558,7 @@ public class ArduinoUno extends AbstractMakerBoard {
|
||||
double btnH = BUTTON_LENGTH.convertToPixels();
|
||||
double btnX = boardX + new Size(0.235d, SizeUnit.in).convertToPixels() - btnW / 2.0;
|
||||
double btnY = boardY + new Size(0.1d, SizeUnit.in).convertToPixels();
|
||||
drawButton(g2d, btnX, btnY, btnW, btnH);
|
||||
MakerBoardPainter.drawButton(g2d, btnX, btnY, btnW, btnH);
|
||||
|
||||
g2d.setColor(SILK_COLOR);
|
||||
g2d.setFont(SILK_FONT_SMALL);
|
||||
@@ -568,7 +570,7 @@ public class ArduinoUno extends AbstractMakerBoard {
|
||||
? new Size(24d, SizeUnit.mm).convertToPixels() : 0;
|
||||
|
||||
// Arduino Infinity Logo
|
||||
drawArduinoLogo(g2d, boardX + new Size(1.26d, SizeUnit.in).convertToPixels() - new Size(3.0d, SizeUnit.mm).convertToPixels(),
|
||||
MakerBoardLogos.drawArduinoLogo(g2d, boardX + new Size(1.26d, SizeUnit.in).convertToPixels() - new Size(3.0d, SizeUnit.mm).convertToPixels(),
|
||||
boardY + new Size(0.4411d, SizeUnit.in).convertToPixels() - new Size(3.0d, SizeUnit.mm).convertToPixels() + brandShiftY);
|
||||
|
||||
// Silkscreen text & branding
|
||||
@@ -617,7 +619,7 @@ public class ArduinoUno extends AbstractMakerBoard {
|
||||
// body drawn above and gets no header pin of its own
|
||||
int headerPinCount = getVersion() == ArduinoUnoVersion.R4_MINIMA
|
||||
? controlPoints.length - 1 : controlPoints.length;
|
||||
drawPinHeader(g2d, 0, headerPinCount, true, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, headerPinCount, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
@@ -666,7 +668,7 @@ public class ArduinoUno extends AbstractMakerBoard {
|
||||
double logoH = 45.33 * scale;
|
||||
double logoX = boardX + (boardW - logoW) / 2.0 + 1.0;
|
||||
double logoY = boardY + 3.5;
|
||||
drawArduinoLogo(g2d, logoX, logoY, scale);
|
||||
MakerBoardLogos.drawArduinoLogo(g2d, logoX, logoY, scale);
|
||||
|
||||
// UNO text below logo
|
||||
g2d.setColor(SILK_COLOR);
|
||||
|
||||
@@ -39,6 +39,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -624,14 +625,14 @@ public class ESP32DevKit extends AbstractMakerBoard {
|
||||
double antennaY = boardY;
|
||||
|
||||
// Antenna (dark rectangle underneath + gold serpentine trace)
|
||||
drawPcbAntenna(g2d, antennaX, antennaY, antennaW, antennaH);
|
||||
MakerBoardPainter.drawPcbAntenna(g2d, antennaX, antennaY, antennaW, antennaH);
|
||||
|
||||
// ESP32-WROOM-32 metal shield module below antenna
|
||||
double shieldW = SHIELD_WIDTH.convertToPixels();
|
||||
double shieldH = SHIELD_LENGTH.convertToPixels();
|
||||
double shieldX = centerX - shieldW / 2.0;
|
||||
double shieldY = boardY + antennaH;
|
||||
drawMetalConnector(g2d, shieldX, shieldY, shieldW, shieldH, "ESP32-WROOM-32");
|
||||
MakerBoardPainter.drawMetalConnector(g2d, shieldX, shieldY, shieldW, shieldH, "ESP32-WROOM-32");
|
||||
|
||||
// 4 Corner Mounting Holes (diameter 2.8mm, 0.8mm away from edges in both directions)
|
||||
double holeDiameter = HOLE_DIAMETER_30.convertToPixels();
|
||||
@@ -642,10 +643,10 @@ public class ESP32DevKit extends AbstractMakerBoard {
|
||||
double topHoleY = boardY + edgeMargin + holeRadius;
|
||||
double bottomHoleY = boardY + boardH - edgeMargin - holeRadius;
|
||||
|
||||
drawMountingHole(g2d, leftHoleX, topHoleY, holeDiameter);
|
||||
drawMountingHole(g2d, rightHoleX, topHoleY, holeDiameter);
|
||||
drawMountingHole(g2d, leftHoleX, bottomHoleY, holeDiameter);
|
||||
drawMountingHole(g2d, rightHoleX, bottomHoleY, holeDiameter);
|
||||
MakerBoardPainter.drawMountingHole(g2d, leftHoleX, topHoleY, holeDiameter);
|
||||
MakerBoardPainter.drawMountingHole(g2d, rightHoleX, topHoleY, holeDiameter);
|
||||
MakerBoardPainter.drawMountingHole(g2d, leftHoleX, bottomHoleY, holeDiameter);
|
||||
MakerBoardPainter.drawMountingHole(g2d, rightHoleX, bottomHoleY, holeDiameter);
|
||||
|
||||
// Micro-USB Jack at bottom (7.5mm x 5.6mm, 0.5mm overhang)
|
||||
double usbW = USB_MICRO_WIDTH.convertToPixels();
|
||||
@@ -653,7 +654,7 @@ public class ESP32DevKit extends AbstractMakerBoard {
|
||||
double usbOverhang = USB_MICRO_OVERHANG.convertToPixels();
|
||||
double usbX = centerX - usbW / 2.0;
|
||||
double usbY = boardY + boardH - usbH + usbOverhang;
|
||||
drawMicroUsb(g2d, usbX, usbY, usbW, usbH, "USB");
|
||||
MakerBoardPainter.drawMicroUsb(g2d, usbX, usbY, usbW, usbH, "USB");
|
||||
|
||||
// EN & BOOT tactile buttons at bottom (flanking the Micro-USB port)
|
||||
double btnY = boardY + boardH - 25 - 1.5 * shift1mm;
|
||||
@@ -681,14 +682,14 @@ public class ESP32DevKit extends AbstractMakerBoard {
|
||||
double antennaY = mainY - antennaH;
|
||||
|
||||
// Antenna at top (dark rectangle + gold serpentine trace)
|
||||
drawPcbAntenna(g2d, antennaX, antennaY, antennaW, antennaH);
|
||||
MakerBoardPainter.drawPcbAntenna(g2d, antennaX, antennaY, antennaW, antennaH);
|
||||
|
||||
// ESP32-S3-WROOM-1 metal shield module below antenna
|
||||
double shieldW = SHIELD_WIDTH_S3.convertToPixels();
|
||||
double shieldH = SHIELD_LENGTH_S3.convertToPixels();
|
||||
double shieldX = centerX - shieldW / 2.0;
|
||||
double shieldY = mainY + 4;
|
||||
drawMetalConnector(g2d, shieldX, shieldY, shieldW, shieldH, "ESP32-S3-WROOM-1");
|
||||
MakerBoardPainter.drawMetalConnector(g2d, shieldX, shieldY, shieldW, shieldH, "ESP32-S3-WROOM-1");
|
||||
|
||||
// BOOT & RESET tactile buttons (per DXF: BOOT on left near pin 13/14, RESET on right near pin 20/19)
|
||||
double btnY = y + 18.5 * PIN_SPACING.convertToPixels() - btnH / 2.0;
|
||||
@@ -705,8 +706,8 @@ public class ESP32DevKit extends AbstractMakerBoard {
|
||||
double usbLeftX = mainX + usbEdgeDist - usbW / 2.0;
|
||||
double usbRightX = mainX + boardW - usbEdgeDist - usbW / 2.0;
|
||||
double usbY = mainY + boardH - usbH + usbOverhang;
|
||||
drawMicroUsb(g2d, usbLeftX, usbY, usbW, usbH, "UART");
|
||||
drawMicroUsb(g2d, usbRightX, usbY, usbW, usbH, "USB");
|
||||
MakerBoardPainter.drawMicroUsb(g2d, usbLeftX, usbY, usbW, usbH, "UART");
|
||||
MakerBoardPainter.drawMicroUsb(g2d, usbRightX, usbY, usbW, usbH, "USB");
|
||||
|
||||
// Silkscreen
|
||||
g2d.setColor(SILK_COLOR);
|
||||
@@ -729,14 +730,14 @@ public class ESP32DevKit extends AbstractMakerBoard {
|
||||
double antennaY = mainY - antennaH;
|
||||
|
||||
// Antenna at top (dark rectangle + gold serpentine trace)
|
||||
drawPcbAntenna(g2d, antennaX, antennaY, antennaW, antennaH);
|
||||
MakerBoardPainter.drawPcbAntenna(g2d, antennaX, antennaY, antennaW, antennaH);
|
||||
|
||||
// ESP32-C3-MINI-1 / ESP32-C6-WROOM-1 metal shield module below the antenna
|
||||
double shieldW = getRiscVShieldWidth().convertToPixels();
|
||||
double shieldH = getRiscVShieldLength().convertToPixels();
|
||||
double shieldX = centerX - shieldW / 2.0;
|
||||
double shieldY = mainY + 4;
|
||||
drawMetalConnector(g2d, shieldX, shieldY, shieldW, shieldH,
|
||||
MakerBoardPainter.drawMetalConnector(g2d, shieldX, shieldY, shieldW, shieldH,
|
||||
isC3 ? "ESP32-C3-MINI-1" : "ESP32-C6-WROOM-1");
|
||||
|
||||
// BOOT & RST tactile buttons flanking the connectors, inset clear of the pin columns
|
||||
@@ -752,15 +753,15 @@ public class ESP32DevKit extends AbstractMakerBoard {
|
||||
double usbW = USB_MICRO_WIDTH.convertToPixels();
|
||||
double usbH = USB_MICRO_LENGTH.convertToPixels();
|
||||
double usbOverhang = USB_MICRO_OVERHANG.convertToPixels();
|
||||
drawMicroUsb(g2d, centerX - usbW / 2.0, mainY + boardH - usbH + usbOverhang, usbW, usbH, "USB");
|
||||
MakerBoardPainter.drawMicroUsb(g2d, centerX - usbW / 2.0, mainY + boardH - usbH + usbOverhang, usbW, usbH, "USB");
|
||||
} else {
|
||||
double usbW = USB_C_WIDTH.convertToPixels();
|
||||
double usbH = USB_C_LENGTH.convertToPixels();
|
||||
double usbOverhang = USB_C_OVERHANG.convertToPixels();
|
||||
double usbEdgeDist = new Size(6.5d, SizeUnit.mm).convertToPixels();
|
||||
double usbY = mainY + boardH - usbH + usbOverhang;
|
||||
drawUsbC(g2d, mainX + usbEdgeDist - usbW / 2.0, usbY, usbW, usbH, "UART");
|
||||
drawUsbC(g2d, mainX + boardW - usbEdgeDist - usbW / 2.0, usbY, usbW, usbH, "USB");
|
||||
MakerBoardPainter.drawUsbC(g2d, mainX + usbEdgeDist - usbW / 2.0, usbY, usbW, usbH, "UART");
|
||||
MakerBoardPainter.drawUsbC(g2d, mainX + boardW - usbEdgeDist - usbW / 2.0, usbY, usbW, usbH, "USB");
|
||||
}
|
||||
|
||||
// Silkscreen
|
||||
@@ -785,14 +786,14 @@ public class ESP32DevKit extends AbstractMakerBoard {
|
||||
double antennaY = mainY - antennaH;
|
||||
|
||||
// Antenna (dark rectangle underneath + gold serpentine trace)
|
||||
drawPcbAntenna(g2d, antennaX, antennaY, antennaW, antennaH);
|
||||
MakerBoardPainter.drawPcbAntenna(g2d, antennaX, antennaY, antennaW, antennaH);
|
||||
|
||||
// ESP32-WROOM-32 metal shield module below antenna
|
||||
double shieldW = SHIELD_WIDTH.convertToPixels();
|
||||
double shieldH = SHIELD_LENGTH.convertToPixels();
|
||||
double shieldX = centerX - shieldW / 2.0;
|
||||
double shieldY = mainY + 8;
|
||||
drawMetalConnector(g2d, shieldX, shieldY, shieldW, shieldH, "ESP32-WROOM-32");
|
||||
MakerBoardPainter.drawMetalConnector(g2d, shieldX, shieldY, shieldW, shieldH, "ESP32-WROOM-32");
|
||||
|
||||
// Micro-USB Jack at bottom (7.5mm x 5.6mm, 0.5mm overhang)
|
||||
double usbW = USB_MICRO_WIDTH.convertToPixels();
|
||||
@@ -800,7 +801,7 @@ public class ESP32DevKit extends AbstractMakerBoard {
|
||||
double usbOverhang = USB_MICRO_OVERHANG.convertToPixels();
|
||||
double usbX = centerX - usbW / 2.0;
|
||||
double usbY = mainY + mainH - usbH + usbOverhang;
|
||||
drawMicroUsb(g2d, usbX, usbY, usbW, usbH, "USB");
|
||||
MakerBoardPainter.drawMicroUsb(g2d, usbX, usbY, usbW, usbH, "USB");
|
||||
|
||||
// EN & BOOT tactile buttons at bottom
|
||||
double btnY = mainY + mainH - 25 - new Size(2.0d, SizeUnit.mm).convertToPixels();
|
||||
@@ -821,7 +822,7 @@ public class ESP32DevKit extends AbstractMakerBoard {
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
if (headers) {
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
} else {
|
||||
drawPcbSolderPads(g2d, 0, controlPoints.length, true, outlineMode, drawingObserver);
|
||||
}
|
||||
@@ -834,8 +835,8 @@ public class ESP32DevKit extends AbstractMakerBoard {
|
||||
*/
|
||||
private void drawButtons(Graphics2D g2d, double btnLeftX, double btnRightX, double btnY, double btnW, double btnH,
|
||||
String leftLabel, String rightLabel) {
|
||||
drawButton(g2d, btnLeftX, btnY, btnW, btnH);
|
||||
drawButton(g2d, btnRightX, btnY, btnW, btnH);
|
||||
MakerBoardPainter.drawButton(g2d, btnLeftX, btnY, btnW, btnH);
|
||||
MakerBoardPainter.drawButton(g2d, btnRightX, btnY, btnW, btnH);
|
||||
|
||||
g2d.setColor(SILK_COLOR);
|
||||
g2d.setFont(SILK_FONT_SMALL);
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -222,16 +223,16 @@ public class ESP8266NodeMCU extends AbstractMakerBoard {
|
||||
double leftHoleX = (x + rowSpacing / 2.0) - holeDistX / 2.0;
|
||||
double rightHoleX = (x + rowSpacing / 2.0) + holeDistX / 2.0;
|
||||
|
||||
drawMountingHole(g2d, leftHoleX, topHoleY, holeDiameter);
|
||||
drawMountingHole(g2d, rightHoleX, topHoleY, holeDiameter);
|
||||
drawMountingHole(g2d, leftHoleX, bottomHoleY, holeDiameter);
|
||||
drawMountingHole(g2d, rightHoleX, bottomHoleY, holeDiameter);
|
||||
MakerBoardPainter.drawMountingHole(g2d, leftHoleX, topHoleY, holeDiameter);
|
||||
MakerBoardPainter.drawMountingHole(g2d, rightHoleX, topHoleY, holeDiameter);
|
||||
MakerBoardPainter.drawMountingHole(g2d, leftHoleX, bottomHoleY, holeDiameter);
|
||||
MakerBoardPainter.drawMountingHole(g2d, rightHoleX, bottomHoleY, holeDiameter);
|
||||
|
||||
// Antenna (dark rectangle underneath + gold serpentine trace)
|
||||
drawPcbAntenna(g2d, antennaX, antennaY, antennaW, antennaH);
|
||||
MakerBoardPainter.drawPcbAntenna(g2d, antennaX, antennaY, antennaW, antennaH);
|
||||
|
||||
// ESP-12 Metal shield module below antenna
|
||||
drawMetalConnector(g2d, shieldX, shieldY, shieldW, shieldH, "ESP8266");
|
||||
MakerBoardPainter.drawMetalConnector(g2d, shieldX, shieldY, shieldW, shieldH, "ESP8266");
|
||||
|
||||
// Micro-USB Jack at bottom (7.5mm x 5.6mm, 0.5mm overhang)
|
||||
double usbW = USB_MICRO_WIDTH.convertToPixels();
|
||||
@@ -239,7 +240,7 @@ public class ESP8266NodeMCU extends AbstractMakerBoard {
|
||||
double usbOverhang = USB_MICRO_OVERHANG.convertToPixels();
|
||||
double usbX = (x + rowSpacing / 2.0) - usbW / 2.0;
|
||||
double usbY = boardY + boardH - usbH + usbOverhang;
|
||||
drawMicroUsb(g2d, usbX, usbY, usbW, usbH, "USB");
|
||||
MakerBoardPainter.drawMicroUsb(g2d, usbX, usbY, usbW, usbH, "USB");
|
||||
|
||||
// RST & FLASH tactile buttons at bottom (flanking the Micro-USB port)
|
||||
double btnW = BUTTON_LENGTH.convertToPixels();
|
||||
@@ -249,8 +250,8 @@ public class ESP8266NodeMCU extends AbstractMakerBoard {
|
||||
double btnLeftX = leftHoleX + 10 + shift1mm;
|
||||
double btnRightX = rightHoleX - 10 - shift1mm - btnW;
|
||||
|
||||
drawButton(g2d, btnLeftX, btnY, btnW, btnH);
|
||||
drawButton(g2d, btnRightX, btnY, btnW, btnH);
|
||||
MakerBoardPainter.drawButton(g2d, btnLeftX, btnY, btnW, btnH);
|
||||
MakerBoardPainter.drawButton(g2d, btnRightX, btnY, btnW, btnH);
|
||||
|
||||
g2d.setColor(SILK_COLOR);
|
||||
g2d.setFont(SILK_FONT_SMALL);
|
||||
@@ -269,7 +270,7 @@ public class ESP8266NodeMCU extends AbstractMakerBoard {
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
if (headers) {
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
} else {
|
||||
drawPcbSolderPads(g2d, 0, controlPoints.length, true, outlineMode, drawingObserver);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardLogos;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -251,13 +253,13 @@ public class RaspberryPi extends AbstractMakerBoard {
|
||||
if (!outlineMode) {
|
||||
// 4 Mounting holes (diameter 2.7mm, spaced 58mm apart horizontally and 49mm vertically)
|
||||
double holeDiameter = new Size(2.7d, SizeUnit.mm).convertToPixels();
|
||||
drawMountingHole(g2d, boardX + new Size(3.5d, SizeUnit.mm).convertToPixels(),
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + new Size(3.5d, SizeUnit.mm).convertToPixels(),
|
||||
boardY + new Size(3.5d, SizeUnit.mm).convertToPixels(), holeDiameter);
|
||||
drawMountingHole(g2d, boardX + new Size(3.5d, SizeUnit.mm).convertToPixels(),
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + new Size(3.5d, SizeUnit.mm).convertToPixels(),
|
||||
boardY + new Size(52.5d, SizeUnit.mm).convertToPixels(), holeDiameter);
|
||||
drawMountingHole(g2d, boardX + new Size(61.5d, SizeUnit.mm).convertToPixels(),
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + new Size(61.5d, SizeUnit.mm).convertToPixels(),
|
||||
boardY + new Size(3.5d, SizeUnit.mm).convertToPixels(), holeDiameter);
|
||||
drawMountingHole(g2d, boardX + new Size(61.5d, SizeUnit.mm).convertToPixels(),
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + new Size(61.5d, SizeUnit.mm).convertToPixels(),
|
||||
boardY + new Size(52.5d, SizeUnit.mm).convertToPixels(), holeDiameter);
|
||||
|
||||
// USB & Ethernet Ports on the right edge
|
||||
@@ -273,19 +275,19 @@ public class RaspberryPi extends AbstractMakerBoard {
|
||||
double topUsbCenterY = (version == RaspberryPiVersion.PI_4_B) ? bottomCenterY : topCenterY;
|
||||
|
||||
// Top USB slot (USB 3.0)
|
||||
drawUsbA(g2d, boardX + boardW - new Size(14.5d, SizeUnit.mm).convertToPixels(),
|
||||
MakerBoardPainter.drawUsbA(g2d, boardX + boardW - new Size(14.5d, SizeUnit.mm).convertToPixels(),
|
||||
boardY + new Size(topUsbCenterY - 7.0d, SizeUnit.mm).convertToPixels(),
|
||||
USB_A_DUAL_LENGTH.convertToPixels(),
|
||||
new Size(14.0d, SizeUnit.mm).convertToPixels(), "USB 3.0");
|
||||
|
||||
// USB 2.0 (middle)
|
||||
drawUsbA(g2d, boardX + boardW - new Size(14.5d, SizeUnit.mm).convertToPixels(),
|
||||
MakerBoardPainter.drawUsbA(g2d, boardX + boardW - new Size(14.5d, SizeUnit.mm).convertToPixels(),
|
||||
boardY + new Size(middleCenterY - 7.0d, SizeUnit.mm).convertToPixels(),
|
||||
USB_A_DUAL_LENGTH.convertToPixels(),
|
||||
new Size(14.0d, SizeUnit.mm).convertToPixels(), "USB 2.0");
|
||||
|
||||
// Ethernet
|
||||
drawMetalConnector(g2d, boardX + boardW - new Size(18.0d, SizeUnit.mm).convertToPixels(),
|
||||
MakerBoardPainter.drawMetalConnector(g2d, boardX + boardW - new Size(18.0d, SizeUnit.mm).convertToPixels(),
|
||||
boardY + new Size(ethernetCenterY - 8.0d, SizeUnit.mm).convertToPixels(),
|
||||
new Size(21.0d, SizeUnit.mm).convertToPixels(),
|
||||
new Size(16.0d, SizeUnit.mm).convertToPixels(), "ETHERNET");
|
||||
@@ -335,25 +337,25 @@ public class RaspberryPi extends AbstractMakerBoard {
|
||||
// PWR (USB-C): center X = 11.2 mm
|
||||
double usbCW = USB_C_WIDTH.convertToPixels();
|
||||
double usbCH = USB_C_LENGTH.convertToPixels();
|
||||
drawUsbC(g2d, boardX + new Size(11.2d, SizeUnit.mm).convertToPixels() - usbCW / 2.0,
|
||||
MakerBoardPainter.drawUsbC(g2d, boardX + new Size(11.2d, SizeUnit.mm).convertToPixels() - usbCW / 2.0,
|
||||
boardY + boardH - new Size(6.5d, SizeUnit.mm).convertToPixels(),
|
||||
usbCW, usbCH, "PWR");
|
||||
|
||||
if (version == RaspberryPiVersion.PI_3_B) {
|
||||
double hdmiW = new Size(15.0d, SizeUnit.mm).convertToPixels();
|
||||
double hdmiH = new Size(11.5d, SizeUnit.mm).convertToPixels();
|
||||
drawMetalConnector(g2d, boardX + new Size(32.0d, SizeUnit.mm).convertToPixels() - hdmiW / 2.0,
|
||||
MakerBoardPainter.drawMetalConnector(g2d, boardX + new Size(32.0d, SizeUnit.mm).convertToPixels() - hdmiW / 2.0,
|
||||
boardY + boardH - new Size(10.5d, SizeUnit.mm).convertToPixels(),
|
||||
hdmiW, hdmiH, "HDMI");
|
||||
} else {
|
||||
// HDMI0: center X = 25.8 mm
|
||||
drawMetalConnector(g2d, boardX + new Size(22.05d, SizeUnit.mm).convertToPixels(),
|
||||
MakerBoardPainter.drawMetalConnector(g2d, boardX + new Size(22.05d, SizeUnit.mm).convertToPixels(),
|
||||
boardY + boardH - new Size(6.5d, SizeUnit.mm).convertToPixels(),
|
||||
new Size(7.5d, SizeUnit.mm).convertToPixels(),
|
||||
new Size(7.5d, SizeUnit.mm).convertToPixels(), "HDMI0");
|
||||
|
||||
// HDMI1: center X = 39.2 mm
|
||||
drawMetalConnector(g2d, boardX + new Size(35.45d, SizeUnit.mm).convertToPixels(),
|
||||
MakerBoardPainter.drawMetalConnector(g2d, boardX + new Size(35.45d, SizeUnit.mm).convertToPixels(),
|
||||
boardY + boardH - new Size(6.5d, SizeUnit.mm).convertToPixels(),
|
||||
new Size(7.5d, SizeUnit.mm).convertToPixels(),
|
||||
new Size(7.5d, SizeUnit.mm).convertToPixels(), "HDMI1");
|
||||
@@ -367,8 +369,8 @@ public class RaspberryPi extends AbstractMakerBoard {
|
||||
if (version == RaspberryPiVersion.PI_5) {
|
||||
double mipi1X = boardX + new Size(48.5d, SizeUnit.mm).convertToPixels() - mipiW / 2.0;
|
||||
double mipi0X = boardX + new Size(54.5d, SizeUnit.mm).convertToPixels() - mipiW / 2.0;
|
||||
drawFpcConnector(g2d, mipi1X, mipiY, mipiW, mipiH, true, "");
|
||||
drawFpcConnector(g2d, mipi0X, mipiY, mipiW, mipiH, true, "");
|
||||
MakerBoardPainter.drawFpcConnector(g2d, mipi1X, mipiY, mipiW, mipiH, true, "");
|
||||
MakerBoardPainter.drawFpcConnector(g2d, mipi0X, mipiY, mipiW, mipiH, true, "");
|
||||
|
||||
g2d.setColor(Color.WHITE);
|
||||
g2d.setFont(SILK_FONT_SMALL);
|
||||
@@ -450,7 +452,7 @@ public class RaspberryPi extends AbstractMakerBoard {
|
||||
double pcieH = new Size(10.5d, SizeUnit.mm).convertToPixels();
|
||||
double pcieX = boardX + new Size(0.1d, SizeUnit.in).convertToPixels() - new Size(1.0d, SizeUnit.mm).convertToPixels();
|
||||
double pcieY = boardY + new Size(1.0d, SizeUnit.in).convertToPixels() + new Size(0.75d, SizeUnit.mm).convertToPixels() - pcieH / 2.0;
|
||||
drawFpcConnector(g2d, pcieX, pcieY, pcieW, pcieH, true, "");
|
||||
MakerBoardPainter.drawFpcConnector(g2d, pcieX, pcieY, pcieW, pcieH, true, "");
|
||||
|
||||
g2d.setColor(Color.WHITE);
|
||||
g2d.setFont(SILK_FONT_SMALL);
|
||||
@@ -501,13 +503,13 @@ public class RaspberryPi extends AbstractMakerBoard {
|
||||
double logoSize = new Size(10.4d, SizeUnit.mm).convertToPixels();
|
||||
double logoX = boardX + new Size(8.3d, SizeUnit.mm).convertToPixels();
|
||||
double logoY = boardY + new Size(26.5d, SizeUnit.mm).convertToPixels() - new Size(0.2d, SizeUnit.in).convertToPixels();
|
||||
drawRaspberryPiLogo(g2d, logoX, logoY, logoSize);
|
||||
MakerBoardLogos.drawRaspberryPiLogo(g2d, logoX, logoY, logoSize);
|
||||
}
|
||||
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
// Draw 40 GPIO header pins and 4 PoE header pins
|
||||
drawPinHeader(g2d, 0, 44, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, 44, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,8 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardLogos;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -285,16 +287,16 @@ public class RaspberryPiPico extends AbstractMakerBoard {
|
||||
double holeCenterX = boardX + boardW / 2.0;
|
||||
double topHoleY = boardY + holeMarginY;
|
||||
double bottomHoleY = boardY + boardH - holeMarginY;
|
||||
drawMountingHole(g2d, holeCenterX - holeDistX, topHoleY, holeDiameter);
|
||||
drawMountingHole(g2d, holeCenterX + holeDistX, topHoleY, holeDiameter);
|
||||
drawMountingHole(g2d, holeCenterX - holeDistX, bottomHoleY, holeDiameter);
|
||||
drawMountingHole(g2d, holeCenterX + holeDistX, bottomHoleY, holeDiameter);
|
||||
MakerBoardPainter.drawMountingHole(g2d, holeCenterX - holeDistX, topHoleY, holeDiameter);
|
||||
MakerBoardPainter.drawMountingHole(g2d, holeCenterX + holeDistX, topHoleY, holeDiameter);
|
||||
MakerBoardPainter.drawMountingHole(g2d, holeCenterX - holeDistX, bottomHoleY, holeDiameter);
|
||||
MakerBoardPainter.drawMountingHole(g2d, holeCenterX + holeDistX, bottomHoleY, holeDiameter);
|
||||
|
||||
// Micro USB Connector
|
||||
double usbW = USB_MICRO_WIDTH.convertToPixels();
|
||||
double usbH = USB_MICRO_LENGTH.convertToPixels();
|
||||
double usbOverhang = new Size(1.3d, SizeUnit.mm).convertToPixels();
|
||||
drawMicroUsb(g2d, boardX + (boardW - usbW) / 2.0, boardY - usbOverhang, usbW, usbH, "USB");
|
||||
MakerBoardPainter.drawMicroUsb(g2d, boardX + (boardW - usbW) / 2.0, boardY - usbOverhang, usbW, usbH, "USB");
|
||||
|
||||
// BOOTSEL button, sitting left of the board center line
|
||||
double btnW = BOOTSEL_WIDTH.convertToPixels();
|
||||
@@ -302,7 +304,7 @@ public class RaspberryPiPico extends AbstractMakerBoard {
|
||||
double btnCenterX = boardX + boardW / 2.0 - BOOTSEL_OFFSET_X.convertToPixels();
|
||||
double btnX = btnCenterX - btnW / 2.0;
|
||||
double btnY = boardY + BOOTSEL_OFFSET_Y.convertToPixels();
|
||||
drawButton(g2d, btnX, btnY, btnW, btnH);
|
||||
MakerBoardPainter.drawButton(g2d, btnX, btnY, btnW, btnH);
|
||||
|
||||
// the label does not fit next to the button unless it is turned to read bottom to top,
|
||||
// the way the real board prints it
|
||||
@@ -322,7 +324,7 @@ public class RaspberryPiPico extends AbstractMakerBoard {
|
||||
double chipY = isW()
|
||||
? boardY + new Size(23.0d, SizeUnit.mm).convertToPixels() - new Size(0.1d, SizeUnit.in).convertToPixels()
|
||||
: boardY + new Size(23.0d, SizeUnit.mm).convertToPixels();
|
||||
drawChip(g2d, chipX, chipY, chipSize, chipSize, isV2() ? "RP2350" : "RP2040");
|
||||
MakerBoardPainter.drawChip(g2d, chipX, chipY, chipSize, chipSize, isV2() ? "RP2350" : "RP2040");
|
||||
|
||||
if (isW()) {
|
||||
double spacing = PIN_SPACING.convertToPixels();
|
||||
@@ -351,14 +353,14 @@ public class RaspberryPiPico extends AbstractMakerBoard {
|
||||
double wifiH = WIFI_LENGTH.convertToPixels();
|
||||
double wifiX = boardX + (boardW - wifiW) / 2.0;
|
||||
double wifiY = boardY + boardH - WIFI_OFFSET_Y.convertToPixels() - wifiH / 2.0;
|
||||
drawMetalConnector(g2d, wifiX, wifiY, wifiW, wifiH, "");
|
||||
MakerBoardPainter.drawMetalConnector(g2d, wifiX, wifiY, wifiW, wifiH, "");
|
||||
} else {
|
||||
// Raspberry Pi Logo at bottom of the board (~9mm height)
|
||||
double logoSize = new Size(9.0d, SizeUnit.mm).convertToPixels();
|
||||
double logoWidth = logoSize * 72.515 / 92.604;
|
||||
double logoX = boardX + (boardW - logoWidth) / 2.0;
|
||||
double logoY = boardY + new Size(35.5d, SizeUnit.mm).convertToPixels();
|
||||
drawRaspberryPiLogo(g2d, logoX, logoY, logoSize);
|
||||
MakerBoardLogos.drawRaspberryPiLogo(g2d, logoX, logoY, logoSize);
|
||||
|
||||
// DEBUG silkscreen text above SWD pins
|
||||
g2d.setColor(Color.WHITE);
|
||||
@@ -377,7 +379,7 @@ public class RaspberryPiPico extends AbstractMakerBoard {
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
if (headers) {
|
||||
drawPinHeader(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
}
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
|
||||
@@ -39,6 +39,8 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardLogos;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -244,13 +246,13 @@ public class RaspberryPiZero extends AbstractMakerBoard {
|
||||
if (!outlineMode) {
|
||||
// 4 Mounting holes (diameter 2.75mm, located 3.5mm from board edges)
|
||||
double holeDiameter = new Size(2.75d, SizeUnit.mm).convertToPixels();
|
||||
drawMountingHole(g2d, boardX + new Size(3.5d, SizeUnit.mm).convertToPixels(),
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + new Size(3.5d, SizeUnit.mm).convertToPixels(),
|
||||
boardY + new Size(3.5d, SizeUnit.mm).convertToPixels(), holeDiameter);
|
||||
drawMountingHole(g2d, boardX + new Size(3.5d, SizeUnit.mm).convertToPixels(),
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + new Size(3.5d, SizeUnit.mm).convertToPixels(),
|
||||
boardY + boardH - new Size(3.5d, SizeUnit.mm).convertToPixels(), holeDiameter);
|
||||
drawMountingHole(g2d, boardX + boardW - new Size(3.5d, SizeUnit.mm).convertToPixels(),
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - new Size(3.5d, SizeUnit.mm).convertToPixels(),
|
||||
boardY + new Size(3.5d, SizeUnit.mm).convertToPixels(), holeDiameter);
|
||||
drawMountingHole(g2d, boardX + boardW - new Size(3.5d, SizeUnit.mm).convertToPixels(),
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - new Size(3.5d, SizeUnit.mm).convertToPixels(),
|
||||
boardY + boardH - new Size(3.5d, SizeUnit.mm).convertToPixels(), holeDiameter);
|
||||
|
||||
// MicroSD card slot on the left edge
|
||||
@@ -258,14 +260,14 @@ public class RaspberryPiZero extends AbstractMakerBoard {
|
||||
double sdH = new Size(12.0d, SizeUnit.mm).convertToPixels();
|
||||
double sdX = boardX + new Size(1.5d, SizeUnit.mm).convertToPixels();
|
||||
double sdY = boardY + new Size(7.5d, SizeUnit.mm).convertToPixels();
|
||||
drawMetalConnector(g2d, sdX, sdY, sdW, sdH, "SD");
|
||||
MakerBoardPainter.drawMetalConnector(g2d, sdX, sdY, sdW, sdH, "SD");
|
||||
|
||||
// Mini HDMI Connector (center at X = 12.4mm, width = 11.2mm, height = 7.5mm, overhang = 1.5mm)
|
||||
double hdmiW = new Size(11.2d, SizeUnit.mm).convertToPixels();
|
||||
double hdmiH = new Size(7.5d, SizeUnit.mm).convertToPixels();
|
||||
double hdmiX = boardX + new Size(12.4d, SizeUnit.mm).convertToPixels() - hdmiW / 2.0;
|
||||
double hdmiY = boardY + boardH - new Size(6.0d, SizeUnit.mm).convertToPixels();
|
||||
drawMetalConnector(g2d, hdmiX, hdmiY, hdmiW, hdmiH, "HDMI");
|
||||
MakerBoardPainter.drawMetalConnector(g2d, hdmiX, hdmiY, hdmiW, hdmiH, "HDMI");
|
||||
|
||||
// Micro USB Data (center at X = 41.4mm, width = 7.5mm, height = 5.6mm, overhang = 1.4mm)
|
||||
double usbW = USB_MICRO_WIDTH.convertToPixels();
|
||||
@@ -273,33 +275,33 @@ public class RaspberryPiZero extends AbstractMakerBoard {
|
||||
double usbOverhang = new Size(1.4d, SizeUnit.mm).convertToPixels();
|
||||
double usbX = boardX + new Size(41.4d, SizeUnit.mm).convertToPixels() - usbW / 2.0;
|
||||
double usbY = boardY + boardH - usbH + usbOverhang;
|
||||
drawMicroUsb(g2d, usbX, usbY, usbW, usbH, "USB");
|
||||
MakerBoardPainter.drawMicroUsb(g2d, usbX, usbY, usbW, usbH, "USB");
|
||||
|
||||
// Micro USB Power (center at X = 54.0mm, width = 7.5mm, height = 5.6mm, overhang = 1.4mm)
|
||||
double pwrX = boardX + new Size(54.0d, SizeUnit.mm).convertToPixels() - usbW / 2.0;
|
||||
double pwrY = boardY + boardH - usbH + usbOverhang;
|
||||
drawMicroUsb(g2d, pwrX, pwrY, usbW, usbH, "PWR");
|
||||
MakerBoardPainter.drawMicroUsb(g2d, pwrX, pwrY, usbW, usbH, "PWR");
|
||||
|
||||
// Camera Connector (CSI) on right edge
|
||||
double csiW = new Size(3.2d, SizeUnit.mm).convertToPixels();
|
||||
double csiH = new Size(16.5d, SizeUnit.mm).convertToPixels();
|
||||
double csiX = boardX + boardW - new Size(4.2d, SizeUnit.mm).convertToPixels();
|
||||
double csiY = boardY + new Size(6.75d, SizeUnit.mm).convertToPixels();
|
||||
drawFpcConnector(g2d, csiX, csiY, csiW, csiH, true, "");
|
||||
MakerBoardPainter.drawFpcConnector(g2d, csiX, csiY, csiW, csiH, true, "");
|
||||
|
||||
// Main SoC chip (Broadcom BCM2835 / RP3A0)
|
||||
double socW = new Size(12.0d, SizeUnit.mm).convertToPixels();
|
||||
double socH = new Size(12.0d, SizeUnit.mm).convertToPixels();
|
||||
double socX = boardX + new Size(19.5d, SizeUnit.mm).convertToPixels();
|
||||
double socY = boardY + new Size(11.5d, SizeUnit.mm).convertToPixels();
|
||||
drawChip(g2d, socX, socY, socW, socH, "");
|
||||
MakerBoardPainter.drawChip(g2d, socX, socY, socW, socH, "");
|
||||
|
||||
// Raspberry Pi logo on SoC chip
|
||||
double logoSize = new Size(7.0d, SizeUnit.mm).convertToPixels();
|
||||
double logoW = logoSize * (72.51 / 92.604);
|
||||
double logoX = socX + (socW - logoW) / 2.0;
|
||||
double logoY = socY + (socH - logoSize) / 2.0;
|
||||
drawRaspberryPiLogo(g2d, logoX, logoY, logoSize);
|
||||
MakerBoardLogos.drawRaspberryPiLogo(g2d, logoX, logoY, logoSize);
|
||||
|
||||
// Version label to the right of the SoC. "Raspberry Pi Zero 2 W" overruns the board edge at
|
||||
// the title size, so step the font down when the label does not fit.
|
||||
@@ -351,7 +353,7 @@ public class RaspberryPiZero extends AbstractMakerBoard {
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
if (headers) {
|
||||
drawPinHeader(g2d, 0, 40, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, 40, outlineMode, drawingObserver);
|
||||
// RUN and TV are typically left unpopulated even with headers
|
||||
drawPcbSolderPads(g2d, 41, 2, true, outlineMode, drawingObserver);
|
||||
drawPcbSolderPads(g2d, 43, 1, false, outlineMode, drawingObserver);
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -382,7 +383,7 @@ public class Teensy extends AbstractMakerBoard {
|
||||
double usbH = USB_MICRO_LENGTH.convertToPixels();
|
||||
double usbX = centerX - usbW / 2.0;
|
||||
double usbY = boardY - new Size(1.0d, SizeUnit.mm).convertToPixels();
|
||||
drawMicroUsb(g2d, usbX, usbY, usbW, usbH, "USB");
|
||||
MakerBoardPainter.drawMicroUsb(g2d, usbX, usbY, usbW, usbH, "USB");
|
||||
|
||||
// Main MCU chip: NXP i.MX RT1062 BGA on the 4.x, Kinetis MK20DX256 LQFP-64 on the 3.2
|
||||
double chipW = isCompact()
|
||||
@@ -395,7 +396,7 @@ public class Teensy extends AbstractMakerBoard {
|
||||
double chipY = isCompact()
|
||||
? boardY + new Size(9.5d, SizeUnit.mm).convertToPixels() + new Size(0.1d, SizeUnit.in).convertToPixels()
|
||||
: boardY + new Size(19.0d, SizeUnit.mm).convertToPixels() + new Size(0.15d, SizeUnit.in).convertToPixels();
|
||||
drawChip(g2d, chipX, chipY, chipW, chipH,
|
||||
MakerBoardPainter.drawChip(g2d, chipX, chipY, chipW, chipH,
|
||||
getVersion() == TeensyVersion.Teensy_3_2 ? "MK20DX256" : "iMXRT1062");
|
||||
|
||||
// Pushbutton (Program button)
|
||||
@@ -405,7 +406,7 @@ public class Teensy extends AbstractMakerBoard {
|
||||
double btnY = isCompact()
|
||||
? boardY + PIN1_OFFSET_Y.convertToPixels() + 11.5 * PIN_SPACING.convertToPixels() - btnH / 2.0
|
||||
: boardY + new Size(35.5d, SizeUnit.mm).convertToPixels() + new Size(0.25d, SizeUnit.in).convertToPixels();
|
||||
drawButton(g2d, btnX, btnY, btnW, btnH);
|
||||
MakerBoardPainter.drawButton(g2d, btnX, btnY, btnW, btnH);
|
||||
|
||||
// Teensy 4.1 extras: Ethernet PHY + SD card slot
|
||||
if (getVersion() == TeensyVersion.Teensy_4_1) {
|
||||
@@ -414,7 +415,7 @@ public class Teensy extends AbstractMakerBoard {
|
||||
double sdH = new Size(12.0d, SizeUnit.mm).convertToPixels();
|
||||
double sdX = centerX - sdW / 2.0;
|
||||
double sdY = boardY + boardH - sdH;
|
||||
drawMetalConnector(g2d, sdX, sdY, sdW, sdH, "SD");
|
||||
MakerBoardPainter.drawMetalConnector(g2d, sdX, sdY, sdW, sdH, "SD");
|
||||
}
|
||||
|
||||
// Silkscreen "TEENSY" label
|
||||
@@ -433,7 +434,7 @@ public class Teensy extends AbstractMakerBoard {
|
||||
|
||||
// Render pin headers or gold solder pads with drill holes
|
||||
if (headers) {
|
||||
drawPinHeader(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
} else {
|
||||
drawSolderPads(g2d, outlineMode, drawingObserver);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -258,10 +259,10 @@ public class WemosD1Mini extends AbstractMakerBoard {
|
||||
|
||||
if (!outlineMode) {
|
||||
// Antenna (dark rectangle underneath + gold serpentine trace)
|
||||
drawPcbAntenna(g2d, moduleX, boardY, moduleW, moduleH);
|
||||
MakerBoardPainter.drawPcbAntenna(g2d, moduleX, boardY, moduleW, moduleH);
|
||||
|
||||
// ESP8266 Metal Shield (main chip module)
|
||||
drawMetalConnector(g2d, shieldX, shieldY, shieldW, shieldH, "ESP8266");
|
||||
MakerBoardPainter.drawMetalConnector(g2d, shieldX, shieldY, shieldW, shieldH, "ESP8266");
|
||||
|
||||
// Micro-USB Jack drawn with 0.5mm overhang at the bottom edge
|
||||
double usbW = USB_WIDTH.convertToPixels();
|
||||
@@ -269,7 +270,7 @@ public class WemosD1Mini extends AbstractMakerBoard {
|
||||
double usbOverhang = USB_MICRO_OVERHANG.convertToPixels();
|
||||
double usbX = (x + rowSpacing / 2.0) - usbW / 2.0;
|
||||
double usbY = bottomY - usbH + usbOverhang;
|
||||
drawMicroUsb(g2d, usbX, usbY, usbW, usbH, "USB");
|
||||
MakerBoardPainter.drawMicroUsb(g2d, usbX, usbY, usbW, usbH, "USB");
|
||||
|
||||
// Reset button: small black rectangle touching the board in the bottom left cutout, moved 2mm up
|
||||
double rstCutoutW = RST_CUTOUT_WIDTH.convertToPixels();
|
||||
@@ -313,7 +314,7 @@ public class WemosD1Mini extends AbstractMakerBoard {
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
if (headers) {
|
||||
drawPinHeader(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
} else {
|
||||
drawPcbSolderPads(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
}
|
||||
|
||||
+1
-1
@@ -176,7 +176,7 @@ public class A4988StepperDriver extends AbstractMakerBoard {
|
||||
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
+1
-1
@@ -190,7 +190,7 @@ public class ActiveBuzzerModule extends AbstractMakerBoard {
|
||||
}
|
||||
|
||||
g2d.setTransform(oldTx);
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
|
||||
+6
-5
@@ -37,6 +37,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -146,10 +147,10 @@ public class AnalogJoystickKY023 extends AbstractMakerBoard {
|
||||
|
||||
if (!outlineMode) {
|
||||
// 4 Mounting Holes in corners
|
||||
drawMountingHole(g2d, boardX + 16, boardY + 16, 16);
|
||||
drawMountingHole(g2d, boardX + 16, boardY + boardH - 16, 16);
|
||||
drawMountingHole(g2d, boardX + boardW - 40, boardY + 16, 16);
|
||||
drawMountingHole(g2d, boardX + boardW - 40, boardY + boardH - 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 16, boardY + 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 16, boardY + boardH - 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 40, boardY + 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 40, boardY + boardH - 16, 16);
|
||||
|
||||
// Metal Gimbal Frame (Center)
|
||||
double cx = boardX + (boardW - 30) / 2.0;
|
||||
@@ -183,7 +184,7 @@ public class AnalogJoystickKY023 extends AbstractMakerBoard {
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
// Draw 5 header pins
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -153,10 +154,10 @@ public class GPSModuleNEO6M extends AbstractMakerBoard {
|
||||
if (!outlineMode) {
|
||||
// 4 Small Mounting holes in the corners
|
||||
double holeMargin = 7.0;
|
||||
drawMountingHole(g2d, boardX + holeMargin, boardY + holeMargin, 8.0);
|
||||
drawMountingHole(g2d, boardX + holeMargin, boardY + boardH - holeMargin, 8.0);
|
||||
drawMountingHole(g2d, boardX + boardW - holeMargin, boardY + holeMargin, 8.0);
|
||||
drawMountingHole(g2d, boardX + boardW - holeMargin, boardY + boardH - holeMargin, 8.0);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + holeMargin, boardY + holeMargin, 8.0);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + holeMargin, boardY + boardH - holeMargin, 8.0);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - holeMargin, boardY + holeMargin, 8.0);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - holeMargin, boardY + boardH - holeMargin, 8.0);
|
||||
|
||||
// Silkscreen pin labels (VCC, RX, TX, GND) placed neatly next to left header
|
||||
g2d.setColor(Color.WHITE);
|
||||
@@ -219,7 +220,7 @@ public class GPSModuleNEO6M extends AbstractMakerBoard {
|
||||
}
|
||||
|
||||
g2d.setTransform(oldTx);
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ public class HC05Bluetooth extends AbstractMakerBoard {
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
// Draw 6 header pins
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
+6
-5
@@ -38,6 +38,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -167,10 +168,10 @@ public class INA219CurrentSensor extends AbstractMakerBoard {
|
||||
if (!outlineMode) {
|
||||
// 4 Large Gold Ring Mounting Holes in corners (20mm x 20mm pitch)
|
||||
double holeMargin = 10.0;
|
||||
drawMountingHole(g2d, boardX + holeMargin, boardY + holeMargin, 13.0);
|
||||
drawMountingHole(g2d, boardX + boardW - holeMargin, boardY + holeMargin, 13.0);
|
||||
drawMountingHole(g2d, boardX + holeMargin, boardY + boardH - holeMargin, 13.0);
|
||||
drawMountingHole(g2d, boardX + boardW - holeMargin, boardY + boardH - holeMargin, 13.0);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + holeMargin, boardY + holeMargin, 13.0);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - holeMargin, boardY + holeMargin, 13.0);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + holeMargin, boardY + boardH - holeMargin, 13.0);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - holeMargin, boardY + boardH - holeMargin, 13.0);
|
||||
|
||||
// Top Blue Screw Terminal Block (5.08mm 2-pin block)
|
||||
double termW = 44.0;
|
||||
@@ -281,7 +282,7 @@ public class INA219CurrentSensor extends AbstractMakerBoard {
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
// Draw bottom 6 header pins
|
||||
drawPins(g2d, 0, 6, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, 6, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
+7
-6
@@ -37,6 +37,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -163,10 +164,10 @@ public class L298NMotorDriver extends AbstractMakerBoard {
|
||||
|
||||
if (!outlineMode) {
|
||||
// 4 Mounting holes
|
||||
drawMountingHole(g2d, boardX + 20, boardY + 20, 20);
|
||||
drawMountingHole(g2d, boardX + 20, boardY + boardSizePx - 20, 20);
|
||||
drawMountingHole(g2d, boardX + boardSizePx - 20, boardY + 20, 20);
|
||||
drawMountingHole(g2d, boardX + boardSizePx - 20, boardY + boardSizePx - 20, 20);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 20, boardY + 20, 20);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 20, boardY + boardSizePx - 20, 20);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardSizePx - 20, boardY + 20, 20);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardSizePx - 20, boardY + boardSizePx - 20, 20);
|
||||
|
||||
// Large black aluminum heatsink in center
|
||||
double hsW = boardSizePx - 100;
|
||||
@@ -185,7 +186,7 @@ public class L298NMotorDriver extends AbstractMakerBoard {
|
||||
}
|
||||
|
||||
// L298 Multiwatt IC mounted to heatsink
|
||||
drawChip(g2d, hsX + (hsW - 100) / 2.0, hsY + hsH - 15, 100, 30, "L298N");
|
||||
MakerBoardPainter.drawChip(g2d, hsX + (hsW - 100) / 2.0, hsY + hsH - 15, 100, 30, "L298N");
|
||||
|
||||
// Logic header black block
|
||||
g2d.setColor(HEADER_BODY_COLOR);
|
||||
@@ -211,7 +212,7 @@ public class L298NMotorDriver extends AbstractMakerBoard {
|
||||
drawTerminalBlock(g2d, 5, 2, false, 1, 38.0, outlineMode, drawingObserver);
|
||||
|
||||
// Draw logic header pins
|
||||
drawPins(g2d, 7, 6, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 7, 6, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
+3
-2
@@ -37,6 +37,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -156,8 +157,8 @@ public class LM2596BuckConverter extends AbstractMakerBoard {
|
||||
|
||||
if (!outlineMode) {
|
||||
// 2 Diagonal Mounting holes
|
||||
drawMountingHole(g2d, boardX + 50, boardY + 16, 16);
|
||||
drawMountingHole(g2d, boardX + boardW - 50, boardY + boardH - 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 50, boardY + 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 50, boardY + boardH - 16, 16);
|
||||
|
||||
// Input Capacitor (Left)
|
||||
g2d.setColor(Color.LIGHT_GRAY);
|
||||
|
||||
+1
-1
@@ -164,7 +164,7 @@ public class LogicLevelConverter extends AbstractMakerBoard {
|
||||
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
+5
-4
@@ -37,6 +37,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -167,7 +168,7 @@ public class MB102PowerSupply extends AbstractMakerBoard {
|
||||
g2d.fill(new Ellipse2D.Double(boardX + 1, boardY + boardH / 2.0 - 5, 10, 10));
|
||||
|
||||
// USB-A Connector (Center)
|
||||
drawUsbA(g2d, boardX + 45, boardY + boardH / 2.0 - 22, 48, 44, "USB");
|
||||
MakerBoardPainter.drawUsbA(g2d, boardX + 45, boardY + boardH / 2.0 - 22, 48, 44, "USB");
|
||||
|
||||
// Push Button Latch Switch (Left-ish)
|
||||
g2d.setColor(Color.LIGHT_GRAY);
|
||||
@@ -180,8 +181,8 @@ public class MB102PowerSupply extends AbstractMakerBoard {
|
||||
g2d.fill(new Ellipse2D.Double(boardX + 85, boardY + 54, 10, 10));
|
||||
|
||||
// AMS1117 Voltage Regulators (3.3V and 5.0V)
|
||||
drawChip(g2d, boardX + 110, boardY + 70, 28, 22, "3.3V");
|
||||
drawChip(g2d, boardX + 110, boardY + boardH - 92, 28, 22, "5.0V");
|
||||
MakerBoardPainter.drawChip(g2d, boardX + 110, boardY + 70, 28, 22, "3.3V");
|
||||
MakerBoardPainter.drawChip(g2d, boardX + 110, boardY + boardH - 92, 28, 22, "5.0V");
|
||||
|
||||
// Voltage Selection Jumpers (Top & Bottom rail selectors)
|
||||
g2d.setColor(JUMPER_YELLOW);
|
||||
@@ -206,7 +207,7 @@ public class MB102PowerSupply extends AbstractMakerBoard {
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
// Draw header pins connecting to breadboard rails
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
+4
-3
@@ -37,6 +37,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -158,8 +159,8 @@ public class MOSFETSwitchModule extends AbstractMakerBoard {
|
||||
|
||||
if (!outlineMode) {
|
||||
// 2 Mounting Holes
|
||||
drawMountingHole(g2d, boardX + 14, boardY + 14, 14);
|
||||
drawMountingHole(g2d, boardX + 14, boardY + boardH - 14, 14);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 14, boardY + 14, 14);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 14, boardY + boardH - 14, 14);
|
||||
|
||||
// TO-220 Power MOSFET (Center)
|
||||
double mosX = boardX + 50;
|
||||
@@ -193,7 +194,7 @@ public class MOSFETSwitchModule extends AbstractMakerBoard {
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
// Draw control header pins on left
|
||||
drawPins(g2d, 0, 3, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, 3, outlineMode, drawingObserver);
|
||||
|
||||
// Draw dual terminal blocks on right matching PCBTerminalBlock style
|
||||
drawTerminalBlock(g2d, 3, 2, false, 1, 38.0, outlineMode, drawingObserver);
|
||||
|
||||
+2
-1
@@ -37,6 +37,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -197,7 +198,7 @@ public class MT3608BoostConverter extends AbstractMakerBoard {
|
||||
HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
|
||||
// MT3608 SOT23-6 Boost Controller IC (Bottom-Right / Center)
|
||||
drawChip(g2d, boardX + 150.0, boardY + 78.0, 26.0, 22.0, "3608");
|
||||
MakerBoardPainter.drawChip(g2d, boardX + 150.0, boardY + 78.0, 26.0, 22.0, "3608");
|
||||
|
||||
// Silkscreen Text Labels (placed above/below pads without overlapping)
|
||||
g2d.setColor(Color.WHITE);
|
||||
|
||||
+3
-2
@@ -35,6 +35,7 @@ import java.awt.geom.RoundRectangle2D;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -167,7 +168,7 @@ public class NRF24L01Transceiver extends AbstractMakerBoard {
|
||||
double icX = boardX + 88.0;
|
||||
double icY = boardY + 20.0;
|
||||
double icSize = 32.0;
|
||||
drawChip(g2d, icX, icY, icSize, icSize, "nRF24");
|
||||
MakerBoardPainter.drawChip(g2d, icX, icY, icSize, icSize, "nRF24");
|
||||
|
||||
// White corner silkscreen brackets around IC
|
||||
g2d.setColor(SILK_LINE_COLOR);
|
||||
@@ -255,7 +256,7 @@ public class NRF24L01Transceiver extends AbstractMakerBoard {
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
// Draw 8 header pins on top-left edge
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
+9
-8
@@ -38,6 +38,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -258,10 +259,10 @@ public class PCA9685ServoDriver extends AbstractMakerBoard {
|
||||
|
||||
if (!outlineMode) {
|
||||
// 4 Mounting holes with annular silver rings
|
||||
drawMountingHole(g2d, boardX + 16, boardY + 16, 15);
|
||||
drawMountingHole(g2d, boardX + 16, boardY + boardH - 16, 15);
|
||||
drawMountingHole(g2d, boardX + boardW - 16, boardY + 16, 15);
|
||||
drawMountingHole(g2d, boardX + boardW - 16, boardY + boardH - 16, 15);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 16, boardY + 16, 15);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 16, boardY + boardH - 16, 15);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 16, boardY + 16, 15);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 16, boardY + boardH - 16, 15);
|
||||
|
||||
// 2-Pin Screw Terminal Block — centered horizontally at top of the board
|
||||
double termW = 56.0;
|
||||
@@ -280,7 +281,7 @@ public class PCA9685ServoDriver extends AbstractMakerBoard {
|
||||
double chipH = 50.0;
|
||||
double chipX = centerX - chipW / 2.0;
|
||||
double chipY = termY + termH + 6.0;
|
||||
drawChip(g2d, chipX, chipY, chipW, chipH, "PCA9685");
|
||||
MakerBoardPainter.drawChip(g2d, chipX, chipY, chipW, chipH, "PCA9685");
|
||||
|
||||
// Large Filter Electrolytic Capacitor (Top-Left)
|
||||
double capX = boardX + 65.0;
|
||||
@@ -390,14 +391,14 @@ public class PCA9685ServoDriver extends AbstractMakerBoard {
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
// Draw I2C header pins (left & right)
|
||||
drawPins(g2d, 0, 6, false, outlineMode, drawingObserver);
|
||||
drawPins(g2d, 6, 6, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, 6, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 6, 6, outlineMode, drawingObserver);
|
||||
|
||||
// Draw screw terminal block matching PCBTerminalBlock style (V+, GND)
|
||||
drawTerminalBlock(g2d, 12, 2, true, -1, 34.0, outlineMode, drawingObserver);
|
||||
|
||||
// Draw all 48 servo channel pins
|
||||
drawPins(g2d, 14, 48, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 14, 48, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -145,10 +146,10 @@ public class RFIDRC522 extends AbstractMakerBoard {
|
||||
|
||||
if (!outlineMode) {
|
||||
// 4 Mounting Holes
|
||||
drawMountingHole(g2d, boardX + 16, boardY + 16, 16);
|
||||
drawMountingHole(g2d, boardX + 16, boardY + boardH - 16, 16);
|
||||
drawMountingHole(g2d, boardX + boardW - 40, boardY + 16, 16);
|
||||
drawMountingHole(g2d, boardX + boardW - 40, boardY + boardH - 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 16, boardY + 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 16, boardY + boardH - 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 40, boardY + 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 40, boardY + boardH - 16, 16);
|
||||
|
||||
// Large PCB Loop Antenna (Left side)
|
||||
double antX = boardX + 25;
|
||||
@@ -165,7 +166,7 @@ public class RFIDRC522 extends AbstractMakerBoard {
|
||||
// MFRC522 QFN IC (Center Right)
|
||||
double icX = boardX + boardW * 0.62;
|
||||
double icY = boardY + boardH / 2.0 - 18;
|
||||
drawChip(g2d, icX, icY, 36, 36, "RC522");
|
||||
MakerBoardPainter.drawChip(g2d, icX, icY, 36, 36, "RC522");
|
||||
|
||||
// 27.120 MHz Crystal
|
||||
g2d.setColor(CRYSTAL_BODY);
|
||||
@@ -190,7 +191,7 @@ public class RFIDRC522 extends AbstractMakerBoard {
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
// Draw 8 header pins
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -144,8 +145,8 @@ public class RTCModule extends AbstractMakerBoard {
|
||||
|
||||
if (!outlineMode) {
|
||||
// 2 Mounting holes
|
||||
drawMountingHole(g2d, boardX + boardW - 16, boardY + 16, 16);
|
||||
drawMountingHole(g2d, boardX + boardW - 16, boardY + boardH - 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 16, boardY + 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 16, boardY + boardH - 16, 16);
|
||||
|
||||
// Round CR2032 Coin Cell Battery holder
|
||||
double battD = boardH - 30;
|
||||
@@ -163,10 +164,10 @@ public class RTCModule extends AbstractMakerBoard {
|
||||
StringUtils.drawCenteredText(g2d, "CR2032", battX + battD / 2.0, battY + battD / 2.0, HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
|
||||
// DS3231 SOIC-16 IC
|
||||
drawChip(g2d, boardX + 35, boardY + 25, 65, 50, "DS3231");
|
||||
MakerBoardPainter.drawChip(g2d, boardX + 35, boardY + 25, 65, 50, "DS3231");
|
||||
|
||||
// AT24C32 EEPROM
|
||||
drawChip(g2d, boardX + 35, boardY + 90, 50, 35, "24C32");
|
||||
MakerBoardPainter.drawChip(g2d, boardX + 35, boardY + 90, 50, 35, "24C32");
|
||||
|
||||
g2d.setColor(Color.WHITE);
|
||||
g2d.setFont(SILK_FONT_SMALL);
|
||||
@@ -175,7 +176,7 @@ public class RTCModule extends AbstractMakerBoard {
|
||||
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -204,10 +205,10 @@ public class RelayModule extends AbstractMakerBoard {
|
||||
|
||||
if (!outlineMode) {
|
||||
// 4 Mounting holes
|
||||
drawMountingHole(g2d, boardX + 16, boardY + 16, 16);
|
||||
drawMountingHole(g2d, boardX + 16, boardY + boardH - 16, 16);
|
||||
drawMountingHole(g2d, boardX + boardW - 16, boardY + 16, 16);
|
||||
drawMountingHole(g2d, boardX + boardW - 16, boardY + boardH - 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 16, boardY + 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 16, boardY + boardH - 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 16, boardY + 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 16, boardY + boardH - 16, 16);
|
||||
|
||||
// Blue cubic relay blocks (Songle 10A style)
|
||||
int chCount = channels.getCount();
|
||||
@@ -244,7 +245,7 @@ public class RelayModule extends AbstractMakerBoard {
|
||||
}
|
||||
|
||||
// Draw control pins on right
|
||||
drawPins(g2d, chCount * 3, 2 + chCount, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, chCount * 3, 2 + chCount, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
+4
-3
@@ -37,6 +37,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -142,8 +143,8 @@ public class RotaryEncoderKY040 extends AbstractMakerBoard {
|
||||
|
||||
if (!outlineMode) {
|
||||
// 2 Mounting Holes
|
||||
drawMountingHole(g2d, boardX + 16, boardY + 16, 16);
|
||||
drawMountingHole(g2d, boardX + 16, boardY + boardH - 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 16, boardY + 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 16, boardY + boardH - 16, 16);
|
||||
|
||||
// Rotary Encoder Metal Body (Center Left)
|
||||
double cx = boardX + 90;
|
||||
@@ -177,7 +178,7 @@ public class RotaryEncoderKY040 extends AbstractMakerBoard {
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
// Draw 5 header pins
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -140,16 +141,16 @@ public class SDCardModule extends AbstractMakerBoard {
|
||||
|
||||
if (!outlineMode) {
|
||||
// 4 Mounting holes
|
||||
drawMountingHole(g2d, boardX + 15, boardY + 15, 16);
|
||||
drawMountingHole(g2d, boardX + 15, boardY + boardH - 15, 16);
|
||||
drawMountingHole(g2d, boardX + boardW - 15, boardY + 15, 16);
|
||||
drawMountingHole(g2d, boardX + boardW - 15, boardY + boardH - 15, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 15, boardY + 15, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 15, boardY + boardH - 15, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 15, boardY + 15, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 15, boardY + boardH - 15, 16);
|
||||
|
||||
// MicroSD metal push-push slot
|
||||
drawMetalConnector(g2d, boardX + boardW - 120, boardY + 25, 110, boardH - 50, "MicroSD");
|
||||
MakerBoardPainter.drawMetalConnector(g2d, boardX + boardW - 120, boardY + 25, 110, boardH - 50, "MicroSD");
|
||||
|
||||
// 74LVC125A Level Shifter chip
|
||||
drawChip(g2d, boardX + 45, boardY + 40, 60, 45, "74LVC125");
|
||||
MakerBoardPainter.drawChip(g2d, boardX + 45, boardY + 40, 60, 45, "74LVC125");
|
||||
|
||||
g2d.setColor(Color.WHITE);
|
||||
g2d.setFont(SILK_FONT_SMALL);
|
||||
@@ -158,7 +159,7 @@ public class SDCardModule extends AbstractMakerBoard {
|
||||
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -154,14 +155,14 @@ public class TP4056Charger extends AbstractMakerBoard {
|
||||
|
||||
if (!outlineMode) {
|
||||
// USB Type-C Connector (Left Edge)
|
||||
drawUsbC(g2d, boardX - 6, boardY + boardH / 2.0 - 18, 32, 36, "Type-C");
|
||||
MakerBoardPainter.drawUsbC(g2d, boardX - 6, boardY + boardH / 2.0 - 18, 32, 36, "Type-C");
|
||||
|
||||
// TP4056 Linear Charger IC (SOP-8)
|
||||
drawChip(g2d, boardX + 60, boardY + 20, 26, 32, "4056");
|
||||
MakerBoardPainter.drawChip(g2d, boardX + 60, boardY + 20, 26, 32, "4056");
|
||||
|
||||
// DW01A Battery Protection IC & Dual MOSFET
|
||||
drawChip(g2d, boardX + 110, boardY + 22, 18, 20, "DW01");
|
||||
drawChip(g2d, boardX + 110, boardY + boardH - 44, 20, 24, "8205");
|
||||
MakerBoardPainter.drawChip(g2d, boardX + 110, boardY + 22, 18, 20, "DW01");
|
||||
MakerBoardPainter.drawChip(g2d, boardX + 110, boardY + boardH - 44, 20, 24, "8205");
|
||||
|
||||
// Dual Status LEDs (Red = CHRG, Blue = STDBY)
|
||||
g2d.setColor(Color.RED);
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -175,10 +176,10 @@ public class ULN2003Driver extends AbstractMakerBoard {
|
||||
|
||||
if (!outlineMode) {
|
||||
// 4 Mounting Holes with silver solder rings in corners
|
||||
drawMountingHole(g2d, boardX + 16, boardY + 16, 16);
|
||||
drawMountingHole(g2d, boardX + 16, boardY + boardH - 16, 16);
|
||||
drawMountingHole(g2d, boardX + boardW - 16, boardY + 16, 16);
|
||||
drawMountingHole(g2d, boardX + boardW - 16, boardY + boardH - 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 16, boardY + 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 16, boardY + boardH - 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 16, boardY + 16, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 16, boardY + boardH - 16, 16);
|
||||
|
||||
// Left edge unpopulated through-holes (IN5, IN6, IN7) below IN4
|
||||
for (int i = 4; i < 7; i++) {
|
||||
@@ -288,13 +289,13 @@ public class ULN2003Driver extends AbstractMakerBoard {
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
// Draw left input header pins (4 populated pins: IN1..IN4)
|
||||
drawPins(g2d, 0, 4, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, 4, outlineMode, drawingObserver);
|
||||
|
||||
// Draw bottom power header pins (4 pins: GND, 5-12V, Jumper 1, Jumper 2)
|
||||
drawPins(g2d, 4, 4, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 4, 4, outlineMode, drawingObserver);
|
||||
|
||||
// Draw 5-Pin JST motor connector contacts
|
||||
drawPins(g2d, 8, 5, true, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 8, 5, outlineMode, drawingObserver);
|
||||
|
||||
if (!outlineMode) {
|
||||
// Black Jumper shunt cap installed over the two rightmost power selection pins (pins 6 & 7)
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -142,7 +143,7 @@ public class BME280Sensor extends AbstractMakerBoard {
|
||||
|
||||
if (!outlineMode) {
|
||||
// 1 Mounting Hole (Right side)
|
||||
drawMountingHole(g2d, boardX + boardW - 16, boardY + boardH - 20, 14);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 16, boardY + boardH - 20, 14);
|
||||
|
||||
// BME280 Metal Sensor Can with vent hole (Center)
|
||||
double sx = boardX + 35;
|
||||
@@ -156,7 +157,7 @@ public class BME280Sensor extends AbstractMakerBoard {
|
||||
g2d.fill(new Ellipse2D.Double(sx + 5, sy + 5, 4, 4));
|
||||
|
||||
// LDO Voltage Regulator (Left)
|
||||
drawChip(g2d, boardX + 12, boardY + boardH - 32, 16, 16, "");
|
||||
MakerBoardPainter.drawChip(g2d, boardX + 12, boardY + boardH - 32, 16, 16, "");
|
||||
|
||||
// Silk Screen Text
|
||||
g2d.setColor(Color.WHITE);
|
||||
@@ -167,7 +168,7 @@ public class BME280Sensor extends AbstractMakerBoard {
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
// Draw 6 header pins
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ public class DHTSensor extends AbstractMakerBoard {
|
||||
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
+1
-1
@@ -183,7 +183,7 @@ public class IRReceiverModule extends AbstractMakerBoard {
|
||||
}
|
||||
|
||||
g2d.setTransform(oldTx);
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -152,7 +153,7 @@ public class LDRSensorModule extends AbstractMakerBoard {
|
||||
g2d.drawLine((int) ldrX - 6, (int) ldrY + 4, (int) ldrX + 6, (int) ldrY + 4);
|
||||
|
||||
// LM393 comparator chip
|
||||
drawChip(g2d, boardX + 15, boardY + 40, boardW - 30, 45, "LM393");
|
||||
MakerBoardPainter.drawChip(g2d, boardX + 15, boardY + 40, boardW - 30, 45, "LM393");
|
||||
|
||||
// Blue sensitivity trimpot
|
||||
g2d.setColor(Color.decode("#0088CC"));
|
||||
@@ -168,7 +169,7 @@ public class LDRSensorModule extends AbstractMakerBoard {
|
||||
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -140,10 +141,10 @@ public class MPU6050 extends AbstractMakerBoard {
|
||||
|
||||
if (!outlineMode) {
|
||||
// Corner mounting hole
|
||||
drawMountingHole(g2d, boardX + boardW - 20, boardY + 20, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 20, boardY + 20, 16);
|
||||
|
||||
// Central QFN MPU-6050 chip
|
||||
drawChip(g2d, boardX + 35, boardY + 20, 45, 45, "6050");
|
||||
MakerBoardPainter.drawChip(g2d, boardX + 35, boardY + 20, 45, 45, "6050");
|
||||
|
||||
// Silkscreen
|
||||
g2d.setColor(Color.WHITE);
|
||||
@@ -153,7 +154,7 @@ public class MPU6050 extends AbstractMakerBoard {
|
||||
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -142,8 +143,8 @@ public class PIRMotionSensor extends AbstractMakerBoard {
|
||||
|
||||
if (!outlineMode) {
|
||||
// 2 Corner mounting holes
|
||||
drawMountingHole(g2d, boardX + 15, boardY + 15, 16);
|
||||
drawMountingHole(g2d, boardX + boardW - 15, boardY + 15, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + 15, boardY + 15, 16);
|
||||
MakerBoardPainter.drawMountingHole(g2d, boardX + boardW - 15, boardY + 15, 16);
|
||||
|
||||
// Large central white Fresnel lens dome
|
||||
double domeD = new Size(20.0d, SizeUnit.mm).convertToPixels();
|
||||
@@ -173,7 +174,7 @@ public class PIRMotionSensor extends AbstractMakerBoard {
|
||||
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
+4
-3
@@ -37,6 +37,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -163,10 +164,10 @@ public class SoilMoistureSensor extends AbstractMakerBoard {
|
||||
g2d.drawLine((int)(boardX + boardW * 0.35), (int)boardY + 4, (int)(boardX + boardW * 0.35), (int)(boardY + boardH - 4));
|
||||
|
||||
// NE555 / TLC555 Oscillator Timer IC (Handle area)
|
||||
drawChip(g2d, boardX + 45, boardY + boardH / 2.0 - 14, 28, 28, "555");
|
||||
MakerBoardPainter.drawChip(g2d, boardX + 45, boardY + boardH / 2.0 - 14, 28, 28, "555");
|
||||
|
||||
// 3.3V Voltage Regulator
|
||||
drawChip(g2d, boardX + 85, boardY + boardH / 2.0 - 10, 18, 20, "");
|
||||
MakerBoardPainter.drawChip(g2d, boardX + 85, boardY + boardH / 2.0 - 10, 18, 20, "");
|
||||
|
||||
// Silk Screen Text
|
||||
g2d.setColor(Color.WHITE);
|
||||
@@ -184,7 +185,7 @@ public class SoilMoistureSensor extends AbstractMakerBoard {
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
// Draw 3 header pins
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -152,7 +153,7 @@ public class TCRT5000Sensor extends AbstractMakerBoard {
|
||||
g2d.fill(new Ellipse2D.Double(boardX - 6, boardY + boardH / 2.0 + 1, 14, 14));
|
||||
|
||||
// LM393 Comparator IC (Center)
|
||||
drawChip(g2d, boardX + 45, boardY + boardH / 2.0 - 14, 30, 28, "393");
|
||||
MakerBoardPainter.drawChip(g2d, boardX + 45, boardY + boardH / 2.0 - 14, 30, 28, "393");
|
||||
|
||||
// Sensitivity Trimmer Potentiometer (Right Center)
|
||||
g2d.setColor(POT_BLUE);
|
||||
@@ -181,7 +182,7 @@ public class TCRT5000Sensor extends AbstractMakerBoard {
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
// Draw 4 header pins
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
+3
-2
@@ -37,6 +37,7 @@ import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -170,7 +171,7 @@ public class UltrasonicSensor extends AbstractMakerBoard {
|
||||
StringUtils.drawCenteredText(g2d, "R", cyl2X + cylD / 2.0, cylY + cylD / 2.0, HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
|
||||
// Center crystal oscillator & text
|
||||
drawMetalConnector(g2d, boardX + boardW / 2.0 - 20, boardY + 25, 40, 20, "4MHz");
|
||||
MakerBoardPainter.drawMetalConnector(g2d, boardX + boardW / 2.0 - 20, boardY + 25, 40, 20, "4MHz");
|
||||
|
||||
g2d.setColor(Color.WHITE);
|
||||
g2d.setFont(SILK_FONT_SMALL);
|
||||
@@ -179,7 +180,7 @@ public class UltrasonicSensor extends AbstractMakerBoard {
|
||||
|
||||
g2d.setTransform(oldTx);
|
||||
|
||||
drawPins(g2d, 0, controlPoints.length, false, outlineMode, drawingObserver);
|
||||
drawPinHeader(g2d, 0, controlPoints.length, outlineMode, drawingObserver);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import org.diylc.components.AbstractMakerBoard;
|
||||
import org.diylc.components.AbstractMakerBoard.UsbPortType;
|
||||
import org.diylc.components.MakerBoardPainter;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
@@ -68,48 +69,17 @@ public class UsbPortTest {
|
||||
BufferedImage img = new BufferedImage(400, 400, BufferedImage.TYPE_INT_ARGB);
|
||||
Graphics2D g2d = img.createGraphics();
|
||||
|
||||
TestMakerBoard board = new TestMakerBoard();
|
||||
board.testDrawMethods(g2d);
|
||||
MakerBoardPainter.drawMicroUsb(g2d, 10, 200, 60, 40, "USB");
|
||||
MakerBoardPainter.drawMicroUsb(g2d, 100, 200, 40, 60, "USB");
|
||||
MakerBoardPainter.drawUsbC(g2d, 10, 260, 60, 40, "Type-C");
|
||||
MakerBoardPainter.drawUsbC(g2d, 100, 260, 40, 60, "Type-C");
|
||||
MakerBoardPainter.drawUsbA(g2d, 10, 320, 60, 40, "USB 3.0");
|
||||
MakerBoardPainter.drawUsbA(g2d, 100, 320, 40, 60, "USB 2.0");
|
||||
MakerBoardPainter.drawUsbB(g2d, 200, 10, 60, 40, "USB");
|
||||
MakerBoardPainter.drawMetalConnector(g2d, 200, 150, 60, 40, "SHIELD");
|
||||
MakerBoardPainter.drawMetalConnector(g2d, 200, 220, 60, 40, null);
|
||||
MakerBoardPainter.drawMetalConnector(g2d, 250, 220, 60, 40, "");
|
||||
|
||||
g2d.dispose();
|
||||
}
|
||||
|
||||
static class TestMakerBoard extends AbstractMakerBoard {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected void updateControlPoints() {}
|
||||
|
||||
@Override
|
||||
public java.awt.Shape getBodyShape() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Graphics2D g2d, org.diylc.core.ComponentState componentState, boolean outlineMode,
|
||||
org.diylc.core.Project project, org.diylc.core.IDrawingObserver drawingObserver) {}
|
||||
|
||||
@Override
|
||||
public void drawIcon(Graphics2D g2d, int width, int height) {}
|
||||
|
||||
public void testDrawMethods(Graphics2D g2d) {
|
||||
// Horizontal and Vertical tests for all types
|
||||
for (UsbPortType type : UsbPortType.values()) {
|
||||
drawUsbPort(g2d, 10, 10, 60, 40, type, type.name());
|
||||
drawUsbPort(g2d, 100, 10, 40, 60, type, type.name());
|
||||
drawUsbPort(g2d, 10, 100, 60, 40, type, null);
|
||||
drawUsbPort(g2d, 100, 100, 40, 60, type, "");
|
||||
}
|
||||
// Direct method calls
|
||||
drawMicroUsb(g2d, 10, 200, 60, 40, "USB");
|
||||
drawMicroUsb(g2d, 100, 200, 40, 60, "USB");
|
||||
drawUsbC(g2d, 10, 260, 60, 40, "Type-C");
|
||||
drawUsbC(g2d, 100, 260, 40, 60, "Type-C");
|
||||
drawUsbA(g2d, 10, 320, 60, 40, "USB 3.0");
|
||||
drawUsbA(g2d, 100, 320, 40, 60, "USB 2.0");
|
||||
drawUsbB(g2d, 200, 10, 60, 40, "USB");
|
||||
drawMiniUsb(g2d, 200, 80, 60, 40, "USB");
|
||||
drawMetalConnector(g2d, 200, 150, 60, 40, "SHIELD");
|
||||
drawUsbPort(g2d, 200, 220, 60, 40, null, "FALLBACK");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user