mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
Highlight connected areas through copper traces, leads, jumpers, etc...
This commit is contained in:
@@ -376,8 +376,10 @@ public class TerminalStrip extends AbstractTransparentComponent<String> {
|
||||
g2d.setColor(finalBorderColor);
|
||||
g2d.draw(mainArea);
|
||||
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : TERMINAL_COLOR);
|
||||
g2d.fill(terminalArea);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : TERMINAL_COLOR);
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
g2d.fill(terminalArea);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
|
||||
Color finalTerminalBorderColor;
|
||||
if (outlineMode) {
|
||||
|
||||
@@ -94,9 +94,11 @@ public class TriPadBoard extends AbstractBoard {
|
||||
spacesToDraw = (remainingSpace - stripSize) / spacing;
|
||||
}
|
||||
|
||||
g2d.setColor(stripColor);
|
||||
g2d.setColor(stripColor);
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
g2d.fillRect(p.x + spacing - stripSize / 2, p.y - stripSize / 2, spacing * (spacesToDraw - 1) + stripSize,
|
||||
stripSize);
|
||||
stripSize);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
g2d.setColor(stripColor.darker());
|
||||
|
||||
g2d.drawRect(p.x + spacing - stripSize / 2, p.y - stripSize / 2, spacing * (spacesToDraw - 1) + stripSize,
|
||||
@@ -130,9 +132,11 @@ public class TriPadBoard extends AbstractBoard {
|
||||
spacesToDraw = (remainingSpace - stripSize) / spacing;
|
||||
}
|
||||
|
||||
g2d.setColor(stripColor);
|
||||
g2d.setColor(stripColor);
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
g2d.fillRect(p.x - stripSize / 2, p.y + spacing - stripSize / 2, stripSize, spacing * (spacesToDraw - 1)
|
||||
+ stripSize);
|
||||
+ stripSize);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
g2d.setColor(stripColor.darker());
|
||||
g2d.drawRect(p.x - stripSize / 2, p.y + spacing - stripSize / 2, stripSize, spacing * (spacesToDraw - 1)
|
||||
+ stripSize);
|
||||
|
||||
@@ -84,8 +84,10 @@ public class VeroBoard extends AbstractBoard {
|
||||
while (p.y < secondPoint.y - spacing) {
|
||||
p.x = firstPoint.x;
|
||||
p.y += spacing;
|
||||
g2d.setColor(stripColor);
|
||||
g2d.fillRect(p.x + spacing / 2, p.y - stripSize / 2, secondPoint.x - spacing - p.x, stripSize);
|
||||
g2d.setColor(stripColor);
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
g2d.fillRect(p.x + spacing / 2, p.y - stripSize / 2, secondPoint.x - spacing - p.x, stripSize);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
g2d.setColor(stripColor.darker());
|
||||
g2d.drawRect(p.x + spacing / 2, p.y - stripSize / 2, secondPoint.x - spacing - p.x, stripSize);
|
||||
while (p.x < secondPoint.x - spacing - holeSize) {
|
||||
@@ -100,8 +102,10 @@ public class VeroBoard extends AbstractBoard {
|
||||
while (p.x < secondPoint.x - spacing) {
|
||||
p.x += spacing;
|
||||
p.y = firstPoint.y;
|
||||
g2d.setColor(stripColor);
|
||||
g2d.fillRect(p.x - stripSize / 2, p.y + spacing / 2, stripSize, secondPoint.y - spacing - p.y);
|
||||
g2d.setColor(stripColor);
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
g2d.fillRect(p.x - stripSize / 2, p.y + spacing / 2, stripSize, secondPoint.y - spacing - p.y);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
g2d.setColor(stripColor.darker());
|
||||
g2d.drawRect(p.x - stripSize / 2, p.y + spacing / 2, stripSize, secondPoint.y - spacing - p.y);
|
||||
while (p.y < secondPoint.y - spacing - holeSize) {
|
||||
|
||||
@@ -24,13 +24,14 @@ package org.diylc.components.connectivity;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.CubicCurve2D;
|
||||
|
||||
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.PCBLayer;
|
||||
import org.diylc.components.AbstractCurvedComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
import org.diylc.core.annotations.BomPolicy;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
@@ -58,14 +59,16 @@ public class CurvedTrace extends AbstractCurvedComponent<Void> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawCurve(CubicCurve2D curve, Graphics2D g2d, ComponentState componentState) {
|
||||
protected void drawCurve(CubicCurve2D curve, Graphics2D g2d, ComponentState componentState, IDrawingObserver drawingObserver) {
|
||||
float thickness = (float) size.convertToPixels();
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(thickness));
|
||||
Color curveColor =
|
||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||
: color;
|
||||
g2d.setColor(curveColor);
|
||||
g2d.draw(curve);
|
||||
g2d.setColor(curveColor);
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
g2d.draw(curve);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
}
|
||||
|
||||
@EditableProperty(name = "Width")
|
||||
|
||||
@@ -24,12 +24,13 @@ package org.diylc.components.connectivity;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.CubicCurve2D;
|
||||
|
||||
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.components.AbstractCurvedComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
import org.diylc.core.annotations.BomPolicy;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
@@ -38,7 +39,7 @@ import org.diylc.utils.Constants;
|
||||
@ComponentDescriptor(name = "Hookup Wire", author = "Branislav Stojkovic", category = "Connectivity",
|
||||
instanceNamePrefix = "W", description = "Flexible wire with two control points", zOrder = IDIYComponent.COMPONENT,
|
||||
flexibleZOrder = true, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
|
||||
transformer = SimpleComponentTransformer.class)
|
||||
transformer = SimpleComponentTransformer.class, continuity = true)
|
||||
public class HookupWire extends AbstractCurvedComponent<Void> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -54,7 +55,7 @@ public class HookupWire extends AbstractCurvedComponent<Void> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawCurve(CubicCurve2D curve, Graphics2D g2d, ComponentState componentState) {
|
||||
protected void drawCurve(CubicCurve2D curve, Graphics2D g2d, ComponentState componentState, IDrawingObserver drawingObserver) {
|
||||
int thickness =
|
||||
(int) (Math.pow(Math.E, -1.12436 - 0.11594 * gauge.getValue()) * Constants.PIXELS_PER_INCH * (1 + 2 * INSULATION_THICKNESS_PCT));
|
||||
Color curveColor =
|
||||
|
||||
@@ -40,7 +40,7 @@ import org.diylc.core.measures.Size;
|
||||
@ComponentDescriptor(name = "Jumper", author = "Branislav Stojkovic", category = "Connectivity",
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "J", description = "",
|
||||
zOrder = IDIYComponent.COMPONENT, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
|
||||
transformer = SimpleComponentTransformer.class)
|
||||
transformer = SimpleComponentTransformer.class, continuity = true)
|
||||
public class Jumper extends AbstractLeadedComponent<Void> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -77,16 +77,20 @@ public class TraceCut extends AbstractComponent<Void> {
|
||||
if (getCutBetweenHoles()) {
|
||||
int holeSpacing = getClosestOdd(getHoleSpacing().convertToPixels());
|
||||
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||
: boardColor);
|
||||
g2d.fillRect(point.x - holeSpacing / 2 - cutWidth / 2, point.y - size / 2 - 1, cutWidth, size + 2);
|
||||
: boardColor);
|
||||
drawingObserver.startTrackingContinuityArea(false);
|
||||
g2d.fillRect(point.x - holeSpacing / 2 - cutWidth / 2, point.y - size / 2 - 1, cutWidth, size + 2);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
} else {
|
||||
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||
: boardColor);
|
||||
g2d.fillRoundRect(point.x - size / 2, point.y - size / 2, size, size, size, size);
|
||||
: boardColor);
|
||||
drawingObserver.startTrackingContinuityArea(false);
|
||||
g2d.fillRoundRect(point.x - size / 2, point.y - size / 2, size, size, size, size);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
|
||||
g2d.setColor(Constants.CANVAS_COLOR);
|
||||
int holeSize = getClosestOdd((int) HOLE_SIZE.convertToPixels());
|
||||
g2d.fillOval(point.x - holeSize / 2, point.y - holeSize / 2, holeSize, holeSize);
|
||||
int holeSize = getClosestOdd((int) HOLE_SIZE.convertToPixels());
|
||||
g2d.fillOval(point.x - holeSize / 2, point.y - holeSize / 2, holeSize, holeSize);
|
||||
g2d.setColor(boardColor.darker());
|
||||
g2d.drawOval(point.x - holeSize / 2, point.y - holeSize / 2, holeSize, holeSize);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user