mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
editable board spacing
This commit is contained in:
Binary file not shown.
+15
-4
@@ -11,6 +11,7 @@ import org.diylc.core.ComponentState;
|
|||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Size;
|
import org.diylc.core.measures.Size;
|
||||||
import org.diylc.core.measures.SizeUnit;
|
import org.diylc.core.measures.SizeUnit;
|
||||||
import org.diylc.utils.Constants;
|
import org.diylc.utils.Constants;
|
||||||
@@ -29,6 +30,7 @@ public class PerfBoard extends AbstractBoard {
|
|||||||
private static Size HOLE_SIZE = new Size(0.8d, SizeUnit.mm);
|
private static Size HOLE_SIZE = new Size(0.8d, SizeUnit.mm);
|
||||||
|
|
||||||
// private Area copperArea;
|
// private Area copperArea;
|
||||||
|
private Size spacing = SPACING;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState, Project project) {
|
public void draw(Graphics2D g2d, ComponentState componentState, Project project) {
|
||||||
@@ -55,11 +57,11 @@ public class PerfBoard extends AbstractBoard {
|
|||||||
int holeRadius = HOLE_SIZE.convertToPixels() / 2;
|
int holeRadius = HOLE_SIZE.convertToPixels() / 2;
|
||||||
g2d.setStroke(new BasicStroke(radius));
|
g2d.setStroke(new BasicStroke(radius));
|
||||||
|
|
||||||
while (p.y < controlPoints[1].y - SPACING.convertToPixels()) {
|
while (p.y < controlPoints[1].y - spacing.convertToPixels()) {
|
||||||
p.x = controlPoints[0].x;
|
p.x = controlPoints[0].x;
|
||||||
p.y += SPACING.convertToPixels();
|
p.y += spacing.convertToPixels();
|
||||||
while (p.x < controlPoints[1].x - SPACING.convertToPixels()) {
|
while (p.x < controlPoints[1].x - spacing.convertToPixels()) {
|
||||||
p.x += SPACING.convertToPixels();
|
p.x += spacing.convertToPixels();
|
||||||
g2d.setColor(COPPER_COLOR);
|
g2d.setColor(COPPER_COLOR);
|
||||||
g2d.fillOval(p.x - radius, p.y - radius, radius * 2, radius * 2);
|
g2d.fillOval(p.x - radius, p.y - radius, radius * 2, radius * 2);
|
||||||
g2d.setColor(Constants.CANVAS_COLOR);
|
g2d.setColor(Constants.CANVAS_COLOR);
|
||||||
@@ -124,6 +126,15 @@ public class PerfBoard extends AbstractBoard {
|
|||||||
// return copperArea;
|
// return copperArea;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
@EditableProperty
|
||||||
|
public Size getSpacing() {
|
||||||
|
return spacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpacing(Size spacing) {
|
||||||
|
this.spacing = spacing;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Color getBoardColor() {
|
protected Color getBoardColor() {
|
||||||
return BOARD_COLOR;
|
return BOARD_COLOR;
|
||||||
|
|||||||
+16
-5
@@ -10,6 +10,7 @@ import org.diylc.core.ComponentState;
|
|||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.Project;
|
import org.diylc.core.Project;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Size;
|
import org.diylc.core.measures.Size;
|
||||||
import org.diylc.core.measures.SizeUnit;
|
import org.diylc.core.measures.SizeUnit;
|
||||||
import org.diylc.utils.Constants;
|
import org.diylc.utils.Constants;
|
||||||
@@ -28,6 +29,7 @@ public class VeroBoard extends AbstractBoard {
|
|||||||
private static Size HOLE_SIZE = new Size(0.8d, SizeUnit.mm);
|
private static Size HOLE_SIZE = new Size(0.8d, SizeUnit.mm);
|
||||||
|
|
||||||
// private Area copperArea;
|
// private Area copperArea;
|
||||||
|
private Size spacing = SPACING;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState, Project project) {
|
public void draw(Graphics2D g2d, ComponentState componentState, Project project) {
|
||||||
@@ -53,14 +55,14 @@ public class VeroBoard extends AbstractBoard {
|
|||||||
int stripSize = STRIP_SIZE.convertToPixels() / 2 * 2;
|
int stripSize = STRIP_SIZE.convertToPixels() / 2 * 2;
|
||||||
int holeRadius = HOLE_SIZE.convertToPixels() / 2;
|
int holeRadius = HOLE_SIZE.convertToPixels() / 2;
|
||||||
|
|
||||||
while (p.y < controlPoints[1].y - SPACING.convertToPixels()) {
|
while (p.y < controlPoints[1].y - spacing.convertToPixels()) {
|
||||||
p.x = controlPoints[0].x;
|
p.x = controlPoints[0].x;
|
||||||
p.y += SPACING.convertToPixels();
|
p.y += spacing.convertToPixels();
|
||||||
g2d.setColor(COPPER_COLOR);
|
g2d.setColor(COPPER_COLOR);
|
||||||
g2d.fillRect(p.x + SPACING.convertToPixels() / 2, p.y - stripSize / 2,
|
g2d.fillRect(p.x + SPACING.convertToPixels() / 2, p.y - stripSize / 2,
|
||||||
controlPoints[1].x - SPACING.convertToPixels() - p.x, stripSize);
|
controlPoints[1].x - spacing.convertToPixels() - p.x, stripSize);
|
||||||
while (p.x < controlPoints[1].x - SPACING.convertToPixels()) {
|
while (p.x < controlPoints[1].x - spacing.convertToPixels()) {
|
||||||
p.x += SPACING.convertToPixels();
|
p.x += spacing.convertToPixels();
|
||||||
g2d.setColor(Constants.CANVAS_COLOR);
|
g2d.setColor(Constants.CANVAS_COLOR);
|
||||||
g2d
|
g2d
|
||||||
.fillOval(p.x - holeRadius, p.y - holeRadius, holeRadius * 2,
|
.fillOval(p.x - holeRadius, p.y - holeRadius, holeRadius * 2,
|
||||||
@@ -123,6 +125,15 @@ public class VeroBoard extends AbstractBoard {
|
|||||||
// return copperArea;
|
// return copperArea;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
@EditableProperty
|
||||||
|
public Size getSpacing() {
|
||||||
|
return spacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpacing(Size spacing) {
|
||||||
|
this.spacing = spacing;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Color getBoardColor() {
|
protected Color getBoardColor() {
|
||||||
return BOARD_COLOR;
|
return BOARD_COLOR;
|
||||||
|
|||||||
Reference in New Issue
Block a user