Rollback Include layer id in continuity areas

This commit is contained in:
Bane Stojkovic
2022-11-22 18:10:03 +01:00
parent aaa24ad56a
commit 0f2e581a02
38 changed files with 109 additions and 73 deletions
@@ -110,10 +110,14 @@ public abstract class AbstractLeadedComponent<T> extends AbstractLabeledComponen
points[1] = new Point2D.Double(targetSize / 2, 0);
}
protected boolean IsCopperArea() {
protected boolean isCopperArea() {
return false;
}
protected int getLayerId() {
return 0;
}
protected Point2D[] getPoints() {
// convert old points to new
if (points.length == 2) {
@@ -149,7 +153,7 @@ public abstract class AbstractLeadedComponent<T> extends AbstractLabeledComponen
Shape shape = getBodyShape();
// If there's no body, just draw the line connecting the ending points.
if (shape == null) {
drawLead(g2d, componentState, drawingObserver, IsCopperArea());
drawLead(g2d, componentState, drawingObserver, isCopperArea());
return;
}
@@ -415,7 +419,7 @@ public abstract class AbstractLeadedComponent<T> extends AbstractLabeledComponen
private void drawLead(Graphics2D g2d, ComponentState componentState, IDrawingObserver observer, boolean isCopperArea) {
if (isCopperArea)
observer.startTrackingContinuityArea(true);
observer.startTrackingContinuityArea(getLayerId(), true);
float thickness = getLeadThickness();
@@ -195,7 +195,7 @@ public class Breadboard extends AbstractProtoBoard {
}
// draw transparent connections just to designate connections
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(1, true);
Composite oldComposite = g2d.getComposite();
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.0f));
@@ -380,7 +380,7 @@ public class EurorackStripboard extends AbstractProtoBoard {
int padX = (int) (x0 + (segment.x + i) * spacing);
int padY = (int) (y0 + (segment.y + j) * spacing);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(1, true);
drawingObserver.setContinuityMarker(segment.label);
g2d.setColor(padColor);
@@ -432,7 +432,7 @@ public class EurorackStripboard extends AbstractProtoBoard {
int padX = (int) (x0 + potPad.x * spacing);
int padY = (int) (y0 + (potPad.y + 8 * i) * spacing);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(1, true);
drawingObserver.setContinuityMarker(potPad.label + i);
g2d.setColor(padColor);
@@ -483,7 +483,7 @@ public class EurorackStripboard extends AbstractProtoBoard {
int padX = (int) (x0 + potPad.x * spacing);
int padY = (int) (y0 + potPad.y * spacing);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(1, true);
drawingObserver.setContinuityMarker(potPad.label);
g2d.setColor(padColor);
@@ -513,7 +513,7 @@ public class EurorackStripboard extends AbstractProtoBoard {
int padX = (int) (x0 + (6.5 + i) * spacing);
int padY = (int) (y0 + (36 + j) * spacing);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(1, true);
drawingObserver.setContinuityMarker(connectorLabels[i]);
g2d.setColor(padColor);
@@ -543,7 +543,7 @@ public class EurorackStripboard extends AbstractProtoBoard {
int padX = (int) (x0 + (17) * spacing);
int padY = (int) (y0 + 35.5 * spacing);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(1, true);
drawingObserver.setContinuityMarker("GND");
g2d.setColor(padColor);
@@ -140,7 +140,7 @@ public class ProtoBoard extends AbstractProtoBoard {
g2d.setColor(traceColor);
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(padSize / 4));
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(1, true);
// draw segment connectors
for (int y = 0; y < ROW_COUNT; y++) {
@@ -223,7 +223,7 @@ public class ProtoBoard extends AbstractProtoBoard {
// draw top mini pad traces
g2d.setColor(traceColor);
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(padSize / 4));
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(1, true);
g2d.drawLine((int) (point.getX() + (1 + SEGMENTS_SUM[3] + 0.5) * spacing), (int) (point.getY() + 1 * spacing),
(int) (point.getX() + (1 + SEGMENTS_SUM[3] + 0.5) * spacing), (int) (point.getY() + 3.5 * spacing));
g2d.drawLine((int) (point.getX() + (1 + SEGMENTS_SUM[3] + 1.5) * spacing + miniPadSize / 2), (int) (point.getY() + 1 * spacing),
@@ -255,7 +255,7 @@ public class ProtoBoard extends AbstractProtoBoard {
int padX = (int) (point.getX() + (xOffset + x) * spacing);
int padY = (int) (point.getY() + (yOffset + y) * spacing);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(1, true);
drawingObserver.setContinuityMarker("SEGMENT=" + segment + ";ROW=" + y);
g2d.setColor(padColor);
@@ -295,7 +295,7 @@ public class ProtoBoard extends AbstractProtoBoard {
g2d.drawRect((int) (point.getX() + (1 + SEGMENTS_SUM[3]) * spacing), (int) (point.getY() + (yOffset - 2 + y * (ROW_COUNT + 2)) * spacing),
(int)(3 * spacing), (int)spacing);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(1, true);
for (int x = 0; x < 3; x++) {
int padX = (int) (point.getX() + (1 + SEGMENTS_SUM[3] + 0.5 + x) * spacing);
@@ -344,7 +344,7 @@ public class ProtoBoard extends AbstractProtoBoard {
g2d.setColor(traceColor);
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(padSize / 4));
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(1, true);
// Draw two horizontal traces in the top-right section
g2d.drawLine((int) (point.getX() + width - 4 * spacing), (int) (point.getY() + 0.5 * spacing), (int) (point.getX() + width - (2) * spacing), (int) (point.getY() + 0.5 * spacing));
@@ -403,7 +403,7 @@ public class ProtoBoard extends AbstractProtoBoard {
for (int i = 0; i < padXs.length; i++) {
int padX = padXs[i];
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(1, true);
if (i == 0 || i == 2 || i == 5) {
switch (y) {
@@ -473,7 +473,7 @@ public class ProtoBoard extends AbstractProtoBoard {
for (int y = 0; y < ROW_COUNT; y++) {
g2d.setColor(padColor);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(1, true);
// top row
g2d.fillRect((int) (point.getX() + (1 + SEGMENTS_SUM[3] + 0.5) * spacing) + 1, (int) (point.getY() + (yOffset + y - 0.5d) * spacing + 2), miniPadSize, miniPadSize);
@@ -492,7 +492,7 @@ public class ProtoBoard extends AbstractProtoBoard {
g2d.setColor(undersidePadColor);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(1, true);
// bottom row
@@ -302,7 +302,7 @@ public class TagStrip extends AbstractTransparentComponent<String> implements IC
g2d.draw(mainArea);
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : TERMINAL_COLOR);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(1, true);
for (int i = 1; i < body.length; i++)
g2d.fill(body[i]);
drawingObserver.stopTrackingContinuityArea();
@@ -379,7 +379,7 @@ public class TerminalStrip extends AbstractTransparentComponent<String> implemen
g2d.draw(mainArea);
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : TERMINAL_COLOR);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(1, true);
for (int i = 1; i < body.length; i++)
g2d.fill(body[i]);
drawingObserver.stopTrackingContinuityArea();
@@ -84,7 +84,7 @@ public class TriPadBoard extends AbstractVeroBoard {
}
g2d.setColor(stripColor);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(1, true);
g2d.fillRect((int)(x + spacing - stripSize / 2), (int)(y - stripSize / 2), (int)(spacing * (spacesToDraw - 1) + stripSize),
stripSize);
drawingObserver.stopTrackingContinuityArea();
@@ -122,7 +122,7 @@ public class TriPadBoard extends AbstractVeroBoard {
}
g2d.setColor(stripColor);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(1, true);
g2d.fillRect((int)(x - stripSize / 2), (int)(y + spacing - stripSize / 2), stripSize, (int)(spacing * (spacesToDraw - 1)
+ stripSize));
drawingObserver.stopTrackingContinuityArea();
@@ -73,7 +73,7 @@ public class VeroBoard extends AbstractVeroBoard {
x = firstPoint.getX();
y += spacing;
g2d.setColor(stripColor);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(1, true);
g2d.fillRect((int)(x + spacing / 2), (int)(y - stripSize / 2), (int)(finalSecondPoint.getX() - spacing - x), stripSize);
drawingObserver.stopTrackingContinuityArea();
g2d.setColor(stripColor.darker());
@@ -91,7 +91,7 @@ public class VeroBoard extends AbstractVeroBoard {
x += spacing;
y = firstPoint.getY();
g2d.setColor(stripColor);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(1, true);
g2d.fillRect((int)(x - stripSize / 2), (int)(y + spacing / 2), stripSize, (int)(finalSecondPoint.getY() - spacing - y));
drawingObserver.stopTrackingContinuityArea();
g2d.setColor(stripColor.darker());
@@ -158,10 +158,15 @@ public class CopperTrace extends AbstractLeadedComponent<Void> {
}
@Override
protected boolean IsCopperArea() {
protected boolean isCopperArea() {
return true;
}
@Override
protected int getLayerId() {
return getLayer().getId();
}
@Override
public String getControlPointNodeName(int index) {
return null;
@@ -63,7 +63,7 @@ public class CurvedTrace extends AbstractCurvedComponent<Void> {
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
: color;
g2d.setColor(curveColor);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(getLayer().getId(), true);
g2d.draw(curve);
drawingObserver.stopTrackingContinuityArea();
}
@@ -72,7 +72,7 @@ public class Eyelet extends AbstractComponent<String> {
int holeDiameter = getClosestOdd((int) holeSize.convertToPixels());
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1f));
g2d.setColor(color);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(1, true);
g2d.fillOval((int)(point.getX() - diameter / 2), (int)(point.getY() - diameter / 2), diameter, diameter);
drawingObserver.stopTrackingContinuityArea();
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
@@ -73,7 +73,7 @@ public class GroundFill extends AbstractComponent<Void> {
xPoints[i] = (int)controlPoints[i].getX();
yPoints[i] = (int)controlPoints[i].getY();
}
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(getLayer().getId(), true);
g2d.fillPolygon(xPoints, yPoints, controlPoints.length);
drawingObserver.stopTrackingContinuityArea();
// Do not track any changes that follow because the whole board has been
@@ -69,7 +69,7 @@ public class SolderPad extends AbstractComponent<Void> {
double holeDiameter = getHoleSize().convertToPixels();
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
: color);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(getLayer().getId(), true);
if (type == Type.ROUND) {
g2d.fill(new Ellipse2D.Double(point.getX() - diameter / 2, point.getY() - diameter / 2, diameter, diameter));
} else if (type == Type.OVAL_HORIZONTAL) {
@@ -84,7 +84,7 @@ public class TraceCut extends AbstractComponent<Void> {
int holeSpacing = getClosestOdd(getHoleSpacing().convertToPixels());
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
: getBoardColor());
drawingObserver.startTrackingContinuityArea(false);
drawingObserver.startTrackingContinuityArea(1, false);
if (getOrientation() == OrientationHV.VERTICAL)
g2d.fillRect((int)(point.getX() - holeSpacing / 2 - cutWidth / 2), (int)(point.getY() - size / 2 - 1), cutWidth, size + 2);
else
@@ -93,7 +93,7 @@ public class TraceCut extends AbstractComponent<Void> {
} else {
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
: getBoardColor());
drawingObserver.startTrackingContinuityArea(false);
drawingObserver.startTrackingContinuityArea(1, false);
g2d.fillRoundRect((int)(point.getX() - size / 2), (int)(point.getY() - size / 2), size, size, size, size);
drawingObserver.stopTrackingContinuityArea();
@@ -70,7 +70,7 @@ public class Turret extends AbstractComponent<String> {
int holeDiameter = getClosestOdd((int) holeSize.convertToPixels());
g2d.setColor(color);
g2d.setStroke(ObjectCache.getInstance().fetchZoomableStroke(1f));
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(1, true);
g2d.fillOval((int)(point.getX() - diameter / 2), (int)(point.getY() - diameter / 2), diameter, diameter);
drawingObserver.stopTrackingContinuityArea();
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
@@ -127,7 +127,7 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
}
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(hashCode(), true);
g2d.fill(body[1]);
g2d.fill(body[2]);
if (body[3] != null)
@@ -127,7 +127,7 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
}
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(hashCode(), true);
g2d.fill(body[1]);
g2d.fill(body[2]);
if (body[3] != null)
@@ -123,7 +123,7 @@ public class PilotLampHolder extends AbstractMultiPartComponent<String> {
}
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(hashCode(), true);
g2d.fill(body[3]);
g2d.fill(body[4]);
@@ -114,7 +114,7 @@ public class RCAJack extends AbstractMultiPartComponent<String> {
}
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(hashCode(), true);
g2d.fill(body[1]);
g2d.fill(body[2]);
drawingObserver.stopTrackingContinuityArea();
@@ -121,7 +121,7 @@ public class RotarySelectorSwitch extends AbstractMultiPartComponent<String> {
}
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : TERMINAL_COLOR);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(hashCode(), true);
for (int i = 2; i < body.length; i++)
g2d.fill(body[i]);
drawingObserver.stopTrackingContinuityArea();
@@ -350,7 +350,7 @@ public class RotarySwitchOpen extends AbstractAngledComponent<RotarySwitchOpenTy
// Draw outer pins
if (configuration.getNeedsSecondLevel()) {
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(hashCode(), true);
for (int i = secondLevelStart; i < body.length; i++) {
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : pinColor);
g2d.fill(body[i]);
@@ -373,7 +373,7 @@ public class RotarySwitchOpen extends AbstractAngledComponent<RotarySwitchOpenTy
// Draw pins
for (int i = 1; i <= secondLevelStart; i++) {
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(hashCode(), true);
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : pinColor);
g2d.fill(body[i]);
drawingObserver.stopTrackingContinuityArea();
@@ -216,7 +216,7 @@ public class RotarySwitchSealed extends AbstractAngledComponent<RotarySwitchSeal
}
g2d.setColor(pinColor);
if (getMount() == Mount.CHASSIS)
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(hashCode(), true);
g2d.fill(pinShape);
drawingObserver.stopTrackingContinuityArea();
g2d.setColor(pinColor.darker());
@@ -76,7 +76,7 @@ public class SwitchLatchingSymbol
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke((float) (terminalSize / 4)));
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(hashCode(), true);
for (int i = 0; i < controlPoints.length; i++) {
Ellipse2D.Double terminal = new Ellipse2D.Double(controlPoints[i].getX() - terminalSize / 2,
@@ -191,7 +191,7 @@ public class S1Switch extends AbstractTransparentComponent<Void> implements ISwi
g2d.drawOval((int)(p.getX() - padDiameter / 2), (int)(p.getY() - padDiameter / 2), padDiameter, padDiameter);
} else {
g2d.setColor(PAD_COLOR);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(hashCode(), true);
g2d.fillOval((int)(p.getX() - padDiameter / 2), (int)(p.getY() - padDiameter / 2), padDiameter, padDiameter);
drawingObserver.stopTrackingContinuityArea();
g2d.setColor(PAD_COLOR.darker());
@@ -93,7 +93,7 @@ public class CommonNode extends AbstractComponent<String> implements ICommonNode
}
g2d.setColor(bgColor);
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(text.hashCode(), true);
g2d.fill(rect);
drawingObserver.stopTrackingContinuityArea();
drawingObserver.stopTracking();
@@ -279,11 +279,11 @@ public class PotentiometerPanel extends AbstractPotentiometer {
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
}
if (!outlineMode) {
if (i == 3)
drawingObserver.startTrackingContinuityArea(true);
// if (i == 3)
// drawingObserver.startTrackingContinuityArea(true);
g2d.fill(shape);
if (i == 3)
drawingObserver.stopTrackingContinuityArea();
// if (i == 3)
// drawingObserver.stopTrackingContinuityArea();
}
g2d.setComposite(oldComposite);
Color finalBorderColor;
@@ -248,7 +248,7 @@ public class Jumbo4PinTubeSocket extends AbstractAngledComponent<String> {
Shape terminalShape = body[1];
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getTerminalColor());
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(hashCode(), true);
g2d.fill(terminalShape);
drawingObserver.stopTrackingContinuityArea();
@@ -287,7 +287,7 @@ public class TubeSocket extends AbstractAngledComponent<String> {
}
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : PIN_COLOR);
if (getMount() == Mount.CHASSIS)
drawingObserver.startTrackingContinuityArea(true);
drawingObserver.startTrackingContinuityArea(hashCode(), true);
g2d.fill(pinShape);
drawingObserver.stopTrackingContinuityArea();
if (!outlineMode) {