Traces, curved traces, ground fills, solder pads and PCB text call their layer 'Board Side', like every other part, and count as Board Side components in code; the saved field is still 'layer'

This commit is contained in:
Bane Stojkovic
2026-11-11 21:15:26 +01:00
parent 7ae773ab77
commit aef300d902
13 changed files with 87 additions and 51 deletions
@@ -24,11 +24,11 @@ package org.diylc.core;
import org.diylc.common.PCBLayer;
/**
* Interface for components mounted on one side of a board, such as a resistor or an IC. The side
* Interface for components on one side of a board, such as a resistor, an IC or a trace. The side
* says where the part sits physically; it is separate from {@link ILayeredComponent}, which drives
* continuity, because the leads of a through-hole part connect to copper on both sides whichever
* side the part is mounted on. Components whose copper already has a layer (traces, pads, ground
* fills) do not implement it.
* side the part is mounted on. Copper implements it through {@link IPCBLayerComponent}, whose layer
* is its side and also drives its continuity.
*
* @author Branislav Stojkovic
*/
@@ -25,14 +25,27 @@ import org.diylc.common.PCBLayer;
/**
* Interface for copper drawn on a layer of a PCB, such as a trace, pad, ground fill or PCB text.
* Unlike {@link IBoardSideComponent}, the layer is where the copper itself is, and it also decides
* which other copper it connects to.
* The layer is the copper's board side, shown to the user as 'Board Side', but unlike the side of a
* mounted part it also decides which other copper the copper connects to.
*
* @author Branislav Stojkovic
*/
public interface IPCBLayerComponent {
public interface IPCBLayerComponent extends IBoardSideComponent {
PCBLayer getLayer();
void setLayer(PCBLayer layer);
/**
* @return the layer, with the deprecated inner layers counted as the bottom
*/
@Override
default PCBLayer getBoardSide() {
return getLayer() == PCBLayer._2 ? PCBLayer._2 : PCBLayer._1;
}
@Override
default void setBoardSide(PCBLayer boardSide) {
setLayer(boardSide);
}
}
@@ -26,12 +26,11 @@ import java.util.Collection;
import org.diylc.common.PCBLayer;
import org.diylc.core.IBoardSideComponent;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IPCBLayerComponent;
/**
* Puts components placed through an Underside Display mirror on the bottom of the board. A part
* that is mounted on a side goes to the bottom, copper with a {@link PCBLayer} goes to the bottom
* layer, and anything else is left as it is. Nothing is mirrored.
* Puts components placed through an Underside Display mirror on the bottom of the board. Parts and
* copper that have a board side go to the bottom, and anything else is left as it is. Nothing is
* mirrored.
*/
public class MirrorPlacement {
@@ -42,8 +41,6 @@ public class MirrorPlacement {
for (IDIYComponent<?> component : components) {
if (component instanceof IBoardSideComponent sided) {
sided.setBoardSide(PCBLayer._1);
} else if (component instanceof IPCBLayerComponent copper) {
copper.setLayer(PCBLayer._1);
}
}
}
@@ -657,6 +657,10 @@
<changeType>IMPROVEMENT</changeType>
<description>Inner layers 1 to 6 are no longer offered for traces, pads and other copper, since boards are two-sided; projects that use them still open unchanged</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType>
<description>The 'Layer' property of traces, curved traces, ground fills, solder pads and PCB text is now called 'Board Side', the same as on resistors, ICs and other parts</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>BUG_FIX</changeType>
<description>Rotated labels in pasted components and building blocks were drawn in the wrong place and at the wrong angle while following the mouse, until the components were placed</description>