Trace cuts can be placed between two holes for tighter layouts

This commit is contained in:
bancika
2013-04-29 14:16:25 +00:00
parent 689ddebdb8
commit ac81b30e8e
2 changed files with 13 additions and 4 deletions
@@ -34,7 +34,7 @@ public class TraceCut extends AbstractComponent<Void> {
private Color fillColor = FILL_COLOR; private Color fillColor = FILL_COLOR;
private Color borderColor = BORDER_COLOR; private Color borderColor = BORDER_COLOR;
private Color boardColor = AbstractBoard.BOARD_COLOR; private Color boardColor = AbstractBoard.BOARD_COLOR;
private boolean cutBetweenHoles = false; private Boolean cutBetweenHoles = true;
private Size holeSpacing = VeroBoard.SPACING; private Size holeSpacing = VeroBoard.SPACING;
protected Point point = new Point(0, 0); protected Point point = new Point(0, 0);
@@ -46,10 +46,10 @@ public class TraceCut extends AbstractComponent<Void> {
if (checkPointsClipped(g2d.getClip())) { if (checkPointsClipped(g2d.getClip())) {
return; return;
} }
int size = getClosestOdd((int) this.size.convertToPixels()); int size = getClosestOdd((int) this.size.convertToPixels());
int holeSpacing = getClosestOdd(this.holeSpacing.convertToPixels());
int cutWidth = getClosestOdd((int) CUT_WIDTH.convertToPixels()); int cutWidth = getClosestOdd((int) CUT_WIDTH.convertToPixels());
if (cutBetweenHoles) { if (getCutBetweenHoles()) {
int holeSpacing = getClosestOdd(getHoleSpacing().convertToPixels());
g2d g2d
.setColor(componentState == ComponentState.SELECTED .setColor(componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
@@ -147,6 +147,9 @@ public class TraceCut extends AbstractComponent<Void> {
@EditableProperty(name = "Cut between holes") @EditableProperty(name = "Cut between holes")
public boolean getCutBetweenHoles() { public boolean getCutBetweenHoles() {
if (cutBetweenHoles == null) {
cutBetweenHoles = false;
}
return cutBetweenHoles; return cutBetweenHoles;
} }
@@ -156,6 +159,9 @@ public class TraceCut extends AbstractComponent<Void> {
@EditableProperty(name = "Board") @EditableProperty(name = "Board")
public Color getBoardColor() { public Color getBoardColor() {
if (boardColor == null) {
boardColor = AbstractBoard.BOARD_COLOR;
}
return boardColor; return boardColor;
} }
@@ -165,6 +171,9 @@ public class TraceCut extends AbstractComponent<Void> {
@EditableProperty(name = "Hole spacing") @EditableProperty(name = "Hole spacing")
public Size getHoleSpacing() { public Size getHoleSpacing() {
if (holeSpacing == null) {
holeSpacing = VeroBoard.SPACING;
}
return holeSpacing; return holeSpacing;
} }